@mhamz.01/easyflow-texteditor 0.1.31 → 0.1.33
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.css +5078 -22
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +40 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
package/dist/index.mjs
CHANGED
|
@@ -937,37 +937,9 @@ function useEditorBridge() {
|
|
|
937
937
|
return ctx;
|
|
938
938
|
}
|
|
939
939
|
|
|
940
|
-
// src/lib/editorStorage.ts
|
|
941
|
-
var STORAGE_KEY = "tiptap-tabs-v1";
|
|
942
|
-
var ACTIVE_TAB_KEY = "tiptap-active-tab";
|
|
943
|
-
function loadTabs() {
|
|
944
|
-
if (typeof window === "undefined") return [];
|
|
945
|
-
try {
|
|
946
|
-
const raw = localStorage.getItem("tiptap-tabs-v1");
|
|
947
|
-
if (!raw) return [];
|
|
948
|
-
const parsed = JSON.parse(raw);
|
|
949
|
-
if (!Array.isArray(parsed)) return [];
|
|
950
|
-
return parsed;
|
|
951
|
-
} catch {
|
|
952
|
-
return [];
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
function saveTabs(tabs) {
|
|
956
|
-
if (typeof window === "undefined") return;
|
|
957
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(tabs));
|
|
958
|
-
}
|
|
959
|
-
function loadActiveTab() {
|
|
960
|
-
if (typeof window === "undefined") return "1";
|
|
961
|
-
return localStorage.getItem(ACTIVE_TAB_KEY) ?? "1";
|
|
962
|
-
}
|
|
963
|
-
function saveActiveTab(id) {
|
|
964
|
-
if (typeof window === "undefined") return;
|
|
965
|
-
localStorage.setItem(ACTIVE_TAB_KEY, id);
|
|
966
|
-
}
|
|
967
|
-
|
|
968
940
|
// src/components/editorLayout/editorLayout.tsx
|
|
969
941
|
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
970
|
-
function EditorLayout({ children, onChange }) {
|
|
942
|
+
function EditorLayout({ children, onChange, initialTabs, onTabsChange }) {
|
|
971
943
|
const [editor, setEditor] = useState4(null);
|
|
972
944
|
const [tabs, setTabs] = useState4([]);
|
|
973
945
|
const [activeTabId, setActiveTabId] = useState4("");
|
|
@@ -1001,18 +973,17 @@ function EditorLayout({ children, onChange }) {
|
|
|
1001
973
|
[emitChangeDebounced, tabs, activeTabId, activeSubTabId]
|
|
1002
974
|
);
|
|
1003
975
|
useEffect2(() => {
|
|
1004
|
-
|
|
1005
|
-
if (initialTabs.length === 0) {
|
|
976
|
+
if (initialTabs?.length === 0) {
|
|
1006
977
|
setTabs([{ id: "1", title: "Tab 1", content: null, subtabs: [] }]);
|
|
1007
978
|
setActiveTabId("1");
|
|
1008
979
|
} else {
|
|
1009
|
-
setTabs(initialTabs);
|
|
1010
|
-
setActiveTabId(initialTabs[0]
|
|
980
|
+
setTabs(initialTabs ?? []);
|
|
981
|
+
setActiveTabId(initialTabs?.[0]?.id ?? "");
|
|
1011
982
|
}
|
|
1012
|
-
}, []);
|
|
983
|
+
}, [initialTabs]);
|
|
1013
984
|
useEffect2(() => {
|
|
1014
|
-
|
|
1015
|
-
}, [tabs]);
|
|
985
|
+
onTabsChange?.(tabs);
|
|
986
|
+
}, [tabs, onTabsChange]);
|
|
1016
987
|
const saveCurrentContent = useCallback2(() => {
|
|
1017
988
|
if (!editor) return tabs;
|
|
1018
989
|
const json = editor.getJSON();
|
|
@@ -1257,7 +1228,7 @@ import { Superscript } from "@tiptap/extension-superscript";
|
|
|
1257
1228
|
import { Gapcursor, Selection as Selection2 } from "@tiptap/extensions";
|
|
1258
1229
|
import { TextStyleKit } from "@tiptap/extension-text-style";
|
|
1259
1230
|
|
|
1260
|
-
//
|
|
1231
|
+
// node_modules/@tiptap/extension-document/dist/index.js
|
|
1261
1232
|
import { Node } from "@tiptap/core";
|
|
1262
1233
|
var Document = Node.create({
|
|
1263
1234
|
name: "doc",
|
|
@@ -1272,7 +1243,7 @@ var Document = Node.create({
|
|
|
1272
1243
|
});
|
|
1273
1244
|
var index_default = Document;
|
|
1274
1245
|
|
|
1275
|
-
//
|
|
1246
|
+
// node_modules/@tiptap/extension-paragraph/dist/index.js
|
|
1276
1247
|
import { mergeAttributes, Node as Node2 } from "@tiptap/core";
|
|
1277
1248
|
var Paragraph = Node2.create({
|
|
1278
1249
|
name: "paragraph",
|
|
@@ -1323,7 +1294,7 @@ var Paragraph = Node2.create({
|
|
|
1323
1294
|
});
|
|
1324
1295
|
var index_default2 = Paragraph;
|
|
1325
1296
|
|
|
1326
|
-
//
|
|
1297
|
+
// node_modules/@tiptap/extension-text/dist/index.js
|
|
1327
1298
|
import { Node as Node3 } from "@tiptap/core";
|
|
1328
1299
|
var Text = Node3.create({
|
|
1329
1300
|
name: "text",
|
|
@@ -7756,8 +7727,8 @@ function SimpleEditor() {
|
|
|
7756
7727
|
|
|
7757
7728
|
// src/components/editor/editor.tsx
|
|
7758
7729
|
import { jsx as jsx77 } from "react/jsx-runtime";
|
|
7759
|
-
function Editor({ onChange, className, style }) {
|
|
7760
|
-
return /* @__PURE__ */ jsx77("div", { className, style, children: /* @__PURE__ */ jsx77(EditorShell, { children: /* @__PURE__ */ jsx77(EditorLayout, { onChange, children: /* @__PURE__ */ jsx77(SimpleEditor, {}) }) }) });
|
|
7730
|
+
function Editor({ onChange, className, style, onTabsChange }) {
|
|
7731
|
+
return /* @__PURE__ */ jsx77("div", { className, style, children: /* @__PURE__ */ jsx77(EditorShell, { children: /* @__PURE__ */ jsx77(EditorLayout, { onChange, onTabsChange, children: /* @__PURE__ */ jsx77(SimpleEditor, {}) }) }) });
|
|
7761
7732
|
}
|
|
7762
7733
|
|
|
7763
7734
|
// src/hooks/use-scrolling.ts
|
|
@@ -7795,6 +7766,34 @@ function useScrolling(target, options = {}) {
|
|
|
7795
7766
|
return isScrolling;
|
|
7796
7767
|
}
|
|
7797
7768
|
|
|
7769
|
+
// src/lib/editorStorage.ts
|
|
7770
|
+
var STORAGE_KEY = "tiptap-tabs-v1";
|
|
7771
|
+
var ACTIVE_TAB_KEY = "tiptap-active-tab";
|
|
7772
|
+
function loadTabs() {
|
|
7773
|
+
if (typeof window === "undefined") return [];
|
|
7774
|
+
try {
|
|
7775
|
+
const raw = localStorage.getItem("tiptap-tabs-v1");
|
|
7776
|
+
if (!raw) return [];
|
|
7777
|
+
const parsed = JSON.parse(raw);
|
|
7778
|
+
if (!Array.isArray(parsed)) return [];
|
|
7779
|
+
return parsed;
|
|
7780
|
+
} catch {
|
|
7781
|
+
return [];
|
|
7782
|
+
}
|
|
7783
|
+
}
|
|
7784
|
+
function saveTabs(tabs) {
|
|
7785
|
+
if (typeof window === "undefined") return;
|
|
7786
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(tabs));
|
|
7787
|
+
}
|
|
7788
|
+
function loadActiveTab() {
|
|
7789
|
+
if (typeof window === "undefined") return "1";
|
|
7790
|
+
return localStorage.getItem(ACTIVE_TAB_KEY) ?? "1";
|
|
7791
|
+
}
|
|
7792
|
+
function saveActiveTab(id) {
|
|
7793
|
+
if (typeof window === "undefined") return;
|
|
7794
|
+
localStorage.setItem(ACTIVE_TAB_KEY, id);
|
|
7795
|
+
}
|
|
7796
|
+
|
|
7798
7797
|
// src/lib/local-image.ts
|
|
7799
7798
|
function fileToBase64(file) {
|
|
7800
7799
|
return new Promise((resolve, reject) => {
|