@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.
32 lines (31 loc) • 1.01 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Quill = require("quill");
const Action = require("./Action.cjs.js");
class DeleteAction extends Action.default {
constructor() {
super(...arguments);
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);
}
}
exports.default = DeleteAction;
//# sourceMappingURL=DeleteAction.cjs.js.map