From a594991307968cc4500b0a429063564c4c0601f7 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Thu, 19 Sep 2013 13:03:31 +0200 Subject: [PATCH 01/30] Initial uncleaned version of placeholder2 plugin.js --- config.js | 1 + plugins/placeholder2/dialogs/placeholder2.js | 47 ++++++++ .../placeholder2/icons/hidpi/placeholder2.png | Bin 0 -> 3073 bytes plugins/placeholder2/icons/placeholder2.png | Bin 0 -> 916 bytes plugins/placeholder2/lang/en.js | 15 +++ plugins/placeholder2/plugin.js | 104 ++++++++++++++++++ .../placeholder2/samples/placeholder2.html | 70 ++++++++++++ 7 files changed, 237 insertions(+) create mode 100644 plugins/placeholder2/dialogs/placeholder2.js create mode 100644 plugins/placeholder2/icons/hidpi/placeholder2.png create mode 100644 plugins/placeholder2/icons/placeholder2.png create mode 100644 plugins/placeholder2/lang/en.js create mode 100644 plugins/placeholder2/plugin.js create mode 100644 plugins/placeholder2/samples/placeholder2.html diff --git a/config.js b/config.js index 77182768f51..46db59d5569 100644 --- a/config.js +++ b/config.js @@ -47,6 +47,7 @@ CKEDITOR.editorConfig = function( config ) { 'pagebreak,' + 'pastefromword,' + 'pastetext,' + + 'placeholder2,' + 'preview,' + 'print,' + 'removeformat,' + diff --git a/plugins/placeholder2/dialogs/placeholder2.js b/plugins/placeholder2/dialogs/placeholder2.js new file mode 100644 index 00000000000..5e101d25f5d --- /dev/null +++ b/plugins/placeholder2/dialogs/placeholder2.js @@ -0,0 +1,47 @@ + +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license + */ + +/** + * @fileOverview Definition for placeholder plugin dialog + * + */ + +CKEDITOR.dialog.add( 'placeholder2', function( editor ) { + + var lang = editor.lang.placeholder2, + generalLabel = editor.lang.common.generalTab; + + return { + title: lang.title, + minWidth: 300, + minHeight: 80, + contents: [ + { + id: 'info', + label: generalLabel, + title: generalLabel, + elements: [ + // Dialog window UI elements. + { + id: 'name', + type: 'text', + style: 'width: 100%;', + label: lang.text, + 'default': '', + required: true, + validate: CKEDITOR.dialog.validate.notEmpty( lang.textMissing ), + setup: function( widget ) { + this.setValue( widget.data.name ); + }, + commit: function( widget ) { + widget.setData( 'name', this.getValue() ); + } + } + ] + } + ] + }; +} ); \ No newline at end of file diff --git a/plugins/placeholder2/icons/hidpi/placeholder2.png b/plugins/placeholder2/icons/hidpi/placeholder2.png new file mode 100644 index 0000000000000000000000000000000000000000..bad62eed46816b7754cdf8aada26635a638438b3 GIT binary patch literal 3073 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 C>)n3< literal 0 HcmV?d00001 diff --git a/plugins/placeholder2/icons/placeholder2.png b/plugins/placeholder2/icons/placeholder2.png new file mode 100644 index 0000000000000000000000000000000000000000..9fafa28a81a520e1662cb1662f19af8b64ae1e82 GIT binary patch literal 916 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zKpodXn9)gNb_D|i(^^j##}JFtwUhUE3unq4v(Gom6neg?C6g&r#ruZVqVfrQuOx-@2jU!fq7&#?hwqbGG`02cU46CdZCSU9PBPEVn7*Wq9l5t9 zlJ_y!G4(abU%DgxK(s(f^F-R_n3xy=S3$|soA&YEXLUQ9_W59e#Tt)Oo~L-*4|{FC zS;NrNV_2Shds&1|Ql!|K=fx_Fci5Jle)=iqQs)xuNnR`8d00j2O@DqsWQT6&&l$V@1fQO`1w(wgeEe9{Y` zdZ91iGvZyIp2AH+%M3HqYy-fAwB|EU`+pnyd7(@Kx;n9J3Oj)Yhn6X;;CPM32>1 zca_LIpQtiPg>lEG*ZRDy_x!WAr$12HkA3}1{$!X~F`o-Q!RvWmwbt`%%q89j5*G5kZt0Ug?R($+ywduF z@AcC31L+UUAJ_%>mD+!`+r7?ua>?cIwKnH}b4m0cw?3ik8MpgxUATtGJtppiKp?g4 z_S^DFHlEvS?x)+xJ+72fp=hipS|lF<72P?)t-HJ(#aHqV;}e* z7hmFz{Wn z8<^6OH00)|WTsW()?o9K`3O*hB*=!~{Irtt#G+J&^73-M%)IR4__placeholder-name__', + + upcast: function( element, data ) { + if ( element.name == 'span' && element.attributes[ 'data-ckeplaceholder' ] ) { + return true; + } + return false; + }, + + defaults: { + name: editor.lang.placeholder2.defaultName + }, + + downcast: function( widgetElement ) { + return new CKEDITOR.htmlParser.text( '[[' + this.data.name + ']]' ); + }, + + init: function() { + // note that placeholder markup characters are stripped for the name + var curText = this.element.getText(); + this.setData( 'name', curText.substring( 2, curText.length - 2 ) ); + }, + + data: function( data ) { + // change text node only when placeholder name was changed + if ( this.data.name != this.element.getText() ) { + this.element.setText( '[[' + this.data.name + ']]' ); + } + } + + } ); + }, + + afterInit: function( editor ) { + + var dataFilter = editor.dataProcessor && editor.dataProcessor.dataFilter, + widgetRepo = editor.widgets, + placeholderReplaceRegex = /\[\[[^\]]+\]\]/g; + + dataFilter.addRules({ + text: function( text ) { + return text.replace( placeholderReplaceRegex, function( match ) { + + // creating widget code + var widgetWrapper = null, + innerElement = new CKEDITOR.htmlParser.element( 'span' ); + //innerElement = new CKEDITOR.htmlParser.element( 'i' ); + // inner element gets decorated with extra attrs in wrapElement() method + + // adds placeholder identifier as innertext + innerElement.add( new CKEDITOR.htmlParser.text( match ) ); + widgetWrapper = widgetRepo.wrapElement( innerElement, 'placeholder2' ); + + + // return outerhtml of widget wrapper so it will be placed + // as replacement + return widgetWrapper.getOuterHtml(); + }); + } + }); + + } + } ); + +})(); diff --git a/plugins/placeholder2/samples/placeholder2.html b/plugins/placeholder2/samples/placeholder2.html new file mode 100644 index 00000000000..bbf4b365ab8 --- /dev/null +++ b/plugins/placeholder2/samples/placeholder2.html @@ -0,0 +1,70 @@ + + + + + Placeholder Plugin — CKEditor Sample + + + + + + + + +

+ CKEditor Samples » Using the Placeholder Plugin +

+
+

+ This sample shows how to configure CKEditor instances to use the + Placeholder plugin that lets you insert read-only elements + into your content. To enter and modify read-only text, use the + Create Placeholder button and its matching dialog window. +

+

+ To add a CKEditor instance that uses the placeholder plugin and a related + Create Placeholder toolbar button, insert the following JavaScript + call to your code: +

+
+CKEDITOR.replace( 'textarea_id', {
+	extraPlugins: 'placeholder',
+	toolbar: [ [ 'Source', 'Bold' ], ['CreatePlaceholder'] ]
+});
+

+ Note that textarea_id in the code above is the id attribute of + the <textarea> element to be replaced with CKEditor. +

+
+
+

+ + + +

+

+ +

+
+ + + From 6f1e5aa82c40b6056181f86134a688ea373b3931 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Fri, 20 Sep 2013 13:50:54 +0200 Subject: [PATCH 02/30] Changed default text in placeholder template and codestyle changes. --- plugins/placeholder2/plugin.js | 16 ++++++++++------ plugins/placeholder2/samples/placeholder2.html | 3 +-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index 4620edde6a2..fbb1adf7b06 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -37,12 +37,18 @@ // Widget code. button: editor.lang.placeholder2.button, dialog: 'placeholder2', - template: '__placeholder-name__', + + /** + * @todo: mostlikely we'll have to adjust this template a little bit, but at + * the end it might so happen, that we'll need to fake some wrapping span or + * sth like that + */ + template: '[[]]', upcast: function( element, data ) { - if ( element.name == 'span' && element.attributes[ 'data-ckeplaceholder' ] ) { + if ( element.name == 'span' && element.attributes[ 'data-ckeplaceholder' ] ) return true; - } + return false; }, @@ -62,9 +68,8 @@ data: function( data ) { // change text node only when placeholder name was changed - if ( this.data.name != this.element.getText() ) { + if ( this.data.name != this.element.getText() ) this.element.setText( '[[' + this.data.name + ']]' ); - } } } ); @@ -83,7 +88,6 @@ // creating widget code var widgetWrapper = null, innerElement = new CKEDITOR.htmlParser.element( 'span' ); - //innerElement = new CKEDITOR.htmlParser.element( 'i' ); // inner element gets decorated with extra attrs in wrapElement() method // adds placeholder identifier as innertext diff --git a/plugins/placeholder2/samples/placeholder2.html b/plugins/placeholder2/samples/placeholder2.html index bbf4b365ab8..9446b97ccaf 100644 --- a/plugins/placeholder2/samples/placeholder2.html +++ b/plugins/placeholder2/samples/placeholder2.html @@ -44,11 +44,10 @@

- +

From e66249a1b36bd81bf6d8366389012dd39a43497a Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Fri, 20 Sep 2013 14:46:14 +0200 Subject: [PATCH 03/30] Placeholder regexp update. --- plugins/placeholder2/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index fbb1adf7b06..15dd474fd3b 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -79,7 +79,7 @@ var dataFilter = editor.dataProcessor && editor.dataProcessor.dataFilter, widgetRepo = editor.widgets, - placeholderReplaceRegex = /\[\[[^\]]+\]\]/g; + placeholderReplaceRegex = /\[\[([^\[\]])+\]\]/g; dataFilter.addRules({ text: function( text ) { From 0008df593f7b90a55b11681adf8f9e85a48fcd47 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Fri, 20 Sep 2013 15:44:06 +0200 Subject: [PATCH 04/30] Added handling for undesired keys in placeholder dialog "name" field. --- plugins/placeholder2/dialogs/placeholder2.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plugins/placeholder2/dialogs/placeholder2.js b/plugins/placeholder2/dialogs/placeholder2.js index 5e101d25f5d..f102d41e60f 100644 --- a/plugins/placeholder2/dialogs/placeholder2.js +++ b/plugins/placeholder2/dialogs/placeholder2.js @@ -38,6 +38,25 @@ CKEDITOR.dialog.add( 'placeholder2', function( editor ) { }, commit: function( widget ) { widget.setData( 'name', this.getValue() ); + }, + onLoad: function( e ) { + this.getInputElement().on( 'keydown', function( e ) { + + var keyEvent = e.data, + // keys disabled (unless shift is pressed) + excludedKeyCodes = [ + 219, // [ - open square bracket + 221 // ] - close square bracket + ]; + + // checking if key is not on list of blocked keys, shift cant be + // pressed, because it's making curly then - which are allowed + if ( keyEvent.$.shiftKey == false && excludedKeyCodes.indexOf( keyEvent.getKey() ) !== -1 ) { + keyEvent.preventDefault(); + } + + return; + } ); } } ] From 219705b6cfac3d575f9c877e9da89dc5aed86da4 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 11:44:22 +0200 Subject: [PATCH 05/30] Updated comments + minor codestyle change. --- plugins/placeholder2/dialogs/placeholder2.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/placeholder2/dialogs/placeholder2.js b/plugins/placeholder2/dialogs/placeholder2.js index f102d41e60f..2d68e37a56d 100644 --- a/plugins/placeholder2/dialogs/placeholder2.js +++ b/plugins/placeholder2/dialogs/placeholder2.js @@ -41,7 +41,6 @@ CKEDITOR.dialog.add( 'placeholder2', function( editor ) { }, onLoad: function( e ) { this.getInputElement().on( 'keydown', function( e ) { - var keyEvent = e.data, // keys disabled (unless shift is pressed) excludedKeyCodes = [ @@ -49,11 +48,10 @@ CKEDITOR.dialog.add( 'placeholder2', function( editor ) { 221 // ] - close square bracket ]; - // checking if key is not on list of blocked keys, shift cant be - // pressed, because it's making curly then - which are allowed - if ( keyEvent.$.shiftKey == false && excludedKeyCodes.indexOf( keyEvent.getKey() ) !== -1 ) { + // checking if key is not on list of blocked keys, but allow with + // shift pressed, because it's making curly then - which are allowed + if ( keyEvent.$.shiftKey == false && excludedKeyCodes.indexOf( keyEvent.getKey() ) !== -1 ) keyEvent.preventDefault(); - } return; } ); From 2847c8480a6c906194d792735ad6ac634fa16861 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 14:23:05 +0200 Subject: [PATCH 06/30] Renamed language entry name. --- plugins/placeholder2/dialogs/placeholder2.js | 4 ++-- plugins/placeholder2/lang/en.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/placeholder2/dialogs/placeholder2.js b/plugins/placeholder2/dialogs/placeholder2.js index 2d68e37a56d..71c895fce4d 100644 --- a/plugins/placeholder2/dialogs/placeholder2.js +++ b/plugins/placeholder2/dialogs/placeholder2.js @@ -29,10 +29,10 @@ CKEDITOR.dialog.add( 'placeholder2', function( editor ) { id: 'name', type: 'text', style: 'width: 100%;', - label: lang.text, + label: lang.name, 'default': '', required: true, - validate: CKEDITOR.dialog.validate.notEmpty( lang.textMissing ), + validate: CKEDITOR.dialog.validate.notEmpty( lang.nameMissing ), setup: function( widget ) { this.setValue( widget.data.name ); }, diff --git a/plugins/placeholder2/lang/en.js b/plugins/placeholder2/lang/en.js index f8ef69334f6..3cbe9a0c857 100644 --- a/plugins/placeholder2/lang/en.js +++ b/plugins/placeholder2/lang/en.js @@ -6,10 +6,10 @@ CKEDITOR.plugins.setLang( 'placeholder2', 'en', { button: 'Add placeholder', defaultName: 'DEFAULT_PLACEHOLDER_NAME', - + title: 'Placeholder Properties', toolbar: 'Create Placeholder', - text: 'Placeholder Text', + name: 'Placeholder Name', edit: 'Edit Placeholder', - textMissing: 'The placeholder must contain text.' + nameMissing: 'The placeholder must contain name.' }); From 3fac2caa2993e2912b7211bdd67d3dfe16fa8971 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 14:25:20 +0200 Subject: [PATCH 07/30] Removed placeholder2 plugin from default config. --- config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/config.js b/config.js index 46db59d5569..77182768f51 100644 --- a/config.js +++ b/config.js @@ -47,7 +47,6 @@ CKEDITOR.editorConfig = function( config ) { 'pagebreak,' + 'pastefromword,' + 'pastetext,' + - 'placeholder2,' + 'preview,' + 'print,' + 'removeformat,' + From ac2a76d5df82c63d043ac1237bf6095cdac3b5aa Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 14:39:29 +0200 Subject: [PATCH 08/30] Plugin cleanup. --- plugins/placeholder2/plugin.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index 15dd474fd3b..40207a88297 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -18,8 +18,6 @@ 'use strict'; - var placeholders = []; - CKEDITOR.plugins.add( 'placeholder2', { requires: 'widget,dialog', lang: 'en', // %REMOVE_LINE_CORE% @@ -32,8 +30,8 @@ // put ur init code here editor.widgets.add( 'placeholder2', { - allowedContent: 'span[!contenteditable,!data-ckeplaceholder,class]', - requiredContent: 'span[contenteditable,data-ckeplaceholder]', + allowedContent: 'span[!data-ckeplaceholder,class]', + requiredContent: 'span[data-ckeplaceholder]', // Widget code. button: editor.lang.placeholder2.button, dialog: 'placeholder2', @@ -43,7 +41,7 @@ * the end it might so happen, that we'll need to fake some wrapping span or * sth like that */ - template: '[[]]', + template: '[[]]', upcast: function( element, data ) { if ( element.name == 'span' && element.attributes[ 'data-ckeplaceholder' ] ) @@ -63,7 +61,7 @@ init: function() { // note that placeholder markup characters are stripped for the name var curText = this.element.getText(); - this.setData( 'name', curText.substring( 2, curText.length - 2 ) ); + this.setData( 'name', curText.slice(2, -2) ); }, data: function( data ) { @@ -77,11 +75,10 @@ afterInit: function( editor ) { - var dataFilter = editor.dataProcessor && editor.dataProcessor.dataFilter, - widgetRepo = editor.widgets, + var widgetRepo = editor.widgets, placeholderReplaceRegex = /\[\[([^\[\]])+\]\]/g; - dataFilter.addRules({ + editor.dataProcessor.dataFilter.addRules({ text: function( text ) { return text.replace( placeholderReplaceRegex, function( match ) { @@ -94,7 +91,6 @@ innerElement.add( new CKEDITOR.htmlParser.text( match ) ); widgetWrapper = widgetRepo.wrapElement( innerElement, 'placeholder2' ); - // return outerhtml of widget wrapper so it will be placed // as replacement return widgetWrapper.getOuterHtml(); From 0f780105bce17e354f2e7ad47f7b8859a5cca2c9 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 14:58:38 +0200 Subject: [PATCH 09/30] Reduced count of not needed attributes for wrapping span. --- plugins/placeholder2/plugin.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index 40207a88297..7b996c5487e 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -30,25 +30,14 @@ // put ur init code here editor.widgets.add( 'placeholder2', { - allowedContent: 'span[!data-ckeplaceholder,class]', - requiredContent: 'span[data-ckeplaceholder]', + allowedContent: 'span[class]', + requiredContent: 'span', // Widget code. button: editor.lang.placeholder2.button, dialog: 'placeholder2', - - /** - * @todo: mostlikely we'll have to adjust this template a little bit, but at - * the end it might so happen, that we'll need to fake some wrapping span or - * sth like that - */ - template: '[[]]', - - upcast: function( element, data ) { - if ( element.name == 'span' && element.attributes[ 'data-ckeplaceholder' ] ) - return true; - - return false; - }, + // we need to have wrapping element, otherwise there are issues in + // add dialog + template: '[[]]', defaults: { name: editor.lang.placeholder2.defaultName From 8099a052cc6cf3118117dfe2c9326a3f5816fdf0 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 15:01:37 +0200 Subject: [PATCH 10/30] Whitespace changes, extra comment removed. --- plugins/placeholder2/plugin.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index 7b996c5487e..bdf7f5fc99d 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -10,12 +10,6 @@ */ (function() { - - /** - * @todo: change name data-ckeplaceholder to data-cke-placeholder - * - */ - 'use strict'; CKEDITOR.plugins.add( 'placeholder2', { @@ -50,7 +44,7 @@ init: function() { // note that placeholder markup characters are stripped for the name var curText = this.element.getText(); - this.setData( 'name', curText.slice(2, -2) ); + this.setData( 'name', curText.slice( 2, -2 ) ); }, data: function( data ) { @@ -67,7 +61,7 @@ var widgetRepo = editor.widgets, placeholderReplaceRegex = /\[\[([^\[\]])+\]\]/g; - editor.dataProcessor.dataFilter.addRules({ + editor.dataProcessor.dataFilter.addRules( { text: function( text ) { return text.replace( placeholderReplaceRegex, function( match ) { @@ -83,10 +77,9 @@ // return outerhtml of widget wrapper so it will be placed // as replacement return widgetWrapper.getOuterHtml(); - }); + } ); } - }); - + } ); } } ); From 3fc4f1f357d42802b1c2ee6f77b92bf82c9f8287 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 15:23:03 +0200 Subject: [PATCH 11/30] Minor refactorization. --- plugins/placeholder2/plugin.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index bdf7f5fc99d..8bf525f867f 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -9,9 +9,9 @@ * */ -(function() { - 'use strict'; +'use strict'; +(function() { CKEDITOR.plugins.add( 'placeholder2', { requires: 'widget,dialog', lang: 'en', // %REMOVE_LINE_CORE% @@ -43,8 +43,7 @@ init: function() { // note that placeholder markup characters are stripped for the name - var curText = this.element.getText(); - this.setData( 'name', curText.slice( 2, -2 ) ); + this.setData( 'name', this.element.getText().slice( 2, -2 ) ); }, data: function( data ) { @@ -57,7 +56,6 @@ }, afterInit: function( editor ) { - var widgetRepo = editor.widgets, placeholderReplaceRegex = /\[\[([^\[\]])+\]\]/g; From 5b9ced87d0523e0c8e96bd8ec1dfcaf65a2226f5 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 16:41:13 +0200 Subject: [PATCH 12/30] Changed method of placeholder name validation. --- plugins/placeholder2/dialogs/placeholder2.js | 24 ++++---------------- plugins/placeholder2/lang/en.js | 3 ++- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/plugins/placeholder2/dialogs/placeholder2.js b/plugins/placeholder2/dialogs/placeholder2.js index 71c895fce4d..78405650f4f 100644 --- a/plugins/placeholder2/dialogs/placeholder2.js +++ b/plugins/placeholder2/dialogs/placeholder2.js @@ -9,10 +9,13 @@ * */ +'use strict'; + CKEDITOR.dialog.add( 'placeholder2', function( editor ) { var lang = editor.lang.placeholder2, - generalLabel = editor.lang.common.generalTab; + generalLabel = editor.lang.common.generalTab, + validNameRegex = /^[^\[\]\<\>]+$/; return { title: lang.title, @@ -32,29 +35,12 @@ CKEDITOR.dialog.add( 'placeholder2', function( editor ) { label: lang.name, 'default': '', required: true, - validate: CKEDITOR.dialog.validate.notEmpty( lang.nameMissing ), + validate: CKEDITOR.dialog.validate.regex( validNameRegex, lang.invalidName ), setup: function( widget ) { this.setValue( widget.data.name ); }, commit: function( widget ) { widget.setData( 'name', this.getValue() ); - }, - onLoad: function( e ) { - this.getInputElement().on( 'keydown', function( e ) { - var keyEvent = e.data, - // keys disabled (unless shift is pressed) - excludedKeyCodes = [ - 219, // [ - open square bracket - 221 // ] - close square bracket - ]; - - // checking if key is not on list of blocked keys, but allow with - // shift pressed, because it's making curly then - which are allowed - if ( keyEvent.$.shiftKey == false && excludedKeyCodes.indexOf( keyEvent.getKey() ) !== -1 ) - keyEvent.preventDefault(); - - return; - } ); } } ] diff --git a/plugins/placeholder2/lang/en.js b/plugins/placeholder2/lang/en.js index 3cbe9a0c857..b8118766dae 100644 --- a/plugins/placeholder2/lang/en.js +++ b/plugins/placeholder2/lang/en.js @@ -11,5 +11,6 @@ CKEDITOR.plugins.setLang( 'placeholder2', 'en', { toolbar: 'Create Placeholder', name: 'Placeholder Name', edit: 'Edit Placeholder', - nameMissing: 'The placeholder must contain name.' + + invalidName: 'The placeholder can not be empty and can not contain any of following characters: [, ].' }); From 4b0e0e5876e1c65c857af0e1786eb916f79741af Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 16:43:18 +0200 Subject: [PATCH 13/30] Removed unused language entry. --- plugins/placeholder2/lang/en.js | 3 --- plugins/placeholder2/plugin.js | 1 - 2 files changed, 4 deletions(-) diff --git a/plugins/placeholder2/lang/en.js b/plugins/placeholder2/lang/en.js index b8118766dae..0ea269628c2 100644 --- a/plugins/placeholder2/lang/en.js +++ b/plugins/placeholder2/lang/en.js @@ -6,11 +6,8 @@ CKEDITOR.plugins.setLang( 'placeholder2', 'en', { button: 'Add placeholder', defaultName: 'DEFAULT_PLACEHOLDER_NAME', - title: 'Placeholder Properties', toolbar: 'Create Placeholder', name: 'Placeholder Name', - edit: 'Edit Placeholder', - invalidName: 'The placeholder can not be empty and can not contain any of following characters: [, ].' }); diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index 8bf525f867f..7f3eaddd458 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -62,7 +62,6 @@ editor.dataProcessor.dataFilter.addRules( { text: function( text ) { return text.replace( placeholderReplaceRegex, function( match ) { - // creating widget code var widgetWrapper = null, innerElement = new CKEDITOR.htmlParser.element( 'span' ); From c573ed22594616a47654a585363bd9e1eb42a865 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 23 Sep 2013 16:44:32 +0200 Subject: [PATCH 14/30] Updated icon to be the same as in old plugin. --- .../placeholder2/icons/hidpi/placeholder2.png | Bin 3073 -> 1775 bytes plugins/placeholder2/icons/placeholder2.png | Bin 916 -> 714 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/plugins/placeholder2/icons/hidpi/placeholder2.png b/plugins/placeholder2/icons/hidpi/placeholder2.png index bad62eed46816b7754cdf8aada26635a638438b3..0b7abcec8aec3fc61ed2038fb90bc74b8bde31e8 100644 GIT binary patch delta 1577 zcmV+^2G;q381D^`N`D3jNklArP8peNTK6lsatnpr3z!e}cf=E~**dZZ^ zfRHKD&`?lN5YeHlbV#_Mr9}J#X$Wl!7ZeF46d{(Sn+pZ9Wy6&VV_|u{yX@@je4dkH zcE+=2{gqc5?d+bj=XuZbydUR?cQZ2ppj7e!NTrD57%3%6sef#2-zEe?2sBMY*L5@@ z5V~V4@z#h|eglST;Z4Q*nlnMnjO-rVxe*xlt zYt?@HO|R8z)V}#9CJ1%~&lVISaYP8PEDp@h>eXtM>JLBk#WDW#(@(grOQX@i?Q{sE zh=%78bUH-7Pk+#AAzgQqg?==5fqUpSjAT5D2s<6leg8c}g#xBwP%0J~8XBThDq(o8 ztF5oC@$A{N9uMFC{4>7qb9rK7U$Q%n!}9Vn8;u6Kt`qt`^;(VpzI@q3;q~j+_0iE$ z3_l2Hxh_C6KOt}&qA=VSI6%2v=FFKhctODb-o7PrU4LXEU(fn2*B!0|0S17uEY^Sh zwfbRom5pz|jdi8aE?W2>>Mp%{tFccsR1FKx7_{A3#2L{l5A1Nhaj)5yzu5jYS32fU2l59y$N=dWX zWNmGY$A6C>Gd(@c;^HDFPo89Qe4IaLXR&M>Q7BNXRItirgkhjk2LLo(PaaJ}Xc|Jw zp2!cwkRS-M_fDrn7={QTFijKNwmE+MIAddDeEj&4vuDrJZnv>alY^t9)arFKP0Mf~ zNqtSmF>xGk=I}OD$K82h7}97oxO?|5w{PF()_<*A96NT5)zww%^*TWiP_0%ufBrlV z9y|cx$dMz&`79D5DRgm+p_D=?mE`dbI;RdOrD!x7T)TEH8@qY)CIHjZ)6CD$Q!baO zR;$d-%>hs>7L%%);sYtJmcHy}Qc9$hL{UVi)5(5cUS7`L@7=pctJNZkA^=ubSFF8cN`fF@Y;3G&$0_(fk|1+bh%6O>3>@Ijoja7vWdJ8h++I7%rz&!bkWar*RW&Ye34z~bT}nyzOI zi0+2sd<^Vn`M^?2aq85m?7*UwqSC+hO-*t2>eY<3ckkX|Sr$SFR8D4@I)GA1j_xrAf*@dh zeVsRN-t0JkWo3o;@84rtR+57G^@Yglf{|*mmo!YBXti2>=eVv*v)SashYxt3hi%(Q zZ|Q>PD`6UY`_2NOr%OJ6{v6x3(SN%^mY#@G+WWTgd=@CWWwM{;HOm#Ed@Hsri$bB0 zrCAo~yKG2xdxIhOAwilgc?Z&6_mtXQER|rh8>T_n@9A2n)1lpNXYYGM+HCPE4aDxF zx*Ia`B^F%=%R&Jv3{g3)KYjYd!omVT=E!c~O4GnFl21(o%S!GF`4|Augnz&?P3&Tk zf6dM5GKvU&AERD}@4kzHZHv{mfd*h04F2(lE-VY(G|>zLt60P`O|{j)SqY1a&c!GQq=r>1(=|N6oO0^i42n4bqB z7_L@PLJ&zw%XNvvFrlnmPPE%1L3)G}LL@P>l>tpdnP#$P5I~{8V5x+mX$YnG|I!jD zg-}XG{TN*MJ+S@{ delta 2885 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 diff --git a/plugins/placeholder2/icons/placeholder2.png b/plugins/placeholder2/icons/placeholder2.png index 9fafa28a81a520e1662cb1662f19af8b64ae1e82..cb12b481452f7a2e84747fc8a17122aaf00c975d 100644 GIT binary patch delta 522 zcmV+l0`>ir2g(JIN`C?4Nkl$6f9S2+=!$}V}lK9(-`6>Fsf7K z8S(~smXzu81jcC$vU?|x%1H$Ni7=M1B}==vx!OqAA$MS58D`EoduCQBr2t6Nls(YM-NQX z)XpbKqQR6>HP-5yODVC+r002JwOak{Q8j?-z1?mL$8mJd`uO;u{7_$CU*h@sxz=Qw zCQ?eIl-2cC0L^9-p_I}lyuZI&MNw#g>U*nz=jZ3T=MOv#G7eWYCr$tW03~!qSaf7z MbY(hYa+44PgdI%+LI3~& delta 711 zcmV;&0yzE31(XMnN`C^aNkl^@X(UV7Dx!Cgz13n- z3kxBIO|Y@CN_9<&lWWphZgqtF3oL^O*Q8kk+Sn*W2QpLaK|FQyYbUwA36q)U3MYqL zaW6d0^X2(`f52;e-^Un(Wm(v^&EDP~|M!;5C9Bnn?RJYKEPrDRxm=E7v50Nk7-PNz zegckwAJW_#;1zHpDadBCTwGibMG+axvc3)91xC$g^TBX9tVqg9$_T+)f8JCaJN?npXWE|=%P6u2#k`Fsv>90S94Bft8Y-1ar;_OR`!A~1>U&9K;y7lp zSX`~w>(3-H7z{4U<+6IcUc8&2*XzaQa#@4H;8GIxdVl@dVzIay$1y}vM6Fiab~>GF zo6QDE*CqWf>G52c~^-)uH?I-P5^T5TIe5rkn#tJS)69OscFk|Y7Rvg`iM z9j+uvf+QTrdDLpPF2gV+6NVv`O2xM<>mh(K2H?~f^RqGL&=~W*G3FQGWm?0stcR6K z#Sg;}CV!I&lAh%A`4w<1iS>H@p<1n;0U_}B{{H?S>-E}ACppgN^D9YDCX)&HzK^8* zXf!$l&Qr(@NzWyHN%dUP4d56!AB{$5lJdUqgXeiW$W7OEXTWFRH{d={PIW)^KD(|v zlXTPfeLT Date: Tue, 24 Sep 2013 10:01:06 +0200 Subject: [PATCH 15/30] Updated dialog error message --- plugins/placeholder2/lang/en.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/placeholder2/lang/en.js b/plugins/placeholder2/lang/en.js index 0ea269628c2..c6c9017f37b 100644 --- a/plugins/placeholder2/lang/en.js +++ b/plugins/placeholder2/lang/en.js @@ -9,5 +9,5 @@ CKEDITOR.plugins.setLang( 'placeholder2', 'en', { title: 'Placeholder Properties', toolbar: 'Create Placeholder', name: 'Placeholder Name', - invalidName: 'The placeholder can not be empty and can not contain any of following characters: [, ].' + invalidName: 'The placeholder can not be empty and can not contain any of following characters: [, ], <, >' }); From 8520cca43c1effca8118e00070f0a413b8ffef13 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Tue, 24 Sep 2013 10:14:04 +0200 Subject: [PATCH 16/30] Whitespace fix. --- plugins/placeholder2/samples/placeholder2.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/placeholder2/samples/placeholder2.html b/plugins/placeholder2/samples/placeholder2.html index 9446b97ccaf..15b70bcf216 100644 --- a/plugins/placeholder2/samples/placeholder2.html +++ b/plugins/placeholder2/samples/placeholder2.html @@ -48,7 +48,7 @@

From 2e0d9459ec39842e5c8450e0bfe16dd7b7b9110e Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Tue, 24 Sep 2013 11:24:36 +0200 Subject: [PATCH 17/30] Code simplified. --- plugins/placeholder2/plugin.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index 7f3eaddd458..a02567a02c8 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -24,8 +24,6 @@ // put ur init code here editor.widgets.add( 'placeholder2', { - allowedContent: 'span[class]', - requiredContent: 'span', // Widget code. button: editor.lang.placeholder2.button, dialog: 'placeholder2', @@ -47,9 +45,7 @@ }, data: function( data ) { - // change text node only when placeholder name was changed - if ( this.data.name != this.element.getText() ) - this.element.setText( '[[' + this.data.name + ']]' ); + this.element.setText( '[[' + this.data.name + ']]' ); } } ); From d8fbbb4113f11e553e7a424df4a7514015c477c2 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Tue, 24 Sep 2013 11:24:47 +0200 Subject: [PATCH 18/30] Updated sample. --- plugins/placeholder2/samples/placeholder2.html | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/placeholder2/samples/placeholder2.html b/plugins/placeholder2/samples/placeholder2.html index 15b70bcf216..64ea9ba3658 100644 --- a/plugins/placeholder2/samples/placeholder2.html +++ b/plugins/placeholder2/samples/placeholder2.html @@ -44,12 +44,15 @@

- - + +

From 467a9e82d1f5d28a6972bebb95e63e5381a799ef Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Tue, 24 Sep 2013 11:37:24 +0200 Subject: [PATCH 19/30] Comments style fix. --- plugins/placeholder2/dialogs/placeholder2.js | 2 +- plugins/placeholder2/plugin.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/placeholder2/dialogs/placeholder2.js b/plugins/placeholder2/dialogs/placeholder2.js index 78405650f4f..2e4b2207101 100644 --- a/plugins/placeholder2/dialogs/placeholder2.js +++ b/plugins/placeholder2/dialogs/placeholder2.js @@ -5,7 +5,7 @@ */ /** - * @fileOverview Definition for placeholder plugin dialog + * @fileOverview Definition for placeholder plugin dialog. * */ diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index a02567a02c8..b9fa5870711 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -19,16 +19,16 @@ hidpi: true, // %REMOVE_LINE_CORE% init: function( editor ) { - // register dialog + // Register dialog. CKEDITOR.dialog.add( 'placeholder2', this.path + 'dialogs/placeholder2.js' ); - // put ur init code here + // Put ur init code here. editor.widgets.add( 'placeholder2', { // Widget code. button: editor.lang.placeholder2.button, dialog: 'placeholder2', - // we need to have wrapping element, otherwise there are issues in - // add dialog + // We need to have wrapping element, otherwise there are issues in + // add dialog. template: '[[]]', defaults: { @@ -40,7 +40,7 @@ }, init: function() { - // note that placeholder markup characters are stripped for the name + // Note that placeholder markup characters are stripped for the name. this.setData( 'name', this.element.getText().slice( 2, -2 ) ); }, @@ -58,17 +58,17 @@ editor.dataProcessor.dataFilter.addRules( { text: function( text ) { return text.replace( placeholderReplaceRegex, function( match ) { - // creating widget code + // Creating widget code. var widgetWrapper = null, innerElement = new CKEDITOR.htmlParser.element( 'span' ); - // inner element gets decorated with extra attrs in wrapElement() method + // Inner element gets decorated with extra attrs in wrapElement() method. - // adds placeholder identifier as innertext + // Adds placeholder identifier as innertext. innerElement.add( new CKEDITOR.htmlParser.text( match ) ); widgetWrapper = widgetRepo.wrapElement( innerElement, 'placeholder2' ); - // return outerhtml of widget wrapper so it will be placed - // as replacement + // Return outerhtml of widget wrapper so it will be placed + // as replacement. return widgetWrapper.getOuterHtml(); } ); } From 937ae4405e4bcb9c426bbbb0c0ce4784bbc84cca Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Tue, 24 Sep 2013 14:56:47 +0200 Subject: [PATCH 20/30] Added styling for placeholder widget frame. --- plugins/placeholder2/plugin.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder2/plugin.js index b9fa5870711..2b4a91a8542 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder2/plugin.js @@ -49,6 +49,9 @@ } } ); + + // Registers styles for placeholder widget frame. + CKEDITOR.addCss( '.cke_widget_wrapper *[data-widget="placeholder2"]{background-color: #ffff00;}' ); }, afterInit: function( editor ) { From 4b245e03993cb663df3c8763278aaa5166ade8c1 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Tue, 24 Sep 2013 14:58:30 +0200 Subject: [PATCH 21/30] Old placeholder plugin removed. --- plugins/placeholder/dialogs/placeholder.js | 61 -------- .../placeholder/icons/hidpi/placeholder.png | Bin 1775 -> 0 bytes plugins/placeholder/icons/placeholder.png | Bin 714 -> 0 bytes .../placeholder/lang/_translationstatus.txt | 26 ---- plugins/placeholder/lang/bg.js | 12 -- plugins/placeholder/lang/cs.js | 12 -- plugins/placeholder/lang/cy.js | 12 -- plugins/placeholder/lang/da.js | 12 -- plugins/placeholder/lang/de.js | 12 -- plugins/placeholder/lang/el.js | 12 -- plugins/placeholder/lang/en.js | 12 -- plugins/placeholder/lang/eo.js | 12 -- plugins/placeholder/lang/et.js | 12 -- plugins/placeholder/lang/fa.js | 12 -- plugins/placeholder/lang/fi.js | 12 -- plugins/placeholder/lang/fr.js | 12 -- plugins/placeholder/lang/he.js | 12 -- plugins/placeholder/lang/hr.js | 12 -- plugins/placeholder/lang/it.js | 12 -- plugins/placeholder/lang/nb.js | 12 -- plugins/placeholder/lang/nl.js | 12 -- plugins/placeholder/lang/no.js | 12 -- plugins/placeholder/lang/pl.js | 12 -- plugins/placeholder/lang/tr.js | 12 -- plugins/placeholder/lang/ug.js | 12 -- plugins/placeholder/lang/uk.js | 12 -- plugins/placeholder/lang/vi.js | 12 -- plugins/placeholder/lang/zh-cn.js | 12 -- plugins/placeholder/plugin.js | 143 ------------------ plugins/placeholder/samples/placeholder.html | 72 --------- 30 files changed, 590 deletions(-) delete mode 100644 plugins/placeholder/dialogs/placeholder.js delete mode 100644 plugins/placeholder/icons/hidpi/placeholder.png delete mode 100644 plugins/placeholder/icons/placeholder.png delete mode 100644 plugins/placeholder/lang/_translationstatus.txt delete mode 100644 plugins/placeholder/lang/bg.js delete mode 100644 plugins/placeholder/lang/cs.js delete mode 100644 plugins/placeholder/lang/cy.js delete mode 100644 plugins/placeholder/lang/da.js delete mode 100644 plugins/placeholder/lang/de.js delete mode 100644 plugins/placeholder/lang/el.js delete mode 100644 plugins/placeholder/lang/en.js delete mode 100644 plugins/placeholder/lang/eo.js delete mode 100644 plugins/placeholder/lang/et.js delete mode 100644 plugins/placeholder/lang/fa.js delete mode 100644 plugins/placeholder/lang/fi.js delete mode 100644 plugins/placeholder/lang/fr.js delete mode 100644 plugins/placeholder/lang/he.js delete mode 100644 plugins/placeholder/lang/hr.js delete mode 100644 plugins/placeholder/lang/it.js delete mode 100644 plugins/placeholder/lang/nb.js delete mode 100644 plugins/placeholder/lang/nl.js delete mode 100644 plugins/placeholder/lang/no.js delete mode 100644 plugins/placeholder/lang/pl.js delete mode 100644 plugins/placeholder/lang/tr.js delete mode 100644 plugins/placeholder/lang/ug.js delete mode 100644 plugins/placeholder/lang/uk.js delete mode 100644 plugins/placeholder/lang/vi.js delete mode 100644 plugins/placeholder/lang/zh-cn.js delete mode 100644 plugins/placeholder/plugin.js delete mode 100644 plugins/placeholder/samples/placeholder.html diff --git a/plugins/placeholder/dialogs/placeholder.js b/plugins/placeholder/dialogs/placeholder.js deleted file mode 100644 index 2789246cee6..00000000000 --- a/plugins/placeholder/dialogs/placeholder.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -(function() { - function placeholderDialog( editor, isEdit ) { - - var lang = editor.lang.placeholder, - generalLabel = editor.lang.common.generalTab; - return { - title: lang.title, - minWidth: 300, - minHeight: 80, - contents: [ - { - id: 'info', - label: generalLabel, - title: generalLabel, - elements: [ - { - id: 'text', - type: 'text', - style: 'width: 100%;', - label: lang.text, - 'default': '', - required: true, - validate: CKEDITOR.dialog.validate.notEmpty( lang.textMissing ), - setup: function( element ) { - if ( isEdit ) - this.setValue( element.getText().slice( 2, -2 ) ); - }, - commit: function( element ) { - var text = '[[' + this.getValue() + ']]'; - // The placeholder must be recreated. - CKEDITOR.plugins.placeholder.createPlaceholder( editor, element, text ); - } - } - ] - } - ], - onShow: function() { - if ( isEdit ) - this._element = CKEDITOR.plugins.placeholder.getSelectedPlaceHolder( editor ); - - this.setupContent( this._element ); - }, - onOk: function() { - this.commitContent( this._element ); - delete this._element; - } - }; - } - - CKEDITOR.dialog.add( 'createplaceholder', function( editor ) { - return placeholderDialog( editor ); - }); - CKEDITOR.dialog.add( 'editplaceholder', function( editor ) { - return placeholderDialog( editor, 1 ); - }); -})(); diff --git a/plugins/placeholder/icons/hidpi/placeholder.png b/plugins/placeholder/icons/hidpi/placeholder.png deleted file mode 100644 index 0b7abcec8aec3fc61ed2038fb90bc74b8bde31e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1775 zcmVkSWs8P*6}1(V?q!NVuS-MEnD32yF@%6bU61A(o|^3k9-e z!<7qTVR^l~?Ck7(o|9sB#BlZAdXcY%B8HjHFEiU>O$&VBzqLxlpS zVNfa-85$a*R4QS3uB)xDt?}&HvmOuM{`@n(?{j%#Vqda5j>GcuG8>Hsx~>!YKJ{9S z|Gs?LL*e!7*Y(lSQ4Bu_Xt^#xGe0449HKDX7dSwW2>>Mp%{tFccsR1FKx7_{A3#2L{l5A1Nhaj)5yzu5jYS z32fU2l59y$N=dWXWNmGY$B!Q~Jw46h;vy$co@8=-oIhu0v1}VrC{V0au*zkGVW3h6 z05n}s9!*1N8bZpR$PdGiAPBPePNzc{h6o`rO%vO;Iez>&V`F1{{P>ZxXV21Zx3Nr< zgQKI=>UA_t%Wxn`eNDzOaU5^v@HSM(-Faac(r7fed-pE4Z{OzDty>&Bc8t~4RqFLR zK@d=_RylwEJP#f`0N}`xBgFYE5+W&dag3pqLMfHx@eVqt4k)E)G#XsHb}bvbdGjU! z)6>(;&(BjXm#J2(%+1XKP%IXcs+!^hDXx~j>}FC*q?ANaM5oiqeqUZ*&ff3cyGN_l zB8nmaR##WEF||d~%mFE7uLL_VkU9~^n({(^@dAL+(NTQg&*tXmr6ssW0x7ph zum=WG?^C;U=@P@k!vL(TtY8=hQc8j#U~FuxXU8e{KawDGRER7Ufeakr&Ye4y%VhvO z&tqg{Bx5fv)mzug7}%=>x~@~HRCxICA&%o9rDSGihNYz?CMPF3dh{s1@3XP7!J|iy z0BAOw=-t#yS;!oSyIKj@QHE3kAq1sTi6>8h++I7%rz&!bkWar*RW&Ye34 zz~bT}nyzOIi0+2sd<^Vn`M^?2aq85m?7*UwqSy<=)r_@w@7`fq7D5PAPG*@pfKo}0 z?lA^}AYgrcoi}gZ>^OgAWrg?e-(y);l7jj5g~;lHk!rD*G)$dnwOW1WxUNgH+2q5A z4|tx3ZQDt2>4N7gVH$h;&H|vPOFn=89NV_hyFr$oh*H}7w()!xD7s~`pXD{n6{37A zwk(T6p^&9n7U{ceNOgOIA@?Ccnk{(;(p~qI+FdM_V6z*hLD=u^dqdi6 z@hT0(?xVUJGV&!BT?flT0V)hpIjui^`ozM*0zl@-Zs1DOz%Y_eO#{nH?h5%B0MLZM zGEMAak$=t2=`xB4eIKJz!7Mmw)|*Y_~tZm{j)SqY1a&c!GQq=r>1(=|N6oO0^i42 zn4bqB7_L@PLJ&zw%XNvvFrlnmPPE%1L3)G}LL@P>l>tpdnP#$P5I~{8V5x+mX$YnG z|I!jDg-}XG{TN*M8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?F RJQ@H1002ovPDHLkV1oC?Fk%1z diff --git a/plugins/placeholder/icons/placeholder.png b/plugins/placeholder/icons/placeholder.png deleted file mode 100644 index cb12b481452f7a2e84747fc8a17122aaf00c975d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 714 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zKpodXn9)gNb_D|i<6}=3#}JFtt&{g=y><|2-9J@CCp_y;#}d!vX5OsJ5|7jkRs}zm z{KQr{ZOY3}EXOi=HdU)nIOWOmuhU@K237Cf+jrjbxUN{9kSLjU&ayf!Ok*j7$K@$+ z%T7NmSa9aAbX($u43h$xcDKch4XP~{t_F&9PMvv$S=UHiRneb3!I_5@bPgnfJWuAH>8YS&#oet!NEE7@(g*K#!- zU|DlFuYGFj%xUQoYz%+v=7+6reO|fddiJr$hTFGqx3RVT_~VC%0Lv|N?eoQ})-ZTZ zQds)r-#@tq1D>5bcP1Lmykeu-#pLZ(nG`l_*;daT>%1qa#KgtTV~{xhI8a-|*{d`6 zc8-~J+Gfe-gAF>TCHUI6-m*Dg9~L0OIxY2L)>a0fue!Ur-@SYH(|2`LEsa zI6~Zad9dxHO+VfFeJ)=)r|!Av;FKWKYp-T`Yi>NXY<@By0cwy0*$|wcR#Ki=l*&+EUaps!mtCBkSdglhUz9%k SosASw5re0zpUXO@geCwotTW^Q diff --git a/plugins/placeholder/lang/_translationstatus.txt b/plugins/placeholder/lang/_translationstatus.txt deleted file mode 100644 index 24d039b4548..00000000000 --- a/plugins/placeholder/lang/_translationstatus.txt +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.md or http://ckeditor.com/license - -bg.js Found: 5 Missing: 0 -cs.js Found: 5 Missing: 0 -cy.js Found: 5 Missing: 0 -da.js Found: 5 Missing: 0 -de.js Found: 5 Missing: 0 -el.js Found: 5 Missing: 0 -eo.js Found: 5 Missing: 0 -et.js Found: 5 Missing: 0 -fa.js Found: 5 Missing: 0 -fi.js Found: 5 Missing: 0 -fr.js Found: 5 Missing: 0 -he.js Found: 5 Missing: 0 -hr.js Found: 5 Missing: 0 -it.js Found: 5 Missing: 0 -nb.js Found: 5 Missing: 0 -nl.js Found: 5 Missing: 0 -no.js Found: 5 Missing: 0 -pl.js Found: 5 Missing: 0 -tr.js Found: 5 Missing: 0 -ug.js Found: 5 Missing: 0 -uk.js Found: 5 Missing: 0 -vi.js Found: 3 Missing: 2 -zh-cn.js Found: 5 Missing: 0 diff --git a/plugins/placeholder/lang/bg.js b/plugins/placeholder/lang/bg.js deleted file mode 100644 index 992014ca350..00000000000 --- a/plugins/placeholder/lang/bg.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'bg', { - title: 'Настройки на контейнера', - toolbar: 'Нов контейнер', - text: 'Текст за контейнера', - edit: 'Промяна на контейнер', - textMissing: 'Контейнера трябва да съдържа текст.' -}); diff --git a/plugins/placeholder/lang/cs.js b/plugins/placeholder/lang/cs.js deleted file mode 100644 index 195f1cf3f17..00000000000 --- a/plugins/placeholder/lang/cs.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'cs', { - title: 'Vlastnosti vyhrazeného prostoru', - toolbar: 'Vytvořit vyhrazený prostor', - text: 'Vyhrazený text', - edit: 'Upravit vyhrazený prostor', - textMissing: 'Vyhrazený prostor musí obsahovat text.' -}); diff --git a/plugins/placeholder/lang/cy.js b/plugins/placeholder/lang/cy.js deleted file mode 100644 index 151ce561572..00000000000 --- a/plugins/placeholder/lang/cy.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'cy', { - title: 'Priodweddau\'r Daliwr Geiriau', - toolbar: 'Creu Daliwr Geiriau', - text: 'Testun y Daliwr Geiriau', - edit: 'Golygu\'r Dailwr Geiriau', - textMissing: 'Mae\'n rhaid i\'r daliwr geiriau gynnwys testun.' -}); diff --git a/plugins/placeholder/lang/da.js b/plugins/placeholder/lang/da.js deleted file mode 100644 index 55c85c1015a..00000000000 --- a/plugins/placeholder/lang/da.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'da', { - title: 'Egenskaber for pladsholder', - toolbar: 'Opret pladsholder', - text: 'Tekst til pladsholder', - edit: 'Rediger pladsholder', - textMissing: 'Pladsholder skal indeholde tekst' -}); diff --git a/plugins/placeholder/lang/de.js b/plugins/placeholder/lang/de.js deleted file mode 100644 index 661f992bfd4..00000000000 --- a/plugins/placeholder/lang/de.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'de', { - title: 'Platzhalter Einstellungen', - toolbar: 'Platzhalter erstellen', - text: 'Platzhalter Text', - edit: 'Platzhalter bearbeiten', - textMissing: 'Der Platzhalter muss einen Text beinhalten.' -}); diff --git a/plugins/placeholder/lang/el.js b/plugins/placeholder/lang/el.js deleted file mode 100644 index b5f5bbee926..00000000000 --- a/plugins/placeholder/lang/el.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'el', { - title: 'Ιδιότητες Υποκατάστατου Κειμένου', - toolbar: 'Δημιουργία Υποκατάσταστου Κειμένου', - text: 'Υποκαθιστόμενο Κείμενο', - edit: 'Επεξεργασία Υποκατάσταστου Κειμένου', - textMissing: 'Πρέπει να υπάρχει υποκαθιστόμενο κείμενο.' -}); diff --git a/plugins/placeholder/lang/en.js b/plugins/placeholder/lang/en.js deleted file mode 100644 index 61b8185c304..00000000000 --- a/plugins/placeholder/lang/en.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'en', { - title: 'Placeholder Properties', - toolbar: 'Create Placeholder', - text: 'Placeholder Text', - edit: 'Edit Placeholder', - textMissing: 'The placeholder must contain text.' -}); diff --git a/plugins/placeholder/lang/eo.js b/plugins/placeholder/lang/eo.js deleted file mode 100644 index 6a383e4c1b6..00000000000 --- a/plugins/placeholder/lang/eo.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'eo', { - title: 'Atributoj de la rezervita spaco', - toolbar: 'Krei la rezervitan spacon', - text: 'Texto de la rezervita spaco', - edit: 'Modifi la rezervitan spacon', - textMissing: 'La rezervita spaco devas enteni tekston.' -}); diff --git a/plugins/placeholder/lang/et.js b/plugins/placeholder/lang/et.js deleted file mode 100644 index aa730b9bdd5..00000000000 --- a/plugins/placeholder/lang/et.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'et', { - title: 'Kohahoidja omadused', - toolbar: 'Kohahoidja loomine', - text: 'Kohahoidja tekst', - edit: 'Kohahoidja muutmine', - textMissing: 'Kohahoidja peab sisaldama teksti.' -}); diff --git a/plugins/placeholder/lang/fa.js b/plugins/placeholder/lang/fa.js deleted file mode 100644 index d5dea48daa9..00000000000 --- a/plugins/placeholder/lang/fa.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'fa', { - title: 'ویژگی‌های محل نگهداری', - toolbar: 'ایجاد یک محل نگهداری', - text: 'متن محل نگهداری', - edit: 'ویرایش محل نگهداری', - textMissing: 'محل نگهداری باید محتوی متن باشد.' -}); diff --git a/plugins/placeholder/lang/fi.js b/plugins/placeholder/lang/fi.js deleted file mode 100644 index 03a58765d17..00000000000 --- a/plugins/placeholder/lang/fi.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'fi', { - title: 'Paikkamerkin ominaisuudet', - toolbar: 'Luo paikkamerkki', - text: 'Paikkamerkin teksti', - edit: 'Muokkaa paikkamerkkiä', - textMissing: 'Paikkamerkin täytyy sisältää tekstiä' -}); diff --git a/plugins/placeholder/lang/fr.js b/plugins/placeholder/lang/fr.js deleted file mode 100644 index 8664bc13136..00000000000 --- a/plugins/placeholder/lang/fr.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'fr', { - title: 'Propriétés de l\'Espace réservé', - toolbar: 'Créer l\'Espace réservé', - text: 'Texte de l\'Espace réservé', - edit: 'Modifier l\'Espace réservé', - textMissing: 'L\'Espace réservé doit contenir du texte.' -}); diff --git a/plugins/placeholder/lang/he.js b/plugins/placeholder/lang/he.js deleted file mode 100644 index ea444ba3d3f..00000000000 --- a/plugins/placeholder/lang/he.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'he', { - title: 'מאפייני שומר מקום', - toolbar: 'צור שומר מקום', - text: 'תוכן שומר המקום', - edit: 'ערוך שומר מקום', - textMissing: 'שומר המקום חייב להכיל טקסט.' -}); diff --git a/plugins/placeholder/lang/hr.js b/plugins/placeholder/lang/hr.js deleted file mode 100644 index 2d344ba17bf..00000000000 --- a/plugins/placeholder/lang/hr.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'hr', { - title: 'Svojstva rezerviranog mjesta', - toolbar: 'Napravi rezervirano mjesto', - text: 'Tekst rezerviranog mjesta', - edit: 'Uredi rezervirano mjesto', - textMissing: 'Rezervirano mjesto mora sadržavati tekst.' -}); diff --git a/plugins/placeholder/lang/it.js b/plugins/placeholder/lang/it.js deleted file mode 100644 index 42fc0807d8d..00000000000 --- a/plugins/placeholder/lang/it.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'it', { - title: 'Proprietà segnaposto', - toolbar: 'Crea segnaposto', - text: 'Testo segnaposto', - edit: 'Modifica segnaposto', - textMissing: 'Il segnaposto deve contenere del testo.' -}); diff --git a/plugins/placeholder/lang/nb.js b/plugins/placeholder/lang/nb.js deleted file mode 100644 index 7a6cd69188c..00000000000 --- a/plugins/placeholder/lang/nb.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'nb', { - title: 'Egenskaper for plassholder', - toolbar: 'Opprett plassholder', - text: 'Tekst for plassholder', - edit: 'Rediger plassholder', - textMissing: 'Plassholderen må inneholde tekst.' -}); diff --git a/plugins/placeholder/lang/nl.js b/plugins/placeholder/lang/nl.js deleted file mode 100644 index a31ae63f7ed..00000000000 --- a/plugins/placeholder/lang/nl.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'nl', { - title: 'Eigenschappen placeholder', - toolbar: 'Placeholder aanmaken', - text: 'Placeholder tekst', - edit: 'Placeholder wijzigen', - textMissing: 'De placeholder moet tekst bevatten.' -}); diff --git a/plugins/placeholder/lang/no.js b/plugins/placeholder/lang/no.js deleted file mode 100644 index b9f02e4d10e..00000000000 --- a/plugins/placeholder/lang/no.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'no', { - title: 'Egenskaper for plassholder', - toolbar: 'Opprett plassholder', - text: 'Tekst for plassholder', - edit: 'Rediger plassholder', - textMissing: 'Plassholderen må inneholde tekst.' -}); diff --git a/plugins/placeholder/lang/pl.js b/plugins/placeholder/lang/pl.js deleted file mode 100644 index 215daa5f694..00000000000 --- a/plugins/placeholder/lang/pl.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'pl', { - title: 'Właściwości wypełniacza', - toolbar: 'Utwórz wypełniacz', - text: 'Tekst wypełnienia', - edit: 'Edytuj wypełnienie', - textMissing: 'Wypełnienie musi posiadać jakiś tekst.' -}); diff --git a/plugins/placeholder/lang/tr.js b/plugins/placeholder/lang/tr.js deleted file mode 100644 index 162ee60c3a8..00000000000 --- a/plugins/placeholder/lang/tr.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'tr', { - title: 'Yer tutucu özellikleri', - toolbar: 'Yer tutucu oluşturun', - text: 'Yer tutucu metini', - edit: 'Yer tutucuyu düzenle', - textMissing: 'Yer tutucu metin içermelidir.' -}); diff --git a/plugins/placeholder/lang/ug.js b/plugins/placeholder/lang/ug.js deleted file mode 100644 index 2a18d1abb4a..00000000000 --- a/plugins/placeholder/lang/ug.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'ug', { - title: 'ئورۇن بەلگە خاسلىقى', - toolbar: 'ئورۇن بەلگە قۇر', - text: 'ئورۇن بەلگە تېكىستى', - edit: 'ئورۇن بەلگە تەھرىر', - textMissing: 'ئورۇن بەلگىسىدە چوقۇم تېكىست بولۇشى لازىم' -}); diff --git a/plugins/placeholder/lang/uk.js b/plugins/placeholder/lang/uk.js deleted file mode 100644 index 3b94d646390..00000000000 --- a/plugins/placeholder/lang/uk.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'uk', { - title: 'Налаштування Заповнювача', - toolbar: 'Створити Заповнювач', - text: 'Текст Заповнювача', - edit: 'Редагувати Заповнювач', - textMissing: 'Заповнювач повинен містити текст.' -}); diff --git a/plugins/placeholder/lang/vi.js b/plugins/placeholder/lang/vi.js deleted file mode 100644 index 0abc1de8c2c..00000000000 --- a/plugins/placeholder/lang/vi.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'vi', { - title: 'Thuộc tính đặt chỗ', - toolbar: 'Tạo đặt chỗ', - text: 'Văn bản đặt chỗ', - edit: 'Edit Placeholder', // MISSING - textMissing: 'The placeholder must contain text.' // MISSING -}); diff --git a/plugins/placeholder/lang/zh-cn.js b/plugins/placeholder/lang/zh-cn.js deleted file mode 100644 index 2d226a7ca55..00000000000 --- a/plugins/placeholder/lang/zh-cn.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -CKEDITOR.plugins.setLang( 'placeholder', 'zh-cn', { - title: '占位符属性', - toolbar: '创建占位符', - text: '占位符文字', - edit: '编辑占位符', - textMissing: '占位符必需包含有文字' -}); diff --git a/plugins/placeholder/plugin.js b/plugins/placeholder/plugin.js deleted file mode 100644 index f49ccb02171..00000000000 --- a/plugins/placeholder/plugin.js +++ /dev/null @@ -1,143 +0,0 @@ -/** - * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license - */ - -/** - * @fileOverview The "placeholder" plugin. - * - */ - -(function() { - var placeholderReplaceRegex = /\[\[[^\]]+\]\]/g; - CKEDITOR.plugins.add( 'placeholder', { - requires: 'dialog', - lang: 'en,bg,cs,cy,da,de,el,eo,et,fa,fi,fr,he,hr,it,ku,nb,nl,no,pl,tr,ug,uk,vi,zh-cn', // %REMOVE_LINE_CORE% - icons: 'placeholder', // %REMOVE_LINE_CORE% - hidpi: true, // %REMOVE_LINE_CORE% - onLoad: function() { - CKEDITOR.addCss( '.cke_placeholder' + - '{' + - 'background-color: #ffff00;' + - ( CKEDITOR.env.gecko ? 'cursor: default;' : '' ) + - '}' - ); - }, - init: function( editor ) { - var lang = editor.lang.placeholder; - - editor.addCommand( 'createplaceholder', new CKEDITOR.dialogCommand( 'createplaceholder' ) ); - editor.addCommand( 'editplaceholder', new CKEDITOR.dialogCommand( 'editplaceholder' ) ); - - editor.ui.addButton && editor.ui.addButton( 'CreatePlaceholder', { - label: lang.toolbar, - command: 'createplaceholder', - toolbar: 'insert,5', - icon: 'placeholder' - }); - - if ( editor.addMenuItems ) { - editor.addMenuGroup( 'placeholder', 20 ); - editor.addMenuItems({ - editplaceholder: { - label: lang.edit, - command: 'editplaceholder', - group: 'placeholder', - order: 1, - icon: 'placeholder' - } - }); - - if ( editor.contextMenu ) { - editor.contextMenu.addListener( function( element, selection ) { - if ( !element || !element.data( 'cke-placeholder' ) ) - return null; - - return { editplaceholder: CKEDITOR.TRISTATE_OFF }; - }); - } - } - - editor.on( 'doubleclick', function( evt ) { - if ( CKEDITOR.plugins.placeholder.getSelectedPlaceHolder( editor ) ) - evt.data.dialog = 'editplaceholder'; - }); - - editor.on( 'contentDom', function() { - editor.editable().on( 'resizestart', function( evt ) { - if ( editor.getSelection().getSelectedElement().data( 'cke-placeholder' ) ) - evt.data.preventDefault(); - }); - }); - - CKEDITOR.dialog.add( 'createplaceholder', this.path + 'dialogs/placeholder.js' ); - CKEDITOR.dialog.add( 'editplaceholder', this.path + 'dialogs/placeholder.js' ); - }, - afterInit: function( editor ) { - var dataProcessor = editor.dataProcessor, - dataFilter = dataProcessor && dataProcessor.dataFilter, - htmlFilter = dataProcessor && dataProcessor.htmlFilter; - - if ( dataFilter ) { - dataFilter.addRules({ - text: function( text ) { - return text.replace( placeholderReplaceRegex, function( match ) { - return CKEDITOR.plugins.placeholder.createPlaceholder( editor, null, match, 1 ); - }); - } - }); - } - - if ( htmlFilter ) { - htmlFilter.addRules({ - elements: { - 'span': function( element ) { - if ( element.attributes && element.attributes[ 'data-cke-placeholder' ] ) - delete element.name; - } - } - }); - } - } - }); -})(); - -CKEDITOR.plugins.placeholder = { - createPlaceholder: function( editor, oldElement, text, isGet ) { - var element = new CKEDITOR.dom.element( 'span', editor.document ); - element.setAttributes({ - contentEditable: 'false', - 'data-cke-placeholder': 1, - 'class': 'cke_placeholder' - }); - - text && element.setText( text ); - - if ( isGet ) - return element.getOuterHtml(); - - if ( oldElement ) { - if ( CKEDITOR.env.ie ) { - element.insertAfter( oldElement ); - // Some time is required for IE before the element is removed. - setTimeout( function() { - oldElement.remove(); - element.focus(); - }, 10 ); - } else - element.replace( oldElement ); - } else - editor.insertElement( element ); - - return null; - }, - - getSelectedPlaceHolder: function( editor ) { - var range = editor.getSelection().getRanges()[ 0 ]; - range.shrink( CKEDITOR.SHRINK_TEXT ); - var node = range.startContainer; - while ( node && !( node.type == CKEDITOR.NODE_ELEMENT && node.data( 'cke-placeholder' ) ) ) - node = node.getParent(); - return node; - } -}; diff --git a/plugins/placeholder/samples/placeholder.html b/plugins/placeholder/samples/placeholder.html deleted file mode 100644 index cf542432e49..00000000000 --- a/plugins/placeholder/samples/placeholder.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - Placeholder Plugin — CKEditor Sample - - - - - - - - -

- CKEditor Samples » Using the Placeholder Plugin -

-
-

- This sample shows how to configure CKEditor instances to use the - Placeholder plugin that lets you insert read-only elements - into your content. To enter and modify read-only text, use the - Create Placeholder button and its matching dialog window. -

-

- To add a CKEditor instance that uses the placeholder plugin and a related - Create Placeholder toolbar button, insert the following JavaScript - call to your code: -

-
-CKEDITOR.replace( 'textarea_id', {
-	extraPlugins: 'placeholder',
-	toolbar: [ [ 'Source', 'Bold' ], ['CreatePlaceholder'] ]
-});
-

- Note that textarea_id in the code above is the id attribute of - the <textarea> element to be replaced with CKEditor. -

-
-
-

- - - -

-

- -

-
- - - From 233d4a51e7a0f7f10896b42fb55fca76bfff22fe Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Tue, 24 Sep 2013 15:01:38 +0200 Subject: [PATCH 22/30] Temp plugin name placeholder2 renamed to target placeholder. --- .../dialogs/placeholder2.js | 4 ++-- .../icons/hidpi/placeholder2.png | Bin .../icons/placeholder2.png | Bin .../{placeholder2 => placeholder}/lang/en.js | 2 +- .../{placeholder2 => placeholder}/plugin.js | 20 +++++++++--------- .../samples/placeholder2.html | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) rename plugins/{placeholder2 => placeholder}/dialogs/placeholder2.js (90%) rename plugins/{placeholder2 => placeholder}/icons/hidpi/placeholder2.png (100%) rename plugins/{placeholder2 => placeholder}/icons/placeholder2.png (100%) rename plugins/{placeholder2 => placeholder}/lang/en.js (89%) rename plugins/{placeholder2 => placeholder}/plugin.js (81%) rename plugins/{placeholder2 => placeholder}/samples/placeholder2.html (98%) diff --git a/plugins/placeholder2/dialogs/placeholder2.js b/plugins/placeholder/dialogs/placeholder2.js similarity index 90% rename from plugins/placeholder2/dialogs/placeholder2.js rename to plugins/placeholder/dialogs/placeholder2.js index 2e4b2207101..b23eab57bc5 100644 --- a/plugins/placeholder2/dialogs/placeholder2.js +++ b/plugins/placeholder/dialogs/placeholder2.js @@ -11,9 +11,9 @@ 'use strict'; -CKEDITOR.dialog.add( 'placeholder2', function( editor ) { +CKEDITOR.dialog.add( 'placeholder', function( editor ) { - var lang = editor.lang.placeholder2, + var lang = editor.lang.placeholder, generalLabel = editor.lang.common.generalTab, validNameRegex = /^[^\[\]\<\>]+$/; diff --git a/plugins/placeholder2/icons/hidpi/placeholder2.png b/plugins/placeholder/icons/hidpi/placeholder2.png similarity index 100% rename from plugins/placeholder2/icons/hidpi/placeholder2.png rename to plugins/placeholder/icons/hidpi/placeholder2.png diff --git a/plugins/placeholder2/icons/placeholder2.png b/plugins/placeholder/icons/placeholder2.png similarity index 100% rename from plugins/placeholder2/icons/placeholder2.png rename to plugins/placeholder/icons/placeholder2.png diff --git a/plugins/placeholder2/lang/en.js b/plugins/placeholder/lang/en.js similarity index 89% rename from plugins/placeholder2/lang/en.js rename to plugins/placeholder/lang/en.js index c6c9017f37b..4521ca14470 100644 --- a/plugins/placeholder2/lang/en.js +++ b/plugins/placeholder/lang/en.js @@ -3,7 +3,7 @@ * For licensing, see LICENSE.md or http://ckeditor.com/license */ -CKEDITOR.plugins.setLang( 'placeholder2', 'en', { +CKEDITOR.plugins.setLang( 'placeholder', 'en', { button: 'Add placeholder', defaultName: 'DEFAULT_PLACEHOLDER_NAME', title: 'Placeholder Properties', diff --git a/plugins/placeholder2/plugin.js b/plugins/placeholder/plugin.js similarity index 81% rename from plugins/placeholder2/plugin.js rename to plugins/placeholder/plugin.js index 2b4a91a8542..ba7f271401f 100644 --- a/plugins/placeholder2/plugin.js +++ b/plugins/placeholder/plugin.js @@ -5,34 +5,34 @@ */ /** - * @fileOverview The "placeholder2" plugin. + * @fileOverview The "placeholder" plugin. * */ 'use strict'; (function() { - CKEDITOR.plugins.add( 'placeholder2', { + CKEDITOR.plugins.add( 'placeholder', { requires: 'widget,dialog', lang: 'en', // %REMOVE_LINE_CORE% - icons: 'placeholder2', // %REMOVE_LINE_CORE% + icons: 'placeholder', // %REMOVE_LINE_CORE% hidpi: true, // %REMOVE_LINE_CORE% init: function( editor ) { // Register dialog. - CKEDITOR.dialog.add( 'placeholder2', this.path + 'dialogs/placeholder2.js' ); + CKEDITOR.dialog.add( 'placeholder', this.path + 'dialogs/placeholder.js' ); // Put ur init code here. - editor.widgets.add( 'placeholder2', { + editor.widgets.add( 'placeholder', { // Widget code. - button: editor.lang.placeholder2.button, - dialog: 'placeholder2', + button: editor.lang.placeholder.button, + dialog: 'placeholder', // We need to have wrapping element, otherwise there are issues in // add dialog. template: '[[]]', defaults: { - name: editor.lang.placeholder2.defaultName + name: editor.lang.placeholder.defaultName }, downcast: function( widgetElement ) { @@ -51,7 +51,7 @@ } ); // Registers styles for placeholder widget frame. - CKEDITOR.addCss( '.cke_widget_wrapper *[data-widget="placeholder2"]{background-color: #ffff00;}' ); + CKEDITOR.addCss( '.cke_widget_wrapper *[data-widget="placeholder"]{background-color: #ffff00;}' ); }, afterInit: function( editor ) { @@ -68,7 +68,7 @@ // Adds placeholder identifier as innertext. innerElement.add( new CKEDITOR.htmlParser.text( match ) ); - widgetWrapper = widgetRepo.wrapElement( innerElement, 'placeholder2' ); + widgetWrapper = widgetRepo.wrapElement( innerElement, 'placeholder' ); // Return outerhtml of widget wrapper so it will be placed // as replacement. diff --git a/plugins/placeholder2/samples/placeholder2.html b/plugins/placeholder/samples/placeholder2.html similarity index 98% rename from plugins/placeholder2/samples/placeholder2.html rename to plugins/placeholder/samples/placeholder2.html index 64ea9ba3658..520a03b11a8 100644 --- a/plugins/placeholder2/samples/placeholder2.html +++ b/plugins/placeholder/samples/placeholder2.html @@ -48,7 +48,7 @@

From e53174d336d8cf2fcfedae943b80fc40e37259fe Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Tue, 24 Sep 2013 15:19:22 +0200 Subject: [PATCH 24/30] Code cleanup. --- plugins/placeholder/plugin.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/placeholder/plugin.js b/plugins/placeholder/plugin.js index ba7f271401f..4f367c010c4 100644 --- a/plugins/placeholder/plugin.js +++ b/plugins/placeholder/plugin.js @@ -50,7 +50,7 @@ } ); - // Registers styles for placeholder widget frame. + // Register styles for placeholder widget frame. CKEDITOR.addCss( '.cke_widget_wrapper *[data-widget="placeholder"]{background-color: #ffff00;}' ); }, @@ -64,7 +64,6 @@ // Creating widget code. var widgetWrapper = null, innerElement = new CKEDITOR.htmlParser.element( 'span' ); - // Inner element gets decorated with extra attrs in wrapElement() method. // Adds placeholder identifier as innertext. innerElement.add( new CKEDITOR.htmlParser.text( match ) ); From c656aeeef588b3a06d2837289a4174407e3d820a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Wed, 2 Oct 2013 15:50:21 +0200 Subject: [PATCH 25/30] Call CKEDITOR.addCss only once for all editor instances. --- plugins/placeholder/plugin.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/placeholder/plugin.js b/plugins/placeholder/plugin.js index 4f367c010c4..f6dbb9cf21d 100644 --- a/plugins/placeholder/plugin.js +++ b/plugins/placeholder/plugin.js @@ -18,6 +18,11 @@ icons: 'placeholder', // %REMOVE_LINE_CORE% hidpi: true, // %REMOVE_LINE_CORE% + onLoad: function() { + // Register styles for placeholder widget frame. + CKEDITOR.addCss( '.cke_widget_wrapper *[data-widget="placeholder"]{background-color:#ff0}' ); + }, + init: function( editor ) { // Register dialog. CKEDITOR.dialog.add( 'placeholder', this.path + 'dialogs/placeholder.js' ); @@ -49,9 +54,6 @@ } } ); - - // Register styles for placeholder widget frame. - CKEDITOR.addCss( '.cke_widget_wrapper *[data-widget="placeholder"]{background-color: #ffff00;}' ); }, afterInit: function( editor ) { From 9aa698623c1829a955f1fb905ccb785afc5cb7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Wed, 2 Oct 2013 16:00:05 +0200 Subject: [PATCH 26/30] Use cke_placeholder class to style placeholder for better backward compatibility and easier styling. --- plugins/placeholder/plugin.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/placeholder/plugin.js b/plugins/placeholder/plugin.js index f6dbb9cf21d..feba924b2a0 100644 --- a/plugins/placeholder/plugin.js +++ b/plugins/placeholder/plugin.js @@ -20,7 +20,7 @@ onLoad: function() { // Register styles for placeholder widget frame. - CKEDITOR.addCss( '.cke_widget_wrapper *[data-widget="placeholder"]{background-color:#ff0}' ); + CKEDITOR.addCss( '.cke_placeholder{background-color:#ff0}' ); }, init: function( editor ) { @@ -34,7 +34,7 @@ dialog: 'placeholder', // We need to have wrapping element, otherwise there are issues in // add dialog. - template: '[[]]', + template: '[[]]', defaults: { name: editor.lang.placeholder.defaultName @@ -65,7 +65,9 @@ return text.replace( placeholderReplaceRegex, function( match ) { // Creating widget code. var widgetWrapper = null, - innerElement = new CKEDITOR.htmlParser.element( 'span' ); + innerElement = new CKEDITOR.htmlParser.element( 'span', { + 'class': 'cke_placeholder' + } ); // Adds placeholder identifier as innertext. innerElement.add( new CKEDITOR.htmlParser.text( match ) ); From 7b4b07ec6b8ff9d177d118ecd195ce6eee4277a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Wed, 2 Oct 2013 16:12:25 +0200 Subject: [PATCH 27/30] Minor cleanup. --- plugins/placeholder/dialogs/placeholder.js | 1 - plugins/placeholder/plugin.js | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/placeholder/dialogs/placeholder.js b/plugins/placeholder/dialogs/placeholder.js index b23eab57bc5..a1cc82acccb 100644 --- a/plugins/placeholder/dialogs/placeholder.js +++ b/plugins/placeholder/dialogs/placeholder.js @@ -12,7 +12,6 @@ 'use strict'; CKEDITOR.dialog.add( 'placeholder', function( editor ) { - var lang = editor.lang.placeholder, generalLabel = editor.lang.common.generalTab, validNameRegex = /^[^\[\]\<\>]+$/; diff --git a/plugins/placeholder/plugin.js b/plugins/placeholder/plugin.js index feba924b2a0..2248abb0471 100644 --- a/plugins/placeholder/plugin.js +++ b/plugins/placeholder/plugin.js @@ -40,7 +40,7 @@ name: editor.lang.placeholder.defaultName }, - downcast: function( widgetElement ) { + downcast: function() { return new CKEDITOR.htmlParser.text( '[[' + this.data.name + ']]' ); }, @@ -52,13 +52,11 @@ data: function( data ) { this.element.setText( '[[' + this.data.name + ']]' ); } - } ); }, afterInit: function( editor ) { - var widgetRepo = editor.widgets, - placeholderReplaceRegex = /\[\[([^\[\]])+\]\]/g; + var placeholderReplaceRegex = /\[\[([^\[\]])+\]\]/g; editor.dataProcessor.dataFilter.addRules( { text: function( text ) { @@ -71,7 +69,7 @@ // Adds placeholder identifier as innertext. innerElement.add( new CKEDITOR.htmlParser.text( match ) ); - widgetWrapper = widgetRepo.wrapElement( innerElement, 'placeholder' ); + widgetWrapper = editor.widgets.wrapElement( innerElement, 'placeholder' ); // Return outerhtml of widget wrapper so it will be placed // as replacement. From a1972d9ef4fcce7e194a24a99218bc9345c24fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Wed, 2 Oct 2013 16:13:08 +0200 Subject: [PATCH 28/30] We don't need a default name since it's empty. --- plugins/placeholder/lang/en.js | 1 - plugins/placeholder/plugin.js | 4 ---- 2 files changed, 5 deletions(-) diff --git a/plugins/placeholder/lang/en.js b/plugins/placeholder/lang/en.js index 4521ca14470..974434d2623 100644 --- a/plugins/placeholder/lang/en.js +++ b/plugins/placeholder/lang/en.js @@ -5,7 +5,6 @@ CKEDITOR.plugins.setLang( 'placeholder', 'en', { button: 'Add placeholder', - defaultName: 'DEFAULT_PLACEHOLDER_NAME', title: 'Placeholder Properties', toolbar: 'Create Placeholder', name: 'Placeholder Name', diff --git a/plugins/placeholder/plugin.js b/plugins/placeholder/plugin.js index 2248abb0471..c470940621b 100644 --- a/plugins/placeholder/plugin.js +++ b/plugins/placeholder/plugin.js @@ -36,10 +36,6 @@ // add dialog. template: '[[]]', - defaults: { - name: editor.lang.placeholder.defaultName - }, - downcast: function() { return new CKEDITOR.htmlParser.text( '[[' + this.data.name + ']]' ); }, From 414b7a76cadf91c23d174612fbbb66e54bf2f7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Wed, 2 Oct 2013 16:18:56 +0200 Subject: [PATCH 29/30] Switched to the 'toolbar' language entry which we used in previous version and removed 'Create' fragment, because now it may also be used to edit placeholder. --- plugins/placeholder/lang/en.js | 3 +-- plugins/placeholder/plugin.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/placeholder/lang/en.js b/plugins/placeholder/lang/en.js index 974434d2623..b3217ff3b00 100644 --- a/plugins/placeholder/lang/en.js +++ b/plugins/placeholder/lang/en.js @@ -4,9 +4,8 @@ */ CKEDITOR.plugins.setLang( 'placeholder', 'en', { - button: 'Add placeholder', title: 'Placeholder Properties', - toolbar: 'Create Placeholder', + toolbar: 'Placeholder', name: 'Placeholder Name', invalidName: 'The placeholder can not be empty and can not contain any of following characters: [, ], <, >' }); diff --git a/plugins/placeholder/plugin.js b/plugins/placeholder/plugin.js index c470940621b..62f71fa7215 100644 --- a/plugins/placeholder/plugin.js +++ b/plugins/placeholder/plugin.js @@ -30,7 +30,7 @@ // Put ur init code here. editor.widgets.add( 'placeholder', { // Widget code. - button: editor.lang.placeholder.button, + button: editor.lang.placeholder.toolbar, dialog: 'placeholder', // We need to have wrapping element, otherwise there are issues in // add dialog. From 9e69dc5dfe1d77bbf593392d840e9aa0dd0dc9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Fri, 4 Oct 2013 10:39:51 +0200 Subject: [PATCH 30/30] Changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index c06429c2624..ebf1136d63c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ New Features: Fixed Issues: * [#10612](http://dev.ckeditor.com/ticket/10612): Internet Explorer 11 compatibility issues. +* [#10862](http://dev.ckeditor.com/ticket/10862): Placeholder plugin was rewritten as a widget in order to fix it. * [#10831](http://dev.ckeditor.com/ticket/10831): Image2: Merged `image2inline` and `image2block` into `image2` widget. * [#10835](http://dev.ckeditor.com/ticket/10835): Image2: Improved visibility of the resize handler. * [#10836](http://dev.ckeditor.com/ticket/10836): Image2: Preserve custom mouse cursor while resizing the image.