Issue #1605Opened November 26, 2018by rajeshmaropost0 reactions

Can we implement Paste as Rich text editor options in Rte?

Question

hi @artf I've gone through this Drag and Drop Editor and what an amazing work. I also read your docs and I tried to extend rich text editor but i m stuck b/w some thing.

As you can see screen shot below i've added different options for Rich text Editor
screen shot 2018-11-26 at 12 34 27 pm 1

I implemented "paste as plain text" i want to another option for paste as rich text editor (formatted text with all styling and stuff" So is it possible to do that Like here the code of mine paste option

rte.add('insertText', {
      name: 'insertText',
      icon: '<i class="fa fa-paste"></i>',
      content: '',
      attributes: {title: 'PasteAsPlainText', "data-tooltip": 'PasteAsPlainText'},
      result: rte => {
        rte.exec('insertText',  prompt(common))
      }
    });

Here i take a common variable with "" this and in cut option i write common = rte.selection().toString(); rte.exec('cut')} because default paste option of Rich text editor is not compatible with chrome browser

Can You please help me to add option for"Paste as rich text editor" and in the ckeditor there is an already an option for that but i want to implement in the rich text editor

Thanks.

Answers (3)

artfNovember 30, 20180 reactions

Use insertHTML instead of insertText

rajeshmaropostDecember 3, 20180 reactions

hi @artf Here is my code. rte.add('insertHTML', { name: 'insertHTML', icon: '<i class="fa fa-paste"></i>', attributes: {title: 'PasteAsPlainText', "data-tooltip": 'PasteAsPlainText'}, result: rte => { rte.exec('insertHTML', prompt("Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.Please paste inside the following box using the keyboard (Ctrl/Cmd+V) and hit OK")) } });

It doesn't work for me like when i paste from word with some styling or heading it doesn't comes with same styling still paste as plain text.Please tell me is there something i missed ?

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.