@firecms/editor 3.0.0-beta.11 → 3.0.0-beta.13
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/editor.d.ts +2 -2
- package/dist/extensions/slashCommand.d.ts +1 -2
- package/dist/index.es.js +9 -14
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +9 -14
- package/dist/index.umd.js.map +1 -1
- package/package.json +40 -39
package/dist/index.umd.js
CHANGED
|
@@ -1354,25 +1354,15 @@
|
|
|
1354
1354
|
});
|
|
1355
1355
|
const suggestion = (ref, {
|
|
1356
1356
|
upload,
|
|
1357
|
-
onDisabledAutocompleteClick,
|
|
1358
1357
|
aiController
|
|
1359
1358
|
}) => ({
|
|
1360
1359
|
items: ({
|
|
1361
1360
|
query
|
|
1362
1361
|
}) => {
|
|
1363
1362
|
const availableSuggestionItems = [...suggestionItems];
|
|
1364
|
-
if (
|
|
1363
|
+
if (aiController) {
|
|
1365
1364
|
availableSuggestionItems.push(autocompleteSuggestionItem);
|
|
1366
1365
|
}
|
|
1367
|
-
if (onDisabledAutocompleteClick) {
|
|
1368
|
-
availableSuggestionItems.push({
|
|
1369
|
-
title: "Autocomplete",
|
|
1370
|
-
description: "Add text based on the context.",
|
|
1371
|
-
searchTerms: ["ai"],
|
|
1372
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(ui.AutoFixHighIcon, { size: 18 }),
|
|
1373
|
-
command: onDisabledAutocompleteClick
|
|
1374
|
-
});
|
|
1375
|
-
}
|
|
1376
1366
|
return availableSuggestionItems.filter((item) => {
|
|
1377
1367
|
const inTitle = item.title.toLowerCase().startsWith(query.toLowerCase());
|
|
1378
1368
|
if (inTitle) return inTitle;
|
|
@@ -1607,6 +1597,7 @@
|
|
|
1607
1597
|
}
|
|
1608
1598
|
return t12;
|
|
1609
1599
|
});
|
|
1600
|
+
CommandList.displayName = "CommandList";
|
|
1610
1601
|
const autocompleteSuggestionItem = {
|
|
1611
1602
|
title: "Autocomplete",
|
|
1612
1603
|
description: "Add text based on the context.",
|
|
@@ -1803,7 +1794,7 @@
|
|
|
1803
1794
|
highlight,
|
|
1804
1795
|
handleImageUpload,
|
|
1805
1796
|
aiController,
|
|
1806
|
-
|
|
1797
|
+
disabled
|
|
1807
1798
|
}) => {
|
|
1808
1799
|
const ref = React.useRef(null);
|
|
1809
1800
|
const editorRef = React.useRef(null);
|
|
@@ -1819,6 +1810,9 @@
|
|
|
1819
1810
|
editorRef.current?.commands.setContent(content ?? "");
|
|
1820
1811
|
}
|
|
1821
1812
|
}, [version]);
|
|
1813
|
+
React.useEffect(() => {
|
|
1814
|
+
editorRef?.current?.setEditable(!disabled);
|
|
1815
|
+
}, [disabled]);
|
|
1822
1816
|
React.useEffect(() => {
|
|
1823
1817
|
if (version === void 0) return;
|
|
1824
1818
|
if (editorRef.current && version > 0) {
|
|
@@ -1887,12 +1881,12 @@
|
|
|
1887
1881
|
},
|
|
1888
1882
|
suggestion: suggestion(ref, {
|
|
1889
1883
|
upload: handleImageUpload,
|
|
1890
|
-
aiController
|
|
1891
|
-
onDisabledAutocompleteClick
|
|
1884
|
+
aiController
|
|
1892
1885
|
})
|
|
1893
1886
|
})
|
|
1894
1887
|
], []);
|
|
1895
1888
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: "relative min-h-[300px] w-full", children: /* @__PURE__ */ jsxRuntime.jsx(react.EditorProvider, { content: content ?? "", extensions, editorProps: {
|
|
1889
|
+
editable: () => !disabled,
|
|
1896
1890
|
attributes: {
|
|
1897
1891
|
class: ui.cls(proseClass, "prose-headings:font-title font-default focus:outline-none max-w-full p-12")
|
|
1898
1892
|
}
|
|
@@ -1900,6 +1894,7 @@
|
|
|
1900
1894
|
editor: editor_0
|
|
1901
1895
|
}) => {
|
|
1902
1896
|
editorRef.current = editor_0;
|
|
1897
|
+
editor_0.setEditable(!disabled);
|
|
1903
1898
|
}, onUpdate: ({
|
|
1904
1899
|
editor: editor_1
|
|
1905
1900
|
}) => {
|