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

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)
Use insertHTML instead of insertText
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 ?
insertHTML is the native way to insert HTML strings but probably each browser implements its own set of rules.
Instead, check this https://stackoverflow.com/questions/25941559/is-there-a-way-to-keep-execcommandinserthtml-from-removing-attributes-in-chr/25943182#25943182
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1162
[Question]: Editable components in Handlebars rendered template
Hi, I've been using grapes for about a couple of days now. Thanks for the awesome work on this project. I've read through the API docs (hop...
Issue #1756
Drag and Drop not working in resized editor window in Google Chrome
Hi, I developed some components and all works fine in Firefox, Opera browser. In Google chrome also working fine in fullscreen editor mode...
Issue #1296
Custom Rich Text Editor is not working
Hi @artf, I've just created a custom plugin of the RTE using different libraries like CKEditor 5, TinyMCE 4 or pell but all of them with th...
Issue #1022
[BUG] Drag and drop blocks are not working in IE Browser
Hi, There is some bug related to "Drag and drop blocks are not working in IE Browser ", I didn't get better solution regarding this issue....
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.