rhino-editor
Version:
A custom element wrapped rich text editor
33 lines (30 loc) • 793 B
JavaScript
import {
RhinoPasteEvent
} from "./chunk-OCUMPVMV.js";
// src/exports/extensions/paste.ts
import { Plugin, PluginKey } from "@tiptap/pm/state";
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-M5MRCAAY.js.map