@yurikilian/lex4 1.5.4 → 1.5.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lex4Editor.d.ts","sourceRoot":"","sources":["../../src/components/Lex4Editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0E,MAAM,OAAO,CAAC;AAC/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAkB/D,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Lex4Editor.d.ts","sourceRoot":"","sources":["../../src/components/Lex4Editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0E,MAAM,OAAO,CAAC;AAC/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAkB/D,OAAO,eAAe,CAAC;AAoWvB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,0FA+BrB,CAAC"}
|
package/dist/lex4-editor.cjs
CHANGED
|
@@ -5704,39 +5704,46 @@ const EditorWithHandle = React.forwardRef(({ captureHistoryShortcutsOnWindow, on
|
|
|
5704
5704
|
const getDocument = React.useCallback(() => documentRef.current, []);
|
|
5705
5705
|
const getActiveEditor = React.useCallback(() => activeEditorRef.current, []);
|
|
5706
5706
|
const extensionCtx = useExtensionContext(getDocument, getActiveEditor);
|
|
5707
|
-
React.
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5707
|
+
const handleRef = React.useRef({});
|
|
5708
|
+
const extensionMethodKeysRef = React.useRef([]);
|
|
5709
|
+
const handle = handleRef.current;
|
|
5710
|
+
handle.setHistorySidebarOpen = (open) => {
|
|
5711
|
+
setHistorySidebarOpen(open);
|
|
5712
|
+
};
|
|
5713
|
+
handle.toggleHistorySidebar = () => {
|
|
5714
|
+
setHistorySidebarOpen(!historySidebarOpenRef.current);
|
|
5715
|
+
};
|
|
5716
|
+
handle.insertDocumentContent = (documentToInsert) => {
|
|
5717
|
+
const currentActiveEditor = activeEditorRef.current;
|
|
5718
|
+
if (!currentActiveEditor || activeCaretRegionRef.current !== "body") {
|
|
5719
|
+
return false;
|
|
5720
|
+
}
|
|
5721
|
+
let inserted = false;
|
|
5722
|
+
runHistoryActionRef.current(
|
|
5723
|
+
{
|
|
5724
|
+
label: insertedDocumentContentLabelRef.current,
|
|
5725
|
+
source: "toolbar",
|
|
5726
|
+
region: "document"
|
|
5714
5727
|
},
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
if (!currentActiveEditor || activeCaretRegionRef.current !== "body") {
|
|
5718
|
-
return false;
|
|
5719
|
-
}
|
|
5720
|
-
let inserted = false;
|
|
5721
|
-
runHistoryActionRef.current(
|
|
5722
|
-
{
|
|
5723
|
-
label: insertedDocumentContentLabelRef.current,
|
|
5724
|
-
source: "toolbar",
|
|
5725
|
-
region: "document"
|
|
5726
|
-
},
|
|
5727
|
-
() => {
|
|
5728
|
-
inserted = insertDocumentContent(currentActiveEditor, documentToInsert);
|
|
5729
|
-
}
|
|
5730
|
-
);
|
|
5731
|
-
return inserted;
|
|
5728
|
+
() => {
|
|
5729
|
+
inserted = insertDocumentContent(currentActiveEditor, documentToInsert);
|
|
5732
5730
|
}
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5731
|
+
);
|
|
5732
|
+
return inserted;
|
|
5733
|
+
};
|
|
5734
|
+
for (const key of extensionMethodKeysRef.current) {
|
|
5735
|
+
delete handle[key];
|
|
5736
|
+
}
|
|
5737
|
+
const extensionMethodKeys = [];
|
|
5738
|
+
for (const factory of handleFactories) {
|
|
5739
|
+
const methods = factory(extensionCtx);
|
|
5740
|
+
for (const [key, method] of Object.entries(methods)) {
|
|
5741
|
+
handle[key] = method;
|
|
5742
|
+
extensionMethodKeys.push(key);
|
|
5737
5743
|
}
|
|
5738
|
-
|
|
5739
|
-
|
|
5744
|
+
}
|
|
5745
|
+
extensionMethodKeysRef.current = extensionMethodKeys;
|
|
5746
|
+
React.useImperativeHandle(ref, () => handle, []);
|
|
5740
5747
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5741
5748
|
EditorChrome,
|
|
5742
5749
|
{
|