@mhamz.01/easyflow-texteditor 0.1.158 → 0.1.159
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 +24 -24
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -18,7 +18,7 @@ interface EditorTab$1 {
|
|
|
18
18
|
subtabs: EditorSubTab$1[];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
type EditorChangeSource = "editor" | "tab-switch" | "subtab-switch" | "add-tab" | "add-subtab" | "delete-tab" | "delete-subtab" | "restore" | "storage" | "manual";
|
|
21
|
+
type EditorChangeSource = "editor" | "tab-switch" | "subtab-switch" | "add-tab" | "add-subtab" | "delete-tab" | "delete-subtab" | "restore" | "storage" | "manual" | "rename-tab" | "rename-subtab";
|
|
22
22
|
interface EditorChangePayload {
|
|
23
23
|
tabs: EditorTab$1[];
|
|
24
24
|
activeTabId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ interface EditorTab$1 {
|
|
|
18
18
|
subtabs: EditorSubTab$1[];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
type EditorChangeSource = "editor" | "tab-switch" | "subtab-switch" | "add-tab" | "add-subtab" | "delete-tab" | "delete-subtab" | "restore" | "storage" | "manual";
|
|
21
|
+
type EditorChangeSource = "editor" | "tab-switch" | "subtab-switch" | "add-tab" | "add-subtab" | "delete-tab" | "delete-subtab" | "restore" | "storage" | "manual" | "rename-tab" | "rename-subtab";
|
|
22
22
|
interface EditorChangePayload {
|
|
23
23
|
tabs: EditorTab$1[];
|
|
24
24
|
activeTabId: string;
|
package/dist/index.js
CHANGED
|
@@ -1235,9 +1235,13 @@ function EditorLayout({ children, onChange, initialTabs, onTabsChange }) {
|
|
|
1235
1235
|
);
|
|
1236
1236
|
const renameTab = (0, import_react9.useCallback)(
|
|
1237
1237
|
(id, title) => {
|
|
1238
|
-
setTabs((prev) =>
|
|
1238
|
+
setTabs((prev) => {
|
|
1239
|
+
const updated = prev.map((t) => t.id === id ? { ...t, title } : t);
|
|
1240
|
+
emitChangeDebounced({ tabs: updated, activeTabId, activeSubTabId, source: "rename-tab" });
|
|
1241
|
+
return updated;
|
|
1242
|
+
});
|
|
1239
1243
|
},
|
|
1240
|
-
[]
|
|
1244
|
+
[emitChangeDebounced, activeTabId, activeSubTabId]
|
|
1241
1245
|
);
|
|
1242
1246
|
const deleteTab = (0, import_react9.useCallback)(
|
|
1243
1247
|
(id) => {
|
|
@@ -1281,18 +1285,15 @@ function EditorLayout({ children, onChange, initialTabs, onTabsChange }) {
|
|
|
1281
1285
|
);
|
|
1282
1286
|
const renameSubTab = (0, import_react9.useCallback)(
|
|
1283
1287
|
(tabId, subTabId, title) => {
|
|
1284
|
-
setTabs(
|
|
1285
|
-
|
|
1286
|
-
(tab) => tab.id === tabId ? {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
} : tab
|
|
1292
|
-
)
|
|
1293
|
-
);
|
|
1288
|
+
setTabs((prev) => {
|
|
1289
|
+
const updated = prev.map(
|
|
1290
|
+
(tab) => tab.id === tabId ? { ...tab, subtabs: tab.subtabs.map((st) => st.id === subTabId ? { ...st, title } : st) } : tab
|
|
1291
|
+
);
|
|
1292
|
+
emitChangeDebounced({ tabs: updated, activeTabId, activeSubTabId, source: "rename-subtab" });
|
|
1293
|
+
return updated;
|
|
1294
|
+
});
|
|
1294
1295
|
},
|
|
1295
|
-
[]
|
|
1296
|
+
[emitChangeDebounced, activeTabId, activeSubTabId]
|
|
1296
1297
|
);
|
|
1297
1298
|
const editorActions = (0, import_react9.useMemo)(
|
|
1298
1299
|
() => ({
|
|
@@ -1865,7 +1866,7 @@ var FONT_SIZES = [
|
|
|
1865
1866
|
"64px"
|
|
1866
1867
|
];
|
|
1867
1868
|
var FontSizeExtension = import_core4.Extension.create({
|
|
1868
|
-
name: "
|
|
1869
|
+
name: "customFontSize",
|
|
1869
1870
|
addOptions() {
|
|
1870
1871
|
return {
|
|
1871
1872
|
types: ["textStyle"]
|
|
@@ -1900,15 +1901,15 @@ var FontSizeExtension = import_core4.Extension.create({
|
|
|
1900
1901
|
increaseFontSize: () => ({ editor }) => {
|
|
1901
1902
|
const currentSize = editor.getAttributes("textStyle").fontSize;
|
|
1902
1903
|
const currentIndex = FONT_SIZES.indexOf(currentSize || "16px");
|
|
1903
|
-
const
|
|
1904
|
-
const nextSize = FONT_SIZES[
|
|
1904
|
+
const fromIndex = currentIndex === -1 ? FONT_SIZES.indexOf("16px") : currentIndex;
|
|
1905
|
+
const nextSize = FONT_SIZES[Math.min(fromIndex + 1, FONT_SIZES.length - 1)];
|
|
1905
1906
|
return editor.chain().focus().setFontSize(nextSize).run();
|
|
1906
1907
|
},
|
|
1907
1908
|
decreaseFontSize: () => ({ editor }) => {
|
|
1908
1909
|
const currentSize = editor.getAttributes("textStyle").fontSize;
|
|
1909
1910
|
const currentIndex = FONT_SIZES.indexOf(currentSize || "16px");
|
|
1910
|
-
const
|
|
1911
|
-
const nextSize = FONT_SIZES[
|
|
1911
|
+
const fromIndex = currentIndex === -1 ? FONT_SIZES.indexOf("16px") : currentIndex;
|
|
1912
|
+
const nextSize = FONT_SIZES[Math.max(fromIndex - 1, 0)];
|
|
1912
1913
|
return editor.chain().focus().setFontSize(nextSize).run();
|
|
1913
1914
|
}
|
|
1914
1915
|
};
|