code
stringlengths 1
2.08M
| language
stringclasses 1
value |
|---|---|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'eo',
{
euro: 'Eŭrosigno',
lsquo: 'Supra 6-citilo',
rsquo: 'Supra 9-citilo',
ldquo: 'Supra 66-citilo',
rdquo: 'Supra 99-citilo',
ndash: 'Streketo',
mdash: 'Substreko',
iexcl: 'Renversita krisigno',
cent: 'Cendosigno',
pound: 'Pundosigno',
curren: 'Monersigno',
yen: 'Enosigno',
brvbar: 'Rompita vertikala streko',
sect: 'Kurba paragrafo',
uml: 'Tremao',
copy: 'Kopirajtosigno',
ordf: 'Adjektiva numerfinaĵo',
laquo: 'Duobla malplio-citilo',
not: 'Negohoko',
reg: 'Registrita marko',
macr: 'Superstreko',
deg: 'Gradosigno',
sup2: 'Supra indico 2',
sup3: 'Supra indico 3',
acute: 'Dekstra korno',
micro: 'Mikrosigno',
para: 'Rekta paragrafo',
middot: 'Meza punkto',
cedil: 'Zoeto',
sup1: 'Supra indico 1',
ordm: 'Substantiva numerfinaĵo',
raquo: 'Duobla plio-citilo',
frac14: 'Kvaronosigno',
frac12: 'Duonosigno',
frac34: 'Trikvaronosigno',
iquest: 'renversita demandosigno',
Agrave: 'Latina ĉeflitero A kun liva korno',
Aacute: 'Latina ĉeflitero A kun dekstra korno',
Acirc: 'Latina ĉeflitero A kun ĉapelo',
Atilde: 'Latina ĉeflitero A kun tildo',
Auml: 'Latina ĉeflitero A kun tremao',
Aring: 'Latina ĉeflitero A kun superringo',
AElig: 'Latina ĉeflitera ligaturo Æ',
Ccedil: 'Latina ĉeflitero C kun zoeto',
Egrave: 'Latina ĉeflitero E kun liva korno',
Eacute: 'Latina ĉeflitero E kun dekstra korno',
Ecirc: 'Latina ĉeflitero E kun ĉapelo',
Euml: 'Latina ĉeflitero E kun tremao',
Igrave: 'Latina ĉeflitero I kun liva korno',
Iacute: 'Latina ĉeflitero I kun dekstra korno',
Icirc: 'Latina ĉeflitero I kun ĉapelo',
Iuml: 'Latina ĉeflitero I kun tremao',
ETH: 'Latina ĉeflitero islanda edo',
Ntilde: 'Latina ĉeflitero N kun tildo',
Ograve: 'Latina ĉeflitero O kun liva korno',
Oacute: 'Latina ĉeflitero O kun dekstra korno',
Ocirc: 'Latina ĉeflitero O kun ĉapelo',
Otilde: 'Latina ĉeflitero O kun tildo',
Ouml: 'Latina ĉeflitero O kun tremao',
times: 'Multipliko',
Oslash: 'Latina ĉeflitero O trastrekita',
Ugrave: 'Latina ĉeflitero U kun liva korno',
Uacute: 'Latina ĉeflitero U kun dekstra korno',
Ucirc: 'Latina ĉeflitero U kun ĉapelo',
Uuml: 'Latina ĉeflitero U kun tremao',
Yacute: 'Latina ĉeflitero Y kun dekstra korno',
THORN: 'Latina ĉeflitero islanda dorno',
szlig: 'Latina etlitero germana sozo (akra s)',
agrave: 'Latina etlitero a kun liva korno',
aacute: 'Latina etlitero a kun dekstra korno',
acirc: 'Latina etlitero a kun ĉapelo',
atilde: 'Latina etlitero a kun tildo',
auml: 'Latina etlitero a kun tremao',
aring: 'Latina etlitero a kun superringo',
aelig: 'Latina etlitera ligaturo æ',
ccedil: 'Latina etlitero c kun zoeto',
egrave: 'Latina etlitero e kun liva korno',
eacute: 'Latina etlitero e kun dekstra korno',
ecirc: 'Latina etlitero e kun ĉapelo',
euml: 'Latina etlitero e kun tremao',
igrave: 'Latina etlitero i kun liva korno',
iacute: 'Latina etlitero i kun dekstra korno',
icirc: 'Latina etlitero i kun ĉapelo',
iuml: 'Latina etlitero i kun tremao',
eth: 'Latina etlitero islanda edo',
ntilde: 'Latina etlitero n kun tildo',
ograve: 'Latina etlitero o kun liva korno',
oacute: 'Latina etlitero o kun dekstra korno',
ocirc: 'Latina etlitero o kun ĉapelo',
otilde: 'Latina etlitero o kun tildo',
ouml: 'Latina etlitero o kun tremao',
divide: 'Dividosigno',
oslash: 'Latina etlitero o trastrekita',
ugrave: 'Latina etlitero u kun liva korno',
uacute: 'Latina etlitero u kun dekstra korno',
ucirc: 'Latina etlitero u kun ĉapelo',
uuml: 'Latina etlitero u kun tremao',
yacute: 'Latina etlitero y kun dekstra korno',
thorn: 'Latina etlitero islanda dorno',
yuml: 'Latina etlitero y kun tremao',
OElig: 'Latina ĉeflitera ligaturo Œ',
oelig: 'Latina etlitera ligaturo œ',
'372': 'Latina ĉeflitero W kun ĉapelo',
'374': 'Latina ĉeflitero Y kun ĉapelo',
'373': 'Latina etlitero w kun ĉapelo',
'375': 'Latina etlitero y kun ĉapelo',
sbquo: 'Suba 9-citilo',
'8219': 'Supra renversita 9-citilo',
bdquo: 'Suba 99-citilo',
hellip: 'Tripunkto',
trade: 'Varmarka signo',
'9658': 'Nigra sago dekstren',
bull: 'Bulmarko',
rarr: 'Sago dekstren',
rArr: 'Duobla sago dekstren',
hArr: 'Duobla sago maldekstren',
diams: 'Nigra kvadrato',
asymp: 'Preskaŭ egala'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'de',
{
euro: 'Euro Zeichen',
lsquo: 'Hochkomma links',
rsquo: 'Hochkomma rechts',
ldquo: 'Anführungszeichen links',
rdquo: 'Anführungszeichen rechts',
ndash: 'kleiner Strich',
mdash: 'mittlerer Strich',
iexcl: 'invertiertes Ausrufezeichen',
cent: 'Cent',
pound: 'Pfund',
curren: 'Währung',
yen: 'Yen',
brvbar: 'gestrichelte Linie',
sect: '§ Zeichen',
uml: 'Diäresis',
copy: 'Copyright',
ordf: 'Feminine ordinal Anzeige',
laquo: 'Nach links zeigenden Doppel-Winkel Anführungszeichen',
not: 'Not-Zeichen',
reg: 'Registriert',
macr: 'Längezeichen',
deg: 'Grad',
sup2: 'Hoch 2',
sup3: 'Hoch 3',
acute: 'Akzentzeichen ',
micro: 'Micro',
para: 'Pilcrow-Zeichen',
middot: 'Mittelpunkt',
cedil: 'Cedilla',
sup1: 'Hoch 1',
ordm: 'Männliche Ordnungszahl Anzeige',
raquo: 'Nach rechts zeigenden Doppel-Winkel Anführungszeichen',
frac14: 'ein Viertel',
frac12: 'Hälfte',
frac34: 'Dreiviertel',
iquest: 'Umgekehrtes Fragezeichen',
Agrave: 'Lateinischer Buchstabe A mit AkzentGrave',
Aacute: 'Lateinischer Buchstabe A mit Akutakzent',
Acirc: 'Lateinischer Buchstabe A mit Zirkumflex',
Atilde: 'Lateinischer Buchstabe A mit Tilde',
Auml: 'Lateinischer Buchstabe A mit Trema',
Aring: 'Lateinischer Buchstabe A mit Ring oben',
AElig: 'Lateinischer Buchstabe Æ',
Ccedil: 'Lateinischer Buchstabe C mit Cedille',
Egrave: 'Lateinischer Buchstabe E mit AkzentGrave',
Eacute: 'Lateinischer Buchstabe E mit Akutakzent',
Ecirc: 'Lateinischer Buchstabe E mit Zirkumflex',
Euml: 'Lateinischer Buchstabe E Trema',
Igrave: 'Lateinischer Buchstabe I mit AkzentGrave',
Iacute: 'Lateinischer Buchstabe I mit Akutakzent',
Icirc: 'Lateinischer Buchstabe I mit Zirkumflex',
Iuml: 'Lateinischer Buchstabe I mit Trema',
ETH: 'Lateinischer Buchstabe Eth',
Ntilde: 'Lateinischer Buchstabe N mit Tilde',
Ograve: 'Lateinischer Buchstabe O mit AkzentGrave',
Oacute: 'Lateinischer Buchstabe O mit Akutakzent',
Ocirc: 'Lateinischer Buchstabe O mit Zirkumflex',
Otilde: 'Lateinischer Buchstabe O mit Tilde',
Ouml: 'Lateinischer Buchstabe O mit Trema',
times: 'Multiplikation',
Oslash: 'Lateinischer Buchstabe O durchgestrichen',
Ugrave: 'Lateinischer Buchstabe U mit Akzentgrave',
Uacute: 'Lateinischer Buchstabe U mit Akutakzent',
Ucirc: 'Lateinischer Buchstabe U mit Zirkumflex',
Uuml: 'Lateinischer Buchstabe a mit Trema',
Yacute: 'Lateinischer Buchstabe a mit Akzent',
THORN: 'Lateinischer Buchstabe mit Dorn',
szlig: 'Kleiner lateinischer Buchstabe scharfe s',
agrave: 'Kleiner lateinischer Buchstabe a mit Accent grave',
aacute: 'Kleiner lateinischer Buchstabe a mit Akut',
acirc: 'Lateinischer Buchstabe a mit Zirkumflex',
atilde: 'Lateinischer Buchstabe a mit Tilde',
auml: 'Kleiner lateinischer Buchstabe a mit Trema',
aring: 'Kleiner lateinischer Buchstabe a mit Ring oben',
aelig: 'Lateinischer Buchstabe æ',
ccedil: 'Kleiner lateinischer Buchstabe c mit Cedille',
egrave: 'Kleiner lateinischer Buchstabe e mit Accent grave',
eacute: 'Kleiner lateinischer Buchstabe e mit Akut',
ecirc: 'Kleiner lateinischer Buchstabe e mit Zirkumflex',
euml: 'Kleiner lateinischer Buchstabe e mit Trema',
igrave: 'Kleiner lateinischer Buchstabe i mit AkzentGrave',
iacute: 'Kleiner lateinischer Buchstabe i mit Akzent',
icirc: 'Kleiner lateinischer Buchstabe i mit Zirkumflex',
iuml: 'Kleiner lateinischer Buchstabe i mit Trema',
eth: 'Kleiner lateinischer Buchstabe eth',
ntilde: 'Kleiner lateinischer Buchstabe n mit Tilde',
ograve: 'Kleiner lateinischer Buchstabe o mit Accent grave',
oacute: 'Kleiner lateinischer Buchstabe o mit Akzent',
ocirc: 'Kleiner lateinischer Buchstabe o mit Zirkumflex',
otilde: 'Lateinischer Buchstabe i mit Tilde',
ouml: 'Kleiner lateinischer Buchstabe o mit Trema',
divide: 'Divisionszeichen',
oslash: 'Kleiner lateinischer Buchstabe o durchgestrichen',
ugrave: 'Kleiner lateinischer Buchstabe u mit Accent grave',
uacute: 'Kleiner lateinischer Buchstabe u mit Akut',
ucirc: 'Kleiner lateinischer Buchstabe u mit Zirkumflex',
uuml: 'Kleiner lateinischer Buchstabe u mit Trema',
yacute: 'Kleiner lateinischer Buchstabe y mit Akut',
thorn: 'Kleiner lateinischer Buchstabe Dorn',
yuml: 'Kleiner lateinischer Buchstabe y mit Trema',
OElig: 'Lateinischer Buchstabe Ligatur OE',
oelig: 'Kleiner lateinischer Buchstabe Ligatur OE',
'372': 'Lateinischer Buchstabe W mit Zirkumflex',
'374': 'Lateinischer Buchstabe Y mit Zirkumflex',
'373': 'Kleiner lateinischer Buchstabe w mit Zirkumflex',
'375': 'Kleiner lateinischer Buchstabe y mit Zirkumflex',
sbquo: 'Tiefergestelltes Komma',
'8219': 'Rumgedrehtes Komma',
bdquo: 'Doppeltes Anführungszeichen unten',
hellip: 'horizontale Auslassungspunkte',
trade: 'Handelszeichen',
'9658': 'Dreickspfeil rechts',
bull: 'Bullet',
rarr: 'Pfeil rechts',
rArr: 'Doppelpfeil rechts',
hArr: 'Doppelpfeil links',
diams: 'Karo',
asymp: 'Ungefähr'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'no',
{
euro: 'Eurosymbol',
lsquo: 'Venstre enkelt anførselstegn',
rsquo: 'Høyre enkelt anførselstegn',
ldquo: 'Venstre dobbelt anførselstegn',
rdquo: 'Høyre anførsesltegn',
ndash: 'Kort tankestrek',
mdash: 'Lang tankestrek',
iexcl: 'Omvendt utropstegn',
cent: 'Centsymbol',
pound: 'Pundsymbol',
curren: 'Valutategn',
yen: 'Yensymbol',
brvbar: 'Brutt loddrett strek',
sect: 'Paragraftegn',
uml: 'Tøddel',
copy: 'Copyrighttegn',
ordf: 'Feminin ordensindikator',
laquo: 'Venstre anførselstegn',
not: 'Negasjonstegn',
reg: 'Registrert varemerke-tegn',
macr: 'Makron',
deg: 'Gradsymbol',
sup2: 'Hevet totall',
sup3: 'Hevet tretall',
acute: 'Akutt aksent',
micro: 'Mikrosymbol',
para: 'Avsnittstegn',
middot: 'Midtstilt prikk',
cedil: 'Cedille',
sup1: 'Hevet ettall',
ordm: 'Maskulin ordensindikator',
raquo: 'Høyre anførselstegn',
frac14: 'Fjerdedelsbrøk',
frac12: 'Halvbrøk',
frac34: 'Tre fjerdedelers brøk',
iquest: 'Omvendt spørsmålstegn',
Agrave: 'Stor A med grav aksent',
Aacute: 'Stor A med akutt aksent',
Acirc: 'Stor A med cirkumfleks',
Atilde: 'Stor A med tilde',
Auml: 'Stor A med tøddel',
Aring: 'Stor Å',
AElig: 'Stor Æ',
Ccedil: 'Stor C med cedille',
Egrave: 'Stor E med grav aksent',
Eacute: 'Stor E med akutt aksent',
Ecirc: 'Stor E med cirkumfleks',
Euml: 'Stor E med tøddel',
Igrave: 'Stor I med grav aksent',
Iacute: 'Stor I med akutt aksent',
Icirc: 'Stor I med cirkumfleks',
Iuml: 'Stor I med tøddel',
ETH: 'Stor Edd/stungen D',
Ntilde: 'Stor N med tilde',
Ograve: 'Stor O med grav aksent',
Oacute: 'Stor O med akutt aksent',
Ocirc: 'Stor O med cirkumfleks',
Otilde: 'Stor O med tilde',
Ouml: 'Stor O med tøddel',
times: 'Multiplikasjonstegn',
Oslash: 'Stor Ø',
Ugrave: 'Stor U med grav aksent',
Uacute: 'Stor U med akutt aksent',
Ucirc: 'Stor U med cirkumfleks',
Uuml: 'Stor U med tøddel',
Yacute: 'Stor Y med akutt aksent',
THORN: 'Stor Thorn',
szlig: 'Liten dobbelt-s/Eszett',
agrave: 'Liten a med grav aksent',
aacute: 'Liten a med akutt aksent',
acirc: 'Liten a med cirkumfleks',
atilde: 'Liten a med tilde',
auml: 'Liten a med tøddel',
aring: 'Liten å',
aelig: 'Liten æ',
ccedil: 'Liten c med cedille',
egrave: 'Liten e med grav aksent',
eacute: 'Liten e med akutt aksent',
ecirc: 'Liten e med cirkumfleks',
euml: 'Liten e med tøddel',
igrave: 'Liten i med grav aksent',
iacute: 'Liten i med akutt aksent',
icirc: 'Liten i med cirkumfleks',
iuml: 'Liten i med tøddel',
eth: 'Liten edd/stungen d',
ntilde: 'Liten n med tilde',
ograve: 'Liten o med grav aksent',
oacute: 'Liten o med akutt aksent',
ocirc: 'Liten o med cirkumfleks',
otilde: 'Liten o med tilde',
ouml: 'Liten o med tøddel',
divide: 'Divisjonstegn',
oslash: 'Liten ø',
ugrave: 'Liten u med grav aksent',
uacute: 'Liten u med akutt aksent',
ucirc: 'Liten u med cirkumfleks',
uuml: 'Liten u med tøddel',
yacute: 'Liten y med akutt aksent',
thorn: 'Liten thorn',
yuml: 'Liten y med tøddel',
OElig: 'Stor ligatur av O og E',
oelig: 'Liten ligatur av o og e',
'372': 'Stor W med cirkumfleks',
'374': 'Stor Y med cirkumfleks',
'373': 'Liten w med cirkumfleks',
'375': 'Liten y med cirkumfleks',
sbquo: 'Enkelt lavt 9-anførselstegn',
'8219': 'Enkelt høyt reversert 9-anførselstegn',
bdquo: 'Dobbelt lavt 9-anførselstegn',
hellip: 'Ellipse',
trade: 'Varemerkesymbol',
'9658': 'Svart høyrevendt peker',
bull: 'Tykk interpunkt',
rarr: 'Høyrevendt pil',
rArr: 'Dobbel høyrevendt pil',
hArr: 'Dobbel venstrevendt pil',
diams: 'Svart ruter',
asymp: 'Omtrent likhetstegn'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'it',
{
euro: 'Simbolo Euro',
lsquo: 'Virgoletta singola sinistra',
rsquo: 'Virgoletta singola destra',
ldquo: 'Virgolette aperte',
rdquo: 'Virgolette chiuse',
ndash: 'Trattino',
mdash: 'Trattino lungo',
iexcl: 'Punto esclavamativo invertito',
cent: 'Simbolo Cent',
pound: 'Simbolo Sterlina',
curren: 'Simbolo Moneta',
yen: 'Simbolo Yen',
brvbar: 'Barra interrotta',
sect: 'Simbolo di sezione',
uml: 'Dieresi',
copy: 'Simbolo Copyright',
ordf: 'Indicatore ordinale femminile',
laquo: 'Virgolette basse aperte',
not: 'Nessun segno',
reg: 'Simbolo Registrato',
macr: 'Macron',
deg: 'Simbolo Grado',
sup2: 'Apice Due',
sup3: 'Apice Tre',
acute: 'Accento acuto',
micro: 'Simbolo Micro',
para: 'Simbolo Paragrafo',
middot: 'Punto centrale',
cedil: 'Cediglia',
sup1: 'Apice Uno',
ordm: 'Indicatore ordinale maschile',
raquo: 'Virgolette basse chiuse',
frac14: 'Frazione volgare un quarto',
frac12: 'Frazione volgare un mezzo',
frac34: 'Frazione volgare tre quarti',
iquest: 'Punto interrogativo invertito',
Agrave: 'Lettera maiuscola latina A con accento grave',
Aacute: 'Lettera maiuscola latina A con accento acuto',
Acirc: 'Lettera maiuscola latina A con accento circonflesso',
Atilde: 'Lettera maiuscola latina A con tilde',
Auml: 'Lettera maiuscola latina A con dieresi',
Aring: 'Lettera maiuscola latina A con anello sopra',
AElig: 'Lettera maiuscola latina AE',
Ccedil: 'Lettera maiuscola latina C con cediglia',
Egrave: 'Lettera maiuscola latina E con accento grave',
Eacute: 'Lettera maiuscola latina E con accento acuto',
Ecirc: 'Lettera maiuscola latina E con accento circonflesso',
Euml: 'Lettera maiuscola latina E con dieresi',
Igrave: 'Lettera maiuscola latina I con accento grave',
Iacute: 'Lettera maiuscola latina I con accento acuto',
Icirc: 'Lettera maiuscola latina I con accento circonflesso',
Iuml: 'Lettera maiuscola latina I con dieresi',
ETH: 'Lettera maiuscola latina Eth',
Ntilde: 'Lettera maiuscola latina N con tilde',
Ograve: 'Lettera maiuscola latina O con accento grave',
Oacute: 'Lettera maiuscola latina O con accento acuto',
Ocirc: 'Lettera maiuscola latina O con accento circonflesso',
Otilde: 'Lettera maiuscola latina O con tilde',
Ouml: 'Lettera maiuscola latina O con dieresi',
times: 'Simbolo di moltiplicazione',
Oslash: 'Lettera maiuscola latina O barrata',
Ugrave: 'Lettera maiuscola latina U con accento grave',
Uacute: 'Lettera maiuscola latina U con accento acuto',
Ucirc: 'Lettera maiuscola latina U con accento circonflesso',
Uuml: 'Lettera maiuscola latina U con accento circonflesso',
Yacute: 'Lettera maiuscola latina Y con accento acuto',
THORN: 'Lettera maiuscola latina Thorn',
szlig: 'Lettera latina minuscola doppia S',
agrave: 'Lettera minuscola latina a con accento grave',
aacute: 'Lettera minuscola latina a con accento acuto',
acirc: 'Lettera minuscola latina a con accento circonflesso',
atilde: 'Lettera minuscola latina a con tilde',
auml: 'Lettera minuscola latina a con dieresi',
aring: 'Lettera minuscola latina a con anello superiore',
aelig: 'Lettera minuscola latina ae',
ccedil: 'Lettera minuscola latina c con cediglia',
egrave: 'Lettera minuscola latina e con accento grave',
eacute: 'Lettera minuscola latina e con accento acuto',
ecirc: 'Lettera minuscola latina e con accento circonflesso',
euml: 'Lettera minuscola latina e con dieresi',
igrave: 'Lettera minuscola latina i con accento grave',
iacute: 'Lettera minuscola latina i con accento acuto',
icirc: 'Lettera minuscola latina i con accento circonflesso',
iuml: 'Lettera minuscola latina i con dieresi',
eth: 'Lettera minuscola latina eth',
ntilde: 'Lettera minuscola latina n con tilde',
ograve: 'Lettera minuscola latina o con accento grave',
oacute: 'Lettera minuscola latina o con accento acuto',
ocirc: 'Lettera minuscola latina o con accento circonflesso',
otilde: 'Lettera minuscola latina o con tilde',
ouml: 'Lettera minuscola latina o con dieresi',
divide: 'Simbolo di divisione',
oslash: 'Lettera minuscola latina o barrata',
ugrave: 'Lettera minuscola latina u con accento grave',
uacute: 'Lettera minuscola latina u con accento acuto',
ucirc: 'Lettera minuscola latina u con accento circonflesso',
uuml: 'Lettera minuscola latina u con dieresi',
yacute: 'Lettera minuscola latina y con accento acuto',
thorn: 'Lettera minuscola latina thorn',
yuml: 'Lettera minuscola latina y con dieresi',
OElig: 'Legatura maiuscola latina OE',
oelig: 'Legatura minuscola latina oe',
'372': 'Lettera maiuscola latina W con accento circonflesso',
'374': 'Lettera maiuscola latina Y con accento circonflesso',
'373': 'Lettera minuscola latina w con accento circonflesso',
'375': 'Lettera minuscola latina y con accento circonflesso',
sbquo: 'Singola virgoletta bassa low-9',
'8219': 'Singola virgoletta bassa low-9 inversa',
bdquo: 'Doppia virgoletta bassa low-9',
hellip: 'Ellissi orizzontale',
trade: 'Simbolo TM',
'9658': 'Puntatore nero rivolto verso destra',
bull: 'Punto',
rarr: 'Freccia verso destra',
rArr: 'Doppia freccia verso destra',
hArr: 'Doppia freccia sinistra destra',
diams: 'Simbolo nero diamante',
asymp: 'Quasi uguale a'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'nl',
{
euro: 'Euro-teken',
lsquo: 'Linker enkel aanhalingsteken',
rsquo: 'Rechter enkel aanhalingsteken',
ldquo: 'Linker dubbel aanhalingsteken',
rdquo: 'Rechter dubbel aanhalingsteken',
ndash: 'En dash',
mdash: 'Em dash',
iexcl: 'Omgekeerd uitroepteken',
cent: 'Cent-teken',
pound: 'Pond-teken',
curren: 'Valuta-teken',
yen: 'Yen-teken',
brvbar: 'Gebroken streep',
sect: 'Paragraaf-teken',
uml: 'Trema',
copy: 'Copyright-teken',
ordf: 'Vrouwelijk ordinaal',
laquo: 'Linker guillemet',
not: 'Ongelijk-teken',
reg: 'Geregistreerd handelsmerk-teken',
macr: 'Macron',
deg: 'Graden-teken',
sup2: 'Superscript twee',
sup3: 'Superscript drie',
acute: 'Accent aigu',
micro: 'Mico-teken',
para: 'Alinea-teken',
middot: 'Halfhoge punt',
cedil: 'Cedille',
sup1: 'Superscript een',
ordm: 'Mannelijk ordinaal',
raquo: 'Rechter guillemet',
frac14: 'Breuk kwart',
frac12: 'Breuk half',
frac34: 'Breuk driekwart',
iquest: 'Omgekeerd vraagteken',
Agrave: 'Latijnse hoofdletter A met een accent grave',
Aacute: 'Latijnse hoofdletter A met een accent aigu',
Acirc: 'Latijnse hoofdletter A met een circonflexe',
Atilde: 'Latijnse hoofdletter A met een tilde',
Auml: 'Latijnse hoofdletter A met een trema',
Aring: 'Latijnse hoofdletter A met een corona',
AElig: 'Latijnse hoofdletter Æ',
Ccedil: 'Latijnse hoofdletter C met een cedille',
Egrave: 'Latijnse hoofdletter E met een accent grave',
Eacute: 'Latijnse hoofdletter E met een accent aigu',
Ecirc: 'Latijnse hoofdletter E met een circonflexe',
Euml: 'Latijnse hoofdletter E met een trema',
Igrave: 'Latijnse hoofdletter I met een accent grave',
Iacute: 'Latijnse hoofdletter I met een accent aigu',
Icirc: 'Latijnse hoofdletter I met een circonflexe',
Iuml: 'Latijnse hoofdletter I met een trema',
ETH: 'Latijnse hoofdletter Eth',
Ntilde: 'Latijnse hoofdletter N met een tilde',
Ograve: 'Latijnse hoofdletter O met een accent grave',
Oacute: 'Latijnse hoofdletter O met een accent aigu',
Ocirc: 'Latijnse hoofdletter O met een circonflexe',
Otilde: 'Latijnse hoofdletter O met een tilde',
Ouml: 'Latijnse hoofdletter O met een trema',
times: 'Maal-teken',
Oslash: 'Latijnse hoofdletter O met een schuine streep',
Ugrave: 'Latijnse hoofdletter U met een accent grave',
Uacute: 'Latijnse hoofdletter U met een accent aigu',
Ucirc: 'Latijnse hoofdletter U met een circonflexe',
Uuml: 'Latijnse hoofdletter U met een trema',
Yacute: 'Latijnse hoofdletter Y met een accent aigu',
THORN: 'Latijnse hoofdletter Thorn',
szlig: 'Latijnse kleine ringel-s',
agrave: 'Latijnse kleine letter a met een accent grave',
aacute: 'Latijnse kleine letter a met een accent aigu',
acirc: 'Latijnse kleine letter a met een circonflexe',
atilde: 'Latijnse kleine letter a met een tilde',
auml: 'Latijnse kleine letter a met een trema',
aring: 'Latijnse kleine letter a met een corona',
aelig: 'Latijnse kleine letter æ',
ccedil: 'Latijnse kleine letter c met een cedille',
egrave: 'Latijnse kleine letter e met een accent grave',
eacute: 'Latijnse kleine letter e met een accent aigu',
ecirc: 'Latijnse kleine letter e met een circonflexe',
euml: 'Latijnse kleine letter e met een trema',
igrave: 'Latijnse kleine letter i met een accent grave',
iacute: 'Latijnse kleine letter i met een accent aigu',
icirc: 'Latijnse kleine letter i met een circonflexe',
iuml: 'Latijnse kleine letter i met een trema',
eth: 'Latijnse kleine letter eth',
ntilde: 'Latijnse kleine letter n met een tilde',
ograve: 'Latijnse kleine letter o met een accent grave',
oacute: 'Latijnse kleine letter o met een accent aigu',
ocirc: 'Latijnse kleine letter o met een circonflexe',
otilde: 'Latijnse kleine letter o met een tilde',
ouml: 'Latijnse kleine letter o met een trema',
divide: 'Deel-teken',
oslash: 'Latijnse kleine letter o met een schuine streep',
ugrave: 'Latijnse kleine letter u met een accent grave',
uacute: 'Latijnse kleine letter u met een accent aigu',
ucirc: 'Latijnse kleine letter u met een circonflexe',
uuml: 'Latijnse kleine letter u met een trema',
yacute: 'Latijnse kleine letter y met een accent aigu',
thorn: 'Latijnse kleine letter thorn',
yuml: 'Latijnse kleine letter y met een trema',
OElig: 'Latijnse hoofdletter Œ',
oelig: 'Latijnse kleine letter œ',
'372': 'Latijnse hoofdletter W met een circonflexe',
'374': 'Latijnse hoofdletter Y met een circonflexe',
'373': 'Latijnse kleine letter w met een circonflexe',
'375': 'Latijnse kleine letter y met een circonflexe',
sbquo: 'Lage enkele aanhalingsteken',
'8219': 'Hoge omgekeerde enkele aanhalingsteken',
bdquo: 'Lage dubbele aanhalingsteken',
hellip: 'Beletselteken',
trade: 'Trademark-teken',
'9658': 'Zwarte driehoek naar rechts',
bull: 'Bullet',
rarr: 'Pijl naar rechts',
rArr: 'Dubbele pijl naar rechts',
hArr: 'Dubbele pijl naar links',
diams: 'Zwart ruitje',
asymp: 'Benaderingsteken'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'et',
{
euro: 'Euromärk',
lsquo: 'Alustav ühekordne jutumärk',
rsquo: 'Lõpetav ühekordne jutumärk',
ldquo: 'Alustav kahekordne jutumärk',
rdquo: 'Lõpetav kahekordne jutumärk',
ndash: 'Enn-kriips',
mdash: 'Emm-kriips',
iexcl: 'Pööratud hüüumärk',
cent: 'Sendimärk',
pound: 'Naela märk',
curren: 'Valuutamärk',
yen: 'Jeeni märk',
brvbar: 'Katkestatud kriips',
sect: 'Lõigu märk',
uml: 'Täpid',
copy: 'Autoriõiguse märk',
ordf: 'Feminine ordinal indicator', // MISSING
laquo: 'Left-pointing double angle quotation mark', // MISSING
not: 'Ei-märk',
reg: 'Registered sign', // MISSING
macr: 'Macron', // MISSING
deg: 'Kraadimärk',
sup2: 'Ülaindeks kaks',
sup3: 'Ülaindeks kolm',
acute: 'Acute accent', // MISSING
micro: 'Mikro-märk',
para: 'Pilcrow sign', // MISSING
middot: 'Keskpunkt',
cedil: 'Cedilla', // MISSING
sup1: 'Ülaindeks üks',
ordm: 'Masculine ordinal indicator', // MISSING
raquo: 'Right-pointing double angle quotation mark', // MISSING
frac14: 'Vulgar fraction one quarter', // MISSING
frac12: 'Vulgar fraction one half', // MISSING
frac34: 'Vulgar fraction three quarters', // MISSING
iquest: 'Inverted question mark', // MISSING
Agrave: 'Latin capital letter A with grave accent', // MISSING
Aacute: 'Latin capital letter A with acute accent', // MISSING
Acirc: 'Latin capital letter A with circumflex', // MISSING
Atilde: 'Ladina suur A tildega',
Auml: 'Latin capital letter A with diaeresis', // MISSING
Aring: 'Latin capital letter A with ring above', // MISSING
AElig: 'Latin Capital letter Æ', // MISSING
Ccedil: 'Latin capital letter C with cedilla', // MISSING
Egrave: 'Latin capital letter E with grave accent', // MISSING
Eacute: 'Latin capital letter E with acute accent', // MISSING
Ecirc: 'Latin capital letter E with circumflex', // MISSING
Euml: 'Latin capital letter E with diaeresis', // MISSING
Igrave: 'Latin capital letter I with grave accent', // MISSING
Iacute: 'Latin capital letter I with acute accent', // MISSING
Icirc: 'Latin capital letter I with circumflex', // MISSING
Iuml: 'Latin capital letter I with diaeresis', // MISSING
ETH: 'Latin capital letter Eth', // MISSING
Ntilde: 'Latin capital letter N with tilde', // MISSING
Ograve: 'Latin capital letter O with grave accent', // MISSING
Oacute: 'Latin capital letter O with acute accent', // MISSING
Ocirc: 'Latin capital letter O with circumflex', // MISSING
Otilde: 'Latin capital letter O with tilde', // MISSING
Ouml: 'Täppidega ladina suur O',
times: 'Multiplication sign', // MISSING
Oslash: 'Latin capital letter O with stroke', // MISSING
Ugrave: 'Latin capital letter U with grave accent', // MISSING
Uacute: 'Latin capital letter U with acute accent', // MISSING
Ucirc: 'Kandilise katusega suur ladina U',
Uuml: 'Täppidega ladina suur U',
Yacute: 'Latin capital letter Y with acute accent', // MISSING
THORN: 'Latin capital letter Thorn', // MISSING
szlig: 'Ladina väike terav s',
agrave: 'Latin small letter a with grave accent', // MISSING
aacute: 'Latin small letter a with acute accent', // MISSING
acirc: 'Kandilise katusega ladina väike a',
atilde: 'Tildega ladina väike a',
auml: 'Täppidega ladina väike a',
aring: 'Latin small letter a with ring above', // MISSING
aelig: 'Latin small letter æ', // MISSING
ccedil: 'Latin small letter c with cedilla', // MISSING
egrave: 'Latin small letter e with grave accent', // MISSING
eacute: 'Latin small letter e with acute accent', // MISSING
ecirc: 'Latin small letter e with circumflex', // MISSING
euml: 'Latin small letter e with diaeresis', // MISSING
igrave: 'Latin small letter i with grave accent', // MISSING
iacute: 'Latin small letter i with acute accent', // MISSING
icirc: 'Latin small letter i with circumflex', // MISSING
iuml: 'Latin small letter i with diaeresis', // MISSING
eth: 'Latin small letter eth', // MISSING
ntilde: 'Latin small letter n with tilde', // MISSING
ograve: 'Latin small letter o with grave accent', // MISSING
oacute: 'Latin small letter o with acute accent', // MISSING
ocirc: 'Latin small letter o with circumflex', // MISSING
otilde: 'Latin small letter o with tilde', // MISSING
ouml: 'Latin small letter o with diaeresis', // MISSING
divide: 'Division sign', // MISSING
oslash: 'Latin small letter o with stroke', // MISSING
ugrave: 'Latin small letter u with grave accent', // MISSING
uacute: 'Latin small letter u with acute accent', // MISSING
ucirc: 'Latin small letter u with circumflex', // MISSING
uuml: 'Latin small letter u with diaeresis', // MISSING
yacute: 'Latin small letter y with acute accent', // MISSING
thorn: 'Latin small letter thorn', // MISSING
yuml: 'Latin small letter y with diaeresis', // MISSING
OElig: 'Latin capital ligature OE', // MISSING
oelig: 'Latin small ligature oe', // MISSING
'372': 'Latin capital letter W with circumflex', // MISSING
'374': 'Latin capital letter Y with circumflex', // MISSING
'373': 'Latin small letter w with circumflex', // MISSING
'375': 'Latin small letter y with circumflex', // MISSING
sbquo: 'Single low-9 quotation mark', // MISSING
'8219': 'Single high-reversed-9 quotation mark', // MISSING
bdquo: 'Double low-9 quotation mark', // MISSING
hellip: 'Horizontal ellipsis', // MISSING
trade: 'Trade mark sign', // MISSING
'9658': 'Black right-pointing pointer', // MISSING
bull: 'Bullet', // MISSING
rarr: 'Rightwards arrow', // MISSING
rArr: 'Rightwards double arrow', // MISSING
hArr: 'Left right double arrow', // MISSING
diams: 'Black diamond suit', // MISSING
asymp: 'Almost equal to' // MISSING
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'cs',
{
euro: 'Znak eura',
lsquo: 'Počáteční uvozovka jednoduchá',
rsquo: 'Koncová uvozovka jednoduchá',
ldquo: 'Počáteční uvozovka dvojitá',
rdquo: 'Koncová uvozovka dvojitá',
ndash: 'En pomlčka',
mdash: 'Em pomlčka',
iexcl: 'Obrácený vykřičník',
cent: 'Znak centu',
pound: 'Znak libry',
curren: 'Znak měny',
yen: 'Znak jenu',
brvbar: 'Přerušená svislá čára',
sect: 'Znak oddílu',
uml: 'Přehláska',
copy: 'Znak copyrightu',
ordf: 'Ženský indikátor rodu',
laquo: 'Znak dvojitých lomených uvozovek vlevo',
not: 'Logistický zápor',
reg: 'Znak registrace',
macr: 'Pomlčka nad',
deg: 'Znak stupně',
sup2: 'Dvojka jako horní index',
sup3: 'Trojka jako horní index',
acute: 'Čárka nad vpravo',
micro: 'Znak mikro',
para: 'Znak odstavce',
middot: 'Tečka uprostřed',
cedil: 'Ocásek vlevo',
sup1: 'Jednička jako horní index',
ordm: 'Mužský indikátor rodu',
raquo: 'Znak dvojitých lomených uvozovek vpravo',
frac14: 'Obyčejný zlomek jedna čtvrtina',
frac12: 'Obyčejný zlomek jedna polovina',
frac34: 'Obyčejný zlomek tři čtvrtiny',
iquest: 'Znak obráceného otazníku',
Agrave: 'Velké písmeno latinky A s čárkou nad vlevo',
Aacute: 'Velké písmeno latinky A s čárkou nad vpravo',
Acirc: 'Velké písmeno latinky A s vokáněm',
Atilde: 'Velké písmeno latinky A s tildou',
Auml: 'Velké písmeno latinky A s dvěma tečkami',
Aring: 'Velké písmeno latinky A s kroužkem nad',
AElig: 'Velké písmeno latinky Ae',
Ccedil: 'Velké písmeno latinky C s ocáskem vlevo',
Egrave: 'Velké písmeno latinky E s čárkou nad vlevo',
Eacute: 'Velké písmeno latinky E s čárkou nad vpravo',
Ecirc: 'Velké písmeno latinky E s vokáněm',
Euml: 'Velké písmeno latinky E s dvěma tečkami',
Igrave: 'Velké písmeno latinky I s čárkou nad vlevo',
Iacute: 'Velké písmeno latinky I s čárkou nad vpravo',
Icirc: 'Velké písmeno latinky I s vokáněm',
Iuml: 'Velké písmeno latinky I s dvěma tečkami',
ETH: 'Velké písmeno latinky Eth',
Ntilde: 'Velké písmeno latinky N s tildou',
Ograve: 'Velké písmeno latinky O s čárkou nad vlevo',
Oacute: 'Velké písmeno latinky O s čárkou nad vpravo',
Ocirc: 'Velké písmeno latinky O s vokáněm',
Otilde: 'Velké písmeno latinky O s tildou',
Ouml: 'Velké písmeno latinky O s dvěma tečkami',
times: 'Znak násobení',
Oslash: 'Velké písmeno latinky O přeškrtnuté',
Ugrave: 'Velké písmeno latinky U s čárkou nad vlevo',
Uacute: 'Velké písmeno latinky U s čárkou nad vpravo',
Ucirc: 'Velké písmeno latinky U s vokáněm',
Uuml: 'Velké písmeno latinky U s dvěma tečkami',
Yacute: 'Velké písmeno latinky Y s čárkou nad vpravo',
THORN: 'Velké písmeno latinky Thorn',
szlig: 'Malé písmeno latinky ostré s',
agrave: 'Malé písmeno latinky a s čárkou nad vlevo',
aacute: 'Malé písmeno latinky a s čárkou nad vpravo',
acirc: 'Malé písmeno latinky a s vokáněm',
atilde: 'Malé písmeno latinky a s tildou',
auml: 'Malé písmeno latinky a s dvěma tečkami',
aring: 'Malé písmeno latinky a s kroužkem nad',
aelig: 'Malé písmeno latinky ae',
ccedil: 'Malé písmeno latinky c s ocáskem vlevo',
egrave: 'Malé písmeno latinky e s čárkou nad vlevo',
eacute: 'Malé písmeno latinky e s čárkou nad vpravo',
ecirc: 'Malé písmeno latinky e s vokáněm',
euml: 'Malé písmeno latinky e s dvěma tečkami',
igrave: 'Malé písmeno latinky i s čárkou nad vlevo',
iacute: 'Malé písmeno latinky i s čárkou nad vpravo',
icirc: 'Malé písmeno latinky i s vokáněm',
iuml: 'Malé písmeno latinky i s dvěma tečkami',
eth: 'Malé písmeno latinky eth',
ntilde: 'Malé písmeno latinky n s tildou',
ograve: 'Malé písmeno latinky o s čárkou nad vlevo',
oacute: 'Malé písmeno latinky o s čárkou nad vpravo',
ocirc: 'Malé písmeno latinky o s vokáněm',
otilde: 'Malé písmeno latinky o s tildou',
ouml: 'Malé písmeno latinky o s dvěma tečkami',
divide: 'Znak dělení',
oslash: 'Malé písmeno latinky o přeškrtnuté',
ugrave: 'Malé písmeno latinky u s čárkou nad vlevo',
uacute: 'Malé písmeno latinky u s čárkou nad vpravo',
ucirc: 'Malé písmeno latinky u s vokáněm',
uuml: 'Malé písmeno latinky u s dvěma tečkami',
yacute: 'Malé písmeno latinky y s čárkou nad vpravo',
thorn: 'Malé písmeno latinky thorn',
yuml: 'Malé písmeno latinky y s dvěma tečkami',
OElig: 'Velká ligatura latinky OE',
oelig: 'Malá ligatura latinky OE',
'372': 'Velké písmeno latinky W s vokáněm',
'374': 'Velké písmeno latinky Y s vokáněm',
'373': 'Malé písmeno latinky w s vokáněm',
'375': 'Malé písmeno latinky y s vokáněm',
sbquo: 'Dolní 9 uvozovka jednoduchá',
'8219': 'Horní obrácená 9 uvozovka jednoduchá',
bdquo: 'Dolní 9 uvozovka dvojitá',
hellip: 'Trojtečkový úvod',
trade: 'Obchodní značka',
'9658': 'Černý ukazatel směřující vpravo',
bull: 'Kolečko',
rarr: 'Šipka vpravo',
rArr: 'Dvojitá šipka vpravo',
hArr: 'Dvojitá šipka vlevo a vpravo',
diams: 'Černé piky',
asymp: 'Téměř se rovná'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'hr',
{
euro: 'Euro znak',
lsquo: 'Lijevi jednostruki navodnik',
rsquo: 'Desni jednostruki navodnik',
ldquo: 'Lijevi dvostruki navodnik',
rdquo: 'Desni dvostruki navodnik',
ndash: 'En crtica',
mdash: 'Em crtica',
iexcl: 'Naopaki uskličnik',
cent: 'Cent znak',
pound: 'Funta znak',
curren: 'Znak valute',
yen: 'Yen znak',
brvbar: 'Potrgana prečka',
sect: 'Znak odjeljka',
uml: 'Diaeresis', // MISSING
copy: 'Copyright znak',
ordf: 'Feminine ordinal indicator', // MISSING
laquo: 'Lijevi dvostruki uglati navodnik',
not: 'Not znak',
reg: 'Registered znak',
macr: 'Macron', // MISSING
deg: 'Stupanj znak',
sup2: 'Superscript two', // MISSING
sup3: 'Superscript three', // MISSING
acute: 'Acute accent', // MISSING
micro: 'Micro sign', // MISSING
para: 'Pilcrow sign', // MISSING
middot: 'Srednja točka',
cedil: 'Cedilla', // MISSING
sup1: 'Superscript one', // MISSING
ordm: 'Masculine ordinal indicator', // MISSING
raquo: 'Desni dvostruku uglati navodnik',
frac14: 'Vulgar fraction one quarter', // MISSING
frac12: 'Vulgar fraction one half', // MISSING
frac34: 'Vulgar fraction three quarters', // MISSING
iquest: 'Naopaki upitnik',
Agrave: 'Veliko latinsko slovo A s akcentom',
Aacute: 'Latin capital letter A with acute accent', // MISSING
Acirc: 'Latin capital letter A with circumflex', // MISSING
Atilde: 'Latin capital letter A with tilde', // MISSING
Auml: 'Latin capital letter A with diaeresis', // MISSING
Aring: 'Latin capital letter A with ring above', // MISSING
AElig: 'Latin Capital letter Æ', // MISSING
Ccedil: 'Latin capital letter C with cedilla', // MISSING
Egrave: 'Latin capital letter E with grave accent', // MISSING
Eacute: 'Latin capital letter E with acute accent', // MISSING
Ecirc: 'Latin capital letter E with circumflex', // MISSING
Euml: 'Latin capital letter E with diaeresis', // MISSING
Igrave: 'Latin capital letter I with grave accent', // MISSING
Iacute: 'Latin capital letter I with acute accent', // MISSING
Icirc: 'Latin capital letter I with circumflex', // MISSING
Iuml: 'Latin capital letter I with diaeresis', // MISSING
ETH: 'Latin capital letter Eth', // MISSING
Ntilde: 'Latin capital letter N with tilde', // MISSING
Ograve: 'Latin capital letter O with grave accent', // MISSING
Oacute: 'Latin capital letter O with acute accent', // MISSING
Ocirc: 'Latin capital letter O with circumflex', // MISSING
Otilde: 'Latin capital letter O with tilde', // MISSING
Ouml: 'Latin capital letter O with diaeresis', // MISSING
times: 'Multiplication sign', // MISSING
Oslash: 'Latin capital letter O with stroke', // MISSING
Ugrave: 'Latin capital letter U with grave accent', // MISSING
Uacute: 'Latin capital letter U with acute accent', // MISSING
Ucirc: 'Latin capital letter U with circumflex', // MISSING
Uuml: 'Latin capital letter U with diaeresis', // MISSING
Yacute: 'Latin capital letter Y with acute accent', // MISSING
THORN: 'Latin capital letter Thorn', // MISSING
szlig: 'Latin small letter sharp s', // MISSING
agrave: 'Latin small letter a with grave accent', // MISSING
aacute: 'Latin small letter a with acute accent', // MISSING
acirc: 'Latin small letter a with circumflex', // MISSING
atilde: 'Latin small letter a with tilde', // MISSING
auml: 'Latin small letter a with diaeresis', // MISSING
aring: 'Latin small letter a with ring above', // MISSING
aelig: 'Latin small letter æ', // MISSING
ccedil: 'Latin small letter c with cedilla', // MISSING
egrave: 'Latin small letter e with grave accent', // MISSING
eacute: 'Latin small letter e with acute accent', // MISSING
ecirc: 'Latin small letter e with circumflex', // MISSING
euml: 'Latin small letter e with diaeresis', // MISSING
igrave: 'Latin small letter i with grave accent', // MISSING
iacute: 'Latin small letter i with acute accent', // MISSING
icirc: 'Latin small letter i with circumflex', // MISSING
iuml: 'Latin small letter i with diaeresis', // MISSING
eth: 'Latin small letter eth', // MISSING
ntilde: 'Latin small letter n with tilde', // MISSING
ograve: 'Latin small letter o with grave accent', // MISSING
oacute: 'Latin small letter o with acute accent', // MISSING
ocirc: 'Latin small letter o with circumflex', // MISSING
otilde: 'Latin small letter o with tilde', // MISSING
ouml: 'Latin small letter o with diaeresis', // MISSING
divide: 'Division sign', // MISSING
oslash: 'Latin small letter o with stroke', // MISSING
ugrave: 'Latin small letter u with grave accent', // MISSING
uacute: 'Latin small letter u with acute accent', // MISSING
ucirc: 'Latin small letter u with circumflex', // MISSING
uuml: 'Latin small letter u with diaeresis', // MISSING
yacute: 'Latin small letter y with acute accent', // MISSING
thorn: 'Latin small letter thorn', // MISSING
yuml: 'Latin small letter y with diaeresis', // MISSING
OElig: 'Latin capital ligature OE', // MISSING
oelig: 'Latin small ligature oe', // MISSING
'372': 'Latin capital letter W with circumflex', // MISSING
'374': 'Latin capital letter Y with circumflex', // MISSING
'373': 'Latin small letter w with circumflex', // MISSING
'375': 'Latin small letter y with circumflex', // MISSING
sbquo: 'Single low-9 quotation mark', // MISSING
'8219': 'Single high-reversed-9 quotation mark', // MISSING
bdquo: 'Double low-9 quotation mark', // MISSING
hellip: 'Horizontal ellipsis', // MISSING
trade: 'Trade mark sign', // MISSING
'9658': 'Black right-pointing pointer', // MISSING
bull: 'Bullet', // MISSING
rarr: 'Rightwards arrow', // MISSING
rArr: 'Rightwards double arrow', // MISSING
hArr: 'Left right double arrow', // MISSING
diams: 'Black diamond suit', // MISSING
asymp: 'Almost equal to' // MISSING
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'fi',
{
euro: 'Euron merkki',
lsquo: 'Vasen yksittäinen lainausmerkki',
rsquo: 'Oikea yksittäinen lainausmerkki',
ldquo: 'Vasen kaksoislainausmerkki',
rdquo: 'Oikea kaksoislainausmerkki',
ndash: 'En dash', // MISSING
mdash: 'Em dash', // MISSING
iexcl: 'Inverted exclamation mark', // MISSING
cent: 'Sentin merkki',
pound: 'Punnan merkki',
curren: 'Valuuttamerkki',
yen: 'Yenin merkki',
brvbar: 'Broken bar', // MISSING
sect: 'Section sign', // MISSING
uml: 'Diaeresis', // MISSING
copy: 'Copyright sign', // MISSING
ordf: 'Feminine ordinal indicator', // MISSING
laquo: 'Left-pointing double angle quotation mark', // MISSING
not: 'Not sign', // MISSING
reg: 'Rekisteröity merkki',
macr: 'Macron', // MISSING
deg: 'Asteen merkki',
sup2: 'Yläindeksi kaksi',
sup3: 'Yläindeksi kolme',
acute: 'Acute accent', // MISSING
micro: 'Mikron merkki',
para: 'Pilcrow sign', // MISSING
middot: 'Middle dot', // MISSING
cedil: 'Cedilla', // MISSING
sup1: 'Yläindeksi yksi',
ordm: 'Masculine ordinal indicator', // MISSING
raquo: 'Right-pointing double angle quotation mark', // MISSING
frac14: 'Vulgar fraction one quarter', // MISSING
frac12: 'Vulgar fraction one half', // MISSING
frac34: 'Vulgar fraction three quarters', // MISSING
iquest: 'Ylösalaisin oleva kysymysmerkki',
Agrave: 'Latin capital letter A with grave accent', // MISSING
Aacute: 'Latin capital letter A with acute accent', // MISSING
Acirc: 'Latin capital letter A with circumflex', // MISSING
Atilde: 'Latin capital letter A with tilde', // MISSING
Auml: 'Latin capital letter A with diaeresis', // MISSING
Aring: 'Latin capital letter A with ring above', // MISSING
AElig: 'Latin Capital letter Æ', // MISSING
Ccedil: 'Latin capital letter C with cedilla', // MISSING
Egrave: 'Latin capital letter E with grave accent', // MISSING
Eacute: 'Latin capital letter E with acute accent', // MISSING
Ecirc: 'Latin capital letter E with circumflex', // MISSING
Euml: 'Latin capital letter E with diaeresis', // MISSING
Igrave: 'Latin capital letter I with grave accent', // MISSING
Iacute: 'Latin capital letter I with acute accent', // MISSING
Icirc: 'Latin capital letter I with circumflex', // MISSING
Iuml: 'Latin capital letter I with diaeresis', // MISSING
ETH: 'Latin capital letter Eth', // MISSING
Ntilde: 'Latin capital letter N with tilde', // MISSING
Ograve: 'Latin capital letter O with grave accent', // MISSING
Oacute: 'Latin capital letter O with acute accent', // MISSING
Ocirc: 'Latin capital letter O with circumflex', // MISSING
Otilde: 'Latin capital letter O with tilde', // MISSING
Ouml: 'Latin capital letter O with diaeresis', // MISSING
times: 'Kertomerkki',
Oslash: 'Latin capital letter O with stroke', // MISSING
Ugrave: 'Latin capital letter U with grave accent', // MISSING
Uacute: 'Latin capital letter U with acute accent', // MISSING
Ucirc: 'Latin capital letter U with circumflex', // MISSING
Uuml: 'Latin capital letter U with diaeresis', // MISSING
Yacute: 'Latin capital letter Y with acute accent', // MISSING
THORN: 'Latin capital letter Thorn', // MISSING
szlig: 'Latin small letter sharp s', // MISSING
agrave: 'Latin small letter a with grave accent', // MISSING
aacute: 'Latin small letter a with acute accent', // MISSING
acirc: 'Latin small letter a with circumflex', // MISSING
atilde: 'Latin small letter a with tilde', // MISSING
auml: 'Latin small letter a with diaeresis', // MISSING
aring: 'Latin small letter a with ring above', // MISSING
aelig: 'Latin small letter æ', // MISSING
ccedil: 'Latin small letter c with cedilla', // MISSING
egrave: 'Latin small letter e with grave accent', // MISSING
eacute: 'Latin small letter e with acute accent', // MISSING
ecirc: 'Latin small letter e with circumflex', // MISSING
euml: 'Latin small letter e with diaeresis', // MISSING
igrave: 'Latin small letter i with grave accent', // MISSING
iacute: 'Latin small letter i with acute accent', // MISSING
icirc: 'Latin small letter i with circumflex', // MISSING
iuml: 'Latin small letter i with diaeresis', // MISSING
eth: 'Latin small letter eth', // MISSING
ntilde: 'Latin small letter n with tilde', // MISSING
ograve: 'Latin small letter o with grave accent', // MISSING
oacute: 'Latin small letter o with acute accent', // MISSING
ocirc: 'Latin small letter o with circumflex', // MISSING
otilde: 'Latin small letter o with tilde', // MISSING
ouml: 'Latin small letter o with diaeresis', // MISSING
divide: 'Jakomerkki',
oslash: 'Latin small letter o with stroke', // MISSING
ugrave: 'Latin small letter u with grave accent', // MISSING
uacute: 'Latin small letter u with acute accent', // MISSING
ucirc: 'Latin small letter u with circumflex', // MISSING
uuml: 'Latin small letter u with diaeresis', // MISSING
yacute: 'Latin small letter y with acute accent', // MISSING
thorn: 'Latin small letter thorn', // MISSING
yuml: 'Latin small letter y with diaeresis', // MISSING
OElig: 'Latin capital ligature OE', // MISSING
oelig: 'Latin small ligature oe', // MISSING
'372': 'Latin capital letter W with circumflex', // MISSING
'374': 'Latin capital letter Y with circumflex', // MISSING
'373': 'Latin small letter w with circumflex', // MISSING
'375': 'Latin small letter y with circumflex', // MISSING
sbquo: 'Single low-9 quotation mark', // MISSING
'8219': 'Single high-reversed-9 quotation mark', // MISSING
bdquo: 'Double low-9 quotation mark', // MISSING
hellip: 'Horizontal ellipsis', // MISSING
trade: 'Tavaramerkki merkki',
'9658': 'Black right-pointing pointer', // MISSING
bull: 'Bullet', // MISSING
rarr: 'Nuoli oikealle',
rArr: 'Kaksoisnuoli oikealle',
hArr: 'Kaksoisnuoli oikealle ja vasemmalle',
diams: 'Black diamond suit', // MISSING
asymp: 'Noin'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'ug',
{
euro: 'ياۋرو بەلگىسى',
lsquo: 'يالاڭ پەش سول',
rsquo: 'يالاڭ پەش ئوڭ',
ldquo: 'قوش پەش سول',
rdquo: 'قوش پەش ئوڭ',
ndash: 'سىزىقچە',
mdash: 'سىزىق',
iexcl: 'ئۈندەش',
cent: 'تىيىن بەلگىسى',
pound: 'فوند ستېرلىڭ',
curren: 'پۇل بەلگىسى',
yen: 'ياپونىيە يىنى',
brvbar: 'ئۈزۈك بالداق',
sect: 'پاراگراف بەلگىسى',
uml: 'تاۋۇش ئايرىش بەلگىسى',
copy: 'نەشر ھوقۇقى بەلگىسى',
ordf: 'Feminine ordinal indicator', // MISSING
laquo: 'قوش تىرناق سول',
not: 'غەيرى بەلگە',
reg: 'خەتلەتكەن تاۋار ماركىسى',
macr: 'سوزۇش بەلگىسى',
deg: 'گىرادۇس بەلگىسى',
sup2: 'يۇقىرى ئىندېكىس 2',
sup3: 'يۇقىرى ئىندېكىس 3',
acute: 'ئۇرغۇ بەلگىسى',
micro: 'Micro sign', // MISSING
para: 'ئابزاس بەلگىسى',
middot: 'ئوتتۇرا چېكىت',
cedil: 'ئاستىغا قوشۇلىدىغان بەلگە',
sup1: 'يۇقىرى ئىندېكىس 1',
ordm: 'Masculine ordinal indicator', // MISSING
raquo: 'قوش تىرناق ئوڭ',
frac14: 'ئاددىي كەسىر تۆتتىن بىر',
frac12: 'ئاددىي كەسىر ئىككىدىن بىر',
frac34: 'ئاددىي كەسىر ئۈچتىن تۆرت',
iquest: 'Inverted question mark', // MISSING
Agrave: 'Latin capital letter A with grave accent', // MISSING
Aacute: 'Latin capital letter A with acute accent', // MISSING
Acirc: 'Latin capital letter A with circumflex', // MISSING
Atilde: 'Latin capital letter A with tilde', // MISSING
Auml: 'Latin capital letter A with diaeresis', // MISSING
Aring: 'Latin capital letter A with ring above', // MISSING
AElig: 'Latin Capital letter Æ', // MISSING
Ccedil: 'Latin capital letter C with cedilla', // MISSING
Egrave: 'Latin capital letter E with grave accent', // MISSING
Eacute: 'Latin capital letter E with acute accent', // MISSING
Ecirc: 'Latin capital letter E with circumflex', // MISSING
Euml: 'Latin capital letter E with diaeresis', // MISSING
Igrave: 'Latin capital letter I with grave accent', // MISSING
Iacute: 'Latin capital letter I with acute accent', // MISSING
Icirc: 'Latin capital letter I with circumflex', // MISSING
Iuml: 'Latin capital letter I with diaeresis', // MISSING
ETH: 'Latin capital letter Eth', // MISSING
Ntilde: 'Latin capital letter N with tilde', // MISSING
Ograve: 'قوش پەش ئوڭ',
Oacute: 'Latin capital letter O with acute accent', // MISSING
Ocirc: 'Latin capital letter O with circumflex', // MISSING
Otilde: 'Latin capital letter O with tilde', // MISSING
Ouml: 'Latin capital letter O with diaeresis', // MISSING
times: 'Multiplication sign', // MISSING
Oslash: 'Latin capital letter O with stroke', // MISSING
Ugrave: 'Latin capital letter U with grave accent', // MISSING
Uacute: 'Latin capital letter U with acute accent', // MISSING
Ucirc: 'Latin capital letter U with circumflex', // MISSING
Uuml: 'Latin capital letter U with diaeresis', // MISSING
Yacute: 'Latin capital letter Y with acute accent', // MISSING
THORN: 'Latin capital letter Thorn', // MISSING
szlig: 'Latin small letter sharp s', // MISSING
agrave: 'Latin small letter a with grave accent', // MISSING
aacute: 'Latin small letter a with acute accent', // MISSING
acirc: 'Latin small letter a with circumflex', // MISSING
atilde: 'Latin small letter a with tilde', // MISSING
auml: 'Latin small letter a with diaeresis', // MISSING
aring: 'Latin small letter a with ring above', // MISSING
aelig: 'Latin small letter æ', // MISSING
ccedil: 'Latin small letter c with cedilla', // MISSING
egrave: 'Latin small letter e with grave accent', // MISSING
eacute: 'Latin small letter e with acute accent', // MISSING
ecirc: 'Latin small letter e with circumflex', // MISSING
euml: 'Latin small letter e with diaeresis', // MISSING
igrave: 'Latin small letter i with grave accent', // MISSING
iacute: 'Latin small letter i with acute accent', // MISSING
icirc: 'Latin small letter i with circumflex', // MISSING
iuml: 'Latin small letter i with diaeresis', // MISSING
eth: 'Latin small letter eth', // MISSING
ntilde: 'تىك موللاق سوئال بەلگىسى',
ograve: 'Latin small letter o with grave accent', // MISSING
oacute: 'Latin small letter o with acute accent', // MISSING
ocirc: 'Latin small letter o with circumflex', // MISSING
otilde: 'Latin small letter o with tilde', // MISSING
ouml: 'Latin small letter o with diaeresis', // MISSING
divide: 'Division sign', // MISSING
oslash: 'Latin small letter o with stroke', // MISSING
ugrave: 'Latin small letter u with grave accent', // MISSING
uacute: 'Latin small letter u with acute accent', // MISSING
ucirc: 'Latin small letter u with circumflex', // MISSING
uuml: 'Latin small letter u with diaeresis', // MISSING
yacute: 'Latin small letter y with acute accent', // MISSING
thorn: 'Latin small letter thorn', // MISSING
yuml: 'Latin small letter y with diaeresis', // MISSING
OElig: 'Latin capital ligature OE', // MISSING
oelig: 'Latin small ligature oe', // MISSING
'372': 'Latin capital letter W with circumflex', // MISSING
'374': 'Latin capital letter Y with circumflex', // MISSING
'373': 'Latin small letter w with circumflex', // MISSING
'375': 'Latin small letter y with circumflex', // MISSING
sbquo: 'Single low-9 quotation mark', // MISSING
'8219': 'Single high-reversed-9 quotation mark', // MISSING
bdquo: 'Double low-9 quotation mark', // MISSING
hellip: 'Horizontal ellipsis', // MISSING
trade: 'Trade mark sign', // MISSING
'9658': 'Black right-pointing pointer', // MISSING
bull: 'Bullet', // MISSING
rarr: 'ئوڭ يا ئوق',
rArr: 'ئوڭ قوش سىزىق يا ئوق',
hArr: 'ئوڭ سول قوش سىزىق يا ئوق',
diams: 'ئۇيۇل غىچ',
asymp: 'تەخمىنەن تەڭ'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'zh-cn',
{
euro: '欧元符号',
lsquo: '左单引号',
rsquo: '右单引号',
ldquo: '左双引号',
rdquo: '右双引号',
ndash: '短划线',
mdash: '破折号',
iexcl: '竖翻叹号',
cent: '分币标记',
pound: '英镑标记',
curren: '货币标记',
yen: '日元标记',
brvbar: '间断条',
sect: '节标记',
uml: '分音符',
copy: '版权所有标记',
ordf: '阴性顺序指示符',
laquo: '左指双尖引号',
not: '非标记',
reg: '注册标记',
macr: '长音符',
deg: '度标记',
sup2: '上标二',
sup3: '上标三',
acute: '锐音符',
micro: '微符',
para: '段落标记',
middot: '中间点',
cedil: '下加符',
sup1: '上标一',
ordm: '阳性顺序指示符',
raquo: '右指双尖引号',
frac14: '普通分数四分之一',
frac12: '普通分数二分之一',
frac34: '普通分数四分之三',
iquest: '竖翻问号',
Agrave: '带抑音符的拉丁文大写字母 A',
Aacute: '带锐音符的拉丁文大写字母 A',
Acirc: '带扬抑符的拉丁文大写字母 A',
Atilde: '带颚化符的拉丁文大写字母 A',
Auml: '带分音符的拉丁文大写字母 A',
Aring: '带上圆圈的拉丁文大写字母 A',
AElig: '拉丁文大写字母 Ae',
Ccedil: '带下加符的拉丁文大写字母 C',
Egrave: '带抑音符的拉丁文大写字母 E',
Eacute: '带锐音符的拉丁文大写字母 E',
Ecirc: '带扬抑符的拉丁文大写字母 E',
Euml: '带分音符的拉丁文大写字母 E',
Igrave: '带抑音符的拉丁文大写字母 I',
Iacute: '带锐音符的拉丁文大写字母 I',
Icirc: '带扬抑符的拉丁文大写字母 I',
Iuml: '带分音符的拉丁文大写字母 I',
ETH: '拉丁文大写字母 Eth',
Ntilde: '带颚化符的拉丁文大写字母 N',
Ograve: '带抑音符的拉丁文大写字母 O',
Oacute: '带锐音符的拉丁文大写字母 O',
Ocirc: '带扬抑符的拉丁文大写字母 O',
Otilde: '带颚化符的拉丁文大写字母 O',
Ouml: '带分音符的拉丁文大写字母 O',
times: '乘号',
Oslash: '带粗线的拉丁文大写字母 O',
Ugrave: '带抑音符的拉丁文大写字母 U',
Uacute: '带锐音符的拉丁文大写字母 U',
Ucirc: '带扬抑符的拉丁文大写字母 U',
Uuml: '带分音符的拉丁文大写字母 U',
Yacute: '带抑音符的拉丁文大写字母 Y',
THORN: '拉丁文大写字母 Thorn',
szlig: '拉丁文小写字母清音 S',
agrave: '带抑音符的拉丁文小写字母 A',
aacute: '带锐音符的拉丁文小写字母 A',
acirc: '带扬抑符的拉丁文小写字母 A',
atilde: '带颚化符的拉丁文小写字母 A',
auml: '带分音符的拉丁文小写字母 A',
aring: '带上圆圈的拉丁文小写字母 A',
aelig: '拉丁文小写字母 Ae',
ccedil: '带下加符的拉丁文小写字母 C',
egrave: '带抑音符的拉丁文小写字母 E',
eacute: '带锐音符的拉丁文小写字母 E',
ecirc: '带扬抑符的拉丁文小写字母 E',
euml: '带分音符的拉丁文小写字母 E',
igrave: '带抑音符的拉丁文小写字母 I',
iacute: '带锐音符的拉丁文小写字母 I',
icirc: '带扬抑符的拉丁文小写字母 I',
iuml: '带分音符的拉丁文小写字母 I',
eth: '拉丁文小写字母 Eth',
ntilde: '带颚化符的拉丁文小写字母 N',
ograve: '带抑音符的拉丁文小写字母 O',
oacute: '带锐音符的拉丁文小写字母 O',
ocirc: '带扬抑符的拉丁文小写字母 O',
otilde: '带颚化符的拉丁文小写字母 O',
ouml: '带分音符的拉丁文小写字母 O',
divide: '除号',
oslash: '带粗线的拉丁文小写字母 O',
ugrave: '带抑音符的拉丁文小写字母 U',
uacute: '带锐音符的拉丁文小写字母 U',
ucirc: '带扬抑符的拉丁文小写字母 U',
uuml: '带分音符的拉丁文小写字母 U',
yacute: '带抑音符的拉丁文小写字母 Y',
thorn: '拉丁文小写字母 Thorn',
yuml: '带分音符的拉丁文小写字母 Y',
OElig: '拉丁文大写连字 Oe',
oelig: '拉丁文小写连字 Oe',
'372': '带扬抑符的拉丁文大写字母 W',
'374': '带扬抑符的拉丁文大写字母 Y',
'373': '带扬抑符的拉丁文小写字母 W',
'375': '带扬抑符的拉丁文小写字母 Y',
sbquo: '单下 9 形引号',
'8219': '单高横翻 9 形引号',
bdquo: '双下 9 形引号',
hellip: '水平省略号',
trade: '商标标志',
'9658': '实心右指指针',
bull: '加重号',
rarr: '向右箭头',
rArr: '向右双线箭头',
hArr: '左右双线箭头',
diams: '实心方块纸牌',
asymp: '约等于'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'en',
{
euro: 'Euro sign',
lsquo: 'Left single quotation mark',
rsquo: 'Right single quotation mark',
ldquo: 'Left double quotation mark',
rdquo: 'Right double quotation mark',
ndash: 'En dash',
mdash: 'Em dash',
iexcl: 'Inverted exclamation mark',
cent: 'Cent sign',
pound: 'Pound sign',
curren: 'Currency sign',
yen: 'Yen sign',
brvbar: 'Broken bar',
sect: 'Section sign',
uml: 'Diaeresis',
copy: 'Copyright sign',
ordf: 'Feminine ordinal indicator',
laquo: 'Left-pointing double angle quotation mark',
not: 'Not sign',
reg: 'Registered sign',
macr: 'Macron',
deg: 'Degree sign',
sup2: 'Superscript two',
sup3: 'Superscript three',
acute: 'Acute accent',
micro: 'Micro sign',
para: 'Pilcrow sign',
middot: 'Middle dot',
cedil: 'Cedilla',
sup1: 'Superscript one',
ordm: 'Masculine ordinal indicator',
raquo: 'Right-pointing double angle quotation mark',
frac14: 'Vulgar fraction one quarter',
frac12: 'Vulgar fraction one half',
frac34: 'Vulgar fraction three quarters',
iquest: 'Inverted question mark',
Agrave: 'Latin capital letter A with grave accent',
Aacute: 'Latin capital letter A with acute accent',
Acirc: 'Latin capital letter A with circumflex',
Atilde: 'Latin capital letter A with tilde',
Auml: 'Latin capital letter A with diaeresis',
Aring: 'Latin capital letter A with ring above',
AElig: 'Latin Capital letter Æ',
Ccedil: 'Latin capital letter C with cedilla',
Egrave: 'Latin capital letter E with grave accent',
Eacute: 'Latin capital letter E with acute accent',
Ecirc: 'Latin capital letter E with circumflex',
Euml: 'Latin capital letter E with diaeresis',
Igrave: 'Latin capital letter I with grave accent',
Iacute: 'Latin capital letter I with acute accent',
Icirc: 'Latin capital letter I with circumflex',
Iuml: 'Latin capital letter I with diaeresis',
ETH: 'Latin capital letter Eth',
Ntilde: 'Latin capital letter N with tilde',
Ograve: 'Latin capital letter O with grave accent',
Oacute: 'Latin capital letter O with acute accent',
Ocirc: 'Latin capital letter O with circumflex',
Otilde: 'Latin capital letter O with tilde',
Ouml: 'Latin capital letter O with diaeresis',
times: 'Multiplication sign',
Oslash: 'Latin capital letter O with stroke',
Ugrave: 'Latin capital letter U with grave accent',
Uacute: 'Latin capital letter U with acute accent',
Ucirc: 'Latin capital letter U with circumflex',
Uuml: 'Latin capital letter U with diaeresis',
Yacute: 'Latin capital letter Y with acute accent',
THORN: 'Latin capital letter Thorn',
szlig: 'Latin small letter sharp s',
agrave: 'Latin small letter a with grave accent',
aacute: 'Latin small letter a with acute accent',
acirc: 'Latin small letter a with circumflex',
atilde: 'Latin small letter a with tilde',
auml: 'Latin small letter a with diaeresis',
aring: 'Latin small letter a with ring above',
aelig: 'Latin small letter æ',
ccedil: 'Latin small letter c with cedilla',
egrave: 'Latin small letter e with grave accent',
eacute: 'Latin small letter e with acute accent',
ecirc: 'Latin small letter e with circumflex',
euml: 'Latin small letter e with diaeresis',
igrave: 'Latin small letter i with grave accent',
iacute: 'Latin small letter i with acute accent',
icirc: 'Latin small letter i with circumflex',
iuml: 'Latin small letter i with diaeresis',
eth: 'Latin small letter eth',
ntilde: 'Latin small letter n with tilde',
ograve: 'Latin small letter o with grave accent',
oacute: 'Latin small letter o with acute accent',
ocirc: 'Latin small letter o with circumflex',
otilde: 'Latin small letter o with tilde',
ouml: 'Latin small letter o with diaeresis',
divide: 'Division sign',
oslash: 'Latin small letter o with stroke',
ugrave: 'Latin small letter u with grave accent',
uacute: 'Latin small letter u with acute accent',
ucirc: 'Latin small letter u with circumflex',
uuml: 'Latin small letter u with diaeresis',
yacute: 'Latin small letter y with acute accent',
thorn: 'Latin small letter thorn',
yuml: 'Latin small letter y with diaeresis',
OElig: 'Latin capital ligature OE',
oelig: 'Latin small ligature oe',
'372': 'Latin capital letter W with circumflex',
'374': 'Latin capital letter Y with circumflex',
'373': 'Latin small letter w with circumflex',
'375': 'Latin small letter y with circumflex',
sbquo: 'Single low-9 quotation mark',
'8219': 'Single high-reversed-9 quotation mark',
bdquo: 'Double low-9 quotation mark',
hellip: 'Horizontal ellipsis',
trade: 'Trade mark sign',
'9658': 'Black right-pointing pointer',
bull: 'Bullet',
rarr: 'Rightwards arrow',
rArr: 'Rightwards double arrow',
hArr: 'Left right double arrow',
diams: 'Black diamond suit',
asymp: 'Almost equal to'
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'specialchar', function( editor )
{
/**
* Simulate "this" of a dialog for non-dialog events.
* @type {CKEDITOR.dialog}
*/
var dialog,
lang = editor.lang.specialChar;
var onChoice = function( evt )
{
var target, value;
if ( evt.data )
target = evt.data.getTarget();
else
target = new CKEDITOR.dom.element( evt );
if ( target.getName() == 'a' && ( value = target.getChild( 0 ).getHtml() ) )
{
target.removeClass( "cke_light_background" );
dialog.hide();
// We must use "insertText" here to keep text styled.
var span = editor.document.createElement( 'span' );
span.setHtml( value );
editor.insertText( span.getText() );
}
};
var onClick = CKEDITOR.tools.addFunction( onChoice );
var focusedNode;
var onFocus = function( evt, target )
{
var value;
target = target || evt.data.getTarget();
if ( target.getName() == 'span' )
target = target.getParent();
if ( target.getName() == 'a' && ( value = target.getChild( 0 ).getHtml() ) )
{
// Trigger blur manually if there is focused node.
if ( focusedNode )
onBlur( null, focusedNode );
var htmlPreview = dialog.getContentElement( 'info', 'htmlPreview' ).getElement();
dialog.getContentElement( 'info', 'charPreview' ).getElement().setHtml( value );
htmlPreview.setHtml( CKEDITOR.tools.htmlEncode( value ) );
target.getParent().addClass( "cke_light_background" );
// Memorize focused node.
focusedNode = target;
}
};
var onBlur = function( evt, target )
{
target = target || evt.data.getTarget();
if ( target.getName() == 'span' )
target = target.getParent();
if ( target.getName() == 'a' )
{
dialog.getContentElement( 'info', 'charPreview' ).getElement().setHtml( ' ' );
dialog.getContentElement( 'info', 'htmlPreview' ).getElement().setHtml( ' ' );
target.getParent().removeClass( "cke_light_background" );
focusedNode = undefined;
}
};
var onKeydown = CKEDITOR.tools.addFunction( function( ev )
{
ev = new CKEDITOR.dom.event( ev );
// Get an Anchor element.
var element = ev.getTarget();
var relative, nodeToMove;
var keystroke = ev.getKeystroke(),
rtl = editor.lang.dir == 'rtl';
switch ( keystroke )
{
// UP-ARROW
case 38 :
// relative is TR
if ( ( relative = element.getParent().getParent().getPrevious() ) )
{
nodeToMove = relative.getChild( [element.getParent().getIndex(), 0] );
nodeToMove.focus();
onBlur( null, element );
onFocus( null, nodeToMove );
}
ev.preventDefault();
break;
// DOWN-ARROW
case 40 :
// relative is TR
if ( ( relative = element.getParent().getParent().getNext() ) )
{
nodeToMove = relative.getChild( [ element.getParent().getIndex(), 0 ] );
if ( nodeToMove && nodeToMove.type == 1 )
{
nodeToMove.focus();
onBlur( null, element );
onFocus( null, nodeToMove );
}
}
ev.preventDefault();
break;
// SPACE
// ENTER is already handled as onClick
case 32 :
onChoice( { data: ev } );
ev.preventDefault();
break;
// RIGHT-ARROW
case rtl ? 37 : 39 :
// TAB
case 9 :
// relative is TD
if ( ( relative = element.getParent().getNext() ) )
{
nodeToMove = relative.getChild( 0 );
if ( nodeToMove.type == 1 )
{
nodeToMove.focus();
onBlur( null, element );
onFocus( null, nodeToMove );
ev.preventDefault( true );
}
else
onBlur( null, element );
}
// relative is TR
else if ( ( relative = element.getParent().getParent().getNext() ) )
{
nodeToMove = relative.getChild( [ 0, 0 ] );
if ( nodeToMove && nodeToMove.type == 1 )
{
nodeToMove.focus();
onBlur( null, element );
onFocus( null, nodeToMove );
ev.preventDefault( true );
}
else
onBlur( null, element );
}
break;
// LEFT-ARROW
case rtl ? 39 : 37 :
// SHIFT + TAB
case CKEDITOR.SHIFT + 9 :
// relative is TD
if ( ( relative = element.getParent().getPrevious() ) )
{
nodeToMove = relative.getChild( 0 );
nodeToMove.focus();
onBlur( null, element );
onFocus( null, nodeToMove );
ev.preventDefault( true );
}
// relative is TR
else if ( ( relative = element.getParent().getParent().getPrevious() ) )
{
nodeToMove = relative.getLast().getChild( 0 );
nodeToMove.focus();
onBlur( null, element );
onFocus( null, nodeToMove );
ev.preventDefault( true );
}
else
onBlur( null, element );
break;
default :
// Do not stop not handled events.
return;
}
});
return {
title : lang.title,
minWidth : 430,
minHeight : 280,
buttons : [ CKEDITOR.dialog.cancelButton ],
charColumns : 17,
onLoad : function()
{
var columns = this.definition.charColumns,
extraChars = editor.config.extraSpecialChars,
chars = editor.config.specialChars;
var charsTableLabel = CKEDITOR.tools.getNextId() + '_specialchar_table_label';
var html = [ '<table role="listbox" aria-labelledby="' + charsTableLabel + '"' +
' style="width: 320px; height: 100%; border-collapse: separate;"' +
' align="center" cellspacing="2" cellpadding="2" border="0">' ];
var i = 0,
size = chars.length,
character,
charDesc;
while ( i < size )
{
html.push( '<tr>' ) ;
for ( var j = 0 ; j < columns ; j++, i++ )
{
if ( ( character = chars[ i ] ) )
{
charDesc = '';
if ( character instanceof Array )
{
charDesc = character[ 1 ];
character = character[ 0 ];
}
else
{
var _tmpName = character.replace( '&', '' ).replace( ';', '' ).replace( '#', '' );
// Use character in case description unavailable.
charDesc = lang[ _tmpName ] || character;
}
var charLabelId = 'cke_specialchar_label_' + i + '_' + CKEDITOR.tools.getNextNumber();
html.push(
'<td class="cke_dark_background" style="cursor: default" role="presentation">' +
'<a href="javascript: void(0);" role="option"' +
' aria-posinset="' + ( i +1 ) + '"',
' aria-setsize="' + size + '"',
' aria-labelledby="' + charLabelId + '"',
' style="cursor: inherit; display: block; height: 1.25em; margin-top: 0.25em; text-align: center;" title="', CKEDITOR.tools.htmlEncode( charDesc ), '"' +
' onkeydown="CKEDITOR.tools.callFunction( ' + onKeydown + ', event, this )"' +
' onclick="CKEDITOR.tools.callFunction(' + onClick + ', this); return false;"' +
' tabindex="-1">' +
'<span style="margin: 0 auto;cursor: inherit">' +
character +
'</span>' +
'<span class="cke_voice_label" id="' + charLabelId + '">' +
charDesc +
'</span></a>');
}
else
html.push( '<td class="cke_dark_background"> ' );
html.push( '</td>' );
}
html.push( '</tr>' );
}
html.push( '</tbody></table>', '<span id="' + charsTableLabel + '" class="cke_voice_label">' + lang.options +'</span>' );
this.getContentElement( 'info', 'charContainer' ).getElement().setHtml( html.join( '' ) );
},
contents : [
{
id : 'info',
label : editor.lang.common.generalTab,
title : editor.lang.common.generalTab,
padding : 0,
align : 'top',
elements : [
{
type : 'hbox',
align : 'top',
widths : [ '320px', '90px' ],
children :
[
{
type : 'html',
id : 'charContainer',
html : '',
onMouseover : onFocus,
onMouseout : onBlur,
focus : function()
{
var firstChar = this.getElement().getElementsByTag( 'a' ).getItem( 0 );
setTimeout( function()
{
firstChar.focus();
onFocus( null, firstChar );
}, 0 );
},
onShow : function()
{
var firstChar = this.getElement().getChild( [ 0, 0, 0, 0, 0 ] );
setTimeout( function()
{
firstChar.focus();
onFocus( null, firstChar );
}, 0 );
},
onLoad : function( event )
{
dialog = event.sender;
}
},
{
type : 'hbox',
align : 'top',
widths : [ '100%' ],
children :
[
{
type : 'vbox',
align : 'top',
children :
[
{
type : 'html',
html : '<div></div>'
},
{
type : 'html',
id : 'charPreview',
className : 'cke_dark_background',
style : 'border:1px solid #eeeeee;font-size:28px;height:40px;width:70px;padding-top:9px;font-family:\'Microsoft Sans Serif\',Arial,Helvetica,Verdana;text-align:center;',
html : '<div> </div>'
},
{
type : 'html',
id : 'htmlPreview',
className : 'cke_dark_background',
style : 'border:1px solid #eeeeee;font-size:14px;height:20px;width:70px;padding-top:2px;font-family:\'Microsoft Sans Serif\',Arial,Helvetica,Verdana;text-align:center;',
html : '<div> </div>'
}
]
}
]
}
]
}
]
}
]
};
} );
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
CKEDITOR.plugins.liststyle =
{
requires : [ 'dialog' ],
init : function( editor )
{
editor.addCommand( 'numberedListStyle', new CKEDITOR.dialogCommand( 'numberedListStyle' ) );
CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' );
editor.addCommand( 'bulletedListStyle', new CKEDITOR.dialogCommand( 'bulletedListStyle' ) );
CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' );
// If the "menu" plugin is loaded, register the menu items.
if ( editor.addMenuItems )
{
//Register map group;
editor.addMenuGroup("list", 108);
editor.addMenuItems(
{
numberedlist :
{
label : editor.lang.list.numberedTitle,
group : 'list',
command: 'numberedListStyle'
},
bulletedlist :
{
label : editor.lang.list.bulletedTitle,
group : 'list',
command: 'bulletedListStyle'
}
});
}
// If the "contextmenu" plugin is loaded, register the listeners.
if ( editor.contextMenu )
{
editor.contextMenu.addListener( function( element, selection )
{
if ( !element || element.isReadOnly() )
return null;
while ( element )
{
var name = element.getName();
if ( name == 'ol' )
return { numberedlist: CKEDITOR.TRISTATE_OFF };
else if ( name == 'ul' )
return { bulletedlist: CKEDITOR.TRISTATE_OFF };
element = element.getParent();
}
return null;
});
}
}
};
CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle );
})();
|
JavaScript
|
/*
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
function getListElement( editor, listTag )
{
var range;
try { range = editor.getSelection().getRanges()[ 0 ]; }
catch( e ) { return null; }
range.shrink( CKEDITOR.SHRINK_TEXT );
return range.getCommonAncestor().getAscendant( listTag, 1 );
}
var listItem = function( node ) { return node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' ); };
var mapListStyle = {
'a' : 'lower-alpha',
'A' : 'upper-alpha',
'i' : 'lower-roman',
'I' : 'upper-roman',
'1' : 'decimal',
'disc' : 'disc',
'circle': 'circle',
'square' : 'square'
};
function listStyle( editor, startupPage )
{
var lang = editor.lang.list;
if ( startupPage == 'bulletedListStyle' )
{
return {
title : lang.bulletedTitle,
minWidth : 300,
minHeight : 50,
contents :
[
{
id : 'info',
accessKey : 'I',
elements :
[
{
type : 'select',
label : lang.type,
id : 'type',
align : 'center',
style : 'width:150px',
items :
[
[ lang.notset, '' ],
[ lang.circle, 'circle' ],
[ lang.disc, 'disc' ],
[ lang.square, 'square' ]
],
setup : function( element )
{
var value = element.getStyle( 'list-style-type' )
|| mapListStyle[ element.getAttribute( 'type' ) ]
|| element.getAttribute( 'type' )
|| '';
this.setValue( value );
},
commit : function( element )
{
var value = this.getValue();
if ( value )
element.setStyle( 'list-style-type', value );
else
element.removeStyle( 'list-style-type' );
}
}
]
}
],
onShow: function()
{
var editor = this.getParentEditor(),
element = getListElement( editor, 'ul' );
element && this.setupContent( element );
},
onOk: function()
{
var editor = this.getParentEditor(),
element = getListElement( editor, 'ul' );
element && this.commitContent( element );
}
};
}
else if ( startupPage == 'numberedListStyle' )
{
var listStyleOptions =
[
[ lang.notset, '' ],
[ lang.lowerRoman, 'lower-roman' ],
[ lang.upperRoman, 'upper-roman' ],
[ lang.lowerAlpha, 'lower-alpha' ],
[ lang.upperAlpha, 'upper-alpha' ],
[ lang.decimal, 'decimal' ]
];
if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 7 )
{
listStyleOptions.concat( [
[ lang.armenian, 'armenian' ],
[ lang.decimalLeadingZero, 'decimal-leading-zero' ],
[ lang.georgian, 'georgian' ],
[ lang.lowerGreek, 'lower-greek' ]
]);
}
return {
title : lang.numberedTitle,
minWidth : 300,
minHeight : 50,
contents :
[
{
id : 'info',
accessKey : 'I',
elements :
[
{
type : 'hbox',
widths : [ '25%', '75%' ],
children :
[
{
label : lang.start,
type : 'text',
id : 'start',
validate : CKEDITOR.dialog.validate.integer( lang.validateStartNumber ),
setup : function( element )
{
// List item start number dominates.
var value = element.getFirst( listItem ).getAttribute( 'value' ) || element.getAttribute( 'start' ) || 1;
value && this.setValue( value );
},
commit : function( element )
{
var firstItem = element.getFirst( listItem );
var oldStart = firstItem.getAttribute( 'value' ) || element.getAttribute( 'start' ) || 1;
// Force start number on list root.
element.getFirst( listItem ).removeAttribute( 'value' );
var val = parseInt( this.getValue(), 10 );
if ( isNaN( val ) )
element.removeAttribute( 'start' );
else
element.setAttribute( 'start', val );
// Update consequent list item numbering.
var nextItem = firstItem, conseq = oldStart, startNumber = isNaN( val ) ? 1 : val;
while ( ( nextItem = nextItem.getNext( listItem ) ) && conseq++ )
{
if ( nextItem.getAttribute( 'value' ) == conseq )
nextItem.setAttribute( 'value', startNumber + conseq - oldStart );
}
}
},
{
type : 'select',
label : lang.type,
id : 'type',
style : 'width: 100%;',
items : listStyleOptions,
setup : function( element )
{
var value = element.getStyle( 'list-style-type' )
|| mapListStyle[ element.getAttribute( 'type' ) ]
|| element.getAttribute( 'type' )
|| '';
this.setValue( value );
},
commit : function( element )
{
var value = this.getValue();
if ( value )
element.setStyle( 'list-style-type', value );
else
element.removeStyle( 'list-style-type' );
}
}
]
}
]
}
],
onShow: function()
{
var editor = this.getParentEditor(),
element = getListElement( editor, 'ol' );
element && this.setupContent( element );
},
onOk: function()
{
var editor = this.getParentEditor(),
element = getListElement( editor, 'ol' );
element && this.commitContent( element );
}
};
}
}
CKEDITOR.dialog.add( 'numberedListStyle', function( editor )
{
return listStyle( editor, 'numberedListStyle' );
});
CKEDITOR.dialog.add( 'bulletedListStyle', function( editor )
{
return listStyle( editor, 'bulletedListStyle' );
});
})();
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'docprops',
{
init : function( editor )
{
var cmd = new CKEDITOR.dialogCommand( 'docProps' );
// Only applicable on full page mode.
cmd.modes = { wysiwyg : editor.config.fullPage };
editor.addCommand( 'docProps', cmd );
CKEDITOR.dialog.add( 'docProps', this.path + 'dialogs/docprops.js' );
editor.ui.addButton( 'DocProps',
{
label : editor.lang.docprops.label,
command : 'docProps'
});
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'docProps', function( editor )
{
var lang = editor.lang.docprops,
langCommon = editor.lang.common,
metaHash = {};
function getDialogValue( dialogName, callback )
{
var onOk = function()
{
releaseHandlers( this );
callback( this, this._.parentDialog );
};
var releaseHandlers = function( dialog )
{
dialog.removeListener( 'ok', onOk );
dialog.removeListener( 'cancel', releaseHandlers );
};
var bindToDialog = function( dialog )
{
dialog.on( 'ok', onOk );
dialog.on( 'cancel', releaseHandlers );
};
editor.execCommand( dialogName );
if ( editor._.storedDialogs.colordialog )
bindToDialog( editor._.storedDialogs.colordialog );
else
{
CKEDITOR.on( 'dialogDefinition', function( e )
{
if ( e.data.name != dialogName )
return;
var definition = e.data.definition;
e.removeListener();
definition.onLoad = CKEDITOR.tools.override( definition.onLoad, function( orginal )
{
return function()
{
bindToDialog( this );
definition.onLoad = orginal;
if ( typeof orginal == 'function' )
orginal.call( this );
};
});
});
}
}
function handleOther()
{
var dialog = this.getDialog(),
other = dialog.getContentElement( 'general', this.id + 'Other' );
if ( !other )
return;
if ( this.getValue() == 'other' )
{
other.getInputElement().removeAttribute( 'readOnly' );
other.focus();
other.getElement().removeClass( 'cke_disabled' );
}
else
{
other.getInputElement().setAttribute( 'readOnly', true );
other.getElement().addClass( 'cke_disabled' );
}
}
function commitMeta( name, isHttp, value )
{
return function( doc, html, head )
{
var hash = metaHash,
val = typeof value != 'undefined' ? value : this.getValue();
if ( !val && ( name in hash ) )
hash[ name ].remove();
else if ( val && ( name in hash ) )
hash[ name ].setAttribute( 'content', val );
else if ( val )
{
var meta = new CKEDITOR.dom.element( 'meta', editor.document );
meta.setAttribute( isHttp ? 'http-equiv' : 'name', name );
meta.setAttribute( 'content', val );
head.append( meta );
}
};
}
function setupMeta( name, ret )
{
return function()
{
var hash = metaHash,
result = ( name in hash ) ? hash[ name ].getAttribute( 'content' ) || '' : '';
if ( ret )
return result;
this.setValue( result );
return null;
};
}
function commitMargin( name )
{
return function( doc, html, head, body )
{
body.removeAttribute( 'margin' + name );
var val = this.getValue();
if ( val !== '' )
body.setStyle( 'margin-' + name, CKEDITOR.tools.cssLength( val ) );
else
body.removeStyle( 'margin-' + name );
};
}
function createMetaHash( doc )
{
var hash = {},
metas = doc.getElementsByTag( 'meta' ),
count = metas.count();
for ( var i = 0; i < count; i++ )
{
var meta = metas.getItem( i );
hash[ meta.getAttribute( meta.hasAttribute( 'http-equiv' ) ? 'http-equiv' : 'name' ).toLowerCase() ] = meta;
}
return hash;
}
// We cannot just remove the style from the element, as it might be affected from non-inline stylesheets.
// To get the proper result, we should manually set the inline style to its default value.
function resetStyle( element, prop, resetVal )
{
element.removeStyle( prop );
if ( element.getComputedStyle( prop ) != resetVal )
element.setStyle( prop, resetVal );
}
// Utilty to shorten the creation of color fields in the dialog.
var colorField = function( id, label, fieldProps )
{
return {
type : 'hbox',
padding : 0,
widths : [ '60%', '40%' ],
children : [
CKEDITOR.tools.extend( {
type : 'text',
id : id,
label : lang[ label ]
}, fieldProps || {}, 1 ),
{
type : 'button',
id : id + 'Choose',
label : lang.chooseColor,
className : 'colorChooser',
onClick : function()
{
var self = this;
getDialogValue( 'colordialog', function( colorDialog )
{
var dialog = self.getDialog();
dialog.getContentElement( dialog._.currentTabId, id ).setValue( colorDialog.getContentElement( 'picker', 'selectedColor' ).getValue() );
});
}
}
]
};
};
var previewSrc = 'javascript:' +
'void((function(){' +
encodeURIComponent(
'document.open();' +
( CKEDITOR.env.isCustomDomain() ? 'document.domain=\'' + document.domain + '\';' : '' ) +
'document.write( \'<html style="background-color: #ffffff; height: 100%"><head></head><body style="width: 100%; height: 100%; margin: 0px">' + lang.previewHtml + '</body></html>\' );' +
'document.close();'
) +
'})())';
return {
title : lang.title,
minHeight: 330,
minWidth: 500,
onShow : function()
{
var doc = editor.document,
html = doc.getElementsByTag( 'html' ).getItem( 0 ),
head = doc.getHead(),
body = doc.getBody();
metaHash = createMetaHash( doc );
this.setupContent( doc, html, head, body );
},
onHide : function()
{
metaHash = {};
},
onOk : function()
{
var doc = editor.document,
html = doc.getElementsByTag( 'html' ).getItem( 0 ),
head = doc.getHead(),
body = doc.getBody();
this.commitContent( doc, html, head, body );
},
contents : [
{
id : 'general',
label : langCommon.generalTab,
elements : [
{
type : 'text',
id : 'title',
label : lang.docTitle,
setup : function( doc )
{
this.setValue( doc.getElementsByTag( 'title' ).getItem( 0 ).data( 'cke-title' ) );
},
commit : function( doc, html, head, body, isPreview )
{
if ( isPreview )
return;
doc.getElementsByTag( 'title' ).getItem( 0 ).data( 'cke-title', this.getValue() );
}
},
{
type : 'hbox',
children : [
{
type : 'select',
id : 'dir',
label : langCommon.langDir,
style : 'width: 100%',
items : [
[ langCommon.notSet , '' ],
[ langCommon.langDirLtr, 'ltr' ],
[ langCommon.langDirRtl, 'rtl' ]
],
setup : function( doc, html, head, body )
{
this.setValue( body.getDirection() || '' );
},
commit : function( doc, html, head, body )
{
var val = this.getValue();
if ( val )
body.setAttribute( 'dir', val );
else
body.removeAttribute( 'dir' );
body.removeStyle( 'direction' );
}
},
{
type : 'text',
id : 'langCode',
label : langCommon.langCode,
setup : function( doc, html )
{
this.setValue( html.getAttribute( 'xml:lang' ) || html.getAttribute( 'lang' ) || '' );
},
commit : function( doc, html, head, body, isPreview )
{
if ( isPreview )
return;
var val = this.getValue();
if ( val )
html.setAttributes( { 'xml:lang' : val, lang : val } );
else
html.removeAttributes( { 'xml:lang' : 1, lang : 1 } );
}
}
]
},
{
type : 'hbox',
children : [
{
type : 'select',
id : 'charset',
label : lang.charset,
style : 'width: 100%',
items : [
[ langCommon.notSet, '' ],
[ lang.charsetASCII, 'us-ascii' ],
[ lang.charsetCE, 'iso-8859-2' ],
[ lang.charsetCT, 'big5' ],
[ lang.charsetCR, 'iso-8859-5' ],
[ lang.charsetGR, 'iso-8859-7' ],
[ lang.charsetJP, 'iso-2022-jp' ],
[ lang.charsetKR, 'iso-2022-kr' ],
[ lang.charsetTR, 'iso-8859-9' ],
[ lang.charsetUN, 'utf-8' ],
[ lang.charsetWE, 'iso-8859-1' ],
[ lang.other, 'other' ]
],
'default' : '',
onChange : function()
{
this.getDialog().selectedCharset = this.getValue() != 'other' ? this.getValue() : '';
handleOther.call( this );
},
setup : function()
{
this.metaCharset = ( 'charset' in metaHash );
var func = setupMeta( this.metaCharset ? 'charset' : 'content-type', 1, 1 ),
val = func.call( this );
!this.metaCharset && val.match( /charset=[^=]+$/ ) && ( val = val.substring( val.indexOf( '=' ) + 1 ) );
if ( val )
{
this.setValue( val.toLowerCase() );
if ( !this.getValue() )
{
this.setValue( 'other' );
var other = this.getDialog().getContentElement( 'general', 'charsetOther' );
other && other.setValue( val );
}
this.getDialog().selectedCharset = val;
}
handleOther.call( this );
},
commit : function( doc, html, head, body, isPreview )
{
if ( isPreview )
return;
var value = this.getValue(),
other = this.getDialog().getContentElement( 'general', 'charsetOther' );
value == 'other' && ( value = other ? other.getValue() : '' );
value && !this.metaCharset && ( value = ( metaHash[ 'content-type' ] ? metaHash[ 'content-type' ].getAttribute( 'content' ).split( ';' )[0] : 'text/html' ) + '; charset=' + value );
var func = commitMeta( this.metaCharset ? 'charset' : 'content-type', 1, value );
func.call( this, doc, html, head );
}
},
{
type : 'text',
id : 'charsetOther',
label : lang.charsetOther,
onChange : function(){ this.getDialog().selectedCharset = this.getValue(); }
}
]
},
{
type : 'hbox',
children : [
{
type : 'select',
id : 'docType',
label : lang.docType,
style : 'width: 100%',
items : [
[ langCommon.notSet , '' ],
[ 'XHTML 1.1', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' ],
[ 'XHTML 1.0 Transitional', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' ],
[ 'XHTML 1.0 Strict', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' ],
[ 'XHTML 1.0 Frameset', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' ],
[ 'HTML 5', '<!DOCTYPE html>' ],
[ 'HTML 4.01 Transitional', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' ],
[ 'HTML 4.01 Strict', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' ],
[ 'HTML 4.01 Frameset', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">' ],
[ 'HTML 3.2', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">' ],
[ 'HTML 2.0', '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' ],
[ lang.other, 'other' ]
],
onChange : handleOther,
setup : function()
{
if ( editor.docType )
{
this.setValue( editor.docType );
if ( !this.getValue() )
{
this.setValue( 'other' );
var other = this.getDialog().getContentElement( 'general', 'docTypeOther' );
other && other.setValue( editor.docType );
}
}
handleOther.call( this );
},
commit : function( doc, html, head, body, isPreview )
{
if ( isPreview )
return;
var value = this.getValue(),
other = this.getDialog().getContentElement( 'general', 'docTypeOther' );
editor.docType = value == 'other' ? ( other ? other.getValue() : '' ) : value;
}
},
{
type : 'text',
id : 'docTypeOther',
label : lang.docTypeOther
}
]
},
{
type : 'checkbox',
id : 'xhtmlDec',
label : lang.xhtmlDec,
setup : function()
{
this.setValue( !!editor.xmlDeclaration );
},
commit : function( doc, html, head, body, isPreview )
{
if ( isPreview )
return;
if ( this.getValue() )
{
editor.xmlDeclaration = '<?xml version="1.0" encoding="' + ( this.getDialog().selectedCharset || 'utf-8' )+ '"?>' ;
html.setAttribute( 'xmlns', 'http://www.w3.org/1999/xhtml' );
}
else
{
editor.xmlDeclaration = '';
html.removeAttribute( 'xmlns' );
}
}
}
]
},
{
id : 'design',
label : lang.design,
elements : [
{
type : 'hbox',
widths : [ '60%', '40%' ],
children : [
{
type : 'vbox',
children : [
colorField( 'txtColor', 'txtColor',
{
setup : function( doc, html, head, body )
{
this.setValue( body.getComputedStyle( 'color' ) );
},
commit : function( doc, html, head, body, isPreview )
{
if ( this.isChanged() || isPreview )
{
body.removeAttribute( 'text' );
var val = this.getValue();
if ( val )
body.setStyle( 'color', val );
else
body.removeStyle( 'color' );
}
}
}),
colorField( 'bgColor', 'bgColor', {
setup : function( doc, html, head, body )
{
var val = body.getComputedStyle( 'background-color' ) || '';
this.setValue( val == 'transparent' ? '' : val );
},
commit : function( doc, html, head, body, isPreview )
{
if ( this.isChanged() || isPreview )
{
body.removeAttribute( 'bgcolor' );
var val = this.getValue();
if ( val )
body.setStyle( 'background-color', val );
else
resetStyle( body, 'background-color', 'transparent' );
}
}
}),
{
type : 'hbox',
widths : [ '60%', '40%' ],
padding : 1,
children : [
{
type : 'text',
id : 'bgImage',
label : lang.bgImage,
setup : function( doc, html, head, body )
{
var val = body.getComputedStyle( 'background-image' ) || '';
if ( val == 'none' )
val = '';
else
{
val = val.replace( /url\(\s*(["']?)\s*([^\)]*)\s*\1\s*\)/i, function( match, quote, url )
{
return url;
});
}
this.setValue( val );
},
commit : function( doc, html, head, body )
{
body.removeAttribute( 'background' );
var val = this.getValue();
if ( val )
body.setStyle( 'background-image', 'url(' + val + ')' );
else
resetStyle( body, 'background-image', 'none' );
}
},
{
type : 'button',
id : 'bgImageChoose',
label : langCommon.browseServer,
style : 'display:inline-block;margin-top:10px;',
hidden : true,
filebrowser : 'design:bgImage'
}
]
},
{
type : 'checkbox',
id : 'bgFixed',
label : lang.bgFixed,
setup : function( doc, html, head, body )
{
this.setValue( body.getComputedStyle( 'background-attachment' ) == 'fixed' );
},
commit : function( doc, html, head, body )
{
if ( this.getValue() )
body.setStyle( 'background-attachment', 'fixed' );
else
resetStyle( body, 'background-attachment', 'scroll' );
}
}
]
},
{
type : 'vbox',
children : [
{
type : 'html',
id : 'marginTitle',
html : '<div style="text-align: center; margin: 0px auto; font-weight: bold">' + lang.margin + '</div>'
},
{
type : 'text',
id : 'marginTop',
label : lang.marginTop,
style : 'width: 80px; text-align: center',
align : 'center',
inputStyle : 'text-align: center',
setup : function( doc, html, head, body )
{
this.setValue( body.getStyle( 'margin-top' ) || body.getAttribute( 'margintop' ) || '' );
},
commit : commitMargin( 'top' )
},
{
type : 'hbox',
children : [
{
type : 'text',
id : 'marginLeft',
label : lang.marginLeft,
style : 'width: 80px; text-align: center',
align : 'center',
inputStyle : 'text-align: center',
setup : function( doc, html, head, body )
{
this.setValue( body.getStyle( 'margin-left' ) || body.getAttribute( 'marginleft' ) || '' );
},
commit : commitMargin( 'left' )
},
{
type : 'text',
id : 'marginRight',
label : lang.marginRight,
style : 'width: 80px; text-align: center',
align : 'center',
inputStyle : 'text-align: center',
setup : function( doc, html, head, body )
{
this.setValue( body.getStyle( 'margin-right' ) || body.getAttribute( 'marginright' ) || '' );
},
commit : commitMargin( 'right' )
}
]
},
{
type : 'text',
id : 'marginBottom',
label : lang.marginBottom,
style : 'width: 80px; text-align: center',
align : 'center',
inputStyle : 'text-align: center',
setup : function( doc, html, head, body )
{
this.setValue( body.getStyle( 'margin-bottom' ) || body.getAttribute( 'marginbottom' ) || '' );
},
commit : commitMargin( 'bottom' )
}
]
}
]
}
]
},
{
id : 'meta',
label : lang.meta,
elements : [
{
type : 'textarea',
id : 'metaKeywords',
label : lang.metaKeywords,
setup : setupMeta( 'keywords' ),
commit : commitMeta( 'keywords' )
},
{
type : 'textarea',
id : 'metaDescription',
label : lang.metaDescription,
setup : setupMeta( 'description' ),
commit : commitMeta( 'description' )
},
{
type : 'text',
id : 'metaAuthor',
label : lang.metaAuthor,
setup : setupMeta( 'author' ),
commit : commitMeta( 'author' )
},
{
type : 'text',
id : 'metaCopyright',
label : lang.metaCopyright,
setup : setupMeta( 'copyright' ),
commit : commitMeta( 'copyright' )
}
]
},
{
id : 'preview',
label : langCommon.preview,
elements : [
{
type : 'html',
id : 'previewHtml',
html : '<iframe src="' + previewSrc + '" style="width: 100%; height: 310px" hidefocus="true" frameborder="0" ' +
'id="cke_docProps_preview_iframe"></iframe>',
onLoad : function()
{
this.getDialog().on( 'selectPage', function( ev )
{
if ( ev.data.page == 'preview' )
{
var self = this;
setTimeout( function()
{
var doc = CKEDITOR.document.getById( 'cke_docProps_preview_iframe' ).getFrameDocument(),
html = doc.getElementsByTag( 'html' ).getItem( 0 ),
head = doc.getHead(),
body = doc.getBody();
self.commitContent( doc, html, head, body, 1 );
}, 50 );
}
});
CKEDITOR.document.getById( 'cke_docProps_preview_iframe' ).getAscendant( 'table' ).setStyle( 'height', '100%' );
}
}
]
}
]
};
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
var cssStyle = CKEDITOR.htmlParser.cssStyle,
cssLength = CKEDITOR.tools.cssLength;
var cssLengthRegex = /^((?:\d*(?:\.\d+))|(?:\d+))(.*)?$/i;
/*
* Replacing the former CSS length value with the later one, with
* adjustment to the length unit.
*/
function replaceCssLength( length1, length2 )
{
var parts1 = cssLengthRegex.exec( length1 ),
parts2 = cssLengthRegex.exec( length2 );
// Omit pixel length unit when necessary,
// e.g. replaceCssLength( 10, '20px' ) -> 20
if ( parts1 )
{
if ( !parts1[ 2 ] && parts2[ 2 ] == 'px' )
return parts2[ 1 ];
if ( parts1[ 2 ] == 'px' && !parts2[ 2 ] )
return parts2[ 1 ] + 'px';
}
return length2;
}
var htmlFilterRules =
{
elements :
{
$ : function( element )
{
var attributes = element.attributes,
realHtml = attributes && attributes[ 'data-cke-realelement' ],
realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ),
realElement = realFragment && realFragment.children[ 0 ];
// Width/height in the fake object are subjected to clone into the real element.
if ( realElement && element.attributes[ 'data-cke-resizable' ] )
{
var styles = new cssStyle( element ).rules,
realAttrs = realElement.attributes,
width = styles.width,
height = styles.height;
width && ( realAttrs.width = replaceCssLength( realAttrs.width, width ) );
height && ( realAttrs.height = replaceCssLength( realAttrs.height, height ) );
}
return realElement;
}
}
};
CKEDITOR.plugins.add( 'fakeobjects',
{
requires : [ 'htmlwriter' ],
afterInit : function( editor )
{
var dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
if ( htmlFilter )
htmlFilter.addRules( htmlFilterRules );
}
});
CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType, isResizable )
{
var lang = this.lang.fakeobjects,
label = lang[ realElementType ] || lang.unknown;
var attributes =
{
'class' : className,
src : CKEDITOR.getUrl( 'images/spacer.gif' ),
'data-cke-realelement' : encodeURIComponent( realElement.getOuterHtml() ),
'data-cke-real-node-type' : realElement.type,
alt : label,
title : label,
align : realElement.getAttribute( 'align' ) || ''
};
if ( realElementType )
attributes[ 'data-cke-real-element-type' ] = realElementType;
if ( isResizable )
{
attributes[ 'data-cke-resizable' ] = isResizable;
var fakeStyle = new cssStyle();
var width = realElement.getAttribute( 'width' ),
height = realElement.getAttribute( 'height' );
width && ( fakeStyle.rules.width = cssLength( width ) );
height && ( fakeStyle.rules.height = cssLength( height ) );
fakeStyle.populate( attributes );
}
return this.document.createElement( 'img', { attributes : attributes } );
};
CKEDITOR.editor.prototype.createFakeParserElement = function( realElement, className, realElementType, isResizable )
{
var lang = this.lang.fakeobjects,
label = lang[ realElementType ] || lang.unknown,
html;
var writer = new CKEDITOR.htmlParser.basicWriter();
realElement.writeHtml( writer );
html = writer.getHtml();
var attributes =
{
'class' : className,
src : CKEDITOR.getUrl( 'images/spacer.gif' ),
'data-cke-realelement' : encodeURIComponent( html ),
'data-cke-real-node-type' : realElement.type,
alt : label,
title : label,
align : realElement.attributes.align || ''
};
if ( realElementType )
attributes[ 'data-cke-real-element-type' ] = realElementType;
if ( isResizable )
{
attributes[ 'data-cke-resizable' ] = isResizable;
var realAttrs = realElement.attributes,
fakeStyle = new cssStyle();
var width = realAttrs.width,
height = realAttrs.height;
width != undefined && ( fakeStyle.rules.width = cssLength( width ) );
height != undefined && ( fakeStyle.rules.height = cssLength ( height ) );
fakeStyle.populate( attributes );
}
return new CKEDITOR.htmlParser.element( 'img', attributes );
};
CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement )
{
if ( fakeElement.data( 'cke-real-node-type' ) != CKEDITOR.NODE_ELEMENT )
return null;
var element = CKEDITOR.dom.element.createFromHtml(
decodeURIComponent( fakeElement.data( 'cke-realelement' ) ),
this.document );
if ( fakeElement.data( 'cke-resizable') )
{
var width = fakeElement.getStyle( 'width' ),
height = fakeElement.getStyle( 'height' );
width && element.setAttribute( 'width', replaceCssLength( element.getAttribute( 'width' ), width ) );
height && element.setAttribute( 'height', replaceCssLength( element.getAttribute( 'height' ), height ) );
}
return element;
};
})();
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @file Horizontal Page Break
*/
// Register a plugin named "pagebreak".
CKEDITOR.plugins.add( 'pagebreak',
{
init : function( editor )
{
// Register the command.
editor.addCommand( 'pagebreak', CKEDITOR.plugins.pagebreakCmd );
// Register the toolbar button.
editor.ui.addButton( 'PageBreak',
{
label : editor.lang.pagebreak,
command : 'pagebreak'
});
var cssStyles = [
'{' ,
'background: url(' + CKEDITOR.getUrl( this.path + 'images/pagebreak.gif' ) + ') no-repeat center center;' ,
'clear: both;' ,
'width:100%; _width:99.9%;' ,
'border-top: #999999 1px dotted;' ,
'border-bottom: #999999 1px dotted;' ,
'padding:0;' ,
'height: 5px;' ,
'cursor: default;' ,
'}'
].join( '' ).replace(/;/g, ' !important;' ); // Increase specificity to override other styles, e.g. block outline.
// Add the style that renders our placeholder.
editor.addCss( 'div.cke_pagebreak' + cssStyles );
// Opera needs help to select the page-break.
CKEDITOR.env.opera && editor.on( 'contentDom', function()
{
editor.document.on( 'click', function( evt )
{
var target = evt.data.getTarget();
if ( target.is( 'div' ) && target.hasClass( 'cke_pagebreak') )
editor.getSelection().selectElement( target );
});
});
},
afterInit : function( editor )
{
var label = editor.lang.pagebreakAlt;
// Register a filter to displaying placeholders after mode change.
var dataProcessor = editor.dataProcessor,
dataFilter = dataProcessor && dataProcessor.dataFilter,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
if ( htmlFilter )
{
htmlFilter.addRules(
{
attributes : {
'class' : function( value, element )
{
var className = value.replace( 'cke_pagebreak', '' );
if ( className != value )
{
var span = CKEDITOR.htmlParser.fragment.fromHtml( '<span style="display: none;"> </span>' );
element.children.length = 0;
element.add( span );
var attrs = element.attributes;
delete attrs[ 'aria-label' ];
delete attrs.contenteditable;
delete attrs.title;
}
return className;
}
}
}, 5 );
}
if ( dataFilter )
{
dataFilter.addRules(
{
elements :
{
div : function( element )
{
var attributes = element.attributes,
style = attributes && attributes.style,
child = style && element.children.length == 1 && element.children[ 0 ],
childStyle = child && ( child.name == 'span' ) && child.attributes.style;
if ( childStyle && ( /page-break-after\s*:\s*always/i ).test( style ) && ( /display\s*:\s*none/i ).test( childStyle ) )
{
attributes.contenteditable = "false";
attributes[ 'class' ] = "cke_pagebreak";
attributes[ 'data-cke-display-name' ] = "pagebreak";
attributes[ 'aria-label' ] = label;
attributes[ 'title' ] = label;
element.children.length = 0;
}
}
}
});
}
},
requires : [ 'fakeobjects' ]
});
CKEDITOR.plugins.pagebreakCmd =
{
exec : function( editor )
{
var label = editor.lang.pagebreakAlt;
// Create read-only element that represents a print break.
var pagebreak = CKEDITOR.dom.element.createFromHtml(
'<div style="' +
'page-break-after: always;"' +
'contenteditable="false" ' +
'title="'+ label + '" ' +
'aria-label="'+ label + '" ' +
'data-cke-display-name="pagebreak" ' +
'class="cke_pagebreak">' +
'</div>', editor.document );
var ranges = editor.getSelection().getRanges( true );
editor.fire( 'saveSnapshot' );
for ( var range, i = ranges.length - 1 ; i >= 0; i-- )
{
range = ranges[ i ];
if ( i < ranges.length -1 )
pagebreak = pagebreak.clone( true );
range.splitBlock( 'p' );
range.insertNode( pagebreak );
if ( i == ranges.length - 1 )
{
var next = pagebreak.getNext();
range.moveToPosition( pagebreak, CKEDITOR.POSITION_AFTER_END );
// If there's nothing or a non-editable block followed by, establish a new paragraph
// to make sure cursor is not trapped.
if ( !next || next.type == CKEDITOR.NODE_ELEMENT && !next.isEditable() )
range.fixBlock( true, editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
range.select();
}
}
editor.fire( 'saveSnapshot' );
}
};
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
// #### checkSelectionChange : START
// The selection change check basically saves the element parent tree of
// the current node and check it on successive requests. If there is any
// change on the tree, then the selectionChange event gets fired.
function checkSelectionChange()
{
try
{
// In IE, the "selectionchange" event may still get thrown when
// releasing the WYSIWYG mode, so we need to check it first.
var sel = this.getSelection();
if ( !sel || !sel.document.getWindow().$ )
return;
var firstElement = sel.getStartElement();
var currentPath = new CKEDITOR.dom.elementPath( firstElement );
if ( !currentPath.compare( this._.selectionPreviousPath ) )
{
this._.selectionPreviousPath = currentPath;
this.fire( 'selectionChange', { selection : sel, path : currentPath, element : firstElement } );
}
}
catch (e)
{}
}
var checkSelectionChangeTimer,
checkSelectionChangeTimeoutPending;
function checkSelectionChangeTimeout()
{
// Firing the "OnSelectionChange" event on every key press started to
// be too slow. This function guarantees that there will be at least
// 200ms delay between selection checks.
checkSelectionChangeTimeoutPending = true;
if ( checkSelectionChangeTimer )
return;
checkSelectionChangeTimeoutExec.call( this );
checkSelectionChangeTimer = CKEDITOR.tools.setTimeout( checkSelectionChangeTimeoutExec, 200, this );
}
function checkSelectionChangeTimeoutExec()
{
checkSelectionChangeTimer = null;
if ( checkSelectionChangeTimeoutPending )
{
// Call this with a timeout so the browser properly moves the
// selection after the mouseup. It happened that the selection was
// being moved after the mouseup when clicking inside selected text
// with Firefox.
CKEDITOR.tools.setTimeout( checkSelectionChange, 0, this );
checkSelectionChangeTimeoutPending = false;
}
}
// #### checkSelectionChange : END
function rangeRequiresFix( range )
{
function isInlineCt( node )
{
return node && node.type == CKEDITOR.NODE_ELEMENT
&& node.getName() in CKEDITOR.dtd.$removeEmpty;
}
function singletonBlock( node )
{
var body = range.document.getBody();
return !node.is( 'body' ) && body.getChildCount() == 1;
}
var start = range.startContainer,
offset = range.startOffset;
if ( start.type == CKEDITOR.NODE_TEXT )
return false;
// 1. Empty inline element. <span>^</span>
// 2. Adjoin to inline element. <p><strong>text</strong>^</p>
// 3. The only empty block in document. <body><p>^</p></body> (#7222)
return !CKEDITOR.tools.trim( start.getHtml() ) ? isInlineCt( start ) || singletonBlock( start )
: isInlineCt( start.getChild( offset - 1 ) ) || isInlineCt( start.getChild( offset ) );
}
var selectAllCmd =
{
modes : { wysiwyg : 1, source : 1 },
readOnly : CKEDITOR.env.ie || CKEDITOR.env.webkit,
exec : function( editor )
{
switch ( editor.mode )
{
case 'wysiwyg' :
editor.document.$.execCommand( 'SelectAll', false, null );
// Force triggering selectionChange (#7008)
editor.forceNextSelectionCheck();
editor.selectionChange();
break;
case 'source' :
// Select the contents of the textarea
var textarea = editor.textarea.$;
if ( CKEDITOR.env.ie )
textarea.createTextRange().execCommand( 'SelectAll' );
else
{
textarea.selectionStart = 0;
textarea.selectionEnd = textarea.value.length;
}
textarea.focus();
}
},
canUndo : false
};
function createFillingChar( doc )
{
removeFillingChar( doc );
var fillingChar = doc.createText( '\u200B' );
doc.setCustomData( 'cke-fillingChar', fillingChar );
return fillingChar;
}
function getFillingChar( doc )
{
return doc && doc.getCustomData( 'cke-fillingChar' );
}
// Checks if a filling char has been used, eventualy removing it (#1272).
function checkFillingChar( doc )
{
var fillingChar = doc && getFillingChar( doc );
if ( fillingChar )
{
// Use this flag to avoid removing the filling char right after
// creating it.
if ( fillingChar.getCustomData( 'ready' ) )
removeFillingChar( doc );
else
fillingChar.setCustomData( 'ready', 1 );
}
}
function removeFillingChar( doc )
{
var fillingChar = doc && doc.removeCustomData( 'cke-fillingChar' );
if ( fillingChar )
{
var bm,
sel = doc.getSelection().getNative(),
// Be error proof.
range = sel && sel.type != 'None' && sel.getRangeAt( 0 );
// Text selection position might get mangled by
// subsequent dom modification, save it now for restoring. (#8617)
if ( fillingChar.getLength() > 1
&& range && range.intersectsNode( fillingChar.$ ) )
{
bm = [ sel.anchorOffset, sel.focusOffset ];
// Anticipate the offset change brought by the removed char.
var startAffected = sel.anchorNode == fillingChar.$ && sel.anchorOffset > 0,
endAffected = sel.focusNode == fillingChar.$ && sel.focusOffset > 0;
startAffected && bm[ 0 ]--;
endAffected && bm[ 1 ]--;
// Revert the bookmark order on reverse selection.
isReversedSelection( sel ) && bm.unshift( bm.pop() );
}
// We can't simply remove the filling node because the user
// will actually enlarge it when typing, so we just remove the
// invisible char from it.
fillingChar.setText( fillingChar.getText().replace( /\u200B/g, '' ) );
// Restore the bookmark.
if ( bm )
{
var rng = sel.getRangeAt( 0 );
rng.setStart( rng.startContainer, bm[ 0 ] );
rng.setEnd( rng.startContainer, bm[ 1 ] );
sel.removeAllRanges();
sel.addRange( rng );
}
}
}
function isReversedSelection( sel )
{
if ( !sel.isCollapsed )
{
var range = sel.getRangeAt( 0 );
// Potentially alter an reversed selection range.
range.setStart( sel.anchorNode, sel.anchorOffset );
range.setEnd( sel.focusNode, sel.focusOffset );
return range.collapsed;
}
}
CKEDITOR.plugins.add( 'selection',
{
init : function( editor )
{
// On WebKit only, we need a special "filling" char on some situations
// (#1272). Here we set the events that should invalidate that char.
if ( CKEDITOR.env.webkit )
{
editor.on( 'selectionChange', function() { checkFillingChar( editor.document ); } );
editor.on( 'beforeSetMode', function() { removeFillingChar( editor.document ); } );
var fillingCharBefore,
resetSelection;
function beforeData()
{
var doc = editor.document,
fillingChar = getFillingChar( doc );
if ( fillingChar )
{
// If cursor is right blinking by side of the filler node, save it for restoring,
// as the following text substitution will blind it. (#7437)
var sel = doc.$.defaultView.getSelection();
if ( sel.type == 'Caret' && sel.anchorNode == fillingChar.$ )
resetSelection = 1;
fillingCharBefore = fillingChar.getText();
fillingChar.setText( fillingCharBefore.replace( /\u200B/g, '' ) );
}
}
function afterData()
{
var doc = editor.document,
fillingChar = getFillingChar( doc );
if ( fillingChar )
{
fillingChar.setText( fillingCharBefore );
if ( resetSelection )
{
doc.$.defaultView.getSelection().setPosition( fillingChar.$,fillingChar.getLength() );
resetSelection = 0;
}
}
}
editor.on( 'beforeUndoImage', beforeData );
editor.on( 'afterUndoImage', afterData );
editor.on( 'beforeGetData', beforeData, null, null, 0 );
editor.on( 'getData', afterData );
}
editor.on( 'contentDom', function()
{
var doc = editor.document,
body = doc.getBody(),
html = doc.getDocumentElement();
if ( CKEDITOR.env.ie )
{
// Other browsers don't loose the selection if the
// editor document loose the focus. In IE, we don't
// have support for it, so we reproduce it here, other
// than firing the selection change event.
var savedRange,
saveEnabled,
restoreEnabled = 1;
// "onfocusin" is fired before "onfocus". It makes it
// possible to restore the selection before click
// events get executed.
body.on( 'focusin', function( evt )
{
// If there are elements with layout they fire this event but
// it must be ignored to allow edit its contents #4682
if ( evt.data.$.srcElement.nodeName != 'BODY' )
return;
// Give the priority to locked selection since it probably
// reflects the actual situation, besides locked selection
// could be interfered because of text nodes normalizing.
// (#6083, #6987)
var lockedSelection = doc.getCustomData( 'cke_locked_selection' );
if ( lockedSelection )
{
lockedSelection.unlock( 1 );
lockedSelection.lock();
}
// Then check ff we have saved a range, restore it at this
// point.
else if ( savedRange && restoreEnabled )
{
// Well not break because of this.
try { savedRange.select(); } catch (e) {}
savedRange = null;
}
});
body.on( 'focus', function()
{
// Enable selections to be saved.
saveEnabled = 1;
saveSelection();
});
body.on( 'beforedeactivate', function( evt )
{
// Ignore this event if it's caused by focus switch between
// internal editable control type elements, e.g. layouted paragraph. (#4682)
if ( evt.data.$.toElement )
return;
// Disable selections from being saved.
saveEnabled = 0;
restoreEnabled = 1;
});
// [IE] Iframe will still keep the selection when blurred, if
// focus is moved onto a non-editing host, e.g. link or button, but
// it becomes a problem for the object type selection, since the resizer
// handler attached on it will mark other part of the UI, especially
// for the dialog. (#8157)
// [IE<8] Even worse For old IEs, the cursor will not vanish even if
// the selection has been moved to another text input in some cases. (#4716)
//
// Now the range restore is disabled, so we simply force IE to clean
// up the selection before blur.
CKEDITOR.env.ie && editor.on( 'blur', function()
{
// Error proof when the editor is not visible. (#6375)
try{ doc.$.selection.empty(); } catch ( er){}
});
// Listening on document element ensures that
// scrollbar is included. (#5280)
html.on( 'mousedown', function()
{
// Lock restore selection now, as we have
// a followed 'click' event which introduce
// new selection. (#5735)
restoreEnabled = 0;
});
html.on( 'mouseup', function()
{
restoreEnabled = 1;
});
var scroll;
// IE fires the "selectionchange" event when clicking
// inside a selection. We don't want to capture that.
body.on( 'mousedown', function( evt )
{
// IE scrolls document to top on right mousedown
// when editor has no focus, remember this scroll
// position and revert it before context menu opens. (#5778)
if ( evt.data.$.button == 2 )
{
var sel = editor.document.$.selection;
if ( sel.type == 'None' )
scroll = editor.window.getScrollPosition();
}
disableSave();
});
body.on( 'mouseup',
function( evt )
{
// Restore recorded scroll position when needed on right mouseup.
if ( evt.data.$.button == 2 && scroll )
{
editor.document.$.documentElement.scrollLeft = scroll.x;
editor.document.$.documentElement.scrollTop = scroll.y;
}
scroll = null;
saveEnabled = 1;
setTimeout( function()
{
saveSelection( true );
},
0 );
});
body.on( 'keydown', disableSave );
body.on( 'keyup',
function()
{
saveEnabled = 1;
saveSelection();
});
// When content doc is in standards mode, IE doesn't focus the editor when
// clicking at the region below body (on html element) content, we emulate
// the normal behavior on old IEs. (#1659, #7932)
if ( ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat )
&& doc.$.compatMode != 'BackCompat' )
{
html.on( 'mousedown', function( evt )
{
evt = evt.data.$;
// Expand the text range along with mouse move.
function onHover( evt )
{
evt = evt.data.$;
if ( textRng )
{
// Read the current cursor.
var rngEnd = body.$.createTextRange();
rngEnd.moveToPoint( evt.x, evt.y );
// Handle drag directions.
textRng.setEndPoint(
textRng.compareEndPoints( 'StartToStart', rngEnd ) < 0 ?
'EndToEnd' :
'StartToStart',
rngEnd );
// Update selection with new range.
textRng.select();
}
}
// We're sure that the click happens at the region
// below body, but not on scrollbar.
if ( evt.y < html.$.clientHeight
&& evt.y > body.$.offsetTop + body.$.clientHeight
&& evt.x < html.$.clientWidth )
{
// Start to build the text range.
var textRng = body.$.createTextRange();
textRng.moveToPoint( evt.x, evt.y );
textRng.select();
html.on( 'mousemove', onHover );
html.on( 'mouseup', function( evt )
{
html.removeListener( 'mousemove', onHover );
evt.removeListener();
textRng.select();
textRng = null;
} );
}
});
}
// It's much simpler for IE8, we just need to reselect the reported range.
if ( CKEDITOR.env.ie8 )
{
html.on( 'mouseup', function( evt )
{
// The event is not fired when clicking on the scrollbars,
// so we can safely check the following to understand
// whether the empty space following <body> has been clicked.
if ( evt.data.getTarget().getName() == 'html' )
{
var sel = CKEDITOR.document.$.selection,
range = sel.createRange();
// The selection range is reported on host, but actually it should applies to the content doc.
if ( sel.type != 'None' && range.parentElement().ownerDocument == doc.$ )
range.select();
}
} );
}
// IE is the only to provide the "selectionchange"
// event.
doc.on( 'selectionchange', saveSelection );
function disableSave()
{
saveEnabled = 0;
}
function saveSelection( testIt )
{
if ( saveEnabled )
{
var doc = editor.document,
sel = editor.getSelection(),
nativeSel = sel && sel.getNative();
// There is a very specific case, when clicking
// inside a text selection. In that case, the
// selection collapses at the clicking point,
// but the selection object remains in an
// unknown state, making createRange return a
// range at the very start of the document. In
// such situation we have to test the range, to
// be sure it's valid.
if ( testIt && nativeSel && nativeSel.type == 'None' )
{
// The "InsertImage" command can be used to
// test whether the selection is good or not.
// If not, it's enough to give some time to
// IE to put things in order for us.
if ( !doc.$.queryCommandEnabled( 'InsertImage' ) )
{
CKEDITOR.tools.setTimeout( saveSelection, 50, this, true );
return;
}
}
// Avoid saving selection from within text input. (#5747)
var parentTag;
if ( nativeSel && nativeSel.type && nativeSel.type != 'Control'
&& ( parentTag = nativeSel.createRange() )
&& ( parentTag = parentTag.parentElement() )
&& ( parentTag = parentTag.nodeName )
&& parentTag.toLowerCase() in { input: 1, textarea : 1 } )
{
return;
}
savedRange = nativeSel && sel.getRanges()[ 0 ];
checkSelectionChangeTimeout.call( editor );
}
}
}
else
{
// In other browsers, we make the selection change
// check based on other events, like clicks or keys
// press.
doc.on( 'mouseup', checkSelectionChangeTimeout, editor );
doc.on( 'keyup', checkSelectionChangeTimeout, editor );
doc.on( 'selectionchange', checkSelectionChangeTimeout, editor );
}
if ( CKEDITOR.env.webkit )
{
doc.on( 'keydown', function( evt )
{
var key = evt.data.getKey();
// Remove the filling char before some keys get
// executed, so they'll not get blocked by it.
switch ( key )
{
case 13 : // ENTER
case 33 : // PAGEUP
case 34 : // PAGEDOWN
case 35 : // HOME
case 36 : // END
case 37 : // LEFT-ARROW
case 39 : // RIGHT-ARROW
case 8 : // BACKSPACE
case 45 : // INS
case 46 : // DEl
removeFillingChar( editor.document );
}
}, null, null, 10 );
}
});
// Clear the cached range path before unload. (#7174)
editor.on( 'contentDomUnload', editor.forceNextSelectionCheck, editor );
editor.addCommand( 'selectAll', selectAllCmd );
editor.ui.addButton( 'SelectAll',
{
label : editor.lang.selectAll,
command : 'selectAll'
});
editor.selectionChange = checkSelectionChangeTimeout;
// IE9 might cease to work if there's an object selection inside the iframe (#7639).
CKEDITOR.env.ie9Compat && editor.on( 'destroy', function()
{
var sel = editor.getSelection();
sel && sel.getNative().clear();
}, null, null, 9 );
}
});
/**
* Gets the current selection from the editing area when in WYSIWYG mode.
* @returns {CKEDITOR.dom.selection} A selection object or null if not in
* WYSIWYG mode or no selection is available.
* @example
* var selection = CKEDITOR.instances.editor1.<strong>getSelection()</strong>;
* alert( selection.getType() );
*/
CKEDITOR.editor.prototype.getSelection = function()
{
return this.document && this.document.getSelection();
};
CKEDITOR.editor.prototype.forceNextSelectionCheck = function()
{
delete this._.selectionPreviousPath;
};
/**
* Gets the current selection from the document.
* @returns {CKEDITOR.dom.selection} A selection object.
* @example
* var selection = CKEDITOR.instances.editor1.document.<strong>getSelection()</strong>;
* alert( selection.getType() );
*/
CKEDITOR.dom.document.prototype.getSelection = function()
{
var sel = new CKEDITOR.dom.selection( this );
return ( !sel || sel.isInvalid ) ? null : sel;
};
/**
* No selection.
* @constant
* @example
* if ( editor.getSelection().getType() == CKEDITOR.SELECTION_NONE )
* alert( 'Nothing is selected' );
*/
CKEDITOR.SELECTION_NONE = 1;
/**
* A text or a collapsed selection.
* @constant
* @example
* if ( editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT )
* alert( 'A text is selected' );
*/
CKEDITOR.SELECTION_TEXT = 2;
/**
* Element selection.
* @constant
* @example
* if ( editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT )
* alert( 'An element is selected' );
*/
CKEDITOR.SELECTION_ELEMENT = 3;
/**
* Manipulates the selection in a DOM document.
* @constructor
* @param {CKEDITOR.dom.document} document The DOM document that contains the selection.
* @example
* var sel = new <strong>CKEDITOR.dom.selection( CKEDITOR.document )</strong>;
*/
CKEDITOR.dom.selection = function( document )
{
var lockedSelection = document.getCustomData( 'cke_locked_selection' );
if ( lockedSelection )
return lockedSelection;
this.document = document;
this.isLocked = 0;
this._ =
{
cache : {}
};
/**
* IE BUG: The selection's document may be a different document than the
* editor document. Return null if that is the case.
*/
if ( CKEDITOR.env.ie )
{
// Avoid breaking because of it. (#8836)
try
{
var range = this.getNative().createRange();
if ( !range ||
( range.item && range.item( 0 ).ownerDocument != this.document.$ ) ||
( range.parentElement && range.parentElement().ownerDocument != this.document.$ ) )
{
throw 0;
}
}
catch ( e )
{
this.isInvalid = true;
}
}
return this;
};
var styleObjectElements =
{
img:1,hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,
a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,thead:1,tfoot:1
};
CKEDITOR.dom.selection.prototype =
{
/**
* Gets the native selection object from the browser.
* @function
* @returns {Object} The native browser selection object.
* @example
* var selection = editor.getSelection().<strong>getNative()</strong>;
*/
getNative :
CKEDITOR.env.ie ?
function()
{
return this._.cache.nativeSel || ( this._.cache.nativeSel = this.document.$.selection );
}
:
function()
{
return this._.cache.nativeSel || ( this._.cache.nativeSel = this.document.getWindow().$.getSelection() );
},
/**
* Gets the type of the current selection. The following values are
* available:
* <ul>
* <li><code>{@link CKEDITOR.SELECTION_NONE}</code> (1): No selection.</li>
* <li><code>{@link CKEDITOR.SELECTION_TEXT}</code> (2): A text or a collapsed
* selection is selected.</li>
* <li><code>{@link CKEDITOR.SELECTION_ELEMENT}</code> (3): An element is
* selected.</li>
* </ul>
* @function
* @returns {Number} One of the following constant values:
* <code>{@link CKEDITOR.SELECTION_NONE}</code>, <code>{@link CKEDITOR.SELECTION_TEXT}</code>, or
* <code>{@link CKEDITOR.SELECTION_ELEMENT}</code>.
* @example
* if ( editor.getSelection().<strong>getType()</strong> == CKEDITOR.SELECTION_TEXT )
* alert( 'A text is selected' );
*/
getType :
CKEDITOR.env.ie ?
function()
{
var cache = this._.cache;
if ( cache.type )
return cache.type;
var type = CKEDITOR.SELECTION_NONE;
try
{
var sel = this.getNative(),
ieType = sel.type;
if ( ieType == 'Text' )
type = CKEDITOR.SELECTION_TEXT;
if ( ieType == 'Control' )
type = CKEDITOR.SELECTION_ELEMENT;
// It is possible that we can still get a text range
// object even when type == 'None' is returned by IE.
// So we'd better check the object returned by
// createRange() rather than by looking at the type.
if ( sel.createRange().parentElement )
type = CKEDITOR.SELECTION_TEXT;
}
catch(e) {}
return ( cache.type = type );
}
:
function()
{
var cache = this._.cache;
if ( cache.type )
return cache.type;
var type = CKEDITOR.SELECTION_TEXT;
var sel = this.getNative();
if ( !sel )
type = CKEDITOR.SELECTION_NONE;
else if ( sel.rangeCount == 1 )
{
// Check if the actual selection is a control (IMG,
// TABLE, HR, etc...).
var range = sel.getRangeAt(0),
startContainer = range.startContainer;
if ( startContainer == range.endContainer
&& startContainer.nodeType == 1
&& ( range.endOffset - range.startOffset ) == 1
&& styleObjectElements[ startContainer.childNodes[ range.startOffset ].nodeName.toLowerCase() ] )
{
type = CKEDITOR.SELECTION_ELEMENT;
}
}
return ( cache.type = type );
},
/**
* Retrieves the <code>{@link CKEDITOR.dom.range}</code> instances that represent the current selection.
* Note: Some browsers return multiple ranges even for a continuous selection. Firefox, for example, returns
* one range for each table cell when one or more table rows are selected.
* @function
* @param {Boolean} [onlyEditables] If set to <code>true</code>, this function retrives editable ranges only.
* @return {Array} Range instances that represent the current selection.
* @example
* var ranges = selection.<strong>getRanges()</strong>;
* alert( ranges.length );
*/
getRanges : (function()
{
var func = CKEDITOR.env.ie ?
( function()
{
function getNodeIndex( node ) { return new CKEDITOR.dom.node( node ).getIndex(); }
// Finds the container and offset for a specific boundary
// of an IE range.
var getBoundaryInformation = function( range, start )
{
// Creates a collapsed range at the requested boundary.
range = range.duplicate();
range.collapse( start );
// Gets the element that encloses the range entirely.
var parent = range.parentElement(),
doc = parent.ownerDocument;
// Empty parent element, e.g. <i>^</i>
if ( !parent.hasChildNodes() )
return { container : parent, offset : 0 };
var siblings = parent.children,
child,
sibling,
testRange = range.duplicate(),
startIndex = 0,
endIndex = siblings.length - 1,
index = -1,
position,
distance,
container;
// Binary search over all element childs to test the range to see whether
// range is right on the boundary of one element.
while ( startIndex <= endIndex )
{
index = Math.floor( ( startIndex + endIndex ) / 2 );
child = siblings[ index ];
testRange.moveToElementText( child );
position = testRange.compareEndPoints( 'StartToStart', range );
if ( position > 0 )
endIndex = index - 1;
else if ( position < 0 )
startIndex = index + 1;
else
{
// IE9 report wrong measurement with compareEndPoints when range anchors between two BRs.
// e.g. <p>text<br />^<br /></p> (#7433)
if ( CKEDITOR.env.ie9Compat && child.tagName == 'BR' )
{
// "Fall back" to w3c selection.
var sel = doc.defaultView.getSelection();
return { container : sel[ start ? 'anchorNode' : 'focusNode' ],
offset : sel[ start ? 'anchorOffset' : 'focusOffset' ] };
}
else
return { container : parent, offset : getNodeIndex( child ) };
}
}
// All childs are text nodes,
// or to the right hand of test range are all text nodes. (#6992)
if ( index == -1 || index == siblings.length - 1 && position < 0 )
{
// Adapt test range to embrace the entire parent contents.
testRange.moveToElementText( parent );
testRange.setEndPoint( 'StartToStart', range );
// IE report line break as CRLF with range.text but
// only LF with textnode.nodeValue, normalize them to avoid
// breaking character counting logic below. (#3949)
distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;
siblings = parent.childNodes;
// Actual range anchor right beside test range at the boundary of text node.
if ( !distance )
{
child = siblings[ siblings.length - 1 ];
if ( child.nodeType != CKEDITOR.NODE_TEXT )
return { container : parent, offset : siblings.length };
else
return { container : child, offset : child.nodeValue.length };
}
// Start the measuring until distance overflows, meanwhile count the text nodes.
var i = siblings.length;
while ( distance > 0 && i > 0 )
{
sibling = siblings[ --i ];
if ( sibling.nodeType == CKEDITOR.NODE_TEXT )
{
container = sibling;
distance -= sibling.nodeValue.length;
}
}
return { container : container, offset : -distance };
}
// Test range was one offset beyond OR behind the anchored text node.
else
{
// Adapt one side of test range to the actual range
// for measuring the offset between them.
testRange.collapse( position > 0 ? true : false );
testRange.setEndPoint( position > 0 ? 'StartToStart' : 'EndToStart', range );
// IE report line break as CRLF with range.text but
// only LF with textnode.nodeValue, normalize them to avoid
// breaking character counting logic below. (#3949)
distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;
// Actual range anchor right beside test range at the inner boundary of text node.
if ( !distance )
return { container : parent, offset : getNodeIndex( child ) + ( position > 0 ? 0 : 1 ) };
// Start the measuring until distance overflows, meanwhile count the text nodes.
while ( distance > 0 )
{
try
{
sibling = child[ position > 0 ? 'previousSibling' : 'nextSibling' ];
if ( sibling.nodeType == CKEDITOR.NODE_TEXT )
{
distance -= sibling.nodeValue.length;
container = sibling;
}
child = sibling;
}
// Measurement in IE could be somtimes wrong because of <select> element. (#4611)
catch( e )
{
return { container : parent, offset : getNodeIndex( child ) };
}
}
return { container : container, offset : position > 0 ? -distance : container.nodeValue.length + distance };
}
};
return function()
{
// IE doesn't have range support (in the W3C way), so we
// need to do some magic to transform selections into
// CKEDITOR.dom.range instances.
var sel = this.getNative(),
nativeRange = sel && sel.createRange(),
type = this.getType(),
range;
if ( !sel )
return [];
if ( type == CKEDITOR.SELECTION_TEXT )
{
range = new CKEDITOR.dom.range( this.document );
var boundaryInfo = getBoundaryInformation( nativeRange, true );
range.setStart( new CKEDITOR.dom.node( boundaryInfo.container ), boundaryInfo.offset );
boundaryInfo = getBoundaryInformation( nativeRange );
range.setEnd( new CKEDITOR.dom.node( boundaryInfo.container ), boundaryInfo.offset );
// Correct an invalid IE range case on empty list item. (#5850)
if ( range.endContainer.getPosition( range.startContainer ) & CKEDITOR.POSITION_PRECEDING
&& range.endOffset <= range.startContainer.getIndex() )
{
range.collapse();
}
return [ range ];
}
else if ( type == CKEDITOR.SELECTION_ELEMENT )
{
var retval = [];
for ( var i = 0 ; i < nativeRange.length ; i++ )
{
var element = nativeRange.item( i ),
parentElement = element.parentNode,
j = 0;
range = new CKEDITOR.dom.range( this.document );
for (; j < parentElement.childNodes.length && parentElement.childNodes[j] != element ; j++ )
{ /*jsl:pass*/ }
range.setStart( new CKEDITOR.dom.node( parentElement ), j );
range.setEnd( new CKEDITOR.dom.node( parentElement ), j + 1 );
retval.push( range );
}
return retval;
}
return [];
};
})()
:
function()
{
// On browsers implementing the W3C range, we simply
// tranform the native ranges in CKEDITOR.dom.range
// instances.
var ranges = [],
range,
doc = this.document,
sel = this.getNative();
if ( !sel )
return ranges;
// On WebKit, it may happen that we'll have no selection
// available. We normalize it here by replicating the
// behavior of other browsers.
if ( !sel.rangeCount )
{
range = new CKEDITOR.dom.range( doc );
range.moveToElementEditStart( doc.getBody() );
ranges.push( range );
}
for ( var i = 0 ; i < sel.rangeCount ; i++ )
{
var nativeRange = sel.getRangeAt( i );
range = new CKEDITOR.dom.range( doc );
range.setStart( new CKEDITOR.dom.node( nativeRange.startContainer ), nativeRange.startOffset );
range.setEnd( new CKEDITOR.dom.node( nativeRange.endContainer ), nativeRange.endOffset );
ranges.push( range );
}
return ranges;
};
return function( onlyEditables )
{
var cache = this._.cache;
if ( cache.ranges && !onlyEditables )
return cache.ranges;
else if ( !cache.ranges )
cache.ranges = new CKEDITOR.dom.rangeList( func.call( this ) );
// Split range into multiple by read-only nodes.
if ( onlyEditables )
{
var ranges = cache.ranges;
for ( var i = 0; i < ranges.length; i++ )
{
var range = ranges[ i ];
// Drop range spans inside one ready-only node.
var parent = range.getCommonAncestor();
if ( parent.isReadOnly() )
ranges.splice( i, 1 );
if ( range.collapsed )
continue;
// Range may start inside a non-editable element,
// replace the range start after it.
if ( range.startContainer.isReadOnly() )
{
var current = range.startContainer;
while( current )
{
if ( current.is( 'body' ) || !current.isReadOnly() )
break;
if ( current.type == CKEDITOR.NODE_ELEMENT
&& current.getAttribute( 'contentEditable' ) == 'false' )
range.setStartAfter( current );
current = current.getParent();
}
}
var startContainer = range.startContainer,
endContainer = range.endContainer,
startOffset = range.startOffset,
endOffset = range.endOffset,
walkerRange = range.clone();
// Enlarge range start/end with text node to avoid walker
// being DOM destructive, it doesn't interfere our checking
// of elements below as well.
if ( startContainer && startContainer.type == CKEDITOR.NODE_TEXT )
{
if ( startOffset >= startContainer.getLength() )
walkerRange.setStartAfter( startContainer );
else
walkerRange.setStartBefore( startContainer );
}
if ( endContainer && endContainer.type == CKEDITOR.NODE_TEXT )
{
if ( !endOffset )
walkerRange.setEndBefore( endContainer );
else
walkerRange.setEndAfter( endContainer );
}
// Looking for non-editable element inside the range.
var walker = new CKEDITOR.dom.walker( walkerRange );
walker.evaluator = function( node )
{
if ( node.type == CKEDITOR.NODE_ELEMENT
&& node.isReadOnly() )
{
var newRange = range.clone();
range.setEndBefore( node );
// Drop collapsed range around read-only elements,
// it make sure the range list empty when selecting
// only non-editable elements.
if ( range.collapsed )
ranges.splice( i--, 1 );
// Avoid creating invalid range.
if ( !( node.getPosition( walkerRange.endContainer ) & CKEDITOR.POSITION_CONTAINS ) )
{
newRange.setStartAfter( node );
if ( !newRange.collapsed )
ranges.splice( i + 1, 0, newRange );
}
return true;
}
return false;
};
walker.next();
}
}
return cache.ranges;
};
})(),
/**
* Gets the DOM element in which the selection starts.
* @returns {CKEDITOR.dom.element} The element at the beginning of the
* selection.
* @example
* var element = editor.getSelection().<strong>getStartElement()</strong>;
* alert( element.getName() );
*/
getStartElement : function()
{
var cache = this._.cache;
if ( cache.startElement !== undefined )
return cache.startElement;
var node,
sel = this.getNative();
switch ( this.getType() )
{
case CKEDITOR.SELECTION_ELEMENT :
return this.getSelectedElement();
case CKEDITOR.SELECTION_TEXT :
var range = this.getRanges()[0];
if ( range )
{
if ( !range.collapsed )
{
range.optimize();
// Decrease the range content to exclude particial
// selected node on the start which doesn't have
// visual impact. ( #3231 )
while ( 1 )
{
var startContainer = range.startContainer,
startOffset = range.startOffset;
// Limit the fix only to non-block elements.(#3950)
if ( startOffset == ( startContainer.getChildCount ?
startContainer.getChildCount() : startContainer.getLength() )
&& !startContainer.isBlockBoundary() )
range.setStartAfter( startContainer );
else break;
}
node = range.startContainer;
if ( node.type != CKEDITOR.NODE_ELEMENT )
return node.getParent();
node = node.getChild( range.startOffset );
if ( !node || node.type != CKEDITOR.NODE_ELEMENT )
node = range.startContainer;
else
{
var child = node.getFirst();
while ( child && child.type == CKEDITOR.NODE_ELEMENT )
{
node = child;
child = child.getFirst();
}
}
}
else
{
node = range.startContainer;
if ( node.type != CKEDITOR.NODE_ELEMENT )
node = node.getParent();
}
node = node.$;
}
}
return cache.startElement = ( node ? new CKEDITOR.dom.element( node ) : null );
},
/**
* Gets the currently selected element.
* @returns {CKEDITOR.dom.element} The selected element. Null if no
* selection is available or the selection type is not
* <code>{@link CKEDITOR.SELECTION_ELEMENT}</code>.
* @example
* var element = editor.getSelection().<strong>getSelectedElement()</strong>;
* alert( element.getName() );
*/
getSelectedElement : function()
{
var cache = this._.cache;
if ( cache.selectedElement !== undefined )
return cache.selectedElement;
var self = this;
var node = CKEDITOR.tools.tryThese(
// Is it native IE control type selection?
function()
{
return self.getNative().createRange().item( 0 );
},
// If a table or list is fully selected.
function()
{
var root,
retval,
range = self.getRanges()[ 0 ],
ancestor = range.getCommonAncestor( 1, 1 ),
tags = { table:1,ul:1,ol:1,dl:1 };
for ( var t in tags )
{
if ( ( root = ancestor.getAscendant( t, 1 ) ) )
break;
}
if ( root )
{
// Enlarging the start boundary.
var testRange = new CKEDITOR.dom.range( this.document );
testRange.setStartAt( root, CKEDITOR.POSITION_AFTER_START );
testRange.setEnd( range.startContainer, range.startOffset );
var enlargeables = CKEDITOR.tools.extend( tags, CKEDITOR.dtd.$listItem, CKEDITOR.dtd.$tableContent ),
walker = new CKEDITOR.dom.walker( testRange ),
// Check the range is at the inner boundary of the structural element.
guard = function( walker, isEnd )
{
return function( node, isWalkOut )
{
if ( node.type == CKEDITOR.NODE_TEXT && ( !CKEDITOR.tools.trim( node.getText() ) || node.getParent().data( 'cke-bookmark' ) ) )
return true;
var tag;
if ( node.type == CKEDITOR.NODE_ELEMENT )
{
tag = node.getName();
// Bypass bogus br at the end of block.
if ( tag == 'br' && isEnd && node.equals( node.getParent().getBogus() ) )
return true;
if ( isWalkOut && tag in enlargeables || tag in CKEDITOR.dtd.$removeEmpty )
return true;
}
walker.halted = 1;
return false;
};
};
walker.guard = guard( walker );
if ( walker.checkBackward() && !walker.halted )
{
walker = new CKEDITOR.dom.walker( testRange );
testRange.setStart( range.endContainer, range.endOffset );
testRange.setEndAt( root, CKEDITOR.POSITION_BEFORE_END );
walker.guard = guard( walker, 1 );
if ( walker.checkForward() && !walker.halted )
retval = root.$;
}
}
if ( !retval )
throw 0;
return retval;
},
// Figure it out by checking if there's a single enclosed
// node of the range.
function()
{
var range = self.getRanges()[ 0 ],
enclosed,
selected;
// Check first any enclosed element, e.g. <ul>[<li><a href="#">item</a></li>]</ul>
for ( var i = 2; i && !( ( enclosed = range.getEnclosedNode() )
&& ( enclosed.type == CKEDITOR.NODE_ELEMENT )
&& styleObjectElements[ enclosed.getName() ]
&& ( selected = enclosed ) ); i-- )
{
// Then check any deep wrapped element, e.g. [<b><i><img /></i></b>]
range.shrink( CKEDITOR.SHRINK_ELEMENT );
}
return selected.$;
});
return cache.selectedElement = ( node ? new CKEDITOR.dom.element( node ) : null );
},
/**
* Retrieves the text contained within the range. An empty string is returned for non-text selection.
* @returns {String} A string of text within the current selection.
* @since 3.6.1
* @example
* var text = editor.getSelection().<strong>getSelectedText()</strong>;
* alert( text );
*/
getSelectedText : function()
{
var cache = this._.cache;
if ( cache.selectedText !== undefined )
return cache.selectedText;
var text = '',
nativeSel = this.getNative();
if ( this.getType() == CKEDITOR.SELECTION_TEXT )
text = CKEDITOR.env.ie ? nativeSel.createRange().text : nativeSel.toString();
return ( cache.selectedText = text );
},
/**
* Locks the selection made in the editor in order to make it possible to
* manipulate it without browser interference. A locked selection is
* cached and remains unchanged until it is released with the <code>#unlock</code>
* method.
* @example
* editor.getSelection().<strong>lock()</strong>;
*/
lock : function()
{
// Call all cacheable function.
this.getRanges();
this.getStartElement();
this.getSelectedElement();
this.getSelectedText();
// The native selection is not available when locked.
this._.cache.nativeSel = {};
this.isLocked = 1;
// Save this selection inside the DOM document.
this.document.setCustomData( 'cke_locked_selection', this );
},
/**
* Unlocks the selection made in the editor and locked with the <code>#lock</code> method.
* An unlocked selection is no longer cached and can be changed.
* @param {Boolean} [restore] If set to <code>true</code>, the selection is restored back to the selection saved earlier by using the <code>#lock</code> method.
* @example
* editor.getSelection().<strong>unlock()</strong>;
*/
unlock : function( restore )
{
var doc = this.document,
lockedSelection = doc.getCustomData( 'cke_locked_selection' );
if ( lockedSelection )
{
doc.setCustomData( 'cke_locked_selection', null );
if ( restore )
{
var selectedElement = lockedSelection.getSelectedElement(),
ranges = !selectedElement && lockedSelection.getRanges();
this.isLocked = 0;
this.reset();
doc.getBody().focus();
if ( selectedElement )
this.selectElement( selectedElement );
else
this.selectRanges( ranges );
}
}
if ( !lockedSelection || !restore )
{
this.isLocked = 0;
this.reset();
}
},
/**
* Clears the selection cache.
* @example
* editor.getSelection().<strong>reset()</strong>;
*/
reset : function()
{
this._.cache = {};
},
/**
* Makes the current selection of type <code>{@link CKEDITOR.SELECTION_ELEMENT}</code> by enclosing the specified element.
* @param {CKEDITOR.dom.element} element The element to enclose in the selection.
* @example
* var element = editor.document.getById( 'sampleElement' );
* editor.getSelection.<strong>selectElement( element )</strong>;
*/
selectElement : function( element )
{
if ( this.isLocked )
{
var range = new CKEDITOR.dom.range( this.document );
range.setStartBefore( element );
range.setEndAfter( element );
this._.cache.selectedElement = element;
this._.cache.startElement = element;
this._.cache.ranges = new CKEDITOR.dom.rangeList( range );
this._.cache.type = CKEDITOR.SELECTION_ELEMENT;
return;
}
range = new CKEDITOR.dom.range( element.getDocument() );
range.setStartBefore( element );
range.setEndAfter( element );
range.select();
this.document.fire( 'selectionchange' );
this.reset();
},
/**
* Clears the original selection and adds the specified ranges
* to the document selection.
* @param {Array} ranges An array of <code>{@link CKEDITOR.dom.range}</code> instances representing ranges to be added to the document.
* @example
* var ranges = new CKEDITOR.dom.range( editor.document );
* editor.getSelection().<strong>selectRanges( [ ranges ] )</strong>;
*/
selectRanges : function( ranges )
{
if ( this.isLocked )
{
this._.cache.selectedElement = null;
this._.cache.startElement = ranges[ 0 ] && ranges[ 0 ].getTouchedStartNode();
this._.cache.ranges = new CKEDITOR.dom.rangeList( ranges );
this._.cache.type = CKEDITOR.SELECTION_TEXT;
return;
}
if ( CKEDITOR.env.ie )
{
if ( ranges.length > 1 )
{
// IE doesn't accept multiple ranges selection, so we join all into one.
var last = ranges[ ranges.length -1 ] ;
ranges[ 0 ].setEnd( last.endContainer, last.endOffset );
ranges.length = 1;
}
if ( ranges[ 0 ] )
ranges[ 0 ].select();
this.reset();
}
else
{
var sel = this.getNative();
// getNative() returns null if iframe is "display:none" in FF. (#6577)
if ( !sel )
return;
if ( ranges.length )
{
sel.removeAllRanges();
// Remove any existing filling char first.
CKEDITOR.env.webkit && removeFillingChar( this.document );
}
for ( var i = 0 ; i < ranges.length ; i++ )
{
// Joining sequential ranges introduced by
// readonly elements protection.
if ( i < ranges.length -1 )
{
var left = ranges[ i ], right = ranges[ i +1 ],
between = left.clone();
between.setStart( left.endContainer, left.endOffset );
between.setEnd( right.startContainer, right.startOffset );
// Don't confused by Firefox adjancent multi-ranges
// introduced by table cells selection.
if ( !between.collapsed )
{
between.shrink( CKEDITOR.NODE_ELEMENT, true );
var ancestor = between.getCommonAncestor(),
enclosed = between.getEnclosedNode();
// The following cases has to be considered:
// 1. <span contenteditable="false">[placeholder]</span>
// 2. <input contenteditable="false" type="radio"/> (#6621)
if ( ancestor.isReadOnly() || enclosed && enclosed.isReadOnly() )
{
right.setStart( left.startContainer, left.startOffset );
ranges.splice( i--, 1 );
continue;
}
}
}
var range = ranges[ i ];
var nativeRange = this.document.$.createRange();
var startContainer = range.startContainer;
// In FF2, if we have a collapsed range, inside an empty
// element, we must add something to it otherwise the caret
// will not be visible.
// In Opera instead, the selection will be moved out of the
// element. (#4657)
if ( range.collapsed &&
( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ) &&
startContainer.type == CKEDITOR.NODE_ELEMENT &&
!startContainer.getChildCount() )
{
startContainer.appendText( '' );
}
if ( range.collapsed
&& CKEDITOR.env.webkit
&& rangeRequiresFix( range ) )
{
// Append a zero-width space so WebKit will not try to
// move the selection by itself (#1272).
var fillingChar = createFillingChar( this.document );
range.insertNode( fillingChar ) ;
var next = fillingChar.getNext();
// If the filling char is followed by a <br>, whithout
// having something before it, it'll not blink.
// Let's remove it in this case.
if ( next && !fillingChar.getPrevious() && next.type == CKEDITOR.NODE_ELEMENT && next.getName() == 'br' )
{
removeFillingChar( this.document );
range.moveToPosition( next, CKEDITOR.POSITION_BEFORE_START );
}
else
range.moveToPosition( fillingChar, CKEDITOR.POSITION_AFTER_END );
}
nativeRange.setStart( range.startContainer.$, range.startOffset );
try
{
nativeRange.setEnd( range.endContainer.$, range.endOffset );
}
catch ( e )
{
// There is a bug in Firefox implementation (it would be too easy
// otherwise). The new start can't be after the end (W3C says it can).
// So, let's create a new range and collapse it to the desired point.
if ( e.toString().indexOf( 'NS_ERROR_ILLEGAL_VALUE' ) >= 0 )
{
range.collapse( 1 );
nativeRange.setEnd( range.endContainer.$, range.endOffset );
}
else
throw e;
}
// Select the range.
sel.addRange( nativeRange );
}
// Don't miss selection change event for non-IEs.
this.document.fire( 'selectionchange' );
this.reset();
}
},
/**
* Creates a bookmark for each range of this selection (from <code>#getRanges</code>)
* by calling the <code>{@link CKEDITOR.dom.range.prototype.createBookmark}</code> method,
* with extra care taken to avoid interference among those ranges. The arguments
* received are the same as with the underlying range method.
* @returns {Array} Array of bookmarks for each range.
* @example
* var bookmarks = editor.getSelection().<strong>createBookmarks()</strong>;
*/
createBookmarks : function( serializable )
{
return this.getRanges().createBookmarks( serializable );
},
/**
* Creates a bookmark for each range of this selection (from <code>#getRanges</code>)
* by calling the <code>{@link CKEDITOR.dom.range.prototype.createBookmark2}</code> method,
* with extra care taken to avoid interference among those ranges. The arguments
* received are the same as with the underlying range method.
* @returns {Array} Array of bookmarks for each range.
* @example
* var bookmarks = editor.getSelection().<strong>createBookmarks2()</strong>;
*/
createBookmarks2 : function( normalized )
{
return this.getRanges().createBookmarks2( normalized );
},
/**
* Selects the virtual ranges denoted by the bookmarks by calling <code>#selectRanges</code>.
* @param {Array} bookmarks The bookmarks representing ranges to be selected.
* @returns {CKEDITOR.dom.selection} This selection object, after the ranges were selected.
* @example
* var bookmarks = editor.getSelection().createBookmarks();
* editor.getSelection().<strong>selectBookmarks( bookmarks )</strong>;
*/
selectBookmarks : function( bookmarks )
{
var ranges = [];
for ( var i = 0 ; i < bookmarks.length ; i++ )
{
var range = new CKEDITOR.dom.range( this.document );
range.moveToBookmark( bookmarks[i] );
ranges.push( range );
}
this.selectRanges( ranges );
return this;
},
/**
* Retrieves the common ancestor node of the first range and the last range.
* @returns {CKEDITOR.dom.element} The common ancestor of the selection.
* @example
* var ancestor = editor.getSelection().<strong>getCommonAncestor()</strong>;
*/
getCommonAncestor : function()
{
var ranges = this.getRanges(),
startNode = ranges[ 0 ].startContainer,
endNode = ranges[ ranges.length - 1 ].endContainer;
return startNode.getCommonAncestor( endNode );
},
/**
* Moves the scrollbar to the starting position of the current selection.
* @example
* editor.getSelection().<strong>scrollIntoView()</strong>;
*/
scrollIntoView : function()
{
// If we have split the block, adds a temporary span at the
// range position and scroll relatively to it.
var start = this.getStartElement();
start.scrollIntoView();
}
};
})();
( function()
{
var notWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
fillerTextRegex = /\ufeff|\u00a0/,
nonCells = { table:1,tbody:1,tr:1 };
CKEDITOR.dom.range.prototype.select =
CKEDITOR.env.ie ?
// V2
function( forceExpand )
{
var collapsed = this.collapsed,
isStartMarkerAlone, dummySpan, ieRange;
// Try to make a object selection.
var selected = this.getEnclosedNode();
if ( selected )
{
try
{
ieRange = this.document.$.body.createControlRange();
ieRange.addElement( selected.$ );
ieRange.select();
return;
}
catch( er ) {}
}
// IE doesn't support selecting the entire table row/cell, move the selection into cells, e.g.
// <table><tbody><tr>[<td>cell</b></td>... => <table><tbody><tr><td>[cell</td>...
if ( this.startContainer.type == CKEDITOR.NODE_ELEMENT && this.startContainer.getName() in nonCells
|| this.endContainer.type == CKEDITOR.NODE_ELEMENT && this.endContainer.getName() in nonCells )
{
this.shrink( CKEDITOR.NODE_ELEMENT, true );
}
var bookmark = this.createBookmark();
// Create marker tags for the start and end boundaries.
var startNode = bookmark.startNode;
var endNode;
if ( !collapsed )
endNode = bookmark.endNode;
// Create the main range which will be used for the selection.
ieRange = this.document.$.body.createTextRange();
// Position the range at the start boundary.
ieRange.moveToElementText( startNode.$ );
ieRange.moveStart( 'character', 1 );
if ( endNode )
{
// Create a tool range for the end.
var ieRangeEnd = this.document.$.body.createTextRange();
// Position the tool range at the end.
ieRangeEnd.moveToElementText( endNode.$ );
// Move the end boundary of the main range to match the tool range.
ieRange.setEndPoint( 'EndToEnd', ieRangeEnd );
ieRange.moveEnd( 'character', -1 );
}
else
{
// The isStartMarkerAlone logic comes from V2. It guarantees that the lines
// will expand and that the cursor will be blinking on the right place.
// Actually, we are using this flag just to avoid using this hack in all
// situations, but just on those needed.
var next = startNode.getNext( notWhitespaces );
isStartMarkerAlone = ( !( next && next.getText && next.getText().match( fillerTextRegex ) ) // already a filler there?
&& ( forceExpand || !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) ) ) );
// Append a temporary <span></span> before the selection.
// This is needed to avoid IE destroying selections inside empty
// inline elements, like <b></b> (#253).
// It is also needed when placing the selection right after an inline
// element to avoid the selection moving inside of it.
dummySpan = this.document.createElement( 'span' );
dummySpan.setHtml( '' ); // Zero Width No-Break Space (U+FEFF). See #1359.
dummySpan.insertBefore( startNode );
if ( isStartMarkerAlone )
{
// To expand empty blocks or line spaces after <br>, we need
// instead to have any char, which will be later deleted using the
// selection.
// \ufeff = Zero Width No-Break Space (U+FEFF). (#1359)
this.document.createText( '\ufeff' ).insertBefore( startNode );
}
}
// Remove the markers (reset the position, because of the changes in the DOM tree).
this.setStartBefore( startNode );
startNode.remove();
if ( collapsed )
{
if ( isStartMarkerAlone )
{
// Move the selection start to include the temporary \ufeff.
ieRange.moveStart( 'character', -1 );
ieRange.select();
// Remove our temporary stuff.
this.document.$.selection.clear();
}
else
ieRange.select();
this.moveToPosition( dummySpan, CKEDITOR.POSITION_BEFORE_START );
dummySpan.remove();
}
else
{
this.setEndBefore( endNode );
endNode.remove();
ieRange.select();
}
this.document.fire( 'selectionchange' );
}
:
function()
{
this.document.getSelection().selectRanges( [ this ] );
};
} )();
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'popup' );
CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
{
/**
* Opens Browser in a popup. The "width" and "height" parameters accept
* numbers (pixels) or percent (of screen size) values.
* @param {String} url The url of the external file browser.
* @param {String} width Popup window width.
* @param {String} height Popup window height.
* @param {String} options Popup window features.
*/
popup : function( url, width, height, options )
{
width = width || '80%';
height = height || '70%';
if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) == '%' )
width = parseInt( window.screen.width * parseInt( width, 10 ) / 100, 10 );
if ( typeof height == 'string' && height.length > 1 && height.substr( height.length - 1, 1 ) == '%' )
height = parseInt( window.screen.height * parseInt( height, 10 ) / 100, 10 );
if ( width < 640 )
width = 640;
if ( height < 420 )
height = 420;
var top = parseInt( ( window.screen.height - height ) / 2, 10 ),
left = parseInt( ( window.screen.width - width ) / 2, 10 );
options = ( options || 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes' ) +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;
var popupWindow = window.open( '', null, options, true );
// Blocked by a popup blocker.
if ( !popupWindow )
return false;
try
{
// Chrome 18 is problematic, but it's not really needed here (#8855).
var ua = navigator.userAgent.toLowerCase();
if ( ua.indexOf( ' chrome/18' ) == -1 )
{
popupWindow.moveTo( left, top );
popupWindow.resizeTo( width, height );
}
popupWindow.focus();
popupWindow.location.href = url;
}
catch ( e )
{
popupWindow = window.open( url, null, options, true );
}
return true;
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview The "elementspath" plugin. It shows all elements in the DOM
* parent tree relative to the current selection in the editing area.
*/
(function()
{
var commands =
{
toolbarFocus :
{
editorFocus : false,
readOnly : 1,
exec : function( editor )
{
var idBase = editor._.elementsPath.idBase;
var element = CKEDITOR.document.getById( idBase + '0' );
// Make the first button focus accessible for IE. (#3417)
// Adobe AIR instead need while of delay.
element && element.focus( CKEDITOR.env.ie || CKEDITOR.env.air );
}
}
};
var emptyHtml = '<span class="cke_empty"> </span>';
CKEDITOR.plugins.add( 'elementspath',
{
requires : [ 'selection' ],
init : function( editor )
{
var spaceId = 'cke_path_' + editor.name;
var spaceElement;
var getSpaceElement = function()
{
if ( !spaceElement )
spaceElement = CKEDITOR.document.getById( spaceId );
return spaceElement;
};
var idBase = 'cke_elementspath_' + CKEDITOR.tools.getNextNumber() + '_';
editor._.elementsPath = { idBase : idBase, filters : [] };
editor.on( 'themeSpace', function( event )
{
if ( event.data.space == 'bottom' )
{
event.data.html +=
'<span id="' + spaceId + '_label" class="cke_voice_label">' + editor.lang.elementsPath.eleLabel + '</span>' +
'<div id="' + spaceId + '" class="cke_path" role="group" aria-labelledby="' + spaceId + '_label">' + emptyHtml + '</div>';
}
});
function onClick( elementIndex )
{
editor.focus();
var element = editor._.elementsPath.list[ elementIndex ];
if ( element.is( 'body' ) )
{
var range = new CKEDITOR.dom.range( editor.document );
range.selectNodeContents( element );
range.select();
}
else
editor.getSelection().selectElement( element );
}
var onClickHanlder = CKEDITOR.tools.addFunction( onClick );
var onKeyDownHandler = CKEDITOR.tools.addFunction( function( elementIndex, ev )
{
var idBase = editor._.elementsPath.idBase,
element;
ev = new CKEDITOR.dom.event( ev );
var rtl = editor.lang.dir == 'rtl';
switch ( ev.getKeystroke() )
{
case rtl ? 39 : 37 : // LEFT-ARROW
case 9 : // TAB
element = CKEDITOR.document.getById( idBase + ( elementIndex + 1 ) );
if ( !element )
element = CKEDITOR.document.getById( idBase + '0' );
element.focus();
return false;
case rtl ? 37 : 39 : // RIGHT-ARROW
case CKEDITOR.SHIFT + 9 : // SHIFT + TAB
element = CKEDITOR.document.getById( idBase + ( elementIndex - 1 ) );
if ( !element )
element = CKEDITOR.document.getById( idBase + ( editor._.elementsPath.list.length - 1 ) );
element.focus();
return false;
case 27 : // ESC
editor.focus();
return false;
case 13 : // ENTER // Opera
case 32 : // SPACE
onClick( elementIndex );
return false;
}
return true;
});
editor.on( 'selectionChange', function( ev )
{
var env = CKEDITOR.env,
selection = ev.data.selection,
element = selection.getStartElement(),
html = [],
editor = ev.editor,
elementsList = editor._.elementsPath.list = [],
filters = editor._.elementsPath.filters;
while ( element )
{
var ignore = 0,
name;
if ( element.data( 'cke-display-name' ) )
name = element.data( 'cke-display-name' );
else if ( element.data( 'cke-real-element-type' ) )
name = element.data( 'cke-real-element-type' );
else
name = element.getName();
for ( var i = 0; i < filters.length; i++ )
{
var ret = filters[ i ]( element, name );
if ( ret === false )
{
ignore = 1;
break;
}
name = ret || name;
}
if ( !ignore )
{
var index = elementsList.push( element ) - 1;
// Use this variable to add conditional stuff to the
// HTML (because we are doing it in reverse order... unshift).
var extra = '';
// Some browsers don't cancel key events in the keydown but in the
// keypress.
// TODO: Check if really needed for Gecko+Mac.
if ( env.opera || ( env.gecko && env.mac ) )
extra += ' onkeypress="return false;"';
// With Firefox, we need to force the button to redraw, otherwise it
// will remain in the focus state.
if ( env.gecko )
extra += ' onblur="this.style.cssText = this.style.cssText;"';
var label = editor.lang.elementsPath.eleTitle.replace( /%1/, name );
html.unshift(
'<a' +
' id="', idBase, index, '"' +
' href="javascript:void(\'', name, '\')"' +
' tabindex="-1"' +
' title="', label, '"' +
( ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ?
' onfocus="event.preventBubble();"' : '' ) +
' hidefocus="true" ' +
' onkeydown="return CKEDITOR.tools.callFunction(', onKeyDownHandler, ',', index, ', event );"' +
extra ,
' onclick="CKEDITOR.tools.callFunction('+ onClickHanlder, ',', index, '); return false;"',
' role="button" aria-labelledby="' + idBase + index + '_label">',
name,
'<span id="', idBase, index, '_label" class="cke_label">' + label + '</span>',
'</a>' );
}
if ( name == 'body' )
break;
element = element.getParent();
}
var space = getSpaceElement();
space.setHtml( html.join('') + emptyHtml );
editor.fire( 'elementsPathUpdate', { space : space } );
});
function empty()
{
spaceElement && spaceElement.setHtml( emptyHtml );
delete editor._.elementsPath.list;
}
editor.on( 'readOnly', empty );
editor.on( 'contentDomUnload', empty );
editor.addCommand( 'elementsPathFocus', commands.toolbarFocus );
}
});
})();
/**
* Fired when the contents of the elementsPath are changed
* @name CKEDITOR.editor#elementsPathUpdate
* @event
* @param {Object} eventData.space The elementsPath container
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
var guardElements = { table:1, ul:1, ol:1, blockquote:1, div:1 },
directSelectionGuardElements = {},
// All guard elements which can have a direction applied on them.
allGuardElements = {};
CKEDITOR.tools.extend( directSelectionGuardElements, guardElements, { tr:1, p:1, div:1, li:1 } );
CKEDITOR.tools.extend( allGuardElements, directSelectionGuardElements, { td:1 } );
function onSelectionChange( e )
{
setToolbarStates( e );
handleMixedDirContent( e );
}
function setToolbarStates( evt )
{
var editor = evt.editor,
path = evt.data.path;
if ( editor.readOnly )
return;
var useComputedState = editor.config.useComputedState,
selectedElement;
useComputedState = useComputedState === undefined || useComputedState;
// We can use computedState provided by the browser or traverse parents manually.
if ( !useComputedState )
selectedElement = getElementForDirection( path.lastElement );
selectedElement = selectedElement || path.block || path.blockLimit;
// If we're having BODY here, user probably done CTRL+A, let's try to get the enclosed node, if any.
if ( selectedElement.is( 'body' ) )
{
var enclosedNode = editor.getSelection().getRanges()[ 0 ].getEnclosedNode();
enclosedNode && enclosedNode.type == CKEDITOR.NODE_ELEMENT && ( selectedElement = enclosedNode );
}
if ( !selectedElement )
return;
var selectionDir = useComputedState ?
selectedElement.getComputedStyle( 'direction' ) :
selectedElement.getStyle( 'direction' ) || selectedElement.getAttribute( 'dir' );
editor.getCommand( 'bidirtl' ).setState( selectionDir == 'rtl' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
editor.getCommand( 'bidiltr' ).setState( selectionDir == 'ltr' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
}
function handleMixedDirContent( evt )
{
var editor = evt.editor,
directionNode = evt.data.path.block || evt.data.path.blockLimit;
editor.fire( 'contentDirChanged', directionNode ? directionNode.getComputedStyle( 'direction' ) : editor.lang.dir );
}
/**
* Returns element with possibility of applying the direction.
* @param node
*/
function getElementForDirection( node )
{
while ( node && !( node.getName() in allGuardElements || node.is( 'body' ) ) )
{
var parent = node.getParent();
if ( !parent )
break;
node = parent;
}
return node;
}
function switchDir( element, dir, editor, database )
{
if ( element.isReadOnly() )
return;
// Mark this element as processed by switchDir.
CKEDITOR.dom.element.setMarker( database, element, 'bidi_processed', 1 );
// Check whether one of the ancestors has already been styled.
var parent = element;
while ( ( parent = parent.getParent() ) && !parent.is( 'body' ) )
{
if ( parent.getCustomData( 'bidi_processed' ) )
{
// Ancestor style must dominate.
element.removeStyle( 'direction' );
element.removeAttribute( 'dir' );
return;
}
}
var useComputedState = ( 'useComputedState' in editor.config ) ? editor.config.useComputedState : 1;
var elementDir = useComputedState ? element.getComputedStyle( 'direction' )
: element.getStyle( 'direction' ) || element.hasAttribute( 'dir' );
// Stop if direction is same as present.
if ( elementDir == dir )
return;
// Clear direction on this element.
element.removeStyle( 'direction' );
// Do the second check when computed state is ON, to check
// if we need to apply explicit direction on this element.
if ( useComputedState )
{
element.removeAttribute( 'dir' );
if ( dir != element.getComputedStyle( 'direction' ) )
element.setAttribute( 'dir', dir );
}
else
// Set new direction for this element.
element.setAttribute( 'dir', dir );
editor.forceNextSelectionCheck();
return;
}
function getFullySelected( range, elements, enterMode )
{
var ancestor = range.getCommonAncestor( false, true );
range = range.clone();
range.enlarge( enterMode == CKEDITOR.ENTER_BR ?
CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS
: CKEDITOR.ENLARGE_BLOCK_CONTENTS );
if ( range.checkBoundaryOfElement( ancestor, CKEDITOR.START )
&& range.checkBoundaryOfElement( ancestor, CKEDITOR.END ) )
{
var parent;
while ( ancestor && ancestor.type == CKEDITOR.NODE_ELEMENT
&& ( parent = ancestor.getParent() )
&& parent.getChildCount() == 1
&& !( ancestor.getName() in elements ) )
ancestor = parent;
return ancestor.type == CKEDITOR.NODE_ELEMENT
&& ( ancestor.getName() in elements )
&& ancestor;
}
}
function bidiCommand( dir )
{
return function( editor )
{
var selection = editor.getSelection(),
enterMode = editor.config.enterMode,
ranges = selection.getRanges();
if ( ranges && ranges.length )
{
var database = {};
// Creates bookmarks for selection, as we may split some blocks.
var bookmarks = selection.createBookmarks();
var rangeIterator = ranges.createIterator(),
range,
i = 0;
while ( ( range = rangeIterator.getNextRange( 1 ) ) )
{
// Apply do directly selected elements from guardElements.
var selectedElement = range.getEnclosedNode();
// If this is not our element of interest, apply to fully selected elements from guardElements.
if ( !selectedElement || selectedElement
&& !( selectedElement.type == CKEDITOR.NODE_ELEMENT && selectedElement.getName() in directSelectionGuardElements )
)
selectedElement = getFullySelected( range, guardElements, enterMode );
selectedElement && switchDir( selectedElement, dir, editor, database );
var iterator,
block;
// Walker searching for guardElements.
var walker = new CKEDITOR.dom.walker( range );
var start = bookmarks[ i ].startNode,
end = bookmarks[ i++ ].endNode;
walker.evaluator = function( node )
{
return !! ( node.type == CKEDITOR.NODE_ELEMENT
&& node.getName() in guardElements
&& !( node.getName() == ( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' )
&& node.getParent().type == CKEDITOR.NODE_ELEMENT
&& node.getParent().getName() == 'blockquote' )
// Element must be fully included in the range as well. (#6485).
&& node.getPosition( start ) & CKEDITOR.POSITION_FOLLOWING
&& ( ( node.getPosition( end ) & CKEDITOR.POSITION_PRECEDING + CKEDITOR.POSITION_CONTAINS ) == CKEDITOR.POSITION_PRECEDING ) );
};
while ( ( block = walker.next() ) )
switchDir( block, dir, editor, database );
iterator = range.createIterator();
iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR;
while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) )
switchDir( block, dir, editor, database );
}
CKEDITOR.dom.element.clearAllMarkers( database );
editor.forceNextSelectionCheck();
// Restore selection position.
selection.selectBookmarks( bookmarks );
editor.focus();
}
};
}
CKEDITOR.plugins.add( 'bidi',
{
requires : [ 'styles', 'button' ],
init : function( editor )
{
// All buttons use the same code to register. So, to avoid
// duplications, let's use this tool function.
var addButtonCommand = function( buttonName, buttonLabel, commandName, commandExec )
{
editor.addCommand( commandName, new CKEDITOR.command( editor, { exec : commandExec }) );
editor.ui.addButton( buttonName,
{
label : buttonLabel,
command : commandName
});
};
var lang = editor.lang.bidi;
addButtonCommand( 'BidiLtr', lang.ltr, 'bidiltr', bidiCommand( 'ltr' ) );
addButtonCommand( 'BidiRtl', lang.rtl, 'bidirtl', bidiCommand( 'rtl' ) );
editor.on( 'selectionChange', onSelectionChange );
editor.on( 'contentDom', function()
{
editor.document.on( 'dirChanged', function( evt )
{
editor.fire( 'dirChanged',
{
node : evt.data,
dir : evt.data.getDirection( 1 )
} );
});
});
}
});
// If the element direction changed, we need to switch the margins of
// the element and all its children, so it will get really reflected
// like a mirror. (#5910)
function isOffline( el )
{
var html = el.getDocument().getBody().getParent();
while ( el )
{
if ( el.equals( html ) )
return false;
el = el.getParent();
}
return true;
}
function dirChangeNotifier( org )
{
var isAttribute = org == elementProto.setAttribute,
isRemoveAttribute = org == elementProto.removeAttribute,
dirStyleRegexp = /\bdirection\s*:\s*(.*?)\s*(:?$|;)/;
return function( name, val )
{
if ( !this.getDocument().equals( CKEDITOR.document ) )
{
var orgDir;
if ( ( name == ( isAttribute || isRemoveAttribute ? 'dir' : 'direction' ) ||
name == 'style' && ( isRemoveAttribute || dirStyleRegexp.test( val ) ) ) && !isOffline( this ) )
{
orgDir = this.getDirection( 1 );
var retval = org.apply( this, arguments );
if ( orgDir != this.getDirection( 1 ) )
{
this.getDocument().fire( 'dirChanged', this );
return retval;
}
}
}
return org.apply( this, arguments );
};
}
var elementProto = CKEDITOR.dom.element.prototype,
methods = [ 'setStyle', 'removeStyle', 'setAttribute', 'removeAttribute' ];
for ( var i = 0; i < methods.length; i++ )
elementProto[ methods[ i ] ] = CKEDITOR.tools.override( elementProto[ methods [ i ] ], dirChangeNotifier );
})();
/**
* Fired when the language direction of an element is changed
* @name CKEDITOR.editor#dirChanged
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {Object} eventData.node The element that is being changed.
* @param {String} eventData.dir The new direction.
*/
/**
* Fired when the language direction in the specific cursor position is changed
* @name CKEDITOR.editor#contentDirChanged
* @event
* @param {String} eventData The direction in the current position.
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
// Register a templates definition set named "default".
CKEDITOR.addTemplates( 'default',
{
// The name of sub folder which hold the shortcut preview images of the
// templates.
imagesPath : CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'templates' ) + 'templates/images/' ),
// The templates definitions.
templates :
[
{
title: 'Image and Title',
image: 'template1.gif',
description: 'One main image with a title and text that surround the image.',
html:
'<h3>' +
'<img style="margin-right: 10px" height="100" width="100" align="left"/>' +
'Type the title here'+
'</h3>' +
'<p>' +
'Type the text here' +
'</p>'
},
{
title: 'Strange Template',
image: 'template2.gif',
description: 'A template that defines two colums, each one with a title, and some text.',
html:
'<table cellspacing="0" cellpadding="0" style="width:100%" border="0">' +
'<tr>' +
'<td style="width:50%">' +
'<h3>Title 1</h3>' +
'</td>' +
'<td></td>' +
'<td style="width:50%">' +
'<h3>Title 2</h3>' +
'</td>' +
'</tr>' +
'<tr>' +
'<td>' +
'Text 1' +
'</td>' +
'<td></td>' +
'<td>' +
'Text 2' +
'</td>' +
'</tr>' +
'</table>' +
'<p>' +
'More text goes here.' +
'</p>'
},
{
title: 'Text and Table',
image: 'template3.gif',
description: 'A title with some text and a table.',
html:
'<div style="width: 80%">' +
'<h3>' +
'Title goes here' +
'</h3>' +
'<table style="width:150px;float: right" cellspacing="0" cellpadding="0" border="1">' +
'<caption style="border:solid 1px black">' +
'<strong>Table title</strong>' +
'</caption>' +
'</tr>' +
'<tr>' +
'<td> </td>' +
'<td> </td>' +
'<td> </td>' +
'</tr>' +
'<tr>' +
'<td> </td>' +
'<td> </td>' +
'<td> </td>' +
'</tr>' +
'<tr>' +
'<td> </td>' +
'<td> </td>' +
'<td> </td>' +
'</tr>' +
'</table>' +
'<p>' +
'Type the text here' +
'</p>' +
'</div>'
}
]
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
var doc = CKEDITOR.document;
CKEDITOR.dialog.add( 'templates', function( editor )
{
// Constructs the HTML view of the specified templates data.
function renderTemplatesList( container, templatesDefinitions )
{
// clear loading wait text.
container.setHtml( '' );
for ( var i = 0, totalDefs = templatesDefinitions.length ; i < totalDefs ; i++ )
{
var definition = CKEDITOR.getTemplates( templatesDefinitions[ i ] ),
imagesPath = definition.imagesPath,
templates = definition.templates,
count = templates.length;
for ( var j = 0 ; j < count ; j++ )
{
var template = templates[ j ],
item = createTemplateItem( template, imagesPath );
item.setAttribute( 'aria-posinset', j + 1 );
item.setAttribute( 'aria-setsize', count );
container.append( item );
}
}
}
function createTemplateItem( template, imagesPath )
{
var item = CKEDITOR.dom.element.createFromHtml(
'<a href="javascript:void(0)" tabIndex="-1" role="option" >' +
'<div class="cke_tpl_item"></div>' +
'</a>' );
// Build the inner HTML of our new item DIV.
var html = '<table style="width:350px;" class="cke_tpl_preview" role="presentation"><tr>';
if ( template.image && imagesPath )
html += '<td class="cke_tpl_preview_img"><img src="' + CKEDITOR.getUrl( imagesPath + template.image ) + '"' + ( CKEDITOR.env.ie6Compat ? ' onload="this.width=this.width"' : '' ) + ' alt="" title=""></td>';
html += '<td style="white-space:normal;"><span class="cke_tpl_title">' + template.title + '</span><br/>';
if ( template.description )
html += '<span>' + template.description + '</span>';
html += '</td></tr></table>';
item.getFirst().setHtml( html );
item.on( 'click', function() { insertTemplate( template.html ); } );
return item;
}
/**
* Insert the specified template content into editor.
* @param {Number} index
*/
function insertTemplate( html )
{
var dialog = CKEDITOR.dialog.getCurrent(),
isInsert = dialog.getValueOf( 'selectTpl', 'chkInsertOpt' );
if ( isInsert )
{
// Everything should happen after the document is loaded (#4073).
editor.on( 'contentDom', function( evt )
{
evt.removeListener();
dialog.hide();
// Place the cursor at the first editable place.
var range = new CKEDITOR.dom.range( editor.document );
range.moveToElementEditStart( editor.document.getBody() );
range.select( 1 );
setTimeout( function()
{
editor.fire( 'saveSnapshot' );
}, 0 );
});
editor.fire( 'saveSnapshot' );
editor.setData( html );
}
else
{
editor.insertHtml( html );
dialog.hide();
}
}
function keyNavigation( evt )
{
var target = evt.data.getTarget(),
onList = listContainer.equals( target );
// Keyboard navigation for template list.
if ( onList || listContainer.contains( target ) )
{
var keystroke = evt.data.getKeystroke(),
items = listContainer.getElementsByTag( 'a' ),
focusItem;
if ( items )
{
// Focus not yet onto list items?
if ( onList )
focusItem = items.getItem( 0 );
else
{
switch ( keystroke )
{
case 40 : // ARROW-DOWN
focusItem = target.getNext();
break;
case 38 : // ARROW-UP
focusItem = target.getPrevious();
break;
case 13 : // ENTER
case 32 : // SPACE
target.fire( 'click' );
}
}
if ( focusItem )
{
focusItem.focus();
evt.data.preventDefault();
}
}
}
}
// Load skin at first.
CKEDITOR.skins.load( editor, 'templates' );
var listContainer;
var templateListLabelId = 'cke_tpl_list_label_' + CKEDITOR.tools.getNextNumber(),
lang = editor.lang.templates,
config = editor.config;
return {
title :editor.lang.templates.title,
minWidth : CKEDITOR.env.ie ? 440 : 400,
minHeight : 340,
contents :
[
{
id :'selectTpl',
label : lang.title,
elements :
[
{
type : 'vbox',
padding : 5,
children :
[
{
id : 'selectTplText',
type : 'html',
html :
'<span>' +
lang.selectPromptMsg +
'</span>'
},
{
id : 'templatesList',
type : 'html',
focus: true,
html :
'<div class="cke_tpl_list" tabIndex="-1" role="listbox" aria-labelledby="' + templateListLabelId+ '">' +
'<div class="cke_tpl_loading"><span></span></div>' +
'</div>' +
'<span class="cke_voice_label" id="' + templateListLabelId + '">' + lang.options+ '</span>'
},
{
id : 'chkInsertOpt',
type : 'checkbox',
label : lang.insertOption,
'default' : config.templates_replaceContent
}
]
}
]
}
],
buttons : [ CKEDITOR.dialog.cancelButton ],
onShow : function()
{
var templatesListField = this.getContentElement( 'selectTpl' , 'templatesList' );
listContainer = templatesListField.getElement();
CKEDITOR.loadTemplates( config.templates_files, function()
{
var templates = ( config.templates || 'default' ).split( ',' );
if ( templates.length )
{
renderTemplatesList( listContainer, templates );
templatesListField.focus();
}
else
{
listContainer.setHtml(
'<div class="cke_tpl_empty">' +
'<span>' + lang.emptyListMsg + '</span>' +
'</div>' );
}
});
this._.element.on( 'keydown', keyNavigation );
},
onHide : function()
{
this._.element.removeListener( 'keydown', keyNavigation );
}
};
});
})();
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Plugin definition for the a11yhelp, which provides a dialog
* with accessibility related help.
*/
(function()
{
var pluginName = 'a11yhelp',
commandName = 'a11yHelp';
CKEDITOR.plugins.add( pluginName,
{
// List of available localizations.
availableLangs : { cs:1, cy:1, da:1, de:1, el:1, en:1, eo:1, fa:1, fi:1, fr:1, gu:1, he:1, it:1, mk:1, nb:1, nl:1, no:1, tr:1, ug:1, vi:1, 'zh-cn':1 },
init : function( editor )
{
var plugin = this;
editor.addCommand( commandName,
{
exec : function()
{
var langCode = editor.langCode;
langCode = plugin.availableLangs[ langCode ] ? langCode : 'en';
CKEDITOR.scriptLoader.load(
CKEDITOR.getUrl( plugin.path + 'lang/' + langCode + '.js' ),
function()
{
CKEDITOR.tools.extend( editor.lang, plugin.langEntries[ langCode ] );
editor.openDialog( commandName );
});
},
modes : { wysiwyg:1, source:1 },
readOnly : 1,
canUndo : false
});
CKEDITOR.dialog.add( commandName, this.path + 'dialogs/a11yhelp.js' );
}
});
})();
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'cy',
{
accessibilityHelp :
{
title : 'Canllawiau Hygyrchedd',
contents : 'Cynnwys Cymorth. I gau y deialog hwn, pwyswch ESC.',
legend :
[
{
name : 'Cyffredinol',
items :
[
{
name : 'Bar Offer y Golygydd',
legend:
'Pwyswch $ {toolbarFocus} i fynd at y bar offer. Symudwch i\'r grŵp bar offer nesaf a blaenorol gyda TAB a SHIFT-TAB. Symudwch i\'r botwm bar offer nesaf a blaenorol gyda SAETH DDE neu SAETH CHWITH. Pwyswch SPACE neu ENTER i wneud botwm y bar offer yn weithredol.'
},
{
name : 'Deialog y Golygydd',
legend :
'Tu mewn i\'r deialog, pwyswch TAB i fynd i\'r maes nesaf ar y deialog, pwyswch SHIFT + TAB i symud i faes blaenorol, pwyswch ENTER i gyflwyno\'r deialog, pwyswch ESC i ddiddymu\'r deialog. Ar gyfer deialogau sydd â thudalennau aml-tab, pwyswch ALT + F10 i lywio\'r tab-restr. Yna symudwch i\'r tab nesaf gyda TAB neu SAETH DDE. Symudwch i dab blaenorol gyda SHIFT + TAB neu\'r SAETH CHWITH. Pwyswch SPACE neu ENTER i ddewis y dudalen tab.'
},
{
name : 'Dewislen Cyd-destun y Golygydd',
legend :
'Pwyswch $ {contextMenu} neu\'r ALLWEDD \'APPLICATION\' i agor y ddewislen cyd-destun. Yna symudwch i\'r opsiwn ddewislen nesaf gyda\'r TAB neu\'r SAETH I LAWR. Symudwch i\'r opsiwn blaenorol gyda SHIFT + TAB neu\'r SAETH I FYNY. Pwyswch SPACE neu ENTER i ddewis yr opsiwn ddewislen. Agorwch is-dewislen yr opsiwn cyfredol gyda SPACE neu ENTER neu SAETH DDE. Ewch yn ôl i\'r eitem ar y ddewislen uwch gydag ESC neu SAETH CHWITH. Ceuwch y ddewislen cyd-destun gydag ESC.'
},
{
name : 'Blwch Rhestr y Golygydd',
legend :
'Tu mewn rhestr-bocs, ewch i\'r eitem rhestr nesaf gyda TAB neu\'r SAETH I LAWR. Symudwch i restr eitem flaenorol gyda SHIFT + TAB neu SAETH I FYNY. Pwyswch SPACE neu ENTER i ddewis yr opsiwn o\'r rhestr. Pwyswch ESC i gau\'r rhestr.'
},
{
name : 'Bar Llwybr Elfen y Golygydd',
legend :
'Pwyswch $ {elementsPathFocus} i fynd i\'r elfennau llwybr bar. Symudwch i fotwm yr elfen nesaf gyda TAB neu SAETH DDE. Symudwch i fotwm blaenorol gyda SHIFT + TAB neu SAETH CHWITH. Pwyswch SPACE neu ENTER i ddewis yr elfen yn y golygydd.'
}
]
},
{
name : 'Gorchmynion',
items :
[
{
name : 'Gorchymyn dadwneud',
legend : 'Pwyswch ${undo}'
},
{
name : 'Gorchymyn ailadrodd',
legend : 'Pwyswch ${redo}'
},
{
name : 'Gorchymyn Bras',
legend : 'Pwyswch ${bold}'
},
{
name : 'Gorchymyn italig',
legend : 'Pwyswch ${italig}'
},
{
name : 'Gorchymyn tanlinellu',
legend : 'Pwyso ${underline}'
},
{
name : 'Gorchymyn dolen',
legend : 'Pwyswch ${link}'
},
{
name : 'Gorchymyn Cwympo\'r Dewislen',
legend : 'Pwyswch ${toolbarCollapse}'
},
{
name : 'Cymorth Hygyrchedd',
legend : 'Pwyswch ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'tr',
{
accessibilityHelp :
{
title : 'Erişilebilirlik Talimatları',
contents : 'Yardım içeriği. Bu pencereyi kapatmak için ESC tuşuna basın.',
legend :
[
{
name : 'Genel',
items :
[
{
name : 'Araç Çubuğu Editörü',
legend:
'Araç çubuğunda gezinmek için ${toolbarFocus} basın. TAB ve SHIFT-TAB ile önceki ve sonraki araç çubuğu grubuna taşıyın. SAĞ OK veya SOL OK ile önceki ve sonraki bir araç çubuğu düğmesini hareket ettirin. SPACE tuşuna basın veya araç çubuğu düğmesini etkinleştirmek için ENTER tuşna basın.'
},
{
name : 'Dialog Editörü',
legend :
'Dialog penceresi içinde, sonraki iletişim alanına gitmek için SEKME tuşuna basın, önceki alana geçmek için SHIFT + TAB tuşuna basın, pencereyi göndermek için ENTER tuşuna basın, dialog penceresini iptal etmek için ESC tuşuna basın. Birden çok sekme sayfaları olan diyalogların, sekme listesine gitmek için ALT + F10 tuşlarına basın. Sonra TAB veya SAĞ OK sonraki sekmeye taşıyın. SHIFT + TAB veya SOL OK ile önceki sekmeye geçin. Sekme sayfayı seçmek için SPACE veya ENTER tuşuna basın.'
},
{
name : 'İçerik Menü Editörü',
legend :
'İçerik menüsünü açmak için ${contextMenu} veya UYGULAMA TUŞU\'na basın. Daha sonra SEKME veya AŞAĞI OK ile bir sonraki menü seçeneği taşıyın. SHIFT + TAB veya YUKARI OK ile önceki seçeneğe gider. Menü seçeneğini seçmek için SPACE veya ENTER tuşuna basın. Seçili seçeneğin alt menüsünü SPACE ya da ENTER veya SAĞ OK açın. Üst menü öğesini geçmek için ESC veya SOL OK ile geri dönün. ESC ile bağlam menüsünü kapatın.'
},
{
name : 'Liste Kutusu Editörü',
legend :
'Liste kutusu içinde, bir sonraki liste öğesine SEKME VEYA AŞAĞI OK ile taşıyın. SHIFT + TAB veya YUKARI önceki liste öğesi taşıyın. Liste seçeneği seçmek için SPACE veya ENTER tuşuna basın. Liste kutusunu kapatmak için ESC tuşuna basın.'
},
{
name : 'Element Yol Çubuğu Editörü',
legend :
'Elementlerin yol çubuğunda gezinmek için ${ElementsPathFocus} basın. SEKME veya SAĞ OK ile sonraki element düğmesine taşıyın. SHIFT + TAB veya SOL OK önceki düğmeye hareket ettirin. Editör içindeki elementi seçmek için ENTER veya SPACE tuşuna basın.'
}
]
},
{
name : 'Komutlar',
items :
[
{
name : 'Komutu geri al',
legend : '${undo} basın'
},
{
name : ' Tekrar komutu uygula',
legend : '${redo} basın'
},
{
name : ' Kalın komut',
legend : '${bold} basın'
},
{
name : ' İtalik komutu',
legend : '${italic} basın'
},
{
name : ' Alttan çizgi komutu',
legend : '${underline} basın'
},
{
name : ' Bağlantı komutu',
legend : '${link} basın'
},
{
name : ' Araç çubuğu Toplama komutu',
legend : '${toolbarCollapse} basın'
},
{
name : 'Erişilebilirlik Yardımı',
legend : '${a11yHelp} basın'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'nb',
{
accessibilityHelp :
{
title : 'Instruksjoner for tilgjengelighet',
contents : 'Innhold for hjelp. Trykk ESC for å lukke denne dialogen.',
legend :
[
{
name : 'Generelt',
items :
[
{
name : 'Verktøylinje for editor',
legend:
'Trykk ${toolbarFocus} for å navigere til verktøylinjen. Flytt til neste og forrige verktøylinjegruppe med TAB og SHIFT-TAB. Flytt til neste og forrige verktøylinjeknapp med HØYRE PILTAST og VENSTRE PILTAST. Trykk MELLOMROM eller ENTER for å aktivere verktøylinjeknappen.'
},
{
name : 'Dialog for editor',
legend :
'Mens du er i en dialog, trykk TAB for å navigere til neste dialogfelt, press SHIFT + TAB for å flytte til forrige felt, trykk ENTER for å akseptere dialogen, trykk ESC for å avbryte dialogen. For dialoger med flere faner, trykk ALT + F10 for å navigere til listen over faner. Gå til neste fane med TAB eller HØYRE PILTAST. Gå til forrige fane med SHIFT + TAB eller VENSTRE PILTAST. Trykk MELLOMROM eller ENTER for å velge fanen.'
},
{
name : 'Kontekstmeny for editor',
legend :
'Trykk ${contextMenu} eller MENYKNAPP for å åpne kontekstmeny. Gå til neste alternativ i menyen med TAB eller PILTAST NED. Gå til forrige alternativ med SHIFT+TAB eller PILTAST OPP. Trykk MELLOMROM eller ENTER for å velge menyalternativet. Åpne undermenyen på valgt alternativ med MELLOMROM eller ENTER eller HØYRE PILTAST. Gå tilbake til overordnet menyelement med ESC eller VENSTRE PILTAST. Lukk kontekstmenyen med ESC.'
},
{
name : 'Listeboks for editor',
legend :
'I en listeboks, gå til neste alternativ i listen med TAB eller PILTAST NED. Gå til forrige alternativ i listen med SHIFT + TAB eller PILTAST OPP. Trykk MELLOMROM eller ENTER for å velge alternativet i listen. Trykk ESC for å lukke listeboksen.'
},
{
name : 'Verktøylinje for elementsti',
legend :
'Trykk ${elementsPathFocus} for å navigere til verktøylinjen som viser elementsti. Gå til neste elementknapp med TAB eller HØYRE PILTAST. Gå til forrige elementknapp med SHIFT+TAB eller VENSTRE PILTAST. Trykk MELLOMROM eller ENTER for å velge elementet i editoren.'
}
]
},
{
name : 'Kommandoer',
items :
[
{
name : 'Angre',
legend : 'Trykk ${undo}'
},
{
name : 'Gjør om',
legend : 'Trykk ${redo}'
},
{
name : 'Fet tekst',
legend : 'Trykk ${bold}'
},
{
name : 'Kursiv tekst',
legend : 'Trykk ${italic}'
},
{
name : 'Understreking',
legend : 'Trykk ${underline}'
},
{
name : 'Link',
legend : 'Trykk ${link}'
},
{
name : 'Skjul verktøylinje',
legend : 'Trykk ${toolbarCollapse}'
},
{
name : 'Hjelp for tilgjengelighet',
legend : 'Trykk ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'fr',
{
accessibilityHelp :
{
title : 'Instructions pour l\'accessibilité',
contents : 'Contenu de l\'aide. Pour fermer ce dialogue, appuyez sur la touche ESC (Echappement).',
legend :
[
{
name : 'Général',
items :
[
{
name : 'Barre d\'outils de l\'éditeur',
legend:
'Appuyer sur ${toolbarFocus} pour accéder à la barre d\'outils. Se déplacer vers les groupes suivant ou précédent de la barre d\'outil avec les touches TAB et SHIFT-TAB. Se déplacer vers les boutons suivant ou précédent de la barre d\'outils avec les touches FLECHE DROITE et FLECHE GAUCHE. Appuyer sur la barre d\'espace ou la touche ENTRER pour activer le bouton de barre d\'outils.'
},
{
name : 'Dialogue de léditeur',
legend :
'A l\'intérieur d\'un dialogue, appuyer sur la touche TAB pour naviguer jusqu\'au champ de dalogue suivant, appuyez sur les touches SHIFT + TAB pour revenir au champ précédent, appuyez sur la touche ENTRER pour soumettre le dialogue, appuyer sur la touche ESC pour annuler le dialogue. Pour les dialogues avec plusieurs pages d\'onglets, appuyer sur ALT + F10 pour naviguer jusqu\'à la liste des onglets. Puis se déplacer vers l\'onglet suivant avec la touche TAB ou FLECHE DROITE. Se déplacer vers l\'onglet précédent avec les touches SHIFT + TAB ou FLECHE GAUCHE. Appuyer sur la barre d\'espace ou la touche ENTRER pour sélectionner la page de l\'onglet.'
},
{
name : 'Menu contextuel de l\'éditeur',
legend :
'Appuyer sur ${contextMenu} ou entrer le RACCOURCI CLAVIER pour ouvrir le menu contextuel. Puis se déplacer vers l\'option suivante du menu avec les touches TAB ou FLECHE BAS. Se déplacer vers l\'option précédente avec les touches SHIFT+TAB ou FLECHE HAUT. appuyer sur la BARRE D\'ESPACE ou la touche ENTREE pour sélectionner l\'option du menu. Oovrir le sous-menu de l\'option courante avec la BARRE D\'ESPACE ou les touches ENTREE ou FLECHE DROITE. Revenir à l\'élément de menu parent avec les touches ESC ou FLECHE GAUCHE. Fermer le menu contextuel avec ESC.'
},
{
name : 'Zone de liste en menu déroulant de l\'éditeur',
legend :
'A l\'intérieur d\'une liste en menu déroulant, se déplacer vers l\'élément suivant de la liste avec les touches TAB ou FLECHE BAS. Se déplacer vers l\'élément précédent de la liste avec les touches SHIFT + TAB ou FLECHE HAUT. Appuyer sur la BARRE D\'ESPACE ou sur ENTREE pour sélectionner l\'option dans la liste. Appuyer sur ESC pour fermer le menu déroulant.'
},
{
name : 'Barre d\'emplacement des éléments de léditeur',
legend :
'Appuyer sur ${elementsPathFocus} pour naviguer vers la barre d\'emplacement des éléments de léditeur. Se déplacer vers le bouton d\'élément suivant avec les touches TAB ou FLECHE DROITE. Se déplacer vers le bouton d\'élément précédent avec les touches SHIFT+TAB ou FLECHE GAUCHE. Appuyer sur la BARRE D\'ESPACE ou sur ENTREE pour sélectionner l\'élément dans l\'éditeur.'
}
]
},
{
name : 'Commandes',
items :
[
{
name : ' Commande défaire',
legend : 'Appuyer sur ${undo}'
},
{
name : ' Commande refaire',
legend : 'Appuyer sur ${redo}'
},
{
name : ' Commande gras',
legend : 'Appuyer sur ${bold}'
},
{
name : ' Commande italique',
legend : 'Appuyer sur ${italic}'
},
{
name : ' Commande souligné',
legend : 'Appuyer sur ${underline}'
},
{
name : ' Commande lien',
legend : 'Appuyer sur ${link}'
},
{
name : ' Commande enrouler la barre d\'outils',
legend : 'Appuyer sur ${toolbarCollapse}'
},
{
name : ' Aide Accessibilité',
legend : 'Appuyer sur ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'fa',
{
accessibilityHelp :
{
title : 'دستورالعملهای دسترسی',
contents : 'راهنمای فهرست مطالب. برای بستن این کادر محاورهای ESC را فشار دهید.',
legend :
[
{
name : 'عمومی',
items :
[
{
name : 'نوار ابزار ویرایشگر',
legend:
'${toolbarFocus} را برای باز کردن نوار ابزار بفشارید. با کلید Tab و Shif-Tab در مجموعه نوار ابزار بعدی و قبلی حرکت کنید. برای حرکت در کلید نوار ابزار قبلی و بعدی با کلید جهتنمای راست و چپ جابجا شوید. کلید Space یا Enter را برای فعال کردن کلید نوار ابزار بفشارید.'
},
{
name : 'پنجره محاورهای ویرایشگر',
legend :
'در داخل یک پنجره محاورهای، کلید Tab را بفشارید تا به پنجرهی بعدی بروید، Shift+Tab برای حرکت به فیلد قبلی، فشردن Enter برای ثبت اطلاعات پنجره، فشردن Esc برای لغو پنجره محاورهای و برای پنجرههایی که چندین برگه دارند، فشردن Alt+F10 جهت رفتن به Tab-List. در نهایت حرکت به برگه بعدی با Tab یا کلید جهتنمای راست. حرکت به برگه قبلی با Shift+Tab یا کلید جهتنمای چپ. فشردن Space یا Enter برای انتخاب یک برگه.'
},
{
name : 'منوی متنی ویرایشگر',
legend :
'${contextMenu} یا کلید برنامههای کاربردی را برای باز کردن منوی متن را بفشارید. سپس میتوانید برای حرکت به گزینه بعدی منو با کلید Tab و یا کلید جهتنمای پایین جابجا شوید. حرکت به گزینه قبلی با Shift+Tab یا کلید جهتنمای بالا. فشردن Space یا Enter برای انتخاب یک گزینه از منو. باز کردن زیر شاخه گزینه منو جاری با کلید Space یا Enter و یا کلید جهتنمای راست و چپ. بازگشت به منوی والد با کلید Esc یا کلید جهتنمای چپ. بستن منوی متن با Esc.'
},
{
name : 'جعبه فهرست ویرایشگر',
legend :
'در داخل جعبه لیست، قلم دوم از اقلام لیست بعدی را با TAB و یا Arrow Down حرکت دهید. انتقال به قلم دوم از اقلام لیست قبلی را با SHIFT + TAB یا UP ARROW. کلید Space یا ENTER را برای انتخاب گزینه لیست بفشارید. کلید ESC را برای بستن جعبه لیست بفشارید.'
},
{
name : 'ویرایشگر عنصر نوار راه',
legend :
'برای رفتن به مسیر عناصر ${elementsPathFocus} را بفشارید. حرکت به کلید عنصر بعدی با کلید Tab یا کلید جهتنمای راست. برگشت به کلید قبلی با Shift+Tab یا کلید جهتنمای چپ. فشردن Space یا Enter برای انتخاب یک عنصر در ویرایشگر.'
}
]
},
{
name : 'فرمانها',
items :
[
{
name : 'بازگشت فرمان',
legend : 'فشردن ${undo}'
},
{
name : 'انجام مجدد فرمان',
legend : 'فشردن ${redo}'
},
{
name : 'فرمان متن درشت',
legend : 'فشردن ${bold}'
},
{
name : 'فرمان متن کج',
legend : 'فشردن ${italic}'
},
{
name : 'فرمان متن زیرخطدار',
legend : 'فشردن ${underline}'
},
{
name : 'فرمان پیوند',
legend : 'فشردن ${link}'
},
{
name : 'بستن نوار ابزار فرمان',
legend : 'فشردن ${toolbarCollapse}'
},
{
name : 'راهنمای دسترسی',
legend : 'فشردن ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'eo',
{
accessibilityHelp :
{
title : 'Uzindikoj pri atingeblo',
contents : 'Helpilenhavo. Por fermi tiun dialogon, premu la ESKAPAN klavon.',
legend :
[
{
name : 'Ĝeneralaĵoj',
items :
[
{
name : 'Ilbreto de la redaktilo',
legend:
'Premu ${toolbarFocus} por atingi la ilbreton. Moviĝu al la sekva aŭ antaŭa grupoj de la ilbreto per la klavoj TABA kaj MAJUSKLIGA-TABA. Moviĝu al la sekva aŭ antaŭa butonoj de la ilbreto per la klavoj SAGO DEKSTREN kaj SAGO MALDEKSTREN. Premu la SPACETklavon aŭ la ENENklavon por aktivigi la ilbretbutonon.'
},
{
name : 'Redaktildialogo',
legend :
'En dialogo, premu la TABAN klavon por navigi al la sekva dialogkampo, premu la MAJUSKLIGAN + TABAN klavojn por reveni al la antaŭa kampo, premu la ENENklavon por sendi la dialogon, premu la ESKAPAN klavon por nuligi la dialogon. Por dialogoj kun pluraj retpaĝoj sub langetoj, premu ALT + F10 por navigi al la langetlisto. Poste moviĝu al la sekva langeto per la klavo TABA aŭ SAGO DEKSTREN. Moviĝu al la antaŭa langeto per la klavoj MAJUSKLIGA + TABA aŭ SAGO MALDEKSTREN. Premu la SPACETklavon aŭ la ENENklavon por selekti la langetretpaĝon.'
},
{
name : 'Kunteksta menuo de la redaktilo',
legend :
'Premu ${contextMenu} aŭ entajpu la KLAVKOMBINAĴON por malfermi la kuntekstan menuon. Poste moviĝu al la sekva opcio de la menuo per la klavoj TABA aŭ SAGO SUBEN. Moviĝu al la antaŭa opcio per la klavoj MAJUSKLGA + TABA aŭ SAGO SUPREN. Premu la SPACETklavon aŭ ENENklavon por selekti la menuopcion. Malfermu la submenuon de la kuranta opcio per la SPACETklavo aŭ la ENENklavo aŭ la SAGO DEKSTREN. Revenu al la elemento de la patra menuo per la klavoj ESKAPA aŭ SAGO MALDEKSTREN. Fermu la kuntekstan menuon per la ESKAPA klavo.'
},
{
name : 'Fallisto de la redaktilo',
legend :
'En fallisto, moviĝu al la sekva listelemento per la klavoj TABA aŭ SAGO SUBEN. Moviĝu al la antaŭa listelemento per la klavoj MAJUSKLIGA + TABA aŭ SAGO SUPREN. Premu la SPACETklavon aŭ ENENklavon por selekti la opcion en la listo. Premu la ESKAPAN klavon por fermi la falmenuon.'
},
{
name : 'Breto indikanta la vojon al la redaktilelementoj',
legend :
'Premu ${elementsPathFocus} por navigi al la breto indikanta la vojon al la redaktilelementoj. Moviĝu al la butono de la sekva elemento per la klavoj TABA aŭ SAGO DEKSTREN. Moviĝu al la butono de la antaŭa elemento per la klavoj MAJUSKLIGA + TABA aŭ SAGO MALDEKSTREN. Premu la SPACETklavon aŭ ENENklavon por selekti la elementon en la redaktilo.'
}
]
},
{
name : 'Komandoj',
items :
[
{
name : 'Komando malfari',
legend : 'Premu ${undo}'
},
{
name : 'Komando refari',
legend : 'Premu ${redo}'
},
{
name : 'Komando grasa',
legend : 'Premu ${bold}'
},
{
name : 'Komando kursiva',
legend : 'Premu ${italic}'
},
{
name : 'Komando substreki',
legend : 'Premu ${underline}'
},
{
name : 'Komando ligilo',
legend : 'Premu ${link}'
},
{
name : 'Komando faldi la ilbreton',
legend : 'Premu ${toolbarCollapse}'
},
{
name : 'Helpilo pri atingeblo',
legend : 'Premu ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'he',
{
accessibilityHelp :
{
title : 'הוראות נגישות',
contents : 'הוראות נגישות. לסגירה לחץ אסקייפ (ESC).',
legend :
[
{
name : 'כללי',
items :
[
{
name : 'סרגל הכלים',
legend:
'לחץ על ${toolbarFocus} כדי לנווט לסרגל הכלים. עבור לכפתור הבא עם מקש הטאב (TAB) או חץ שמאלי. עבור לכפתור הקודם עם מקש השיפט (SHIFT) + טאב (TAB) או חץ ימני. לחץ רווח או אנטר (ENTER) כדי להפעיל את הכפתור הנבחר.'
},
{
name : 'דיאלוגים (חלונות תשאול)',
legend :
'בתוך דיאלוג, לחץ טאב (TAB) כדי לנווט לשדה הבא, לחץ שיפט (SHIFT) + טאב (TAB) כדי לנווט לשדה הקודם, לחץ אנטר (ENTER) כדי לשלוח את הדיאלוג, לחץ אסקייפ (ESC) כדי לבטל. בתוך דיאלוגים בעלי מספר טאבים (לשוניות), לחץ אלט (ALT) + F10 כדי לנווט לשורת הטאבים. נווט לטאב הבא עם טאב (TAB) או חץ שמאלי. עבור לטאב הקודם עם שיפט (SHIFT) + טאב (TAB) או חץ שמאלי. לחץ רווח או אנטר (ENTER) כדי להיכנס לטאב.'
},
{
name : 'תפריט ההקשר (Context Menu)',
legend :
'לחץ ${contextMenu} או APPLICATION KEYכדי לפתוח את תפריט ההקשר. עבור לאפשרות הבאה עם טאב (TAB) או חץ למטה. עבור לאפשרות הקודמת עם שיפט (SHIFT) + טאב (TAB) או חץ למעלה. לחץ רווח או אנטר (ENTER) כדי לבחור את האפשרות. פתח את תת התפריט (Sub-menu) של האפשרות הנוכחית עם רווח או אנטר (ENTER) או חץ שמאלי. חזור לתפריט האב עם אסקייפ (ESC) או חץ שמאלי. סגור את תפריט ההקשר עם אסקייפ (ESC).'
},
{
name : 'תפריטים צפים (List boxes)',
legend :
'בתוך תפריט צף, עבור לפריט הבא עם טאב (TAB) או חץ למטה. עבור לתפריט הקודם עם שיפט (SHIFT) + טאב (TAB) or חץ עליון. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.'
},
{
name : 'עץ אלמנטים (Elements Path)',
legend :
'לחץ ${elementsPathFocus} כדי לנווט לעץ האלמנטים. עבור לפריט הבא עם טאב (TAB) או חץ ימני. עבור לפריט הקודם עם שיפט (SHIFT) + טאב (TAB) או חץ שמאלי. לחץ רווח או אנטר (ENTER) כדי לבחור את האלמנט בעורך.'
}
]
},
{
name : 'פקודות',
items :
[
{
name : ' ביטול צעד אחרון',
legend : 'לחץ ${undo}'
},
{
name : ' חזרה על צעד אחרון',
legend : 'לחץ ${redo}'
},
{
name : ' הדגשה',
legend : 'לחץ ${bold}'
},
{
name : ' הטייה',
legend : 'לחץ ${italic}'
},
{
name : ' הוספת קו תחתון',
legend : 'לחץ ${underline}'
},
{
name : ' הוספת לינק',
legend : 'לחץ ${link}'
},
{
name : ' כיווץ סרגל הכלים',
legend : 'לחץ ${toolbarCollapse}'
},
{
name : ' הוראות נגישות',
legend : 'לחץ ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'de',
{
accessibilityHelp :
{
title : 'Barrierefreiheitinformationen',
contents : 'Hilfeinhalt. Um den Dialog zu schliessen die Taste \'ESC\' drücken.',
legend :
[
{
name : 'Allgemein',
items :
[
{
name : 'Editor Symbolleiste',
legend:
'Drücken Sie ${toolbarFocus} auf der Symbolleiste. Gehen Sie zur nächsten oder vorherigen Symbolleistengruppe mit TAB und SHIFT-TAB. Gehen Sie zur nächsten oder vorherigen Symbolleiste auf die Schaltfläche mit dem RECHTS- oder LINKS-Pfeil. Drücken Sie die Leertaste oder Eingabetaste, um die Schaltfläche in der Symbolleiste aktivieren.'
},
{
name : 'Editor Dialog',
legend :
'Innerhalb des Dialogs drücken Sie TAB um zum nächsten Dialogfeld zu gelangen, drücken Sie SHIFT-TAG um zum vorherigen Feld zu wechseln, drücken Sie ENTER um den Dialog abzusenden und ESC um den Dialog zu abzubrechen. Um zwischen den Reitern innerhalb eines Dialogs zu wechseln drücken sie ALT-F10. Um zum nächsten Reiter zu gelangen können Sie TAB oder die rechte Pfeiltaste. Zurück gelangt man mit SHIFT-TAB oder der linken Pfeiltaste. Mit der Leertaste oder Enter kann man den Reiter auswählen.'
},
{
name : 'Editor Kontextmenü',
legend :
'Dürcken Sie ${contextMenu} oder die Anwendungstaste um das Kontextmenü zu öffnen. Man kann die Pfeiltasten zum Wechsel benutzen. Mit der Leertaste oder der Enter-Taste kann man den Menüpunkt aufrufen. Schliessen Sie das Kontextmenü mit der ESC-Taste.'
},
{
name : 'Editor Listen',
legend :
'Innerhalb einer Listenbox kann man mit der TAB-Taste oder den Pfeilrunter-Taste den nächsten Menüeintrag wählen. Mit der Shift-TAB Tastenkombination oder der Pfeilhoch-Taste gelangt man zum vorherigen Menüpunkt. Mit der Leertaste oder Enter kann man den Menüpunkt auswählen. Drücken Sie ESC zum Verlassen des Menüs.'
},
{
name : 'Editor Elementpfadleiste',
legend :
'Drücken Sie ${elementsPathFocus} um sich durch die Pfadleiste zu bewegen. Um zum nächsten Element zu gelangen drücken Sie TAB oder die Pfeilrechts-Taste. Zum vorherigen Element gelangen Sie mit der SHIFT-TAB oder der Pfeillinks-Taste. Drücken Sie die Leertaste oder Enter um das Element auszuwählen.'
}
]
},
{
name : 'Befehle',
items :
[
{
name : 'Wiederholen Befehl',
legend : 'Drücken Sie ${undo}'
},
{
name : 'Rückgängig Befehl',
legend : 'Drücken Sie ${redo}'
},
{
name : 'Fettschrift Befehl',
legend : 'Drücken Sie ${bold}'
},
{
name : 'Italic Befehl',
legend : 'Drücken Sie ${italic}'
},
{
name : 'Unterstreichung Befehl',
legend : 'Drücken Sie ${underline}'
},
{
name : 'Link Befehl',
legend : 'Drücken Sie ${link}'
},
{
name : 'Symbolleiste zuammenklappen Befehl',
legend : 'Drücken Sie ${toolbarCollapse}'
},
{
name : 'Eingabehilfen',
legend : 'Drücken Sie ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'no',
{
accessibilityHelp :
{
title : 'Instruksjoner for tilgjengelighet',
contents : 'Innhold for hjelp. Trykk ESC for å lukke denne dialogen.',
legend :
[
{
name : 'Generelt',
items :
[
{
name : 'Verktøylinje for editor',
legend:
'Trykk ${toolbarFocus} for å navigere til verktøylinjen. Flytt til neste og forrige verktøylinjegruppe med TAB og SHIFT-TAB. Flytt til neste og forrige verktøylinjeknapp med HØYRE PILTAST og VENSTRE PILTAST. Trykk MELLOMROM eller ENTER for å aktivere verktøylinjeknappen.'
},
{
name : 'Dialog for editor',
legend :
'Mens du er i en dialog, trykk TAB for å navigere til neste dialogfelt, press SHIFT + TAB for å flytte til forrige felt, trykk ENTER for å akseptere dialogen, trykk ESC for å avbryte dialogen. For dialoger med flere faner, trykk ALT + F10 for å navigere til listen over faner. Gå til neste fane med TAB eller HØYRE PILTAST. Gå til forrige fane med SHIFT + TAB eller VENSTRE PILTAST. Trykk MELLOMROM eller ENTER for å velge fanen.'
},
{
name : 'Kontekstmeny for editor',
legend :
'Trykk ${contextMenu} eller MENYKNAPP for å åpne kontekstmeny. Gå til neste alternativ i menyen med TAB eller PILTAST NED. Gå til forrige alternativ med SHIFT+TAB eller PILTAST OPP. Trykk MELLOMROM eller ENTER for å velge menyalternativet. Åpne undermenyen på valgt alternativ med MELLOMROM eller ENTER eller HØYRE PILTAST. Gå tilbake til overordnet menyelement med ESC eller VENSTRE PILTAST. Lukk kontekstmenyen med ESC.'
},
{
name : 'Listeboks for editor',
legend :
'I en listeboks, gå til neste alternativ i listen med TAB eller PILTAST NED. Gå til forrige alternativ i listen med SHIFT + TAB eller PILTAST OPP. Trykk MELLOMROM eller ENTER for å velge alternativet i listen. Trykk ESC for å lukke listeboksen.'
},
{
name : 'Verktøylinje for elementsti',
legend :
'Trykk ${elementsPathFocus} for å navigere til verktøylinjen som viser elementsti. Gå til neste elementknapp med TAB eller HØYRE PILTAST. Gå til forrige elementknapp med SHIFT+TAB eller VENSTRE PILTAST. Trykk MELLOMROM eller ENTER for å velge elementet i editoren.'
}
]
},
{
name : 'Kommandoer',
items :
[
{
name : 'Angre',
legend : 'Trykk ${undo}'
},
{
name : 'Gjør om',
legend : 'Trykk ${redo}'
},
{
name : 'Fet tekst',
legend : 'Trykk ${bold}'
},
{
name : 'Kursiv tekst',
legend : 'Trykk ${italic}'
},
{
name : 'Understreking',
legend : 'Trykk ${underline}'
},
{
name : 'Link',
legend : 'Trykk ${link}'
},
{
name : 'Skjul verktøylinje',
legend : 'Trykk ${toolbarCollapse}'
},
{
name : 'Hjelp for tilgjengelighet',
legend : 'Trykk ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'el',
{
accessibilityHelp :
{
title : 'Οδηγίες Προσβασιμότητας',
contents : 'Περιεχόμενα Βοήθειας. Πατήστε ESC για κλείσιμο.',
legend :
[
{
name : 'Γενικά',
items :
[
{
name : 'Εργαλειοθήκη Επεξεργαστή',
legend:
'Πατήστε ${toolbarFocus} για να περιηγηθείτε στην γραμμή εργαλείων. Μετακινηθείτε ανάμεσα στις ομάδες της γραμμής εργαλείων με TAB και Shift-TAB. Μετακινηθείτε ανάμεσα στα κουμπία εργαλείων με ΔΕΞΙ και ΑΡΙΣΤΕΡΟ ΒΕΛΑΚΙ. Πατήστε ΚΕΝΟ ή ENTER για να ενεργοποιήσετε το ενεργό κουμπί εργαλείου.'
},
{
name : 'Παράθυρο Διαλόγου Επεξεργαστή',
legend :
'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page.' // MISSING
},
{
name : 'Editor Context Menu', // MISSING
legend :
'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.' // MISSING
},
{
name : 'Editor List Box', // MISSING
legend :
'Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.' // MISSING
},
{
name : 'Editor Element Path Bar', // MISSING
legend :
'Press ${elementsPathFocus} to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor.' // MISSING
}
]
},
{
name : 'Εντολές',
items :
[
{
name : ' Εντολή αναίρεσης',
legend : 'Πατήστε ${undo}'
},
{
name : ' Εντολή επανάληψης',
legend : 'Πατήστε ${redo}'
},
{
name : ' Εντολή έντονης γραφής',
legend : 'Πατήστε ${bold}'
},
{
name : ' Εντολή πλάγιας γραφής',
legend : 'Πατήστε ${italic}'
},
{
name : ' Εντολή υπογράμμισης',
legend : 'Πατήστε ${underline}'
},
{
name : ' Εντολή συνδέσμου',
legend : 'Πατήστε ${link}'
},
{
name : ' Εντολή Σύμπτηξης Εργαλειοθήκης',
legend : 'Πατήστε ${toolbarCollapse}'
},
{
name : ' Βοήθεια Προσβασιμότητας',
legend : 'Πατήστε ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'vi',
{
accessibilityHelp :
{
title : 'Accessibility Instructions', // MISSING
contents : 'Nội dung Hỗ trợ. Nhấn ESC để đóng hộp thoại.',
legend :
[
{
name : 'Chung',
items :
[
{
name : 'Thanh công cụ soạn th',
legend:
'Nhấn ${toolbarFocus} để điều hướng đến thanh công cụ. Nhấn TAB và SHIFT-TAB để chuyển đến nhóm thanh công cụ khác. Nhấn MŨI TÊN PHẢI hoặc MŨI TÊN TRÁI để chuyển sang nút khác trên thanh công cụ. Nhấn PHÍM CÁCH hoặc ENTER để kích hoạt nút trên thanh công c.'
},
{
name : 'Hộp thoại Biên t',
legend :
'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page.' // MISSING
},
{
name : 'Trình đơn Ngữ cảnh cBộ soạn thảo',
legend :
'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.' // MISSING
},
{
name : 'Editor List Box', // MISSING
legend :
'Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.' // MISSING
},
{
name : 'Editor Element Path Bar', // MISSING
legend :
'Press ${elementsPathFocus} to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor.' // MISSING
}
]
},
{
name : 'Commands', // MISSING
items :
[
{
name : ' Undo command', // MISSING
legend : 'Press ${undo}' // MISSING
},
{
name : ' Redo command', // MISSING
legend : 'Press ${redo}' // MISSING
},
{
name : ' Bold command', // MISSING
legend : 'Press ${bold}' // MISSING
},
{
name : ' Italic command', // MISSING
legend : 'Press ${italic}' // MISSING
},
{
name : ' Underline command', // MISSING
legend : 'Press ${underline}' // MISSING
},
{
name : ' Link command', // MISSING
legend : 'Press ${link}' // MISSING
},
{
name : ' Toolbar Collapse command', // MISSING
legend : 'Press ${toolbarCollapse}' // MISSING
},
{
name : ' Accessibility Help', // MISSING
legend : 'Press ${a11yHelp}' // MISSING
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'mk',
{
accessibilityHelp :
{
title : 'Инструкции за пристапност',
contents : 'Содржина на делот за помош. За да го затворите овој дијалот притиснете ESC.',
legend :
[
{
name : 'Општо',
items :
[
{
name : 'Мени за едиторот',
legend:
'Press ${toolbarFocus} to navigate to the toolbar. Move to the next and previous toolbar group with TAB and SHIFT-TAB. Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. Press SPACE or ENTER to activate the toolbar button.' // MISSING
},
{
name : 'Дијалот за едиторот',
legend :
'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page.' // MISSING
},
{
name : 'Editor Context Menu', // MISSING
legend :
'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.' // MISSING
},
{
name : 'Editor List Box', // MISSING
legend :
'Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.' // MISSING
},
{
name : 'Editor Element Path Bar', // MISSING
legend :
'Press ${elementsPathFocus} to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor.' // MISSING
}
]
},
{
name : 'Commands', // MISSING
items :
[
{
name : ' Undo command', // MISSING
legend : 'Press ${undo}' // MISSING
},
{
name : ' Redo command', // MISSING
legend : 'Press ${redo}' // MISSING
},
{
name : ' Bold command', // MISSING
legend : 'Press ${bold}' // MISSING
},
{
name : ' Italic command', // MISSING
legend : 'Press ${italic}' // MISSING
},
{
name : ' Underline command', // MISSING
legend : 'Press ${underline}' // MISSING
},
{
name : ' Link command', // MISSING
legend : 'Press ${link}' // MISSING
},
{
name : ' Toolbar Collapse command', // MISSING
legend : 'Press ${toolbarCollapse}' // MISSING
},
{
name : ' Accessibility Help', // MISSING
legend : 'Press ${a11yHelp}' // MISSING
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'it',
{
accessibilityHelp :
{
title : 'Istruzioni di Accessibilità',
contents : 'Contenuti di Aiuto. Per chiudere questa finestra premi ESC.',
legend :
[
{
name : 'Generale',
items :
[
{
name : 'Barra degli strumenti Editor',
legend:
'Premi ${toolbarFocus} per navigare fino alla barra degli strumenti. Muoviti tra i gruppi della barra degli strumenti con i tasti Tab e Maiusc-Tab. Spostati tra il successivo ed il precedente pulsante della barra degli strumenti usando le frecce direzionali Destra e Sinistra. Premi Spazio o Invio per attivare il pulsante della barra degli strumenti.'
},
{
name : 'Finestra Editor',
legend :
'All\'interno di una finestra di dialogo, premi Tab per navigare fino al campo successivo della finestra di dialogo, premi Maiusc-Tab per tornare al campo precedente, premi Invio per inviare la finestra di dialogo, premi Esc per uscire. Per le finestre che hanno schede multiple, premi Alt+F10 per navigare nella lista delle schede. Quindi spostati alla scheda successiva con il tasto Tab oppure con la Freccia Destra. Torna alla scheda precedente con Maiusc+Tab oppure con la Freccia Sinistra. Premi Spazio o Invio per scegliere la scheda.'
},
{
name : 'Menù contestuale Editor',
legend :
'Premi ${contextMenu} o TASTO APPLICAZIONE per aprire il menu contestuale. Dunque muoviti all\'opzione successiva del menu con il tasto TAB o con la Freccia Sotto. Muoviti all\'opzione precedente con MAIUSC+TAB o con Freccia Sopra. Premi SPAZIO o INVIO per scegliere l\'opzione di menu. Apri il sottomenu dell\'opzione corrente con SPAZIO o INVIO oppure con la Freccia Destra. Torna indietro al menu superiore con ESC oppure Freccia Sinistra. Chiudi il menu contestuale con ESC.'
},
{
name : 'Box Lista Editor',
legend :
'Dentro un box-lista, muoviti al prossimo elemento della lista con TAB o con la Freccia direzionale giù. Spostati all\'elemento precedente con MAIUSC+TAB oppure con Freccia direzionale sopra. Premi SPAZIO o INVIO per scegliere l\'opzione della lista. Premi ESC per chiudere il box-lista.'
},
{
name : 'Barra percorso elementi editor',
legend :
'Premi ${elementsPathFocus} per navigare tra gli elementi della barra percorso. Muoviti al prossimo pulsante di elemento con TAB o la Freccia direzionale destra. Muoviti al pulsante precedente con MAIUSC+TAB o la Freccia Direzionale Sinistra. Premi SPAZIO o INVIO per scegliere l\'elemento nell\'editor.'
}
]
},
{
name : 'Comandi',
items :
[
{
name : ' Annulla comando',
legend : 'Premi ${undo}'
},
{
name : ' Ripeti comando',
legend : 'Premi ${redo}'
},
{
name : ' Comando Grassetto',
legend : 'Premi ${bold}'
},
{
name : ' Comando Corsivo',
legend : 'Premi ${italic}'
},
{
name : ' Comando Sottolineato',
legend : 'Premi ${underline}'
},
{
name : ' Comando Link',
legend : 'Premi ${link}'
},
{
name : ' Comando riduci barra degli strumenti',
legend : 'Premi ${toolbarCollapse}'
},
{
name : ' Aiuto Accessibilità',
legend : 'Premi ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'nl',
{
accessibilityHelp :
{
title : 'Toegankelijkheidsinstructies',
contents : 'Help inhoud. Druk op ESC om dit dialoog te sluiten.',
legend :
[
{
name : 'Algemeen',
items :
[
{
name : 'Werkbalk tekstverwerker',
legend:
'Druk op ${toolbarFocus} om naar de werkbalk te navigeren. Om te schakelen naar de volgende en vorige werkbalkgroep, gebruik TAB en SHIFT+TAB. Om te schakelen naar de volgende en vorige werkbalkknop, gebruik de PIJL RECHTS en PIJL LINKS. Druk op SPATIE of ENTER om een werkbalkknop te activeren.'
},
{
name : 'Dialoog tekstverwerker',
legend :
'In een dialoogvenster, druk op TAB om te navigeren naar het volgende veld. Druk op SHIFT+TAB om naar het vorige veld te navigeren. Druk op ENTER om het dialoogvenster te verzenden. Druk op ESC om het dialoogvenster te sluiten. Voor dialoogvensters met meerdere tabbladen, druk op ALT+F10 om naar de tabset te navigeren. Schakel naar het volgende tabblad met TAB of PIJL RECHTS. Schakel naar het vorige tabblad met SHIFT+TAB of PIJL LINKS. Druk op SPATIE of ENTER om het tabblad te selecteren.'
},
{
name : 'Contextmenu tekstverwerker',
legend :
'Druk op ${contextMenu} of APPLICATION KEY om het contextmenu te openen. Schakel naar de volgende menuoptie met TAB of PIJL OMLAAG. Schakel naar de vorige menuoptie met SHIFT+TAB of PIJL OMHOOG. Druk op SPATIE of ENTER om een menuoptie te selecteren. Op een submenu van de huidige optie met SPATIE, ENTER of PIJL RECHTS. Ga terug naar de bovenliggende menuoptie met ESC of PIJL LINKS. Sluit het contextmenu met ESC.'
},
{
name : 'Keuzelijst tekstverwerker',
legend :
'In een keuzelijst, schakel naar het volgende item met TAB of PIJL OMLAAG. Schakel naar het vorige item met SHIFT+TAB of PIJL OMHOOG. Druk op SPATIE of ENTER om het item te selecteren. Druk op ESC om de keuzelijst te sluiten.'
},
{
name : 'Elementenpad werkbalk tekstverwerker',
legend :
'Druk op ${elementsPathFocus} om naar het elementenpad te navigeren. Om te schakelen naar het volgende element, gebruik TAB of PIJL RECHTS. Om te schakelen naar het vorige element, gebruik SHIFT+TAB or PIJL LINKS. Druk op SPATIE of ENTER om een element te selecteren in de tekstverwerker.'
}
]
},
{
name : 'Opdrachten',
items :
[
{
name : 'Ongedaan maken opdracht',
legend : 'Druk op ${undo}'
},
{
name : 'Opnieuw uitvoeren opdracht',
legend : 'Druk op ${redo}'
},
{
name : 'Vetgedrukt opdracht',
legend : 'Druk up ${bold}'
},
{
name : 'Cursief opdracht',
legend : 'Druk op ${italic}'
},
{
name : 'Onderstrepen opdracht',
legend : 'Druk op ${underline}'
},
{
name : 'Link opdracht',
legend : 'Druk op ${link}'
},
{
name : 'Werkbalk inklappen opdracht',
legend : 'Druk op ${toolbarCollapse}'
},
{
name : 'Toegankelijkheidshulp',
legend : 'Druk op ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'da',
{
accessibilityHelp :
{
title : 'Accessibility Instructions', // MISSING
contents : 'Help Contents. To close this dialog press ESC.', // MISSING
legend :
[
{
name : 'Generelt',
items :
[
{
name : 'Editor værktøjslinje',
legend:
'Press ${toolbarFocus} to navigate to the toolbar. Move to the next and previous toolbar group with TAB and SHIFT-TAB. Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. Press SPACE or ENTER to activate the toolbar button.' // MISSING
},
{
name : 'Editor Dialog', // MISSING
legend :
'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page.' // MISSING
},
{
name : 'Editor Context Menu', // MISSING
legend :
'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.' // MISSING
},
{
name : 'Editor List Box', // MISSING
legend :
'Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.' // MISSING
},
{
name : 'Editor Element Path Bar', // MISSING
legend :
'Press ${elementsPathFocus} to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor.' // MISSING
}
]
},
{
name : 'Kommandoer',
items :
[
{
name : 'Fortryd kommando',
legend : 'Klik på ${undo}'
},
{
name : 'Gentag kommando',
legend : 'Klik ${redo}'
},
{
name : ' Bold command', // MISSING
legend : 'Klik ${bold}'
},
{
name : ' Italic command', // MISSING
legend : 'Press ${italic}' // MISSING
},
{
name : ' Underline command', // MISSING
legend : 'Klik ${underline}'
},
{
name : ' Link command', // MISSING
legend : 'Klik ${link}'
},
{
name : ' Toolbar Collapse command', // MISSING
legend : 'Press ${toolbarCollapse}' // MISSING
},
{
name : ' Accessibility Help', // MISSING
legend : 'Kilk ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'gu',
{
accessibilityHelp :
{
title : 'એક્ક્ષેબિલિટી ની વિગતો',
contents : 'હેલ્પ. આ બંધ કરવા ESC દબાવો.',
legend :
[
{
name : 'જનરલ',
items :
[
{
name : 'એડિટર ટૂલબાર',
legend:
'Press ${toolbarFocus} to navigate to the toolbar. Move to the next and previous toolbar group with TAB and SHIFT-TAB. Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. Press SPACE or ENTER to activate the toolbar button.' // MISSING
},
{
name : 'એડિટર ડાયલોગ',
legend :
'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page.' // MISSING
},
{
name : 'Editor Context Menu', // MISSING
legend :
'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.' // MISSING
},
{
name : 'Editor List Box', // MISSING
legend :
'Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.' // MISSING
},
{
name : 'Editor Element Path Bar', // MISSING
legend :
'Press ${elementsPathFocus} to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor.' // MISSING
}
]
},
{
name : 'કમાંડસ',
items :
[
{
name : 'અન્ડું કમાંડ',
legend : '$ દબાવો {undo}'
},
{
name : 'ફરી કરો કમાંડ',
legend : '$ દબાવો {redo}'
},
{
name : 'બોલ્દનો કમાંડ',
legend : '$ દબાવો {bold}'
},
{
name : ' Italic command', // MISSING
legend : 'Press ${italic}' // MISSING
},
{
name : ' Underline command', // MISSING
legend : 'Press ${underline}' // MISSING
},
{
name : ' Link command', // MISSING
legend : 'Press ${link}' // MISSING
},
{
name : ' Toolbar Collapse command', // MISSING
legend : 'Press ${toolbarCollapse}' // MISSING
},
{
name : ' Accessibility Help', // MISSING
legend : 'Press ${a11yHelp}' // MISSING
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'cs',
{
accessibilityHelp :
{
title : 'Instrukce pro přístupnost',
contents : 'Obsah nápovědy. Pro uzavření tohoto dialogu stiskněte klávesu ESC.',
legend :
[
{
name : 'Obecné',
items :
[
{
name : 'Panel nástrojů editoru',
legend:
'Stiskněte${toolbarFocus} k procházení panelu nástrojů. Přejděte na další a předchozí skupiny pomocí TAB a SHIFT-TAB. Přechod na další a předchozí tlačítko panelu nástrojů je pomocí ŠIPKA VPRAVO nebo ŠIPKA VLEVO. Stisknutím mezerníku nebo klávesy ENTER tlačítko aktivujete.'
},
{
name : 'Dialogové okno editoru',
legend :
'Uvnitř dialogového okna stiskněte TAB pro přesunutí na další pole, stiskněte SHIFT + TAB pro přesun na předchozí pole, stiskněte ENTER pro odeslání dialogu, stiskněte ESC pro jeho zrušení. Pro dialogová okna, která mají mnoho karet stiskněte ALT + F10 pr oprocházení seznamu karet. Pak se přesuňte na další kartu pomocí TAB nebo ŠIPKA VPRAVO. Pro přesun na předchozí stiskněte SHIFT + TAB nebo ŠIPKA VLEVO. Stiskněte MEZERNÍK nebo ENTER pro vybrání stránky karet.'
},
{
name : 'Kontextové menu editoru',
legend :
'Stiskněte ${contextMenu} nebo klávesu APPLICATION k otevření kontextového menu. Pak se přesuňte na další možnost menu pomocí TAB nebo ŠIPKY DOLŮ. Přesuňte se na předchozí možnost pomocí SHIFT+TAB nebo ŠIPKY NAHORU. Stiskněte MEZERNÍK nebo ENTER pro zvolení možnosti menu. Podmenu současné možnosti otevřete pomocí MEZERNÍKU nebo ENTER či ŠIPKY DOLEVA. Kontextové menu uzavřete stiskem ESC.'
},
{
name : 'Rámeček seznamu editoru',
legend :
'Uvnitř rámečku seznamu se přesunete na další položku menu pomocí TAB nebo ŠIPKA DOLŮ. Na předchozí položku se přesunete SHIFT + TAB nebo ŠIPKA NAHORU. Stiskněte MEZERNÍK nebo ENTER pro zvolení možnosti seznamu. Stiskněte ESC pro uzavření seznamu.'
},
{
name : 'Lišta cesty prvku v editoru',
legend :
'Stiskněte ${elementsPathFocus} pro procházení lišty cesty prvku. Na další tlačítko prvku se přesunete pomocí TAB nebo ŠIPKA VPRAVO. Na předchozí položku se přesunete pomocí SHIFT + TAB nebo ŠIPKA VLEVO. Stiskněte MEZERNÍK nebo ENTER pro vybrání prvku v editoru.'
}
]
},
{
name : 'Příkazy',
items :
[
{
name : ' Příkaz Zpět',
legend : 'Stiskněte ${undo}'
},
{
name : ' Příkaz Znovu',
legend : 'Stiskněte ${redo}'
},
{
name : ' Příkaz Tučné',
legend : 'Stiskněte ${bold}'
},
{
name : ' Příkaz Kurzíva',
legend : 'Stiskněte ${italic}'
},
{
name : ' Příkaz Podtržení',
legend : 'Stiskněte ${underline}'
},
{
name : ' Příkaz Odkaz',
legend : 'Stiskněte ${link}'
},
{
name : ' Příkaz Skrýt panel nástrojů',
legend : 'Stiskněte ${toolbarCollapse}'
},
{
name : ' Nápověda přístupnosti',
legend : 'Stiskněte ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'fi',
{
accessibilityHelp :
{
title : 'Saavutettavuus ohjeet',
contents : 'Ohjeen sisällöt. Sulkeaksesi tämän dialogin paina ESC.',
legend :
[
{
name : 'Yleinen',
items :
[
{
name : 'Editorin työkalupalkki',
legend:
'Paina ${toolbarFocus} siirtyäksesi työkalupalkkiin. Siirry seuraavaan ja edelliseen työkalupalkin ryhmään TAB ja SHIFT-TAB näppäimillä. Siirry seuraavaan ja edelliseen työkalupainikkeeseen käyttämällä NUOLI OIKEALLE tai NUOLI VASEMMALLE näppäimillä. Paina VÄLILYÖNTI tai ENTER näppäintä aktivoidaksesi työkalupainikkeen.'
},
{
name : 'Editorin dialogi',
legend :
'Dialogin sisällä, painamalla TAB siirryt seuraavaan dialogin kenttään, painamalla SHIFT+TAB siirryt aiempaan kenttään, painamalla ENTER lähetät dialogin, painamalla ESC peruutat dialogin. Dialogeille joissa on useita välilehtiä, paina ALT+F10 siirtyäksesi välillehtilistaan. Siirtyäksesi seuraavaan välilehteen paina TAB tai NUOLI OIKEALLE. Siirry edelliseen välilehteen painamalla SHIFT+TAB tai nuoli vasemmalle. Paina VÄLILYÖNTI tai ENTER valitaksesi välilehden.'
},
{
name : 'Editorin oheisvalikko',
legend :
'Paina ${contextMenu} tai SOVELLUSPAINIKETTA avataksesi oheisvalikon. Liiku seuraavaan valikon vaihtoehtoon TAB tai NUOLI ALAS näppäimillä. Siirry edelliseen vaihtoehtoon SHIFT+TAB tai NUOLI YLÖS näppäimillä. Paina VÄLILYÖNTI tai ENTER valitaksesi valikon kohdan. Avataksesi nykyisen kohdan alivalikon paina VÄLILYÖNTI tai ENTER tai NUOLI OIKEALLE painiketta. Siirtyäksesi takaisin valikon ylemmälle tasolle paina ESC tai NUOLI vasemmalle. Oheisvalikko suljetaan ESC painikkeella.'
},
{
name : 'Editorin listalaatikko',
legend :
'Listalaatikon sisällä siirry seuraavaan listan kohtaan TAB tai NUOLI ALAS painikkeilla. Siirry edelliseen listan kohtaan SHIFT+TAB tai NUOLI YLÖS painikkeilla. Paina VÄLILYÖNTI tai ENTER valitaksesi listan vaihtoehdon. Paina ESC sulkeaksesi listalaatikon.'
},
{
name : 'Editorin elementtipolun palkki',
legend :
'Paina ${elementsPathFocus} siirtyäksesi elementtipolun palkkiin. Siirry seuraavaan elementtipainikkeeseen TAB tai NUOLI OIKEALLE painikkeilla. Siirry aiempaan painikkeeseen SHIFT+TAB tai NUOLI VASEMMALLE painikkeilla. Paina VÄLILYÖNTI tai ENTER valitaksesi elementin editorissa.'
}
]
},
{
name : 'Komennot',
items :
[
{
name : 'Peruuta komento',
legend : 'Paina ${undo}'
},
{
name : 'Tee uudelleen komento',
legend : 'Paina ${redo}'
},
{
name : 'Lihavoi komento',
legend : 'Paina ${bold}'
},
{
name : 'Kursivoi komento',
legend : 'Paina ${italic}'
},
{
name : 'Alleviivaa komento',
legend : 'Paina ${underline}'
},
{
name : 'Linkki komento',
legend : 'Paina ${link}'
},
{
name : 'Pienennä työkalupalkki komento',
legend : 'Paina ${toolbarCollapse}'
},
{
name : 'Saavutettavuus ohjeet',
legend : 'Paina ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'ug',
{
accessibilityHelp :
{
title : 'قوشۇمچە چۈشەندۈرۈش',
contents : 'ياردەم مەزمۇنى. بۇ سۆزلەشكۈنى ياپماقچى بولسىڭىز ESC نى بېسىڭ.',
legend :
[
{
name : 'ئادەتتىكى',
items :
[
{
name : 'قورال بالداق تەھرىر',
legend:
'${toolbarFocus} بېسىلسا قورال بالداققا يېتەكلەيدۇ، TAB ياكى SHIFT+TAB ئارقىلىق قورال بالداق گۇرۇپپىسى تاللىنىدۇ، ئوڭ سول يا ئوقتا توپچا تاللىنىدۇ، بوشلۇق ياكى Enter كۇنۇپكىسىدا تاللانغان توپچىنى قوللىنىدۇ.'
},
{
name : 'تەھرىرلىگۈچ سۆزلەشكۈسى',
legend :
'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page.' // MISSING
},
{
name : 'تەھرىرلىگۈچ تىل مۇھىت تىزىملىكى',
legend :
'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.' // MISSING
},
{
name : 'تەھرىرلىگۈچ تىزىمى',
legend :
'Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.' // MISSING
},
{
name : 'تەھرىرلىگۈچ ئېلېمېنت يول بالداق',
legend :
'${elementsPathFocus} بېسىلسا ئېلېمېنت يول بالداققا يېتەكلەيدۇ، TAB ياكى ئوڭ يا ئوقتا كېيىنكى ئېلېمېنت تاللىنىدۇ، SHIFT+TAB ياكى سول يا ئوقتا ئالدىنقى ئېلېمېنت تاللىنىدۇ، بوشلۇق ياكى Enter كۇنۇپكىسىدا تەھرىرلىگۈچتىكى ئېلېمېنت تاللىنىدۇ.'
}
]
},
{
name : 'بۇيرۇق',
items :
[
{
name : 'بۇيرۇقتىن يېنىۋال',
legend : '${undo} نى بېسىڭ'
},
{
name : 'قايتىلاش بۇيرۇقى',
legend : '${redo} نى بېسىڭ'
},
{
name : 'توملىتىش بۇيرۇقى',
legend : '${bold} نى بېسىڭ'
},
{
name : 'يانتۇ بۇيرۇقى',
legend : '${italic} نى بېسىڭ'
},
{
name : 'ئاستى سىزىق بۇيرۇقى',
legend : '${underline} نى بېسىڭ'
},
{
name : 'ئۇلانما بۇيرۇقى',
legend : '${link} نى بېسىڭ'
},
{
name : 'قورال بالداق قاتلاش بۇيرۇقى',
legend : '${toolbarCollapse} نى بېسىڭ'
},
{
name : 'توسالغۇسىز لايىھە چۈشەندۈرۈشى',
legend : '${a11yHelp} نى بېسىڭ'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'zh-cn',
{
accessibilityHelp :
{
title : '辅助说明',
contents : '帮助内容。要关闭此对话框请按 ESC 键。',
legend :
[
{
name : '常规',
items :
[
{
name : '编辑器工具栏',
legend:
'按 ${toolbarFocus} 以导航到工具栏,使用 TAB 键或 SHIFT+TAB 组合键以选择工具栏组,使用左右箭头键以选择按钮,按空格键或回车键以应用选中的按钮。'
},
{
name : '编辑器对话框',
legend :
'在对话框内,TAB键移动到下一个字段,SHIFT + TAB 移动到上一个字段,ENTER键提交对话框,ESC键取消对话框。对于有多标签的对话框,用ALT + F10来移到标签列表。然后用TAB键或者向右箭头来移动到下一个标签;SHIFT + TAB或者向左箭头移动到上一个标签。用SPACE或者ENTER选择标签。'
},
{
name : '编辑器上下文菜单',
legend :
'用 ${contextMenu}或者 应用程序键 打开上下文菜单。然后用TAB键或者向下箭头来移动到下一个菜单项;SHIFT + TAB或者向上箭头移动到上一个菜单项。用SPACE或者ENTER选择菜单项。用SPACE,ENTER或者向右箭头打开子菜单。返回菜单用ESC键或者向左箭头。用ESC关闭上下文菜单。'
},
{
name : '编辑器列表框',
legend :
'在列表框中,移到下一列表项用TAB键或者向下箭头。移到上一列表项用SHIFT + TAB或者向上箭头,用SPACE或者ENTER选择列表项。用ESC收起列表框。'
},
{
name : '编辑器元素路径栏',
legend :
'按 ${elementsPathFocus} 以导航到元素路径栏,使用 TAB 键或右箭头键选择下一个元素,使用 SHIFT+TAB 组合键或左箭头键选择上一个元素,按空格键或回车键以选定编辑器里的元素。'
}
]
},
{
name : '命令',
items :
[
{
name : ' 撤消命令',
legend : '按 ${undo}'
},
{
name : ' 重做命令',
legend : '按 ${redo}'
},
{
name : ' 加粗命令',
legend : '按 ${bold}'
},
{
name : ' 倾斜命令',
legend : '按 ${italic}'
},
{
name : ' 下划线命令',
legend : '按 ${underline}'
},
{
name : ' 链接命令',
legend : '按 ${link}'
},
{
name : ' 工具栏折叠命令',
legend : '按 ${toolbarCollapse}'
},
{
name : ' 无障碍设计说明',
legend : '按 ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'en',
{
accessibilityHelp :
{
title : 'Accessibility Instructions',
contents : 'Help Contents. To close this dialog press ESC.',
legend :
[
{
name : 'General',
items :
[
{
name : 'Editor Toolbar',
legend:
'Press ${toolbarFocus} to navigate to the toolbar. ' +
'Move to the next and previous toolbar group with TAB and SHIFT-TAB. ' +
'Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. ' +
'Press SPACE or ENTER to activate the toolbar button.'
},
{
name : 'Editor Dialog',
legend :
'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. ' +
'For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. ' +
'Then move to next tab with TAB OR RIGTH ARROW. ' +
'Move to previous tab with SHIFT + TAB or LEFT ARROW. ' +
'Press SPACE or ENTER to select the tab page.'
},
{
name : 'Editor Context Menu',
legend :
'Press ${contextMenu} or APPLICATION KEY to open context-menu. ' +
'Then move to next menu option with TAB or DOWN ARROW. ' +
'Move to previous option with SHIFT+TAB or UP ARROW. ' +
'Press SPACE or ENTER to select the menu option. ' +
'Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. ' +
'Go back to parent menu item with ESC or LEFT ARROW. ' +
'Close context menu with ESC.'
},
{
name : 'Editor List Box',
legend :
'Inside a list-box, move to next list item with TAB OR DOWN ARROW. ' +
'Move to previous list item with SHIFT + TAB or UP ARROW. ' +
'Press SPACE or ENTER to select the list option. ' +
'Press ESC to close the list-box.'
},
{
name : 'Editor Element Path Bar',
legend :
'Press ${elementsPathFocus} to navigate to the elements path bar. ' +
'Move to next element button with TAB or RIGHT ARROW. ' +
'Move to previous button with SHIFT+TAB or LEFT ARROW. ' +
'Press SPACE or ENTER to select the element in editor.'
}
]
},
{
name : 'Commands',
items :
[
{
name : ' Undo command',
legend : 'Press ${undo}'
},
{
name : ' Redo command',
legend : 'Press ${redo}'
},
{
name : ' Bold command',
legend : 'Press ${bold}'
},
{
name : ' Italic command',
legend : 'Press ${italic}'
},
{
name : ' Underline command',
legend : 'Press ${underline}'
},
{
name : ' Link command',
legend : 'Press ${link}'
},
{
name : ' Toolbar Collapse command',
legend : 'Press ${toolbarCollapse}'
},
{
name : ' Accessibility Help',
legend : 'Press ${a11yHelp}'
}
]
}
]
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'a11yHelp', function( editor )
{
var lang = editor.lang.accessibilityHelp,
id = CKEDITOR.tools.getNextId();
// CharCode <-> KeyChar.
var keyMap =
{
8 : "BACKSPACE",
9 : "TAB" ,
13 : "ENTER" ,
16 : "SHIFT" ,
17 : "CTRL" ,
18 : "ALT" ,
19 : "PAUSE" ,
20 : "CAPSLOCK" ,
27 : "ESCAPE" ,
33 : "PAGE UP" ,
34 : "PAGE DOWN" ,
35 : "END" ,
36 : "HOME" ,
37 : "LEFT ARROW" ,
38 : "UP ARROW" ,
39 : "RIGHT ARROW" ,
40 : "DOWN ARROW" ,
45 : "INSERT" ,
46 : "DELETE" ,
91 : "LEFT WINDOW KEY" ,
92 : "RIGHT WINDOW KEY" ,
93 : "SELECT KEY" ,
96 : "NUMPAD 0" ,
97 : "NUMPAD 1" ,
98 : "NUMPAD 2" ,
99 : "NUMPAD 3" ,
100 : "NUMPAD 4" ,
101 : "NUMPAD 5" ,
102 : "NUMPAD 6" ,
103 : "NUMPAD 7" ,
104 : "NUMPAD 8" ,
105 : "NUMPAD 9" ,
106 : "MULTIPLY" ,
107 : "ADD" ,
109 : "SUBTRACT" ,
110 : "DECIMAL POINT" ,
111 : "DIVIDE" ,
112 : "F1" ,
113 : "F2" ,
114 : "F3" ,
115 : "F4" ,
116 : "F5" ,
117 : "F6" ,
118 : "F7" ,
119 : "F8" ,
120 : "F9" ,
121 : "F10" ,
122 : "F11" ,
123 : "F12" ,
144 : "NUM LOCK" ,
145 : "SCROLL LOCK" ,
186 : "SEMI-COLON" ,
187 : "EQUAL SIGN" ,
188 : "COMMA" ,
189 : "DASH" ,
190 : "PERIOD" ,
191 : "FORWARD SLASH" ,
192 : "GRAVE ACCENT" ,
219 : "OPEN BRACKET" ,
220 : "BACK SLASH" ,
221 : "CLOSE BRAKET" ,
222 : "SINGLE QUOTE"
};
// Modifier keys override.
keyMap[ CKEDITOR.ALT ] = 'ALT';
keyMap[ CKEDITOR.SHIFT ] = 'SHIFT';
keyMap[ CKEDITOR.CTRL ] = 'CTRL';
// Sort in desc.
var modifiers = [ CKEDITOR.ALT, CKEDITOR.SHIFT, CKEDITOR.CTRL ];
function representKeyStroke( keystroke )
{
var quotient,
modifier,
presentation = [];
for ( var i = 0; i < modifiers.length; i++ )
{
modifier = modifiers[ i ];
quotient = keystroke / modifiers[ i ];
if ( quotient > 1 && quotient <= 2 )
{
keystroke -= modifier;
presentation.push( keyMap[ modifier ] );
}
}
presentation.push( keyMap[ keystroke ]
|| String.fromCharCode( keystroke ) );
return presentation.join( '+' );
}
var variablesPattern = /\$\{(.*?)\}/g;
function replaceVariables( match, name )
{
var keystrokes = editor.config.keystrokes,
definition,
length = keystrokes.length;
for ( var i = 0; i < length; i++ )
{
definition = keystrokes[ i ];
if ( definition[ 1 ] == name )
break;
}
return representKeyStroke( definition[ 0 ] );
}
// Create the help list directly from lang file entries.
function buildHelpContents()
{
var pageTpl = '<div class="cke_accessibility_legend" role="document" aria-labelledby="' + id + '_arialbl" tabIndex="-1">%1</div>' +
'<span id="' + id + '_arialbl" class="cke_voice_label">' + lang.contents + ' </span>',
sectionTpl = '<h1>%1</h1><dl>%2</dl>',
itemTpl = '<dt>%1</dt><dd>%2</dd>';
var pageHtml = [],
sections = lang.legend,
sectionLength = sections.length;
for ( var i = 0; i < sectionLength; i++ )
{
var section = sections[ i ],
sectionHtml = [],
items = section.items,
itemsLength = items.length;
for ( var j = 0; j < itemsLength; j++ )
{
var item = items[ j ],
itemHtml;
itemHtml = itemTpl.replace( '%1', item.name ).
replace( '%2', item.legend.replace( variablesPattern, replaceVariables ) );
sectionHtml.push( itemHtml );
}
pageHtml.push( sectionTpl.replace( '%1', section.name ).replace( '%2', sectionHtml.join( '' ) ) );
}
return pageTpl.replace( '%1', pageHtml.join( '' ) );
}
return {
title : lang.title,
minWidth : 600,
minHeight : 400,
contents : [
{
id : 'info',
label : editor.lang.common.generalTab,
expand : true,
elements :
[
{
type : 'html',
id : 'legends',
style : 'white-space:normal;',
focus : function() {},
html : buildHelpContents() +
'<style type="text/css">' +
'.cke_accessibility_legend' +
'{' +
'width:600px;' +
'height:400px;' +
'padding-right:5px;' +
'overflow-y:auto;' +
'overflow-x:hidden;' +
'}' +
// Some adjustments are to be done for IE6 and Quirks to work "properly" (#5757)
'.cke_browser_quirks .cke_accessibility_legend,' +
'.cke_browser_ie6 .cke_accessibility_legend' +
'{' +
'height:390px' +
'}' +
// Override non-wrapping white-space rule in reset css.
'.cke_accessibility_legend *' +
'{' +
'white-space:normal;' +
'}' +
'.cke_accessibility_legend h1' +
'{' +
'font-size: 20px;' +
'border-bottom: 1px solid #AAA;' +
'margin: 5px 0px 15px;' +
'}' +
'.cke_accessibility_legend dl' +
'{' +
'margin-left: 5px;' +
'}' +
'.cke_accessibility_legend dt' +
'{' +
'font-size: 13px;' +
'font-weight: bold;' +
'}' +
'.cke_accessibility_legend dd' +
'{' +
'margin:10px' +
'}' +
'</style>'
}
]
}
],
buttons : [ CKEDITOR.dialog.cancelButton ]
};
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'link',
{
init : function( editor )
{
// Add the link and unlink buttons.
editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link' ) );
editor.addCommand( 'anchor', new CKEDITOR.dialogCommand( 'anchor' ) );
editor.addCommand( 'unlink', new CKEDITOR.unlinkCommand() );
editor.addCommand( 'removeAnchor', new CKEDITOR.removeAnchorCommand() );
editor.ui.addButton( 'Link',
{
label : editor.lang.link.toolbar,
command : 'link'
} );
editor.ui.addButton( 'Unlink',
{
label : editor.lang.unlink,
command : 'unlink'
} );
editor.ui.addButton( 'Anchor',
{
label : editor.lang.anchor.toolbar,
command : 'anchor'
} );
CKEDITOR.dialog.add( 'link', this.path + 'dialogs/link.js' );
CKEDITOR.dialog.add( 'anchor', this.path + 'dialogs/anchor.js' );
// Add the CSS styles for anchor placeholders.
var side = ( editor.lang.dir == 'rtl' ? 'right' : 'left' );
var basicCss =
'background:url(' + CKEDITOR.getUrl( this.path + 'images/anchor.gif' ) + ') no-repeat ' + side + ' center;' +
'border:1px dotted #00f;';
editor.addCss(
'a.cke_anchor,a.cke_anchor_empty' +
// IE6 breaks with the following selectors.
( ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ) ? '' :
',a[name],a[data-cke-saved-name]' ) +
'{' +
basicCss +
'padding-' + side + ':18px;' +
// Show the arrow cursor for the anchor image (FF at least).
'cursor:auto;' +
'}' +
( CKEDITOR.env.ie ? (
'a.cke_anchor_empty' +
'{' +
// Make empty anchor selectable on IE.
'display:inline-block;' +
'}'
) : '' ) +
'img.cke_anchor' +
'{' +
basicCss +
'width:16px;' +
'min-height:15px;' +
// The default line-height on IE.
'height:1.15em;' +
// Opera works better with "middle" (even if not perfect)
'vertical-align:' + ( CKEDITOR.env.opera ? 'middle' : 'text-bottom' ) + ';' +
'}');
// Register selection change handler for the unlink button.
editor.on( 'selectionChange', function( evt )
{
if ( editor.readOnly )
return;
/*
* Despite our initial hope, document.queryCommandEnabled() does not work
* for this in Firefox. So we must detect the state by element paths.
*/
var command = editor.getCommand( 'unlink' ),
element = evt.data.path.lastElement && evt.data.path.lastElement.getAscendant( 'a', true );
if ( element && element.getName() == 'a' && element.getAttribute( 'href' ) && element.getChildCount() )
command.setState( CKEDITOR.TRISTATE_OFF );
else
command.setState( CKEDITOR.TRISTATE_DISABLED );
} );
editor.on( 'doubleclick', function( evt )
{
var element = CKEDITOR.plugins.link.getSelectedLink( editor ) || evt.data.element;
if ( !element.isReadOnly() )
{
if ( element.is( 'a' ) )
{
evt.data.dialog = ( element.getAttribute( 'name' ) && ( !element.getAttribute( 'href' ) || !element.getChildCount() ) ) ? 'anchor' : 'link';
editor.getSelection().selectElement( element );
}
else if ( CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, element ) )
evt.data.dialog = 'anchor';
}
});
// If the "menu" plugin is loaded, register the menu items.
if ( editor.addMenuItems )
{
editor.addMenuItems(
{
anchor :
{
label : editor.lang.anchor.menu,
command : 'anchor',
group : 'anchor',
order : 1
},
removeAnchor :
{
label : editor.lang.anchor.remove,
command : 'removeAnchor',
group : 'anchor',
order : 5
},
link :
{
label : editor.lang.link.menu,
command : 'link',
group : 'link',
order : 1
},
unlink :
{
label : editor.lang.unlink,
command : 'unlink',
group : 'link',
order : 5
}
});
}
// If the "contextmenu" plugin is loaded, register the listeners.
if ( editor.contextMenu )
{
editor.contextMenu.addListener( function( element, selection )
{
if ( !element || element.isReadOnly() )
return null;
var anchor = CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, element );
if ( !anchor && !( anchor = CKEDITOR.plugins.link.getSelectedLink( editor ) ) )
return null;
var menu = {};
if ( anchor.getAttribute( 'href' ) && anchor.getChildCount() )
menu = { link : CKEDITOR.TRISTATE_OFF, unlink : CKEDITOR.TRISTATE_OFF };
if ( anchor && anchor.hasAttribute( 'name' ) )
menu.anchor = menu.removeAnchor = CKEDITOR.TRISTATE_OFF;
return menu;
});
}
},
afterInit : function( editor )
{
// Register a filter to displaying placeholders after mode change.
var dataProcessor = editor.dataProcessor,
dataFilter = dataProcessor && dataProcessor.dataFilter,
htmlFilter = dataProcessor && dataProcessor.htmlFilter,
pathFilters = editor._.elementsPath && editor._.elementsPath.filters;
if ( dataFilter )
{
dataFilter.addRules(
{
elements :
{
a : function( element )
{
var attributes = element.attributes;
if ( !attributes.name )
return null;
var isEmpty = !element.children.length;
if ( CKEDITOR.plugins.link.synAnchorSelector )
{
// IE needs a specific class name to be applied
// to the anchors, for appropriate styling.
var ieClass = isEmpty ? 'cke_anchor_empty' : 'cke_anchor';
var cls = attributes[ 'class' ];
if ( attributes.name && ( !cls || cls.indexOf( ieClass ) < 0 ) )
attributes[ 'class' ] = ( cls || '' ) + ' ' + ieClass;
if ( isEmpty && CKEDITOR.plugins.link.emptyAnchorFix )
{
attributes.contenteditable = 'false';
attributes[ 'data-cke-editable' ] = 1;
}
}
else if ( CKEDITOR.plugins.link.fakeAnchor && isEmpty )
return editor.createFakeParserElement( element, 'cke_anchor', 'anchor' );
return null;
}
}
});
}
if ( CKEDITOR.plugins.link.emptyAnchorFix && htmlFilter )
{
htmlFilter.addRules(
{
elements :
{
a : function( element )
{
delete element.attributes.contenteditable;
}
}
});
}
if ( pathFilters )
{
pathFilters.push( function( element, name )
{
if ( name == 'a' )
{
if ( CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, element ) ||
( element.getAttribute( 'name' ) && ( !element.getAttribute( 'href' ) || !element.getChildCount() ) ) )
{
return 'anchor';
}
}
});
}
},
requires : [ 'fakeobjects' ]
} );
CKEDITOR.plugins.link =
{
/**
* Get the surrounding link element of current selection.
* @param editor
* @example CKEDITOR.plugins.link.getSelectedLink( editor );
* @since 3.2.1
* The following selection will all return the link element.
* <pre>
* <a href="#">li^nk</a>
* <a href="#">[link]</a>
* text[<a href="#">link]</a>
* <a href="#">li[nk</a>]
* [<b><a href="#">li]nk</a></b>]
* [<a href="#"><b>li]nk</b></a>
* </pre>
*/
getSelectedLink : function( editor )
{
try
{
var selection = editor.getSelection();
if ( selection.getType() == CKEDITOR.SELECTION_ELEMENT )
{
var selectedElement = selection.getSelectedElement();
if ( selectedElement.is( 'a' ) )
return selectedElement;
}
var range = selection.getRanges( true )[ 0 ];
range.shrink( CKEDITOR.SHRINK_TEXT );
var root = range.getCommonAncestor();
return root.getAscendant( 'a', true );
}
catch( e ) { return null; }
},
// Opera and WebKit don't make it possible to select empty anchors. Fake
// elements must be used for them.
fakeAnchor : CKEDITOR.env.opera || CKEDITOR.env.webkit,
// For browsers that don't support CSS3 a[name]:empty(), note IE9 is included because of #7783.
synAnchorSelector : CKEDITOR.env.ie,
// For browsers that have editing issue with empty anchor.
emptyAnchorFix : CKEDITOR.env.ie && CKEDITOR.env.version < 8,
tryRestoreFakeAnchor : function( editor, element )
{
if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == 'anchor' )
{
var link = editor.restoreRealElement( element );
if ( link.data( 'cke-saved-name' ) )
return link;
}
}
};
CKEDITOR.unlinkCommand = function(){};
CKEDITOR.unlinkCommand.prototype =
{
/** @ignore */
exec : function( editor )
{
/*
* execCommand( 'unlink', ... ) in Firefox leaves behind <span> tags at where
* the <a> was, so again we have to remove the link ourselves. (See #430)
*
* TODO: Use the style system when it's complete. Let's use execCommand()
* as a stopgap solution for now.
*/
var selection = editor.getSelection(),
bookmarks = selection.createBookmarks(),
ranges = selection.getRanges(),
rangeRoot,
element;
for ( var i = 0 ; i < ranges.length ; i++ )
{
rangeRoot = ranges[i].getCommonAncestor( true );
element = rangeRoot.getAscendant( 'a', true );
if ( !element )
continue;
ranges[i].selectNodeContents( element );
}
selection.selectRanges( ranges );
editor.document.$.execCommand( 'unlink', false, null );
selection.selectBookmarks( bookmarks );
},
startDisabled : true
};
CKEDITOR.removeAnchorCommand = function(){};
CKEDITOR.removeAnchorCommand.prototype =
{
/** @ignore */
exec : function( editor )
{
var sel = editor.getSelection(),
bms = sel.createBookmarks(),
anchor;
if ( sel && ( anchor = sel.getSelectedElement() ) && ( CKEDITOR.plugins.link.fakeAnchor && !anchor.getChildCount() ? CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, anchor ) : anchor.is( 'a' ) ) )
anchor.remove( 1 );
else
{
if ( ( anchor = CKEDITOR.plugins.link.getSelectedLink( editor ) ) )
{
if ( anchor.hasAttribute( 'href' ) )
{
anchor.removeAttributes( { name : 1, 'data-cke-saved-name' : 1 } );
anchor.removeClass( 'cke_anchor' );
}
else
anchor.remove( 1 );
}
}
sel.selectBookmarks( bms );
}
};
CKEDITOR.tools.extend( CKEDITOR.config,
{
linkShowAdvancedTab : true,
linkShowTargetTab : true
} );
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'anchor', function( editor )
{
// Function called in onShow to load selected element.
var loadElements = function( element )
{
this._.selectedElement = element;
var attributeValue = element.data( 'cke-saved-name' );
this.setValueOf( 'info','txtName', attributeValue || '' );
};
function createFakeAnchor( editor, anchor )
{
return editor.createFakeElement( anchor, 'cke_anchor', 'anchor' );
}
return {
title : editor.lang.anchor.title,
minWidth : 300,
minHeight : 60,
onOk : function()
{
var name = this.getValueOf( 'info', 'txtName' );
var attributes =
{
name : name,
'data-cke-saved-name' : name
};
if ( this._.selectedElement )
{
if ( this._.selectedElement.data( 'cke-realelement' ) )
{
var newFake = createFakeAnchor( editor, editor.document.createElement( 'a', { attributes: attributes } ) );
newFake.replace( this._.selectedElement );
}
else
this._.selectedElement.setAttributes( attributes );
}
else
{
var sel = editor.getSelection(),
range = sel && sel.getRanges()[ 0 ];
// Empty anchor
if ( range.collapsed )
{
if ( CKEDITOR.plugins.link.synAnchorSelector )
attributes[ 'class' ] = 'cke_anchor_empty';
if ( CKEDITOR.plugins.link.emptyAnchorFix )
{
attributes[ 'contenteditable' ] = 'false';
attributes[ 'data-cke-editable' ] = 1;
}
var anchor = editor.document.createElement( 'a', { attributes: attributes } );
// Transform the anchor into a fake element for browsers that need it.
if ( CKEDITOR.plugins.link.fakeAnchor )
anchor = createFakeAnchor( editor, anchor );
range.insertNode( anchor );
}
else
{
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
attributes['class'] = 'cke_anchor';
// Apply style.
var style = new CKEDITOR.style( { element : 'a', attributes : attributes } );
style.type = CKEDITOR.STYLE_INLINE;
style.apply( editor.document );
}
}
},
onHide : function()
{
delete this._.selectedElement;
},
onShow : function()
{
var selection = editor.getSelection(),
fullySelected = selection.getSelectedElement(),
partialSelected;
// Detect the anchor under selection.
if ( fullySelected )
{
if ( CKEDITOR.plugins.link.fakeAnchor )
{
var realElement = CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, fullySelected );
realElement && loadElements.call( this, realElement );
this._.selectedElement = fullySelected;
}
else if ( fullySelected.is( 'a' ) && fullySelected.hasAttribute( 'name' ) )
loadElements.call( this, fullySelected );
}
else
{
partialSelected = CKEDITOR.plugins.link.getSelectedLink( editor );
if ( partialSelected )
{
loadElements.call( this, partialSelected );
selection.selectElement( partialSelected );
}
}
this.getContentElement( 'info', 'txtName' ).focus();
},
contents : [
{
id : 'info',
label : editor.lang.anchor.title,
accessKey : 'I',
elements :
[
{
type : 'text',
id : 'txtName',
label : editor.lang.anchor.name,
required: true,
validate : function()
{
if ( !this.getValue() )
{
alert( editor.lang.anchor.errorName );
return false;
}
return true;
}
}
]
}
]
};
} );
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'link', function( editor )
{
var plugin = CKEDITOR.plugins.link;
// Handles the event when the "Target" selection box is changed.
var targetChanged = function()
{
var dialog = this.getDialog(),
popupFeatures = dialog.getContentElement( 'target', 'popupFeatures' ),
targetName = dialog.getContentElement( 'target', 'linkTargetName' ),
value = this.getValue();
if ( !popupFeatures || !targetName )
return;
popupFeatures = popupFeatures.getElement();
popupFeatures.hide();
targetName.setValue( '' );
switch ( value )
{
case 'frame' :
targetName.setLabel( editor.lang.link.targetFrameName );
targetName.getElement().show();
break;
case 'popup' :
popupFeatures.show();
targetName.setLabel( editor.lang.link.targetPopupName );
targetName.getElement().show();
break;
default :
targetName.setValue( value );
targetName.getElement().hide();
break;
}
};
// Handles the event when the "Type" selection box is changed.
var linkTypeChanged = function()
{
var dialog = this.getDialog(),
partIds = [ 'urlOptions', 'anchorOptions', 'emailOptions' ],
typeValue = this.getValue(),
uploadTab = dialog.definition.getContents( 'upload' ),
uploadInitiallyHidden = uploadTab && uploadTab.hidden;
if ( typeValue == 'url' )
{
if ( editor.config.linkShowTargetTab )
dialog.showPage( 'target' );
if ( !uploadInitiallyHidden )
dialog.showPage( 'upload' );
}
else
{
dialog.hidePage( 'target' );
if ( !uploadInitiallyHidden )
dialog.hidePage( 'upload' );
}
for ( var i = 0 ; i < partIds.length ; i++ )
{
var element = dialog.getContentElement( 'info', partIds[i] );
if ( !element )
continue;
element = element.getElement().getParent().getParent();
if ( partIds[i] == typeValue + 'Options' )
element.show();
else
element.hide();
}
dialog.layout();
};
// Loads the parameters in a selected link to the link dialog fields.
var javascriptProtocolRegex = /^javascript:/,
emailRegex = /^mailto:([^?]+)(?:\?(.+))?$/,
emailSubjectRegex = /subject=([^;?:@&=$,\/]*)/,
emailBodyRegex = /body=([^;?:@&=$,\/]*)/,
anchorRegex = /^#(.*)$/,
urlRegex = /^((?:http|https|ftp|news):\/\/)?(.*)$/,
selectableTargets = /^(_(?:self|top|parent|blank))$/,
encodedEmailLinkRegex = /^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,
functionCallProtectedEmailLinkRegex = /^javascript:([^(]+)\(([^)]+)\)$/;
var popupRegex =
/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/;
var popupFeaturesRegex = /(?:^|,)([^=]+)=(\d+|yes|no)/gi;
var parseLink = function( editor, element )
{
var href = ( element && ( element.data( 'cke-saved-href' ) || element.getAttribute( 'href' ) ) ) || '',
javascriptMatch,
emailMatch,
anchorMatch,
urlMatch,
retval = {};
if ( ( javascriptMatch = href.match( javascriptProtocolRegex ) ) )
{
if ( emailProtection == 'encode' )
{
href = href.replace( encodedEmailLinkRegex,
function ( match, protectedAddress, rest )
{
return 'mailto:' +
String.fromCharCode.apply( String, protectedAddress.split( ',' ) ) +
( rest && unescapeSingleQuote( rest ) );
});
}
// Protected email link as function call.
else if ( emailProtection )
{
href.replace( functionCallProtectedEmailLinkRegex, function( match, funcName, funcArgs )
{
if ( funcName == compiledProtectionFunction.name )
{
retval.type = 'email';
var email = retval.email = {};
var paramRegex = /[^,\s]+/g,
paramQuoteRegex = /(^')|('$)/g,
paramsMatch = funcArgs.match( paramRegex ),
paramsMatchLength = paramsMatch.length,
paramName,
paramVal;
for ( var i = 0; i < paramsMatchLength; i++ )
{
paramVal = decodeURIComponent( unescapeSingleQuote( paramsMatch[ i ].replace( paramQuoteRegex, '' ) ) );
paramName = compiledProtectionFunction.params[ i ].toLowerCase();
email[ paramName ] = paramVal;
}
email.address = [ email.name, email.domain ].join( '@' );
}
} );
}
}
if ( !retval.type )
{
if ( ( anchorMatch = href.match( anchorRegex ) ) )
{
retval.type = 'anchor';
retval.anchor = {};
retval.anchor.name = retval.anchor.id = anchorMatch[1];
}
// Protected email link as encoded string.
else if ( ( emailMatch = href.match( emailRegex ) ) )
{
var subjectMatch = href.match( emailSubjectRegex ),
bodyMatch = href.match( emailBodyRegex );
retval.type = 'email';
var email = ( retval.email = {} );
email.address = emailMatch[ 1 ];
subjectMatch && ( email.subject = decodeURIComponent( subjectMatch[ 1 ] ) );
bodyMatch && ( email.body = decodeURIComponent( bodyMatch[ 1 ] ) );
}
// urlRegex matches empty strings, so need to check for href as well.
else if ( href && ( urlMatch = href.match( urlRegex ) ) )
{
retval.type = 'url';
retval.url = {};
retval.url.protocol = urlMatch[1];
retval.url.url = urlMatch[2];
}
else
retval.type = 'url';
}
// Load target and popup settings.
if ( element )
{
var target = element.getAttribute( 'target' );
retval.target = {};
retval.adv = {};
// IE BUG: target attribute is an empty string instead of null in IE if it's not set.
if ( !target )
{
var onclick = element.data( 'cke-pa-onclick' ) || element.getAttribute( 'onclick' ),
onclickMatch = onclick && onclick.match( popupRegex );
if ( onclickMatch )
{
retval.target.type = 'popup';
retval.target.name = onclickMatch[1];
var featureMatch;
while ( ( featureMatch = popupFeaturesRegex.exec( onclickMatch[2] ) ) )
{
// Some values should remain numbers (#7300)
if ( ( featureMatch[2] == 'yes' || featureMatch[2] == '1' ) && !( featureMatch[1] in { height:1, width:1, top:1, left:1 } ) )
retval.target[ featureMatch[1] ] = true;
else if ( isFinite( featureMatch[2] ) )
retval.target[ featureMatch[1] ] = featureMatch[2];
}
}
}
else
{
var targetMatch = target.match( selectableTargets );
if ( targetMatch )
retval.target.type = retval.target.name = target;
else
{
retval.target.type = 'frame';
retval.target.name = target;
}
}
var me = this;
var advAttr = function( inputName, attrName )
{
var value = element.getAttribute( attrName );
if ( value !== null )
retval.adv[ inputName ] = value || '';
};
advAttr( 'advId', 'id' );
advAttr( 'advLangDir', 'dir' );
advAttr( 'advAccessKey', 'accessKey' );
retval.adv.advName =
element.data( 'cke-saved-name' )
|| element.getAttribute( 'name' )
|| '';
advAttr( 'advLangCode', 'lang' );
advAttr( 'advTabIndex', 'tabindex' );
advAttr( 'advTitle', 'title' );
advAttr( 'advContentType', 'type' );
CKEDITOR.plugins.link.synAnchorSelector ?
retval.adv.advCSSClasses = getLinkClass( element )
: advAttr( 'advCSSClasses', 'class' );
advAttr( 'advCharset', 'charset' );
advAttr( 'advStyles', 'style' );
advAttr( 'advRel', 'rel' );
}
// Find out whether we have any anchors in the editor.
var anchors = retval.anchors = [],
i, count, item;
// For some browsers we set contenteditable="false" on anchors, making document.anchors not to include them, so we must traverse the links manually (#7893).
if ( CKEDITOR.plugins.link.emptyAnchorFix )
{
var links = editor.document.getElementsByTag( 'a' );
for ( i = 0, count = links.count(); i < count; i++ )
{
item = links.getItem( i );
if ( item.data( 'cke-saved-name' ) || item.hasAttribute( 'name' ) )
anchors.push( { name : item.data( 'cke-saved-name' ) || item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) } );
}
}
else
{
var anchorList = new CKEDITOR.dom.nodeList( editor.document.$.anchors );
for ( i = 0, count = anchorList.count(); i < count; i++ )
{
item = anchorList.getItem( i );
anchors[ i ] = { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) };
}
}
if ( CKEDITOR.plugins.link.fakeAnchor )
{
var imgs = editor.document.getElementsByTag( 'img' );
for ( i = 0, count = imgs.count(); i < count; i++ )
{
if ( ( item = CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, imgs.getItem( i ) ) ) )
anchors.push( { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) } );
}
}
// Record down the selected element in the dialog.
this._.selectedElement = element;
return retval;
};
var setupParams = function( page, data )
{
if ( data[page] )
this.setValue( data[page][this.id] || '' );
};
var setupPopupParams = function( data )
{
return setupParams.call( this, 'target', data );
};
var setupAdvParams = function( data )
{
return setupParams.call( this, 'adv', data );
};
var commitParams = function( page, data )
{
if ( !data[page] )
data[page] = {};
data[page][this.id] = this.getValue() || '';
};
var commitPopupParams = function( data )
{
return commitParams.call( this, 'target', data );
};
var commitAdvParams = function( data )
{
return commitParams.call( this, 'adv', data );
};
function unescapeSingleQuote( str )
{
return str.replace( /\\'/g, '\'' );
}
function escapeSingleQuote( str )
{
return str.replace( /'/g, '\\$&' );
}
var emailProtection = editor.config.emailProtection || '';
// Compile the protection function pattern.
if ( emailProtection && emailProtection != 'encode' )
{
var compiledProtectionFunction = {};
emailProtection.replace( /^([^(]+)\(([^)]+)\)$/, function( match, funcName, params )
{
compiledProtectionFunction.name = funcName;
compiledProtectionFunction.params = [];
params.replace( /[^,\s]+/g, function( param )
{
compiledProtectionFunction.params.push( param );
} );
} );
}
function protectEmailLinkAsFunction( email )
{
var retval,
name = compiledProtectionFunction.name,
params = compiledProtectionFunction.params,
paramName,
paramValue;
retval = [ name, '(' ];
for ( var i = 0; i < params.length; i++ )
{
paramName = params[ i ].toLowerCase();
paramValue = email[ paramName ];
i > 0 && retval.push( ',' );
retval.push( '\'',
paramValue ?
escapeSingleQuote( encodeURIComponent( email[ paramName ] ) )
: '',
'\'');
}
retval.push( ')' );
return retval.join( '' );
}
function protectEmailAddressAsEncodedString( address )
{
var charCode,
length = address.length,
encodedChars = [];
for ( var i = 0; i < length; i++ )
{
charCode = address.charCodeAt( i );
encodedChars.push( charCode );
}
return 'String.fromCharCode(' + encodedChars.join( ',' ) + ')';
}
function getLinkClass( ele )
{
var className = ele.getAttribute( 'class' );
return className ? className.replace( /\s*(?:cke_anchor_empty|cke_anchor)(?:\s*$)?/g, '' ) : '';
}
var commonLang = editor.lang.common,
linkLang = editor.lang.link;
return {
title : linkLang.title,
minWidth : 350,
minHeight : 230,
contents : [
{
id : 'info',
label : linkLang.info,
title : linkLang.info,
elements :
[
{
id : 'linkType',
type : 'select',
label : linkLang.type,
'default' : 'url',
items :
[
[ linkLang.toUrl, 'url' ],
[ linkLang.toAnchor, 'anchor' ],
[ linkLang.toEmail, 'email' ]
],
onChange : linkTypeChanged,
setup : function( data )
{
if ( data.type )
this.setValue( data.type );
},
commit : function( data )
{
data.type = this.getValue();
}
},
{
type : 'vbox',
id : 'urlOptions',
children :
[
{
type : 'hbox',
widths : [ '25%', '75%' ],
children :
[
{
id : 'protocol',
type : 'select',
label : commonLang.protocol,
'default' : 'http://',
items :
[
// Force 'ltr' for protocol names in BIDI. (#5433)
[ 'http://\u200E', 'http://' ],
[ 'https://\u200E', 'https://' ],
[ 'ftp://\u200E', 'ftp://' ],
[ 'news://\u200E', 'news://' ],
[ linkLang.other , '' ]
],
setup : function( data )
{
if ( data.url )
this.setValue( data.url.protocol || '' );
},
commit : function( data )
{
if ( !data.url )
data.url = {};
data.url.protocol = this.getValue();
}
},
{
type : 'text',
id : 'url',
label : commonLang.url,
required: true,
onLoad : function ()
{
this.allowOnChange = true;
},
onKeyUp : function()
{
this.allowOnChange = false;
var protocolCmb = this.getDialog().getContentElement( 'info', 'protocol' ),
url = this.getValue(),
urlOnChangeProtocol = /^(http|https|ftp|news):\/\/(?=.)/i,
urlOnChangeTestOther = /^((javascript:)|[#\/\.\?])/i;
var protocol = urlOnChangeProtocol.exec( url );
if ( protocol )
{
this.setValue( url.substr( protocol[ 0 ].length ) );
protocolCmb.setValue( protocol[ 0 ].toLowerCase() );
}
else if ( urlOnChangeTestOther.test( url ) )
protocolCmb.setValue( '' );
this.allowOnChange = true;
},
onChange : function()
{
if ( this.allowOnChange ) // Dont't call on dialog load.
this.onKeyUp();
},
validate : function()
{
var dialog = this.getDialog();
if ( dialog.getContentElement( 'info', 'linkType' ) &&
dialog.getValueOf( 'info', 'linkType' ) != 'url' )
return true;
if ( this.getDialog().fakeObj ) // Edit Anchor.
return true;
var func = CKEDITOR.dialog.validate.notEmpty( linkLang.noUrl );
return func.apply( this );
},
setup : function( data )
{
this.allowOnChange = false;
if ( data.url )
this.setValue( data.url.url );
this.allowOnChange = true;
},
commit : function( data )
{
// IE will not trigger the onChange event if the mouse has been used
// to carry all the operations #4724
this.onChange();
if ( !data.url )
data.url = {};
data.url.url = this.getValue();
this.allowOnChange = false;
}
}
],
setup : function( data )
{
if ( !this.getDialog().getContentElement( 'info', 'linkType' ) )
this.getElement().show();
}
},
{
type : 'button',
id : 'browse',
hidden : 'true',
filebrowser : 'info:url',
label : commonLang.browseServer
}
]
},
{
type : 'vbox',
id : 'anchorOptions',
width : 260,
align : 'center',
padding : 0,
children :
[
{
type : 'fieldset',
id : 'selectAnchorText',
label : linkLang.selectAnchor,
setup : function( data )
{
if ( data.anchors.length > 0 )
this.getElement().show();
else
this.getElement().hide();
},
children :
[
{
type : 'hbox',
id : 'selectAnchor',
children :
[
{
type : 'select',
id : 'anchorName',
'default' : '',
label : linkLang.anchorName,
style : 'width: 100%;',
items :
[
[ '' ]
],
setup : function( data )
{
this.clear();
this.add( '' );
for ( var i = 0 ; i < data.anchors.length ; i++ )
{
if ( data.anchors[i].name )
this.add( data.anchors[i].name );
}
if ( data.anchor )
this.setValue( data.anchor.name );
var linkType = this.getDialog().getContentElement( 'info', 'linkType' );
if ( linkType && linkType.getValue() == 'email' )
this.focus();
},
commit : function( data )
{
if ( !data.anchor )
data.anchor = {};
data.anchor.name = this.getValue();
}
},
{
type : 'select',
id : 'anchorId',
'default' : '',
label : linkLang.anchorId,
style : 'width: 100%;',
items :
[
[ '' ]
],
setup : function( data )
{
this.clear();
this.add( '' );
for ( var i = 0 ; i < data.anchors.length ; i++ )
{
if ( data.anchors[i].id )
this.add( data.anchors[i].id );
}
if ( data.anchor )
this.setValue( data.anchor.id );
},
commit : function( data )
{
if ( !data.anchor )
data.anchor = {};
data.anchor.id = this.getValue();
}
}
],
setup : function( data )
{
if ( data.anchors.length > 0 )
this.getElement().show();
else
this.getElement().hide();
}
}
]
},
{
type : 'html',
id : 'noAnchors',
style : 'text-align: center;',
html : '<div role="note" tabIndex="-1">' + CKEDITOR.tools.htmlEncode( linkLang.noAnchors ) + '</div>',
// Focus the first element defined in above html.
focus : true,
setup : function( data )
{
if ( data.anchors.length < 1 )
this.getElement().show();
else
this.getElement().hide();
}
}
],
setup : function( data )
{
if ( !this.getDialog().getContentElement( 'info', 'linkType' ) )
this.getElement().hide();
}
},
{
type : 'vbox',
id : 'emailOptions',
padding : 1,
children :
[
{
type : 'text',
id : 'emailAddress',
label : linkLang.emailAddress,
required : true,
validate : function()
{
var dialog = this.getDialog();
if ( !dialog.getContentElement( 'info', 'linkType' ) ||
dialog.getValueOf( 'info', 'linkType' ) != 'email' )
return true;
var func = CKEDITOR.dialog.validate.notEmpty( linkLang.noEmail );
return func.apply( this );
},
setup : function( data )
{
if ( data.email )
this.setValue( data.email.address );
var linkType = this.getDialog().getContentElement( 'info', 'linkType' );
if ( linkType && linkType.getValue() == 'email' )
this.select();
},
commit : function( data )
{
if ( !data.email )
data.email = {};
data.email.address = this.getValue();
}
},
{
type : 'text',
id : 'emailSubject',
label : linkLang.emailSubject,
setup : function( data )
{
if ( data.email )
this.setValue( data.email.subject );
},
commit : function( data )
{
if ( !data.email )
data.email = {};
data.email.subject = this.getValue();
}
},
{
type : 'textarea',
id : 'emailBody',
label : linkLang.emailBody,
rows : 3,
'default' : '',
setup : function( data )
{
if ( data.email )
this.setValue( data.email.body );
},
commit : function( data )
{
if ( !data.email )
data.email = {};
data.email.body = this.getValue();
}
}
],
setup : function( data )
{
if ( !this.getDialog().getContentElement( 'info', 'linkType' ) )
this.getElement().hide();
}
}
]
},
{
id : 'target',
label : linkLang.target,
title : linkLang.target,
elements :
[
{
type : 'hbox',
widths : [ '50%', '50%' ],
children :
[
{
type : 'select',
id : 'linkTargetType',
label : commonLang.target,
'default' : 'notSet',
style : 'width : 100%;',
'items' :
[
[ commonLang.notSet, 'notSet' ],
[ linkLang.targetFrame, 'frame' ],
[ linkLang.targetPopup, 'popup' ],
[ commonLang.targetNew, '_blank' ],
[ commonLang.targetTop, '_top' ],
[ commonLang.targetSelf, '_self' ],
[ commonLang.targetParent, '_parent' ]
],
onChange : targetChanged,
setup : function( data )
{
if ( data.target )
this.setValue( data.target.type || 'notSet' );
targetChanged.call( this );
},
commit : function( data )
{
if ( !data.target )
data.target = {};
data.target.type = this.getValue();
}
},
{
type : 'text',
id : 'linkTargetName',
label : linkLang.targetFrameName,
'default' : '',
setup : function( data )
{
if ( data.target )
this.setValue( data.target.name );
},
commit : function( data )
{
if ( !data.target )
data.target = {};
data.target.name = this.getValue().replace(/\W/gi, '');
}
}
]
},
{
type : 'vbox',
width : '100%',
align : 'center',
padding : 2,
id : 'popupFeatures',
children :
[
{
type : 'fieldset',
label : linkLang.popupFeatures,
children :
[
{
type : 'hbox',
children :
[
{
type : 'checkbox',
id : 'resizable',
label : linkLang.popupResizable,
setup : setupPopupParams,
commit : commitPopupParams
},
{
type : 'checkbox',
id : 'status',
label : linkLang.popupStatusBar,
setup : setupPopupParams,
commit : commitPopupParams
}
]
},
{
type : 'hbox',
children :
[
{
type : 'checkbox',
id : 'location',
label : linkLang.popupLocationBar,
setup : setupPopupParams,
commit : commitPopupParams
},
{
type : 'checkbox',
id : 'toolbar',
label : linkLang.popupToolbar,
setup : setupPopupParams,
commit : commitPopupParams
}
]
},
{
type : 'hbox',
children :
[
{
type : 'checkbox',
id : 'menubar',
label : linkLang.popupMenuBar,
setup : setupPopupParams,
commit : commitPopupParams
},
{
type : 'checkbox',
id : 'fullscreen',
label : linkLang.popupFullScreen,
setup : setupPopupParams,
commit : commitPopupParams
}
]
},
{
type : 'hbox',
children :
[
{
type : 'checkbox',
id : 'scrollbars',
label : linkLang.popupScrollBars,
setup : setupPopupParams,
commit : commitPopupParams
},
{
type : 'checkbox',
id : 'dependent',
label : linkLang.popupDependent,
setup : setupPopupParams,
commit : commitPopupParams
}
]
},
{
type : 'hbox',
children :
[
{
type : 'text',
widths : [ '50%', '50%' ],
labelLayout : 'horizontal',
label : commonLang.width,
id : 'width',
setup : setupPopupParams,
commit : commitPopupParams
},
{
type : 'text',
labelLayout : 'horizontal',
widths : [ '50%', '50%' ],
label : linkLang.popupLeft,
id : 'left',
setup : setupPopupParams,
commit : commitPopupParams
}
]
},
{
type : 'hbox',
children :
[
{
type : 'text',
labelLayout : 'horizontal',
widths : [ '50%', '50%' ],
label : commonLang.height,
id : 'height',
setup : setupPopupParams,
commit : commitPopupParams
},
{
type : 'text',
labelLayout : 'horizontal',
label : linkLang.popupTop,
widths : [ '50%', '50%' ],
id : 'top',
setup : setupPopupParams,
commit : commitPopupParams
}
]
}
]
}
]
}
]
},
{
id : 'upload',
label : linkLang.upload,
title : linkLang.upload,
hidden : true,
filebrowser : 'uploadButton',
elements :
[
{
type : 'file',
id : 'upload',
label : commonLang.upload,
style: 'height:40px',
size : 29
},
{
type : 'fileButton',
id : 'uploadButton',
label : commonLang.uploadSubmit,
filebrowser : 'info:url',
'for' : [ 'upload', 'upload' ]
}
]
},
{
id : 'advanced',
label : linkLang.advanced,
title : linkLang.advanced,
elements :
[
{
type : 'vbox',
padding : 1,
children :
[
{
type : 'hbox',
widths : [ '45%', '35%', '20%' ],
children :
[
{
type : 'text',
id : 'advId',
label : linkLang.id,
setup : setupAdvParams,
commit : commitAdvParams
},
{
type : 'select',
id : 'advLangDir',
label : linkLang.langDir,
'default' : '',
style : 'width:110px',
items :
[
[ commonLang.notSet, '' ],
[ linkLang.langDirLTR, 'ltr' ],
[ linkLang.langDirRTL, 'rtl' ]
],
setup : setupAdvParams,
commit : commitAdvParams
},
{
type : 'text',
id : 'advAccessKey',
width : '80px',
label : linkLang.acccessKey,
maxLength : 1,
setup : setupAdvParams,
commit : commitAdvParams
}
]
},
{
type : 'hbox',
widths : [ '45%', '35%', '20%' ],
children :
[
{
type : 'text',
label : linkLang.name,
id : 'advName',
setup : setupAdvParams,
commit : commitAdvParams
},
{
type : 'text',
label : linkLang.langCode,
id : 'advLangCode',
width : '110px',
'default' : '',
setup : setupAdvParams,
commit : commitAdvParams
},
{
type : 'text',
label : linkLang.tabIndex,
id : 'advTabIndex',
width : '80px',
maxLength : 5,
setup : setupAdvParams,
commit : commitAdvParams
}
]
}
]
},
{
type : 'vbox',
padding : 1,
children :
[
{
type : 'hbox',
widths : [ '45%', '55%' ],
children :
[
{
type : 'text',
label : linkLang.advisoryTitle,
'default' : '',
id : 'advTitle',
setup : setupAdvParams,
commit : commitAdvParams
},
{
type : 'text',
label : linkLang.advisoryContentType,
'default' : '',
id : 'advContentType',
setup : setupAdvParams,
commit : commitAdvParams
}
]
},
{
type : 'hbox',
widths : [ '45%', '55%' ],
children :
[
{
type : 'text',
label : linkLang.cssClasses,
'default' : '',
id : 'advCSSClasses',
setup : setupAdvParams,
commit : commitAdvParams
},
{
type : 'text',
label : linkLang.charset,
'default' : '',
id : 'advCharset',
setup : setupAdvParams,
commit : commitAdvParams
}
]
},
{
type : 'hbox',
widths : [ '45%', '55%' ],
children :
[
{
type : 'text',
label : linkLang.rel,
'default' : '',
id : 'advRel',
setup : setupAdvParams,
commit : commitAdvParams
},
{
type : 'text',
label : linkLang.styles,
'default' : '',
id : 'advStyles',
validate : CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ),
setup : setupAdvParams,
commit : commitAdvParams
}
]
}
]
}
]
}
],
onShow : function()
{
var editor = this.getParentEditor(),
selection = editor.getSelection(),
element = null;
// Fill in all the relevant fields if there's already one link selected.
if ( ( element = plugin.getSelectedLink( editor ) ) && element.hasAttribute( 'href' ) )
selection.selectElement( element );
else
element = null;
this.setupContent( parseLink.apply( this, [ editor, element ] ) );
},
onOk : function()
{
var attributes = {},
removeAttributes = [],
data = {},
me = this,
editor = this.getParentEditor();
this.commitContent( data );
// Compose the URL.
switch ( data.type || 'url' )
{
case 'url':
var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://',
url = ( data.url && CKEDITOR.tools.trim( data.url.url ) ) || '';
attributes[ 'data-cke-saved-href' ] = ( url.indexOf( '/' ) === 0 ) ? url : protocol + url;
break;
case 'anchor':
var name = ( data.anchor && data.anchor.name ),
id = ( data.anchor && data.anchor.id );
attributes[ 'data-cke-saved-href' ] = '#' + ( name || id || '' );
break;
case 'email':
var linkHref,
email = data.email,
address = email.address;
switch( emailProtection )
{
case '' :
case 'encode' :
{
var subject = encodeURIComponent( email.subject || '' ),
body = encodeURIComponent( email.body || '' );
// Build the e-mail parameters first.
var argList = [];
subject && argList.push( 'subject=' + subject );
body && argList.push( 'body=' + body );
argList = argList.length ? '?' + argList.join( '&' ) : '';
if ( emailProtection == 'encode' )
{
linkHref = [ 'javascript:void(location.href=\'mailto:\'+',
protectEmailAddressAsEncodedString( address ) ];
// parameters are optional.
argList && linkHref.push( '+\'', escapeSingleQuote( argList ), '\'' );
linkHref.push( ')' );
}
else
linkHref = [ 'mailto:', address, argList ];
break;
}
default :
{
// Separating name and domain.
var nameAndDomain = address.split( '@', 2 );
email.name = nameAndDomain[ 0 ];
email.domain = nameAndDomain[ 1 ];
linkHref = [ 'javascript:', protectEmailLinkAsFunction( email ) ];
}
}
attributes[ 'data-cke-saved-href' ] = linkHref.join( '' );
break;
}
// Popups and target.
if ( data.target )
{
if ( data.target.type == 'popup' )
{
var onclickList = [ 'window.open(this.href, \'',
data.target.name || '', '\', \'' ];
var featureList = [ 'resizable', 'status', 'location', 'toolbar', 'menubar', 'fullscreen',
'scrollbars', 'dependent' ];
var featureLength = featureList.length;
var addFeature = function( featureName )
{
if ( data.target[ featureName ] )
featureList.push( featureName + '=' + data.target[ featureName ] );
};
for ( var i = 0 ; i < featureLength ; i++ )
featureList[i] = featureList[i] + ( data.target[ featureList[i] ] ? '=yes' : '=no' ) ;
addFeature( 'width' );
addFeature( 'left' );
addFeature( 'height' );
addFeature( 'top' );
onclickList.push( featureList.join( ',' ), '\'); return false;' );
attributes[ 'data-cke-pa-onclick' ] = onclickList.join( '' );
// Add the "target" attribute. (#5074)
removeAttributes.push( 'target' );
}
else
{
if ( data.target.type != 'notSet' && data.target.name )
attributes.target = data.target.name;
else
removeAttributes.push( 'target' );
removeAttributes.push( 'data-cke-pa-onclick', 'onclick' );
}
}
// Advanced attributes.
if ( data.adv )
{
var advAttr = function( inputName, attrName )
{
var value = data.adv[ inputName ];
if ( value )
attributes[attrName] = value;
else
removeAttributes.push( attrName );
};
advAttr( 'advId', 'id' );
advAttr( 'advLangDir', 'dir' );
advAttr( 'advAccessKey', 'accessKey' );
if ( data.adv[ 'advName' ] )
attributes[ 'name' ] = attributes[ 'data-cke-saved-name' ] = data.adv[ 'advName' ];
else
removeAttributes = removeAttributes.concat( [ 'data-cke-saved-name', 'name' ] );
advAttr( 'advLangCode', 'lang' );
advAttr( 'advTabIndex', 'tabindex' );
advAttr( 'advTitle', 'title' );
advAttr( 'advContentType', 'type' );
advAttr( 'advCSSClasses', 'class' );
advAttr( 'advCharset', 'charset' );
advAttr( 'advStyles', 'style' );
advAttr( 'advRel', 'rel' );
}
var selection = editor.getSelection();
// Browser need the "href" fro copy/paste link to work. (#6641)
attributes.href = attributes[ 'data-cke-saved-href' ];
if ( !this._.selectedElement )
{
// Create element if current selection is collapsed.
var ranges = selection.getRanges( true );
if ( ranges.length == 1 && ranges[0].collapsed )
{
// Short mailto link text view (#5736).
var text = new CKEDITOR.dom.text( data.type == 'email' ?
data.email.address : attributes[ 'data-cke-saved-href' ], editor.document );
ranges[0].insertNode( text );
ranges[0].selectNodeContents( text );
selection.selectRanges( ranges );
}
// Apply style.
var style = new CKEDITOR.style( { element : 'a', attributes : attributes } );
style.type = CKEDITOR.STYLE_INLINE; // need to override... dunno why.
style.apply( editor.document );
}
else
{
// We're only editing an existing link, so just overwrite the attributes.
var element = this._.selectedElement,
href = element.data( 'cke-saved-href' ),
textView = element.getHtml();
element.setAttributes( attributes );
element.removeAttributes( removeAttributes );
if ( data.adv && data.adv.advName && CKEDITOR.plugins.link.synAnchorSelector )
element.addClass( element.getChildCount() ? 'cke_anchor' : 'cke_anchor_empty' );
// Update text view when user changes protocol (#4612).
if ( href == textView || data.type == 'email' && textView.indexOf( '@' ) != -1 )
{
// Short mailto link text view (#5736).
element.setHtml( data.type == 'email' ?
data.email.address : attributes[ 'data-cke-saved-href' ] );
}
selection.selectElement( element );
delete this._.selectedElement;
}
},
onLoad : function()
{
if ( !editor.config.linkShowAdvancedTab )
this.hidePage( 'advanced' ); //Hide Advanded tab.
if ( !editor.config.linkShowTargetTab )
this.hidePage( 'target' ); //Hide Target tab.
},
// Inital focus on 'url' field if link is of type URL.
onFocus : function()
{
var linkType = this.getContentElement( 'info', 'linkType' ),
urlField;
if ( linkType && linkType.getValue() == 'url' )
{
urlField = this.getContentElement( 'info', 'url' );
urlField.select();
}
}
};
});
/**
* The e-mail address anti-spam protection option. The protection will be
* applied when creating or modifying e-mail links through the editor interface.<br>
* Two methods of protection can be choosed:
* <ol> <li>The e-mail parts (name, domain and any other query string) are
* assembled into a function call pattern. Such function must be
* provided by the developer in the pages that will use the contents.
* <li>Only the e-mail address is obfuscated into a special string that
* has no meaning for humans or spam bots, but which is properly
* rendered and accepted by the browser.</li></ol>
* Both approaches require JavaScript to be enabled.
* @name CKEDITOR.config.emailProtection
* @since 3.1
* @type String
* @default '' (empty string = disabled)
* @example
* // href="mailto:tester@ckeditor.com?subject=subject&body=body"
* config.emailProtection = '';
* @example
* // href="<a href=\"javascript:void(location.href=\'mailto:\'+String.fromCharCode(116,101,115,116,101,114,64,99,107,101,100,105,116,111,114,46,99,111,109)+\'?subject=subject&body=body\')\">e-mail</a>"
* config.emailProtection = 'encode';
* @example
* // href="javascript:mt('tester','ckeditor.com','subject','body')"
* config.emailProtection = 'mt(NAME,DOMAIN,SUBJECT,BODY)';
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @file Increse and decrease indent commands.
*/
(function()
{
var listNodeNames = { ol : 1, ul : 1 },
isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true );
function onSelectionChange( evt )
{
if ( evt.editor.readOnly )
return null;
var editor = evt.editor,
elementPath = evt.data.path,
list = elementPath && elementPath.contains( listNodeNames ),
firstBlock = elementPath.block || elementPath.blockLimit;
if ( list )
return this.setState( CKEDITOR.TRISTATE_OFF );
if ( !this.useIndentClasses && this.name == 'indent' )
return this.setState( CKEDITOR.TRISTATE_OFF );
if ( !firstBlock )
return this.setState( CKEDITOR.TRISTATE_DISABLED );
if ( this.useIndentClasses )
{
var indentClass = firstBlock.$.className.match( this.classNameRegex ),
indentStep = 0;
if ( indentClass )
{
indentClass = indentClass[1];
indentStep = this.indentClassMap[ indentClass ];
}
if ( ( this.name == 'outdent' && !indentStep ) ||
( this.name == 'indent' && indentStep == editor.config.indentClasses.length ) )
return this.setState( CKEDITOR.TRISTATE_DISABLED );
return this.setState( CKEDITOR.TRISTATE_OFF );
}
else
{
var indent = parseInt( firstBlock.getStyle( getIndentCssProperty( firstBlock ) ), 10 );
if ( isNaN( indent ) )
indent = 0;
if ( indent <= 0 )
return this.setState( CKEDITOR.TRISTATE_DISABLED );
return this.setState( CKEDITOR.TRISTATE_OFF );
}
}
function indentCommand( editor, name )
{
this.name = name;
this.useIndentClasses = editor.config.indentClasses && editor.config.indentClasses.length > 0;
if ( this.useIndentClasses )
{
this.classNameRegex = new RegExp( '(?:^|\\s+)(' + editor.config.indentClasses.join( '|' ) + ')(?=$|\\s)' );
this.indentClassMap = {};
for ( var i = 0 ; i < editor.config.indentClasses.length ; i++ )
this.indentClassMap[ editor.config.indentClasses[i] ] = i + 1;
}
this.startDisabled = name == 'outdent';
}
// Returns the CSS property to be used for identing a given element.
function getIndentCssProperty( element, dir )
{
return ( dir || element.getComputedStyle( 'direction' ) ) == 'ltr' ? 'margin-left' : 'margin-right';
}
function isListItem( node )
{
return node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' );
}
indentCommand.prototype = {
exec : function( editor )
{
var self = this, database = {};
function indentList( listNode )
{
// Our starting and ending points of the range might be inside some blocks under a list item...
// So before playing with the iterator, we need to expand the block to include the list items.
var startContainer = range.startContainer,
endContainer = range.endContainer;
while ( startContainer && !startContainer.getParent().equals( listNode ) )
startContainer = startContainer.getParent();
while ( endContainer && !endContainer.getParent().equals( listNode ) )
endContainer = endContainer.getParent();
if ( !startContainer || !endContainer )
return;
// Now we can iterate over the individual items on the same tree depth.
var block = startContainer,
itemsToMove = [],
stopFlag = false;
while ( !stopFlag )
{
if ( block.equals( endContainer ) )
stopFlag = true;
itemsToMove.push( block );
block = block.getNext();
}
if ( itemsToMove.length < 1 )
return;
// Do indent or outdent operations on the array model of the list, not the
// list's DOM tree itself. The array model demands that it knows as much as
// possible about the surrounding lists, we need to feed it the further
// ancestor node that is still a list.
var listParents = listNode.getParents( true );
for ( var i = 0 ; i < listParents.length ; i++ )
{
if ( listParents[i].getName && listNodeNames[ listParents[i].getName() ] )
{
listNode = listParents[i];
break;
}
}
var indentOffset = self.name == 'indent' ? 1 : -1,
startItem = itemsToMove[0],
lastItem = itemsToMove[ itemsToMove.length - 1 ];
// Convert the list DOM tree into a one dimensional array.
var listArray = CKEDITOR.plugins.list.listToArray( listNode, database );
// Apply indenting or outdenting on the array.
var baseIndent = listArray[ lastItem.getCustomData( 'listarray_index' ) ].indent;
for ( i = startItem.getCustomData( 'listarray_index' ); i <= lastItem.getCustomData( 'listarray_index' ); i++ )
{
listArray[ i ].indent += indentOffset;
// Make sure the newly created sublist get a brand-new element of the same type. (#5372)
var listRoot = listArray[ i ].parent;
listArray[ i ].parent = new CKEDITOR.dom.element( listRoot.getName(), listRoot.getDocument() );
}
for ( i = lastItem.getCustomData( 'listarray_index' ) + 1 ;
i < listArray.length && listArray[i].indent > baseIndent ; i++ )
listArray[i].indent += indentOffset;
// Convert the array back to a DOM forest (yes we might have a few subtrees now).
// And replace the old list with the new forest.
var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode, listNode.getDirection() );
// Avoid nested <li> after outdent even they're visually same,
// recording them for later refactoring.(#3982)
if ( self.name == 'outdent' )
{
var parentLiElement;
if ( ( parentLiElement = listNode.getParent() ) && parentLiElement.is( 'li' ) )
{
var children = newList.listNode.getChildren(),
pendingLis = [],
count = children.count(),
child;
for ( i = count - 1 ; i >= 0 ; i-- )
{
if ( ( child = children.getItem( i ) ) && child.is && child.is( 'li' ) )
pendingLis.push( child );
}
}
}
if ( newList )
newList.listNode.replace( listNode );
// Move the nested <li> to be appeared after the parent.
if ( pendingLis && pendingLis.length )
{
for ( i = 0; i < pendingLis.length ; i++ )
{
var li = pendingLis[ i ],
followingList = li;
// Nest preceding <ul>/<ol> inside current <li> if any.
while ( ( followingList = followingList.getNext() ) &&
followingList.is &&
followingList.getName() in listNodeNames )
{
// IE requires a filler NBSP for nested list inside empty list item,
// otherwise the list item will be inaccessiable. (#4476)
if ( CKEDITOR.env.ie && !li.getFirst( function( node ){ return isNotWhitespaces( node ) && isNotBookmark( node ); } ) )
li.append( range.document.createText( '\u00a0' ) );
li.append( followingList );
}
li.insertAfter( parentLiElement );
}
}
}
function indentBlock()
{
var iterator = range.createIterator(),
enterMode = editor.config.enterMode;
iterator.enforceRealBlocks = true;
iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR;
var block;
while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) )
indentElement( block );
}
function indentElement( element, dir )
{
if ( element.getCustomData( 'indent_processed' ) )
return false;
if ( self.useIndentClasses )
{
// Transform current class name to indent step index.
var indentClass = element.$.className.match( self.classNameRegex ),
indentStep = 0;
if ( indentClass )
{
indentClass = indentClass[1];
indentStep = self.indentClassMap[ indentClass ];
}
// Operate on indent step index, transform indent step index back to class
// name.
if ( self.name == 'outdent' )
indentStep--;
else
indentStep++;
if ( indentStep < 0 )
return false;
indentStep = Math.min( indentStep, editor.config.indentClasses.length );
indentStep = Math.max( indentStep, 0 );
element.$.className = CKEDITOR.tools.ltrim( element.$.className.replace( self.classNameRegex, '' ) );
if ( indentStep > 0 )
element.addClass( editor.config.indentClasses[ indentStep - 1 ] );
}
else
{
var indentCssProperty = getIndentCssProperty( element, dir ),
currentOffset = parseInt( element.getStyle( indentCssProperty ), 10 );
if ( isNaN( currentOffset ) )
currentOffset = 0;
var indentOffset = editor.config.indentOffset || 40;
currentOffset += ( self.name == 'indent' ? 1 : -1 ) * indentOffset;
if ( currentOffset < 0 )
return false;
currentOffset = Math.max( currentOffset, 0 );
currentOffset = Math.ceil( currentOffset / indentOffset ) * indentOffset;
element.setStyle( indentCssProperty, currentOffset ? currentOffset + ( editor.config.indentUnit || 'px' ) : '' );
if ( element.getAttribute( 'style' ) === '' )
element.removeAttribute( 'style' );
}
CKEDITOR.dom.element.setMarker( database, element, 'indent_processed', 1 );
return true;
}
var selection = editor.getSelection(),
bookmarks = selection.createBookmarks( 1 ),
ranges = selection && selection.getRanges( 1 ),
range;
var iterator = ranges.createIterator();
while ( ( range = iterator.getNextRange() ) )
{
var rangeRoot = range.getCommonAncestor(),
nearestListBlock = rangeRoot;
while ( nearestListBlock && !( nearestListBlock.type == CKEDITOR.NODE_ELEMENT &&
listNodeNames[ nearestListBlock.getName() ] ) )
nearestListBlock = nearestListBlock.getParent();
// Avoid having selection enclose the entire list. (#6138)
// [<ul><li>...</li></ul>] =><ul><li>[...]</li></ul>
if ( !nearestListBlock )
{
var selectedNode = range.getEnclosedNode();
if ( selectedNode
&& selectedNode.type == CKEDITOR.NODE_ELEMENT
&& selectedNode.getName() in listNodeNames)
{
range.setStartAt( selectedNode, CKEDITOR.POSITION_AFTER_START );
range.setEndAt( selectedNode, CKEDITOR.POSITION_BEFORE_END );
nearestListBlock = selectedNode;
}
}
// Avoid selection anchors under list root.
// <ul>[<li>...</li>]</ul> => <ul><li>[...]</li></ul>
if ( nearestListBlock && range.startContainer.type == CKEDITOR.NODE_ELEMENT
&& range.startContainer.getName() in listNodeNames )
{
var walker = new CKEDITOR.dom.walker( range );
walker.evaluator = isListItem;
range.startContainer = walker.next();
}
if ( nearestListBlock && range.endContainer.type == CKEDITOR.NODE_ELEMENT
&& range.endContainer.getName() in listNodeNames )
{
walker = new CKEDITOR.dom.walker( range );
walker.evaluator = isListItem;
range.endContainer = walker.previous();
}
if ( nearestListBlock )
{
var firstListItem = nearestListBlock.getFirst( isListItem ),
hasMultipleItems = !!firstListItem.getNext( isListItem ),
rangeStart = range.startContainer,
indentWholeList = firstListItem.equals( rangeStart ) || firstListItem.contains( rangeStart );
// Indent the entire list if cursor is inside the first list item. (#3893)
// Only do that for indenting or when using indent classes or when there is something to outdent. (#6141)
if ( !( indentWholeList &&
( self.name == 'indent' || self.useIndentClasses || parseInt( nearestListBlock.getStyle( getIndentCssProperty( nearestListBlock ) ), 10 ) ) &&
indentElement( nearestListBlock, !hasMultipleItems && firstListItem.getDirection() ) ) )
indentList( nearestListBlock );
}
else
indentBlock();
}
// Clean up the markers.
CKEDITOR.dom.element.clearAllMarkers( database );
editor.forceNextSelectionCheck();
selection.selectBookmarks( bookmarks );
}
};
CKEDITOR.plugins.add( 'indent',
{
init : function( editor )
{
// Register commands.
var indent = editor.addCommand( 'indent', new indentCommand( editor, 'indent' ) ),
outdent = editor.addCommand( 'outdent', new indentCommand( editor, 'outdent' ) );
// Register the toolbar buttons.
editor.ui.addButton( 'Indent',
{
label : editor.lang.indent,
command : 'indent'
});
editor.ui.addButton( 'Outdent',
{
label : editor.lang.outdent,
command : 'outdent'
});
// Register the state changing handlers.
editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, indent ) );
editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, outdent ) );
// [IE6/7] Raw lists are using margin instead of padding for visual indentation in wysiwyg mode. (#3893)
if ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat )
{
editor.addCss(
"ul,ol" +
"{" +
" margin-left: 0px;" +
" padding-left: 40px;" +
"}" );
}
// Register dirChanged listener.
editor.on( 'dirChanged', function( e )
{
var range = new CKEDITOR.dom.range( editor.document );
range.setStartBefore( e.data.node );
range.setEndAfter( e.data.node );
var walker = new CKEDITOR.dom.walker( range ),
node;
while ( ( node = walker.next() ) )
{
if ( node.type == CKEDITOR.NODE_ELEMENT )
{
// A child with the defined dir is to be ignored.
if ( !node.equals( e.data.node ) && node.getDirection() )
{
range.setStartAfter( node );
walker = new CKEDITOR.dom.walker( range );
continue;
}
// Switch alignment classes.
var classes = editor.config.indentClasses;
if ( classes )
{
var suffix = ( e.data.dir == 'ltr' ) ? [ '_rtl', '' ] : [ '', '_rtl' ];
for ( var i = 0; i < classes.length; i++ )
{
if ( node.hasClass( classes[ i ] + suffix[ 0 ] ) )
{
node.removeClass( classes[ i ] + suffix[ 0 ] );
node.addClass( classes[ i ] + suffix[ 1 ] );
}
}
}
// Switch the margins.
var marginLeft = node.getStyle( 'margin-right' ),
marginRight = node.getStyle( 'margin-left' );
marginLeft ? node.setStyle( 'margin-left', marginLeft ) : node.removeStyle( 'margin-left' );
marginRight ? node.setStyle( 'margin-right', marginRight ) : node.removeStyle( 'margin-right' );
}
}
});
editor.on( 'key', function( evt )
{
// Backspace at the beginning of list item should outdent it.
if ( editor.mode == 'wysiwyg' && evt.data.keyCode == 8 )
{
var sel = editor.getSelection(),
range = sel.getRanges()[ 0 ],
li;
if ( range.collapsed &&
( li = range.startContainer.getAscendant( 'li', 1 ) ) &&
range.checkBoundaryOfElement( li, CKEDITOR.START ) )
{
editor.execCommand( 'outdent' );
evt.cancel();
}
}
});
},
requires : [ 'domiterator', 'list' ]
} );
})();
/**
* Size of each indentation step
* @name CKEDITOR.config.indentOffset
* @type Number
* @default 40
* @example
* config.indentOffset = 4;
*/
/**
* Unit for the indentation style
* @name CKEDITOR.config.indentUnit
* @type String
* @default 'px'
* @example
* config.indentUnit = 'em';
*/
/**
* List of classes to use for indenting the contents. If it's null, no classes will be used
* and instead the {@link #indentUnit} and {@link #indentOffset} properties will be used.
* @name CKEDITOR.config.indentClasses
* @type Array
* @default null
* @example
* // Use the classes 'Indent1', 'Indent2', 'Indent3'
* config.indentClasses = ['Indent1', 'Indent2', 'Indent3'];
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @file Horizontal Rule plugin.
*/
(function()
{
var horizontalruleCmd =
{
canUndo : false, // The undo snapshot will be handled by 'insertElement'.
exec : function( editor )
{
var hr = editor.document.createElement( 'hr' ),
range = new CKEDITOR.dom.range( editor.document );
editor.insertElement( hr );
// If there's nothing or a non-editable block followed by, establish a new paragraph
// to make sure cursor is not trapped.
range.moveToPosition( hr, CKEDITOR.POSITION_AFTER_END );
var next = hr.getNext();
if ( !next || next.type == CKEDITOR.NODE_ELEMENT && !next.isEditable() )
range.fixBlock( true, editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
range.select();
}
};
var pluginName = 'horizontalrule';
// Register a plugin named "horizontalrule".
CKEDITOR.plugins.add( pluginName,
{
init : function( editor )
{
editor.addCommand( pluginName, horizontalruleCmd );
editor.ui.addButton( 'HorizontalRule',
{
label : editor.lang.horizontalrule,
command : pluginName
});
}
});
})();
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @file Print Plugin
*/
CKEDITOR.plugins.add( 'print',
{
init : function( editor )
{
var pluginName = 'print';
// Register the command.
var command = editor.addCommand( pluginName, CKEDITOR.plugins.print );
// Register the toolbar button.
editor.ui.addButton( 'Print',
{
label : editor.lang.print,
command : pluginName
});
}
} );
CKEDITOR.plugins.print =
{
exec : function( editor )
{
if ( CKEDITOR.env.opera )
return;
else if ( CKEDITOR.env.gecko )
editor.window.$.print();
else
editor.document.$.execCommand( "Print" );
},
canUndo : false,
readOnly : 1,
modes : { wysiwyg : !( CKEDITOR.env.opera ) } // It is imposible to print the inner document in Opera.
};
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview The default editing block plugin, which holds the editing area
* and source view.
*/
(function()
{
// This is a semaphore used to avoid recursive calls between
// the following data handling functions.
var isHandlingData;
CKEDITOR.plugins.add( 'editingblock',
{
init : function( editor )
{
if ( !editor.config.editingBlock )
return;
editor.on( 'themeSpace', function( event )
{
if ( event.data.space == 'contents' )
event.data.html += '<br>';
});
editor.on( 'themeLoaded', function()
{
editor.fireOnce( 'editingBlockReady' );
});
editor.on( 'uiReady', function()
{
editor.setMode( editor.config.startupMode );
});
editor.on( 'afterSetData', function()
{
if ( !isHandlingData )
{
function setData()
{
isHandlingData = true;
editor.getMode().loadData( editor.getData() );
isHandlingData = false;
}
if ( editor.mode )
setData();
else
{
editor.on( 'mode', function()
{
if ( editor.mode )
{
setData();
editor.removeListener( 'mode', arguments.callee );
}
});
}
}
});
editor.on( 'beforeGetData', function()
{
if ( !isHandlingData && editor.mode )
{
isHandlingData = true;
editor.setData( editor.getMode().getData(), null, 1 );
isHandlingData = false;
}
});
editor.on( 'getSnapshot', function( event )
{
if ( editor.mode )
event.data = editor.getMode().getSnapshotData();
});
editor.on( 'loadSnapshot', function( event )
{
if ( editor.mode )
editor.getMode().loadSnapshotData( event.data );
});
// For the first "mode" call, we'll also fire the "instanceReady"
// event.
editor.on( 'mode', function( event )
{
// Do that once only.
event.removeListener();
// Redirect the focus into editor for webkit. (#5713)
CKEDITOR.env.webkit && editor.container.on( 'focus', function()
{
editor.focus();
});
if ( editor.config.startupFocus )
editor.focus();
// Fire instanceReady for both the editor and CKEDITOR, but
// defer this until the whole execution has completed
// to guarantee the editor is fully responsible.
setTimeout( function(){
editor.fireOnce( 'instanceReady' );
CKEDITOR.fire( 'instanceReady', null, editor );
}, 0 );
});
editor.on( 'destroy', function ()
{
// -> currentMode.unload( holderElement );
if ( this.mode )
this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) );
});
}
});
/**
* The current editing mode. An editing mode is basically a viewport for
* editing or content viewing. By default the possible values for this
* property are "wysiwyg" and "source".
* @type String
* @example
* alert( CKEDITOR.instances.editor1.mode ); // "wysiwyg" (e.g.)
*/
CKEDITOR.editor.prototype.mode = '';
/**
* Registers an editing mode. This function is to be used mainly by plugins.
* @param {String} mode The mode name.
* @param {Object} modeEditor The mode editor definition.
* @example
*/
CKEDITOR.editor.prototype.addMode = function( mode, modeEditor )
{
modeEditor.name = mode;
( this._.modes || ( this._.modes = {} ) )[ mode ] = modeEditor;
};
/**
* Sets the current editing mode in this editor instance.
* @param {String} mode A registered mode name.
* @example
* // Switch to "source" view.
* CKEDITOR.instances.editor1.setMode( 'source' );
*/
CKEDITOR.editor.prototype.setMode = function( mode )
{
this.fire( 'beforeSetMode', { newMode : mode } );
var data,
holderElement = this.getThemeSpace( 'contents' ),
isDirty = this.checkDirty();
// Unload the previous mode.
if ( this.mode )
{
if ( mode == this.mode )
return;
this._.previousMode = this.mode;
this.fire( 'beforeModeUnload' );
var currentMode = this.getMode();
data = currentMode.getData();
currentMode.unload( holderElement );
this.mode = '';
}
holderElement.setHtml( '' );
// Load required mode.
var modeEditor = this.getMode( mode );
if ( !modeEditor )
throw '[CKEDITOR.editor.setMode] Unknown mode "' + mode + '".';
if ( !isDirty )
{
this.on( 'mode', function()
{
this.resetDirty();
this.removeListener( 'mode', arguments.callee );
});
}
modeEditor.load( holderElement, ( typeof data ) != 'string' ? this.getData() : data );
};
/**
* Gets the current or any of the objects that represent the editing
* area modes. The two most common editing modes are "wysiwyg" and "source".
* @param {String} [mode] The mode to be retrieved. If not specified, the
* current one is returned.
*/
CKEDITOR.editor.prototype.getMode = function( mode )
{
return this._.modes && this._.modes[ mode || this.mode ];
};
/**
* Moves the selection focus to the editing are space in the editor.
*/
CKEDITOR.editor.prototype.focus = function()
{
this.forceNextSelectionCheck();
var mode = this.getMode();
if ( mode )
mode.focus();
};
})();
/**
* The mode to load at the editor startup. It depends on the plugins
* loaded. By default, the "wysiwyg" and "source" modes are available.
* @type String
* @default 'wysiwyg'
* @example
* config.startupMode = 'source';
*/
CKEDITOR.config.startupMode = 'wysiwyg';
/**
* Sets whether the editor should have the focus when the page loads.
* @name CKEDITOR.config.startupFocus
* @type Boolean
* @default false
* @example
* config.startupFocus = true;
*/
/**
* Whether to render or not the editing block area in the editor interface.
* @type Boolean
* @default true
* @example
* config.editingBlock = false;
*/
CKEDITOR.config.editingBlock = true;
/**
* Fired when a CKEDITOR instance is created, fully initialized and ready for interaction.
* @name CKEDITOR#instanceReady
* @event
* @param {CKEDITOR.editor} editor The editor instance that has been created.
*/
/**
* Fired when the CKEDITOR instance is created, fully initialized and ready for interaction.
* @name CKEDITOR.editor#instanceReady
* @event
*/
/**
* Fired before changing the editing mode. See also CKEDITOR.editor#beforeSetMode and CKEDITOR.editor#mode
* @name CKEDITOR.editor#beforeModeUnload
* @event
*/
/**
* Fired before the editor mode is set. See also CKEDITOR.editor#mode and CKEDITOR.editor#beforeModeUnload
* @name CKEDITOR.editor#beforeSetMode
* @event
* @since 3.5.3
* @param {String} newMode The name of the mode which is about to be set.
*/
/**
* Fired after setting the editing mode. See also CKEDITOR.editor#beforeSetMode and CKEDITOR.editor#beforeModeUnload
* @name CKEDITOR.editor#mode
* @event
* @param {String} previousMode The previous mode of the editor.
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'menu',
{
beforeInit : function( editor )
{
var groups = editor.config.menu_groups.split( ',' ),
groupsOrder = editor._.menuGroups = {},
menuItems = editor._.menuItems = {};
for ( var i = 0 ; i < groups.length ; i++ )
groupsOrder[ groups[ i ] ] = i + 1;
/**
* Registers an item group to the editor context menu in order to make it
* possible to associate it with menu items later.
* @name CKEDITOR.editor.prototype.addMenuGroup
* @param {String} name Specify a group name.
* @param {Number} [order=100] Define the display sequence of this group
* inside the menu. A smaller value gets displayed first.
*/
editor.addMenuGroup = function( name, order )
{
groupsOrder[ name ] = order || 100;
};
/**
* Adds an item from the specified definition to the editor context menu.
* @name CKEDITOR.editor.prototype.addMenuItem
* @param {String} name The menu item name.
* @param {CKEDITOR.menu.definition} definition The menu item definition.
*/
editor.addMenuItem = function( name, definition )
{
if ( groupsOrder[ definition.group ] )
menuItems[ name ] = new CKEDITOR.menuItem( this, name, definition );
};
/**
* Adds one or more items from the specified definition array to the editor context menu.
* @name CKEDITOR.editor.prototype.addMenuItems
* @param {Array} definitions List of definitions for each menu item as if {@link CKEDITOR.editor.addMenuItem} is called.
*/
editor.addMenuItems = function( definitions )
{
for ( var itemName in definitions )
{
this.addMenuItem( itemName, definitions[ itemName ] );
}
};
/**
* Retrieves a particular menu item definition from the editor context menu.
* @name CKEDITOR.editor.prototype.getMenuItem
* @param {String} name The name of the desired menu item.
* @return {CKEDITOR.menu.definition}
*/
editor.getMenuItem = function( name )
{
return menuItems[ name ];
};
/**
* Removes a particular menu item added before from the editor context menu.
* @name CKEDITOR.editor.prototype.removeMenuItem
* @param {String} name The name of the desired menu item.
* @since 3.6.1
*/
editor.removeMenuItem = function( name )
{
delete menuItems[ name ];
};
},
requires : [ 'floatpanel' ]
});
(function()
{
CKEDITOR.menu = CKEDITOR.tools.createClass(
{
$ : function( editor, definition )
{
definition = this._.definition = definition || {};
this.id = CKEDITOR.tools.getNextId();
this.editor = editor;
this.items = [];
this._.listeners = [];
this._.level = definition.level || 1;
var panelDefinition = CKEDITOR.tools.extend( {}, definition.panel,
{
css : editor.skin.editor.css,
level : this._.level - 1,
block : {}
} );
var attrs = panelDefinition.block.attributes = ( panelDefinition.attributes || {} );
// Provide default role of 'menu'.
!attrs.role && ( attrs.role = 'menu' );
this._.panelDefinition = panelDefinition;
},
_ :
{
onShow : function()
{
var selection = this.editor.getSelection();
// Selection will be unavailable after menu shows up
// in IE, lock it now.
if ( CKEDITOR.env.ie )
selection && selection.lock();
var element = selection && selection.getStartElement(),
listeners = this._.listeners,
includedItems = [];
this.removeAll();
// Call all listeners, filling the list of items to be displayed.
for ( var i = 0 ; i < listeners.length ; i++ )
{
var listenerItems = listeners[ i ]( element, selection );
if ( listenerItems )
{
for ( var itemName in listenerItems )
{
var item = this.editor.getMenuItem( itemName );
if ( item && ( !item.command || this.editor.getCommand( item.command ).state ) )
{
item.state = listenerItems[ itemName ];
this.add( item );
}
}
}
}
},
onClick : function( item )
{
this.hide( false );
if ( item.onClick )
item.onClick();
else if ( item.command )
this.editor.execCommand( item.command );
},
onEscape : function( keystroke )
{
var parent = this.parent;
// 1. If it's sub-menu, restore the last focused item
// of upper level menu.
// 2. In case of a top-menu, close it.
if ( parent )
{
parent._.panel.hideChild();
// Restore parent block item focus.
var parentBlock = parent._.panel._.panel._.currentBlock,
parentFocusIndex = parentBlock._.focusIndex;
parentBlock._.markItem( parentFocusIndex );
}
else if ( keystroke == 27 )
this.hide();
return false;
},
onHide : function()
{
// Unlock the selection upon first panel closing.
if ( CKEDITOR.env.ie && !this.parent )
{
var selection = this.editor.getSelection();
selection && selection.unlock( true );
}
this.onHide && this.onHide();
},
showSubMenu : function( index )
{
var menu = this._.subMenu,
item = this.items[ index ],
subItemDefs = item.getItems && item.getItems();
// If this item has no subitems, we just hide the submenu, if
// available, and return back.
if ( !subItemDefs )
{
this._.panel.hideChild();
return;
}
// Record parent menu focused item first (#3389).
var block = this._.panel.getBlock( this.id );
block._.focusIndex = index;
// Create the submenu, if not available, or clean the existing
// one.
if ( menu )
menu.removeAll();
else
{
menu = this._.subMenu = new CKEDITOR.menu( this.editor,
CKEDITOR.tools.extend( {}, this._.definition, { level : this._.level + 1 }, true ) );
menu.parent = this;
menu._.onClick = CKEDITOR.tools.bind( this._.onClick, this );
}
// Add all submenu items to the menu.
for ( var subItemName in subItemDefs )
{
var subItem = this.editor.getMenuItem( subItemName );
if ( subItem )
{
subItem.state = subItemDefs[ subItemName ];
menu.add( subItem );
}
}
// Get the element representing the current item.
var element = this._.panel.getBlock( this.id ).element.getDocument().getById( this.id + String( index ) );
// Show the submenu.
menu.show( element, 2 );
}
},
proto :
{
add : function( item )
{
// Later we may sort the items, but Array#sort is not stable in
// some browsers, here we're forcing the original sequence with
// 'order' attribute if it hasn't been assigned. (#3868)
if ( !item.order )
item.order = this.items.length;
this.items.push( item );
},
removeAll : function()
{
this.items = [];
},
show : function( offsetParent, corner, offsetX, offsetY )
{
// Not for sub menu.
if ( !this.parent )
{
this._.onShow();
// Don't menu with zero items.
if ( ! this.items.length )
return;
}
corner = corner || ( this.editor.lang.dir == 'rtl' ? 2 : 1 );
var items = this.items,
editor = this.editor,
panel = this._.panel,
element = this._.element;
// Create the floating panel for this menu.
if ( !panel )
{
panel = this._.panel = new CKEDITOR.ui.floatPanel( this.editor,
CKEDITOR.document.getBody(),
this._.panelDefinition,
this._.level );
panel.onEscape = CKEDITOR.tools.bind( function( keystroke )
{
if ( this._.onEscape( keystroke ) === false )
return false;
},
this );
panel.onHide = CKEDITOR.tools.bind( function()
{
this._.onHide && this._.onHide();
},
this );
// Create an autosize block inside the panel.
var block = panel.addBlock( this.id, this._.panelDefinition.block );
block.autoSize = true;
var keys = block.keys;
keys[ 40 ] = 'next'; // ARROW-DOWN
keys[ 9 ] = 'next'; // TAB
keys[ 38 ] = 'prev'; // ARROW-UP
keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB
keys[ ( editor.lang.dir == 'rtl' ? 37 : 39 ) ]= CKEDITOR.env.ie ? 'mouseup' : 'click'; // ARROW-RIGHT/ARROW-LEFT(rtl)
keys[ 32 ] = CKEDITOR.env.ie ? 'mouseup' : 'click'; // SPACE
CKEDITOR.env.ie && ( keys[ 13 ] = 'mouseup' ); // Manage ENTER, since onclick is blocked in IE (#8041).
element = this._.element = block.element;
element.addClass( editor.skinClass );
var elementDoc = element.getDocument();
elementDoc.getBody().setStyle( 'overflow', 'hidden' );
elementDoc.getElementsByTag( 'html' ).getItem( 0 ).setStyle( 'overflow', 'hidden' );
this._.itemOverFn = CKEDITOR.tools.addFunction( function( index )
{
clearTimeout( this._.showSubTimeout );
this._.showSubTimeout = CKEDITOR.tools.setTimeout( this._.showSubMenu, editor.config.menu_subMenuDelay || 400, this, [ index ] );
},
this );
this._.itemOutFn = CKEDITOR.tools.addFunction( function( index )
{
clearTimeout( this._.showSubTimeout );
},
this );
this._.itemClickFn = CKEDITOR.tools.addFunction( function( index )
{
var item = this.items[ index ];
if ( item.state == CKEDITOR.TRISTATE_DISABLED )
{
this.hide();
return;
}
if ( item.getItems )
this._.showSubMenu( index );
else
this._.onClick( item );
},
this );
}
// Put the items in the right order.
sortItems( items );
var chromeRoot = editor.container.getChild( 1 ),
mixedContentClass = chromeRoot.hasClass( 'cke_mixed_dir_content' ) ? ' cke_mixed_dir_content' : '';
// Build the HTML that composes the menu and its items.
var output = [ '<div class="cke_menu' + mixedContentClass + '" role="presentation">' ];
var length = items.length,
lastGroup = length && items[ 0 ].group;
for ( var i = 0 ; i < length ; i++ )
{
var item = items[ i ];
if ( lastGroup != item.group )
{
output.push( '<div class="cke_menuseparator" role="separator"></div>' );
lastGroup = item.group;
}
item.render( this, i, output );
}
output.push( '</div>' );
// Inject the HTML inside the panel.
element.setHtml( output.join( '' ) );
CKEDITOR.ui.fire( 'ready', this );
// Show the panel.
if ( this.parent )
this.parent._.panel.showAsChild( panel, this.id, offsetParent, corner, offsetX, offsetY );
else
panel.showBlock( this.id, offsetParent, corner, offsetX, offsetY );
editor.fire( 'menuShow', [ panel ] );
},
addListener : function( listenerFn )
{
this._.listeners.push( listenerFn );
},
hide : function( returnFocus )
{
this._.onHide && this._.onHide();
this._.panel && this._.panel.hide( returnFocus );
}
}
});
function sortItems( items )
{
items.sort( function( itemA, itemB )
{
if ( itemA.group < itemB.group )
return -1;
else if ( itemA.group > itemB.group )
return 1;
return itemA.order < itemB.order ? -1 :
itemA.order > itemB.order ? 1 :
0;
});
}
CKEDITOR.menuItem = CKEDITOR.tools.createClass(
{
$ : function( editor, name, definition )
{
CKEDITOR.tools.extend( this, definition,
// Defaults
{
order : 0,
className : 'cke_button_' + name
});
// Transform the group name into its order number.
this.group = editor._.menuGroups[ this.group ];
this.editor = editor;
this.name = name;
},
proto :
{
render : function( menu, index, output )
{
var id = menu.id + String( index ),
state = ( typeof this.state == 'undefined' ) ? CKEDITOR.TRISTATE_OFF : this.state;
var classes = ' cke_' + (
state == CKEDITOR.TRISTATE_ON ? 'on' :
state == CKEDITOR.TRISTATE_DISABLED ? 'disabled' :
'off' );
var htmlLabel = this.label;
if ( this.className )
classes += ' ' + this.className;
var hasSubMenu = this.getItems;
output.push(
'<span class="cke_menuitem' + ( this.icon && this.icon.indexOf( '.png' ) == -1 ? ' cke_noalphafix' : '' ) + '">' +
'<a id="', id, '"' +
' class="', classes, '" href="javascript:void(\'', ( this.label || '' ).replace( "'", '' ), '\')"' +
' title="', this.label, '"' +
' tabindex="-1"' +
'_cke_focus=1' +
' hidefocus="true"' +
' role="menuitem"' +
( hasSubMenu ? 'aria-haspopup="true"' : '' ) +
( state == CKEDITOR.TRISTATE_DISABLED ? 'aria-disabled="true"' : '' ) +
( state == CKEDITOR.TRISTATE_ON ? 'aria-pressed="true"' : '' ) );
// Some browsers don't cancel key events in the keydown but in the
// keypress.
// TODO: Check if really needed for Gecko+Mac.
if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
{
output.push(
' onkeypress="return false;"' );
}
// With Firefox, we need to force the button to redraw, otherwise it
// will remain in the focus state.
if ( CKEDITOR.env.gecko )
{
output.push(
' onblur="this.style.cssText = this.style.cssText;"' );
}
var offset = ( this.iconOffset || 0 ) * -16;
output.push(
// ' onkeydown="return CKEDITOR.ui.button._.keydown(', index, ', event);"' +
' onmouseover="CKEDITOR.tools.callFunction(', menu._.itemOverFn, ',', index, ');"' +
' onmouseout="CKEDITOR.tools.callFunction(', menu._.itemOutFn, ',', index, ');" ' +
( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // #188
'="CKEDITOR.tools.callFunction(', menu._.itemClickFn, ',', index, '); return false;"' +
'>' +
'<span class="cke_icon_wrapper"><span class="cke_icon"' +
( this.icon ? ' style="background-image:url(' + CKEDITOR.getUrl( this.icon ) + ');background-position:0 ' + offset + 'px;"'
: '' ) +
'></span></span>' +
'<span class="cke_label">' );
if ( hasSubMenu )
{
output.push(
'<span class="cke_menuarrow">',
'<span>&#',
( this.editor.lang.dir == 'rtl' ?
'9668' : // BLACK LEFT-POINTING POINTER
'9658' ), // BLACK RIGHT-POINTING POINTER
';</span>',
'</span>' );
}
output.push(
htmlLabel,
'</span>' +
'</a>' +
'</span>' );
}
}
});
})();
/**
* The amount of time, in milliseconds, the editor waits before displaying submenu
* options when moving the mouse over options that contain submenus, like the
* "Cell Properties" entry for tables.
* @type Number
* @default 400
* @example
* // Remove the submenu delay.
* config.menu_subMenuDelay = 0;
*/
/**
* A comma separated list of items group names to be displayed in the context
* menu. The order of items will reflect the order specified in this list if
* no priority was defined in the groups.
* @type String
* @default 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea'
* @example
* config.menu_groups = 'clipboard,table,anchor,link,image';
*/
CKEDITOR.config.menu_groups =
'clipboard,' +
'form,' +
'tablecell,tablecellproperties,tablerow,tablecolumn,table,'+
'anchor,link,image,flash,' +
'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @file Horizontal Page Break
*/
// Register a plugin named "newpage".
CKEDITOR.plugins.add( 'newpage',
{
init : function( editor )
{
editor.addCommand( 'newpage',
{
modes : { wysiwyg:1, source:1 },
exec : function( editor )
{
var command = this;
editor.setData( editor.config.newpage_html || '', function()
{
// Save the undo snapshot after all document changes are affected. (#4889)
setTimeout( function ()
{
editor.fire( 'afterCommandExec',
{
name: command.name,
command: command
} );
editor.selectionChange();
}, 200 );
} );
editor.focus();
},
async : true
});
editor.ui.addButton( 'NewPage',
{
label : editor.lang.newPage,
command : 'newpage'
});
}
});
/**
* The HTML to load in the editor when the "new page" command is executed.
* @name CKEDITOR.config.newpage_html
* @type String
* @default ''
* @example
* config.newpage_html = '<p>Type your text here.</p>';
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'htmlwriter' );
/**
* Class used to write HTML data.
* @constructor
* @example
* var writer = new CKEDITOR.htmlWriter();
* writer.openTag( 'p' );
* writer.attribute( 'class', 'MyClass' );
* writer.openTagClose( 'p' );
* writer.text( 'Hello' );
* writer.closeTag( 'p' );
* alert( writer.getHtml() ); "<p class="MyClass">Hello</p>"
*/
CKEDITOR.htmlWriter = CKEDITOR.tools.createClass(
{
base : CKEDITOR.htmlParser.basicWriter,
$ : function()
{
// Call the base contructor.
this.base();
/**
* The characters to be used for each identation step.
* @type String
* @default "\t" (tab)
* @example
* // Use two spaces for indentation.
* editorInstance.dataProcessor.writer.indentationChars = ' ';
*/
this.indentationChars = '\t';
/**
* The characters to be used to close "self-closing" elements, like "br" or
* "img".
* @type String
* @default " />"
* @example
* // Use HTML4 notation for self-closing elements.
* editorInstance.dataProcessor.writer.selfClosingEnd = '>';
*/
this.selfClosingEnd = ' />';
/**
* The characters to be used for line breaks.
* @type String
* @default "\n" (LF)
* @example
* // Use CRLF for line breaks.
* editorInstance.dataProcessor.writer.lineBreakChars = '\r\n';
*/
this.lineBreakChars = '\n';
this.forceSimpleAmpersand = 0;
this.sortAttributes = 1;
this._.indent = 0;
this._.indentation = '';
// Indicate preformatted block context status. (#5789)
this._.inPre = 0;
this._.rules = {};
var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) )
{
this.setRules( e,
{
indent : 1,
breakBeforeOpen : 1,
breakAfterOpen : 1,
breakBeforeClose : !dtd[ e ][ '#' ],
breakAfterClose : 1
});
}
this.setRules( 'br',
{
breakAfterOpen : 1
});
this.setRules( 'title',
{
indent : 0,
breakAfterOpen : 0
});
this.setRules( 'style',
{
indent : 0,
breakBeforeClose : 1
});
// Disable indentation on <pre>.
this.setRules( 'pre',
{
indent : 0
});
},
proto :
{
/**
* Writes the tag opening part for a opener tag.
* @param {String} tagName The element name for this tag.
* @param {Object} attributes The attributes defined for this tag. The
* attributes could be used to inspect the tag.
* @example
* // Writes "<p".
* writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } );
*/
openTag : function( tagName, attributes )
{
var rules = this._.rules[ tagName ];
if ( this._.indent )
this.indentation();
// Do not break if indenting.
else if ( rules && rules.breakBeforeOpen )
{
this.lineBreak();
this.indentation();
}
this._.output.push( '<', tagName );
},
/**
* Writes the tag closing part for a opener tag.
* @param {String} tagName The element name for this tag.
* @param {Boolean} isSelfClose Indicates that this is a self-closing tag,
* like "br" or "img".
* @example
* // Writes ">".
* writer.openTagClose( 'p', false );
* @example
* // Writes " />".
* writer.openTagClose( 'br', true );
*/
openTagClose : function( tagName, isSelfClose )
{
var rules = this._.rules[ tagName ];
if ( isSelfClose )
this._.output.push( this.selfClosingEnd );
else
{
this._.output.push( '>' );
if ( rules && rules.indent )
this._.indentation += this.indentationChars;
}
if ( rules && rules.breakAfterOpen )
this.lineBreak();
tagName == 'pre' && ( this._.inPre = 1 );
},
/**
* Writes an attribute. This function should be called after opening the
* tag with {@link #openTagClose}.
* @param {String} attName The attribute name.
* @param {String} attValue The attribute value.
* @example
* // Writes ' class="MyClass"'.
* writer.attribute( 'class', 'MyClass' );
*/
attribute : function( attName, attValue )
{
if ( typeof attValue == 'string' )
{
this.forceSimpleAmpersand && ( attValue = attValue.replace( /&/g, '&' ) );
// Browsers don't always escape special character in attribute values. (#4683, #4719).
attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
}
this._.output.push( ' ', attName, '="', attValue, '"' );
},
/**
* Writes a closer tag.
* @param {String} tagName The element name for this tag.
* @example
* // Writes "</p>".
* writer.closeTag( 'p' );
*/
closeTag : function( tagName )
{
var rules = this._.rules[ tagName ];
if ( rules && rules.indent )
this._.indentation = this._.indentation.substr( this.indentationChars.length );
if ( this._.indent )
this.indentation();
// Do not break if indenting.
else if ( rules && rules.breakBeforeClose )
{
this.lineBreak();
this.indentation();
}
this._.output.push( '</', tagName, '>' );
tagName == 'pre' && ( this._.inPre = 0 );
if ( rules && rules.breakAfterClose )
this.lineBreak();
},
/**
* Writes text.
* @param {String} text The text value
* @example
* // Writes "Hello Word".
* writer.text( 'Hello Word' );
*/
text : function( text )
{
if ( this._.indent )
{
this.indentation();
!this._.inPre && ( text = CKEDITOR.tools.ltrim( text ) );
}
this._.output.push( text );
},
/**
* Writes a comment.
* @param {String} comment The comment text.
* @example
* // Writes "<!-- My comment -->".
* writer.comment( ' My comment ' );
*/
comment : function( comment )
{
if ( this._.indent )
this.indentation();
this._.output.push( '<!--', comment, '-->' );
},
/**
* Writes a line break. It uses the {@link #lineBreakChars} property for it.
* @example
* // Writes "\n" (e.g.).
* writer.lineBreak();
*/
lineBreak : function()
{
if ( !this._.inPre && this._.output.length > 0 )
this._.output.push( this.lineBreakChars );
this._.indent = 1;
},
/**
* Writes the current indentation chars. It uses the
* {@link #indentationChars} property, repeating it for the current
* indentation steps.
* @example
* // Writes "\t" (e.g.).
* writer.indentation();
*/
indentation : function()
{
if( !this._.inPre )
this._.output.push( this._.indentation );
this._.indent = 0;
},
/**
* Sets formatting rules for a give element. The possible rules are:
* <ul>
* <li><b>indent</b>: indent the element contents.</li>
* <li><b>breakBeforeOpen</b>: break line before the opener tag for this element.</li>
* <li><b>breakAfterOpen</b>: break line after the opener tag for this element.</li>
* <li><b>breakBeforeClose</b>: break line before the closer tag for this element.</li>
* <li><b>breakAfterClose</b>: break line after the closer tag for this element.</li>
* </ul>
*
* All rules default to "false". Each call to the function overrides
* already present rules, leaving the undefined untouched.
*
* By default, all elements available in the {@link CKEDITOR.dtd.$block),
* {@link CKEDITOR.dtd.$listItem} and {@link CKEDITOR.dtd.$tableContent}
* lists have all the above rules set to "true". Additionaly, the "br"
* element has the "breakAfterOpen" set to "true".
* @param {String} tagName The element name to which set the rules.
* @param {Object} rules An object containing the element rules.
* @example
* // Break line before and after "img" tags.
* writer.setRules( 'img',
* {
* breakBeforeOpen : true
* breakAfterOpen : true
* });
* @example
* // Reset the rules for the "h1" tag.
* writer.setRules( 'h1', {} );
*/
setRules : function( tagName, rules )
{
var currentRules = this._.rules[ tagName ];
if ( currentRules )
CKEDITOR.tools.extend( currentRules, rules, true );
else
this._.rules[ tagName ] = rules;
}
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @file Preview plugin.
*/
(function()
{
var previewCmd =
{
modes : { wysiwyg:1, source:1 },
canUndo : false,
readOnly : 1,
exec : function( editor )
{
var sHTML,
config = editor.config,
baseTag = config.baseHref ? '<base href="' + config.baseHref + '"/>' : '',
isCustomDomain = CKEDITOR.env.isCustomDomain();
if ( config.fullPage )
{
sHTML = editor.getData()
.replace( /<head>/, '$&' + baseTag )
.replace( /[^>]*(?=<\/title>)/, '$& — ' + editor.lang.preview );
}
else
{
var bodyHtml = '<body ',
body = editor.document && editor.document.getBody();
if ( body )
{
if ( body.getAttribute( 'id' ) )
bodyHtml += 'id="' + body.getAttribute( 'id' ) + '" ';
if ( body.getAttribute( 'class' ) )
bodyHtml += 'class="' + body.getAttribute( 'class' ) + '" ';
}
bodyHtml += '>';
sHTML =
editor.config.docType +
'<html dir="' + editor.config.contentsLangDirection + '">' +
'<head>' +
baseTag +
'<title>' + editor.lang.preview + '</title>' +
CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
'</head>' + bodyHtml +
editor.getData() +
'</body></html>';
}
var iWidth = 640, // 800 * 0.8,
iHeight = 420, // 600 * 0.7,
iLeft = 80; // (800 - 0.8 * 800) /2 = 800 * 0.1.
try
{
var screen = window.screen;
iWidth = Math.round( screen.width * 0.8 );
iHeight = Math.round( screen.height * 0.7 );
iLeft = Math.round( screen.width * 0.1 );
}
catch ( e ){}
var sOpenUrl = '';
if ( isCustomDomain )
{
window._cke_htmlToLoad = sHTML;
sOpenUrl = 'javascript:void( (function(){' +
'document.open();' +
'document.domain="' + document.domain + '";' +
'document.write( window.opener._cke_htmlToLoad );' +
'document.close();' +
'window.opener._cke_htmlToLoad = null;' +
'})() )';
}
var oWindow = window.open( sOpenUrl, null, 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=' +
iWidth + ',height=' + iHeight + ',left=' + iLeft );
if ( !isCustomDomain )
{
var doc = oWindow.document;
doc.open();
doc.write( sHTML );
doc.close();
// Chrome will need this to show the embedded. (#8016)
CKEDITOR.env.webkit && setTimeout( function() { doc.body.innerHTML += ''; }, 0 );
}
}
};
var pluginName = 'preview';
// Register a plugin named "preview".
CKEDITOR.plugins.add( pluginName,
{
init : function( editor )
{
editor.addCommand( pluginName, previewCmd );
editor.ui.addButton( 'Preview',
{
label : editor.lang.preview,
command : pluginName
});
}
});
})();
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'uicolor',
{
requires : [ 'dialog' ],
lang : [ 'bg', 'cs', 'cy', 'da', 'de', 'el', 'en', 'eo', 'et', 'fa', 'fi', 'fr', 'he', 'hr', 'it', 'mk', 'nb', 'nl', 'no', 'pl', 'tr', 'ug', 'uk', 'vi', 'zh-cn' ],
init : function( editor )
{
if ( CKEDITOR.env.ie6Compat )
return;
editor.addCommand( 'uicolor', new CKEDITOR.dialogCommand( 'uicolor' ) );
editor.ui.addButton( 'UIColor',
{
label : editor.lang.uicolor.title,
command : 'uicolor',
icon : this.path + 'uicolor.gif'
});
CKEDITOR.dialog.add( 'uicolor', this.path + 'dialogs/uicolor.js' );
// Load YUI js files.
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(
'_source/' + // @Packager.RemoveLine
'plugins/uicolor/yui/yui.js'
));
// Load YUI css files.
editor.element.getDocument().appendStyleSheet( CKEDITOR.getUrl(
'_source/' + // @Packager.RemoveLine
'plugins/uicolor/yui/assets/yui.css'
));
}
} );
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'cy',
{
uicolor :
{
title : 'Dewisydd Lliwiau\'r UI',
preview : 'Rhagolwg Byw',
config : 'Gludwch y llinyn hwn i\'ch ffeil config.js',
predefined : 'Setiau lliw wedi\'u cyn-ddiffinio'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'tr',
{
uicolor :
{
title : 'UI Renk Seçicisi',
preview : 'Canlı önizleme',
config : 'Bu dizeyi config.js dosyasının içine yapıştırın',
predefined : 'Önceden tanımlanmış renk kümeleri'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'nb',
{
uicolor :
{
title : 'Fargevelger for brukergrensesnitt',
preview : 'Forhåndsvisning i sanntid',
config : 'Lim inn følgende tekst i din config.js-fil',
predefined : 'Forhåndsdefinerte fargesett'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'fr',
{
uicolor :
{
title : 'UI Sélecteur de couleur',
preview : 'Aperçu',
config : 'Collez cette chaîne de caractères dans votre fichier config.js',
predefined : 'Palettes de couleurs prédéfinies'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'fa',
{
uicolor :
{
title : 'انتخاب رنگ UI',
preview : 'پیشنمایش زنده',
config : 'این رشته را در فایل config.js خود بچسبانید.',
predefined : 'مجموعه رنگ از پیش تعریف شده'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'eo',
{
uicolor :
{
title : 'UI Kolorselektilo',
preview : 'Vidigi la aspekton',
config : 'Gluu tiun signoĉenon en vian dosieron config.js',
predefined : 'Antaŭdifinita koloraro'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'uk',
{
uicolor :
{
title : 'Color Picker Інтерфейс',
preview : 'Перегляд наживо',
config : 'Вставте цей рядок у файл config.js',
predefined : 'Стандартний набір кольорів'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'he',
{
uicolor :
{
title : 'בחירת צבע ממשק משתמש',
preview : 'תצוגה מקדימה',
config : 'הדבק את הטקסט הבא לתוך הקובץ config.js',
predefined : 'קבוצות צבעים מוגדרות מראש'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'de',
{
uicolor :
{
title : 'UI Pipette',
preview : 'Live-Vorschau',
config : 'Fügen Sie diese Zeichenfolge in die \'config.js\' Datei.',
predefined : 'Vordefinierte Farbsätze'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'no',
{
uicolor :
{
title : 'Fargevelger for brukergrensesnitt',
preview : 'Forhåndsvisning i sanntid',
config : 'Lim inn følgende tekst i din config.js-fil',
predefined : 'Forhåndsdefinerte fargesett'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'el',
{
uicolor :
{
title : 'Διεπαφή Επιλογέα Χρωμάτων',
preview : 'Ζωντανή Προεπισκόπηση',
config : 'Επικολλήστε αυτό το κείμενο στο αρχείο config.js',
predefined : 'Προκαθορισμένα σύνολα χρωμάτων'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'vi',
{
uicolor :
{
title : 'Giao diện người dùng Color Picker',
preview : 'Xem trước trực tiếp',
config : 'Dán chuỗi này vào tập tin config.js của bạn',
predefined : 'Tập màu định nghĩa sẵn'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'mk',
{
uicolor :
{
title : 'Палета со бои',
preview : 'Преглед',
config : 'Залепи го овој текст во config.js датотеката',
predefined : 'Предефинирани множества на бои'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'it',
{
uicolor :
{
title : 'Selettore Colore UI',
preview : 'Anteprima Live',
config : 'Incolla questa stringa nel tuo file config.js',
predefined : 'Set di colori predefiniti'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'nl',
{
uicolor :
{
title : 'UI Kleurenkiezer',
preview : 'Live voorbeeld',
config : 'Plak deze tekst in jouw config.js bestand',
predefined : 'Voorgedefinieerde kleurensets'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'da',
{
uicolor :
{
title : 'Brugerflade på farvevælger',
preview : 'Vis liveeksempel',
config : 'Indsæt denne streng i din config.js fil',
predefined : 'Prædefinerede farveskemaer'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'et',
{
uicolor :
{
title : 'Värvivalija kasutajaliides',
preview : 'Automaatne eelvaade',
config : 'Aseta see sõne oma config.js faili.',
predefined : 'Eelmääratud värvikomplektid'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'pl',
{
uicolor :
{
title : 'Wybór koloru interfejsu',
preview : 'Podgląd na żywo',
config : 'Wklej poniższy łańcuch znaków do pliku config.js:',
predefined : 'Predefiniowane zestawy kolorów'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'cs',
{
uicolor :
{
title : 'Výběr barvy rozhraní',
preview : 'Živý náhled',
config : 'Vložte tento řetězec do Vašeho souboru config.js',
predefined : 'Přednastavené sady barev'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'hr',
{
uicolor :
{
title : 'UI odabir boja',
preview : 'Pregled uživo',
config : 'Zalijepite ovaj tekst u Vašu config.js datoteku.',
predefined : 'Već postavljeni setovi boja'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'fi',
{
uicolor :
{
title : 'Käyttöliittymän värivalitsin',
preview : 'Esikatsele',
config : 'Liitä tämä merkkijono config.js tiedostoosi',
predefined : 'Esimääritellyt värijoukot'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'ug',
{
uicolor :
{
title : 'ئىشلەتكۈچى ئارايۈزى رەڭ تاللىغۇچ',
preview : 'شۇئان ئالدىن كۆزىتىش',
config : 'بۇ ھەرپ تىزىقىنى config.js ھۆججەتكە چاپلايدۇ',
predefined : 'ئالدىن بەلگىلەنگەن رەڭلەر'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'zh-cn',
{
uicolor :
{
title : '用户界面颜色选择器',
preview : '即时预览',
config : '粘贴此字符串到你的 config.js 文件',
predefined : '预定义颜色集'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'bg',
{
uicolor :
{
title : 'ПИ избор на цвят',
preview : 'Преглед',
config : 'Вмъкнете този низ във Вашия config.js fajl',
predefined : 'Предефинирани цветови палитри'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'en',
{
uicolor :
{
title : 'UI Color Picker',
preview : 'Live preview',
config : 'Paste this string into your config.js file',
predefined : 'Predefined color sets'
}
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'uicolor', function( editor )
{
var dialog, picker, pickerContents,
// Actual UI color value.
uiColor = editor.getUiColor(),
pickerId = 'cke_uicolor_picker' + CKEDITOR.tools.getNextNumber();
function setNewPickerColor( color )
{
// Convert HEX representation to RGB, stripping # char.
if ( /^#/.test( color ) )
color = window.YAHOO.util.Color.hex2rgb( color.substr( 1 ) );
picker.setValue( color, true );
// Refresh picker UI.
picker.refresh( pickerId );
}
function setNewUiColor( color, force )
{
if ( force || dialog._.contents.tab1.livePeview.getValue() )
editor.setUiColor( color );
// Write new config string into textbox.
dialog._.contents.tab1.configBox.setValue(
'config.uiColor = "#' + picker.get( "hex" ) + '"'
);
}
pickerContents =
{
id : 'yuiColorPicker',
type : 'html',
html : "<div id='" + pickerId + "' class='cke_uicolor_picker' style='width: 360px; height: 200px; position: relative;'></div>",
onLoad : function( event )
{
var url = CKEDITOR.getUrl(
'_source/' + // @Packager.RemoveLine
'plugins/uicolor/yui/'
);
// Create new color picker widget.
picker = new window.YAHOO.widget.ColorPicker( pickerId,
{
showhsvcontrols : true,
showhexcontrols : true,
images :
{
PICKER_THUMB : url + "assets/picker_thumb.png",
HUE_THUMB : url + "assets/hue_thumb.png"
}
});
// Set actual UI color to the picker.
if ( uiColor )
setNewPickerColor( uiColor );
// Subscribe to the rgbChange event.
picker.on( "rgbChange", function()
{
// Reset predefined box.
dialog._.contents.tab1.predefined.setValue( '' );
setNewUiColor( '#' + picker.get( 'hex' ) );
});
// Fix input class names.
var inputs = new CKEDITOR.dom.nodeList( picker.getElementsByTagName( 'input' ) );
for ( var i = 0; i < inputs.count() ; i++ )
inputs.getItem( i ).addClass( 'cke_dialog_ui_input_text' );
}
};
var skipPreviewChange = true;
return {
title : editor.lang.uicolor.title,
minWidth : 360,
minHeight : 320,
onLoad : function()
{
dialog = this;
this.setupContent();
// #3808
if ( CKEDITOR.env.ie7Compat )
dialog.parts.contents.setStyle( 'overflow', 'hidden' );
},
contents : [
{
id : 'tab1',
label : '',
title : '',
expand : true,
padding : 0,
elements : [
pickerContents,
{
id : 'tab1',
type : 'vbox',
children :
[
{
id : 'livePeview',
type : 'checkbox',
label : editor.lang.uicolor.preview,
'default' : 1,
onLoad : function()
{
skipPreviewChange = true;
},
onChange : function()
{
if ( skipPreviewChange )
return;
var on = this.getValue(),
color = on ? '#' + picker.get( 'hex' ) : uiColor;
setNewUiColor( color, true );
}
},
{
type : 'hbox',
children :
[
{
id : 'predefined',
type : 'select',
'default' : '',
label : editor.lang.uicolor.predefined,
items :
[
[ '' ],
[ 'Light blue', '#9AB8F3' ],
[ 'Sand', '#D2B48C' ],
[ 'Metallic', '#949AAA' ],
[ 'Purple', '#C2A3C7' ],
[ 'Olive', '#A2C980' ],
[ 'Happy green', '#9BD446' ],
[ 'Jezebel Blue', '#14B8C4' ],
[ 'Burn', '#FF893A' ],
[ 'Easy red', '#FF6969' ],
[ 'Pisces 3', '#48B4F2' ],
[ 'Aquarius 5', '#487ED4' ],
[ 'Absinthe', '#A8CF76' ],
[ 'Scrambled Egg', '#C7A622' ],
[ 'Hello monday', '#8E8D80' ],
[ 'Lovely sunshine', '#F1E8B1' ],
[ 'Recycled air', '#B3C593' ],
[ 'Down', '#BCBCA4' ],
[ 'Mark Twain', '#CFE91D' ],
[ 'Specks of dust', '#D1B596' ],
[ 'Lollipop', '#F6CE23' ]
],
onChange : function()
{
var color = this.getValue();
if ( color )
{
setNewPickerColor( color );
setNewUiColor( color );
// Refresh predefined preview box.
CKEDITOR.document.getById( 'predefinedPreview' ).setStyle( 'background', color );
}
else
CKEDITOR.document.getById( 'predefinedPreview' ).setStyle( 'background', '' );
},
onShow : function()
{
var color = editor.getUiColor();
if ( color )
this.setValue( color );
}
},
{
id : 'predefinedPreview',
type : 'html',
html : '<div id="cke_uicolor_preview" style="border: 1px solid black; padding: 3px; width: 30px;">' +
'<div id="predefinedPreview" style="width: 30px; height: 30px;"> </div>' +
'</div>'
}
]
},
{
id : 'configBox',
type : 'text',
label : editor.lang.uicolor.config,
onShow : function()
{
var color = editor.getUiColor();
if ( color )
this.setValue(
'config.uiColor = "' + color + '"'
);
}
}
]
}
]
}
],
buttons : [ CKEDITOR.dialog.okButton ]
};
} );
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Plugin for making iframe based dialogs.
*/
CKEDITOR.plugins.add( 'iframedialog',
{
requires : [ 'dialog' ],
onLoad : function()
{
/**
* An iframe base dialog.
* @param {String} name Name of the dialog
* @param {String} title Title of the dialog
* @param {Number} minWidth Minimum width of the dialog
* @param {Number} minHeight Minimum height of the dialog
* @param {Function} [onContentLoad] Function called when the iframe has been loaded.
* If it isn't specified, the inner frame is notified of the dialog events ('load',
* 'resize', 'ok' and 'cancel') on a function called 'onDialogEvent'
* @param {Object} [userDefinition] Additional properties for the dialog definition
* @example
*/
CKEDITOR.dialog.addIframe = function( name, title, src, minWidth, minHeight, onContentLoad, userDefinition )
{
var element =
{
type : 'iframe',
src : src,
width : '100%',
height : '100%'
};
if ( typeof( onContentLoad ) == 'function' )
element.onContentLoad = onContentLoad;
else
element.onContentLoad = function()
{
var element = this.getElement(),
childWindow = element.$.contentWindow;
// If the inner frame has defined a "onDialogEvent" function, setup listeners
if ( childWindow.onDialogEvent )
{
var dialog = this.getDialog(),
notifyEvent = function(e)
{
return childWindow.onDialogEvent(e);
};
dialog.on( 'ok', notifyEvent );
dialog.on( 'cancel', notifyEvent );
dialog.on( 'resize', notifyEvent );
// Clear listeners
dialog.on( 'hide', function(e)
{
dialog.removeListener( 'ok', notifyEvent );
dialog.removeListener( 'cancel', notifyEvent );
dialog.removeListener( 'resize', notifyEvent );
e.removeListener();
} );
// Notify child iframe of load:
childWindow.onDialogEvent( {
name : 'load',
sender : this,
editor : dialog._.editor
} );
}
};
var definition =
{
title : title,
minWidth : minWidth,
minHeight : minHeight,
contents :
[
{
id : 'iframe',
label : title,
expand : true,
elements : [ element ]
}
]
};
for ( var i in userDefinition )
definition[i] = userDefinition[i];
this.add( name, function(){ return definition; } );
};
(function()
{
/**
* An iframe element.
* @extends CKEDITOR.ui.dialog.uiElement
* @example
* @constructor
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
* @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
* <ul>
* <li><strong>src</strong> (Required) The src field of the iframe. </li>
* <li><strong>width</strong> (Required) The iframe's width.</li>
* <li><strong>height</strong> (Required) The iframe's height.</li>
* <li><strong>onContentLoad</strong> (Optional) A function to be executed
* after the iframe's contents has finished loading.</li>
* </ul>
* @param {Array} htmlList
* List of HTML code to output to.
*/
var iframeElement = function( dialog, elementDefinition, htmlList )
{
if ( arguments.length < 3 )
return;
var _ = ( this._ || ( this._ = {} ) ),
contentLoad = elementDefinition.onContentLoad && CKEDITOR.tools.bind( elementDefinition.onContentLoad, this ),
cssWidth = CKEDITOR.tools.cssLength( elementDefinition.width ),
cssHeight = CKEDITOR.tools.cssLength( elementDefinition.height );
_.frameId = CKEDITOR.tools.getNextId() + '_iframe';
// IE BUG: Parent container does not resize to contain the iframe automatically.
dialog.on( 'load', function()
{
var iframe = CKEDITOR.document.getById( _.frameId ),
parentContainer = iframe.getParent();
parentContainer.setStyles(
{
width : cssWidth,
height : cssHeight
} );
} );
var attributes =
{
src : '%2',
id : _.frameId,
frameborder : 0,
allowtransparency : true
};
var myHtml = [];
if ( typeof( elementDefinition.onContentLoad ) == 'function' )
attributes.onload = 'CKEDITOR.tools.callFunction(%1);';
CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, myHtml, 'iframe',
{
width : cssWidth,
height : cssHeight
}, attributes, '' );
// Put a placeholder for the first time.
htmlList.push( '<div style="width:' + cssWidth + ';height:' + cssHeight + ';" id="' + this.domId + '"></div>' );
// Iframe elements should be refreshed whenever it is shown.
myHtml = myHtml.join( '' );
dialog.on( 'show', function()
{
var iframe = CKEDITOR.document.getById( _.frameId ),
parentContainer = iframe.getParent(),
callIndex = CKEDITOR.tools.addFunction( contentLoad ),
html = myHtml.replace( '%1', callIndex ).replace( '%2', CKEDITOR.tools.htmlEncode( elementDefinition.src ) );
parentContainer.setHtml( html );
} );
};
iframeElement.prototype = new CKEDITOR.ui.dialog.uiElement;
CKEDITOR.dialog.addUIElement( 'iframe',
{
build : function( dialog, elementDefinition, output )
{
return new iframeElement( dialog, elementDefinition, output );
}
} );
})();
}
} );
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'panelbutton',
{
requires : [ 'button' ],
onLoad : function()
{
function clickFn( editor )
{
var _ = this._;
if ( _.state == CKEDITOR.TRISTATE_DISABLED )
return;
this.createPanel( editor );
if ( _.on )
{
_.panel.hide();
return;
}
_.panel.showBlock( this._.id, this.document.getById( this._.id ), 4 );
}
CKEDITOR.ui.panelButton = CKEDITOR.tools.createClass(
{
base : CKEDITOR.ui.button,
$ : function( definition )
{
// We don't want the panel definition in this object.
var panelDefinition = definition.panel;
delete definition.panel;
this.base( definition );
this.document = ( panelDefinition
&& panelDefinition.parent
&& panelDefinition.parent.getDocument() )
|| CKEDITOR.document;
panelDefinition.block =
{
attributes : panelDefinition.attributes
};
this.hasArrow = true;
this.click = clickFn;
this._ =
{
panelDefinition : panelDefinition
};
},
statics :
{
handler :
{
create : function( definition )
{
return new CKEDITOR.ui.panelButton( definition );
}
}
},
proto :
{
createPanel : function( editor )
{
var _ = this._;
if ( _.panel )
return;
var panelDefinition = this._.panelDefinition || {},
panelBlockDefinition = this._.panelDefinition.block,
panelParentElement = panelDefinition.parent || CKEDITOR.document.getBody(),
panel = this._.panel = new CKEDITOR.ui.floatPanel( editor, panelParentElement, panelDefinition ),
block = panel.addBlock( _.id, panelBlockDefinition ),
me = this;
panel.onShow = function()
{
if ( me.className )
this.element.getFirst().addClass( me.className + '_panel' );
me.setState( CKEDITOR.TRISTATE_ON );
_.on = 1;
if ( me.onOpen )
me.onOpen();
};
panel.onHide = function( preventOnClose )
{
if ( me.className )
this.element.getFirst().removeClass( me.className + '_panel' );
me.setState( me.modes && me.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
_.on = 0;
if ( !preventOnClose && me.onClose )
me.onClose();
};
panel.onEscape = function()
{
panel.hide();
me.document.getById( _.id ).focus();
};
if ( this.onBlock )
this.onBlock( panel, block );
block.onHide = function()
{
_.on = 0;
me.setState( CKEDITOR.TRISTATE_OFF );
};
}
}
});
},
beforeInit : function( editor )
{
editor.ui.addHandler( CKEDITOR.UI_PANELBUTTON, CKEDITOR.ui.panelButton.handler );
}
});
/**
* Button UI element.
* @constant
* @example
*/
CKEDITOR.UI_PANELBUTTON = 'panelbutton';
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
function addCombo( editor, comboName, styleType, lang, entries, defaultLabel, styleDefinition )
{
var config = editor.config;
// Gets the list of fonts from the settings.
var names = entries.split( ';' ),
values = [];
// Create style objects for all fonts.
var styles = {};
for ( var i = 0 ; i < names.length ; i++ )
{
var parts = names[ i ];
if ( parts )
{
parts = parts.split( '/' );
var vars = {},
name = names[ i ] = parts[ 0 ];
vars[ styleType ] = values[ i ] = parts[ 1 ] || name;
styles[ name ] = new CKEDITOR.style( styleDefinition, vars );
styles[ name ]._.definition.name = name;
}
else
names.splice( i--, 1 );
}
editor.ui.addRichCombo( comboName,
{
label : lang.label,
title : lang.panelTitle,
className : 'cke_' + ( styleType == 'size' ? 'fontSize' : 'font' ),
panel :
{
css : editor.skin.editor.css.concat( config.contentsCss ),
multiSelect : false,
attributes : { 'aria-label' : lang.panelTitle }
},
init : function()
{
this.startGroup( lang.panelTitle );
for ( var i = 0 ; i < names.length ; i++ )
{
var name = names[ i ];
// Add the tag entry to the panel list.
this.add( name, styles[ name ].buildPreview(), name );
}
},
onClick : function( value )
{
editor.focus();
editor.fire( 'saveSnapshot' );
var style = styles[ value ];
if ( this.getValue() == value )
style.remove( editor.document );
else
style.apply( editor.document );
editor.fire( 'saveSnapshot' );
},
onRender : function()
{
editor.on( 'selectionChange', function( ev )
{
var currentValue = this.getValue();
var elementPath = ev.data.path,
elements = elementPath.elements;
// For each element into the elements path.
for ( var i = 0, element ; i < elements.length ; i++ )
{
element = elements[i];
// Check if the element is removable by any of
// the styles.
for ( var value in styles )
{
if ( styles[ value ].checkElementRemovable( element, true ) )
{
if ( value != currentValue )
this.setValue( value );
return;
}
}
}
// If no styles match, just empty it.
this.setValue( '', defaultLabel );
},
this);
}
});
}
CKEDITOR.plugins.add( 'font',
{
requires : [ 'richcombo', 'styles' ],
init : function( editor )
{
var config = editor.config;
addCombo( editor, 'Font', 'family', editor.lang.font, config.font_names, config.font_defaultLabel, config.font_style );
addCombo( editor, 'FontSize', 'size', editor.lang.fontSize, config.fontSize_sizes, config.fontSize_defaultLabel, config.fontSize_style );
}
});
})();
/**
* The list of fonts names to be displayed in the Font combo in the toolbar.
* Entries are separated by semi-colons (;), while it's possible to have more
* than one font for each entry, in the HTML way (separated by comma).
*
* A display name may be optionally defined by prefixing the entries with the
* name and the slash character. For example, "Arial/Arial, Helvetica, sans-serif"
* will be displayed as "Arial" in the list, but will be outputted as
* "Arial, Helvetica, sans-serif".
* @type String
* @example
* config.font_names =
* 'Arial/Arial, Helvetica, sans-serif;' +
* 'Times New Roman/Times New Roman, Times, serif;' +
* 'Verdana';
* @example
* config.font_names = 'Arial;Times New Roman;Verdana';
*/
CKEDITOR.config.font_names =
'Arial/Arial, Helvetica, sans-serif;' +
'Comic Sans MS/Comic Sans MS, cursive;' +
'Courier New/Courier New, Courier, monospace;' +
'Georgia/Georgia, serif;' +
'Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;' +
'Tahoma/Tahoma, Geneva, sans-serif;' +
'Times New Roman/Times New Roman, Times, serif;' +
'Trebuchet MS/Trebuchet MS, Helvetica, sans-serif;' +
'Verdana/Verdana, Geneva, sans-serif';
/**
* The text to be displayed in the Font combo is none of the available values
* matches the current cursor position or text selection.
* @type String
* @example
* // If the default site font is Arial, we may making it more explicit to the end user.
* config.font_defaultLabel = 'Arial';
*/
CKEDITOR.config.font_defaultLabel = '';
/**
* The style definition to be used to apply the font in the text.
* @type Object
* @example
* // This is actually the default value for it.
* config.font_style =
* {
* element : 'span',
* styles : { 'font-family' : '#(family)' },
* overrides : [ { element : 'font', attributes : { 'face' : null } } ]
* };
*/
CKEDITOR.config.font_style =
{
element : 'span',
styles : { 'font-family' : '#(family)' },
overrides : [ { element : 'font', attributes : { 'face' : null } } ]
};
/**
* The list of fonts size to be displayed in the Font Size combo in the
* toolbar. Entries are separated by semi-colons (;).
*
* Any kind of "CSS like" size can be used, like "12px", "2.3em", "130%",
* "larger" or "x-small".
*
* A display name may be optionally defined by prefixing the entries with the
* name and the slash character. For example, "Bigger Font/14px" will be
* displayed as "Bigger Font" in the list, but will be outputted as "14px".
* @type String
* @default '8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px'
* @example
* config.fontSize_sizes = '16/16px;24/24px;48/48px;';
* @example
* config.fontSize_sizes = '12px;2.3em;130%;larger;x-small';
* @example
* config.fontSize_sizes = '12 Pixels/12px;Big/2.3em;30 Percent More/130%;Bigger/larger;Very Small/x-small';
*/
CKEDITOR.config.fontSize_sizes =
'8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px';
/**
* The text to be displayed in the Font Size combo is none of the available
* values matches the current cursor position or text selection.
* @type String
* @example
* // If the default site font size is 12px, we may making it more explicit to the end user.
* config.fontSize_defaultLabel = '12px';
*/
CKEDITOR.config.fontSize_defaultLabel = '';
/**
* The style definition to be used to apply the font size in the text.
* @type Object
* @example
* // This is actually the default value for it.
* config.fontSize_style =
* {
* element : 'span',
* styles : { 'font-size' : '#(size)' },
* overrides : [ { element : 'font', attributes : { 'size' : null } } ]
* };
*/
CKEDITOR.config.fontSize_style =
{
element : 'span',
styles : { 'font-size' : '#(size)' },
overrides : [ { element : 'font', attributes : { 'size' : null } } ]
};
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" dialog, dialog content and dialog button
* definition classes.
*/
/**
* The definition of a dialog window.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create dialogs.
* </div>
* @name CKEDITOR.dialog.definition
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* CKEDITOR.dialog.add( 'testOnly', function( editor )
* {
* return {
* title : 'Test Dialog',
* resizable : CKEDITOR.DIALOG_RESIZE_BOTH,
* minWidth : 500,
* minHeight : 400,
* contents : [
* {
* id : 'tab1',
* label : 'First Tab',
* title : 'First Tab Title',
* accessKey : 'Q',
* elements : [
* {
* type : 'text',
* label : 'Test Text 1',
* id : 'testText1',
* 'default' : 'hello world!'
* }
* ]
* }
* ]
* };
* });
*/
/**
* The dialog title, displayed in the dialog's header. Required.
* @name CKEDITOR.dialog.definition.prototype.title
* @field
* @type String
* @example
*/
/**
* How the dialog can be resized, must be one of the four contents defined below.
* <br /><br />
* <strong>CKEDITOR.DIALOG_RESIZE_NONE</strong><br />
* <strong>CKEDITOR.DIALOG_RESIZE_WIDTH</strong><br />
* <strong>CKEDITOR.DIALOG_RESIZE_HEIGHT</strong><br />
* <strong>CKEDITOR.DIALOG_RESIZE_BOTH</strong><br />
* @name CKEDITOR.dialog.definition.prototype.resizable
* @field
* @type Number
* @default CKEDITOR.DIALOG_RESIZE_NONE
* @example
*/
/**
* The minimum width of the dialog, in pixels.
* @name CKEDITOR.dialog.definition.prototype.minWidth
* @field
* @type Number
* @default 600
* @example
*/
/**
* The minimum height of the dialog, in pixels.
* @name CKEDITOR.dialog.definition.prototype.minHeight
* @field
* @type Number
* @default 400
* @example
*/
/**
* The initial width of the dialog, in pixels.
* @name CKEDITOR.dialog.definition.prototype.width
* @field
* @type Number
* @default @CKEDITOR.dialog.definition.prototype.minWidth
* @since 3.5.3
* @example
*/
/**
* The initial height of the dialog, in pixels.
* @name CKEDITOR.dialog.definition.prototype.height
* @field
* @type Number
* @default @CKEDITOR.dialog.definition.prototype.minHeight
* @since 3.5.3
* @example
*/
/**
* The buttons in the dialog, defined as an array of
* {@link CKEDITOR.dialog.definition.button} objects.
* @name CKEDITOR.dialog.definition.prototype.buttons
* @field
* @type Array
* @default [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ]
* @example
*/
/**
* The contents in the dialog, defined as an array of
* {@link CKEDITOR.dialog.definition.content} objects. Required.
* @name CKEDITOR.dialog.definition.prototype.contents
* @field
* @type Array
* @example
*/
/**
* The function to execute when OK is pressed.
* @name CKEDITOR.dialog.definition.prototype.onOk
* @field
* @type Function
* @example
*/
/**
* The function to execute when Cancel is pressed.
* @name CKEDITOR.dialog.definition.prototype.onCancel
* @field
* @type Function
* @example
*/
/**
* The function to execute when the dialog is displayed for the first time.
* @name CKEDITOR.dialog.definition.prototype.onLoad
* @field
* @type Function
* @example
*/
/**
* The function to execute when the dialog is loaded (executed every time the dialog is opened).
* @name CKEDITOR.dialog.definition.prototype.onShow
* @field
* @type Function
* @example
*/
/**
* <div class="notapi">This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create dialog content pages.</div>
* @name CKEDITOR.dialog.definition.content
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*/
/**
* The id of the content page.
* @name CKEDITOR.dialog.definition.content.prototype.id
* @field
* @type String
* @example
*/
/**
* The tab label of the content page.
* @name CKEDITOR.dialog.definition.content.prototype.label
* @field
* @type String
* @example
*/
/**
* The popup message of the tab label.
* @name CKEDITOR.dialog.definition.content.prototype.title
* @field
* @type String
* @example
*/
/**
* The CTRL hotkey for switching to the tab.
* @name CKEDITOR.dialog.definition.content.prototype.accessKey
* @field
* @type String
* @example
* contentDefinition.accessKey = 'Q'; // Switch to this page when CTRL-Q is pressed.
*/
/**
* The UI elements contained in this content page, defined as an array of
* {@link CKEDITOR.dialog.definition.uiElement} objects.
* @name CKEDITOR.dialog.definition.content.prototype.elements
* @field
* @type Array
* @example
*/
/**
* The definition of user interface element (textarea, radio etc).
* <div class="notapi">This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create dialog UI elements.</div>
* @name CKEDITOR.dialog.definition.uiElement
* @constructor
* @see CKEDITOR.ui.dialog.uiElement
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*/
/**
* The id of the UI element.
* @name CKEDITOR.dialog.definition.uiElement.prototype.id
* @field
* @type String
* @example
*/
/**
* The type of the UI element. Required.
* @name CKEDITOR.dialog.definition.uiElement.prototype.type
* @field
* @type String
* @example
*/
/**
* The popup label of the UI element.
* @name CKEDITOR.dialog.definition.uiElement.prototype.title
* @field
* @type String
* @example
*/
/**
* CSS class names to append to the UI element.
* @name CKEDITOR.dialog.definition.uiElement.prototype.className
* @field
* @type String
* @example
*/
/**
* Inline CSS classes to append to the UI element.
* @name CKEDITOR.dialog.definition.uiElement.prototype.style
* @field
* @type String
* @example
*/
/**
* Horizontal alignment (in container) of the UI element.
* @name CKEDITOR.dialog.definition.uiElement.prototype.align
* @field
* @type String
* @example
*/
/**
* Function to execute the first time the UI element is displayed.
* @name CKEDITOR.dialog.definition.uiElement.prototype.onLoad
* @field
* @type Function
* @example
*/
/**
* Function to execute whenever the UI element's parent dialog is displayed.
* @name CKEDITOR.dialog.definition.uiElement.prototype.onShow
* @field
* @type Function
* @example
*/
/**
* Function to execute whenever the UI element's parent dialog is closed.
* @name CKEDITOR.dialog.definition.uiElement.prototype.onHide
* @field
* @type Function
* @example
*/
/**
* Function to execute whenever the UI element's parent dialog's {@link CKEDITOR.dialog.definition.setupContent} method is executed.
* It usually takes care of the respective UI element as a standalone element.
* @name CKEDITOR.dialog.definition.uiElement.prototype.setup
* @field
* @type Function
* @example
*/
/**
* Function to execute whenever the UI element's parent dialog's {@link CKEDITOR.dialog.definition.commitContent} method is executed.
* It usually takes care of the respective UI element as a standalone element.
* @name CKEDITOR.dialog.definition.uiElement.prototype.commit
* @field
* @type Function
* @example
*/
// ----- hbox -----
/**
* Horizontal layout box for dialog UI elements, auto-expends to available width of container.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create horizontal layouts.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.hbox} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* @name CKEDITOR.dialog.definition.hbox
* @extends CKEDITOR.dialog.definition.uiElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* <b>type : 'hbox',</b>
* widths : [ '25%', '25%', '50%' ],
* children :
* [
* {
* type : 'text',
* id : 'id1',
* width : '40px',
* },
* {
* type : 'text',
* id : 'id2',
* width : '40px',
* },
* {
* type : 'text',
* id : 'id3'
* }
* ]
* }
*/
/**
* Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this container.
* @name CKEDITOR.dialog.definition.hbox.prototype.children
* @field
* @type Array
* @example
*/
/**
* (Optional) The widths of child cells.
* @name CKEDITOR.dialog.definition.hbox.prototype.widths
* @field
* @type Array
* @example
*/
/**
* (Optional) The height of the layout.
* @name CKEDITOR.dialog.definition.hbox.prototype.height
* @field
* @type Number
* @example
*/
/**
* The CSS styles to apply to this element.
* @name CKEDITOR.dialog.definition.hbox.prototype.styles
* @field
* @type String
* @example
*/
/**
* (Optional) The padding width inside child cells. Example: 0, 1.
* @name CKEDITOR.dialog.definition.hbox.prototype.padding
* @field
* @type Number
* @example
*/
/**
* (Optional) The alignment of the whole layout. Example: center, top.
* @name CKEDITOR.dialog.definition.hbox.prototype.align
* @field
* @type String
* @example
*/
// ----- vbox -----
/**
* Vertical layout box for dialog UI elements.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create vertical layouts.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.vbox} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* <style type="text/css">.details .detailList {display:none;} </style>
* @name CKEDITOR.dialog.definition.vbox
* @extends CKEDITOR.dialog.definition.uiElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* <b>type : 'vbox',</b>
* align : 'right',
* width : '200px',
* children :
* [
* {
* type : 'text',
* id : 'age',
* label : 'Age'
* },
* {
* type : 'text',
* id : 'sex',
* label : 'Sex'
* },
* {
* type : 'text',
* id : 'nationality',
* label : 'Nationality'
* }
* ]
* }
*/
/**
* Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this container.
* @name CKEDITOR.dialog.definition.vbox.prototype.children
* @field
* @type Array
* @example
*/
/**
* (Optional) The width of the layout.
* @name CKEDITOR.dialog.definition.vbox.prototype.width
* @field
* @type Array
* @example
*/
/**
* (Optional) The heights of individual cells.
* @name CKEDITOR.dialog.definition.vbox.prototype.heights
* @field
* @type Number
* @example
*/
/**
* The CSS styles to apply to this element.
* @name CKEDITOR.dialog.definition.vbox.prototype.styles
* @field
* @type String
* @example
*/
/**
* (Optional) The padding width inside child cells. Example: 0, 1.
* @name CKEDITOR.dialog.definition.vbox.prototype.padding
* @field
* @type Number
* @example
*/
/**
* (Optional) The alignment of the whole layout. Example: center, top.
* @name CKEDITOR.dialog.definition.vbox.prototype.align
* @field
* @type String
* @example
*/
/**
* (Optional) Whether the layout should expand vertically to fill its container.
* @name CKEDITOR.dialog.definition.vbox.prototype.expand
* @field
* @type Boolean
* @example
*/
// ----- labeled element ------
/**
* The definition of labeled user interface element (textarea, textInput etc).
* <div class="notapi">This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create dialog UI elements.</div>
* @name CKEDITOR.dialog.definition.labeledElement
* @extends CKEDITOR.dialog.definition.uiElement
* @constructor
* @see CKEDITOR.ui.dialog.labeledElement
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*/
/**
* The label of the UI element.
* @name CKEDITOR.dialog.definition.labeledElement.prototype.label
* @type String
* @field
* @example
* {
* type : 'text',
* label : 'My Label '
* }
*/
/**
* (Optional) Specify the layout of the label. Set to 'horizontal' for horizontal layout.
* The default layout is vertical.
* @name CKEDITOR.dialog.definition.labeledElement.prototype.labelLayout
* @type String
* @field
* @example
* {
* type : 'text',
* label : 'My Label ',
* <strong> labelLayout : 'horizontal',</strong>
* }
*/
/**
* (Optional) Applies only to horizontal layouts: a two elements array of lengths to specify the widths of the
* label and the content element. See also {@link CKEDITOR.dialog.definition.labeledElement#labelLayout}.
* @name CKEDITOR.dialog.definition.labeledElement.prototype.widths
* @type Array
* @field
* @example
* {
* type : 'text',
* label : 'My Label ',
* labelLayout : 'horizontal',
* <strong> widths : [100, 200],</strong>
* }
*/
/**
* Specify the inline style of the uiElement label.
* @name CKEDITOR.dialog.definition.labeledElement.prototype.labelStyle
* @type String
* @field
* @example
* {
* type : 'text',
* label : 'My Label ',
* <strong> labelStyle : 'color: red',</strong>
* }
*/
/**
* Specify the inline style of the input element.
* @name CKEDITOR.dialog.definition.labeledElement.prototype.inputStyle
* @type String
* @since 3.6.1
* @field
* @example
* {
* type : 'text',
* label : 'My Label ',
* <strong> inputStyle : 'text-align:center',</strong>
* }
*/
/**
* Specify the inline style of the input element container .
* @name CKEDITOR.dialog.definition.labeledElement.prototype.controlStyle
* @type String
* @since 3.6.1
* @field
* @example
* {
* type : 'text',
* label : 'My Label ',
* <strong> controlStyle : 'width:3em',</strong>
* }
*/
// ----- button ------
/**
* The definition of a button.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create buttons.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.button} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.
* @name CKEDITOR.dialog.definition.button
* @extends CKEDITOR.dialog.definition.uiElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* <b>type : 'button',</b>
* id : 'buttonId',
* label : 'Click me',
* title : 'My title',
* onClick : function() {
* // this = CKEDITOR.ui.dialog.button
* alert( 'Clicked: ' + this.id );
* }
* }
*/
/**
* Whether the button is disabled.
* @name CKEDITOR.dialog.definition.button.prototype.disabled
* @type Boolean
* @field
* @example
*/
/**
* The label of the UI element.
* @name CKEDITOR.dialog.definition.button.prototype.label
* @type String
* @field
* @example
*/
// ----- checkbox ------
/**
* The definition of a checkbox element.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create groups of checkbox buttons.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.checkbox} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.
* @name CKEDITOR.dialog.definition.checkbox
* @extends CKEDITOR.dialog.definition.uiElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* <b>type : 'checkbox',</b>
* id : 'agree',
* label : 'I agree',
* 'default' : 'checked',
* onClick : function() {
* // this = CKEDITOR.ui.dialog.checkbox
* alert( 'Checked: ' + this.getValue() );
* }
* }
*/
/**
* (Optional) The validation function.
* @name CKEDITOR.dialog.definition.checkbox.prototype.validate
* @field
* @type Function
* @example
*/
/**
* The label of the UI element.
* @name CKEDITOR.dialog.definition.checkbox.prototype.label
* @type String
* @field
* @example
*/
/**
* The default state.
* @name CKEDITOR.dialog.definition.checkbox.prototype.default
* @type String
* @field
* @default
* '' (unchecked)
* @example
*/
// ----- file -----
/**
* The definition of a file upload input.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create file upload elements.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.file} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.
* @name CKEDITOR.dialog.definition.file
* @extends CKEDITOR.dialog.definition.labeledElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* <b>type : 'file'</b>,
* id : 'upload',
* label : 'Select file from your computer',
* size : 38
* },
* {
* type : 'fileButton',
* id : 'fileId',
* label : 'Upload file',
* 'for' : [ 'tab1', 'upload' ]
* filebrowser : {
* onSelect : function( fileUrl, data ) {
* alert( 'Successfully uploaded: ' + fileUrl );
* }
* }
* }
*/
/**
* (Optional) The validation function.
* @name CKEDITOR.dialog.definition.file.prototype.validate
* @field
* @type Function
* @example
*/
/**
* (Optional) The action attribute of the form element associated with this file upload input.
* If empty, CKEditor will use path to server connector for currently opened folder.
* @name CKEDITOR.dialog.definition.file.prototype.action
* @type String
* @field
* @example
*/
/**
* The size of the UI element.
* @name CKEDITOR.dialog.definition.file.prototype.size
* @type Number
* @field
* @example
*/
// ----- fileButton -----
/**
* The definition of a button for submitting the file in a file upload input.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create a button for submitting the file in a file upload input.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.fileButton} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.
* @name CKEDITOR.dialog.definition.fileButton
* @extends CKEDITOR.dialog.definition.uiElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* type : 'file',
* id : 'upload',
* label : 'Select file from your computer',
* size : 38
* },
* {
* <b>type : 'fileButton'</b>,
* id : 'fileId',
* label : 'Upload file',
* 'for' : [ 'tab1', 'upload' ]
* filebrowser : {
* onSelect : function( fileUrl, data ) {
* alert( 'Successfully uploaded: ' + fileUrl );
* }
* }
* }
*/
/**
* (Optional) The validation function.
* @name CKEDITOR.dialog.definition.fileButton.prototype.validate
* @field
* @type Function
* @example
*/
/**
* The label of the UI element.
* @name CKEDITOR.dialog.definition.fileButton.prototype.label
* @type String
* @field
* @example
*/
/**
* The instruction for CKEditor how to deal with file upload.
* By default, the file and fileButton elements will not work "as expected" if this attribute is not set.
* @name CKEDITOR.dialog.definition.fileButton.prototype.filebrowser
* @type String|Object
* @field
* @example
* // Update field with id 'txtUrl' in the 'tab1' tab when file is uploaded.
* filebrowser : 'tab1:txtUrl'
*
* // Call custom onSelect function when file is successfully uploaded.
* filebrowser : {
* onSelect : function( fileUrl, data ) {
* alert( 'Successfully uploaded: ' + fileUrl );
* }
* }
*/
/**
* An array that contains pageId and elementId of the file upload input element for which this button is created.
* @name CKEDITOR.dialog.definition.fileButton.prototype.for
* @type String
* @field
* @example
* [ pageId, elementId ]
*/
// ----- html -----
/**
* The definition of a raw HTML element.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create elements made from raw HTML code.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.html} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.<br />
* To access HTML elements use {@link CKEDITOR.dom.document#getById}
* @name CKEDITOR.dialog.definition.html
* @extends CKEDITOR.dialog.definition.uiElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example 1:
* {
* <b>type : 'html',</b>
* html : '<h3>This is some sample HTML content.</h3>'
* }
* @example
* // Example 2:
* // Complete sample with document.getById() call when the "Ok" button is clicked.
* var dialogDefinition =
* {
* title : 'Sample dialog',
* minWidth : 300,
* minHeight : 200,
* onOk : function() {
* // "this" is now a CKEDITOR.dialog object.
* var document = this.getElement().getDocument();
* // document = CKEDITOR.dom.document
* var element = <b>document.getById( 'myDiv' );</b>
* if ( element )
* alert( element.getHtml() );
* },
* contents : [
* {
* id : 'tab1',
* label : '',
* title : '',
* elements :
* [
* {
* <b>type : 'html',</b>
* html : '<b><div id="myDiv">Sample <b>text</b>.</div></b><div id="otherId">Another div.</div>'
* },
* ]
* }
* ],
* buttons : [ CKEDITOR.dialog.cancelButton, CKEDITOR.dialog.okButton ]
* };
*/
/**
* (Required) HTML code of this element.
* @name CKEDITOR.dialog.definition.html.prototype.html
* @type String
* @field
* @example
*/
// ----- radio ------
/**
* The definition of a radio group.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create groups of radio buttons.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.radio} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.
* @name CKEDITOR.dialog.definition.radio
* @extends CKEDITOR.dialog.definition.labeledElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* <b>type : 'radio',</b>
* id : 'country',
* label : 'Which country is bigger',
* items : [ [ 'France', 'FR' ], [ 'Germany', 'DE' ] ] ,
* style : 'color:green',
* 'default' : 'DE',
* onClick : function() {
* // this = CKEDITOR.ui.dialog.radio
* alert( 'Current value: ' + this.getValue() );
* }
* }
*/
/**
* The default value.
* @name CKEDITOR.dialog.definition.radio.prototype.default
* @type String
* @field
* @example
*/
/**
* (Optional) The validation function.
* @name CKEDITOR.dialog.definition.radio.prototype.validate
* @field
* @type Function
* @example
*/
/**
* An array of options. Each option is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value' is missing, then the value would be assumed to be the same as the description.
* @name CKEDITOR.dialog.definition.radio.prototype.items
* @field
* @type Array
* @example
*/
// ----- selectElement ------
/**
* The definition of a select element.
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create select elements.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.select} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.
* @name CKEDITOR.dialog.definition.select
* @extends CKEDITOR.dialog.definition.labeledElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* <b>type : 'select',</b>
* id : 'sport',
* label : 'Select your favourite sport',
* items : [ [ 'Basketball' ], [ 'Baseball' ], [ 'Hockey' ], [ 'Football' ] ],
* 'default' : 'Football',
* onChange : function( api ) {
* // this = CKEDITOR.ui.dialog.select
* alert( 'Current value: ' + this.getValue() );
* }
* }
*/
/**
* The default value.
* @name CKEDITOR.dialog.definition.select.prototype.default
* @type String
* @field
* @example
*/
/**
* (Optional) The validation function.
* @name CKEDITOR.dialog.definition.select.prototype.validate
* @field
* @type Function
* @example
*/
/**
* An array of options. Each option is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value' is missing, then the value would be assumed to be the same as the description.
* @name CKEDITOR.dialog.definition.select.prototype.items
* @field
* @type Array
* @example
*/
/**
* (Optional) Set this to true if you'd like to have a multiple-choice select box.
* @name CKEDITOR.dialog.definition.select.prototype.multiple
* @type Boolean
* @field
* @example
* @default false
*/
/**
* (Optional) The number of items to display in the select box.
* @name CKEDITOR.dialog.definition.select.prototype.size
* @type Number
* @field
* @example
*/
// ----- textInput -----
/**
* The definition of a text field (single line).
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create text fields.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.textInput} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.
* @name CKEDITOR.dialog.definition.textInput
* @extends CKEDITOR.dialog.definition.labeledElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* {
* <b>type : 'text',</b>
* id : 'name',
* label : 'Your name',
* 'default' : '',
* validate : function() {
* if ( !this.getValue() )
* {
* api.openMsgDialog( '', 'Name cannot be empty.' );
* return false;
* }
* }
* }
*/
/**
* The default value.
* @name CKEDITOR.dialog.definition.textInput.prototype.default
* @type String
* @field
* @example
*/
/**
* (Optional) The maximum length.
* @name CKEDITOR.dialog.definition.textInput.prototype.maxLength
* @type Number
* @field
* @example
*/
/**
* (Optional) The size of the input field.
* @name CKEDITOR.dialog.definition.textInput.prototype.size
* @type Number
* @field
* @example
*/
/**
* (Optional) The validation function.
* @name CKEDITOR.dialog.definition.textInput.prototype.validate
* @field
* @type Function
* @example
*/
// ----- textarea ------
/**
* The definition of a text field (multiple lines).
* <div class="notapi">
* This class is not really part of the API. It just illustrates the properties
* that developers can use to define and create textarea.
* <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.textarea} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
* </div>
* For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.
* @name CKEDITOR.dialog.definition.textarea
* @extends CKEDITOR.dialog.definition.labeledElement
* @constructor
* @example
* // There is no constructor for this class, the user just has to define an
* // object with the appropriate properties.
*
* // Example:
* {
* <b>type : 'textarea',</b>
* id : 'message',
* label : 'Your comment',
* 'default' : '',
* validate : function() {
* if ( this.getValue().length < 5 )
* {
* api.openMsgDialog( 'The comment is too short.' );
* return false;
* }
* }
* }
*/
/**
* The number of rows.
* @name CKEDITOR.dialog.definition.textarea.prototype.rows
* @type Number
* @field
* @example
*/
/**
* The number of columns.
* @name CKEDITOR.dialog.definition.textarea.prototype.cols
* @type Number
* @field
* @example
*/
/**
* (Optional) The validation function.
* @name CKEDITOR.dialog.definition.textarea.prototype.validate
* @field
* @type Function
* @example
*/
/**
* The default value.
* @name CKEDITOR.dialog.definition.textarea.prototype.default
* @type String
* @field
* @example
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview The floating dialog plugin.
*/
/**
* No resize for this dialog.
* @constant
*/
CKEDITOR.DIALOG_RESIZE_NONE = 0;
/**
* Only allow horizontal resizing for this dialog, disable vertical resizing.
* @constant
*/
CKEDITOR.DIALOG_RESIZE_WIDTH = 1;
/**
* Only allow vertical resizing for this dialog, disable horizontal resizing.
* @constant
*/
CKEDITOR.DIALOG_RESIZE_HEIGHT = 2;
/*
* Allow the dialog to be resized in both directions.
* @constant
*/
CKEDITOR.DIALOG_RESIZE_BOTH = 3;
(function()
{
var cssLength = CKEDITOR.tools.cssLength;
function isTabVisible( tabId )
{
return !!this._.tabs[ tabId ][ 0 ].$.offsetHeight;
}
function getPreviousVisibleTab()
{
var tabId = this._.currentTabId,
length = this._.tabIdList.length,
tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ) + length;
for ( var i = tabIndex - 1 ; i > tabIndex - length ; i-- )
{
if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) )
return this._.tabIdList[ i % length ];
}
return null;
}
function getNextVisibleTab()
{
var tabId = this._.currentTabId,
length = this._.tabIdList.length,
tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId );
for ( var i = tabIndex + 1 ; i < tabIndex + length ; i++ )
{
if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) )
return this._.tabIdList[ i % length ];
}
return null;
}
function clearOrRecoverTextInputValue( container, isRecover )
{
var inputs = container.$.getElementsByTagName( 'input' );
for ( var i = 0, length = inputs.length; i < length ; i++ )
{
var item = new CKEDITOR.dom.element( inputs[ i ] );
if ( item.getAttribute( 'type' ).toLowerCase() == 'text' )
{
if ( isRecover )
{
item.setAttribute( 'value', item.getCustomData( 'fake_value' ) || '' );
item.removeCustomData( 'fake_value' );
}
else
{
item.setCustomData( 'fake_value', item.getAttribute( 'value' ) );
item.setAttribute( 'value', '' );
}
}
}
}
// Handle dialog element validation state UI changes.
function handleFieldValidated( isValid, msg )
{
var input = this.getInputElement();
if ( input )
{
isValid ? input.removeAttribute( 'aria-invalid' )
: input.setAttribute( 'aria-invalid', true );
}
if ( !isValid )
{
if ( this.select )
this.select();
else
this.focus();
}
msg && alert( msg );
this.fire( 'validated', { valid : isValid, msg : msg } );
}
function resetField()
{
var input = this.getInputElement();
input && input.removeAttribute( 'aria-invalid' );
}
/**
* This is the base class for runtime dialog objects. An instance of this
* class represents a single named dialog for a single editor instance.
* @param {Object} editor The editor which created the dialog.
* @param {String} dialogName The dialog's registered name.
* @constructor
* @example
* var dialogObj = new CKEDITOR.dialog( editor, 'smiley' );
*/
CKEDITOR.dialog = function( editor, dialogName )
{
// Load the dialog definition.
var definition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
defaultDefinition = CKEDITOR.tools.clone( defaultDialogDefinition ),
buttonsOrder = editor.config.dialog_buttonsOrder || 'OS',
dir = editor.lang.dir,
tabsToRemove = {},
i,
processed;
if ( ( buttonsOrder == 'OS' && CKEDITOR.env.mac ) || // The buttons in MacOS Apps are in reverse order (#4750)
( buttonsOrder == 'rtl' && dir == 'ltr' ) ||
( buttonsOrder == 'ltr' && dir == 'rtl' ) )
defaultDefinition.buttons.reverse();
// Completes the definition with the default values.
definition = CKEDITOR.tools.extend( definition( editor ), defaultDefinition );
// Clone a functionally independent copy for this dialog.
definition = CKEDITOR.tools.clone( definition );
// Create a complex definition object, extending it with the API
// functions.
definition = new definitionObject( this, definition );
var doc = CKEDITOR.document;
var themeBuilt = editor.theme.buildDialog( editor );
// Initialize some basic parameters.
this._ =
{
editor : editor,
element : themeBuilt.element,
name : dialogName,
contentSize : { width : 0, height : 0 },
size : { width : 0, height : 0 },
contents : {},
buttons : {},
accessKeyMap : {},
// Initialize the tab and page map.
tabs : {},
tabIdList : [],
currentTabId : null,
currentTabIndex : null,
pageCount : 0,
lastTab : null,
tabBarMode : false,
// Initialize the tab order array for input widgets.
focusList : [],
currentFocusIndex : 0,
hasFocus : false
};
this.parts = themeBuilt.parts;
CKEDITOR.tools.setTimeout( function()
{
editor.fire( 'ariaWidget', this.parts.contents );
},
0, this );
// Set the startup styles for the dialog, avoiding it enlarging the
// page size on the dialog creation.
var startStyles = {
position : CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed',
top : 0,
visibility : 'hidden'
};
startStyles[ dir == 'rtl' ? 'right' : 'left' ] = 0;
this.parts.dialog.setStyles( startStyles );
// Call the CKEDITOR.event constructor to initialize this instance.
CKEDITOR.event.call( this );
// Fire the "dialogDefinition" event, making it possible to customize
// the dialog definition.
this.definition = definition = CKEDITOR.fire( 'dialogDefinition',
{
name : dialogName,
definition : definition
}
, editor ).definition;
// Cache tabs that should be removed.
if ( !( 'removeDialogTabs' in editor._ ) && editor.config.removeDialogTabs )
{
var removeContents = editor.config.removeDialogTabs.split( ';' );
for ( i = 0; i < removeContents.length; i++ )
{
var parts = removeContents[ i ].split( ':' );
if ( parts.length == 2 )
{
var removeDialogName = parts[ 0 ];
if ( !tabsToRemove[ removeDialogName ] )
tabsToRemove[ removeDialogName ] = [];
tabsToRemove[ removeDialogName ].push( parts[ 1 ] );
}
}
editor._.removeDialogTabs = tabsToRemove;
}
// Remove tabs of this dialog.
if ( editor._.removeDialogTabs && ( tabsToRemove = editor._.removeDialogTabs[ dialogName ] ) )
{
for ( i = 0; i < tabsToRemove.length; i++ )
definition.removeContents( tabsToRemove[ i ] );
}
// Initialize load, show, hide, ok and cancel events.
if ( definition.onLoad )
this.on( 'load', definition.onLoad );
if ( definition.onShow )
this.on( 'show', definition.onShow );
if ( definition.onHide )
this.on( 'hide', definition.onHide );
if ( definition.onOk )
{
this.on( 'ok', function( evt )
{
// Dialog confirm might probably introduce content changes (#5415).
editor.fire( 'saveSnapshot' );
setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 );
if ( definition.onOk.call( this, evt ) === false )
evt.data.hide = false;
});
}
if ( definition.onCancel )
{
this.on( 'cancel', function( evt )
{
if ( definition.onCancel.call( this, evt ) === false )
evt.data.hide = false;
});
}
var me = this;
// Iterates over all items inside all content in the dialog, calling a
// function for each of them.
var iterContents = function( func )
{
var contents = me._.contents,
stop = false;
for ( var i in contents )
{
for ( var j in contents[i] )
{
stop = func.call( this, contents[i][j] );
if ( stop )
return;
}
}
};
this.on( 'ok', function( evt )
{
iterContents( function( item )
{
if ( item.validate )
{
var retval = item.validate( this ),
invalid = typeof ( retval ) == 'string' || retval === false;
if ( invalid )
{
evt.data.hide = false;
evt.stop();
}
handleFieldValidated.call( item, !invalid, typeof retval == 'string' ? retval : undefined );
return invalid;
}
});
}, this, null, 0 );
this.on( 'cancel', function( evt )
{
iterContents( function( item )
{
if ( item.isChanged() )
{
if ( !confirm( editor.lang.common.confirmCancel ) )
evt.data.hide = false;
return true;
}
});
}, this, null, 0 );
this.parts.close.on( 'click', function( evt )
{
if ( this.fire( 'cancel', { hide : true } ).hide !== false )
this.hide();
evt.data.preventDefault();
}, this );
// Sort focus list according to tab order definitions.
function setupFocus()
{
var focusList = me._.focusList;
focusList.sort( function( a, b )
{
// Mimics browser tab order logics;
if ( a.tabIndex != b.tabIndex )
return b.tabIndex - a.tabIndex;
// Sort is not stable in some browsers,
// fall-back the comparator to 'focusIndex';
else
return a.focusIndex - b.focusIndex;
});
var size = focusList.length;
for ( var i = 0; i < size; i++ )
focusList[ i ].focusIndex = i;
}
function changeFocus( offset )
{
var focusList = me._.focusList;
offset = offset || 0;
if ( focusList.length < 1 )
return;
var current = me._.currentFocusIndex;
// Trigger the 'blur' event of any input element before anything,
// since certain UI updates may depend on it.
try
{
focusList[ current ].getInputElement().$.blur();
}
catch( e ){}
var startIndex = ( current + offset + focusList.length ) % focusList.length,
currentIndex = startIndex;
while ( offset && !focusList[ currentIndex ].isFocusable() )
{
currentIndex = ( currentIndex + offset + focusList.length ) % focusList.length;
if ( currentIndex == startIndex )
break;
}
focusList[ currentIndex ].focus();
// Select whole field content.
if ( focusList[ currentIndex ].type == 'text' )
focusList[ currentIndex ].select();
}
this.changeFocus = changeFocus;
function focusKeydownHandler( evt )
{
// If I'm not the top dialog, ignore.
if ( me != CKEDITOR.dialog._.currentTop )
return;
var keystroke = evt.data.getKeystroke(),
rtl = editor.lang.dir == 'rtl';
processed = 0;
if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 )
{
var shiftPressed = ( keystroke == CKEDITOR.SHIFT + 9 );
// Handling Tab and Shift-Tab.
if ( me._.tabBarMode )
{
// Change tabs.
var nextId = shiftPressed ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me );
me.selectPage( nextId );
me._.tabs[ nextId ][ 0 ].focus();
}
else
{
// Change the focus of inputs.
changeFocus( shiftPressed ? -1 : 1 );
}
processed = 1;
}
else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode && me.getPageCount() > 1 )
{
// Alt-F10 puts focus into the current tab item in the tab bar.
me._.tabBarMode = true;
me._.tabs[ me._.currentTabId ][ 0 ].focus();
processed = 1;
}
else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode )
{
// Arrow keys - used for changing tabs.
nextId = ( keystroke == ( rtl ? 39 : 37 ) ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) );
me.selectPage( nextId );
me._.tabs[ nextId ][ 0 ].focus();
processed = 1;
}
else if ( ( keystroke == 13 || keystroke == 32 ) && me._.tabBarMode )
{
this.selectPage( this._.currentTabId );
this._.tabBarMode = false;
this._.currentFocusIndex = -1;
changeFocus( 1 );
processed = 1;
}
if ( processed )
{
evt.stop();
evt.data.preventDefault();
}
}
function focusKeyPressHandler( evt )
{
processed && evt.data.preventDefault();
}
var dialogElement = this._.element;
// Add the dialog keyboard handlers.
this.on( 'show', function()
{
dialogElement.on( 'keydown', focusKeydownHandler, this, null, 0 );
// Some browsers instead, don't cancel key events in the keydown, but in the
// keypress. So we must do a longer trip in those cases. (#4531)
if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
dialogElement.on( 'keypress', focusKeyPressHandler, this );
} );
this.on( 'hide', function()
{
dialogElement.removeListener( 'keydown', focusKeydownHandler );
if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
dialogElement.removeListener( 'keypress', focusKeyPressHandler );
// Reset fields state when closing dialog.
iterContents( function( item ) { resetField.apply( item ); } );
} );
this.on( 'iframeAdded', function( evt )
{
var doc = new CKEDITOR.dom.document( evt.data.iframe.$.contentWindow.document );
doc.on( 'keydown', focusKeydownHandler, this, null, 0 );
} );
// Auto-focus logic in dialog.
this.on( 'show', function()
{
// Setup tabIndex on showing the dialog instead of on loading
// to allow dynamic tab order happen in dialog definition.
setupFocus();
if ( editor.config.dialog_startupFocusTab
&& me._.pageCount > 1 )
{
me._.tabBarMode = true;
me._.tabs[ me._.currentTabId ][ 0 ].focus();
}
else if ( !this._.hasFocus )
{
this._.currentFocusIndex = -1;
// Decide where to put the initial focus.
if ( definition.onFocus )
{
var initialFocus = definition.onFocus.call( this );
// Focus the field that the user specified.
initialFocus && initialFocus.focus();
}
// Focus the first field in layout order.
else
changeFocus( 1 );
/*
* IE BUG: If the initial focus went into a non-text element (e.g. button),
* then IE would still leave the caret inside the editing area.
*/
if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
{
var $selection = editor.document.$.selection,
$range = $selection.createRange();
if ( $range )
{
if ( $range.parentElement && $range.parentElement().ownerDocument == editor.document.$
|| $range.item && $range.item( 0 ).ownerDocument == editor.document.$ )
{
var $myRange = document.body.createTextRange();
$myRange.moveToElementText( this.getElement().getFirst().$ );
$myRange.collapse( true );
$myRange.select();
}
}
}
}
}, this, null, 0xffffffff );
// IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (#2661).
// This is still needed after [2708] and [2709] because text fields in hidden TR tags are still broken.
if ( CKEDITOR.env.ie6Compat )
{
this.on( 'load', function( evt )
{
var outer = this.getElement(),
inner = outer.getFirst();
inner.remove();
inner.appendTo( outer );
}, this );
}
initDragAndDrop( this );
initResizeHandles( this );
// Insert the title.
( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this.parts.title );
// Insert the tabs and contents.
for ( i = 0 ; i < definition.contents.length ; i++ )
{
var page = definition.contents[i];
page && this.addPage( page );
}
this.parts[ 'tabs' ].on( 'click', function( evt )
{
var target = evt.data.getTarget();
// If we aren't inside a tab, bail out.
if ( target.hasClass( 'cke_dialog_tab' ) )
{
// Get the ID of the tab, without the 'cke_' prefix and the unique number suffix.
var id = target.$.id;
this.selectPage( id.substring( 4, id.lastIndexOf( '_' ) ) );
if ( this._.tabBarMode )
{
this._.tabBarMode = false;
this._.currentFocusIndex = -1;
changeFocus( 1 );
}
evt.data.preventDefault();
}
}, this );
// Insert buttons.
var buttonsHtml = [],
buttons = CKEDITOR.dialog._.uiElementBuilders.hbox.build( this,
{
type : 'hbox',
className : 'cke_dialog_footer_buttons',
widths : [],
children : definition.buttons
}, buttonsHtml ).getChild();
this.parts.footer.setHtml( buttonsHtml.join( '' ) );
for ( i = 0 ; i < buttons.length ; i++ )
this._.buttons[ buttons[i].id ] = buttons[i];
};
// Focusable interface. Use it via dialog.addFocusable.
function Focusable( dialog, element, index )
{
this.element = element;
this.focusIndex = index;
// TODO: support tabIndex for focusables.
this.tabIndex = 0;
this.isFocusable = function()
{
return !element.getAttribute( 'disabled' ) && element.isVisible();
};
this.focus = function()
{
dialog._.currentFocusIndex = this.focusIndex;
this.element.focus();
};
// Bind events
element.on( 'keydown', function( e )
{
if ( e.data.getKeystroke() in { 32:1, 13:1 } )
this.fire( 'click' );
} );
element.on( 'focus', function()
{
this.fire( 'mouseover' );
} );
element.on( 'blur', function()
{
this.fire( 'mouseout' );
} );
}
CKEDITOR.dialog.prototype =
{
destroy : function()
{
this.hide();
this._.element.remove();
},
/**
* Resizes the dialog.
* @param {Number} width The width of the dialog in pixels.
* @param {Number} height The height of the dialog in pixels.
* @function
* @example
* dialogObj.resize( 800, 640 );
*/
resize : (function()
{
return function( width, height )
{
if ( this._.contentSize && this._.contentSize.width == width && this._.contentSize.height == height )
return;
CKEDITOR.dialog.fire( 'resize',
{
dialog : this,
skin : this._.editor.skinName,
width : width,
height : height
}, this._.editor );
this.fire( 'resize',
{
skin : this._.editor.skinName,
width : width,
height : height
}, this._.editor );
// Update dialog position when dimension get changed in RTL.
if ( this._.editor.lang.dir == 'rtl' && this._.position )
this._.position.x = CKEDITOR.document.getWindow().getViewPaneSize().width -
this._.contentSize.width - parseInt( this._.element.getFirst().getStyle( 'right' ), 10 );
this._.contentSize = { width : width, height : height };
};
})(),
/**
* Gets the current size of the dialog in pixels.
* @returns {Object} An object with "width" and "height" properties.
* @example
* var width = dialogObj.getSize().width;
*/
getSize : function()
{
var element = this._.element.getFirst();
return { width : element.$.offsetWidth || 0, height : element.$.offsetHeight || 0};
},
/**
* Moves the dialog to an (x, y) coordinate relative to the window.
* @function
* @param {Number} x The target x-coordinate.
* @param {Number} y The target y-coordinate.
* @param {Boolean} save Flag indicate whether the dialog position should be remembered on next open up.
* @example
* dialogObj.move( 10, 40 );
*/
move : (function()
{
var isFixed;
return function( x, y, save )
{
// The dialog may be fixed positioned or absolute positioned. Ask the
// browser what is the current situation first.
var element = this._.element.getFirst(),
rtl = this._.editor.lang.dir == 'rtl';
if ( isFixed === undefined )
isFixed = element.getComputedStyle( 'position' ) == 'fixed';
if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y )
return;
// Save the current position.
this._.position = { x : x, y : y };
// If not fixed positioned, add scroll position to the coordinates.
if ( !isFixed )
{
var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition();
x += scrollPosition.x;
y += scrollPosition.y;
}
// Translate coordinate for RTL.
if ( rtl )
{
var dialogSize = this.getSize(),
viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize();
x = viewPaneSize.width - dialogSize.width - x;
}
var styles = { 'top' : ( y > 0 ? y : 0 ) + 'px' };
styles[ rtl ? 'right' : 'left' ] = ( x > 0 ? x : 0 ) + 'px';
element.setStyles( styles );
save && ( this._.moved = 1 );
};
})(),
/**
* Gets the dialog's position in the window.
* @returns {Object} An object with "x" and "y" properties.
* @example
* var dialogX = dialogObj.getPosition().x;
*/
getPosition : function(){ return CKEDITOR.tools.extend( {}, this._.position ); },
/**
* Shows the dialog box.
* @example
* dialogObj.show();
*/
show : function()
{
// Insert the dialog's element to the root document.
var element = this._.element;
var definition = this.definition;
if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) )
element.appendTo( CKEDITOR.document.getBody() );
else
element.setStyle( 'display', 'block' );
// FIREFOX BUG: Fix vanishing caret for Firefox 2 or Gecko 1.8.
if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 )
{
var dialogElement = this.parts.dialog;
dialogElement.setStyle( 'position', 'absolute' );
setTimeout( function()
{
dialogElement.setStyle( 'position', 'fixed' );
}, 0 );
}
// First, set the dialog to an appropriate size.
this.resize( this._.contentSize && this._.contentSize.width || definition.width || definition.minWidth,
this._.contentSize && this._.contentSize.height || definition.height || definition.minHeight );
// Reset all inputs back to their default value.
this.reset();
// Select the first tab by default.
this.selectPage( this.definition.contents[0].id );
// Set z-index.
if ( CKEDITOR.dialog._.currentZIndex === null )
CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex;
this._.element.getFirst().setStyle( 'z-index', CKEDITOR.dialog._.currentZIndex += 10 );
// Maintain the dialog ordering and dialog cover.
if ( CKEDITOR.dialog._.currentTop === null )
{
CKEDITOR.dialog._.currentTop = this;
this._.parentDialog = null;
showCover( this._.editor );
}
else
{
this._.parentDialog = CKEDITOR.dialog._.currentTop;
var parentElement = this._.parentDialog.getElement().getFirst();
parentElement.$.style.zIndex -= Math.floor( this._.editor.config.baseFloatZIndex / 2 );
CKEDITOR.dialog._.currentTop = this;
}
element.on( 'keydown', accessKeyDownHandler );
element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler );
// Prevent some keys from bubbling up. (#4269)
for ( var event in { keyup :1, keydown :1, keypress :1 } )
element.on( event, preventKeyBubbling );
// Register the Esc hotkeys.
registerAccessKey( this, this, '\x1b', null, function()
{
var button = this.getButton( 'cancel' );
// If there's a Cancel button, click it, else just fire the cancel event and hide the dialog
if ( button )
button.click();
else
{
if ( this.fire( 'cancel', { hide : true } ).hide !== false )
this.hide();
}
} );
// Reset the hasFocus state.
this._.hasFocus = false;
CKEDITOR.tools.setTimeout( function()
{
this.layout();
this.parts.dialog.setStyle( 'visibility', '' );
// Execute onLoad for the first show.
this.fireOnce( 'load', {} );
CKEDITOR.ui.fire( 'ready', this );
this.fire( 'show', {} );
this._.editor.fire( 'dialogShow', this );
// Save the initial values of the dialog.
this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } );
},
100, this );
},
/**
* Rearrange the dialog to its previous position or the middle of the window.
* @since 3.5
*/
layout : function()
{
var viewSize = CKEDITOR.document.getWindow().getViewPaneSize(),
dialogSize = this.getSize();
this.move( this._.moved ? this._.position.x : ( viewSize.width - dialogSize.width ) / 2,
this._.moved ? this._.position.y : ( viewSize.height - dialogSize.height ) / 2 );
},
/**
* Executes a function for each UI element.
* @param {Function} fn Function to execute for each UI element.
* @returns {CKEDITOR.dialog} The current dialog object.
*/
foreach : function( fn )
{
for ( var i in this._.contents )
{
for ( var j in this._.contents[i] )
fn.call( this, this._.contents[i][j] );
}
return this;
},
/**
* Resets all input values in the dialog.
* @example
* dialogObj.reset();
* @returns {CKEDITOR.dialog} The current dialog object.
*/
reset : (function()
{
var fn = function( widget ){ if ( widget.reset ) widget.reset( 1 ); };
return function(){ this.foreach( fn ); return this; };
})(),
/**
* Calls the {@link CKEDITOR.dialog.definition.uiElement#setup} method of each of the UI elements, with the arguments passed through it.
* It is usually being called when the dialog is opened, to put the initial value inside the field.
* @example
* dialogObj.setupContent();
* @example
* var timestamp = ( new Date() ).valueOf();
* dialogObj.setupContent( timestamp );
*/
setupContent : function()
{
var args = arguments;
this.foreach( function( widget )
{
if ( widget.setup )
widget.setup.apply( widget, args );
});
},
/**
* Calls the {@link CKEDITOR.dialog.definition.uiElement#commit} method of each of the UI elements, with the arguments passed through it.
* It is usually being called when the user confirms the dialog, to process the values.
* @example
* dialogObj.commitContent();
* @example
* var timestamp = ( new Date() ).valueOf();
* dialogObj.commitContent( timestamp );
*/
commitContent : function()
{
var args = arguments;
this.foreach( function( widget )
{
// Make sure IE triggers "change" event on last focused input before closing the dialog. (#7915)
if ( CKEDITOR.env.ie && this._.currentFocusIndex == widget.focusIndex )
widget.getInputElement().$.blur();
if ( widget.commit )
widget.commit.apply( widget, args );
});
},
/**
* Hides the dialog box.
* @example
* dialogObj.hide();
*/
hide : function()
{
if ( !this.parts.dialog.isVisible() )
return;
this.fire( 'hide', {} );
this._.editor.fire( 'dialogHide', this );
var element = this._.element;
element.setStyle( 'display', 'none' );
this.parts.dialog.setStyle( 'visibility', 'hidden' );
// Unregister all access keys associated with this dialog.
unregisterAccessKey( this );
// Close any child(top) dialogs first.
while( CKEDITOR.dialog._.currentTop != this )
CKEDITOR.dialog._.currentTop.hide();
// Maintain dialog ordering and remove cover if needed.
if ( !this._.parentDialog )
hideCover();
else
{
var parentElement = this._.parentDialog.getElement().getFirst();
parentElement.setStyle( 'z-index', parseInt( parentElement.$.style.zIndex, 10 ) + Math.floor( this._.editor.config.baseFloatZIndex / 2 ) );
}
CKEDITOR.dialog._.currentTop = this._.parentDialog;
// Deduct or clear the z-index.
if ( !this._.parentDialog )
{
CKEDITOR.dialog._.currentZIndex = null;
// Remove access key handlers.
element.removeListener( 'keydown', accessKeyDownHandler );
element.removeListener( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler );
// Remove bubbling-prevention handler. (#4269)
for ( var event in { keyup :1, keydown :1, keypress :1 } )
element.removeListener( event, preventKeyBubbling );
var editor = this._.editor;
editor.focus();
if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
{
var selection = editor.getSelection();
selection && selection.unlock( true );
}
}
else
CKEDITOR.dialog._.currentZIndex -= 10;
delete this._.parentDialog;
// Reset the initial values of the dialog.
this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } );
},
/**
* Adds a tabbed page into the dialog.
* @param {Object} contents Content definition.
* @example
*/
addPage : function( contents )
{
var pageHtml = [],
titleHtml = contents.label ? ' title="' + CKEDITOR.tools.htmlEncode( contents.label ) + '"' : '',
elements = contents.elements,
vbox = CKEDITOR.dialog._.uiElementBuilders.vbox.build( this,
{
type : 'vbox',
className : 'cke_dialog_page_contents',
children : contents.elements,
expand : !!contents.expand,
padding : contents.padding,
style : contents.style || 'width: 100%;height:100%'
}, pageHtml );
// Create the HTML for the tab and the content block.
var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) );
page.setAttribute( 'role', 'tabpanel' );
var env = CKEDITOR.env;
var tabId = 'cke_' + contents.id + '_' + CKEDITOR.tools.getNextNumber(),
tab = CKEDITOR.dom.element.createFromHtml( [
'<a class="cke_dialog_tab"',
( this._.pageCount > 0 ? ' cke_last' : 'cke_first' ),
titleHtml,
( !!contents.hidden ? ' style="display:none"' : '' ),
' id="', tabId, '"',
env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(0)"',
' tabIndex="-1"',
' hidefocus="true"',
' role="tab">',
contents.label,
'</a>'
].join( '' ) );
page.setAttribute( 'aria-labelledby', tabId );
// Take records for the tabs and elements created.
this._.tabs[ contents.id ] = [ tab, page ];
this._.tabIdList.push( contents.id );
!contents.hidden && this._.pageCount++;
this._.lastTab = tab;
this.updateStyle();
var contentMap = this._.contents[ contents.id ] = {},
cursor,
children = vbox.getChild();
while ( ( cursor = children.shift() ) )
{
contentMap[ cursor.id ] = cursor;
if ( typeof( cursor.getChild ) == 'function' )
children.push.apply( children, cursor.getChild() );
}
// Attach the DOM nodes.
page.setAttribute( 'name', contents.id );
page.appendTo( this.parts.contents );
tab.unselectable();
this.parts.tabs.append( tab );
// Add access key handlers if access key is defined.
if ( contents.accessKey )
{
registerAccessKey( this, this, 'CTRL+' + contents.accessKey,
tabAccessKeyDown, tabAccessKeyUp );
this._.accessKeyMap[ 'CTRL+' + contents.accessKey ] = contents.id;
}
},
/**
* Activates a tab page in the dialog by its id.
* @param {String} id The id of the dialog tab to be activated.
* @example
* dialogObj.selectPage( 'tab_1' );
*/
selectPage : function( id )
{
if ( this._.currentTabId == id )
return;
// Returning true means that the event has been canceled
if ( this.fire( 'selectPage', { page : id, currentPage : this._.currentTabId } ) === true )
return;
// Hide the non-selected tabs and pages.
for ( var i in this._.tabs )
{
var tab = this._.tabs[i][0],
page = this._.tabs[i][1];
if ( i != id )
{
tab.removeClass( 'cke_dialog_tab_selected' );
page.hide();
}
page.setAttribute( 'aria-hidden', i != id );
}
var selected = this._.tabs[ id ];
selected[ 0 ].addClass( 'cke_dialog_tab_selected' );
// [IE] an invisible input[type='text'] will enlarge it's width
// if it's value is long when it shows, so we clear it's value
// before it shows and then recover it (#5649)
if ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat )
{
clearOrRecoverTextInputValue( selected[ 1 ] );
selected[ 1 ].show();
setTimeout( function()
{
clearOrRecoverTextInputValue( selected[ 1 ], 1 );
}, 0 );
}
else
selected[ 1 ].show();
this._.currentTabId = id;
this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id );
},
// Dialog state-specific style updates.
updateStyle : function()
{
// If only a single page shown, a different style is used in the central pane.
this.parts.dialog[ ( this._.pageCount === 1 ? 'add' : 'remove' ) + 'Class' ]( 'cke_single_page' );
},
/**
* Hides a page's tab away from the dialog.
* @param {String} id The page's Id.
* @example
* dialog.hidePage( 'tab_3' );
*/
hidePage : function( id )
{
var tab = this._.tabs[id] && this._.tabs[id][0];
if ( !tab || this._.pageCount == 1 || !tab.isVisible() )
return;
// Switch to other tab first when we're hiding the active tab.
else if ( id == this._.currentTabId )
this.selectPage( getPreviousVisibleTab.call( this ) );
tab.hide();
this._.pageCount--;
this.updateStyle();
},
/**
* Unhides a page's tab.
* @param {String} id The page's Id.
* @example
* dialog.showPage( 'tab_2' );
*/
showPage : function( id )
{
var tab = this._.tabs[id] && this._.tabs[id][0];
if ( !tab )
return;
tab.show();
this._.pageCount++;
this.updateStyle();
},
/**
* Gets the root DOM element of the dialog.
* @returns {CKEDITOR.dom.element} The <span> element containing this dialog.
* @example
* var dialogElement = dialogObj.getElement().getFirst();
* dialogElement.setStyle( 'padding', '5px' );
*/
getElement : function()
{
return this._.element;
},
/**
* Gets the name of the dialog.
* @returns {String} The name of this dialog.
* @example
* var dialogName = dialogObj.getName();
*/
getName : function()
{
return this._.name;
},
/**
* Gets a dialog UI element object from a dialog page.
* @param {String} pageId id of dialog page.
* @param {String} elementId id of UI element.
* @example
* dialogObj.getContentElement( 'tabId', 'elementId' ).setValue( 'Example' );
* @returns {CKEDITOR.ui.dialog.uiElement} The dialog UI element.
*/
getContentElement : function( pageId, elementId )
{
var page = this._.contents[ pageId ];
return page && page[ elementId ];
},
/**
* Gets the value of a dialog UI element.
* @param {String} pageId id of dialog page.
* @param {String} elementId id of UI element.
* @example
* alert( dialogObj.getValueOf( 'tabId', 'elementId' ) );
* @returns {Object} The value of the UI element.
*/
getValueOf : function( pageId, elementId )
{
return this.getContentElement( pageId, elementId ).getValue();
},
/**
* Sets the value of a dialog UI element.
* @param {String} pageId id of the dialog page.
* @param {String} elementId id of the UI element.
* @param {Object} value The new value of the UI element.
* @example
* dialogObj.setValueOf( 'tabId', 'elementId', 'Example' );
*/
setValueOf : function( pageId, elementId, value )
{
return this.getContentElement( pageId, elementId ).setValue( value );
},
/**
* Gets the UI element of a button in the dialog's button row.
* @param {String} id The id of the button.
* @example
* @returns {CKEDITOR.ui.dialog.button} The button object.
*/
getButton : function( id )
{
return this._.buttons[ id ];
},
/**
* Simulates a click to a dialog button in the dialog's button row.
* @param {String} id The id of the button.
* @example
* @returns The return value of the dialog's "click" event.
*/
click : function( id )
{
return this._.buttons[ id ].click();
},
/**
* Disables a dialog button.
* @param {String} id The id of the button.
* @example
*/
disableButton : function( id )
{
return this._.buttons[ id ].disable();
},
/**
* Enables a dialog button.
* @param {String} id The id of the button.
* @example
*/
enableButton : function( id )
{
return this._.buttons[ id ].enable();
},
/**
* Gets the number of pages in the dialog.
* @returns {Number} Page count.
*/
getPageCount : function()
{
return this._.pageCount;
},
/**
* Gets the editor instance which opened this dialog.
* @returns {CKEDITOR.editor} Parent editor instances.
*/
getParentEditor : function()
{
return this._.editor;
},
/**
* Gets the element that was selected when opening the dialog, if any.
* @returns {CKEDITOR.dom.element} The element that was selected, or null.
*/
getSelectedElement : function()
{
return this.getParentEditor().getSelection().getSelectedElement();
},
/**
* Adds element to dialog's focusable list.
*
* @param {CKEDITOR.dom.element} element
* @param {Number} [index]
*/
addFocusable: function( element, index ) {
if ( typeof index == 'undefined' )
{
index = this._.focusList.length;
this._.focusList.push( new Focusable( this, element, index ) );
}
else
{
this._.focusList.splice( index, 0, new Focusable( this, element, index ) );
for ( var i = index + 1 ; i < this._.focusList.length ; i++ )
this._.focusList[ i ].focusIndex++;
}
}
};
CKEDITOR.tools.extend( CKEDITOR.dialog,
/**
* @lends CKEDITOR.dialog
*/
{
/**
* Registers a dialog.
* @param {String} name The dialog's name.
* @param {Function|String} dialogDefinition
* A function returning the dialog's definition, or the URL to the .js file holding the function.
* The function should accept an argument "editor" which is the current editor instance, and
* return an object conforming to {@link CKEDITOR.dialog.definition}.
* @see CKEDITOR.dialog.definition
* @example
* // Full sample plugin, which does not only register a dialog window but also adds an item to the context menu.
* // To open the dialog window, choose "Open dialog" in the context menu.
* CKEDITOR.plugins.add( 'myplugin',
* {
* init: function( editor )
* {
* editor.addCommand( 'mydialog',new CKEDITOR.dialogCommand( 'mydialog' ) );
*
* if ( editor.contextMenu )
* {
* editor.addMenuGroup( 'mygroup', 10 );
* editor.addMenuItem( 'My Dialog',
* {
* label : 'Open dialog',
* command : 'mydialog',
* group : 'mygroup'
* });
* editor.contextMenu.addListener( function( element )
* {
* return { 'My Dialog' : CKEDITOR.TRISTATE_OFF };
* });
* }
*
* <strong>CKEDITOR.dialog.add</strong>( 'mydialog', function( api )
* {
* // CKEDITOR.dialog.definition
* var <strong>dialogDefinition</strong> =
* {
* title : 'Sample dialog',
* minWidth : 390,
* minHeight : 130,
* contents : [
* {
* id : 'tab1',
* label : 'Label',
* title : 'Title',
* expand : true,
* padding : 0,
* elements :
* [
* {
* type : 'html',
* html : '<p>This is some sample HTML content.</p>'
* },
* {
* type : 'textarea',
* id : 'textareaId',
* rows : 4,
* cols : 40
* }
* ]
* }
* ],
* buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ],
* onOk : function() {
* // "this" is now a CKEDITOR.dialog object.
* // Accessing dialog elements:
* var textareaObj = this.<strong>getContentElement</strong>( 'tab1', 'textareaId' );
* alert( "You have entered: " + textareaObj.getValue() );
* }
* };
*
* return dialogDefinition;
* } );
* }
* } );
*
* CKEDITOR.replace( 'editor1', { extraPlugins : 'myplugin' } );
*/
add : function( name, dialogDefinition )
{
// Avoid path registration from multiple instances override definition.
if ( !this._.dialogDefinitions[name]
|| typeof dialogDefinition == 'function' )
this._.dialogDefinitions[name] = dialogDefinition;
},
exists : function( name )
{
return !!this._.dialogDefinitions[ name ];
},
getCurrent : function()
{
return CKEDITOR.dialog._.currentTop;
},
/**
* The default OK button for dialogs. Fires the "ok" event and closes the dialog if the event succeeds.
* @static
* @field
* @example
* @type Function
*/
okButton : (function()
{
var retval = function( editor, override )
{
override = override || {};
return CKEDITOR.tools.extend( {
id : 'ok',
type : 'button',
label : editor.lang.common.ok,
'class' : 'cke_dialog_ui_button_ok',
onClick : function( evt )
{
var dialog = evt.data.dialog;
if ( dialog.fire( 'ok', { hide : true } ).hide !== false )
dialog.hide();
}
}, override, true );
};
retval.type = 'button';
retval.override = function( override )
{
return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); },
{ type : 'button' }, true );
};
return retval;
})(),
/**
* The default cancel button for dialogs. Fires the "cancel" event and closes the dialog if no UI element value changed.
* @static
* @field
* @example
* @type Function
*/
cancelButton : (function()
{
var retval = function( editor, override )
{
override = override || {};
return CKEDITOR.tools.extend( {
id : 'cancel',
type : 'button',
label : editor.lang.common.cancel,
'class' : 'cke_dialog_ui_button_cancel',
onClick : function( evt )
{
var dialog = evt.data.dialog;
if ( dialog.fire( 'cancel', { hide : true } ).hide !== false )
dialog.hide();
}
}, override, true );
};
retval.type = 'button';
retval.override = function( override )
{
return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); },
{ type : 'button' }, true );
};
return retval;
})(),
/**
* Registers a dialog UI element.
* @param {String} typeName The name of the UI element.
* @param {Function} builder The function to build the UI element.
* @example
*/
addUIElement : function( typeName, builder )
{
this._.uiElementBuilders[ typeName ] = builder;
}
});
CKEDITOR.dialog._ =
{
uiElementBuilders : {},
dialogDefinitions : {},
currentTop : null,
currentZIndex : null
};
// "Inherit" (copy actually) from CKEDITOR.event.
CKEDITOR.event.implementOn( CKEDITOR.dialog );
CKEDITOR.event.implementOn( CKEDITOR.dialog.prototype, true );
var defaultDialogDefinition =
{
resizable : CKEDITOR.DIALOG_RESIZE_BOTH,
minWidth : 600,
minHeight : 400,
buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ]
};
// Tool function used to return an item from an array based on its id
// property.
var getById = function( array, id, recurse )
{
for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
{
if ( item.id == id )
return item;
if ( recurse && item[ recurse ] )
{
var retval = getById( item[ recurse ], id, recurse ) ;
if ( retval )
return retval;
}
}
return null;
};
// Tool function used to add an item into an array.
var addById = function( array, newItem, nextSiblingId, recurse, nullIfNotFound )
{
if ( nextSiblingId )
{
for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
{
if ( item.id == nextSiblingId )
{
array.splice( i, 0, newItem );
return newItem;
}
if ( recurse && item[ recurse ] )
{
var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true );
if ( retval )
return retval;
}
}
if ( nullIfNotFound )
return null;
}
array.push( newItem );
return newItem;
};
// Tool function used to remove an item from an array based on its id.
var removeById = function( array, id, recurse )
{
for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
{
if ( item.id == id )
return array.splice( i, 1 );
if ( recurse && item[ recurse ] )
{
var retval = removeById( item[ recurse ], id, recurse );
if ( retval )
return retval;
}
}
return null;
};
/**
* This class is not really part of the API. It is the "definition" property value
* passed to "dialogDefinition" event handlers.
* @constructor
* @name CKEDITOR.dialog.definitionObject
* @extends CKEDITOR.dialog.definition
* @example
* CKEDITOR.on( 'dialogDefinition', function( evt )
* {
* var definition = evt.data.definition;
* var content = definition.getContents( 'page1' );
* ...
* } );
*/
var definitionObject = function( dialog, dialogDefinition )
{
// TODO : Check if needed.
this.dialog = dialog;
// Transform the contents entries in contentObjects.
var contents = dialogDefinition.contents;
for ( var i = 0, content ; ( content = contents[i] ) ; i++ )
contents[ i ] = content && new contentObject( dialog, content );
CKEDITOR.tools.extend( this, dialogDefinition );
};
definitionObject.prototype =
/** @lends CKEDITOR.dialog.definitionObject.prototype */
{
/**
* Gets a content definition.
* @param {String} id The id of the content definition.
* @returns {CKEDITOR.dialog.definition.content} The content definition
* matching id.
*/
getContents : function( id )
{
return getById( this.contents, id );
},
/**
* Gets a button definition.
* @param {String} id The id of the button definition.
* @returns {CKEDITOR.dialog.definition.button} The button definition
* matching id.
*/
getButton : function( id )
{
return getById( this.buttons, id );
},
/**
* Adds a content definition object under this dialog definition.
* @param {CKEDITOR.dialog.definition.content} contentDefinition The
* content definition.
* @param {String} [nextSiblingId] The id of an existing content
* definition which the new content definition will be inserted
* before. Omit if the new content definition is to be inserted as
* the last item.
* @returns {CKEDITOR.dialog.definition.content} The inserted content
* definition.
*/
addContents : function( contentDefinition, nextSiblingId )
{
return addById( this.contents, contentDefinition, nextSiblingId );
},
/**
* Adds a button definition object under this dialog definition.
* @param {CKEDITOR.dialog.definition.button} buttonDefinition The
* button definition.
* @param {String} [nextSiblingId] The id of an existing button
* definition which the new button definition will be inserted
* before. Omit if the new button definition is to be inserted as
* the last item.
* @returns {CKEDITOR.dialog.definition.button} The inserted button
* definition.
*/
addButton : function( buttonDefinition, nextSiblingId )
{
return addById( this.buttons, buttonDefinition, nextSiblingId );
},
/**
* Removes a content definition from this dialog definition.
* @param {String} id The id of the content definition to be removed.
* @returns {CKEDITOR.dialog.definition.content} The removed content
* definition.
*/
removeContents : function( id )
{
removeById( this.contents, id );
},
/**
* Removes a button definition from the dialog definition.
* @param {String} id The id of the button definition to be removed.
* @returns {CKEDITOR.dialog.definition.button} The removed button
* definition.
*/
removeButton : function( id )
{
removeById( this.buttons, id );
}
};
/**
* This class is not really part of the API. It is the template of the
* objects representing content pages inside the
* CKEDITOR.dialog.definitionObject.
* @constructor
* @name CKEDITOR.dialog.definition.contentObject
* @example
* CKEDITOR.on( 'dialogDefinition', function( evt )
* {
* var definition = evt.data.definition;
* var content = definition.getContents( 'page1' );
* content.remove( 'textInput1' );
* ...
* } );
*/
function contentObject( dialog, contentDefinition )
{
this._ =
{
dialog : dialog
};
CKEDITOR.tools.extend( this, contentDefinition );
}
contentObject.prototype =
/** @lends CKEDITOR.dialog.definition.contentObject.prototype */
{
/**
* Gets a UI element definition under the content definition.
* @param {String} id The id of the UI element definition.
* @returns {CKEDITOR.dialog.definition.uiElement}
*/
get : function( id )
{
return getById( this.elements, id, 'children' );
},
/**
* Adds a UI element definition to the content definition.
* @param {CKEDITOR.dialog.definition.uiElement} elementDefinition The
* UI elemnet definition to be added.
* @param {String} nextSiblingId The id of an existing UI element
* definition which the new UI element definition will be inserted
* before. Omit if the new button definition is to be inserted as
* the last item.
* @returns {CKEDITOR.dialog.definition.uiElement} The element
* definition inserted.
*/
add : function( elementDefinition, nextSiblingId )
{
return addById( this.elements, elementDefinition, nextSiblingId, 'children' );
},
/**
* Removes a UI element definition from the content definition.
* @param {String} id The id of the UI element definition to be
* removed.
* @returns {CKEDITOR.dialog.definition.uiElement} The element
* definition removed.
* @example
*/
remove : function( id )
{
removeById( this.elements, id, 'children' );
}
};
function initDragAndDrop( dialog )
{
var lastCoords = null,
abstractDialogCoords = null,
element = dialog.getElement().getFirst(),
editor = dialog.getParentEditor(),
magnetDistance = editor.config.dialog_magnetDistance,
margins = editor.skin.margins || [ 0, 0, 0, 0 ];
if ( typeof magnetDistance == 'undefined' )
magnetDistance = 20;
function mouseMoveHandler( evt )
{
var dialogSize = dialog.getSize(),
viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
x = evt.data.$.screenX,
y = evt.data.$.screenY,
dx = x - lastCoords.x,
dy = y - lastCoords.y,
realX, realY;
lastCoords = { x : x, y : y };
abstractDialogCoords.x += dx;
abstractDialogCoords.y += dy;
if ( abstractDialogCoords.x + margins[3] < magnetDistance )
realX = - margins[3];
else if ( abstractDialogCoords.x - margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance )
realX = viewPaneSize.width - dialogSize.width + ( editor.lang.dir == 'rtl' ? 0 : margins[1] );
else
realX = abstractDialogCoords.x;
if ( abstractDialogCoords.y + margins[0] < magnetDistance )
realY = - margins[0];
else if ( abstractDialogCoords.y - margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance )
realY = viewPaneSize.height - dialogSize.height + margins[2];
else
realY = abstractDialogCoords.y;
dialog.move( realX, realY, 1 );
evt.data.preventDefault();
}
function mouseUpHandler( evt )
{
CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
if ( CKEDITOR.env.ie6Compat )
{
var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
coverDoc.removeListener( 'mousemove', mouseMoveHandler );
coverDoc.removeListener( 'mouseup', mouseUpHandler );
}
}
dialog.parts.title.on( 'mousedown', function( evt )
{
lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
CKEDITOR.document.on( 'mouseup', mouseUpHandler );
abstractDialogCoords = dialog.getPosition();
if ( CKEDITOR.env.ie6Compat )
{
var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
coverDoc.on( 'mousemove', mouseMoveHandler );
coverDoc.on( 'mouseup', mouseUpHandler );
}
evt.data.preventDefault();
}, dialog );
}
function initResizeHandles( dialog )
{
var def = dialog.definition,
resizable = def.resizable;
if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE )
return;
var editor = dialog.getParentEditor();
var wrapperWidth, wrapperHeight,
viewSize, origin, startSize,
dialogCover;
var mouseDownFn = CKEDITOR.tools.addFunction( function( $event )
{
startSize = dialog.getSize();
var content = dialog.parts.contents,
iframeDialog = content.$.getElementsByTagName( 'iframe' ).length;
// Shim to help capturing "mousemove" over iframe.
if ( iframeDialog )
{
dialogCover = CKEDITOR.dom.element.createFromHtml( '<div class="cke_dialog_resize_cover" style="height: 100%; position: absolute; width: 100%;"></div>' );
content.append( dialogCover );
}
// Calculate the offset between content and chrome size.
wrapperHeight = startSize.height - dialog.parts.contents.getSize( 'height', ! ( CKEDITOR.env.gecko || CKEDITOR.env.opera || CKEDITOR.env.ie && CKEDITOR.env.quirks ) );
wrapperWidth = startSize.width - dialog.parts.contents.getSize( 'width', 1 );
origin = { x : $event.screenX, y : $event.screenY };
viewSize = CKEDITOR.document.getWindow().getViewPaneSize();
CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
CKEDITOR.document.on( 'mouseup', mouseUpHandler );
if ( CKEDITOR.env.ie6Compat )
{
var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
coverDoc.on( 'mousemove', mouseMoveHandler );
coverDoc.on( 'mouseup', mouseUpHandler );
}
$event.preventDefault && $event.preventDefault();
});
// Prepend the grip to the dialog.
dialog.on( 'load', function()
{
var direction = '';
if ( resizable == CKEDITOR.DIALOG_RESIZE_WIDTH )
direction = ' cke_resizer_horizontal';
else if ( resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT )
direction = ' cke_resizer_vertical';
var resizer = CKEDITOR.dom.element.createFromHtml( '<div' +
' class="cke_resizer' + direction + ' cke_resizer_' + editor.lang.dir + '"' +
' title="' + CKEDITOR.tools.htmlEncode( editor.lang.resize ) + '"' +
' onmousedown="CKEDITOR.tools.callFunction(' + mouseDownFn + ', event )"></div>' );
dialog.parts.footer.append( resizer, 1 );
});
editor.on( 'destroy', function() { CKEDITOR.tools.removeFunction( mouseDownFn ); } );
function mouseMoveHandler( evt )
{
var rtl = editor.lang.dir == 'rtl',
dx = ( evt.data.$.screenX - origin.x ) * ( rtl ? -1 : 1 ),
dy = evt.data.$.screenY - origin.y,
width = startSize.width,
height = startSize.height,
internalWidth = width + dx * ( dialog._.moved ? 1 : 2 ),
internalHeight = height + dy * ( dialog._.moved ? 1 : 2 ),
element = dialog._.element.getFirst(),
right = rtl && element.getComputedStyle( 'right' ),
position = dialog.getPosition();
if ( position.y + internalHeight > viewSize.height )
internalHeight = viewSize.height - position.y;
if ( ( rtl ? right : position.x ) + internalWidth > viewSize.width )
internalWidth = viewSize.width - ( rtl ? right : position.x );
// Make sure the dialog will not be resized to the wrong side when it's in the leftmost position for RTL.
if ( ( resizable == CKEDITOR.DIALOG_RESIZE_WIDTH || resizable == CKEDITOR.DIALOG_RESIZE_BOTH ) )
width = Math.max( def.minWidth || 0, internalWidth - wrapperWidth );
if ( resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT || resizable == CKEDITOR.DIALOG_RESIZE_BOTH )
height = Math.max( def.minHeight || 0, internalHeight - wrapperHeight );
dialog.resize( width, height );
if ( !dialog._.moved )
dialog.layout();
evt.data.preventDefault();
}
function mouseUpHandler()
{
CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
if ( dialogCover )
{
dialogCover.remove();
dialogCover = null;
}
if ( CKEDITOR.env.ie6Compat )
{
var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
coverDoc.removeListener( 'mouseup', mouseUpHandler );
coverDoc.removeListener( 'mousemove', mouseMoveHandler );
}
}
}
var resizeCover;
// Caching resuable covers and allowing only one cover
// on screen.
var covers = {},
currentCover;
function cancelEvent( ev )
{
ev.data.preventDefault(1);
}
function showCover( editor )
{
var win = CKEDITOR.document.getWindow();
var config = editor.config,
backgroundColorStyle = config.dialog_backgroundCoverColor || 'white',
backgroundCoverOpacity = config.dialog_backgroundCoverOpacity,
baseFloatZIndex = config.baseFloatZIndex,
coverKey = CKEDITOR.tools.genKey(
backgroundColorStyle,
backgroundCoverOpacity,
baseFloatZIndex ),
coverElement = covers[ coverKey ];
if ( !coverElement )
{
var html = [
'<div tabIndex="-1" style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ),
'; z-index: ', baseFloatZIndex,
'; top: 0px; left: 0px; ',
( !CKEDITOR.env.ie6Compat ? 'background-color: ' + backgroundColorStyle : '' ),
'" class="cke_dialog_background_cover">'
];
if ( CKEDITOR.env.ie6Compat )
{
// Support for custom document.domain in IE.
var isCustomDomain = CKEDITOR.env.isCustomDomain(),
iframeHtml = '<html><body style=\\\'background-color:' + backgroundColorStyle + ';\\\'></body></html>';
html.push(
'<iframe' +
' hidefocus="true"' +
' frameborder="0"' +
' id="cke_dialog_background_iframe"' +
' src="javascript:' );
html.push( 'void((function(){' +
'document.open();' +
( isCustomDomain ? 'document.domain=\'' + document.domain + '\';' : '' ) +
'document.write( \'' + iframeHtml + '\' );' +
'document.close();' +
'})())' );
html.push(
'"' +
' style="' +
'position:absolute;' +
'left:0;' +
'top:0;' +
'width:100%;' +
'height: 100%;' +
'progid:DXImageTransform.Microsoft.Alpha(opacity=0)">' +
'</iframe>' );
}
html.push( '</div>' );
coverElement = CKEDITOR.dom.element.createFromHtml( html.join( '' ) );
coverElement.setOpacity( backgroundCoverOpacity != undefined ? backgroundCoverOpacity : 0.5 );
coverElement.on( 'keydown', cancelEvent );
coverElement.on( 'keypress', cancelEvent );
coverElement.on( 'keyup', cancelEvent );
coverElement.appendTo( CKEDITOR.document.getBody() );
covers[ coverKey ] = coverElement;
}
else
coverElement. show();
currentCover = coverElement;
var resizeFunc = function()
{
var size = win.getViewPaneSize();
coverElement.setStyles(
{
width : size.width + 'px',
height : size.height + 'px'
} );
};
var scrollFunc = function()
{
var pos = win.getScrollPosition(),
cursor = CKEDITOR.dialog._.currentTop;
coverElement.setStyles(
{
left : pos.x + 'px',
top : pos.y + 'px'
});
if ( cursor )
{
do
{
var dialogPos = cursor.getPosition();
cursor.move( dialogPos.x, dialogPos.y );
} while ( ( cursor = cursor._.parentDialog ) );
}
};
resizeCover = resizeFunc;
win.on( 'resize', resizeFunc );
resizeFunc();
// Using Safari/Mac, focus must be kept where it is (#7027)
if ( !( CKEDITOR.env.mac && CKEDITOR.env.webkit ) )
coverElement.focus();
if ( CKEDITOR.env.ie6Compat )
{
// IE BUG: win.$.onscroll assignment doesn't work.. it must be window.onscroll.
// So we need to invent a really funny way to make it work.
var myScrollHandler = function()
{
scrollFunc();
arguments.callee.prevScrollHandler.apply( this, arguments );
};
win.$.setTimeout( function()
{
myScrollHandler.prevScrollHandler = window.onscroll || function(){};
window.onscroll = myScrollHandler;
}, 0 );
scrollFunc();
}
}
function hideCover()
{
if ( !currentCover )
return;
var win = CKEDITOR.document.getWindow();
currentCover.hide();
win.removeListener( 'resize', resizeCover );
if ( CKEDITOR.env.ie6Compat )
{
win.$.setTimeout( function()
{
var prevScrollHandler = window.onscroll && window.onscroll.prevScrollHandler;
window.onscroll = prevScrollHandler || null;
}, 0 );
}
resizeCover = null;
}
function removeCovers()
{
for ( var coverId in covers )
covers[ coverId ].remove();
covers = {};
}
var accessKeyProcessors = {};
var accessKeyDownHandler = function( evt )
{
var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey,
alt = evt.data.$.altKey,
shift = evt.data.$.shiftKey,
key = String.fromCharCode( evt.data.$.keyCode ),
keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key];
if ( !keyProcessor || !keyProcessor.length )
return;
keyProcessor = keyProcessor[keyProcessor.length - 1];
keyProcessor.keydown && keyProcessor.keydown.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key );
evt.data.preventDefault();
};
var accessKeyUpHandler = function( evt )
{
var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey,
alt = evt.data.$.altKey,
shift = evt.data.$.shiftKey,
key = String.fromCharCode( evt.data.$.keyCode ),
keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key];
if ( !keyProcessor || !keyProcessor.length )
return;
keyProcessor = keyProcessor[keyProcessor.length - 1];
if ( keyProcessor.keyup )
{
keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key );
evt.data.preventDefault();
}
};
var registerAccessKey = function( uiElement, dialog, key, downFunc, upFunc )
{
var procList = accessKeyProcessors[key] || ( accessKeyProcessors[key] = [] );
procList.push( {
uiElement : uiElement,
dialog : dialog,
key : key,
keyup : upFunc || uiElement.accessKeyUp,
keydown : downFunc || uiElement.accessKeyDown
} );
};
var unregisterAccessKey = function( obj )
{
for ( var i in accessKeyProcessors )
{
var list = accessKeyProcessors[i];
for ( var j = list.length - 1 ; j >= 0 ; j-- )
{
if ( list[j].dialog == obj || list[j].uiElement == obj )
list.splice( j, 1 );
}
if ( list.length === 0 )
delete accessKeyProcessors[i];
}
};
var tabAccessKeyUp = function( dialog, key )
{
if ( dialog._.accessKeyMap[key] )
dialog.selectPage( dialog._.accessKeyMap[key] );
};
var tabAccessKeyDown = function( dialog, key )
{
};
// ESC, ENTER
var preventKeyBubblingKeys = { 27 :1, 13 :1 };
var preventKeyBubbling = function( e )
{
if ( e.data.getKeystroke() in preventKeyBubblingKeys )
e.data.stopPropagation();
};
(function()
{
CKEDITOR.ui.dialog =
{
/**
* The base class of all dialog UI elements.
* @constructor
* @param {CKEDITOR.dialog} dialog Parent dialog object.
* @param {CKEDITOR.dialog.definition.uiElement} elementDefinition Element
* definition. Accepted fields:
* <ul>
* <li><strong>id</strong> (Required) The id of the UI element. See {@link
* CKEDITOR.dialog#getContentElement}</li>
* <li><strong>type</strong> (Required) The type of the UI element. The
* value to this field specifies which UI element class will be used to
* generate the final widget.</li>
* <li><strong>title</strong> (Optional) The popup tooltip for the UI
* element.</li>
* <li><strong>hidden</strong> (Optional) A flag that tells if the element
* should be initially visible.</li>
* <li><strong>className</strong> (Optional) Additional CSS class names
* to add to the UI element. Separated by space.</li>
* <li><strong>style</strong> (Optional) Additional CSS inline styles
* to add to the UI element. A semicolon (;) is required after the last
* style declaration.</li>
* <li><strong>accessKey</strong> (Optional) The alphanumeric access key
* for this element. Access keys are automatically prefixed by CTRL.</li>
* <li><strong>on*</strong> (Optional) Any UI element definition field that
* starts with <em>on</em> followed immediately by a capital letter and
* probably more letters is an event handler. Event handlers may be further
* divided into registered event handlers and DOM event handlers. Please
* refer to {@link CKEDITOR.ui.dialog.uiElement#registerEvents} and
* {@link CKEDITOR.ui.dialog.uiElement#eventProcessors} for more
* information.</li>
* </ul>
* @param {Array} htmlList
* List of HTML code to be added to the dialog's content area.
* @param {Function|String} nodeNameArg
* A function returning a string, or a simple string for the node name for
* the root DOM node. Default is 'div'.
* @param {Function|Object} stylesArg
* A function returning an object, or a simple object for CSS styles applied
* to the DOM node. Default is empty object.
* @param {Function|Object} attributesArg
* A fucntion returning an object, or a simple object for attributes applied
* to the DOM node. Default is empty object.
* @param {Function|String} contentsArg
* A function returning a string, or a simple string for the HTML code inside
* the root DOM node. Default is empty string.
* @example
*/
uiElement : function( dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg )
{
if ( arguments.length < 4 )
return;
var nodeName = ( nodeNameArg.call ? nodeNameArg( elementDefinition ) : nodeNameArg ) || 'div',
html = [ '<', nodeName, ' ' ],
styles = ( stylesArg && stylesArg.call ? stylesArg( elementDefinition ) : stylesArg ) || {},
attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {},
innerHTML = ( contentsArg && contentsArg.call ? contentsArg.call( this, dialog, elementDefinition ) : contentsArg ) || '',
domId = this.domId = attributes.id || CKEDITOR.tools.getNextId() + '_uiElement',
id = this.id = elementDefinition.id,
i;
// Set the id, a unique id is required for getElement() to work.
attributes.id = domId;
// Set the type and definition CSS class names.
var classes = {};
if ( elementDefinition.type )
classes[ 'cke_dialog_ui_' + elementDefinition.type ] = 1;
if ( elementDefinition.className )
classes[ elementDefinition.className ] = 1;
if ( elementDefinition.disabled )
classes[ 'cke_disabled' ] = 1;
var attributeClasses = ( attributes['class'] && attributes['class'].split ) ? attributes['class'].split( ' ' ) : [];
for ( i = 0 ; i < attributeClasses.length ; i++ )
{
if ( attributeClasses[i] )
classes[ attributeClasses[i] ] = 1;
}
var finalClasses = [];
for ( i in classes )
finalClasses.push( i );
attributes['class'] = finalClasses.join( ' ' );
// Set the popup tooltop.
if ( elementDefinition.title )
attributes.title = elementDefinition.title;
// Write the inline CSS styles.
var styleStr = ( elementDefinition.style || '' ).split( ';' );
// Element alignment support.
if ( elementDefinition.align )
{
var align = elementDefinition.align;
styles[ 'margin-left' ] = align == 'left' ? 0 : 'auto';
styles[ 'margin-right' ] = align == 'right' ? 0 : 'auto';
}
for ( i in styles )
styleStr.push( i + ':' + styles[i] );
if ( elementDefinition.hidden )
styleStr.push( 'display:none' );
for ( i = styleStr.length - 1 ; i >= 0 ; i-- )
{
if ( styleStr[i] === '' )
styleStr.splice( i, 1 );
}
if ( styleStr.length > 0 )
attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' );
// Write the attributes.
for ( i in attributes )
html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ');
// Write the content HTML.
html.push( '>', innerHTML, '</', nodeName, '>' );
// Add contents to the parent HTML array.
htmlList.push( html.join( '' ) );
( this._ || ( this._ = {} ) ).dialog = dialog;
// Override isChanged if it is defined in element definition.
if ( typeof( elementDefinition.isChanged ) == 'boolean' )
this.isChanged = function(){ return elementDefinition.isChanged; };
if ( typeof( elementDefinition.isChanged ) == 'function' )
this.isChanged = elementDefinition.isChanged;
// Overload 'get(set)Value' on definition.
if ( typeof( elementDefinition.setValue ) == 'function' )
{
this.setValue = CKEDITOR.tools.override( this.setValue, function( org )
{
return function( val ){ org.call( this, elementDefinition.setValue.call( this, val ) ); };
} );
}
if ( typeof( elementDefinition.getValue ) == 'function' )
{
this.getValue = CKEDITOR.tools.override( this.getValue, function( org )
{
return function(){ return elementDefinition.getValue.call( this, org.call( this ) ); };
} );
}
// Add events.
CKEDITOR.event.implementOn( this );
this.registerEvents( elementDefinition );
if ( this.accessKeyUp && this.accessKeyDown && elementDefinition.accessKey )
registerAccessKey( this, dialog, 'CTRL+' + elementDefinition.accessKey );
var me = this;
dialog.on( 'load', function()
{
var input = me.getInputElement();
if ( input )
{
var focusClass = me.type in { 'checkbox' : 1, 'ratio' : 1 } && CKEDITOR.env.ie && CKEDITOR.env.version < 8 ? 'cke_dialog_ui_focused' : '';
input.on( 'focus', function()
{
dialog._.tabBarMode = false;
dialog._.hasFocus = true;
me.fire( 'focus' );
focusClass && this.addClass( focusClass );
});
input.on( 'blur', function()
{
me.fire( 'blur' );
focusClass && this.removeClass( focusClass );
});
}
} );
// Register the object as a tab focus if it can be included.
if ( this.keyboardFocusable )
{
this.tabIndex = elementDefinition.tabIndex || 0;
this.focusIndex = dialog._.focusList.push( this ) - 1;
this.on( 'focus', function()
{
dialog._.currentFocusIndex = me.focusIndex;
} );
}
// Completes this object with everything we have in the
// definition.
CKEDITOR.tools.extend( this, elementDefinition );
},
/**
* Horizontal layout box for dialog UI elements, auto-expends to available width of container.
* @constructor
* @extends CKEDITOR.ui.dialog.uiElement
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
* @param {Array} childObjList
* Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
* container.
* @param {Array} childHtmlList
* Array of HTML code that correspond to the HTML output of all the
* objects in childObjList.
* @param {Array} htmlList
* Array of HTML code that this element will output to.
* @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
* <ul>
* <li><strong>widths</strong> (Optional) The widths of child cells.</li>
* <li><strong>height</strong> (Optional) The height of the layout.</li>
* <li><strong>padding</strong> (Optional) The padding width inside child
* cells.</li>
* <li><strong>align</strong> (Optional) The alignment of the whole layout
* </li>
* </ul>
* @example
*/
hbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition )
{
if ( arguments.length < 4 )
return;
this._ || ( this._ = {} );
var children = this._.children = childObjList,
widths = elementDefinition && elementDefinition.widths || null,
height = elementDefinition && elementDefinition.height || null,
styles = {},
i;
/** @ignore */
var innerHTML = function()
{
var html = [ '<tbody><tr class="cke_dialog_ui_hbox">' ];
for ( i = 0 ; i < childHtmlList.length ; i++ )
{
var className = 'cke_dialog_ui_hbox_child',
styles = [];
if ( i === 0 )
className = 'cke_dialog_ui_hbox_first';
if ( i == childHtmlList.length - 1 )
className = 'cke_dialog_ui_hbox_last';
html.push( '<td class="', className, '" role="presentation" ' );
if ( widths )
{
if ( widths[i] )
styles.push( 'width:' + cssLength( widths[i] ) );
}
else
styles.push( 'width:' + Math.floor( 100 / childHtmlList.length ) + '%' );
if ( height )
styles.push( 'height:' + cssLength( height ) );
if ( elementDefinition && elementDefinition.padding != undefined )
styles.push( 'padding:' + cssLength( elementDefinition.padding ) );
// In IE Quirks alignment has to be done on table cells. (#7324)
if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && children[ i ].align )
styles.push( 'text-align:' + children[ i ].align );
if ( styles.length > 0 )
html.push( 'style="' + styles.join('; ') + '" ' );
html.push( '>', childHtmlList[i], '</td>' );
}
html.push( '</tr></tbody>' );
return html.join( '' );
};
var attribs = { role : 'presentation' };
elementDefinition && elementDefinition.align && ( attribs.align = elementDefinition.align );
CKEDITOR.ui.dialog.uiElement.call(
this,
dialog,
elementDefinition || { type : 'hbox' },
htmlList,
'table',
styles,
attribs,
innerHTML );
},
/**
* Vertical layout box for dialog UI elements.
* @constructor
* @extends CKEDITOR.ui.dialog.hbox
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
* @param {Array} childObjList
* Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
* container.
* @param {Array} childHtmlList
* Array of HTML code that correspond to the HTML output of all the
* objects in childObjList.
* @param {Array} htmlList
* Array of HTML code that this element will output to.
* @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
* <ul>
* <li><strong>width</strong> (Optional) The width of the layout.</li>
* <li><strong>heights</strong> (Optional) The heights of individual cells.
* </li>
* <li><strong>align</strong> (Optional) The alignment of the layout.</li>
* <li><strong>padding</strong> (Optional) The padding width inside child
* cells.</li>
* <li><strong>expand</strong> (Optional) Whether the layout should expand
* vertically to fill its container.</li>
* </ul>
* @example
*/
vbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition )
{
if ( arguments.length < 3 )
return;
this._ || ( this._ = {} );
var children = this._.children = childObjList,
width = elementDefinition && elementDefinition.width || null,
heights = elementDefinition && elementDefinition.heights || null;
/** @ignore */
var innerHTML = function()
{
var html = [ '<table role="presentation" cellspacing="0" border="0" ' ];
html.push( 'style="' );
if ( elementDefinition && elementDefinition.expand )
html.push( 'height:100%;' );
html.push( 'width:' + cssLength( width || '100%' ), ';' );
html.push( '"' );
html.push( 'align="', CKEDITOR.tools.htmlEncode(
( elementDefinition && elementDefinition.align ) || ( dialog.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right' ) ), '" ' );
html.push( '><tbody>' );
for ( var i = 0 ; i < childHtmlList.length ; i++ )
{
var styles = [];
html.push( '<tr><td role="presentation" ' );
if ( width )
styles.push( 'width:' + cssLength( width || '100%' ) );
if ( heights )
styles.push( 'height:' + cssLength( heights[i] ) );
else if ( elementDefinition && elementDefinition.expand )
styles.push( 'height:' + Math.floor( 100 / childHtmlList.length ) + '%' );
if ( elementDefinition && elementDefinition.padding != undefined )
styles.push( 'padding:' + cssLength( elementDefinition.padding ) );
// In IE Quirks alignment has to be done on table cells. (#7324)
if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && children[ i ].align )
styles.push( 'text-align:' + children[ i ].align );
if ( styles.length > 0 )
html.push( 'style="', styles.join( '; ' ), '" ' );
html.push( ' class="cke_dialog_ui_vbox_child">', childHtmlList[i], '</td></tr>' );
}
html.push( '</tbody></table>' );
return html.join( '' );
};
CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, { role : 'presentation' }, innerHTML );
}
};
})();
CKEDITOR.ui.dialog.uiElement.prototype =
{
/**
* Gets the root DOM element of this dialog UI object.
* @returns {CKEDITOR.dom.element} Root DOM element of UI object.
* @example
* uiElement.getElement().hide();
*/
getElement : function()
{
return CKEDITOR.document.getById( this.domId );
},
/**
* Gets the DOM element that the user inputs values.
* This function is used by setValue(), getValue() and focus(). It should
* be overrided in child classes where the input element isn't the root
* element.
* @returns {CKEDITOR.dom.element} The element where the user input values.
* @example
* var rawValue = textInput.getInputElement().$.value;
*/
getInputElement : function()
{
return this.getElement();
},
/**
* Gets the parent dialog object containing this UI element.
* @returns {CKEDITOR.dialog} Parent dialog object.
* @example
* var dialog = uiElement.getDialog();
*/
getDialog : function()
{
return this._.dialog;
},
/**
* Sets the value of this dialog UI object.
* @param {Object} value The new value.
* @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
* @returns {CKEDITOR.dialog.uiElement} The current UI element.
* @example
* uiElement.setValue( 'Dingo' );
*/
setValue : function( value, noChangeEvent )
{
this.getInputElement().setValue( value );
!noChangeEvent && this.fire( 'change', { value : value } );
return this;
},
/**
* Gets the current value of this dialog UI object.
* @returns {Object} The current value.
* @example
* var myValue = uiElement.getValue();
*/
getValue : function()
{
return this.getInputElement().getValue();
},
/**
* Tells whether the UI object's value has changed.
* @returns {Boolean} true if changed, false if not changed.
* @example
* if ( uiElement.isChanged() )
* confirm( 'Value changed! Continue?' );
*/
isChanged : function()
{
// Override in input classes.
return false;
},
/**
* Selects the parent tab of this element. Usually called by focus() or overridden focus() methods.
* @returns {CKEDITOR.dialog.uiElement} The current UI element.
* @example
* focus : function()
* {
* this.selectParentTab();
* // do something else.
* }
*/
selectParentTab : function()
{
var element = this.getInputElement(),
cursor = element,
tabId;
while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 )
{ /*jsl:pass*/ }
// Some widgets don't have parent tabs (e.g. OK and Cancel buttons).
if ( !cursor )
return this;
tabId = cursor.getAttribute( 'name' );
// Avoid duplicate select.
if ( this._.dialog._.currentTabId != tabId )
this._.dialog.selectPage( tabId );
return this;
},
/**
* Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page.
* @returns {CKEDITOR.dialog.uiElement} The current UI element.
* @example
* uiElement.focus();
*/
focus : function()
{
this.selectParentTab().getInputElement().focus();
return this;
},
/**
* Registers the on* event handlers defined in the element definition.
* The default behavior of this function is:
* <ol>
* <li>
* If the on* event is defined in the class's eventProcesors list,
* then the registration is delegated to the corresponding function
* in the eventProcessors list.
* </li>
* <li>
* If the on* event is not defined in the eventProcessors list, then
* register the event handler under the corresponding DOM event of
* the UI element's input DOM element (as defined by the return value
* of {@link CKEDITOR.ui.dialog.uiElement#getInputElement}).
* </li>
* </ol>
* This function is only called at UI element instantiation, but can
* be overridded in child classes if they require more flexibility.
* @param {CKEDITOR.dialog.definition.uiElement} definition The UI element
* definition.
* @returns {CKEDITOR.dialog.uiElement} The current UI element.
* @example
*/
registerEvents : function( definition )
{
var regex = /^on([A-Z]\w+)/,
match;
var registerDomEvent = function( uiElement, dialog, eventName, func )
{
dialog.on( 'load', function()
{
uiElement.getInputElement().on( eventName, func, uiElement );
});
};
for ( var i in definition )
{
if ( !( match = i.match( regex ) ) )
continue;
if ( this.eventProcessors[i] )
this.eventProcessors[i].call( this, this._.dialog, definition[i] );
else
registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] );
}
return this;
},
/**
* The event processor list used by
* {@link CKEDITOR.ui.dialog.uiElement#getInputElement} at UI element
* instantiation. The default list defines three on* events:
* <ol>
* <li>onLoad - Called when the element's parent dialog opens for the
* first time</li>
* <li>onShow - Called whenever the element's parent dialog opens.</li>
* <li>onHide - Called whenever the element's parent dialog closes.</li>
* </ol>
* @field
* @type Object
* @example
* // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick
* // handlers in the UI element's definitions.
* CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {},
* CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
* { onClick : function( dialog, func ) { this.on( 'click', func ); } },
* true );
*/
eventProcessors :
{
onLoad : function( dialog, func )
{
dialog.on( 'load', func, this );
},
onShow : function( dialog, func )
{
dialog.on( 'show', func, this );
},
onHide : function( dialog, func )
{
dialog.on( 'hide', func, this );
}
},
/**
* The default handler for a UI element's access key down event, which
* tries to put focus to the UI element.<br />
* Can be overridded in child classes for more sophisticaed behavior.
* @param {CKEDITOR.dialog} dialog The parent dialog object.
* @param {String} key The key combination pressed. Since access keys
* are defined to always include the CTRL key, its value should always
* include a 'CTRL+' prefix.
* @example
*/
accessKeyDown : function( dialog, key )
{
this.focus();
},
/**
* The default handler for a UI element's access key up event, which
* does nothing.<br />
* Can be overridded in child classes for more sophisticated behavior.
* @param {CKEDITOR.dialog} dialog The parent dialog object.
* @param {String} key The key combination pressed. Since access keys
* are defined to always include the CTRL key, its value should always
* include a 'CTRL+' prefix.
* @example
*/
accessKeyUp : function( dialog, key )
{
},
/**
* Disables a UI element.
* @example
*/
disable : function()
{
var element = this.getElement(),
input = this.getInputElement();
input.setAttribute( 'disabled', 'true' );
element.addClass( 'cke_disabled' );
},
/**
* Enables a UI element.
* @example
*/
enable : function()
{
var element = this.getElement(),
input = this.getInputElement();
input.removeAttribute( 'disabled' );
element.removeClass( 'cke_disabled' );
},
/**
* Determines whether an UI element is enabled or not.
* @returns {Boolean} Whether the UI element is enabled.
* @example
*/
isEnabled : function()
{
return !this.getElement().hasClass( 'cke_disabled' );
},
/**
* Determines whether an UI element is visible or not.
* @returns {Boolean} Whether the UI element is visible.
* @example
*/
isVisible : function()
{
return this.getInputElement().isVisible();
},
/**
* Determines whether an UI element is focus-able or not.
* Focus-able is defined as being both visible and enabled.
* @returns {Boolean} Whether the UI element can be focused.
* @example
*/
isFocusable : function()
{
if ( !this.isEnabled() || !this.isVisible() )
return false;
return true;
}
};
CKEDITOR.ui.dialog.hbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
/**
* @lends CKEDITOR.ui.dialog.hbox.prototype
*/
{
/**
* Gets a child UI element inside this container.
* @param {Array|Number} indices An array or a single number to indicate the child's
* position in the container's descendant tree. Omit to get all the children in an array.
* @returns {Array|CKEDITOR.ui.dialog.uiElement} Array of all UI elements in the container
* if no argument given, or the specified UI element if indices is given.
* @example
* var checkbox = hbox.getChild( [0,1] );
* checkbox.setValue( true );
*/
getChild : function( indices )
{
// If no arguments, return a clone of the children array.
if ( arguments.length < 1 )
return this._.children.concat();
// If indices isn't array, make it one.
if ( !indices.splice )
indices = [ indices ];
// Retrieve the child element according to tree position.
if ( indices.length < 2 )
return this._.children[ indices[0] ];
else
return ( this._.children[ indices[0] ] && this._.children[ indices[0] ].getChild ) ?
this._.children[ indices[0] ].getChild( indices.slice( 1, indices.length ) ) :
null;
}
}, true );
CKEDITOR.ui.dialog.vbox.prototype = new CKEDITOR.ui.dialog.hbox();
(function()
{
var commonBuilder = {
build : function( dialog, elementDefinition, output )
{
var children = elementDefinition.children,
child,
childHtmlList = [],
childObjList = [];
for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ )
{
var childHtml = [];
childHtmlList.push( childHtml );
childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) );
}
return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, childObjList, childHtmlList, output, elementDefinition );
}
};
CKEDITOR.dialog.addUIElement( 'hbox', commonBuilder );
CKEDITOR.dialog.addUIElement( 'vbox', commonBuilder );
})();
/**
* Generic dialog command. It opens a specific dialog when executed.
* @constructor
* @augments CKEDITOR.commandDefinition
* @param {string} dialogName The name of the dialog to open when executing
* this command.
* @example
* // Register the "link" command, which opens the "link" dialog.
* editor.addCommand( 'link', <b>new CKEDITOR.dialogCommand( 'link' )</b> );
*/
CKEDITOR.dialogCommand = function( dialogName )
{
this.dialogName = dialogName;
};
CKEDITOR.dialogCommand.prototype =
{
/** @ignore */
exec : function( editor )
{
// Special treatment for Opera. (#8031)
CKEDITOR.env.opera ?
CKEDITOR.tools.setTimeout( function() { editor.openDialog( this.dialogName ); }, 0, this )
: editor.openDialog( this.dialogName );
},
// Dialog commands just open a dialog ui, thus require no undo logic,
// undo support should dedicate to specific dialog implementation.
canUndo: false,
editorFocus : CKEDITOR.env.ie || CKEDITOR.env.webkit
};
(function()
{
var notEmptyRegex = /^([a]|[^a])+$/,
integerRegex = /^\d*$/,
numberRegex = /^\d*(?:\.\d+)?$/,
htmlLengthRegex = /^(((\d*(\.\d+))|(\d*))(px|\%)?)?$/,
cssLengthRegex = /^(((\d*(\.\d+))|(\d*))(px|em|ex|in|cm|mm|pt|pc|\%)?)?$/i,
inlineStyleRegex = /^(\s*[\w-]+\s*:\s*[^:;]+(?:;|$))*$/;
CKEDITOR.VALIDATE_OR = 1;
CKEDITOR.VALIDATE_AND = 2;
CKEDITOR.dialog.validate =
{
functions : function()
{
var args = arguments;
return function()
{
/**
* It's important for validate functions to be able to accept the value
* as argument in addition to this.getValue(), so that it is possible to
* combine validate functions together to make more sophisticated
* validators.
*/
var value = this && this.getValue ? this.getValue() : args[ 0 ];
var msg = undefined,
relation = CKEDITOR.VALIDATE_AND,
functions = [], i;
for ( i = 0 ; i < args.length ; i++ )
{
if ( typeof( args[i] ) == 'function' )
functions.push( args[i] );
else
break;
}
if ( i < args.length && typeof( args[i] ) == 'string' )
{
msg = args[i];
i++;
}
if ( i < args.length && typeof( args[i]) == 'number' )
relation = args[i];
var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false );
for ( i = 0 ; i < functions.length ; i++ )
{
if ( relation == CKEDITOR.VALIDATE_AND )
passed = passed && functions[i]( value );
else
passed = passed || functions[i]( value );
}
return !passed ? msg : true;
};
},
regex : function( regex, msg )
{
/*
* Can be greatly shortened by deriving from functions validator if code size
* turns out to be more important than performance.
*/
return function()
{
var value = this && this.getValue ? this.getValue() : arguments[0];
return !regex.test( value ) ? msg : true;
};
},
notEmpty : function( msg )
{
return this.regex( notEmptyRegex, msg );
},
integer : function( msg )
{
return this.regex( integerRegex, msg );
},
'number' : function( msg )
{
return this.regex( numberRegex, msg );
},
'cssLength' : function( msg )
{
return this.functions( function( val ){ return cssLengthRegex.test( CKEDITOR.tools.trim( val ) ); }, msg );
},
'htmlLength' : function( msg )
{
return this.functions( function( val ){ return htmlLengthRegex.test( CKEDITOR.tools.trim( val ) ); }, msg );
},
'inlineStyle' : function( msg )
{
return this.functions( function( val ){ return inlineStyleRegex.test( CKEDITOR.tools.trim( val ) ); }, msg );
},
equals : function( value, msg )
{
return this.functions( function( val ){ return val == value; }, msg );
},
notEqual : function( value, msg )
{
return this.functions( function( val ){ return val != value; }, msg );
}
};
CKEDITOR.on( 'instanceDestroyed', function( evt )
{
// Remove dialog cover on last instance destroy.
if ( CKEDITOR.tools.isEmpty( CKEDITOR.instances ) )
{
var currentTopDialog;
while ( ( currentTopDialog = CKEDITOR.dialog._.currentTop ) )
currentTopDialog.hide();
removeCovers();
}
var dialogs = evt.editor._.storedDialogs;
for ( var name in dialogs )
dialogs[ name ].destroy();
});
})();
// Extend the CKEDITOR.editor class with dialog specific functions.
CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
/** @lends CKEDITOR.editor.prototype */
{
/**
* Loads and opens a registered dialog.
* @param {String} dialogName The registered name of the dialog.
* @param {Function} callback The function to be invoked after dialog instance created.
* @see CKEDITOR.dialog.add
* @example
* CKEDITOR.instances.editor1.openDialog( 'smiley' );
* @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered.
*/
openDialog : function( dialogName, callback )
{
if ( this.mode == 'wysiwyg' && CKEDITOR.env.ie )
{
var selection = this.getSelection();
selection && selection.lock();
}
var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
dialogSkin = this.skin.dialog;
if ( CKEDITOR.dialog._.currentTop === null )
showCover( this );
// If the dialogDefinition is already loaded, open it immediately.
if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded )
{
var storedDialogs = this._.storedDialogs ||
( this._.storedDialogs = {} );
var dialog = storedDialogs[ dialogName ] ||
( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );
callback && callback.call( dialog, dialog );
dialog.show();
return dialog;
}
else if ( dialogDefinitions == 'failed' )
{
hideCover();
throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' );
}
var me = this;
function onDialogFileLoaded( success )
{
var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
skin = me.skin.dialog;
// Check if both skin part and definition is loaded.
if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' )
return;
// In case of plugin error, mark it as loading failed.
if ( typeof dialogDefinition != 'function' )
CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';
me.openDialog( dialogName, callback );
}
if ( typeof dialogDefinitions == 'string' )
{
var loadDefinition = 1;
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded, null, 0, 1 );
}
CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded );
return null;
}
});
})();
CKEDITOR.plugins.add( 'dialog',
{
requires : [ 'dialogui' ]
});
// Dialog related configurations.
/**
* The color of the dialog background cover. It should be a valid CSS color
* string.
* @name CKEDITOR.config.dialog_backgroundCoverColor
* @type String
* @default 'white'
* @example
* config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)';
*/
/**
* The opacity of the dialog background cover. It should be a number within the
* range [0.0, 1.0].
* @name CKEDITOR.config.dialog_backgroundCoverOpacity
* @type Number
* @default 0.5
* @example
* config.dialog_backgroundCoverOpacity = 0.7;
*/
/**
* If the dialog has more than one tab, put focus into the first tab as soon as dialog is opened.
* @name CKEDITOR.config.dialog_startupFocusTab
* @type Boolean
* @default false
* @example
* config.dialog_startupFocusTab = true;
*/
/**
* The distance of magnetic borders used in moving and resizing dialogs,
* measured in pixels.
* @name CKEDITOR.config.dialog_magnetDistance
* @type Number
* @default 20
* @example
* config.dialog_magnetDistance = 30;
*/
/**
* The guideline to follow when generating the dialog buttons. There are 3 possible options:
* <ul>
* <li>'OS' - the buttons will be displayed in the default order of the user's OS;</li>
* <li>'ltr' - for Left-To-Right order;</li>
* <li>'rtl' - for Right-To-Left order.</li>
* </ul>
* @name CKEDITOR.config.dialog_buttonsOrder
* @type String
* @default 'OS'
* @since 3.5
* @example
* config.dialog_buttonsOrder = 'rtl';
*/
/**
* The dialog contents to removed. It's a string composed by dialog name and tab name with a colon between them.
* Separate each pair with semicolon (see example).
* <b>Note: All names are case-sensitive.</b>
* <b>Note: Be cautious when specifying dialog tabs that are mandatory, like "info", dialog functionality might be broken because of this!</b>
* @name CKEDITOR.config.removeDialogTabs
* @type String
* @since 3.5
* @default ''
* @example
* config.removeDialogTabs = 'flash:advanced;image:Link';
*/
/**
* Fired when a dialog definition is about to be used to create a dialog into
* an editor instance. This event makes it possible to customize the definition
* before creating it.
* <p>Note that this event is called only the first time a specific dialog is
* opened. Successive openings will use the cached dialog, and this event will
* not get fired.</p>
* @name CKEDITOR#dialogDefinition
* @event
* @param {CKEDITOR.dialog.definition} data The dialog defination that
* is being loaded.
* @param {CKEDITOR.editor} editor The editor instance that will use the
* dialog.
*/
/**
* Fired when a tab is going to be selected in a dialog
* @name CKEDITOR.dialog#selectPage
* @event
* @param {String} page The id of the page that it's gonna be selected.
* @param {String} currentPage The id of the current page.
*/
/**
* Fired when the user tries to dismiss a dialog
* @name CKEDITOR.dialog#cancel
* @event
* @param {Boolean} hide Whether the event should proceed or not.
*/
/**
* Fired when the user tries to confirm a dialog
* @name CKEDITOR.dialog#ok
* @event
* @param {Boolean} hide Whether the event should proceed or not.
*/
/**
* Fired when a dialog is shown
* @name CKEDITOR.dialog#show
* @event
*/
/**
* Fired when a dialog is shown
* @name CKEDITOR.editor#dialogShow
* @event
*/
/**
* Fired when a dialog is hidden
* @name CKEDITOR.dialog#hide
* @event
*/
/**
* Fired when a dialog is hidden
* @name CKEDITOR.editor#dialogHide
* @event
*/
/**
* Fired when a dialog is being resized. The event is fired on
* both the 'CKEDITOR.dialog' object and the dialog instance
* since 3.5.3, previously it's available only in the global object.
* @name CKEDITOR.dialog#resize
* @since 3.5
* @event
* @param {CKEDITOR.dialog} dialog The dialog being resized (if
* it's fired on the dialog itself, this parameter isn't sent).
* @param {String} skin The skin name.
* @param {Number} width The new width.
* @param {Number} height The new height.
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'styles',
{
requires : [ 'selection' ],
init : function( editor )
{
// This doesn't look like correct, but it's the safest way to proper
// pass the disableReadonlyStyling configuration to the style system
// without having to change any method signature in the API. (#6103)
editor.on( 'contentDom', function()
{
editor.document.setCustomData( 'cke_includeReadonly', !editor.config.disableReadonlyStyling );
});
}
});
/**
* Registers a function to be called whenever the selection position changes in the
* editing area. The current state is passed to the function. The possible
* states are {@link CKEDITOR.TRISTATE_ON} and {@link CKEDITOR.TRISTATE_OFF}.
* @param {CKEDITOR.style} style The style to be watched.
* @param {Function} callback The function to be called.
* @example
* // Create a style object for the <b> element.
* var style = new CKEDITOR.style( { element : 'b' } );
* var editor = CKEDITOR.instances.editor1;
* editor.attachStyleStateChange( style, function( state )
* {
* if ( state == CKEDITOR.TRISTATE_ON )
* alert( 'The current state for the B element is ON' );
* else
* alert( 'The current state for the B element is OFF' );
* });
*/
CKEDITOR.editor.prototype.attachStyleStateChange = function( style, callback )
{
// Try to get the list of attached callbacks.
var styleStateChangeCallbacks = this._.styleStateChangeCallbacks;
// If it doesn't exist, it means this is the first call. So, let's create
// all the structure to manage the style checks and the callback calls.
if ( !styleStateChangeCallbacks )
{
// Create the callbacks array.
styleStateChangeCallbacks = this._.styleStateChangeCallbacks = [];
// Attach to the selectionChange event, so we can check the styles at
// that point.
this.on( 'selectionChange', function( ev )
{
// Loop throw all registered callbacks.
for ( var i = 0 ; i < styleStateChangeCallbacks.length ; i++ )
{
var callback = styleStateChangeCallbacks[ i ];
// Check the current state for the style defined for that
// callback.
var currentState = callback.style.checkActive( ev.data.path ) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF;
// Call the callback function, passing the current
// state to it.
callback.fn.call( this, currentState );
}
});
}
// Save the callback info, so it can be checked on the next occurrence of
// selectionChange.
styleStateChangeCallbacks.push( { style : style, fn : callback } );
};
CKEDITOR.STYLE_BLOCK = 1;
CKEDITOR.STYLE_INLINE = 2;
CKEDITOR.STYLE_OBJECT = 3;
(function()
{
var blockElements = { address:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,details:1,datagrid:1,datalist:1 },
objectElements = { a:1,embed:1,hr:1,img:1,li:1,object:1,ol:1,table:1,td:1,tr:1,th:1,ul:1,dl:1,dt:1,dd:1,form:1,audio:1,video:1 };
var semicolonFixRegex = /\s*(?:;\s*|$)/,
varRegex = /#\((.+?)\)/g;
var notBookmark = CKEDITOR.dom.walker.bookmark( 0, 1 ),
nonWhitespaces = CKEDITOR.dom.walker.whitespaces( 1 );
CKEDITOR.style = function( styleDefinition, variablesValues )
{
if ( variablesValues )
{
styleDefinition = CKEDITOR.tools.clone( styleDefinition );
replaceVariables( styleDefinition.attributes, variablesValues );
replaceVariables( styleDefinition.styles, variablesValues );
}
var element = this.element = styleDefinition.element ?
( typeof styleDefinition.element == 'string' ? styleDefinition.element.toLowerCase() : styleDefinition.element )
: '*';
this.type =
blockElements[ element ] ?
CKEDITOR.STYLE_BLOCK
: objectElements[ element ] ?
CKEDITOR.STYLE_OBJECT
:
CKEDITOR.STYLE_INLINE;
// If the 'element' property is an object with a set of possible element, it will be applied like an object style: only to existing elements
if ( typeof this.element == 'object' )
this.type = CKEDITOR.STYLE_OBJECT;
this._ =
{
definition : styleDefinition
};
};
CKEDITOR.style.prototype =
{
apply : function( document )
{
applyStyle.call( this, document, false );
},
remove : function( document )
{
applyStyle.call( this, document, true );
},
applyToRange : function( range )
{
return ( this.applyToRange =
this.type == CKEDITOR.STYLE_INLINE ?
applyInlineStyle
: this.type == CKEDITOR.STYLE_BLOCK ?
applyBlockStyle
: this.type == CKEDITOR.STYLE_OBJECT ?
applyObjectStyle
: null ).call( this, range );
},
removeFromRange : function( range )
{
return ( this.removeFromRange =
this.type == CKEDITOR.STYLE_INLINE ?
removeInlineStyle
: this.type == CKEDITOR.STYLE_BLOCK ?
removeBlockStyle
: this.type == CKEDITOR.STYLE_OBJECT ?
removeObjectStyle
: null ).call( this, range );
},
applyToObject : function( element )
{
setupElement( element, this );
},
/**
* Get the style state inside an element path. Returns "true" if the
* element is active in the path.
*/
checkActive : function( elementPath )
{
switch ( this.type )
{
case CKEDITOR.STYLE_BLOCK :
return this.checkElementRemovable( elementPath.block || elementPath.blockLimit, true );
case CKEDITOR.STYLE_OBJECT :
case CKEDITOR.STYLE_INLINE :
var elements = elementPath.elements;
for ( var i = 0, element ; i < elements.length ; i++ )
{
element = elements[ i ];
if ( this.type == CKEDITOR.STYLE_INLINE
&& ( element == elementPath.block || element == elementPath.blockLimit ) )
continue;
if( this.type == CKEDITOR.STYLE_OBJECT )
{
var name = element.getName();
if ( !( typeof this.element == 'string' ? name == this.element : name in this.element ) )
continue;
}
if ( this.checkElementRemovable( element, true ) )
return true;
}
}
return false;
},
/**
* Whether this style can be applied at the element path.
* @param elementPath
*/
checkApplicable : function( elementPath )
{
switch ( this.type )
{
case CKEDITOR.STYLE_INLINE :
case CKEDITOR.STYLE_BLOCK :
break;
case CKEDITOR.STYLE_OBJECT :
return elementPath.lastElement.getAscendant( this.element, true );
}
return true;
},
// Checks if an element, or any of its attributes, is removable by the
// current style definition.
checkElementRemovable : function( element, fullMatch )
{
var def = this._.definition;
if ( !element || !def.ignoreReadonly && element.isReadOnly() )
return false;
var attribs,
name = element.getName();
// If the element name is the same as the style name.
if ( typeof this.element == 'string' ? name == this.element : name in this.element )
{
// If no attributes are defined in the element.
if ( !fullMatch && !element.hasAttributes() )
return true;
attribs = getAttributesForComparison( def );
if ( attribs._length )
{
for ( var attName in attribs )
{
if ( attName == '_length' )
continue;
var elementAttr = element.getAttribute( attName ) || '';
// Special treatment for 'style' attribute is required.
if ( attName == 'style' ?
compareCssText( attribs[ attName ], normalizeCssText( elementAttr, false ) )
: attribs[ attName ] == elementAttr )
{
if ( !fullMatch )
return true;
}
else if ( fullMatch )
return false;
}
if ( fullMatch )
return true;
}
else
return true;
}
// Check if the element can be somehow overriden.
var override = getOverrides( this )[ element.getName() ] ;
if ( override )
{
// If no attributes have been defined, remove the element.
if ( !( attribs = override.attributes ) )
return true;
for ( var i = 0 ; i < attribs.length ; i++ )
{
attName = attribs[i][0];
var actualAttrValue = element.getAttribute( attName );
if ( actualAttrValue )
{
var attValue = attribs[i][1];
// Remove the attribute if:
// - The override definition value is null;
// - The override definition value is a string that
// matches the attribute value exactly.
// - The override definition value is a regex that
// has matches in the attribute value.
if ( attValue === null ||
( typeof attValue == 'string' && actualAttrValue == attValue ) ||
attValue.test( actualAttrValue ) )
return true;
}
}
}
return false;
},
// Builds the preview HTML based on the styles definition.
buildPreview : function( label )
{
var styleDefinition = this._.definition,
html = [],
elementName = styleDefinition.element;
// Avoid <bdo> in the preview.
if ( elementName == 'bdo' )
elementName = 'span';
html = [ '<', elementName ];
// Assign all defined attributes.
var attribs = styleDefinition.attributes;
if ( attribs )
{
for ( var att in attribs )
{
html.push( ' ', att, '="', attribs[ att ], '"' );
}
}
// Assign the style attribute.
var cssStyle = CKEDITOR.style.getStyleText( styleDefinition );
if ( cssStyle )
html.push( ' style="', cssStyle, '"' );
html.push( '>', ( label || styleDefinition.name ), '</', elementName, '>' );
return html.join( '' );
}
};
// Build the cssText based on the styles definition.
CKEDITOR.style.getStyleText = function( styleDefinition )
{
// If we have already computed it, just return it.
var stylesDef = styleDefinition._ST;
if ( stylesDef )
return stylesDef;
stylesDef = styleDefinition.styles;
// Builds the StyleText.
var stylesText = ( styleDefinition.attributes && styleDefinition.attributes[ 'style' ] ) || '',
specialStylesText = '';
if ( stylesText.length )
stylesText = stylesText.replace( semicolonFixRegex, ';' );
for ( var style in stylesDef )
{
var styleVal = stylesDef[ style ],
text = ( style + ':' + styleVal ).replace( semicolonFixRegex, ';' );
// Some browsers don't support 'inherit' property value, leave them intact. (#5242)
if ( styleVal == 'inherit' )
specialStylesText += text;
else
stylesText += text;
}
// Browsers make some changes to the style when applying them. So, here
// we normalize it to the browser format.
if ( stylesText.length )
stylesText = normalizeCssText( stylesText );
stylesText += specialStylesText;
// Return it, saving it to the next request.
return ( styleDefinition._ST = stylesText );
};
// Gets the parent element which blocks the styling for an element. This
// can be done through read-only elements (contenteditable=false) or
// elements with the "data-nostyle" attribute.
function getUnstylableParent( element )
{
var unstylable,
editable;
while ( ( element = element.getParent() ) )
{
if ( element.getName() == 'body' )
break;
if ( element.getAttribute( 'data-nostyle' ) )
unstylable = element;
else if ( !editable )
{
var contentEditable = element.getAttribute( 'contentEditable' );
if ( contentEditable == 'false' )
unstylable = element;
else if ( contentEditable == 'true' )
editable = 1;
}
}
return unstylable;
}
function applyInlineStyle( range )
{
var document = range.document;
if ( range.collapsed )
{
// Create the element to be inserted in the DOM.
var collapsedElement = getElement( this, document );
// Insert the empty element into the DOM at the range position.
range.insertNode( collapsedElement );
// Place the selection right inside the empty element.
range.moveToPosition( collapsedElement, CKEDITOR.POSITION_BEFORE_END );
return;
}
var elementName = this.element;
var def = this._.definition;
var isUnknownElement;
// Indicates that fully selected read-only elements are to be included in the styling range.
var ignoreReadonly = def.ignoreReadonly,
includeReadonly = ignoreReadonly || def.includeReadonly;
// If the read-only inclusion is not available in the definition, try
// to get it from the document data.
if ( includeReadonly == undefined )
includeReadonly = document.getCustomData( 'cke_includeReadonly' );
// Get the DTD definition for the element. Defaults to "span".
var dtd = CKEDITOR.dtd[ elementName ] || ( isUnknownElement = true, CKEDITOR.dtd.span );
// Expand the range.
range.enlarge( CKEDITOR.ENLARGE_ELEMENT, 1 );
range.trim();
// Get the first node to be processed and the last, which concludes the
// processing.
var boundaryNodes = range.createBookmark(),
firstNode = boundaryNodes.startNode,
lastNode = boundaryNodes.endNode;
var currentNode = firstNode;
var styleRange;
if ( !ignoreReadonly )
{
// Check if the boundaries are inside non stylable elements.
var firstUnstylable = getUnstylableParent( firstNode ),
lastUnstylable = getUnstylableParent( lastNode );
// If the first element can't be styled, we'll start processing right
// after its unstylable root.
if ( firstUnstylable )
currentNode = firstUnstylable.getNextSourceNode( true );
// If the last element can't be styled, we'll stop processing on its
// unstylable root.
if ( lastUnstylable )
lastNode = lastUnstylable;
}
// Do nothing if the current node now follows the last node to be processed.
if ( currentNode.getPosition( lastNode ) == CKEDITOR.POSITION_FOLLOWING )
currentNode = 0;
while ( currentNode )
{
var applyStyle = false;
if ( currentNode.equals( lastNode ) )
{
currentNode = null;
applyStyle = true;
}
else
{
var nodeType = currentNode.type;
var nodeName = nodeType == CKEDITOR.NODE_ELEMENT ? currentNode.getName() : null;
var nodeIsReadonly = nodeName && ( currentNode.getAttribute( 'contentEditable' ) == 'false' );
var nodeIsNoStyle = nodeName && currentNode.getAttribute( 'data-nostyle' );
if ( nodeName && currentNode.data( 'cke-bookmark' ) )
{
currentNode = currentNode.getNextSourceNode( true );
continue;
}
// Check if the current node can be a child of the style element.
if ( !nodeName || ( dtd[ nodeName ]
&& !nodeIsNoStyle
&& ( !nodeIsReadonly || includeReadonly )
&& ( currentNode.getPosition( lastNode ) | CKEDITOR.POSITION_PRECEDING | CKEDITOR.POSITION_IDENTICAL | CKEDITOR.POSITION_IS_CONTAINED ) == ( CKEDITOR.POSITION_PRECEDING + CKEDITOR.POSITION_IDENTICAL + CKEDITOR.POSITION_IS_CONTAINED )
&& ( !def.childRule || def.childRule( currentNode ) ) ) )
{
var currentParent = currentNode.getParent();
// Check if the style element can be a child of the current
// node parent or if the element is not defined in the DTD.
if ( currentParent
&& ( ( currentParent.getDtd() || CKEDITOR.dtd.span )[ elementName ] || isUnknownElement )
&& ( !def.parentRule || def.parentRule( currentParent ) ) )
{
// This node will be part of our range, so if it has not
// been started, place its start right before the node.
// In the case of an element node, it will be included
// only if it is entirely inside the range.
if ( !styleRange && ( !nodeName || !CKEDITOR.dtd.$removeEmpty[ nodeName ] || ( currentNode.getPosition( lastNode ) | CKEDITOR.POSITION_PRECEDING | CKEDITOR.POSITION_IDENTICAL | CKEDITOR.POSITION_IS_CONTAINED ) == ( CKEDITOR.POSITION_PRECEDING + CKEDITOR.POSITION_IDENTICAL + CKEDITOR.POSITION_IS_CONTAINED ) ) )
{
styleRange = new CKEDITOR.dom.range( document );
styleRange.setStartBefore( currentNode );
}
// Non element nodes, readonly elements, or empty
// elements can be added completely to the range.
if ( nodeType == CKEDITOR.NODE_TEXT || nodeIsReadonly || ( nodeType == CKEDITOR.NODE_ELEMENT && !currentNode.getChildCount() ) )
{
var includedNode = currentNode;
var parentNode;
// This node is about to be included completelly, but,
// if this is the last node in its parent, we must also
// check if the parent itself can be added completelly
// to the range, otherwise apply the style immediately.
while ( ( applyStyle = !includedNode.getNext( notBookmark ) )
&& ( parentNode = includedNode.getParent(), dtd[ parentNode.getName() ] )
&& ( parentNode.getPosition( firstNode ) | CKEDITOR.POSITION_FOLLOWING | CKEDITOR.POSITION_IDENTICAL | CKEDITOR.POSITION_IS_CONTAINED ) == ( CKEDITOR.POSITION_FOLLOWING + CKEDITOR.POSITION_IDENTICAL + CKEDITOR.POSITION_IS_CONTAINED )
&& ( !def.childRule || def.childRule( parentNode ) ) )
{
includedNode = parentNode;
}
styleRange.setEndAfter( includedNode );
}
}
else
applyStyle = true;
}
else
applyStyle = true;
// Get the next node to be processed.
currentNode = currentNode.getNextSourceNode( nodeIsNoStyle || nodeIsReadonly );
}
// Apply the style if we have something to which apply it.
if ( applyStyle && styleRange && !styleRange.collapsed )
{
// Build the style element, based on the style object definition.
var styleNode = getElement( this, document ),
styleHasAttrs = styleNode.hasAttributes();
// Get the element that holds the entire range.
var parent = styleRange.getCommonAncestor();
var removeList = {
styles : {},
attrs : {},
// Styles cannot be removed.
blockedStyles : {},
// Attrs cannot be removed.
blockedAttrs : {}
};
var attName, styleName, value;
// Loop through the parents, removing the redundant attributes
// from the element to be applied.
while ( styleNode && parent )
{
if ( parent.getName() == elementName )
{
for ( attName in def.attributes )
{
if ( removeList.blockedAttrs[ attName ] || !( value = parent.getAttribute( styleName ) ) )
continue;
if ( styleNode.getAttribute( attName ) == value )
removeList.attrs[ attName ] = 1;
else
removeList.blockedAttrs[ attName ] = 1;
}
for ( styleName in def.styles )
{
if ( removeList.blockedStyles[ styleName ] || !( value = parent.getStyle( styleName ) ) )
continue;
if ( styleNode.getStyle( styleName ) == value )
removeList.styles[ styleName ] = 1;
else
removeList.blockedStyles[ styleName ] = 1;
}
}
parent = parent.getParent();
}
for ( attName in removeList.attrs )
styleNode.removeAttribute( attName );
for ( styleName in removeList.styles )
styleNode.removeStyle( styleName );
if ( styleHasAttrs && !styleNode.hasAttributes() )
styleNode = null;
if ( styleNode )
{
// Move the contents of the range to the style element.
styleRange.extractContents().appendTo( styleNode );
// Here we do some cleanup, removing all duplicated
// elements from the style element.
removeFromInsideElement( this, styleNode );
// Insert it into the range position (it is collapsed after
// extractContents.
styleRange.insertNode( styleNode );
// Let's merge our new style with its neighbors, if possible.
styleNode.mergeSiblings();
// As the style system breaks text nodes constantly, let's normalize
// things for performance.
// With IE, some paragraphs get broken when calling normalize()
// repeatedly. Also, for IE, we must normalize body, not documentElement.
// IE is also known for having a "crash effect" with normalize().
// We should try to normalize with IE too in some way, somewhere.
if ( !CKEDITOR.env.ie )
styleNode.$.normalize();
}
// Style already inherit from parents, left just to clear up any internal overrides. (#5931)
else
{
styleNode = new CKEDITOR.dom.element( 'span' );
styleRange.extractContents().appendTo( styleNode );
styleRange.insertNode( styleNode );
removeFromInsideElement( this, styleNode );
styleNode.remove( true );
}
// Style applied, let's release the range, so it gets
// re-initialization in the next loop.
styleRange = null;
}
}
// Remove the bookmark nodes.
range.moveToBookmark( boundaryNodes );
// Minimize the result range to exclude empty text nodes. (#5374)
range.shrink( CKEDITOR.SHRINK_TEXT );
}
function removeInlineStyle( range )
{
/*
* Make sure our range has included all "collpased" parent inline nodes so
* that our operation logic can be simpler.
*/
range.enlarge( CKEDITOR.ENLARGE_ELEMENT, 1 );
var bookmark = range.createBookmark(),
startNode = bookmark.startNode;
if ( range.collapsed )
{
var startPath = new CKEDITOR.dom.elementPath( startNode.getParent() ),
// The topmost element in elementspatch which we should jump out of.
boundaryElement;
for ( var i = 0, element ; i < startPath.elements.length
&& ( element = startPath.elements[i] ) ; i++ )
{
/*
* 1. If it's collaped inside text nodes, try to remove the style from the whole element.
*
* 2. Otherwise if it's collapsed on element boundaries, moving the selection
* outside the styles instead of removing the whole tag,
* also make sure other inner styles were well preserverd.(#3309)
*/
if ( element == startPath.block || element == startPath.blockLimit )
break;
if ( this.checkElementRemovable( element ) )
{
var isStart;
if ( range.collapsed && (
range.checkBoundaryOfElement( element, CKEDITOR.END ) ||
( isStart = range.checkBoundaryOfElement( element, CKEDITOR.START ) ) ) )
{
boundaryElement = element;
boundaryElement.match = isStart ? 'start' : 'end';
}
else
{
/*
* Before removing the style node, there may be a sibling to the style node
* that's exactly the same to the one to be removed. To the user, it makes
* no difference that they're separate entities in the DOM tree. So, merge
* them before removal.
*/
element.mergeSiblings();
if ( element.getName() == this.element )
removeFromElement( this, element );
else
removeOverrides( element, getOverrides( this )[ element.getName() ] );
}
}
}
// Re-create the style tree after/before the boundary element,
// the replication start from bookmark start node to define the
// new range.
if ( boundaryElement )
{
var clonedElement = startNode;
for ( i = 0 ;; i++ )
{
var newElement = startPath.elements[ i ];
if ( newElement.equals( boundaryElement ) )
break;
// Avoid copying any matched element.
else if ( newElement.match )
continue;
else
newElement = newElement.clone();
newElement.append( clonedElement );
clonedElement = newElement;
}
clonedElement[ boundaryElement.match == 'start' ?
'insertBefore' : 'insertAfter' ]( boundaryElement );
}
}
else
{
/*
* Now our range isn't collapsed. Lets walk from the start node to the end
* node via DFS and remove the styles one-by-one.
*/
var endNode = bookmark.endNode,
me = this;
/*
* Find out the style ancestor that needs to be broken down at startNode
* and endNode.
*/
function breakNodes()
{
var startPath = new CKEDITOR.dom.elementPath( startNode.getParent() ),
endPath = new CKEDITOR.dom.elementPath( endNode.getParent() ),
breakStart = null,
breakEnd = null;
for ( var i = 0 ; i < startPath.elements.length ; i++ )
{
var element = startPath.elements[ i ];
if ( element == startPath.block || element == startPath.blockLimit )
break;
if ( me.checkElementRemovable( element ) )
breakStart = element;
}
for ( i = 0 ; i < endPath.elements.length ; i++ )
{
element = endPath.elements[ i ];
if ( element == endPath.block || element == endPath.blockLimit )
break;
if ( me.checkElementRemovable( element ) )
breakEnd = element;
}
if ( breakEnd )
endNode.breakParent( breakEnd );
if ( breakStart )
startNode.breakParent( breakStart );
}
breakNodes();
// Now, do the DFS walk.
var currentNode = startNode;
while ( !currentNode.equals( endNode ) )
{
/*
* Need to get the next node first because removeFromElement() can remove
* the current node from DOM tree.
*/
var nextNode = currentNode.getNextSourceNode();
if ( currentNode.type == CKEDITOR.NODE_ELEMENT && this.checkElementRemovable( currentNode ) )
{
// Remove style from element or overriding element.
if ( currentNode.getName() == this.element )
removeFromElement( this, currentNode );
else
removeOverrides( currentNode, getOverrides( this )[ currentNode.getName() ] );
/*
* removeFromElement() may have merged the next node with something before
* the startNode via mergeSiblings(). In that case, the nextNode would
* contain startNode and we'll have to call breakNodes() again and also
* reassign the nextNode to something after startNode.
*/
if ( nextNode.type == CKEDITOR.NODE_ELEMENT && nextNode.contains( startNode ) )
{
breakNodes();
nextNode = startNode.getNext();
}
}
currentNode = nextNode;
}
}
range.moveToBookmark( bookmark );
}
function applyObjectStyle( range )
{
var root = range.getCommonAncestor( true, true ),
element = root.getAscendant( this.element, true );
element && !element.isReadOnly() && setupElement( element, this );
}
function removeObjectStyle( range )
{
var root = range.getCommonAncestor( true, true ),
element = root.getAscendant( this.element, true );
if ( !element )
return;
var style = this,
def = style._.definition,
attributes = def.attributes;
// Remove all defined attributes.
if ( attributes )
{
for ( var att in attributes )
{
element.removeAttribute( att, attributes[ att ] );
}
}
// Assign all defined styles.
if ( def.styles )
{
for ( var i in def.styles )
{
if ( !def.styles.hasOwnProperty( i ) )
continue;
element.removeStyle( i );
}
}
}
function applyBlockStyle( range )
{
// Serializible bookmarks is needed here since
// elements may be merged.
var bookmark = range.createBookmark( true );
var iterator = range.createIterator();
iterator.enforceRealBlocks = true;
// make recognize <br /> tag as a separator in ENTER_BR mode (#5121)
if ( this._.enterMode )
iterator.enlargeBr = ( this._.enterMode != CKEDITOR.ENTER_BR );
var block;
var doc = range.document;
var previousPreBlock;
while ( ( block = iterator.getNextParagraph() ) ) // Only one =
{
if ( !block.isReadOnly() )
{
var newBlock = getElement( this, doc, block );
replaceBlock( block, newBlock );
}
}
range.moveToBookmark( bookmark );
}
function removeBlockStyle( range )
{
// Serializible bookmarks is needed here since
// elements may be merged.
var bookmark = range.createBookmark( 1 );
var iterator = range.createIterator();
iterator.enforceRealBlocks = true;
iterator.enlargeBr = this._.enterMode != CKEDITOR.ENTER_BR;
var block;
while ( ( block = iterator.getNextParagraph() ) )
{
if ( this.checkElementRemovable( block ) )
{
// <pre> get special treatment.
if ( block.is( 'pre' ) )
{
var newBlock = this._.enterMode == CKEDITOR.ENTER_BR ?
null : range.document.createElement(
this._.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' );
newBlock && block.copyAttributes( newBlock );
replaceBlock( block, newBlock );
}
else
removeFromElement( this, block, 1 );
}
}
range.moveToBookmark( bookmark );
}
// Replace the original block with new one, with special treatment
// for <pre> blocks to make sure content format is well preserved, and merging/splitting adjacent
// when necessary.(#3188)
function replaceBlock( block, newBlock )
{
// Block is to be removed, create a temp element to
// save contents.
var removeBlock = !newBlock;
if ( removeBlock )
{
newBlock = block.getDocument().createElement( 'div' );
block.copyAttributes( newBlock );
}
var newBlockIsPre = newBlock && newBlock.is( 'pre' );
var blockIsPre = block.is( 'pre' );
var isToPre = newBlockIsPre && !blockIsPre;
var isFromPre = !newBlockIsPre && blockIsPre;
if ( isToPre )
newBlock = toPre( block, newBlock );
else if ( isFromPre )
// Split big <pre> into pieces before start to convert.
newBlock = fromPres( removeBlock ?
[ block.getHtml() ] : splitIntoPres( block ), newBlock );
else
block.moveChildren( newBlock );
newBlock.replace( block );
if ( newBlockIsPre )
{
// Merge previous <pre> blocks.
mergePre( newBlock );
}
else if ( removeBlock )
removeNoAttribsElement( newBlock );
}
/**
* Merge a <pre> block with a previous sibling if available.
*/
function mergePre( preBlock )
{
var previousBlock;
if ( !( ( previousBlock = preBlock.getPrevious( nonWhitespaces ) )
&& previousBlock.is
&& previousBlock.is( 'pre') ) )
return;
// Merge the previous <pre> block contents into the current <pre>
// block.
//
// Another thing to be careful here is that currentBlock might contain
// a '\n' at the beginning, and previousBlock might contain a '\n'
// towards the end. These new lines are not normally displayed but they
// become visible after merging.
var mergedHtml = replace( previousBlock.getHtml(), /\n$/, '' ) + '\n\n' +
replace( preBlock.getHtml(), /^\n/, '' ) ;
// Krugle: IE normalizes innerHTML from <pre>, breaking whitespaces.
if ( CKEDITOR.env.ie )
preBlock.$.outerHTML = '<pre>' + mergedHtml + '</pre>';
else
preBlock.setHtml( mergedHtml );
previousBlock.remove();
}
/**
* Split into multiple <pre> blocks separated by double line-break.
* @param preBlock
*/
function splitIntoPres( preBlock )
{
// Exclude the ones at header OR at tail,
// and ignore bookmark content between them.
var duoBrRegex = /(\S\s*)\n(?:\s|(<span[^>]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,
blockName = preBlock.getName(),
splitedHtml = replace( preBlock.getOuterHtml(),
duoBrRegex,
function( match, charBefore, bookmark )
{
return charBefore + '</pre>' + bookmark + '<pre>';
} );
var pres = [];
splitedHtml.replace( /<pre\b.*?>([\s\S]*?)<\/pre>/gi, function( match, preContent ){
pres.push( preContent );
} );
return pres;
}
// Wrapper function of String::replace without considering of head/tail bookmarks nodes.
function replace( str, regexp, replacement )
{
var headBookmark = '',
tailBookmark = '';
str = str.replace( /(^<span[^>]+data-cke-bookmark.*?\/span>)|(<span[^>]+data-cke-bookmark.*?\/span>$)/gi,
function( str, m1, m2 ){
m1 && ( headBookmark = m1 );
m2 && ( tailBookmark = m2 );
return '';
} );
return headBookmark + str.replace( regexp, replacement ) + tailBookmark;
}
/**
* Converting a list of <pre> into blocks with format well preserved.
*/
function fromPres( preHtmls, newBlock )
{
var docFrag;
if ( preHtmls.length > 1 )
docFrag = new CKEDITOR.dom.documentFragment( newBlock.getDocument() );
for ( var i = 0 ; i < preHtmls.length ; i++ )
{
var blockHtml = preHtmls[ i ];
// 1. Trim the first and last line-breaks immediately after and before <pre>,
// they're not visible.
blockHtml = blockHtml.replace( /(\r\n|\r)/g, '\n' ) ;
blockHtml = replace( blockHtml, /^[ \t]*\n/, '' ) ;
blockHtml = replace( blockHtml, /\n$/, '' ) ;
// 2. Convert spaces or tabs at the beginning or at the end to
blockHtml = replace( blockHtml, /^[ \t]+|[ \t]+$/g, function( match, offset, s )
{
if ( match.length == 1 ) // one space, preserve it
return ' ' ;
else if ( !offset ) // beginning of block
return CKEDITOR.tools.repeat( ' ', match.length - 1 ) + ' ';
else // end of block
return ' ' + CKEDITOR.tools.repeat( ' ', match.length - 1 );
} ) ;
// 3. Convert \n to <BR>.
// 4. Convert contiguous (i.e. non-singular) spaces or tabs to
blockHtml = blockHtml.replace( /\n/g, '<br>' ) ;
blockHtml = blockHtml.replace( /[ \t]{2,}/g,
function ( match )
{
return CKEDITOR.tools.repeat( ' ', match.length - 1 ) + ' ' ;
} ) ;
if ( docFrag )
{
var newBlockClone = newBlock.clone();
newBlockClone.setHtml( blockHtml );
docFrag.append( newBlockClone );
}
else
newBlock.setHtml( blockHtml );
}
return docFrag || newBlock;
}
/**
* Converting from a non-PRE block to a PRE block in formatting operations.
*/
function toPre( block, newBlock )
{
var bogus = block.getBogus();
bogus && bogus.remove();
// First trim the block content.
var preHtml = block.getHtml();
// 1. Trim head/tail spaces, they're not visible.
preHtml = replace( preHtml, /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, '' );
// 2. Delete ANSI whitespaces immediately before and after <BR> because
// they are not visible.
preHtml = preHtml.replace( /[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi, '$1' );
// 3. Compress other ANSI whitespaces since they're only visible as one
// single space previously.
// 4. Convert to spaces since is no longer needed in <PRE>.
preHtml = preHtml.replace( /([ \t\n\r]+| )/g, ' ' );
// 5. Convert any <BR /> to \n. This must not be done earlier because
// the \n would then get compressed.
preHtml = preHtml.replace( /<br\b[^>]*>/gi, '\n' );
// Krugle: IE normalizes innerHTML to <pre>, breaking whitespaces.
if ( CKEDITOR.env.ie )
{
var temp = block.getDocument().createElement( 'div' );
temp.append( newBlock );
newBlock.$.outerHTML = '<pre>' + preHtml + '</pre>';
newBlock.copyAttributes( temp.getFirst() );
newBlock = temp.getFirst().remove();
}
else
newBlock.setHtml( preHtml );
return newBlock;
}
// Removes a style from an element itself, don't care about its subtree.
function removeFromElement( style, element )
{
var def = style._.definition,
attributes = def.attributes,
styles = def.styles,
overrides = getOverrides( style )[ element.getName() ],
// If the style is only about the element itself, we have to remove the element.
removeEmpty = CKEDITOR.tools.isEmpty( attributes ) && CKEDITOR.tools.isEmpty( styles );
// Remove definition attributes/style from the elemnt.
for ( var attName in attributes )
{
// The 'class' element value must match (#1318).
if ( ( attName == 'class' || style._.definition.fullMatch )
&& element.getAttribute( attName ) != normalizeProperty( attName, attributes[ attName ] ) )
continue;
removeEmpty = element.hasAttribute( attName );
element.removeAttribute( attName );
}
for ( var styleName in styles )
{
// Full match style insist on having fully equivalence. (#5018)
if ( style._.definition.fullMatch
&& element.getStyle( styleName ) != normalizeProperty( styleName, styles[ styleName ], true ) )
continue;
removeEmpty = removeEmpty || !!element.getStyle( styleName );
element.removeStyle( styleName );
}
// Remove overrides, but don't remove the element if it's a block element
removeOverrides( element, overrides, blockElements[ element.getName() ] ) ;
if ( removeEmpty )
{
!CKEDITOR.dtd.$block[ element.getName() ] || style._.enterMode == CKEDITOR.ENTER_BR && !element.hasAttributes() ?
removeNoAttribsElement( element ) :
element.renameNode( style._.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' );
}
}
// Removes a style from inside an element.
function removeFromInsideElement( style, element )
{
var def = style._.definition,
attribs = def.attributes,
styles = def.styles,
overrides = getOverrides( style ),
innerElements = element.getElementsByTag( style.element );
for ( var i = innerElements.count(); --i >= 0 ; )
removeFromElement( style, innerElements.getItem( i ) );
// Now remove any other element with different name that is
// defined to be overriden.
for ( var overrideElement in overrides )
{
if ( overrideElement != style.element )
{
innerElements = element.getElementsByTag( overrideElement ) ;
for ( i = innerElements.count() - 1 ; i >= 0 ; i-- )
{
var innerElement = innerElements.getItem( i );
removeOverrides( innerElement, overrides[ overrideElement ] ) ;
}
}
}
}
/**
* Remove overriding styles/attributes from the specific element.
* Note: Remove the element if no attributes remain.
* @param {Object} element
* @param {Object} overrides
* @param {Boolean} Don't remove the element
*/
function removeOverrides( element, overrides, dontRemove )
{
var attributes = overrides && overrides.attributes ;
if ( attributes )
{
for ( var i = 0 ; i < attributes.length ; i++ )
{
var attName = attributes[i][0], actualAttrValue ;
if ( ( actualAttrValue = element.getAttribute( attName ) ) )
{
var attValue = attributes[i][1] ;
// Remove the attribute if:
// - The override definition value is null ;
// - The override definition valie is a string that
// matches the attribute value exactly.
// - The override definition value is a regex that
// has matches in the attribute value.
if ( attValue === null ||
( attValue.test && attValue.test( actualAttrValue ) ) ||
( typeof attValue == 'string' && actualAttrValue == attValue ) )
element.removeAttribute( attName ) ;
}
}
}
if ( !dontRemove )
removeNoAttribsElement( element );
}
// If the element has no more attributes, remove it.
function removeNoAttribsElement( element )
{
// If no more attributes remained in the element, remove it,
// leaving its children.
if ( !element.hasAttributes() )
{
if ( CKEDITOR.dtd.$block[ element.getName() ] )
{
var previous = element.getPrevious( nonWhitespaces ),
next = element.getNext( nonWhitespaces );
if ( previous && ( previous.type == CKEDITOR.NODE_TEXT || !previous.isBlockBoundary( { br : 1 } ) ) )
element.append( 'br', 1 );
if ( next && ( next.type == CKEDITOR.NODE_TEXT || !next.isBlockBoundary( { br : 1 } ) ) )
element.append( 'br' );
element.remove( true );
}
else
{
// Removing elements may open points where merging is possible,
// so let's cache the first and last nodes for later checking.
var firstChild = element.getFirst();
var lastChild = element.getLast();
element.remove( true );
if ( firstChild )
{
// Check the cached nodes for merging.
firstChild.type == CKEDITOR.NODE_ELEMENT && firstChild.mergeSiblings();
if ( lastChild && !firstChild.equals( lastChild )
&& lastChild.type == CKEDITOR.NODE_ELEMENT )
lastChild.mergeSiblings();
}
}
}
}
function getElement( style, targetDocument, element )
{
var el,
def = style._.definition,
elementName = style.element;
// The "*" element name will always be a span for this function.
if ( elementName == '*' )
elementName = 'span';
// Create the element.
el = new CKEDITOR.dom.element( elementName, targetDocument );
// #6226: attributes should be copied before the new ones are applied
if ( element )
element.copyAttributes( el );
el = setupElement( el, style );
// Avoid ID duplication.
if ( targetDocument.getCustomData( 'doc_processing_style' ) && el.hasAttribute( 'id' ) )
el.removeAttribute( 'id' );
else
targetDocument.setCustomData( 'doc_processing_style', 1 );
return el;
}
function setupElement( el, style )
{
var def = style._.definition,
attributes = def.attributes,
styles = CKEDITOR.style.getStyleText( def );
// Assign all defined attributes.
if ( attributes )
{
for ( var att in attributes )
{
el.setAttribute( att, attributes[ att ] );
}
}
// Assign all defined styles.
if( styles )
el.setAttribute( 'style', styles );
return el;
}
function replaceVariables( list, variablesValues )
{
for ( var item in list )
{
list[ item ] = list[ item ].replace( varRegex, function( match, varName )
{
return variablesValues[ varName ];
});
}
}
// Returns an object that can be used for style matching comparison.
// Attributes names and values are all lowercased, and the styles get
// merged with the style attribute.
function getAttributesForComparison( styleDefinition )
{
// If we have already computed it, just return it.
var attribs = styleDefinition._AC;
if ( attribs )
return attribs;
attribs = {};
var length = 0;
// Loop through all defined attributes.
var styleAttribs = styleDefinition.attributes;
if ( styleAttribs )
{
for ( var styleAtt in styleAttribs )
{
length++;
attribs[ styleAtt ] = styleAttribs[ styleAtt ];
}
}
// Includes the style definitions.
var styleText = CKEDITOR.style.getStyleText( styleDefinition );
if ( styleText )
{
if ( !attribs[ 'style' ] )
length++;
attribs[ 'style' ] = styleText;
}
// Appends the "length" information to the object.
attribs._length = length;
// Return it, saving it to the next request.
return ( styleDefinition._AC = attribs );
}
/**
* Get the the collection used to compare the elements and attributes,
* defined in this style overrides, with other element. All information in
* it is lowercased.
* @param {CKEDITOR.style} style
*/
function getOverrides( style )
{
if ( style._.overrides )
return style._.overrides;
var overrides = ( style._.overrides = {} ),
definition = style._.definition.overrides;
if ( definition )
{
// The override description can be a string, object or array.
// Internally, well handle arrays only, so transform it if needed.
if ( !CKEDITOR.tools.isArray( definition ) )
definition = [ definition ];
// Loop through all override definitions.
for ( var i = 0 ; i < definition.length ; i++ )
{
var override = definition[i];
var elementName;
var overrideEl;
var attrs;
// If can be a string with the element name.
if ( typeof override == 'string' )
elementName = override.toLowerCase();
// Or an object.
else
{
elementName = override.element ? override.element.toLowerCase() : style.element;
attrs = override.attributes;
}
// We can have more than one override definition for the same
// element name, so we attempt to simply append information to
// it if it already exists.
overrideEl = overrides[ elementName ] || ( overrides[ elementName ] = {} );
if ( attrs )
{
// The returning attributes list is an array, because we
// could have different override definitions for the same
// attribute name.
var overrideAttrs = ( overrideEl.attributes = overrideEl.attributes || new Array() );
for ( var attName in attrs )
{
// Each item in the attributes array is also an array,
// where [0] is the attribute name and [1] is the
// override value.
overrideAttrs.push( [ attName.toLowerCase(), attrs[ attName ] ] );
}
}
}
}
return overrides;
}
// Make the comparison of attribute value easier by standardizing it.
function normalizeProperty( name, value, isStyle )
{
var temp = new CKEDITOR.dom.element( 'span' );
temp [ isStyle ? 'setStyle' : 'setAttribute' ]( name, value );
return temp[ isStyle ? 'getStyle' : 'getAttribute' ]( name );
}
// Make the comparison of style text easier by standardizing it.
function normalizeCssText( unparsedCssText, nativeNormalize )
{
var styleText;
if ( nativeNormalize !== false )
{
// Injects the style in a temporary span object, so the browser parses it,
// retrieving its final format.
var temp = new CKEDITOR.dom.element( 'span' );
temp.setAttribute( 'style', unparsedCssText );
styleText = temp.getAttribute( 'style' ) || '';
}
else
styleText = unparsedCssText;
// Normalize font-family property, ignore quotes and being case insensitive. (#7322)
// http://www.w3.org/TR/css3-fonts/#font-family-the-font-family-property
styleText = styleText.replace( /(font-family:)(.*?)(?=;|$)/, function ( match, prop, val )
{
var names = val.split( ',' );
for ( var i = 0; i < names.length; i++ )
names[ i ] = CKEDITOR.tools.trim( names[ i ].replace( /["']/g, '' ) );
return prop + names.join( ',' );
});
// Shrinking white-spaces around colon and semi-colon (#4147).
// Compensate tail semi-colon.
return styleText.replace( /\s*([;:])\s*/, '$1' )
.replace( /([^\s;])$/, '$1;')
// Trimming spaces after comma(#4107),
// remove quotations(#6403),
// mostly for differences on "font-family".
.replace( /,\s+/g, ',' )
.replace( /\"/g,'' )
.toLowerCase();
}
// Turn inline style text properties into one hash.
function parseStyleText( styleText )
{
var retval = {};
styleText
.replace( /"/g, '"' )
.replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value )
{
retval[ name ] = value;
} );
return retval;
}
/**
* Compare two bunch of styles, with the speciality that value 'inherit'
* is treated as a wildcard which will match any value.
* @param {Object|String} source
* @param {Object|String} target
*/
function compareCssText( source, target )
{
typeof source == 'string' && ( source = parseStyleText( source ) );
typeof target == 'string' && ( target = parseStyleText( target ) );
for( var name in source )
{
if ( !( name in target &&
( target[ name ] == source[ name ]
|| source[ name ] == 'inherit'
|| target[ name ] == 'inherit' ) ) )
{
return false;
}
}
return true;
}
function applyStyle( document, remove )
{
var selection = document.getSelection(),
// Bookmark the range so we can re-select it after processing.
bookmarks = selection.createBookmarks( 1 ),
ranges = selection.getRanges(),
func = remove ? this.removeFromRange : this.applyToRange,
range;
var iterator = ranges.createIterator();
while ( ( range = iterator.getNextRange() ) )
func.call( this, range );
if ( bookmarks.length == 1 && bookmarks[ 0 ].collapsed )
{
selection.selectRanges( ranges );
document.getById( bookmarks[ 0 ].startNode ).remove();
}
else
selection.selectBookmarks( bookmarks );
document.removeCustomData( 'doc_processing_style' );
}
})();
CKEDITOR.styleCommand = function( style )
{
this.style = style;
};
CKEDITOR.styleCommand.prototype.exec = function( editor )
{
editor.focus();
var doc = editor.document;
if ( doc )
{
if ( this.state == CKEDITOR.TRISTATE_OFF )
this.style.apply( doc );
else if ( this.state == CKEDITOR.TRISTATE_ON )
this.style.remove( doc );
}
return !!doc;
};
/**
* Manages styles registration and loading. See also {@link CKEDITOR.config.stylesSet}.
* @namespace
* @augments CKEDITOR.resourceManager
* @constructor
* @since 3.2
* @example
* // The set of styles for the <b>Styles</b> combo
* CKEDITOR.stylesSet.add( 'default',
* [
* // Block Styles
* { name : 'Blue Title' , element : 'h3', styles : { 'color' : 'Blue' } },
* { name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } },
*
* // Inline Styles
* { name : 'Marker: Yellow' , element : 'span', styles : { 'background-color' : 'Yellow' } },
* { name : 'Marker: Green' , element : 'span', styles : { 'background-color' : 'Lime' } },
*
* // Object Styles
* {
* name : 'Image on Left',
* element : 'img',
* attributes :
* {
* 'style' : 'padding: 5px; margin-right: 5px',
* 'border' : '2',
* 'align' : 'left'
* }
* }
* ]);
*/
CKEDITOR.stylesSet = new CKEDITOR.resourceManager( '', 'stylesSet' );
// Backward compatibility (#5025).
CKEDITOR.addStylesSet = CKEDITOR.tools.bind( CKEDITOR.stylesSet.add, CKEDITOR.stylesSet );
CKEDITOR.loadStylesSet = function( name, url, callback )
{
CKEDITOR.stylesSet.addExternal( name, url, '' );
CKEDITOR.stylesSet.load( name, callback );
};
/**
* Gets the current styleSet for this instance
* @param {Function} callback The function to be called with the styles data.
* @example
* editor.getStylesSet( function( stylesDefinitions ) {} );
*/
CKEDITOR.editor.prototype.getStylesSet = function( callback )
{
if ( !this._.stylesDefinitions )
{
var editor = this,
// Respect the backwards compatible definition entry
configStyleSet = editor.config.stylesCombo_stylesSet || editor.config.stylesSet || 'default';
// #5352 Allow to define the styles directly in the config object
if ( configStyleSet instanceof Array )
{
editor._.stylesDefinitions = configStyleSet;
callback( configStyleSet );
return;
}
var partsStylesSet = configStyleSet.split( ':' ),
styleSetName = partsStylesSet[ 0 ],
externalPath = partsStylesSet[ 1 ],
pluginPath = CKEDITOR.plugins.registered.styles.path;
CKEDITOR.stylesSet.addExternal( styleSetName,
externalPath ?
partsStylesSet.slice( 1 ).join( ':' ) :
pluginPath + 'styles/' + styleSetName + '.js', '' );
CKEDITOR.stylesSet.load( styleSetName, function( stylesSet )
{
editor._.stylesDefinitions = stylesSet[ styleSetName ];
callback( editor._.stylesDefinitions );
} ) ;
}
else
callback( this._.stylesDefinitions );
};
/**
* Indicates that fully selected read-only elements will be included when
* applying the style (for inline styles only).
* @name CKEDITOR.style.includeReadonly
* @type Boolean
* @default false
* @since 3.5
*/
/**
* Disables inline styling on read-only elements.
* @name CKEDITOR.config.disableReadonlyStyling
* @type Boolean
* @default false
* @since 3.5
*/
/**
* The "styles definition set" to use in the editor. They will be used in the
* styles combo and the Style selector of the div container. <br>
* The styles may be defined in the page containing the editor, or can be
* loaded on demand from an external file. In the second case, if this setting
* contains only a name, the styles definition file will be loaded from the
* "styles" folder inside the styles plugin folder.
* Otherwise, this setting has the "name:url" syntax, making it
* possible to set the URL from which loading the styles file.<br>
* Previously this setting was available as config.stylesCombo_stylesSet<br>
* @name CKEDITOR.config.stylesSet
* @type String|Array
* @default 'default'
* @since 3.3
* @example
* // Load from the styles' styles folder (mystyles.js file).
* config.stylesSet = 'mystyles';
* @example
* // Load from a relative URL.
* config.stylesSet = 'mystyles:/editorstyles/styles.js';
* @example
* // Load from a full URL.
* config.stylesSet = 'mystyles:http://www.example.com/editorstyles/styles.js';
* @example
* // Load from a list of definitions.
* config.stylesSet = [
* { name : 'Strong Emphasis', element : 'strong' },
* { name : 'Emphasis', element : 'em' }, ... ];
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.stylesSet.add( 'default',
[
/* Block Styles */
// These styles are already available in the "Format" combo, so they are
// not needed here by default. You may enable them to avoid placing the
// "Format" combo in the toolbar, maintaining the same features.
/*
{ name : 'Paragraph' , element : 'p' },
{ name : 'Heading 1' , element : 'h1' },
{ name : 'Heading 2' , element : 'h2' },
{ name : 'Heading 3' , element : 'h3' },
{ name : 'Heading 4' , element : 'h4' },
{ name : 'Heading 5' , element : 'h5' },
{ name : 'Heading 6' , element : 'h6' },
{ name : 'Preformatted Text', element : 'pre' },
{ name : 'Address' , element : 'address' },
*/
{ name : 'Blue Title' , element : 'h3', styles : { 'color' : 'Blue' } },
{ name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } },
/* Inline Styles */
// These are core styles available as toolbar buttons. You may opt enabling
// some of them in the Styles combo, removing them from the toolbar.
/*
{ name : 'Strong' , element : 'strong', overrides : 'b' },
{ name : 'Emphasis' , element : 'em' , overrides : 'i' },
{ name : 'Underline' , element : 'u' },
{ name : 'Strikethrough' , element : 'strike' },
{ name : 'Subscript' , element : 'sub' },
{ name : 'Superscript' , element : 'sup' },
*/
{ name : 'Marker: Yellow' , element : 'span', styles : { 'background-color' : 'Yellow' } },
{ name : 'Marker: Green' , element : 'span', styles : { 'background-color' : 'Lime' } },
{ name : 'Big' , element : 'big' },
{ name : 'Small' , element : 'small' },
{ name : 'Typewriter' , element : 'tt' },
{ name : 'Computer Code' , element : 'code' },
{ name : 'Keyboard Phrase' , element : 'kbd' },
{ name : 'Sample Text' , element : 'samp' },
{ name : 'Variable' , element : 'var' },
{ name : 'Deleted Text' , element : 'del' },
{ name : 'Inserted Text' , element : 'ins' },
{ name : 'Cited Work' , element : 'cite' },
{ name : 'Inline Quotation' , element : 'q' },
{ name : 'Language: RTL' , element : 'span', attributes : { 'dir' : 'rtl' } },
{ name : 'Language: LTR' , element : 'span', attributes : { 'dir' : 'ltr' } },
/* Object Styles */
{
name : 'Image on Left',
element : 'img',
attributes :
{
'style' : 'padding: 5px; margin-right: 5px',
'border' : '2',
'align' : 'left'
}
},
{
name : 'Image on Right',
element : 'img',
attributes :
{
'style' : 'padding: 5px; margin-left: 5px',
'border' : '2',
'align' : 'right'
}
},
{ name : 'Borderless Table', element : 'table', styles: { 'border-style': 'hidden', 'background-color' : '#E6E6FA' } },
{ name : 'Square Bulleted List', element : 'ul', styles : { 'list-style-type' : 'square' } }
]);
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'format',
{
requires : [ 'richcombo', 'styles' ],
init : function( editor )
{
var config = editor.config,
lang = editor.lang.format;
// Gets the list of tags from the settings.
var tags = config.format_tags.split( ';' );
// Create style objects for all defined styles.
var styles = {};
for ( var i = 0 ; i < tags.length ; i++ )
{
var tag = tags[ i ];
styles[ tag ] = new CKEDITOR.style( config[ 'format_' + tag ] );
styles[ tag ]._.enterMode = editor.config.enterMode;
}
editor.ui.addRichCombo( 'Format',
{
label : lang.label,
title : lang.panelTitle,
className : 'cke_format',
panel :
{
css : editor.skin.editor.css.concat( config.contentsCss ),
multiSelect : false,
attributes : { 'aria-label' : lang.panelTitle }
},
init : function()
{
this.startGroup( lang.panelTitle );
for ( var tag in styles )
{
var label = lang[ 'tag_' + tag ];
// Add the tag entry to the panel list.
this.add( tag, styles[tag].buildPreview( label ), label );
}
},
onClick : function( value )
{
editor.focus();
editor.fire( 'saveSnapshot' );
var style = styles[ value ],
elementPath = new CKEDITOR.dom.elementPath( editor.getSelection().getStartElement() );
style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document );
// Save the undo snapshot after all changes are affected. (#4899)
setTimeout( function()
{
editor.fire( 'saveSnapshot' );
}, 0 );
},
onRender : function()
{
editor.on( 'selectionChange', function( ev )
{
var currentTag = this.getValue();
var elementPath = ev.data.path;
for ( var tag in styles )
{
if ( styles[ tag ].checkActive( elementPath ) )
{
if ( tag != currentTag )
this.setValue( tag, editor.lang.format[ 'tag_' + tag ] );
return;
}
}
// If no styles match, just empty it.
this.setValue( '' );
},
this);
}
});
}
});
/**
* A list of semi colon separated style names (by default tags) representing
* the style definition for each entry to be displayed in the Format combo in
* the toolbar. Each entry must have its relative definition configuration in a
* setting named "format_(tagName)". For example, the "p" entry has its
* definition taken from config.format_p.
* @type String
* @default 'p;h1;h2;h3;h4;h5;h6;pre;address;div'
* @example
* config.format_tags = 'p;h2;h3;pre'
*/
CKEDITOR.config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div';
/**
* The style definition to be used to apply the "Normal" format.
* @type Object
* @default { element : 'p' }
* @example
* config.format_p = { element : 'p', attributes : { 'class' : 'normalPara' } };
*/
CKEDITOR.config.format_p = { element : 'p' };
/**
* The style definition to be used to apply the "Normal (DIV)" format.
* @type Object
* @default { element : 'div' }
* @example
* config.format_div = { element : 'div', attributes : { 'class' : 'normalDiv' } };
*/
CKEDITOR.config.format_div = { element : 'div' };
/**
* The style definition to be used to apply the "Formatted" format.
* @type Object
* @default { element : 'pre' }
* @example
* config.format_pre = { element : 'pre', attributes : { 'class' : 'code' } };
*/
CKEDITOR.config.format_pre = { element : 'pre' };
/**
* The style definition to be used to apply the "Address" format.
* @type Object
* @default { element : 'address' }
* @example
* config.format_address = { element : 'address', attributes : { 'class' : 'styledAddress' } };
*/
CKEDITOR.config.format_address = { element : 'address' };
/**
* The style definition to be used to apply the "Heading 1" format.
* @type Object
* @default { element : 'h1' }
* @example
* config.format_h1 = { element : 'h1', attributes : { 'class' : 'contentTitle1' } };
*/
CKEDITOR.config.format_h1 = { element : 'h1' };
/**
* The style definition to be used to apply the "Heading 1" format.
* @type Object
* @default { element : 'h2' }
* @example
* config.format_h2 = { element : 'h2', attributes : { 'class' : 'contentTitle2' } };
*/
CKEDITOR.config.format_h2 = { element : 'h2' };
/**
* The style definition to be used to apply the "Heading 1" format.
* @type Object
* @default { element : 'h3' }
* @example
* config.format_h3 = { element : 'h3', attributes : { 'class' : 'contentTitle3' } };
*/
CKEDITOR.config.format_h3 = { element : 'h3' };
/**
* The style definition to be used to apply the "Heading 1" format.
* @type Object
* @default { element : 'h4' }
* @example
* config.format_h4 = { element : 'h4', attributes : { 'class' : 'contentTitle4' } };
*/
CKEDITOR.config.format_h4 = { element : 'h4' };
/**
* The style definition to be used to apply the "Heading 1" format.
* @type Object
* @default { element : 'h5' }
* @example
* config.format_h5 = { element : 'h5', attributes : { 'class' : 'contentTitle5' } };
*/
CKEDITOR.config.format_h5 = { element : 'h5' };
/**
* The style definition to be used to apply the "Heading 1" format.
* @type Object
* @default { element : 'h6' }
* @example
* config.format_h6 = { element : 'h6', attributes : { 'class' : 'contentTitle6' } };
*/
CKEDITOR.config.format_h6 = { element : 'h6' };
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Undo/Redo system for saving shapshot for document modification
* and other recordable changes.
*/
(function()
{
CKEDITOR.plugins.add( 'undo',
{
requires : [ 'selection', 'wysiwygarea' ],
init : function( editor )
{
var undoManager = new UndoManager( editor );
var undoCommand = editor.addCommand( 'undo',
{
exec : function()
{
if ( undoManager.undo() )
{
editor.selectionChange();
this.fire( 'afterUndo' );
}
},
state : CKEDITOR.TRISTATE_DISABLED,
canUndo : false
});
var redoCommand = editor.addCommand( 'redo',
{
exec : function()
{
if ( undoManager.redo() )
{
editor.selectionChange();
this.fire( 'afterRedo' );
}
},
state : CKEDITOR.TRISTATE_DISABLED,
canUndo : false
});
undoManager.onChange = function()
{
undoCommand.setState( undoManager.undoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
redoCommand.setState( undoManager.redoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
};
function recordCommand( event )
{
// If the command hasn't been marked to not support undo.
if ( undoManager.enabled && event.data.command.canUndo !== false )
undoManager.save();
}
// We'll save snapshots before and after executing a command.
editor.on( 'beforeCommandExec', recordCommand );
editor.on( 'afterCommandExec', recordCommand );
// Save snapshots before doing custom changes.
editor.on( 'saveSnapshot', function( evt )
{
undoManager.save( evt.data && evt.data.contentOnly );
});
// Registering keydown on every document recreation.(#3844)
editor.on( 'contentDom', function()
{
editor.document.on( 'keydown', function( event )
{
// Do not capture CTRL hotkeys.
if ( !event.data.$.ctrlKey && !event.data.$.metaKey )
undoManager.type( event );
});
});
// Always save an undo snapshot - the previous mode might have
// changed editor contents.
editor.on( 'beforeModeUnload', function()
{
editor.mode == 'wysiwyg' && undoManager.save( true );
});
// Make the undo manager available only in wysiwyg mode.
editor.on( 'mode', function()
{
undoManager.enabled = editor.readOnly ? false : editor.mode == 'wysiwyg';
undoManager.onChange();
});
editor.ui.addButton( 'Undo',
{
label : editor.lang.undo,
command : 'undo'
});
editor.ui.addButton( 'Redo',
{
label : editor.lang.redo,
command : 'redo'
});
editor.resetUndo = function()
{
// Reset the undo stack.
undoManager.reset();
// Create the first image.
editor.fire( 'saveSnapshot' );
};
/**
* Amend the top of undo stack (last undo image) with the current DOM changes.
* @name CKEDITOR.editor#updateUndo
* @example
* function()
* {
* editor.fire( 'saveSnapshot' );
* editor.document.body.append(...);
* // Make new changes following the last undo snapshot part of it.
* editor.fire( 'updateSnapshot' );
* ...
* }
*/
editor.on( 'updateSnapshot', function()
{
if ( undoManager.currentImage )
undoManager.update();
});
}
});
CKEDITOR.plugins.undo = {};
/**
* Undo snapshot which represents the current document status.
* @name CKEDITOR.plugins.undo.Image
* @param editor The editor instance on which the image is created.
*/
var Image = CKEDITOR.plugins.undo.Image = function( editor )
{
this.editor = editor;
editor.fire( 'beforeUndoImage' );
var contents = editor.getSnapshot(),
selection = contents && editor.getSelection();
// In IE, we need to remove the expando attributes.
CKEDITOR.env.ie && contents && ( contents = contents.replace( /\s+data-cke-expando=".*?"/g, '' ) );
this.contents = contents;
this.bookmarks = selection && selection.createBookmarks2( true );
editor.fire( 'afterUndoImage' );
};
// Attributes that browser may changing them when setting via innerHTML.
var protectedAttrs = /\b(?:href|src|name)="[^"]*?"/gi;
Image.prototype =
{
equals : function( otherImage, contentOnly )
{
var thisContents = this.contents,
otherContents = otherImage.contents;
// For IE6/7 : Comparing only the protected attribute values but not the original ones.(#4522)
if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
{
thisContents = thisContents.replace( protectedAttrs, '' );
otherContents = otherContents.replace( protectedAttrs, '' );
}
if ( thisContents != otherContents )
return false;
if ( contentOnly )
return true;
var bookmarksA = this.bookmarks,
bookmarksB = otherImage.bookmarks;
if ( bookmarksA || bookmarksB )
{
if ( !bookmarksA || !bookmarksB || bookmarksA.length != bookmarksB.length )
return false;
for ( var i = 0 ; i < bookmarksA.length ; i++ )
{
var bookmarkA = bookmarksA[ i ],
bookmarkB = bookmarksB[ i ];
if (
bookmarkA.startOffset != bookmarkB.startOffset ||
bookmarkA.endOffset != bookmarkB.endOffset ||
!CKEDITOR.tools.arrayCompare( bookmarkA.start, bookmarkB.start ) ||
!CKEDITOR.tools.arrayCompare( bookmarkA.end, bookmarkB.end ) )
{
return false;
}
}
}
return true;
}
};
/**
* @constructor Main logic for Redo/Undo feature.
*/
function UndoManager( editor )
{
this.editor = editor;
// Reset the undo stack.
this.reset();
}
var editingKeyCodes = { /*Backspace*/ 8:1, /*Delete*/ 46:1 },
modifierKeyCodes = { /*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1 },
navigationKeyCodes = { 37:1, 38:1, 39:1, 40:1 }; // Arrows: L, T, R, B
UndoManager.prototype =
{
/**
* Process undo system regard keystrikes.
* @param {CKEDITOR.dom.event} event
*/
type : function( event )
{
var keystroke = event && event.data.getKey(),
isModifierKey = keystroke in modifierKeyCodes,
isEditingKey = keystroke in editingKeyCodes,
wasEditingKey = this.lastKeystroke in editingKeyCodes,
sameAsLastEditingKey = isEditingKey && keystroke == this.lastKeystroke,
// Keystrokes which navigation through contents.
isReset = keystroke in navigationKeyCodes,
wasReset = this.lastKeystroke in navigationKeyCodes,
// Keystrokes which just introduce new contents.
isContent = ( !isEditingKey && !isReset ),
// Create undo snap for every different modifier key.
modifierSnapshot = ( isEditingKey && !sameAsLastEditingKey ),
// Create undo snap on the following cases:
// 1. Just start to type .
// 2. Typing some content after a modifier.
// 3. Typing some content after make a visible selection.
startedTyping = !( isModifierKey || this.typing )
|| ( isContent && ( wasEditingKey || wasReset ) );
if ( startedTyping || modifierSnapshot )
{
var beforeTypeImage = new Image( this.editor ),
beforeTypeCount = this.snapshots.length;
// Use setTimeout, so we give the necessary time to the
// browser to insert the character into the DOM.
CKEDITOR.tools.setTimeout( function()
{
var currentSnapshot = this.editor.getSnapshot();
// In IE, we need to remove the expando attributes.
if ( CKEDITOR.env.ie )
currentSnapshot = currentSnapshot.replace( /\s+data-cke-expando=".*?"/g, '' );
// If changes have taken place, while not been captured yet (#8459),
// compensate the snapshot.
if ( beforeTypeImage.contents != currentSnapshot &&
beforeTypeCount == this.snapshots.length )
{
// It's safe to now indicate typing state.
this.typing = true;
// This's a special save, with specified snapshot
// and without auto 'fireChange'.
if ( !this.save( false, beforeTypeImage, false ) )
// Drop future snapshots.
this.snapshots.splice( this.index + 1, this.snapshots.length - this.index - 1 );
this.hasUndo = true;
this.hasRedo = false;
this.typesCount = 1;
this.modifiersCount = 1;
this.onChange();
}
},
0, this
);
}
this.lastKeystroke = keystroke;
// Create undo snap after typed too much (over 25 times).
if ( isEditingKey )
{
this.typesCount = 0;
this.modifiersCount++;
if ( this.modifiersCount > 25 )
{
this.save( false, null, false );
this.modifiersCount = 1;
}
}
else if ( !isReset )
{
this.modifiersCount = 0;
this.typesCount++;
if ( this.typesCount > 25 )
{
this.save( false, null, false );
this.typesCount = 1;
}
}
},
reset : function() // Reset the undo stack.
{
/**
* Remember last pressed key.
*/
this.lastKeystroke = 0;
/**
* Stack for all the undo and redo snapshots, they're always created/removed
* in consistency.
*/
this.snapshots = [];
/**
* Current snapshot history index.
*/
this.index = -1;
this.limit = this.editor.config.undoStackSize || 20;
this.currentImage = null;
this.hasUndo = false;
this.hasRedo = false;
this.resetType();
},
/**
* Reset all states about typing.
* @see UndoManager.type
*/
resetType : function()
{
this.typing = false;
delete this.lastKeystroke;
this.typesCount = 0;
this.modifiersCount = 0;
},
fireChange : function()
{
this.hasUndo = !!this.getNextImage( true );
this.hasRedo = !!this.getNextImage( false );
// Reset typing
this.resetType();
this.onChange();
},
/**
* Save a snapshot of document image for later retrieve.
*/
save : function( onContentOnly, image, autoFireChange )
{
var snapshots = this.snapshots;
// Get a content image.
if ( !image )
image = new Image( this.editor );
// Do nothing if it was not possible to retrieve an image.
if ( image.contents === false )
return false;
// Check if this is a duplicate. In such case, do nothing.
if ( this.currentImage && image.equals( this.currentImage, onContentOnly ) )
return false;
// Drop future snapshots.
snapshots.splice( this.index + 1, snapshots.length - this.index - 1 );
// If we have reached the limit, remove the oldest one.
if ( snapshots.length == this.limit )
snapshots.shift();
// Add the new image, updating the current index.
this.index = snapshots.push( image ) - 1;
this.currentImage = image;
if ( autoFireChange !== false )
this.fireChange();
return true;
},
restoreImage : function( image )
{
// Bring editor focused to restore selection.
var editor = this.editor,
sel;
if ( image.bookmarks )
{
editor.focus();
// Retrieve the selection beforehand. (#8324)
sel = editor.getSelection();
}
this.editor.loadSnapshot( image.contents );
if ( image.bookmarks )
sel.selectBookmarks( image.bookmarks );
else if ( CKEDITOR.env.ie )
{
// IE BUG: If I don't set the selection to *somewhere* after setting
// document contents, then IE would create an empty paragraph at the bottom
// the next time the document is modified.
var $range = this.editor.document.getBody().$.createTextRange();
$range.collapse( true );
$range.select();
}
this.index = image.index;
// Update current image with the actual editor
// content, since actualy content may differ from
// the original snapshot due to dom change. (#4622)
this.update();
this.fireChange();
},
// Get the closest available image.
getNextImage : function( isUndo )
{
var snapshots = this.snapshots,
currentImage = this.currentImage,
image, i;
if ( currentImage )
{
if ( isUndo )
{
for ( i = this.index - 1 ; i >= 0 ; i-- )
{
image = snapshots[ i ];
if ( !currentImage.equals( image, true ) )
{
image.index = i;
return image;
}
}
}
else
{
for ( i = this.index + 1 ; i < snapshots.length ; i++ )
{
image = snapshots[ i ];
if ( !currentImage.equals( image, true ) )
{
image.index = i;
return image;
}
}
}
}
return null;
},
/**
* Check the current redo state.
* @return {Boolean} Whether the document has previous state to
* retrieve.
*/
redoable : function()
{
return this.enabled && this.hasRedo;
},
/**
* Check the current undo state.
* @return {Boolean} Whether the document has future state to restore.
*/
undoable : function()
{
return this.enabled && this.hasUndo;
},
/**
* Perform undo on current index.
*/
undo : function()
{
if ( this.undoable() )
{
this.save( true );
var image = this.getNextImage( true );
if ( image )
return this.restoreImage( image ), true;
}
return false;
},
/**
* Perform redo on current index.
*/
redo : function()
{
if ( this.redoable() )
{
// Try to save. If no changes have been made, the redo stack
// will not change, so it will still be redoable.
this.save( true );
// If instead we had changes, we can't redo anymore.
if ( this.redoable() )
{
var image = this.getNextImage( false );
if ( image )
return this.restoreImage( image ), true;
}
}
return false;
},
/**
* Update the last snapshot of the undo stack with the current editor content.
*/
update : function()
{
this.snapshots.splice( this.index, 1, ( this.currentImage = new Image( this.editor ) ) );
}
};
})();
/**
* The number of undo steps to be saved. The higher this setting value the more
* memory is used for it.
* @name CKEDITOR.config.undoStackSize
* @type Number
* @default 20
* @example
* config.undoStackSize = 50;
*/
/**
* Fired when the editor is about to save an undo snapshot. This event can be
* fired by plugins and customizations to make the editor saving undo snapshots.
* @name CKEDITOR.editor#saveSnapshot
* @event
*/
/**
* Fired before an undo image is to be taken. An undo image represents the
* editor state at some point. It's saved into an undo store, so the editor is
* able to recover the editor state on undo and redo operations.
* @name CKEDITOR.editor#beforeUndoImage
* @since 3.5.3
* @see CKEDITOR.editor#afterUndoImage
* @event
*/
/**
* Fired after an undo image is taken. An undo image represents the
* editor state at some point. It's saved into an undo store, so the editor is
* able to recover the editor state on undo and redo operations.
* @name CKEDITOR.editor#afterUndoImage
* @since 3.5.3
* @see CKEDITOR.editor#beforeUndoImage
* @event
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @file Justify commands.
*/
(function()
{
function getAlignment( element, useComputedState )
{
useComputedState = useComputedState === undefined || useComputedState;
var align;
if ( useComputedState )
align = element.getComputedStyle( 'text-align' );
else
{
while ( !element.hasAttribute || !( element.hasAttribute( 'align' ) || element.getStyle( 'text-align' ) ) )
{
var parent = element.getParent();
if ( !parent )
break;
element = parent;
}
align = element.getStyle( 'text-align' ) || element.getAttribute( 'align' ) || '';
}
// Sometimes computed values doesn't tell.
align && ( align = align.replace( /(?:-(?:moz|webkit)-)?(?:start|auto)/i, '' ) );
!align && useComputedState && ( align = element.getComputedStyle( 'direction' ) == 'rtl' ? 'right' : 'left' );
return align;
}
function onSelectionChange( evt )
{
if ( evt.editor.readOnly )
return;
evt.editor.getCommand( this.name ).refresh( evt.data.path );
}
function justifyCommand( editor, name, value )
{
this.editor = editor;
this.name = name;
this.value = value;
var classes = editor.config.justifyClasses;
if ( classes )
{
switch ( value )
{
case 'left' :
this.cssClassName = classes[0];
break;
case 'center' :
this.cssClassName = classes[1];
break;
case 'right' :
this.cssClassName = classes[2];
break;
case 'justify' :
this.cssClassName = classes[3];
break;
}
this.cssClassRegex = new RegExp( '(?:^|\\s+)(?:' + classes.join( '|' ) + ')(?=$|\\s)' );
}
}
function onDirChanged( e )
{
var editor = e.editor;
var range = new CKEDITOR.dom.range( editor.document );
range.setStartBefore( e.data.node );
range.setEndAfter( e.data.node );
var walker = new CKEDITOR.dom.walker( range ),
node;
while ( ( node = walker.next() ) )
{
if ( node.type == CKEDITOR.NODE_ELEMENT )
{
// A child with the defined dir is to be ignored.
if ( !node.equals( e.data.node ) && node.getDirection() )
{
range.setStartAfter( node );
walker = new CKEDITOR.dom.walker( range );
continue;
}
// Switch the alignment.
var classes = editor.config.justifyClasses;
if ( classes )
{
// The left align class.
if ( node.hasClass( classes[ 0 ] ) )
{
node.removeClass( classes[ 0 ] );
node.addClass( classes[ 2 ] );
}
// The right align class.
else if ( node.hasClass( classes[ 2 ] ) )
{
node.removeClass( classes[ 2 ] );
node.addClass( classes[ 0 ] );
}
}
// Always switch CSS margins.
var style = 'text-align';
var align = node.getStyle( style );
if ( align == 'left' )
node.setStyle( style, 'right' );
else if ( align == 'right' )
node.setStyle( style, 'left' );
}
}
}
justifyCommand.prototype = {
exec : function( editor )
{
var selection = editor.getSelection(),
enterMode = editor.config.enterMode;
if ( !selection )
return;
var bookmarks = selection.createBookmarks(),
ranges = selection.getRanges( true );
var cssClassName = this.cssClassName,
iterator,
block;
var useComputedState = editor.config.useComputedState;
useComputedState = useComputedState === undefined || useComputedState;
for ( var i = ranges.length - 1 ; i >= 0 ; i-- )
{
iterator = ranges[ i ].createIterator();
iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR;
while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) )
{
block.removeAttribute( 'align' );
block.removeStyle( 'text-align' );
// Remove any of the alignment classes from the className.
var className = cssClassName && ( block.$.className =
CKEDITOR.tools.ltrim( block.$.className.replace( this.cssClassRegex, '' ) ) );
var apply =
( this.state == CKEDITOR.TRISTATE_OFF ) &&
( !useComputedState || ( getAlignment( block, true ) != this.value ) );
if ( cssClassName )
{
// Append the desired class name.
if ( apply )
block.addClass( cssClassName );
else if ( !className )
block.removeAttribute( 'class' );
}
else if ( apply )
block.setStyle( 'text-align', this.value );
}
}
editor.focus();
editor.forceNextSelectionCheck();
selection.selectBookmarks( bookmarks );
},
refresh : function( path )
{
var firstBlock = path.block || path.blockLimit;
this.setState( firstBlock.getName() != 'body' &&
getAlignment( firstBlock, this.editor.config.useComputedState ) == this.value ?
CKEDITOR.TRISTATE_ON :
CKEDITOR.TRISTATE_OFF );
}
};
CKEDITOR.plugins.add( 'justify',
{
init : function( editor )
{
var left = new justifyCommand( editor, 'justifyleft', 'left' ),
center = new justifyCommand( editor, 'justifycenter', 'center' ),
right = new justifyCommand( editor, 'justifyright', 'right' ),
justify = new justifyCommand( editor, 'justifyblock', 'justify' );
editor.addCommand( 'justifyleft', left );
editor.addCommand( 'justifycenter', center );
editor.addCommand( 'justifyright', right );
editor.addCommand( 'justifyblock', justify );
editor.ui.addButton( 'JustifyLeft',
{
label : editor.lang.justify.left,
command : 'justifyleft'
} );
editor.ui.addButton( 'JustifyCenter',
{
label : editor.lang.justify.center,
command : 'justifycenter'
} );
editor.ui.addButton( 'JustifyRight',
{
label : editor.lang.justify.right,
command : 'justifyright'
} );
editor.ui.addButton( 'JustifyBlock',
{
label : editor.lang.justify.block,
command : 'justifyblock'
} );
editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, left ) );
editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, right ) );
editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, center ) );
editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, justify ) );
editor.on( 'dirChanged', onDirChanged );
},
requires : [ 'domiterator' ]
});
})();
/**
* List of classes to use for aligning the contents. If it's null, no classes will be used
* and instead the corresponding CSS values will be used. The array should contain 4 members, in the following order: left, center, right, justify.
* @name CKEDITOR.config.justifyClasses
* @type Array
* @default null
* @example
* // Use the classes 'AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify'
* config.justifyClasses = [ 'AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify' ];
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview The "show border" plugin. The command display visible outline
* border line around all table elements if table doesn't have a none-zero 'border' attribute specified.
*/
(function()
{
var showBorderClassName = 'cke_show_border',
cssStyleText,
cssTemplate =
// TODO: For IE6, we don't have child selector support,
// where nested table cells could be incorrect.
( CKEDITOR.env.ie6Compat ?
[
'.%1 table.%2,',
'.%1 table.%2 td, .%1 table.%2 th',
'{',
'border : #d3d3d3 1px dotted',
'}'
] :
[
'.%1 table.%2,',
'.%1 table.%2 > tr > td, .%1 table.%2 > tr > th,',
'.%1 table.%2 > tbody > tr > td, .%1 table.%2 > tbody > tr > th,',
'.%1 table.%2 > thead > tr > td, .%1 table.%2 > thead > tr > th,',
'.%1 table.%2 > tfoot > tr > td, .%1 table.%2 > tfoot > tr > th',
'{',
'border : #d3d3d3 1px dotted',
'}'
] ).join( '' );
cssStyleText = cssTemplate.replace( /%2/g, showBorderClassName ).replace( /%1/g, 'cke_show_borders ' );
var commandDefinition =
{
preserveState : true,
editorFocus : false,
readOnly: 1,
exec : function ( editor )
{
this.toggleState();
this.refresh( editor );
},
refresh : function( editor )
{
if ( editor.document )
{
var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass';
editor.document.getBody()[ funcName ]( 'cke_show_borders' );
}
}
};
CKEDITOR.plugins.add( 'showborders',
{
requires : [ 'wysiwygarea' ],
modes : { 'wysiwyg' : 1 },
init : function( editor )
{
var command = editor.addCommand( 'showborders', commandDefinition );
command.canUndo = false;
if ( editor.config.startupShowBorders !== false )
command.setState( CKEDITOR.TRISTATE_ON );
editor.addCss( cssStyleText );
// Refresh the command on setData.
editor.on( 'mode', function()
{
if ( command.state != CKEDITOR.TRISTATE_DISABLED )
command.refresh( editor );
}, null, null, 100 );
// Refresh the command on wysiwyg frame reloads.
editor.on( 'contentDom', function()
{
if ( command.state != CKEDITOR.TRISTATE_DISABLED )
command.refresh( editor );
});
editor.on( 'removeFormatCleanup', function( evt )
{
var element = evt.data;
if ( editor.getCommand( 'showborders' ).state == CKEDITOR.TRISTATE_ON &&
element.is( 'table' ) && ( !element.hasAttribute( 'border' ) || parseInt( element.getAttribute( 'border' ), 10 ) <= 0 ) )
element.addClass( showBorderClassName );
});
},
afterInit : function( editor )
{
var dataProcessor = editor.dataProcessor,
dataFilter = dataProcessor && dataProcessor.dataFilter,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
if ( dataFilter )
{
dataFilter.addRules(
{
elements :
{
'table' : function( element )
{
var attributes = element.attributes,
cssClass = attributes[ 'class' ],
border = parseInt( attributes.border, 10 );
if ( ( !border || border <= 0 ) && ( !cssClass || cssClass.indexOf( showBorderClassName ) == -1 ) )
attributes[ 'class' ] = ( cssClass || '' ) + ' ' + showBorderClassName;
}
}
} );
}
if ( htmlFilter )
{
htmlFilter.addRules(
{
elements :
{
'table' : function( table )
{
var attributes = table.attributes,
cssClass = attributes[ 'class' ];
cssClass && ( attributes[ 'class' ] =
cssClass.replace( showBorderClassName, '' )
.replace( /\s{2}/, ' ' )
.replace( /^\s+|\s+$/, '' ) );
}
}
} );
}
}
});
// Table dialog must be aware of it.
CKEDITOR.on( 'dialogDefinition', function( ev )
{
var dialogName = ev.data.name;
if ( dialogName == 'table' || dialogName == 'tableProperties' )
{
var dialogDefinition = ev.data.definition,
infoTab = dialogDefinition.getContents( 'info' ),
borderField = infoTab.get( 'txtBorder' ),
originalCommit = borderField.commit;
borderField.commit = CKEDITOR.tools.override( originalCommit, function( org )
{
return function( data, selectedTable )
{
org.apply( this, arguments );
var value = parseInt( this.getValue(), 10 );
selectedTable[ ( !value || value <= 0 ) ? 'addClass' : 'removeClass' ]( showBorderClassName );
};
} );
var advTab = dialogDefinition.getContents( 'advanced' ),
classField = advTab && advTab.get( 'advCSSClasses' );
if ( classField )
{
classField.setup = CKEDITOR.tools.override( classField.setup, function( originalSetup )
{
return function()
{
originalSetup.apply( this, arguments );
this.setValue( this.getValue().replace( /cke_show_border/, '' ) );
};
});
classField.commit = CKEDITOR.tools.override( classField.commit, function( originalCommit )
{
return function( data, element )
{
originalCommit.apply( this, arguments );
if ( !parseInt( element.getAttribute( 'border' ), 10 ) )
element.addClass( 'cke_show_border' );
};
});
}
}
});
} )();
/**
* Whether to automatically enable the "show borders" command when the editor loads.
* (ShowBorders in FCKeditor)
* @name CKEDITOR.config.startupShowBorders
* @type Boolean
* @default true
* @example
* config.startupShowBorders = false;
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Spell Check As You Type (SCAYT).
* Button name : Scayt.
*/
(function()
{
var commandName = 'scaytcheck',
openPage = '';
// Checks if a value exists in an array
function in_array( needle, haystack )
{
var found = 0,
key;
for ( key in haystack )
{
if ( haystack[ key ] == needle )
{
found = 1;
break;
}
}
return found;
}
var onEngineLoad = function()
{
var editor = this;
var createInstance = function() // Create new instance every time Document is created.
{
var config = editor.config;
// Initialise Scayt instance.
var oParams = {};
// Get the iframe.
oParams.srcNodeRef = editor.document.getWindow().$.frameElement;
// syntax : AppName.AppVersion@AppRevision
oParams.assocApp = 'CKEDITOR.' + CKEDITOR.version + '@' + CKEDITOR.revision;
oParams.customerid = config.scayt_customerid || '1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';
oParams.customDictionaryIds = config.scayt_customDictionaryIds || '';
oParams.userDictionaryName = config.scayt_userDictionaryName || '';
oParams.sLang = config.scayt_sLang || 'en_US';
// Introduce SCAYT onLoad callback. (#5632)
oParams.onLoad = function()
{
// Draw down word marker to avoid being covered by background-color style.(#5466)
if ( !( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) )
this.addStyle( this.selectorCss(), 'padding-bottom: 2px !important;' );
// Call scayt_control.focus when SCAYT loaded
// and only if editor has focus and scayt control creates at first time (#5720)
if ( editor.focusManager.hasFocus && !plugin.isControlRestored( editor ) )
this.focus();
};
oParams.onBeforeChange = function()
{
if ( plugin.getScayt( editor ) && !editor.checkDirty() )
setTimeout( function(){ editor.resetDirty(); }, 0 );
};
var scayt_custom_params = window.scayt_custom_params;
if ( typeof scayt_custom_params == 'object' )
{
for ( var k in scayt_custom_params )
oParams[ k ] = scayt_custom_params[ k ];
}
// needs for restoring a specific scayt control settings
if ( plugin.getControlId( editor ) )
oParams.id = plugin.getControlId( editor );
var scayt_control = new window.scayt( oParams );
scayt_control.afterMarkupRemove.push( function( node )
{
( new CKEDITOR.dom.element( node, scayt_control.document ) ).mergeSiblings();
} );
// Copy config.
var lastInstance = plugin.instances[ editor.name ];
if ( lastInstance )
{
scayt_control.sLang = lastInstance.sLang;
scayt_control.option( lastInstance.option() );
scayt_control.paused = lastInstance.paused;
}
plugin.instances[ editor.name ] = scayt_control;
try {
scayt_control.setDisabled( plugin.isPaused( editor ) === false );
} catch (e) {}
editor.fire( 'showScaytState' );
};
editor.on( 'contentDom', createInstance );
editor.on( 'contentDomUnload', function()
{
// Remove scripts.
var scripts = CKEDITOR.document.getElementsByTag( 'script' ),
scaytIdRegex = /^dojoIoScript(\d+)$/i,
scaytSrcRegex = /^https?:\/\/svc\.webspellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;
for ( var i=0; i < scripts.count(); i++ )
{
var script = scripts.getItem( i ),
id = script.getId(),
src = script.getAttribute( 'src' );
if ( id && src && id.match( scaytIdRegex ) && src.match( scaytSrcRegex ))
script.remove();
}
});
editor.on( 'beforeCommandExec', function( ev ) // Disable SCAYT before Source command execution.
{
if ( ( ev.data.name == 'source' || ev.data.name == 'newpage' ) && editor.mode == 'wysiwyg' )
{
var scayt_instance = plugin.getScayt( editor );
if ( scayt_instance )
{
plugin.setPaused( editor, !scayt_instance.disabled );
// store a control id for restore a specific scayt control settings
plugin.setControlId( editor, scayt_instance.id );
scayt_instance.destroy( true );
delete plugin.instances[ editor.name ];
}
}
// Catch on source mode switch off (#5720)
else if ( ev.data.name == 'source' && editor.mode == 'source' )
plugin.markControlRestore( editor );
});
editor.on( 'afterCommandExec', function( ev )
{
if ( !plugin.isScaytEnabled( editor ) )
return;
if ( editor.mode == 'wysiwyg' && ( ev.data.name == 'undo' || ev.data.name == 'redo' ) )
window.setTimeout( function() { plugin.getScayt( editor ).refresh(); }, 10 );
});
editor.on( 'destroy', function( ev )
{
var editor = ev.editor,
scayt_instance = plugin.getScayt( editor );
// SCAYT instance might already get destroyed by mode switch (#5744).
if ( !scayt_instance )
return;
delete plugin.instances[ editor.name ];
// store a control id for restore a specific scayt control settings
plugin.setControlId( editor, scayt_instance.id );
scayt_instance.destroy( true );
});
// Listen to data manipulation to reflect scayt markup.
editor.on( 'afterSetData', function()
{
if ( plugin.isScaytEnabled( editor ) ) {
window.setTimeout( function()
{
var instance = plugin.getScayt( editor );
instance && instance.refresh();
}, 10 );
}
});
// Reload spell-checking for current word after insertion completed.
editor.on( 'insertElement', function()
{
var scayt_instance = plugin.getScayt( editor );
if ( plugin.isScaytEnabled( editor ) )
{
// Unlock the selection before reload, SCAYT will take
// care selection update.
if ( CKEDITOR.env.ie )
editor.getSelection().unlock( true );
// Return focus to the editor and refresh SCAYT markup (#5573).
window.setTimeout( function()
{
scayt_instance.focus();
scayt_instance.refresh();
}, 10 );
}
}, this, null, 50 );
editor.on( 'insertHtml', function()
{
var scayt_instance = plugin.getScayt( editor );
if ( plugin.isScaytEnabled( editor ) )
{
// Unlock the selection before reload, SCAYT will take
// care selection update.
if ( CKEDITOR.env.ie )
editor.getSelection().unlock( true );
// Return focus to the editor (#5573)
// Refresh SCAYT markup
window.setTimeout( function()
{
scayt_instance.focus();
scayt_instance.refresh();
}, 10 );
}
}, this, null, 50 );
editor.on( 'scaytDialog', function( ev ) // Communication with dialog.
{
ev.data.djConfig = window.djConfig;
ev.data.scayt_control = plugin.getScayt( editor );
ev.data.tab = openPage;
ev.data.scayt = window.scayt;
});
var dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
if ( htmlFilter )
{
htmlFilter.addRules(
{
elements :
{
span : function( element )
{
if ( element.attributes[ 'data-scayt_word' ]
&& element.attributes[ 'data-scaytid' ] )
{
delete element.name; // Write children, but don't write this node.
return element;
}
}
}
}
);
}
// Override Image.equals method avoid CK snapshot module to add SCAYT markup to snapshots. (#5546)
var undoImagePrototype = CKEDITOR.plugins.undo.Image.prototype;
undoImagePrototype.equals = CKEDITOR.tools.override( undoImagePrototype.equals, function( org )
{
return function( otherImage )
{
var thisContents = this.contents,
otherContents = otherImage.contents;
var scayt_instance = plugin.getScayt( this.editor );
// Making the comparison based on content without SCAYT word markers.
if ( scayt_instance && plugin.isScaytReady( this.editor ) )
{
// scayt::reset might return value undefined. (#5742)
this.contents = scayt_instance.reset( thisContents ) || '';
otherImage.contents = scayt_instance.reset( otherContents ) || '';
}
var retval = org.apply( this, arguments );
this.contents = thisContents;
otherImage.contents = otherContents;
return retval;
};
});
if ( editor.document )
createInstance();
};
CKEDITOR.plugins.scayt =
{
engineLoaded : false,
instances : {},
// Data storage for SCAYT control, based on editor instances
controlInfo : {},
setControlInfo : function( editor, o )
{
if ( editor && editor.name && typeof ( this.controlInfo[ editor.name ] ) != 'object' )
this.controlInfo[ editor.name ] = {};
for ( var infoOpt in o )
this.controlInfo[ editor.name ][ infoOpt ] = o[ infoOpt ];
},
isControlRestored : function( editor )
{
if ( editor &&
editor.name &&
this.controlInfo[ editor.name ] )
{
return this.controlInfo[ editor.name ].restored ;
}
return false;
},
markControlRestore : function( editor )
{
this.setControlInfo( editor, { restored:true } );
},
setControlId: function( editor, id )
{
this.setControlInfo( editor, { id:id } );
},
getControlId: function( editor )
{
if ( editor &&
editor.name &&
this.controlInfo[ editor.name ] &&
this.controlInfo[ editor.name ].id )
{
return this.controlInfo[ editor.name ].id;
}
return null;
},
setPaused: function( editor , bool )
{
this.setControlInfo( editor, { paused:bool } );
},
isPaused: function( editor )
{
if ( editor &&
editor.name &&
this.controlInfo[editor.name] )
{
return this.controlInfo[editor.name].paused;
}
return undefined;
},
getScayt : function( editor )
{
return this.instances[ editor.name ];
},
isScaytReady : function( editor )
{
return this.engineLoaded === true &&
'undefined' !== typeof window.scayt && this.getScayt( editor );
},
isScaytEnabled : function( editor )
{
var scayt_instance = this.getScayt( editor );
return ( scayt_instance ) ? scayt_instance.disabled === false : false;
},
getUiTabs : function( editor )
{
var uiTabs = [];
// read UI tabs value from config
var configUiTabs = editor.config.scayt_uiTabs || "1,1,1";
// convert string to array
configUiTabs = configUiTabs.split( ',' );
// "About us" should be always shown for standard config
configUiTabs[3] = "1";
for ( var i = 0; i < 4; i++ ) {
uiTabs[i] = (typeof window.scayt != "undefined" && typeof window.scayt.uiTags != "undefined")
? (parseInt(configUiTabs[i],10) && window.scayt.uiTags[i])
: parseInt(configUiTabs[i],10);
}
return uiTabs;
},
loadEngine : function( editor )
{
// SCAYT doesn't work with Firefox2, Opera and AIR.
if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 || CKEDITOR.env.opera || CKEDITOR.env.air )
return editor.fire( 'showScaytState' );
if ( this.engineLoaded === true )
return onEngineLoad.apply( editor ); // Add new instance.
else if ( this.engineLoaded == -1 ) // We are waiting.
return CKEDITOR.on( 'scaytReady', function(){ onEngineLoad.apply( editor ); } ); // Use function(){} to avoid rejection as duplicate.
CKEDITOR.on( 'scaytReady', onEngineLoad, editor );
CKEDITOR.on( 'scaytReady', function()
{
this.engineLoaded = true;
},
this,
null,
0
); // First to run.
this.engineLoaded = -1; // Loading in progress.
// compose scayt url
var protocol = document.location.protocol;
// Default to 'http' for unknown.
protocol = protocol.search( /https?:/) != -1? protocol : 'http:';
var baseUrl = 'svc.webspellchecker.net/scayt26/loader__base.js';
var scaytUrl = editor.config.scayt_srcUrl || ( protocol + '//' + baseUrl );
var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + '/';
if( window.scayt == undefined )
{
CKEDITOR._djScaytConfig =
{
baseUrl: scaytConfigBaseUrl,
addOnLoad:
[
function()
{
CKEDITOR.fireOnce( 'scaytReady' );
}
],
isDebug: false
};
// Append javascript code.
CKEDITOR.document.getHead().append(
CKEDITOR.document.createElement( 'script',
{
attributes :
{
type : 'text/javascript',
async : 'true',
src : scaytUrl
}
})
);
}
else
CKEDITOR.fireOnce( 'scaytReady' );
return null;
},
parseUrl : function ( data )
{
var match;
if ( data.match && ( match = data.match(/(.*)[\/\\](.*?\.\w+)$/) ) )
return { path: match[1], file: match[2] };
else
return data;
}
};
var plugin = CKEDITOR.plugins.scayt;
// Context menu constructing.
var addButtonCommand = function( editor, buttonName, buttonLabel, commandName, command, menugroup, menuOrder )
{
editor.addCommand( commandName, command );
// If the "menu" plugin is loaded, register the menu item.
editor.addMenuItem( commandName,
{
label : buttonLabel,
command : commandName,
group : menugroup,
order : menuOrder
});
};
var commandDefinition =
{
preserveState : true,
editorFocus : false,
canUndo : false,
exec: function( editor )
{
if ( plugin.isScaytReady( editor ) )
{
var isEnabled = plugin.isScaytEnabled( editor );
this.setState( isEnabled ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_ON );
var scayt_control = plugin.getScayt( editor );
// the place where the status of editor focus should be restored
// after there will be ability to store its state before SCAYT button click
// if (storedFocusState is focused )
// scayt_control.focus();
//
// now focus is set certainly
scayt_control.focus();
scayt_control.setDisabled( isEnabled );
}
else if ( !editor.config.scayt_autoStartup && plugin.engineLoaded >= 0 ) // Load first time
{
this.setState( CKEDITOR.TRISTATE_DISABLED );
plugin.loadEngine( editor );
}
}
};
// Add scayt plugin.
CKEDITOR.plugins.add( 'scayt',
{
requires : [ 'menubutton' ],
beforeInit : function( editor )
{
var items_order = editor.config.scayt_contextMenuItemsOrder
|| 'suggest|moresuggest|control',
items_order_str = "";
items_order = items_order.split( '|' );
if ( items_order && items_order.length )
{
for ( var pos = 0 ; pos < items_order.length ; pos++ )
items_order_str += 'scayt_' + items_order[ pos ] + ( items_order.length != parseInt( pos, 10 ) + 1 ? ',' : '' );
}
// Put it on top of all context menu items (#5717)
editor.config.menu_groups = items_order_str + ',' + editor.config.menu_groups;
},
init : function( editor )
{
// Delete span[data-scaytid] when text pasting in editor (#6921)
var dataFilter = editor.dataProcessor && editor.dataProcessor.dataFilter;
var dataFilterRules =
{
elements :
{
span : function( element )
{
var attrs = element.attributes;
if ( attrs && attrs[ 'data-scaytid' ] )
delete element.name;
}
}
};
dataFilter && dataFilter.addRules( dataFilterRules );
var moreSuggestions = {},
mainSuggestions = {};
// Scayt command.
var command = editor.addCommand( commandName, commandDefinition );
// Add Options dialog.
CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) );
var uiTabs = plugin.getUiTabs( editor );
var menuGroup = 'scaytButton';
editor.addMenuGroup( menuGroup );
// combine menu items to render
var uiMenuItems = {};
var lang = editor.lang.scayt;
// always added
uiMenuItems.scaytToggle =
{
label : lang.enable,
command : commandName,
group : menuGroup
};
if ( uiTabs[0] == 1 )
uiMenuItems.scaytOptions =
{
label : lang.options,
group : menuGroup,
onClick : function()
{
openPage = 'options';
editor.openDialog( commandName );
}
};
if ( uiTabs[1] == 1 )
uiMenuItems.scaytLangs =
{
label : lang.langs,
group : menuGroup,
onClick : function()
{
openPage = 'langs';
editor.openDialog( commandName );
}
};
if ( uiTabs[2] == 1 )
uiMenuItems.scaytDict =
{
label : lang.dictionariesTab,
group : menuGroup,
onClick : function()
{
openPage = 'dictionaries';
editor.openDialog( commandName );
}
};
// always added
uiMenuItems.scaytAbout =
{
label : editor.lang.scayt.about,
group : menuGroup,
onClick : function()
{
openPage = 'about';
editor.openDialog( commandName );
}
};
editor.addMenuItems( uiMenuItems );
editor.ui.add( 'Scayt', CKEDITOR.UI_MENUBUTTON,
{
label : lang.title,
title : CKEDITOR.env.opera ? lang.opera_title : lang.title,
className : 'cke_button_scayt',
modes : { wysiwyg : 1 },
onRender: function()
{
command.on( 'state', function()
{
this.setState( command.state );
},
this);
},
onMenu : function()
{
var isEnabled = plugin.isScaytEnabled( editor );
editor.getMenuItem( 'scaytToggle' ).label = lang[ isEnabled ? 'disable' : 'enable' ];
var uiTabs = plugin.getUiTabs( editor );
return {
scaytToggle : CKEDITOR.TRISTATE_OFF,
scaytOptions : isEnabled && uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
scaytLangs : isEnabled && uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
scaytDict : isEnabled && uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
scaytAbout : isEnabled && uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
};
}
});
// If the "contextmenu" plugin is loaded, register the listeners.
if ( editor.contextMenu && editor.addMenuItems )
{
editor.contextMenu.addListener( function( element, selection )
{
if ( !plugin.isScaytEnabled( editor )
|| selection.getRanges()[ 0 ].checkReadOnly() )
return null;
var scayt_control = plugin.getScayt( editor ),
node = scayt_control.getScaytNode();
if ( !node )
return null;
var word = scayt_control.getWord( node );
if ( !word )
return null;
var sLang = scayt_control.getLang(),
_r = {},
items_suggestion = window.scayt.getSuggestion( word, sLang );
if ( !items_suggestion || !items_suggestion.length )
return null;
// Remove unused commands and menuitems
for ( var m in moreSuggestions )
{
delete editor._.menuItems[ m ];
delete editor._.commands[ m ];
}
for ( m in mainSuggestions )
{
delete editor._.menuItems[ m ];
delete editor._.commands[ m ];
}
moreSuggestions = {}; // Reset items.
mainSuggestions = {};
var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || 'on';
var moreSuggestionsUnableAdded = false;
var maxSuggestions = editor.config.scayt_maxSuggestions;
( typeof maxSuggestions != 'number' ) && ( maxSuggestions = 5 );
!maxSuggestions && ( maxSuggestions = items_suggestion.length );
var contextCommands = editor.config.scayt_contextCommands || 'all';
contextCommands = contextCommands.split( '|' );
for ( var i = 0, l = items_suggestion.length; i < l; i += 1 )
{
var commandName = 'scayt_suggestion_' + items_suggestion[i].replace( ' ', '_' );
var exec = ( function( el, s )
{
return {
exec: function()
{
scayt_control.replace( el, s );
}
};
})( node, items_suggestion[i] );
if ( i < maxSuggestions )
{
addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
commandName, exec, 'scayt_suggest', i + 1 );
_r[ commandName ] = CKEDITOR.TRISTATE_OFF;
mainSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
}
else if ( moreSuggestionsUnable == 'on' )
{
addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
commandName, exec, 'scayt_moresuggest', i + 1 );
moreSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
moreSuggestionsUnableAdded = true;
}
}
if ( moreSuggestionsUnableAdded )
{
// Register the More suggestions group;
editor.addMenuItem( 'scayt_moresuggest',
{
label : lang.moreSuggestions,
group : 'scayt_moresuggest',
order : 10,
getItems : function()
{
return moreSuggestions;
}
});
mainSuggestions[ 'scayt_moresuggest' ] = CKEDITOR.TRISTATE_OFF;
}
if ( in_array( 'all', contextCommands ) || in_array( 'ignore', contextCommands) )
{
var ignore_command = {
exec: function(){
scayt_control.ignore( node );
}
};
addButtonCommand( editor, 'ignore', lang.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1 );
mainSuggestions[ 'scayt_ignore' ] = CKEDITOR.TRISTATE_OFF;
}
if ( in_array( 'all', contextCommands ) || in_array( 'ignoreall', contextCommands ) )
{
var ignore_all_command = {
exec: function(){
scayt_control.ignoreAll( node );
}
};
addButtonCommand(editor, 'ignore_all', lang.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2);
mainSuggestions['scayt_ignore_all'] = CKEDITOR.TRISTATE_OFF;
}
if ( in_array( 'all', contextCommands ) || in_array( 'add', contextCommands ) )
{
var addword_command = {
exec: function(){
window.scayt.addWordToUserDictionary( node );
}
};
addButtonCommand(editor, 'add_word', lang.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3);
mainSuggestions['scayt_add_word'] = CKEDITOR.TRISTATE_OFF;
}
if ( scayt_control.fireOnContextMenu )
scayt_control.fireOnContextMenu( editor );
return mainSuggestions;
});
}
var showInitialState = function()
{
editor.removeListener( 'showScaytState', showInitialState );
if ( !CKEDITOR.env.opera && !CKEDITOR.env.air )
command.setState( plugin.isScaytEnabled( editor ) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
else
command.setState( CKEDITOR.TRISTATE_DISABLED );
};
editor.on( 'showScaytState', showInitialState );
if ( CKEDITOR.env.opera || CKEDITOR.env.air )
{
editor.on( 'instanceReady', function()
{
showInitialState();
});
}
// Start plugin
if ( editor.config.scayt_autoStartup )
{
editor.on( 'instanceReady', function()
{
plugin.loadEngine( editor );
});
}
},
afterInit : function( editor )
{
// Prevent word marker line from displaying in elements path and been removed when cleaning format. (#3570) (#4125)
var elementsPathFilters,
scaytFilter = function( element )
{
if ( element.hasAttribute( 'data-scaytid' ) )
return false;
};
if ( editor._.elementsPath && ( elementsPathFilters = editor._.elementsPath.filters ) )
elementsPathFilters.push( scaytFilter );
editor.addRemoveFormatFilter && editor.addRemoveFormatFilter( scaytFilter );
}
});
})();
/**
* If enabled (set to <code>true</code>), turns on SCAYT automatically
* after loading the editor.
* @name CKEDITOR.config.scayt_autoStartup
* @type Boolean
* @default <code>false</code>
* @example
* config.scayt_autoStartup = true;
*/
/**
* Defines the number of SCAYT suggestions to show in the main context menu.
* Possible values are:
* <ul>
* <li><code>0</code> (zero) – All suggestions are displayed in the main context menu.</li>
* <li>Positive number – The maximum number of suggestions to show in the context
* menu. Other entries will be shown in the "More Suggestions" sub-menu.</li>
* <li>Negative number – No suggestions are shown in the main context menu. All
* entries will be listed in the the "Suggestions" sub-menu.</li>
* </ul>
* @name CKEDITOR.config.scayt_maxSuggestions
* @type Number
* @default <code>5</code>
* @example
* // Display only three suggestions in the main context menu.
* config.scayt_maxSuggestions = 3;
* @example
* // Do not show the suggestions directly.
* config.scayt_maxSuggestions = -1;
*/
/**
* Sets the customer ID for SCAYT. Required for migration from free,
* ad-supported version to paid, ad-free version.
* @name CKEDITOR.config.scayt_customerid
* @type String
* @default <code>''</code>
* @example
* // Load SCAYT using my customer ID.
* config.scayt_customerid = 'your-encrypted-customer-id';
*/
/**
* Enables/disables the "More Suggestions" sub-menu in the context menu.
* Possible values are <code>on</code> and <code>off</code>.
* @name CKEDITOR.config.scayt_moreSuggestions
* @type String
* @default <code>'on'</code>
* @example
* // Disables the "More Suggestions" sub-menu.
* config.scayt_moreSuggestions = 'off';
*/
/**
* Customizes the display of SCAYT context menu commands ("Add Word", "Ignore"
* and "Ignore All"). This must be a string with one or more of the following
* words separated by a pipe character ("|"):
* <ul>
* <li><code>off</code> – disables all options.</li>
* <li><code>all</code> – enables all options.</li>
* <li><code>ignore</code> – enables the "Ignore" option.</li>
* <li><code>ignoreall</code> – enables the "Ignore All" option.</li>
* <li><code>add</code> – enables the "Add Word" option.</li>
* </ul>
* @name CKEDITOR.config.scayt_contextCommands
* @type String
* @default <code>'all'</code>
* @example
* // Show only "Add Word" and "Ignore All" in the context menu.
* config.scayt_contextCommands = 'add|ignoreall';
*/
/**
* Sets the default spell checking language for SCAYT. Possible values are:
* <code>en_US</code>, <code>en_GB</code>, <code>pt_BR</code>, <code>da_DK</code>,
* <code>nl_NL</code>, <code>en_CA</code>, <code>fi_FI</code>, <code>fr_FR</code>,
* <code>fr_CA</code>, <code>de_DE</code>, <code>el_GR</code>, <code>it_IT</code>,
* <code>nb_NO</code>, <code>pt_PT</code>, <code>es_ES</code>, <code>sv_SE</code>.
* @name CKEDITOR.config.scayt_sLang
* @type String
* @default <code>'en_US'</code>
* @example
* // Sets SCAYT to German.
* config.scayt_sLang = 'de_DE';
*/
/**
* Sets the visibility of particular tabs in the SCAYT dialog window and toolbar
* button. This setting must contain a <code>1</code> (enabled) or <code>0</code>
* (disabled) value for each of the following entries, in this precise order,
* separated by a comma (","): "Options", "Languages", and "Dictionary".
* @name CKEDITOR.config.scayt_uiTabs
* @type String
* @default <code>'1,1,1'</code>
* @example
* // Hides the "Languages" tab.
* config.scayt_uiTabs = '1,0,1';
*/
/**
* Sets the URL to SCAYT core. Required to switch to the licensed version of SCAYT application.
* Further details available at
* <a href="http://wiki.webspellchecker.net/doku.php?id=migration:hosredfreetolicensedck">
* http://wiki.webspellchecker.net/doku.php?id=migration:hosredfreetolicensedck</a>.
* @name CKEDITOR.config.scayt_srcUrl
* @type String
* @default <code>''</code>
* @example
* config.scayt_srcUrl = "http://my-host/spellcheck/lf/scayt/scayt.js";
*/
/**
* Links SCAYT to custom dictionaries. This is a string containing dictionary IDs
* separared by commas (","). Available only for the licensed version.
* Further details at
* <a href="http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:customdictionaries:licensed">
* http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:customdictionaries:licensed</a>.
* @name CKEDITOR.config.scayt_customDictionaryIds
* @type String
* @default <code>''</code>
* @example
* config.scayt_customDictionaryIds = '3021,3456,3478"';
*/
/**
* Makes it possible to activate a custom dictionary in SCAYT. The user
* dictionary name must be used. Available only for the licensed version.
* @name CKEDITOR.config.scayt_userDictionaryName
* @type String
* @default <code>''</code>
* @example
* config.scayt_userDictionaryName = 'MyDictionary';
*/
/**
* Defines the order SCAYT context menu items by groups.
* This must be a string with one or more of the following
* words separated by a pipe character ("|"):
* <ul>
* <li><code>suggest</code> – main suggestion word list,</li>
* <li><code>moresuggest</code> – more suggestions word list,</li>
* <li><code>control</code> – SCAYT commands, such as "Ignore" and "Add Word".</li>
* </ul>
*
* @name CKEDITOR.config.scayt_contextMenuItemsOrder
* @type String
* @default <code>'suggest|moresuggest|control'</code>
* @example
* config.scayt_contextMenuItemsOrder = 'moresuggest|control|suggest';
*/
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'scaytcheck', function( editor )
{
var firstLoad = true,
captions,
doc = CKEDITOR.document,
editorName = editor.name,
tags = CKEDITOR.plugins.scayt.getUiTabs( editor ),
i,
contents = [],
userDicActive = 0,
dic_buttons = [
// [0] contains buttons for creating
"dic_create_" + editorName + ",dic_restore_" + editorName,
// [1] contains buton for manipulation
"dic_rename_" + editorName + ",dic_delete_" + editorName
],
optionsIds = [ 'mixedCase', 'mixedWithDigits', 'allCaps', 'ignoreDomainNames' ];
// common operations
function getBOMAllOptions()
{
if (typeof document.forms["optionsbar_" + editorName] != "undefined")
return document.forms["optionsbar_" + editorName]["options"];
return [];
}
function getBOMAllLangs()
{
if (typeof document.forms["languagesbar_" + editorName] != "undefined")
return document.forms["languagesbar_" + editorName]["scayt_lang"];
return [];
}
function setCheckedValue( radioObj, newValue )
{
if ( !radioObj )
return;
var radioLength = radioObj.length;
if ( radioLength == undefined )
{
radioObj.checked = radioObj.value == newValue.toString();
return;
}
for ( var i = 0; i < radioLength; i++ )
{
radioObj[i].checked = false;
if ( radioObj[i].value == newValue.toString() )
radioObj[i].checked = true;
}
}
var lang = editor.lang.scayt;
var tags_contents = [
{
id : 'options',
label : lang.optionsTab,
elements : [
{
type : 'html',
id : 'options',
html : '<form name="optionsbar_' + editorName + '"><div class="inner_options">' +
' <div class="messagebox"></div>' +
' <div style="display:none;">' +
' <input type="checkbox" name="options" id="allCaps_' + editorName + '" />' +
' <label for="allCaps" id="label_allCaps_' + editorName + '"></label>' +
' </div>' +
' <div style="display:none;">' +
' <input name="options" type="checkbox" id="ignoreDomainNames_' + editorName + '" />' +
' <label for="ignoreDomainNames" id="label_ignoreDomainNames_' + editorName + '"></label>' +
' </div>' +
' <div style="display:none;">' +
' <input name="options" type="checkbox" id="mixedCase_' + editorName + '" />' +
' <label for="mixedCase" id="label_mixedCase_' + editorName + '"></label>' +
' </div>' +
' <div style="display:none;">' +
' <input name="options" type="checkbox" id="mixedWithDigits_' + editorName + '" />' +
' <label for="mixedWithDigits" id="label_mixedWithDigits_' + editorName + '"></label>' +
' </div>' +
'</div></form>'
}
]
},
{
id : 'langs',
label : lang.languagesTab,
elements : [
{
type : 'html',
id : 'langs',
html : '<form name="languagesbar_' + editorName + '"><div class="inner_langs">' +
' <div class="messagebox"></div> ' +
' <div style="float:left;width:45%;margin-left:5px;" id="scayt_lcol_' + editorName + '" ></div>' +
' <div style="float:left;width:45%;margin-left:15px;" id="scayt_rcol_' + editorName + '"></div>' +
'</div></form>'
}
]
},
{
id : 'dictionaries',
label : lang.dictionariesTab,
elements : [
{
type : 'html',
style: '',
id : 'dictionaries',
html : '<form name="dictionarybar_' + editorName + '"><div class="inner_dictionary" style="text-align:left; white-space:normal; width:320px; overflow: hidden;">' +
' <div style="margin:5px auto; width:80%;white-space:normal; overflow:hidden;" id="dic_message_' + editorName + '"> </div>' +
' <div style="margin:5px auto; width:80%;white-space:normal;"> ' +
' <span class="cke_dialog_ui_labeled_label" >Dictionary name</span><br>'+
' <span class="cke_dialog_ui_labeled_content" >'+
' <div class="cke_dialog_ui_input_text">'+
' <input id="dic_name_' + editorName + '" type="text" class="cke_dialog_ui_input_text"/>'+
' </div></span></div>'+
' <div style="margin:5px auto; width:80%;white-space:normal;">'+
' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_create_' + editorName + '">'+
' </a>' +
' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_delete_' + editorName + '">'+
' </a>' +
' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_rename_' + editorName + '">'+
' </a>' +
' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_restore_' + editorName + '">'+
' </a>' +
' </div>' +
' <div style="margin:5px auto; width:95%;white-space:normal;" id="dic_info_' + editorName + '"></div>' +
'</div></form>'
}
]
},
{
id : 'about',
label : lang.aboutTab,
elements : [
{
type : 'html',
id : 'about',
style : 'margin: 5px 5px;',
html : '<div id="scayt_about_' + editorName + '"></div>'
}
]
}
];
var dialogDefiniton = {
title : lang.title,
minWidth : 360,
minHeight : 220,
onShow : function()
{
var dialog = this;
dialog.data = editor.fire( 'scaytDialog', {} );
dialog.options = dialog.data.scayt_control.option();
dialog.chosed_lang = dialog.sLang = dialog.data.scayt_control.sLang;
if ( !dialog.data || !dialog.data.scayt || !dialog.data.scayt_control )
{
alert( 'Error loading application service' );
dialog.hide();
return;
}
var stop = 0;
if ( firstLoad )
{
dialog.data.scayt.getCaption( editor.langCode || 'en', function( caps )
{
if ( stop++ > 0 ) // Once only
return;
captions = caps;
init_with_captions.apply( dialog );
reload.apply( dialog );
firstLoad = false;
});
}
else
reload.apply( dialog );
dialog.selectPage( dialog.data.tab );
},
onOk : function()
{
var scayt_control = this.data.scayt_control;
scayt_control.option( this.options );
// Setup language if it was changed.
var csLang = this.chosed_lang;
scayt_control.setLang( csLang );
scayt_control.refresh();
},
onCancel: function()
{
var o = getBOMAllOptions();
for ( var i in o )
o[i].checked = false;
setCheckedValue( getBOMAllLangs(), "" );
},
contents : contents
};
var scayt_control = CKEDITOR.plugins.scayt.getScayt( editor );
for ( i = 0; i < tags.length; i++ )
{
if ( tags[ i ] == 1 )
contents[ contents.length ] = tags_contents[ i ];
}
if ( tags[2] == 1 )
userDicActive = 1;
var init_with_captions = function()
{
var dialog = this,
lang_list = dialog.data.scayt.getLangList(),
buttonCaptions = [ 'dic_create', 'dic_delete', 'dic_rename', 'dic_restore' ],
buttonIds = [],
langList = [],
labels = optionsIds,
i;
// Add buttons titles
if ( userDicActive )
{
for ( i = 0; i < buttonCaptions.length; i++ )
{
buttonIds[ i ] = buttonCaptions[ i ] + "_" + editorName;
doc.getById( buttonIds[ i ] ).setHtml( '<span class="cke_dialog_ui_button">' + captions[ 'button_' + buttonCaptions[ i ]] +'</span>' );
}
doc.getById( 'dic_info_' + editorName ).setHtml( captions[ 'dic_info' ] );
}
// Fill options and dictionary labels.
if ( tags[0] == 1 )
{
for ( i in labels )
{
var labelCaption = 'label_' + labels[ i ],
labelId = labelCaption + '_' + editorName,
labelElement = doc.getById( labelId );
if ( 'undefined' != typeof labelElement
&& 'undefined' != typeof captions[ labelCaption ]
&& 'undefined' != typeof dialog.options[labels[ i ]] )
{
labelElement.setHtml( captions[ labelCaption ] );
var labelParent = labelElement.getParent();
labelParent.$.style.display = "block";
}
}
}
var about = '<p><img src="' + window.scayt.getAboutInfo().logoURL + '" /></p>' +
'<p>' + captions[ 'version' ] + window.scayt.getAboutInfo().version.toString() + '</p>' +
'<p>' + captions[ 'about_throwt_copy' ] + '</p>';
doc.getById( 'scayt_about_' + editorName ).setHtml( about );
// Create languages tab.
var createOption = function( option, list )
{
var label = doc.createElement( 'label' );
label.setAttribute( 'for', 'cke_option' + option );
label.setHtml( list[ option ] );
if ( dialog.sLang == option ) // Current.
dialog.chosed_lang = option;
var div = doc.createElement( 'div' );
var radio = CKEDITOR.dom.element.createFromHtml( '<input id="cke_option' +
option + '" type="radio" ' +
( dialog.sLang == option ? 'checked="checked"' : '' ) +
' value="' + option + '" name="scayt_lang" />' );
radio.on( 'click', function()
{
this.$.checked = true;
dialog.chosed_lang = option;
});
div.append( radio );
div.append( label );
return {
lang : list[ option ],
code : option,
radio : div
};
};
if ( tags[1] ==1 )
{
for ( i in lang_list.rtl )
langList[ langList.length ] = createOption( i, lang_list.ltr );
for ( i in lang_list.ltr )
langList[ langList.length ] = createOption( i, lang_list.ltr );
langList.sort( function( lang1, lang2 )
{
return ( lang2.lang > lang1.lang ) ? -1 : 1 ;
});
var fieldL = doc.getById( 'scayt_lcol_' + editorName ),
fieldR = doc.getById( 'scayt_rcol_' + editorName );
for ( i=0; i < langList.length; i++ )
{
var field = ( i < langList.length / 2 ) ? fieldL : fieldR;
field.append( langList[ i ].radio );
}
}
// user dictionary handlers
var dic = {};
dic.dic_create = function( el, dic_name , dic_buttons )
{
// comma separated button's ids include repeats if exists
var all_buttons = dic_buttons[0] + ',' + dic_buttons[1];
var err_massage = captions["err_dic_create"];
var suc_massage = captions["succ_dic_create"];
window.scayt.createUserDictionary( dic_name,
function( arg )
{
hide_dic_buttons ( all_buttons );
display_dic_buttons ( dic_buttons[1] );
suc_massage = suc_massage.replace("%s" , arg.dname );
dic_success_message (suc_massage);
},
function( arg )
{
err_massage = err_massage.replace("%s" ,arg.dname );
dic_error_message ( err_massage + "( "+ (arg.message || "") +")");
});
};
dic.dic_rename = function( el, dic_name )
{
//
// try to rename dictionary
var err_massage = captions["err_dic_rename"] || "";
var suc_massage = captions["succ_dic_rename"] || "";
window.scayt.renameUserDictionary( dic_name,
function( arg )
{
suc_massage = suc_massage.replace("%s" , arg.dname );
set_dic_name( dic_name );
dic_success_message ( suc_massage );
},
function( arg )
{
err_massage = err_massage.replace("%s" , arg.dname );
set_dic_name( dic_name );
dic_error_message( err_massage + "( " + ( arg.message || "" ) + " )" );
});
};
dic.dic_delete = function( el, dic_name , dic_buttons )
{
var all_buttons = dic_buttons[0] + ',' + dic_buttons[1];
var err_massage = captions["err_dic_delete"];
var suc_massage = captions["succ_dic_delete"];
// try to delete dictionary
window.scayt.deleteUserDictionary(
function( arg )
{
suc_massage = suc_massage.replace("%s" , arg.dname );
hide_dic_buttons ( all_buttons );
display_dic_buttons ( dic_buttons[0] );
set_dic_name( "" ); // empty input field
dic_success_message( suc_massage );
},
function( arg )
{
err_massage = err_massage.replace("%s" , arg.dname );
dic_error_message(err_massage);
});
};
dic.dic_restore = dialog.dic_restore || function( el, dic_name , dic_buttons )
{
// try to restore existing dictionary
var all_buttons = dic_buttons[0] + ',' + dic_buttons[1];
var err_massage = captions["err_dic_restore"];
var suc_massage = captions["succ_dic_restore"];
window.scayt.restoreUserDictionary(dic_name,
function( arg )
{
suc_massage = suc_massage.replace("%s" , arg.dname );
hide_dic_buttons ( all_buttons );
display_dic_buttons(dic_buttons[1]);
dic_success_message( suc_massage );
},
function( arg )
{
err_massage = err_massage.replace("%s" , arg.dname );
dic_error_message( err_massage );
});
};
function onDicButtonClick( ev )
{
var dic_name = doc.getById('dic_name_' + editorName).getValue();
if ( !dic_name )
{
dic_error_message(" Dictionary name should not be empty. ");
return false;
}
try{
var el = ev.data.getTarget().getParent();
var id = /(dic_\w+)_[\w\d]+/.exec(el.getId())[1];
dic[ id ].apply( null, [ el, dic_name, dic_buttons ] );
}
catch(err)
{
dic_error_message(" Dictionary error. ");
}
return true;
}
// ** bind event listeners
var arr_buttons = ( dic_buttons[0] + ',' + dic_buttons[1] ).split( ',' ),
l;
for ( i = 0, l = arr_buttons.length ; i < l ; i += 1 )
{
var dic_button = doc.getById(arr_buttons[i]);
if ( dic_button )
dic_button.on( 'click', onDicButtonClick, this );
}
};
var reload = function()
{
var dialog = this;
// for enabled options tab
if ( tags[0] == 1 ){
var opto = getBOMAllOptions();
// Animate options.
for ( var k=0,l = opto.length; k<l;k++ )
{
var i = opto[k].id;
var checkbox = doc.getById( i );
if ( checkbox )
{
opto[k].checked = false;
//alert (opto[k].removeAttribute)
if ( dialog.options[ i.split("_")[0] ] == 1 )
{
opto[k].checked = true;
}
// Bind events. Do it only once.
if ( firstLoad )
{
checkbox.on( 'click', function()
{
dialog.options[ this.getId().split("_")[0] ] = this.$.checked ? 1 : 0 ;
});
}
}
}
}
//for enabled languages tab
if ( tags[1] == 1 )
{
var domLang = doc.getById("cke_option" + dialog.sLang);
setCheckedValue( domLang.$,dialog.sLang );
}
// * user dictionary
if ( userDicActive )
{
window.scayt.getNameUserDictionary(
function( o )
{
var dic_name = o.dname;
hide_dic_buttons( dic_buttons[0] + ',' + dic_buttons[1] );
if ( dic_name )
{
doc.getById( 'dic_name_' + editorName ).setValue(dic_name);
display_dic_buttons( dic_buttons[1] );
}
else
display_dic_buttons( dic_buttons[0] );
},
function()
{
doc.getById( 'dic_name_' + editorName ).setValue("");
});
dic_success_message("");
}
};
function dic_error_message( m )
{
doc.getById('dic_message_' + editorName).setHtml('<span style="color:red;">' + m + '</span>' );
}
function dic_success_message( m )
{
doc.getById('dic_message_' + editorName).setHtml('<span style="color:blue;">' + m + '</span>') ;
}
function display_dic_buttons( sIds )
{
sIds = String( sIds );
var aIds = sIds.split(',');
for ( var i=0, l = aIds.length; i < l ; i+=1)
doc.getById( aIds[i] ).$.style.display = "inline";
}
function hide_dic_buttons( sIds )
{
sIds = String( sIds );
var aIds = sIds.split(',');
for ( var i = 0, l = aIds.length; i < l ; i += 1 )
doc.getById( aIds[i] ).$.style.display = "none";
}
function set_dic_name( dic_name )
{
doc.getById('dic_name_' + editorName).$.value= dic_name;
}
return dialogDefiniton;
});
|
JavaScript
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'devtools',
{
lang : [ 'bg', 'cs', 'cy', 'da', 'de', 'el', 'en', 'eo', 'et', 'fa', 'fi', 'fr', 'gu', 'he', 'hr', 'it', 'nb', 'nl', 'no', 'pl', 'tr', 'ug', 'uk', 'vi', 'zh-cn' ],
init : function( editor )
{
editor._.showDialogDefinitionTooltips = 1;
},
onLoad : function()
{
CKEDITOR.document.appendStyleText( CKEDITOR.config.devtools_styles ||
'#cke_tooltip { padding: 5px; border: 2px solid #333; background: #ffffff }' +
'#cke_tooltip h2 { font-size: 1.1em; border-bottom: 1px solid; margin: 0; padding: 1px; }' +
'#cke_tooltip ul { padding: 0pt; list-style-type: none; }' );
}
});
(function()
{
function defaultCallback( editor, dialog, element, tabName )
{
var lang = editor.lang.devTools,
link = '<a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.' +
( element ? ( element.type == 'text' ? 'textInput' : element.type ) : 'content' ) +
'.html" target="_blank">' + ( element ? element.type : 'content' ) + '</a>',
str =
'<h2>' + lang.title + '</h2>' +
'<ul>' +
'<li><strong>' + lang.dialogName + '</strong> : ' + dialog.getName() + '</li>' +
'<li><strong>' + lang.tabName + '</strong> : ' + tabName + '</li>';
if ( element )
str += '<li><strong>' + lang.elementId + '</strong> : ' + element.id + '</li>';
str += '<li><strong>' + lang.elementType + '</strong> : ' + link + '</li>';
return str + '</ul>';
}
function showTooltip( callback, el, editor, dialog, obj, tabName )
{
var pos = el.getDocumentPosition(),
styles = { 'z-index' : CKEDITOR.dialog._.currentZIndex + 10, top : ( pos.y + el.getSize( 'height' ) ) + 'px' };
tooltip.setHtml( callback( editor, dialog, obj, tabName ) );
tooltip.show();
// Translate coordinate for RTL.
if ( editor.lang.dir == 'rtl' )
{
var viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize();
styles.right = ( viewPaneSize.width - pos.x - el.getSize( 'width' ) ) + 'px';
}
else
styles.left = pos.x + 'px';
tooltip.setStyles( styles );
}
var tooltip;
CKEDITOR.on( 'reset', function()
{
tooltip && tooltip.remove();
tooltip = null;
});
CKEDITOR.on( 'dialogDefinition', function( evt )
{
var editor = evt.editor;
if ( editor._.showDialogDefinitionTooltips )
{
if ( !tooltip )
{
tooltip = CKEDITOR.dom.element.createFromHtml( '<div id="cke_tooltip" tabindex="-1" style="position: absolute"></div>', CKEDITOR.document );
tooltip.hide();
tooltip.on( 'mouseover', function(){ this.show(); } );
tooltip.on( 'mouseout', function(){ this.hide(); } );
tooltip.appendTo( CKEDITOR.document.getBody() );
}
var dialog = evt.data.definition.dialog,
callback = editor.config.devtools_textCallback || defaultCallback;
dialog.on( 'load', function()
{
var tabs = dialog.parts.tabs.getChildren(), tab;
for ( var i = 0, len = tabs.count(); i < len; i++ )
{
tab = tabs.getItem( i );
tab.on( 'mouseover', function()
{
var id = this.$.id;
showTooltip( callback, this, editor, dialog, null, id.substring( 4, id.lastIndexOf( '_' ) ) );
});
tab.on( 'mouseout', function()
{
tooltip.hide();
});
}
dialog.foreach( function( obj )
{
if ( obj.type in { hbox : 1, vbox : 1 } )
return;
var el = obj.getElement();
if ( el )
{
el.on( 'mouseover', function()
{
showTooltip( callback, this, editor, dialog, obj, dialog._.currentTabId );
});
el.on( 'mouseout', function()
{
tooltip.hide();
});
}
});
});
}
});
})();
/**
* A function that returns the text to be displayed inside the Developer Tools tooltip when hovering over a dialog UI element.
* There are 4 parameters that are being passed into the function: editor, dialog window, element, tab name.
* @name editor.config.devtools_textCallback
* @since 3.6
* @type Function
* @default (see example)
* @example
* // This is actually the default value.
* // Show dialog window name, tab ID, and element ID.
* config.devtools_textCallback = function( editor, dialog, element, tabName )
* {
* var lang = editor.lang.devTools,
* link = '<a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.' +
* ( element ? ( element.type == 'text' ? 'textInput' : element.type ) : 'content' ) +
* '.html" target="_blank">' + ( element ? element.type : 'content' ) + '</a>',
* str =
* '<h2>' + lang.title + '</h2>' +
* '<ul>' +
* '<li><strong>' + lang.dialogName + '</strong> : ' + dialog.getName() + '</li>' +
* '<li><strong>' + lang.tabName + '</strong> : ' + tabName + '</li>';
*
* if ( element )
* str += '<li><strong>' + lang.elementId + '</strong> : ' + element.id + '</li>';
*
* str += '<li><strong>' + lang.elementType + '</strong> : ' + link + '</li>';
*
* return str + '</ul>';
* }
*/
/**
* A setting that stores CSS rules to be injected into the page with styles to be applied to the tooltip element.
* @name CKEDITOR.config.devtools_styles
* @since 3.6
* @type String
* @default (see example)
* @example
* // This is actually the default value.
* CKEDITOR.config.devtools_styles = "
* #cke_tooltip { padding: 5px; border: 2px solid #333; background: #ffffff }
* #cke_tooltip h2 { font-size: 1.1em; border-bottom: 1px solid; margin: 0; padding: 1px; }
* #cke_tooltip ul { padding: 0pt; list-style-type: none; }
* ";
*/
|
JavaScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.