Sha256: 46ab2f61d97cc1942df043bb21d56970b38c30c0718ccda57ff804b8fbf82031
Contents?: true
Size: 773 Bytes
Versions: 5
Compression:
Stored size: 773 Bytes
Contents
import lists from '../core/lists'; export default class Clipboard { constructor(context) { this.context = context; this.$editable = context.layoutInfo.editable; } initialize() { this.$editable.on('paste', this.pasteByEvent.bind(this)); } /** * paste by clipboard event * * @param {Event} event */ pasteByEvent(event) { const clipboardData = event.originalEvent.clipboardData; if (clipboardData && clipboardData.items && clipboardData.items.length) { const item = lists.head(clipboardData.items); if (item.kind === 'file' && item.type.indexOf('image/') !== -1) { this.context.invoke('editor.insertImagesOrCallback', [item.getAsFile()]); } this.context.invoke('editor.afterCommand'); } } }
Version data entries
5 entries across 5 versions & 1 rubygems