How to prevent ckeditor to not add   in blank html tag

后端 未结 3 1129
隐瞒了意图╮
隐瞒了意图╮ 2021-02-20 03:21

I have Visual Studio 2012 Express installed in Windows 8.1 OS and using CKEditor in my project as per requirement.

I am new for CKEditor and using it in a proper way as

3条回答
  •  你的背包
    2021-02-20 04:07

    This topic can be helpfull https://stackoverflow.com/

    In short- You can disable Automatic filling of empty blocks in the config:

    config.fillEmptyBlocks = false;
    

    more information- here

    UPD.

    You can try this config.protectedSource.push(/]*><\/i>/g);

    From official documentation

    {Array} CKEDITOR.config.protectedSource Since: 3.0

    List of regular expressions to be executed on input HTML, indicating HTML source code that when matched, must not be available in the WYSIWYG mode for editing.

    config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP code

    config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP code

    config.protectedSource.push( /(]+>[\s|\S]*?]+>)|(]+/>)/gi ); // ASP.Net code

    UPD 2

    Hope this will help.

    CKEDITOR.on( 'instanceReady', function( ev )
    {
    // turn off excess line breaks in html output formatting for blockquote tag.
    // In same way you can correct any tag output formating
    
    ev.editor.dataProcessor.writer.setRules( 'blockquote',
    {
      indent : false,
      breakBeforeOpen : false,
      breakAfterOpen : false,
      breakBeforeClose : false,
      breakAfterClose : true
    });
    });

提交回复
热议问题