UNPKG

rhino-editor

Version:

A custom element wrapped rich text editor

36 lines (33 loc) 800 B
import { RhinoPasteEvent } from "./chunk-O52HHPNC.js"; import { Plugin, PluginKey } from "./chunk-XG3W5CFT.js"; // src/exports/extensions/paste.ts function Paste() { const handledEvents = /* @__PURE__ */ new WeakMap(); return new Plugin({ key: new PluginKey("rhino-paste-event"), props: { handlePaste(view, event) { const { clipboardData } = event; if (handledEvents.has(event)) { return false; } handledEvents.set(event, null); if (event.defaultPrevented) { return false; } const rhinoPasteEvent = new RhinoPasteEvent(clipboardData, event); view.dom.dispatchEvent(rhinoPasteEvent); return false; } } }); } export { Paste }; //# sourceMappingURL=chunk-JBOGFHYG.js.map