Ticket #10185: 10185.patch

File 10185.patch, 1.7 KB (added by thomb, 10 years ago)

Added configuration option for placeholder plugin

  • _source/plugins/placeholder/plugin.js

     
    1010
    1111(function()
    1212{
    13         var placeholderReplaceRegex = /\[\[[^\]]+\]\]/g;
    1413        CKEDITOR.plugins.add( 'placeholder',
    1514        {
    1615                requires : [ 'dialog' ],
     
    8685                {
    8786                        var dataProcessor = editor.dataProcessor,
    8887                                dataFilter = dataProcessor && dataProcessor.dataFilter,
    89                                 htmlFilter = dataProcessor && dataProcessor.htmlFilter;
    90 
     88                                htmlFilter = dataProcessor && dataProcessor.htmlFilter,
     89                                placeholderReplaceRegex = new RegExp('\\' + editor.config.placeholderClosures[0] + '\\' + editor.config.placeholderClosures[1] + '[^\\' + editor.config.placeholderClosures[2] + ']+\\' + editor.config.placeholderClosures[2] + '\\' + editor.config.placeholderClosures[3], 'g');
     90                       
    9191                        if ( dataFilter )
    9292                        {
    9393                                dataFilter.addRules(
     
    169169                return node;
    170170        }
    171171};
     172
     173/**
     174 * Define the type of closures used for the placeholder element.
     175 * The first two array elements are used to define which string determines the start and the third
     176 * and fourth array elements define which string determines the end.
     177 * A slight word of caution: do not declare the defaults with strings which are more commonly used
     178 * as this will return false positives matches on non placeholder text
     179 * @type Array of string
     180 * @default ['[', '[', ']', ']']
     181 * @example
     182 * config.placeholderClosures = ['[', '[', ']', ']']
     183 */
     184CKEDITOR.config.placeholderClosures = ['[', '[', ']', ']'];
     185 No newline at end of file
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy