Reputation: 131
I try to use copy/paste functions in the TinyMCE editor, but I've noticed that paste function doesn't work. I removed all plugins and retested this with "clean" TinyMCE, but paste still haven't work.You can see it in this simple example: http://fiddle.tinymce.com/Wpfaab
Type the text
Click Edit-> Copy
Click Edit-> Paste
Nothing happens
How can I fix it?
Upvotes: 5
Views: 8553
Reputation: 1
You can create a custom button like so:
setup: (editor) => {
editor.ui.registry.addButton('customPasteButton', {
icon: 'paste',
onAction: (_) => navigator.clipboard.readText().then((text) => editor.insertContent(text))
});
}
Then add customPasteButton
to the toolbar.
When the button is first clicked, the browser will request access to your clipboard.
Upvotes: 0
Reputation: 670
One simple way to solve this is by removing the 'contextmenu' plugin.
Upvotes: 0
Reputation: 50832
Paste works, all you need to do is to add the paste plugin to your tinymce config:
tinymce.init({
selector: "textarea", // change this value according to your HTML
plugins: "paste",
menubar: "edit",
toolbar: "paste"
});
Upvotes: 1