Tui.editor: Catch paste event on image

Created on 7 Jun 2019  路  5Comments  路  Source: nhn/tui.editor

Hi,

The paste event of an image is stopped by _processBlobItems. (tui-editor-Editor.js 2239)

What is the correct way to catch this event and handle the data ?

Question inactive

Most helpful comment

I think it's following use case:
The user has image data in his clipboard and simply wants to insert an image in editor by pressing ctrl+v without using buttons of editor. This would result in a huge usability improvement.

All 5 comments

What I've done so far is inserting my custom listener at the first position in the eventManager.
Something like that:


var pasteListener = (event) => {
  var cbData = event.data.clipboardData;
  var types = cbData && cbData.types;

  if (types.includes("Files")) {
    event.preventDefault();
    event.stopPropagation();
   }
  };

tuiEditor.eventManager.events.set('paste', [pasteListener, ...tuiEditor.eventManager.events.get('paste')]);

In case pasting image, we need to emit addImageBlobHook hook and load image using FileReader.
Why you need paste event for image? If you give me for more detail information, I will check it.

I think it's following use case:
The user has image data in his clipboard and simply wants to insert an image in editor by pressing ctrl+v without using buttons of editor. This would result in a huge usability improvement.

This issue has been automatically marked as inactive because there hasn鈥檛 been much going on it lately. It is going to be closed after 7 days. Thanks!

This issue will be closed due to inactivity. Thanks for your contribution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gilles-GitHub picture Gilles-GitHub  路  4Comments

Rorke76753 picture Rorke76753  路  4Comments

dioscuroi picture dioscuroi  路  3Comments

aarangara picture aarangara  路  3Comments

hrvoj3e picture hrvoj3e  路  3Comments