Ticket #10185: CKEditorPlaceholderConfigurable.patch

File CKEditorPlaceholderConfigurable.patch, 2.3 KB (added by Philipp Holz, 11 years ago)

CKEditorPlaceholderConfigurable.patch

  • plugins/placeholder/dialogs/placeholder.js

    diff --git a/plugins/placeholder/dialogs/placeholder.js b/plugins/placeholder/dialogs/placeholder.js
    index beb43a5..a428487 100644
    a b  
    3131                                                        this.setValue( element.getText().slice( 2, -2 ) );
    3232                                        },
    3333                                        commit: function( element ) {
    34                                                 var text = '[[' + this.getValue() + ']]';
     34                        var placeholderTag = editor.config.placeholderTag || '[[$CONTENT$]]',
     35                            text = placeholderTag.replace( '$CONTENT$', this.getValue() );
    3536                                                // The placeholder must be recreated.
    3637                                                CKEDITOR.plugins.placeholder.createPlaceholder( editor, element, text );
    3738                                        }
  • plugins/placeholder/plugin.js

    diff --git a/plugins/placeholder/plugin.js b/plugins/placeholder/plugin.js
    index 0ddf8f0..0d2ce10 100644
    a b  
    99 */
    1010
    1111(function() {
    12         var placeholderReplaceRegex = /\[\[[^\]]+\]\]/g;
    1312        CKEDITOR.plugins.add( 'placeholder', {
    1413                requires: 'dialog',
    1514                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%
     
    6463
    6564                        editor.on( 'contentDom', function() {
    6665                                editor.editable().on( 'resizestart', function( evt ) {
    67                                         if ( editor.getSelection().getSelectedElement().data( 'cke-placeholder' ) )
     66                    if ( editor.getSelection().getSelectedElement().data( 'cke-placeholder' ) )
    6867                                                evt.data.preventDefault();
    6968                                });
    7069                        });
     
    7574                afterInit: function( editor ) {
    7675                        var dataProcessor = editor.dataProcessor,
    7776                                dataFilter = dataProcessor && dataProcessor.dataFilter,
    78                                 htmlFilter = dataProcessor && dataProcessor.htmlFilter;
     77                                htmlFilter = dataProcessor && dataProcessor.htmlFilter,
     78                placeholderReplaceRegex = editor.config.placeholderReplaceRegex || /\[\[[^\]]+\]\]/g;
    7979
    8080                        if ( dataFilter ) {
    8181                                dataFilter.addRules({
     
    103103
    104104CKEDITOR.plugins.placeholder = {
    105105        createPlaceholder: function( editor, oldElement, text, isGet ) {
    106                 var element = new CKEDITOR.dom.element( 'span', editor.document );
     106        var element = new CKEDITOR.dom.element( 'span', editor.document);
    107107                element.setAttributes({
    108108                        contentEditable: 'false',
    109109                        'data-cke-placeholder': 1,
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy