diff --git a/CHANGES.md b/CHANGES.md index 14beccce637..70b0afdf7b9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Fixed Issues: * [#2996](https://github.com/ckeditor/ckeditor4/issues/2996): Fixed: Table header "scope" attribute is incorrect for the "Headers: both" option in the [Table](https://ckeditor.com/cke4/addon/table) dialog. * [#4802](https://github.com/ckeditor/ckeditor4/issues/4802): Fixed: [Tableselection](https://ckeditor.com/cke4/addon/tableselection) caret moves to the previous cell after tabbing into the next cell and then removing its content. * [#5365](https://github.com/ckeditor/ckeditor4/issues/5365): Fixed: The value of the [`config.baseFloatZIndex`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-baseFloatZIndex) config variable is incorrectly applied to parent dialog when the child dialog is closed resulting in the dialog overlay covering up the dialog. Thanks to [JenoDK](https://github.com/JenoDK)! +* [#5305](https://github.com/ckeditor/ckeditor4/issues/5305): Fixed: Anchor name can invalidly include spaces. ## CKEditor 4.20 diff --git a/plugins/link/dialogs/anchor.js b/plugins/link/dialogs/anchor.js index 7f15dd2590e..a7c3b4ee999 100755 --- a/plugins/link/dialogs/anchor.js +++ b/plugins/link/dialogs/anchor.js @@ -136,10 +136,23 @@ CKEDITOR.dialog.add( 'anchor', function( editor ) { label: editor.lang.link.anchor.name, required: true, validate: function() { - if ( !this.getValue() ) { + // https://html.spec.whatwg.org/multipage/dom.html#global-attributes + // The id attribute value must not contain any space characters (#5305). + // [ space, tabulation, line feed, new line, form feed, carriage return ] + var disallowedWhitespacesRegex = /[\u0020\u0009\u000a\u000c\u000d]/g, + content = this.getValue(); + + if ( !content ) { alert( editor.lang.link.anchor.errorName ); // jshint ignore:line return false; } + + // Disallow creating anchors with space characters (#5305). + if ( disallowedWhitespacesRegex.test( content ) ) { + alert( editor.lang.link.anchor.errorWhitespace ); // jshint ignore:line + return false; + } + return true; } } ] diff --git a/plugins/link/lang/af.js b/plugins/link/lang/af.js index c7b0c105654..a70d3f86438 100644 --- a/plugins/link/lang/af.js +++ b/plugins/link/lang/af.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'af', { title: 'Anker-eienskappe', name: 'Ankernaam', errorName: 'Voltooi die ankernaam asseblief', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'Op element Id', diff --git a/plugins/link/lang/ar.js b/plugins/link/lang/ar.js index a36a3208588..be9bd8b2e91 100644 --- a/plugins/link/lang/ar.js +++ b/plugins/link/lang/ar.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ar', { title: 'خصائص الإشارة المرجعية', name: 'اسم الإشارة المرجعية', errorName: 'الرجاء كتابة اسم الإشارة المرجعية', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'إزالة الإشارة المرجعية' }, anchorId: 'حسب رقم العنصر', diff --git a/plugins/link/lang/az.js b/plugins/link/lang/az.js index cfdd4c5fa18..2d72f7e0a6c 100644 --- a/plugins/link/lang/az.js +++ b/plugins/link/lang/az.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'az', { title: 'Xeşin seçimləri', name: 'Xeşin adı', errorName: 'Xeşin adı yanlışdır', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Xeşin adı sil' }, anchorId: 'ID görə', diff --git a/plugins/link/lang/bg.js b/plugins/link/lang/bg.js index 64c0774417e..d089c9906cd 100644 --- a/plugins/link/lang/bg.js +++ b/plugins/link/lang/bg.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'bg', { title: 'Настройки на котва', name: 'Име на котва', errorName: 'Моля въведете име на котвата', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Премахване на котва' }, anchorId: 'По ID на елемент', diff --git a/plugins/link/lang/bn.js b/plugins/link/lang/bn.js index 43dc6230dd4..9d72a7b8c6d 100644 --- a/plugins/link/lang/bn.js +++ b/plugins/link/lang/bn.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'bn', { title: 'নোঙর প্রোপার্টি', name: 'নোঙরের নাম', errorName: 'নোঙরের নাম টাইপ করুন', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'নোঙরের আইডি দিয়ে', diff --git a/plugins/link/lang/bs.js b/plugins/link/lang/bs.js index f1646bd4278..791473f3d04 100644 --- a/plugins/link/lang/bs.js +++ b/plugins/link/lang/bs.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'bs', { title: 'Anchor Properties', name: 'Anchor Name', errorName: 'Please type the anchor name', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'Po Id-u elementa', diff --git a/plugins/link/lang/ca.js b/plugins/link/lang/ca.js index a9ce1e358bf..9e1b4be2b8b 100644 --- a/plugins/link/lang/ca.js +++ b/plugins/link/lang/ca.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ca', { title: 'Propietats de l\'àncora', name: 'Nom de l\'àncora', errorName: 'Si us plau, escriviu el nom de l\'ancora', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'Per Id d\'element', diff --git a/plugins/link/lang/cs.js b/plugins/link/lang/cs.js index aeef6db32c2..f31e93d5c6b 100644 --- a/plugins/link/lang/cs.js +++ b/plugins/link/lang/cs.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'cs', { title: 'Vlastnosti záložky', name: 'Název záložky', errorName: 'Zadejte prosím název záložky', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Odstranit záložku' }, anchorId: 'Podle Id objektu', diff --git a/plugins/link/lang/cy.js b/plugins/link/lang/cy.js index 62b6cf5b837..1a60d79005d 100644 --- a/plugins/link/lang/cy.js +++ b/plugins/link/lang/cy.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'cy', { title: 'Priodweddau\'r Angor', name: 'Enw\'r Angor', errorName: 'Teipiwch enw\'r angor', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Tynnwch yr Angor' }, anchorId: 'Gan Id yr Elfen', diff --git a/plugins/link/lang/da.js b/plugins/link/lang/da.js index 167d38d64aa..dcb301c573b 100644 --- a/plugins/link/lang/da.js +++ b/plugins/link/lang/da.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'da', { title: 'Egenskaber for bogmærke', name: 'Bogmærkenavn', errorName: 'Indtast bogmærkenavn', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Fjern bogmærke' }, anchorId: 'Efter element-Id', diff --git a/plugins/link/lang/de-ch.js b/plugins/link/lang/de-ch.js index edde6e63490..a238c1a1437 100644 --- a/plugins/link/lang/de-ch.js +++ b/plugins/link/lang/de-ch.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'de-ch', { title: 'Ankereigenschaften', name: 'Ankername', errorName: 'Bitte geben Sie den Namen des Ankers ein', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Anker entfernen' }, anchorId: 'Nach Elementkennung', diff --git a/plugins/link/lang/de.js b/plugins/link/lang/de.js index 4700f52df25..370b403eeba 100644 --- a/plugins/link/lang/de.js +++ b/plugins/link/lang/de.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'de', { title: 'Ankereigenschaften', name: 'Ankername', errorName: 'Bitte geben Sie den Namen des Ankers ein', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Anker entfernen' }, anchorId: 'Nach Elementkennung', diff --git a/plugins/link/lang/el.js b/plugins/link/lang/el.js index 1985ae181b7..88c3f3ac559 100644 --- a/plugins/link/lang/el.js +++ b/plugins/link/lang/el.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'el', { title: 'Ιδιότητες άγκυρας', name: 'Όνομα άγκυρας', errorName: 'Παρακαλούμε εισάγετε όνομα άγκυρας', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Αφαίρεση Άγκυρας' }, anchorId: 'Βάσει του Element Id', diff --git a/plugins/link/lang/en-au.js b/plugins/link/lang/en-au.js index 757af937c2f..9306a841321 100644 --- a/plugins/link/lang/en-au.js +++ b/plugins/link/lang/en-au.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'en-au', { title: 'Anchor Properties', name: 'Anchor Name', errorName: 'Please type the anchor name', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'By Element Id', diff --git a/plugins/link/lang/en-ca.js b/plugins/link/lang/en-ca.js index 0018cbbe941..707b20c2217 100644 --- a/plugins/link/lang/en-ca.js +++ b/plugins/link/lang/en-ca.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'en-ca', { title: 'Anchor Properties', name: 'Anchor Name', errorName: 'Please type the anchor name', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'By Element Id', diff --git a/plugins/link/lang/en-gb.js b/plugins/link/lang/en-gb.js index f6b8dd2842b..b28bb344443 100644 --- a/plugins/link/lang/en-gb.js +++ b/plugins/link/lang/en-gb.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'en-gb', { title: 'Anchor Properties', name: 'Anchor Name', errorName: 'Please type the anchor name', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'By Element Id', diff --git a/plugins/link/lang/en.js b/plugins/link/lang/en.js index 2efc05ddaf9..23b4e95e2d9 100644 --- a/plugins/link/lang/en.js +++ b/plugins/link/lang/en.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'en', { title: 'Anchor Properties', name: 'Anchor Name', errorName: 'Please type the anchor name', + errorWhitespace: 'Anchor name cannot contain space characters', remove: 'Remove Anchor' }, anchorId: 'By Element Id', diff --git a/plugins/link/lang/eo.js b/plugins/link/lang/eo.js index 0a75efa2cbd..21e696b5418 100644 --- a/plugins/link/lang/eo.js +++ b/plugins/link/lang/eo.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'eo', { title: 'Ankraj Atributoj', name: 'Ankra Nomo', errorName: 'Bv entajpi la ankran nomon', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Forigi Ankron' }, anchorId: 'Per Elementidentigilo', diff --git a/plugins/link/lang/es-mx.js b/plugins/link/lang/es-mx.js index 1f00de52d94..bd75c2216bb 100644 --- a/plugins/link/lang/es-mx.js +++ b/plugins/link/lang/es-mx.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'es-mx', { title: 'Propiedades del ancla', name: 'Nombre del ancla', errorName: 'Escriba el nombre del ancla', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remover ancla' }, anchorId: 'Por Id del elemento', diff --git a/plugins/link/lang/es.js b/plugins/link/lang/es.js index 8e1a7d14645..ff396cb401b 100644 --- a/plugins/link/lang/es.js +++ b/plugins/link/lang/es.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'es', { title: 'Propiedades de Referencia', name: 'Nombre de la Referencia', errorName: 'Por favor, complete el nombre de la Referencia', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Quitar Referencia' }, anchorId: 'Por ID de elemento', diff --git a/plugins/link/lang/et.js b/plugins/link/lang/et.js index b880c5549b3..26461d6db91 100644 --- a/plugins/link/lang/et.js +++ b/plugins/link/lang/et.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'et', { title: 'Ankru omadused', name: 'Ankru nimi', errorName: 'Palun sisesta ankru nimi', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Eemalda ankur' }, anchorId: 'Elemendi id järgi', diff --git a/plugins/link/lang/eu.js b/plugins/link/lang/eu.js index e4d94350b56..6ff490fb52b 100644 --- a/plugins/link/lang/eu.js +++ b/plugins/link/lang/eu.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'eu', { title: 'Ainguraren propietateak', name: 'Ainguraren izena', errorName: 'Idatzi ainguraren izena', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Kendu aingura' }, anchorId: 'Elementuaren Id-aren arabera', diff --git a/plugins/link/lang/fa.js b/plugins/link/lang/fa.js index 45b713df949..7b1423f0961 100644 --- a/plugins/link/lang/fa.js +++ b/plugins/link/lang/fa.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'fa', { title: 'ویژگی​های لینک', name: 'نام لینک', errorName: 'لطفا نام لنگر را بنویسید', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'حذف لینک' }, anchorId: 'با شناسهٴ المان', diff --git a/plugins/link/lang/fi.js b/plugins/link/lang/fi.js index 48b3682b026..b109ad242be 100644 --- a/plugins/link/lang/fi.js +++ b/plugins/link/lang/fi.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'fi', { title: 'Ankkurin ominaisuudet', name: 'Nimi', errorName: 'Ankkurille on kirjoitettava nimi', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Poista ankkuri' }, anchorId: 'Ankkurin ID:n mukaan', diff --git a/plugins/link/lang/fo.js b/plugins/link/lang/fo.js index 0981828de8d..cb6b8facc14 100644 --- a/plugins/link/lang/fo.js +++ b/plugins/link/lang/fo.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'fo', { title: 'Eginleikar fyri marknastein', name: 'Heiti marknasteinsins', errorName: 'Vinarliga rita marknasteinsins heiti', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Strika marknastein' }, anchorId: 'Eftir element Id', diff --git a/plugins/link/lang/fr-ca.js b/plugins/link/lang/fr-ca.js index 56a2c492cbb..2895eeaa66e 100644 --- a/plugins/link/lang/fr-ca.js +++ b/plugins/link/lang/fr-ca.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'fr-ca', { title: 'Propriétés de l\'ancre', name: 'Nom de l\'ancre', errorName: 'Veuillez saisir le nom de l\'ancre', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Supprimer l\'ancre' }, anchorId: 'Par ID', diff --git a/plugins/link/lang/fr.js b/plugins/link/lang/fr.js index 62583abe4e2..102a4fdc436 100644 --- a/plugins/link/lang/fr.js +++ b/plugins/link/lang/fr.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'fr', { title: 'Propriétés de l\'ancre', name: 'Nom de l\'ancre', errorName: 'Veuillez entrer le nom de l\'ancre.', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Supprimer l\'ancre' }, anchorId: 'Par ID d\'élément', diff --git a/plugins/link/lang/gl.js b/plugins/link/lang/gl.js index cd4cccff7a5..8fa886e1cbd 100644 --- a/plugins/link/lang/gl.js +++ b/plugins/link/lang/gl.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'gl', { title: 'Propiedades da ancoraxe', name: 'Nome da ancoraxe', errorName: 'Escriba o nome da ancoraxe', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Retirar a ancoraxe' }, anchorId: 'Polo ID do elemento', diff --git a/plugins/link/lang/gu.js b/plugins/link/lang/gu.js index 6c35dde971e..f180e1f526a 100644 --- a/plugins/link/lang/gu.js +++ b/plugins/link/lang/gu.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'gu', { title: 'ઍંકરના ગુણ', name: 'ઍંકરનું નામ', errorName: 'ઍંકરનું નામ ટાઈપ કરો', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'સ્થિર નકરવું' }, anchorId: 'ઍંકર એલિમન્ટ Id થી પસંદ કરો', diff --git a/plugins/link/lang/he.js b/plugins/link/lang/he.js index 8d0f459bf14..a914fbcdda9 100644 --- a/plugins/link/lang/he.js +++ b/plugins/link/lang/he.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'he', { title: 'מאפייני נקודת עיגון', name: 'שם לנקודת עיגון', errorName: 'יש להקליד שם לנקודת עיגון', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'מחיקת נקודת עיגון' }, anchorId: 'עפ"י זיהוי (ID) האלמנט', diff --git a/plugins/link/lang/hi.js b/plugins/link/lang/hi.js index a6c46c5e611..74e9712719a 100644 --- a/plugins/link/lang/hi.js +++ b/plugins/link/lang/hi.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'hi', { title: 'ऐंकर प्रॉपर्टीज़', name: 'ऐंकर का नाम', errorName: 'ऐंकर का नाम टाइप करें', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'ऍलीमॅन्ट Id से', diff --git a/plugins/link/lang/hr.js b/plugins/link/lang/hr.js index 8da308fd0ce..10418d0ab77 100644 --- a/plugins/link/lang/hr.js +++ b/plugins/link/lang/hr.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'hr', { title: 'Svojstva sidra', name: 'Ime sidra', errorName: 'Molimo unesite ime sidra', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Ukloni sidro' }, anchorId: 'Po Id elementa', diff --git a/plugins/link/lang/hu.js b/plugins/link/lang/hu.js index a5a16330a46..a7cc15f3f88 100644 --- a/plugins/link/lang/hu.js +++ b/plugins/link/lang/hu.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'hu', { title: 'Horgony tulajdonságai', name: 'Horgony neve', errorName: 'Kérem adja meg a horgony nevét', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Horgony eltávolítása' }, anchorId: 'Azonosító szerint', diff --git a/plugins/link/lang/id.js b/plugins/link/lang/id.js index fa264a80749..6bd879c1e66 100644 --- a/plugins/link/lang/id.js +++ b/plugins/link/lang/id.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'id', { title: 'Anchor Properties', // MISSING name: 'Anchor Name', // MISSING errorName: 'Please type the anchor name', // MISSING + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' // MISSING }, anchorId: 'By Element Id', // MISSING diff --git a/plugins/link/lang/is.js b/plugins/link/lang/is.js index e04558c1b7c..32bae9273f0 100644 --- a/plugins/link/lang/is.js +++ b/plugins/link/lang/is.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'is', { title: 'Eigindi kaflamerkis', name: 'Nafn bókamerkis', errorName: 'Sláðu inn nafn bókamerkis!', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'Eftir auðkenni einingar', diff --git a/plugins/link/lang/it.js b/plugins/link/lang/it.js index 271eb71e921..41108405bd0 100644 --- a/plugins/link/lang/it.js +++ b/plugins/link/lang/it.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'it', { title: 'Proprietà ancora', name: 'Nome ancora', errorName: 'Inserici il nome dell\'ancora', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Rimuovi l\'ancora' }, anchorId: 'Per id elemento', diff --git a/plugins/link/lang/ja.js b/plugins/link/lang/ja.js index 02802d4d088..005fa1d0dc4 100644 --- a/plugins/link/lang/ja.js +++ b/plugins/link/lang/ja.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ja', { title: 'アンカーのプロパティ', name: 'アンカー名', errorName: 'アンカー名を入力してください。', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'アンカーを削除' }, anchorId: 'エレメントID', diff --git a/plugins/link/lang/ka.js b/plugins/link/lang/ka.js index f886af263da..8c76b810f0b 100644 --- a/plugins/link/lang/ka.js +++ b/plugins/link/lang/ka.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ka', { title: 'ღუზის პარამეტრები', name: 'ღუზუს სახელი', errorName: 'აკრიფეთ ღუზის სახელი', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'ელემენტის Id-თ', diff --git a/plugins/link/lang/km.js b/plugins/link/lang/km.js index 2fb4dae785c..9427e0b205b 100644 --- a/plugins/link/lang/km.js +++ b/plugins/link/lang/km.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'km', { title: 'លក្ខណៈ​យុថ្កា', name: 'ឈ្មោះ​យុថ្កា', errorName: 'សូម​បញ្ចូល​ឈ្មោះ​យុថ្កា', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'ដក​យុថ្កា​ចេញ' }, anchorId: 'តាម ID ធាតុ', diff --git a/plugins/link/lang/ko.js b/plugins/link/lang/ko.js index 3ae651f6780..43638b15c53 100644 --- a/plugins/link/lang/ko.js +++ b/plugins/link/lang/ko.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ko', { title: '책갈피 속성', name: '책갈피 이름', errorName: '책갈피 이름을 입력하십시오', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: '책갈피 제거' }, anchorId: '책갈피 ID', diff --git a/plugins/link/lang/ku.js b/plugins/link/lang/ku.js index a37e673fc59..fc6f1c6a5b8 100644 --- a/plugins/link/lang/ku.js +++ b/plugins/link/lang/ku.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ku', { title: 'خاسیەتی لەنگەر', name: 'ناوی لەنگەر', errorName: 'تکایه ناوی لەنگەر بنووسه', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'لابردنی لەنگەر' }, anchorId: 'بەپێی ناسنامەی توخم', diff --git a/plugins/link/lang/lt.js b/plugins/link/lang/lt.js index 9fd9a035efe..cd2d88d69d5 100644 --- a/plugins/link/lang/lt.js +++ b/plugins/link/lang/lt.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'lt', { title: 'Žymės savybės', name: 'Žymės vardas', errorName: 'Prašome įvesti žymės vardą', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Pašalinti žymę' }, anchorId: 'Pagal žymės Id', diff --git a/plugins/link/lang/lv.js b/plugins/link/lang/lv.js index cbfae66935f..51c13a5e418 100644 --- a/plugins/link/lang/lv.js +++ b/plugins/link/lang/lv.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'lv', { title: 'Iezīmes uzstādījumi', name: 'Iezīmes nosaukums', errorName: 'Lūdzu norādiet iezīmes nosaukumu', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Noņemt iezīmi' }, anchorId: 'Pēc elementa ID', diff --git a/plugins/link/lang/mk.js b/plugins/link/lang/mk.js index c48c848f462..6f38fc11f85 100644 --- a/plugins/link/lang/mk.js +++ b/plugins/link/lang/mk.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'mk', { title: 'Anchor Properties', name: 'Anchor Name', errorName: 'Please type the anchor name', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'By Element Id', // MISSING diff --git a/plugins/link/lang/mn.js b/plugins/link/lang/mn.js index 6a8d8b7fbd1..8ab28a5bc6c 100644 --- a/plugins/link/lang/mn.js +++ b/plugins/link/lang/mn.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'mn', { title: 'Зангуугийн шинж чанар', name: 'Зангуугийн нэр', errorName: 'Зангуугийн нэрийг оруулна уу', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Зангууг устгах' }, anchorId: 'Элемэнтйн Id нэрээр', diff --git a/plugins/link/lang/ms.js b/plugins/link/lang/ms.js index 2911ff224cf..01fdf6204b1 100644 --- a/plugins/link/lang/ms.js +++ b/plugins/link/lang/ms.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ms', { title: 'Ciri-ciri Pautan', name: 'Nama Pautan', errorName: 'Sila taip nama pautan', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'dengan menggunakan ID elemen', diff --git a/plugins/link/lang/nb.js b/plugins/link/lang/nb.js index ca145df83e7..0fe798443f6 100644 --- a/plugins/link/lang/nb.js +++ b/plugins/link/lang/nb.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'nb', { title: 'Egenskaper for anker', name: 'Ankernavn', errorName: 'Vennligst skriv inn ankernavnet', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Fjern anker' }, anchorId: 'Element etter ID', diff --git a/plugins/link/lang/nl.js b/plugins/link/lang/nl.js index 0b6b93730ad..5227d52da02 100644 --- a/plugins/link/lang/nl.js +++ b/plugins/link/lang/nl.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'nl', { title: 'Eigenschappen interne link', name: 'Naam interne link', errorName: 'Geef de naam van de interne link op', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Interne link verwijderen' }, anchorId: 'Op kenmerk interne link', diff --git a/plugins/link/lang/no.js b/plugins/link/lang/no.js index 8d7359ea217..fb57acf4ab5 100644 --- a/plugins/link/lang/no.js +++ b/plugins/link/lang/no.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'no', { title: 'Egenskaper for anker', name: 'Ankernavn', errorName: 'Vennligst skriv inn ankernavnet', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Fjern anker' }, anchorId: 'Element etter ID', diff --git a/plugins/link/lang/oc.js b/plugins/link/lang/oc.js index 82330c12e9e..77aae466eab 100644 --- a/plugins/link/lang/oc.js +++ b/plugins/link/lang/oc.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'oc', { title: 'Proprietats de l\'ancòra', name: 'Nom de l\'ancòra', errorName: 'Entratz lo nom de l\'ancòra', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Suprimir l\'ancòra' }, anchorId: 'Per ID d\'element', diff --git a/plugins/link/lang/pl.js b/plugins/link/lang/pl.js index c45c3a2938c..1f9256f4da9 100644 --- a/plugins/link/lang/pl.js +++ b/plugins/link/lang/pl.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'pl', { title: 'Właściwości kotwicy', name: 'Nazwa kotwicy', errorName: 'Podaj nazwę kotwicy.', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Usuń kotwicę' }, anchorId: 'Wg identyfikatora', diff --git a/plugins/link/lang/pt-br.js b/plugins/link/lang/pt-br.js index 391de881e37..d902f39cb32 100644 --- a/plugins/link/lang/pt-br.js +++ b/plugins/link/lang/pt-br.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'pt-br', { title: 'Formatar Âncora', name: 'Nome da Âncora', errorName: 'Por favor, digite o nome da âncora', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remover Âncora' }, anchorId: 'Id da âncora', diff --git a/plugins/link/lang/pt.js b/plugins/link/lang/pt.js index fd3fa28bc3f..851fc4d8c0f 100644 --- a/plugins/link/lang/pt.js +++ b/plugins/link/lang/pt.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'pt', { title: 'Propriedades da âncora', name: 'Nome da âncora', errorName: 'Por favor, introduza o nome da âncora', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remover âncora' }, anchorId: 'Por ID do elemento', diff --git a/plugins/link/lang/ro.js b/plugins/link/lang/ro.js index 81d27f79bde..4fd40634c8a 100644 --- a/plugins/link/lang/ro.js +++ b/plugins/link/lang/ro.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ro', { title: 'Proprietăţi ancoră', name: 'Numele ancorei', errorName: 'Vă rugăm scrieţi numele ancorei', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Elimină ancora' }, anchorId: 'după Id-ul elementului', diff --git a/plugins/link/lang/ru.js b/plugins/link/lang/ru.js index d8a48378ce8..07fc7ad3ac3 100644 --- a/plugins/link/lang/ru.js +++ b/plugins/link/lang/ru.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ru', { title: 'Свойства якоря', name: 'Имя якоря', errorName: 'Пожалуйста, введите имя якоря', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Удалить якорь' }, anchorId: 'По идентификатору', diff --git a/plugins/link/lang/si.js b/plugins/link/lang/si.js index 2fc73a5c0a6..0b7b5feaa37 100644 --- a/plugins/link/lang/si.js +++ b/plugins/link/lang/si.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'si', { title: 'ආධාරක ', name: 'ආධාරකයේ නාමය', errorName: 'කරුණාකර ආධාරකයේ නාමය ඇතුල් කරන්න', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'ආධාරකය ඉවත් කිරීම' }, anchorId: 'By Element Id', // MISSING diff --git a/plugins/link/lang/sk.js b/plugins/link/lang/sk.js index e3367774947..444c6fa3907 100644 --- a/plugins/link/lang/sk.js +++ b/plugins/link/lang/sk.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'sk', { title: 'Vlastnosti kotvy', name: 'Názov kotvy', errorName: 'Zadajte prosím názov kotvy', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Odstrániť kotvu' }, anchorId: 'Podľa Id objektu', diff --git a/plugins/link/lang/sl.js b/plugins/link/lang/sl.js index 13e2a0d248b..12a5ff1b629 100644 --- a/plugins/link/lang/sl.js +++ b/plugins/link/lang/sl.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'sl', { title: 'Lastnosti sidra', name: 'Ime sidra', errorName: 'Prosimo, vnesite ime sidra', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Odstrani sidro' }, anchorId: 'Po ID-ju elementa', diff --git a/plugins/link/lang/sq.js b/plugins/link/lang/sq.js index 6bbec6dd7d4..e5e67158c27 100644 --- a/plugins/link/lang/sq.js +++ b/plugins/link/lang/sq.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'sq', { title: 'Karakteristikat e Spirancës', name: 'Emri i Spirancës', errorName: 'Ju lutemi shkruani emrin e spirancës', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Largo Spirancën' }, anchorId: 'Sipas ID-së së Elementit', diff --git a/plugins/link/lang/sr-latn.js b/plugins/link/lang/sr-latn.js index ab9f8b7aa37..1e624950cfb 100644 --- a/plugins/link/lang/sr-latn.js +++ b/plugins/link/lang/sr-latn.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'sr-latn', { title: 'Karakteristike sidra', name: 'Naziv sidra', errorName: 'Unesite naziv sidra', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Ukloni sidro' }, anchorId: 'Po Id-u elementa', diff --git a/plugins/link/lang/sr.js b/plugins/link/lang/sr.js index 3b565e2449c..83134826616 100644 --- a/plugins/link/lang/sr.js +++ b/plugins/link/lang/sr.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'sr', { title: 'Карактеристике сидра', name: 'Назив сидра', errorName: 'Унесите назив сидра', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Уклони сидро' }, anchorId: 'Пo Ид-у елемента', diff --git a/plugins/link/lang/sv.js b/plugins/link/lang/sv.js index 22ec4136fb2..c0b3d75caf2 100644 --- a/plugins/link/lang/sv.js +++ b/plugins/link/lang/sv.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'sv', { title: 'Egenskaper för ankarlänk', name: 'Ankarnamn', errorName: 'Var god ange ett ankarnamn', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Radera ankare' }, anchorId: 'Efter element-id', diff --git a/plugins/link/lang/th.js b/plugins/link/lang/th.js index 7047b61fddd..7f99dfa3c41 100644 --- a/plugins/link/lang/th.js +++ b/plugins/link/lang/th.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'th', { title: 'รายละเอียด Anchor', name: 'ชื่อ Anchor', errorName: 'กรุณาระบุชื่อของ Anchor', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Remove Anchor' }, anchorId: 'ไอดี', diff --git a/plugins/link/lang/tr.js b/plugins/link/lang/tr.js index 30308dbc3f0..72efafdec6d 100644 --- a/plugins/link/lang/tr.js +++ b/plugins/link/lang/tr.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'tr', { title: 'Bağlantı Özellikleri', name: 'Bağlantı Adı', errorName: 'Lütfen bağlantı için ad giriniz', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Bağlantıyı Kaldır' }, anchorId: 'Eleman Kimlik Numarası ile', diff --git a/plugins/link/lang/tt.js b/plugins/link/lang/tt.js index 6dec1df8b0d..64c0d472f0d 100644 --- a/plugins/link/lang/tt.js +++ b/plugins/link/lang/tt.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'tt', { title: 'Якорь үзлекләре', name: 'Якорь исеме', errorName: 'Якорьнең исемен языгыз', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Якорьне бетерү' }, anchorId: 'Элемент идентификаторы буенча', diff --git a/plugins/link/lang/ug.js b/plugins/link/lang/ug.js index f52d3d4aee0..87b4ad0080f 100644 --- a/plugins/link/lang/ug.js +++ b/plugins/link/lang/ug.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'ug', { title: 'لەڭگەرلىك نۇقتا ئۇلانما خاسلىقى', name: 'لەڭگەرلىك نۇقتا ئاتى', errorName: 'لەڭگەرلىك نۇقتا ئاتىنى كىرگۈزۈڭ', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'لەڭگەرلىك نۇقتا ئۆچۈر' }, anchorId: 'لەڭگەرلىك نۇقتا ID سى بويىچە', diff --git a/plugins/link/lang/uk.js b/plugins/link/lang/uk.js index 3889b8b9f03..7cae72752d7 100644 --- a/plugins/link/lang/uk.js +++ b/plugins/link/lang/uk.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'uk', { title: 'Властивості якоря', name: 'Ім\'я якоря', errorName: 'Будь ласка, вкажіть ім\'я якоря', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Прибрати якір' }, anchorId: 'За ідентифікатором елементу', diff --git a/plugins/link/lang/vi.js b/plugins/link/lang/vi.js index c0dfabc7114..4177a3d51cd 100644 --- a/plugins/link/lang/vi.js +++ b/plugins/link/lang/vi.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'vi', { title: 'Thuộc tính điểm neo', name: 'Tên của điểm neo', errorName: 'Hãy nhập vào tên của điểm neo', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: 'Xóa neo' }, anchorId: 'Theo định danh thành phần', diff --git a/plugins/link/lang/zh-cn.js b/plugins/link/lang/zh-cn.js index d3b25febe8c..b94f16f067d 100644 --- a/plugins/link/lang/zh-cn.js +++ b/plugins/link/lang/zh-cn.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'zh-cn', { title: '锚点链接属性', name: '锚点名称', errorName: '请输入锚点名称', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: '删除锚点' }, anchorId: '按锚点 ID', diff --git a/plugins/link/lang/zh.js b/plugins/link/lang/zh.js index 86ec5402f89..21dbd2722e0 100644 --- a/plugins/link/lang/zh.js +++ b/plugins/link/lang/zh.js @@ -13,6 +13,7 @@ CKEDITOR.plugins.setLang( 'link', 'zh', { title: '錨點內容', name: '錨點名稱', errorName: '請輸入錨點名稱', + errorWhitespace: 'Anchor name cannot contain space characters', // MISSING remove: '移除錨點' }, anchorId: '依元件編號', diff --git a/tests/plugins/link/anchor.js b/tests/plugins/link/anchor.js index 774ff76f056..fefb8d36653 100644 --- a/tests/plugins/link/anchor.js +++ b/tests/plugins/link/anchor.js @@ -207,6 +207,60 @@ assert.beautified.html( expected, editor.getData(), 'Prevent duplicated anchors failed in the ordered list with styled word' ); } ); + }, + // (#5305) + 'test prevent adding anchor with SPACE character': function() { + assertWhitespaceAnchor( this.editorBot, '\u0020', 'SPACE' ); + }, + + // (#5305) + 'test prevent adding anchor with CHARACTER TABULATION character': function() { + assertWhitespaceAnchor( this.editorBot, '\u0009', 'CHARACTER TABULATION' ); + }, + + // (#5305) + 'test prevent adding anchor with FORM FEED character': function() { + assertWhitespaceAnchor( this.editorBot, '\u000c', 'FORM FEED' ); + }, + + // (#5305) + 'test add anchor with non-breaking space': function() { + var bot = this.editorBot, + windowStub = sinon.stub( window, 'alert' ), + template = '[

Simple text

]'; + + windowStub.restore(); + + bot.setHtmlWithSelection( template ); + bot.dialog( 'anchor', function( dialog ) { + dialog.setValueOf( 'info', 'txtName', 'Foo\u00a0bar' ); + dialog.getButton( 'ok' ).click(); + + assert.areEqual( 0, windowStub.callCount ); + } ); } } ); + + function assertWhitespaceAnchor( bot, unicode, name ) { + var windowStub = sinon.stub( window, 'alert' ); + + bot.dialog( 'anchor', function( dialog ) { + + dialog.setValueOf( 'info', 'txtName', 'Foo' + unicode + 'bar' ); + dialog.getButton( 'ok' ).click(); + + resume( function() { + windowStub.restore(); + + assert.areEqual( 1, windowStub.callCount ); + assert.areEqual( + bot.editor.lang.link.anchor.errorWhitespace, + windowStub.args[ 0 ][ 0 ], + 'Anchor containing' + name + 'space should not be added' + ); + }, 10 ); + + wait(); + } ); + } }() ); diff --git a/tests/plugins/link/manual/anchorwithspace.html b/tests/plugins/link/manual/anchorwithspace.html new file mode 100644 index 00000000000..202ca19147b --- /dev/null +++ b/tests/plugins/link/manual/anchorwithspace.html @@ -0,0 +1,27 @@ +

Iframe-based editor

+
+

Foo

+
+ +

Div-based editor

+
+

Foo

+
+ +

Inline editor

+
+

Foo

+
+ + diff --git a/tests/plugins/link/manual/anchorwithspace.md b/tests/plugins/link/manual/anchorwithspace.md new file mode 100644 index 00000000000..b4dbeae970a --- /dev/null +++ b/tests/plugins/link/manual/anchorwithspace.md @@ -0,0 +1,10 @@ +@bender-tags: 4.20.1, bug, 5305 +@bender-ui: collapsed +@bender-ckeditor-plugins: link, toolbar, wysiwygarea, floatingspace + +1. Open anchor dialog. +2. Try to add an anchor that contains a space eg. `Foo bar`. + +**Expected:** Alert popups with the information: `Anchor name cannot contain space characters`. + +**Unexpected:** Anchor was added to the editable.