@tarviks/lexical-rich-editor 1.3.13 → 1.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4575,6 +4575,44 @@ function RefApiPlugin({
|
|
|
4575
4575
|
);
|
|
4576
4576
|
return null;
|
|
4577
4577
|
}
|
|
4578
|
+
function RobustCutPlugin() {
|
|
4579
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
4580
|
+
React9.useEffect(() => {
|
|
4581
|
+
return editor.registerCommand(
|
|
4582
|
+
lexical.KEY_DOWN_COMMAND,
|
|
4583
|
+
(event) => {
|
|
4584
|
+
const isShiftDelete = event.key === "Delete" && event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey;
|
|
4585
|
+
if (!isShiftDelete) return false;
|
|
4586
|
+
let plainText = null;
|
|
4587
|
+
editor.getEditorState().read(() => {
|
|
4588
|
+
const selection = lexical.$getSelection();
|
|
4589
|
+
if (lexical.$isRangeSelection(selection) && !selection.isCollapsed()) {
|
|
4590
|
+
plainText = selection.getTextContent();
|
|
4591
|
+
} else if (lexical.$isNodeSelection(selection) && selection.getNodes().length > 0) {
|
|
4592
|
+
plainText = "";
|
|
4593
|
+
}
|
|
4594
|
+
});
|
|
4595
|
+
if (plainText === null) return false;
|
|
4596
|
+
event.preventDefault();
|
|
4597
|
+
editor.update(() => {
|
|
4598
|
+
const selection = lexical.$getSelection();
|
|
4599
|
+
if (lexical.$isRangeSelection(selection)) {
|
|
4600
|
+
selection.removeText();
|
|
4601
|
+
} else if (lexical.$isNodeSelection(selection)) {
|
|
4602
|
+
selection.getNodes().forEach((node) => node.remove());
|
|
4603
|
+
}
|
|
4604
|
+
});
|
|
4605
|
+
if (plainText && navigator.clipboard?.writeText) {
|
|
4606
|
+
navigator.clipboard.writeText(plainText).catch(() => {
|
|
4607
|
+
});
|
|
4608
|
+
}
|
|
4609
|
+
return true;
|
|
4610
|
+
},
|
|
4611
|
+
lexical.COMMAND_PRIORITY_HIGH
|
|
4612
|
+
);
|
|
4613
|
+
}, [editor]);
|
|
4614
|
+
return null;
|
|
4615
|
+
}
|
|
4578
4616
|
var CSS_ID = "__sc_styles__";
|
|
4579
4617
|
function injectCSS() {
|
|
4580
4618
|
if (document.getElementById(CSS_ID)) return;
|
|
@@ -8650,6 +8688,7 @@ var ContentEditorComponent = React9.forwardRef(
|
|
|
8650
8688
|
/* @__PURE__ */ jsxRuntime.jsx(LexicalAutoLinkPlugin.AutoLinkPlugin, { matchers: MATCHERS }),
|
|
8651
8689
|
/* @__PURE__ */ jsxRuntime.jsx(LexicalTablePlugin.TablePlugin, { hasCellMerge: true, hasCellBackgroundColor: true }),
|
|
8652
8690
|
!isReadOnly && /* @__PURE__ */ jsxRuntime.jsx(YoutubeDeletePlugin, {}),
|
|
8691
|
+
!isReadOnly && /* @__PURE__ */ jsxRuntime.jsx(RobustCutPlugin, {}),
|
|
8653
8692
|
!isReadOnly && floatingAnchorElem && /* @__PURE__ */ jsxRuntime.jsx(TableActionMenuPlugin, {}),
|
|
8654
8693
|
!isReadOnly && floatingAnchorElem && /* @__PURE__ */ jsxRuntime.jsx(TableCellResizerPlugin, { anchorElem: floatingAnchorElem }),
|
|
8655
8694
|
!isReadOnly && /* @__PURE__ */ jsxRuntime.jsx(
|