Dmitry P.
Dmitry P.

Reputation: 131

TinyMCE paste function doesn't work

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

  1. Type the text

  2. Click Edit-> Copy

  3. Click Edit-> Paste

  4. Nothing happens

How can I fix it?

Upvotes: 5

Views: 8553

Answers (3)

code_estintz
code_estintz

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

Saiful Islam
Saiful Islam

Reputation: 670

One simple way to solve this is by removing the 'contextmenu' plugin.

Upvotes: 0

Thariama
Thariama

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

Related Questions