UNPKG

@opentiny/fluent-editor

Version:

A rich text editor based on Quill 2.0, which extends rich modules and formats on the basis of Quill. It's powerful and out-of-the-box.

35 lines (34 loc) 1.2 kB
var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); import Quill from "quill"; import { Action } from "./action.es.js"; class DeleteAction extends Action { constructor() { super(...arguments); __publicField(this, "onKeyUp", (event) => { if (!this.formatter.currentSpec) { return; } if (event.keyCode === 46 || event.keyCode === 8) { const blot = Quill.find(this.formatter.currentSpec.getTargetElement()); if (blot) { blot.deleteAt(0); } this.formatter.hide(); } }); } onCreate() { document.addEventListener("keyup", this.onKeyUp, true); this.formatter.quill.root.addEventListener("input", this.onKeyUp, true); } onDestroy() { document.removeEventListener("keyup", this.onKeyUp); this.formatter.quill.root.removeEventListener("input", this.onKeyUp); } } export { DeleteAction }; //# sourceMappingURL=delete-action.es.js.map