@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.mjs
CHANGED
|
@@ -1173,9 +1173,13 @@ function EditorLayout({ children, onChange, initialTabs, onTabsChange }) {
|
|
|
1173
1173
|
);
|
|
1174
1174
|
const renameTab = useCallback5(
|
|
1175
1175
|
(id, title) => {
|
|
1176
|
-
setTabs((prev) =>
|
|
1176
|
+
setTabs((prev) => {
|
|
1177
|
+
const updated = prev.map((t) => t.id === id ? { ...t, title } : t);
|
|
1178
|
+
emitChangeDebounced({ tabs: updated, activeTabId, activeSubTabId, source: "rename-tab" });
|
|
1179
|
+
return updated;
|
|
1180
|
+
});
|
|
1177
1181
|
},
|
|
1178
|
-
[]
|
|
1182
|
+
[emitChangeDebounced, activeTabId, activeSubTabId]
|
|
1179
1183
|
);
|
|
1180
1184
|
const deleteTab = useCallback5(
|
|
1181
1185
|
(id) => {
|
|
@@ -1219,18 +1223,15 @@ function EditorLayout({ children, onChange, initialTabs, onTabsChange }) {
|
|
|
1219
1223
|
);
|
|
1220
1224
|
const renameSubTab = useCallback5(
|
|
1221
1225
|
(tabId, subTabId, title) => {
|
|
1222
|
-
setTabs(
|
|
1223
|
-
|
|
1224
|
-
(tab) => tab.id === tabId ? {
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
} : tab
|
|
1230
|
-
)
|
|
1231
|
-
);
|
|
1226
|
+
setTabs((prev) => {
|
|
1227
|
+
const updated = prev.map(
|
|
1228
|
+
(tab) => tab.id === tabId ? { ...tab, subtabs: tab.subtabs.map((st) => st.id === subTabId ? { ...st, title } : st) } : tab
|
|
1229
|
+
);
|
|
1230
|
+
emitChangeDebounced({ tabs: updated, activeTabId, activeSubTabId, source: "rename-subtab" });
|
|
1231
|
+
return updated;
|
|
1232
|
+
});
|
|
1232
1233
|
},
|
|
1233
|
-
[]
|
|
1234
|
+
[emitChangeDebounced, activeTabId, activeSubTabId]
|
|
1234
1235
|
);
|
|
1235
1236
|
const editorActions = useMemo2(
|
|
1236
1237
|
() => ({
|
|
@@ -1831,7 +1832,7 @@ var FONT_SIZES = [
|
|
|
1831
1832
|
"64px"
|
|
1832
1833
|
];
|
|
1833
1834
|
var FontSizeExtension = Extension2.create({
|
|
1834
|
-
name: "
|
|
1835
|
+
name: "customFontSize",
|
|
1835
1836
|
addOptions() {
|
|
1836
1837
|
return {
|
|
1837
1838
|
types: ["textStyle"]
|
|
@@ -1866,15 +1867,15 @@ var FontSizeExtension = Extension2.create({
|
|
|
1866
1867
|
increaseFontSize: () => ({ editor }) => {
|
|
1867
1868
|
const currentSize = editor.getAttributes("textStyle").fontSize;
|
|
1868
1869
|
const currentIndex = FONT_SIZES.indexOf(currentSize || "16px");
|
|
1869
|
-
const
|
|
1870
|
-
const nextSize = FONT_SIZES[
|
|
1870
|
+
const fromIndex = currentIndex === -1 ? FONT_SIZES.indexOf("16px") : currentIndex;
|
|
1871
|
+
const nextSize = FONT_SIZES[Math.min(fromIndex + 1, FONT_SIZES.length - 1)];
|
|
1871
1872
|
return editor.chain().focus().setFontSize(nextSize).run();
|
|
1872
1873
|
},
|
|
1873
1874
|
decreaseFontSize: () => ({ editor }) => {
|
|
1874
1875
|
const currentSize = editor.getAttributes("textStyle").fontSize;
|
|
1875
1876
|
const currentIndex = FONT_SIZES.indexOf(currentSize || "16px");
|
|
1876
|
-
const
|
|
1877
|
-
const nextSize = FONT_SIZES[
|
|
1877
|
+
const fromIndex = currentIndex === -1 ? FONT_SIZES.indexOf("16px") : currentIndex;
|
|
1878
|
+
const nextSize = FONT_SIZES[Math.max(fromIndex - 1, 0)];
|
|
1878
1879
|
return editor.chain().focus().setFontSize(nextSize).run();
|
|
1879
1880
|
}
|
|
1880
1881
|
};
|