locked
CKEDITOR 4.x past content without formating RRS feed

  • Question

  • User1487175000 posted

    HI,

    I am using CKEditor 4.5.4 (revision d4677a3) in my project. I want to configure whenever user try to past any text in the editor, text should not include the formating.

    I want user always past text without formating. I cant control the user action but i believe there should be option of ceditor to past without formating.

    Here is my current configuration.

    CKEDITOR.editorConfig = function (config) {
    // Define changes to default configuration here. For example:
    // config.uiColor = '#AADC6E';
    config.language = 'sv';
    config.skin = 'office2013';
    config.toolbar = [
        { name: 'document', items: ['Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates'] },
        { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
        { name: 'editing', items: ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt'] },
        { name: 'forms', items: ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'] },
        '/',
        { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat'] },
        { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language'] },
        { name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
        { name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe'] },
        '/',
        { name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
        { name: 'colors', items: ['TextColor', 'BGColor'] },
        { name: 'tools', items: ['Maximize', 'ShowBlocks'] },
        { name: 'about', items: ['About'] }
    ];
    config.removeButtons = 'Strike,Styles,Save,NewPage,Print';
    config.removePlugins = 'elementspath';
    
    config.font_defaultLabel = 'Georgia';
    config.fontSize_defaultLabel = '11px';
    
    config.allowedContent = true;
    config.enterMode = CKEDITOR.ENTER_BR;
    };

    Thanks

    Monday, August 19, 2019 12:11 PM

Answers

  • User665608656 posted

    Hi Shahid,

    According to your description, I found an example to achieve your function.

    You can refer to this link : Removing Text Formatting

    You can use 4.12.1 version with setting forcePasteAsPlainText to true, and here is the result:

    Best Regards,

    YongQing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 20, 2019 6:48 AM

All replies

  • User665608656 posted

    Hi Shahid,

    According to your description, I found an example to achieve your function.

    You can refer to this link : Removing Text Formatting

    You can use 4.12.1 version with setting forcePasteAsPlainText to true, and here is the result:

    Best Regards,

    YongQing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 20, 2019 6:48 AM
  • User1487175000 posted

    Hi,

    I will try to update my CKEDITOR with plugin let see if i achive what i want. Thanks

    Thursday, August 22, 2019 7:43 PM
  • User1487175000 posted

    Upgrade and forcePasteAsPlainText property work locally at least for me. 

    Friday, August 23, 2019 1:33 PM
  • User1487175000 posted

    HI,

    I tried downloaded Emoji plugin for my new editor and extract into the plugin directory. But editor toolbar is not showing Emoji button/dropdown list.

    I am configuring editor in config.js I notice if i commented out toolbar configuration then Emoji dropdown list appear if i have toolbar configuration then Emoji button disappear.

    Here is my config.js 

    CKEDITOR.editorConfig = function( config ) {
        // Define changes to default configuration here. For example:
        // config.uiColor = '#AADC6E';
        config.skin = 'office2013';
        config.toolbar = [
    		{ name: 'document', items: ['Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates'] },
    		{ name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
    		{ name: 'editing', items: ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt'] },
    		{ name: 'forms', items: ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'] },
    		'/',
    		{ name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat'] },
    		{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language'] },
    		{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
    		{ name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar', 'PageBreak', 'Iframe', 'Emoji', 'Smiley'] },
    		'/',
    		{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
    		{ name: 'colors', items: ['TextColor', 'BGColor'] },
    		{ name: 'tools', items: ['Maximize', 'ShowBlocks'] },
    		{ name: 'about', items: ['About'] }
        ];
        config.removeButtons = 'Strike,Styles,Save,NewPage,Print';
        config.removePlugins = 'elementspath';
    	config.extraPlugins = 'emoji,autocomplete,textwatcher,textmatch,ajax,xml,panelbutton,button,floatpanel,panel';
    	
        config.font_defaultLabel = 'Georgia';
        config.fontSize_defaultLabel = '11px';
        config.forcePasteAsPlainText = true;
    
        config.allowedContent = true;
        config.enterMode = CKEDITOR.ENTER_BR;
    };

    Friday, August 23, 2019 9:28 PM