superdoc 2.20.0 → 2.20.1-next.2
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/chunks/{create-super-doc-ui-D5VrP4Dx.es.js → create-super-doc-ui-B4_V1haj.es.js} +20 -6
- package/dist/chunks/{create-super-doc-ui-BQBQsjoe.cjs → create-super-doc-ui-DFCfYEpW.cjs} +20 -6
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui-vue.cjs +1 -1
- package/dist/public/ui-vue.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +24 -24
- package/dist/style.layered.css +24 -24
- package/dist/superdoc/src/core/types/index.d.ts +4 -2
- package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +1 -1
- package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +1 -0
- package/dist/superdoc.cjs +69 -15
- package/dist/superdoc.es.js +69 -15
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +39 -39
- package/package.json +2 -2
package/dist/superdoc.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./chunks/rolldown-runtime-74VwNCz7.cjs");
|
|
3
3
|
const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
|
|
4
|
-
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-
|
|
4
|
+
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-DFCfYEpW.cjs");
|
|
5
5
|
const require_eventemitter3 = require("./chunks/eventemitter3-C_TAnXOl.cjs");
|
|
6
6
|
const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
|
|
7
7
|
const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-CYxINHh_.cjs");
|
|
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
|
|
|
316
316
|
var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
317
317
|
function getSuperdocVersion() {
|
|
318
318
|
try {
|
|
319
|
-
return "2.20.
|
|
319
|
+
return "2.20.1-next.2";
|
|
320
320
|
} catch {
|
|
321
321
|
return "unknown";
|
|
322
322
|
}
|
|
@@ -22176,6 +22176,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22176
22176
|
if (!documentId) return;
|
|
22177
22177
|
clearV2CommandShortcutBinding(documentId);
|
|
22178
22178
|
if (typeof bindEditShortcuts !== "function") return;
|
|
22179
|
+
getSuperDocUI();
|
|
22179
22180
|
const openLinkWorkflow = resolveV2LinkWorkflowOpener();
|
|
22180
22181
|
const unbind = bindEditShortcuts({
|
|
22181
22182
|
commandRoute: {
|
|
@@ -24520,7 +24521,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
24520
24521
|
], 38);
|
|
24521
24522
|
};
|
|
24522
24523
|
}
|
|
24523
|
-
}, [["__scopeId", "data-v-
|
|
24524
|
+
}, [["__scopeId", "data-v-e476c448"]]);
|
|
24524
24525
|
//#endregion
|
|
24525
24526
|
//#region src/core/create-app.js
|
|
24526
24527
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
@@ -41609,10 +41610,9 @@ var Toolbar_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vu
|
|
|
41609
41610
|
});
|
|
41610
41611
|
const showLeftSide = proxy.$toolbar.config?.toolbarGroups?.includes("left");
|
|
41611
41612
|
const showRightSide = proxy.$toolbar.config?.toolbarGroups?.includes("right");
|
|
41612
|
-
const excludeButtonsList = proxy.$toolbar.config?.toolbarButtonsExclude || [];
|
|
41613
41613
|
const getFilteredItems = (position) => {
|
|
41614
41614
|
toolbarStateVersion.value;
|
|
41615
|
-
return proxy.$toolbar.getToolbarItemByGroup(position)
|
|
41615
|
+
return proxy.$toolbar.getToolbarItemByGroup(position);
|
|
41616
41616
|
};
|
|
41617
41617
|
const updateCompactSideGroups = () => {
|
|
41618
41618
|
compactSideGroups.value = proxy.$toolbar.getAvailableWidth() <= RESPONSIVE_BREAKPOINTS.lg;
|
|
@@ -41786,7 +41786,7 @@ var Toolbar_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vu
|
|
|
41786
41786
|
], 32);
|
|
41787
41787
|
};
|
|
41788
41788
|
}
|
|
41789
|
-
}, [["__scopeId", "data-v-
|
|
41789
|
+
}, [["__scopeId", "data-v-0d00bc5b"]]);
|
|
41790
41790
|
//#endregion
|
|
41791
41791
|
//#region src/internal/toolbar/built-in/font-options.js
|
|
41792
41792
|
/**
|
|
@@ -43548,6 +43548,35 @@ var getToolbarItemWidth = (item, controlSizes) => {
|
|
|
43548
43548
|
if (item.type === "separator") return controlSizes.get("separator");
|
|
43549
43549
|
return controlSizes.get(item.name.value) || controlSizes.get("default");
|
|
43550
43550
|
};
|
|
43551
|
+
var collapseSeparatorRun = (items) => {
|
|
43552
|
+
const result = [];
|
|
43553
|
+
for (const item of items) {
|
|
43554
|
+
if (item.type === "separator") {
|
|
43555
|
+
const previous = result[result.length - 1];
|
|
43556
|
+
if (!previous || previous.type === "separator") continue;
|
|
43557
|
+
}
|
|
43558
|
+
result.push(item);
|
|
43559
|
+
}
|
|
43560
|
+
while (result.length && result[result.length - 1].type === "separator") result.pop();
|
|
43561
|
+
return result;
|
|
43562
|
+
};
|
|
43563
|
+
var normalizeSeparators = (items) => {
|
|
43564
|
+
const byGroup = /* @__PURE__ */ new Map();
|
|
43565
|
+
for (const item of items) {
|
|
43566
|
+
const group = item.group?.value || "center";
|
|
43567
|
+
if (!byGroup.has(group)) byGroup.set(group, []);
|
|
43568
|
+
byGroup.get(group).push(item);
|
|
43569
|
+
}
|
|
43570
|
+
const kept = /* @__PURE__ */ new Set();
|
|
43571
|
+
for (const groupItems of byGroup.values()) for (const item of collapseSeparatorRun(groupItems)) kept.add(item);
|
|
43572
|
+
return items.filter((item) => kept.has(item));
|
|
43573
|
+
};
|
|
43574
|
+
var normalizeSeparatorsIgnoringOverflow = (items) => {
|
|
43575
|
+
const overflowTrigger = items.find((item) => item.type === "overflow");
|
|
43576
|
+
const withoutOverflow = items.filter((item) => item !== overflowTrigger);
|
|
43577
|
+
const kept = new Set(normalizeSeparators(withoutOverflow));
|
|
43578
|
+
return items.filter((item) => item === overflowTrigger || kept.has(item));
|
|
43579
|
+
};
|
|
43551
43580
|
/**
|
|
43552
43581
|
* Set or clear the link item's `href` without disturbing the rest of its
|
|
43553
43582
|
* attributes. The static configuration (`ariaLabel`, and anything added later)
|
|
@@ -43602,7 +43631,7 @@ function hasAiModule(superToolbar) {
|
|
|
43602
43631
|
function aiModuleConfig(superToolbar) {
|
|
43603
43632
|
return superToolbar.config?.superdoc?.config?.modules?.ai ?? superToolbar.superdoc?.config?.modules?.ai ?? {};
|
|
43604
43633
|
}
|
|
43605
|
-
var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev = false, configuredItemNames, excludedItemNames, additionalItems = [] } = {}) => {
|
|
43634
|
+
var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev = false, configuredItemNames, configuredItemOrder, excludedItemNames, additionalItems = [] } = {}) => {
|
|
43606
43635
|
const bold = useToolbarItem({
|
|
43607
43636
|
type: "button",
|
|
43608
43637
|
name: "bold",
|
|
@@ -44712,9 +44741,15 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44712
44741
|
}
|
|
44713
44742
|
if (configuredItemNames) toolbarItems = toolbarItems.filter((item) => item.name.value === "overflow" || item.isCustomToolbarItem || configuredItemNames.has(item.name.value));
|
|
44714
44743
|
if (excludedItemNames?.size) toolbarItems = toolbarItems.filter((item) => !excludedItemNames.has(item.name.value));
|
|
44744
|
+
toolbarItems = normalizeSeparatorsIgnoringOverflow(toolbarItems);
|
|
44715
44745
|
const isStickyItem = (item) => stickyItemNames.includes(item.name.value);
|
|
44716
44746
|
const overflowTrigger = toolbarItems.find((item) => item.name.value === "overflow");
|
|
44717
44747
|
const layoutItems = toolbarItems.filter((item) => item !== overflowTrigger);
|
|
44748
|
+
if (configuredItemOrder) {
|
|
44749
|
+
const orderIndex = new Map(configuredItemOrder.map((name, index) => [name, index]));
|
|
44750
|
+
const rank = (item) => orderIndex.get(item.name.value) ?? Number.MAX_SAFE_INTEGER;
|
|
44751
|
+
layoutItems.sort((a, b) => rank(a) - rank(b));
|
|
44752
|
+
}
|
|
44718
44753
|
const partitionItems = (reserveOverflowTrigger) => {
|
|
44719
44754
|
const overflowItems = [];
|
|
44720
44755
|
const visibleItems = [];
|
|
@@ -44756,6 +44791,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44756
44791
|
if (insertAt === -1) visibleItems.push(overflowTrigger);
|
|
44757
44792
|
else visibleItems.splice(insertAt, 0, overflowTrigger);
|
|
44758
44793
|
}
|
|
44794
|
+
visibleItems = normalizeSeparators(visibleItems);
|
|
44759
44795
|
return {
|
|
44760
44796
|
defaultItems: visibleItems,
|
|
44761
44797
|
overflowItems: overflowItems.filter((item) => item.type !== "separator")
|
|
@@ -44976,6 +45012,7 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
44976
45012
|
responsiveToContainer: false,
|
|
44977
45013
|
mode: "docx",
|
|
44978
45014
|
excludeItems: [],
|
|
45015
|
+
toolbarButtonsExclude: [],
|
|
44979
45016
|
groups: null,
|
|
44980
45017
|
customButtons: [],
|
|
44981
45018
|
showFormattingMarksButton: false,
|
|
@@ -45141,7 +45178,7 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
45141
45178
|
const selectedCustomOptions = new Map(this.#getAllToolbarItems().filter((item) => item.isCustomToolbarItem && item.type === "dropdown").map((item) => [item.name.value, item.selectedValue.value]));
|
|
45142
45179
|
const hasExplicitGroupComposition = this.config.groups && !Array.isArray(this.config.groups) && Object.keys(this.config.groups).length > 0;
|
|
45143
45180
|
const configuredItemNames = hasExplicitGroupComposition ? new Set(Object.values(this.config.groups).flatMap((items) => items)) : null;
|
|
45144
|
-
const excludedItemNames = new Set(this.config.excludeItems);
|
|
45181
|
+
const excludedItemNames = /* @__PURE__ */ new Set([...this.config.excludeItems ?? [], ...this.config.toolbarButtonsExclude ?? []]);
|
|
45145
45182
|
const customItems = this.config.customButtons || [];
|
|
45146
45183
|
const takenNames = new Set(RESERVED_TOOLBAR_ITEM_NAMES);
|
|
45147
45184
|
const customToolbarItems = customItems.map((item, index) => {
|
|
@@ -45162,6 +45199,12 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
45162
45199
|
}).filter(Boolean);
|
|
45163
45200
|
const configuredGroups = hasExplicitGroupComposition ? new Set(Object.keys(this.config.groups)) : null;
|
|
45164
45201
|
const layoutCustomItems = configuredGroups ? customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")) : customToolbarItems;
|
|
45202
|
+
let allConfigItems = null;
|
|
45203
|
+
if (hasExplicitGroupComposition) {
|
|
45204
|
+
const groupedItems = Object.values(this.config.groups).flatMap((item) => item);
|
|
45205
|
+
const groupedCustomItems = customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")).map((item) => item.name.value);
|
|
45206
|
+
allConfigItems = [.../* @__PURE__ */ new Set([...groupedItems, ...groupedCustomItems])];
|
|
45207
|
+
}
|
|
45165
45208
|
const { defaultItems, overflowItems } = makeDefaultItems({
|
|
45166
45209
|
superToolbar: this,
|
|
45167
45210
|
toolbarIcons: this.config.icons,
|
|
@@ -45172,18 +45215,29 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
45172
45215
|
role: this.role,
|
|
45173
45216
|
isDev: this.isDev,
|
|
45174
45217
|
configuredItemNames,
|
|
45218
|
+
configuredItemOrder: allConfigItems,
|
|
45175
45219
|
excludedItemNames,
|
|
45176
45220
|
additionalItems: layoutCustomItems
|
|
45177
45221
|
});
|
|
45178
|
-
|
|
45179
|
-
if (hasExplicitGroupComposition) {
|
|
45180
|
-
const groupedItems = Object.values(this.config.groups).flatMap((item) => item);
|
|
45181
|
-
const groupedCustomItems = customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")).map((item) => item.name.value);
|
|
45182
|
-
allConfigItems = [.../* @__PURE__ */ new Set([...groupedItems, ...groupedCustomItems])];
|
|
45183
|
-
}
|
|
45222
|
+
if (!hasExplicitGroupComposition) allConfigItems = [...defaultItems.map((item) => item.name.value), ...overflowItems.map((item) => item.name.value)];
|
|
45184
45223
|
const configuredOverflowItems = overflowItems.filter((item) => allConfigItems.includes(item.name.value) && !excludedItemNames.has(item.name.value));
|
|
45185
45224
|
const visibleItemNames = configuredOverflowItems.length ? [...allConfigItems, "overflow"] : allConfigItems;
|
|
45186
45225
|
const filteredItems = defaultItems.filter((item) => visibleItemNames.includes(item.name.value)).filter((item) => !excludedItemNames.has(item.name.value));
|
|
45226
|
+
if (hasExplicitGroupComposition) {
|
|
45227
|
+
const orderIndex = new Map(allConfigItems.map((name, index) => [name, index]));
|
|
45228
|
+
const rank = (item) => orderIndex.get(item.name.value) ?? Number.MAX_SAFE_INTEGER;
|
|
45229
|
+
const overflowTrigger = filteredItems.find((item) => item.name.value === "overflow");
|
|
45230
|
+
const originalIndex = new Map(filteredItems.map((item, index) => [item, index]));
|
|
45231
|
+
const reordered = filteredItems.filter((item) => item !== overflowTrigger);
|
|
45232
|
+
reordered.sort((a, b) => rank(a) - rank(b));
|
|
45233
|
+
if (overflowTrigger) {
|
|
45234
|
+
const triggerOriginalIndex = originalIndex.get(overflowTrigger);
|
|
45235
|
+
const insertAt = reordered.findIndex((item) => originalIndex.get(item) > triggerOriginalIndex);
|
|
45236
|
+
insertAt === -1 ? reordered.push(overflowTrigger) : reordered.splice(insertAt, 0, overflowTrigger);
|
|
45237
|
+
}
|
|
45238
|
+
filteredItems.splice(0, filteredItems.length, ...reordered);
|
|
45239
|
+
configuredOverflowItems.sort((a, b) => rank(a) - rank(b));
|
|
45240
|
+
}
|
|
45187
45241
|
if (hasExplicitGroupComposition) {
|
|
45188
45242
|
for (const [group, names] of Object.entries(this.config.groups)) for (const item of filteredItems) if (names.includes(item.name.value)) item.group.value = group;
|
|
45189
45243
|
}
|
|
@@ -46283,7 +46337,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46283
46337
|
this.config.colors = shuffleArray(this.config.colors);
|
|
46284
46338
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
46285
46339
|
this.colorIndex = 0;
|
|
46286
|
-
this.version = "2.20.
|
|
46340
|
+
this.version = "2.20.1-next.2";
|
|
46287
46341
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
46288
46342
|
this.superdocId = config.superdocId || require_uuid.v4();
|
|
46289
46343
|
this.colors = this.config.colors ?? [];
|
package/dist/superdoc.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __toESM$2 } from "./chunks/rolldown-runtime-0pSA04fp.es.js";
|
|
2
2
|
import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
|
|
3
|
-
import { c as createImageFilePicker, d as DOM_CLASS_NAMES, f as closeInteractionHistory, i as registerFirstPartyCommandMutation, l as resolveImageSrc, m as recordInteraction, n as executeFirstPartyCommandAsync, o as applyV2CommentInvalidationFromMutation, p as createInteractionHistory, r as readFirstPartyPageNumbers, s as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-
|
|
3
|
+
import { c as createImageFilePicker, d as DOM_CLASS_NAMES, f as closeInteractionHistory, i as registerFirstPartyCommandMutation, l as resolveImageSrc, m as recordInteraction, n as executeFirstPartyCommandAsync, o as applyV2CommentInvalidationFromMutation, p as createInteractionHistory, r as readFirstPartyPageNumbers, s as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-B4_V1haj.es.js";
|
|
4
4
|
import { t as import_eventemitter3 } from "./chunks/eventemitter3-DEIiXiH2.es.js";
|
|
5
5
|
import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
|
|
6
6
|
import { $ as watch$1, A as onActivated, B as resolveDirective, C as isRef$1, D as normalizeClass, E as nextTick, F as openBlock, G as toRef, H as shallowRef$1, I as reactive, J as useAttrs, K as toRefs, L as ref, M as onDeactivated, N as onMounted, O as normalizeProps, P as onScopeDispose$1, Q as vModelText, R as renderList, S as isReactive$1, T as mergeProps, U as toDisplayString, V as resolveDynamicComponent, W as toRaw$2, X as vModelCheckbox, Y as useSlots, Z as vModelSelect, _ as getCurrentInstance, a as computed$1, b as hasInjectionContext, c as createCommentVNode, d as createStaticVNode, et as withCtx, f as createTextVNode, g as effectScope, h as defineComponent, i as Transition, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, m as defineAsyncComponent, n as Fragment, nt as withKeys, o as createApp, p as createVNode, q as unref, r as Teleport, rt as withModifiers, s as createBlock, t as _plugin_vue_export_helper_default, tt as withDirectives, u as createElementVNode, v as getCurrentScope, w as markRaw, x as inject$1, y as h, z as renderSlot } from "./chunks/_plugin-vue_export-helper-DHiJKCsy.es.js";
|
|
@@ -314,7 +314,7 @@ var shuffleArray = (array) => {
|
|
|
314
314
|
var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
315
315
|
function getSuperdocVersion() {
|
|
316
316
|
try {
|
|
317
|
-
return "2.20.
|
|
317
|
+
return "2.20.1-next.2";
|
|
318
318
|
} catch {
|
|
319
319
|
return "unknown";
|
|
320
320
|
}
|
|
@@ -22135,6 +22135,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
22135
22135
|
if (!documentId) return;
|
|
22136
22136
|
clearV2CommandShortcutBinding(documentId);
|
|
22137
22137
|
if (typeof bindEditShortcuts !== "function") return;
|
|
22138
|
+
getSuperDocUI();
|
|
22138
22139
|
const openLinkWorkflow = resolveV2LinkWorkflowOpener();
|
|
22139
22140
|
const unbind = bindEditShortcuts({
|
|
22140
22141
|
commandRoute: {
|
|
@@ -24479,7 +24480,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
24479
24480
|
], 38);
|
|
24480
24481
|
};
|
|
24481
24482
|
}
|
|
24482
|
-
}, [["__scopeId", "data-v-
|
|
24483
|
+
}, [["__scopeId", "data-v-e476c448"]]);
|
|
24483
24484
|
//#endregion
|
|
24484
24485
|
//#region src/core/create-app.js
|
|
24485
24486
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
@@ -41558,10 +41559,9 @@ var Toolbar_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
41558
41559
|
});
|
|
41559
41560
|
const showLeftSide = proxy.$toolbar.config?.toolbarGroups?.includes("left");
|
|
41560
41561
|
const showRightSide = proxy.$toolbar.config?.toolbarGroups?.includes("right");
|
|
41561
|
-
const excludeButtonsList = proxy.$toolbar.config?.toolbarButtonsExclude || [];
|
|
41562
41562
|
const getFilteredItems = (position) => {
|
|
41563
41563
|
toolbarStateVersion.value;
|
|
41564
|
-
return proxy.$toolbar.getToolbarItemByGroup(position)
|
|
41564
|
+
return proxy.$toolbar.getToolbarItemByGroup(position);
|
|
41565
41565
|
};
|
|
41566
41566
|
const updateCompactSideGroups = () => {
|
|
41567
41567
|
compactSideGroups.value = proxy.$toolbar.getAvailableWidth() <= RESPONSIVE_BREAKPOINTS.lg;
|
|
@@ -41735,7 +41735,7 @@ var Toolbar_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
41735
41735
|
], 32);
|
|
41736
41736
|
};
|
|
41737
41737
|
}
|
|
41738
|
-
}, [["__scopeId", "data-v-
|
|
41738
|
+
}, [["__scopeId", "data-v-0d00bc5b"]]);
|
|
41739
41739
|
//#endregion
|
|
41740
41740
|
//#region src/internal/toolbar/built-in/font-options.js
|
|
41741
41741
|
/**
|
|
@@ -43477,6 +43477,35 @@ var getToolbarItemWidth = (item, controlSizes) => {
|
|
|
43477
43477
|
if (item.type === "separator") return controlSizes.get("separator");
|
|
43478
43478
|
return controlSizes.get(item.name.value) || controlSizes.get("default");
|
|
43479
43479
|
};
|
|
43480
|
+
var collapseSeparatorRun = (items) => {
|
|
43481
|
+
const result = [];
|
|
43482
|
+
for (const item of items) {
|
|
43483
|
+
if (item.type === "separator") {
|
|
43484
|
+
const previous = result[result.length - 1];
|
|
43485
|
+
if (!previous || previous.type === "separator") continue;
|
|
43486
|
+
}
|
|
43487
|
+
result.push(item);
|
|
43488
|
+
}
|
|
43489
|
+
while (result.length && result[result.length - 1].type === "separator") result.pop();
|
|
43490
|
+
return result;
|
|
43491
|
+
};
|
|
43492
|
+
var normalizeSeparators = (items) => {
|
|
43493
|
+
const byGroup = /* @__PURE__ */ new Map();
|
|
43494
|
+
for (const item of items) {
|
|
43495
|
+
const group = item.group?.value || "center";
|
|
43496
|
+
if (!byGroup.has(group)) byGroup.set(group, []);
|
|
43497
|
+
byGroup.get(group).push(item);
|
|
43498
|
+
}
|
|
43499
|
+
const kept = /* @__PURE__ */ new Set();
|
|
43500
|
+
for (const groupItems of byGroup.values()) for (const item of collapseSeparatorRun(groupItems)) kept.add(item);
|
|
43501
|
+
return items.filter((item) => kept.has(item));
|
|
43502
|
+
};
|
|
43503
|
+
var normalizeSeparatorsIgnoringOverflow = (items) => {
|
|
43504
|
+
const overflowTrigger = items.find((item) => item.type === "overflow");
|
|
43505
|
+
const withoutOverflow = items.filter((item) => item !== overflowTrigger);
|
|
43506
|
+
const kept = new Set(normalizeSeparators(withoutOverflow));
|
|
43507
|
+
return items.filter((item) => item === overflowTrigger || kept.has(item));
|
|
43508
|
+
};
|
|
43480
43509
|
/**
|
|
43481
43510
|
* Set or clear the link item's `href` without disturbing the rest of its
|
|
43482
43511
|
* attributes. The static configuration (`ariaLabel`, and anything added later)
|
|
@@ -43531,7 +43560,7 @@ function hasAiModule(superToolbar) {
|
|
|
43531
43560
|
function aiModuleConfig(superToolbar) {
|
|
43532
43561
|
return superToolbar.config?.superdoc?.config?.modules?.ai ?? superToolbar.superdoc?.config?.modules?.ai ?? {};
|
|
43533
43562
|
}
|
|
43534
|
-
var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev = false, configuredItemNames, excludedItemNames, additionalItems = [] } = {}) => {
|
|
43563
|
+
var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev = false, configuredItemNames, configuredItemOrder, excludedItemNames, additionalItems = [] } = {}) => {
|
|
43535
43564
|
const bold = useToolbarItem({
|
|
43536
43565
|
type: "button",
|
|
43537
43566
|
name: "bold",
|
|
@@ -44641,9 +44670,15 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44641
44670
|
}
|
|
44642
44671
|
if (configuredItemNames) toolbarItems = toolbarItems.filter((item) => item.name.value === "overflow" || item.isCustomToolbarItem || configuredItemNames.has(item.name.value));
|
|
44643
44672
|
if (excludedItemNames?.size) toolbarItems = toolbarItems.filter((item) => !excludedItemNames.has(item.name.value));
|
|
44673
|
+
toolbarItems = normalizeSeparatorsIgnoringOverflow(toolbarItems);
|
|
44644
44674
|
const isStickyItem = (item) => stickyItemNames.includes(item.name.value);
|
|
44645
44675
|
const overflowTrigger = toolbarItems.find((item) => item.name.value === "overflow");
|
|
44646
44676
|
const layoutItems = toolbarItems.filter((item) => item !== overflowTrigger);
|
|
44677
|
+
if (configuredItemOrder) {
|
|
44678
|
+
const orderIndex = new Map(configuredItemOrder.map((name, index) => [name, index]));
|
|
44679
|
+
const rank = (item) => orderIndex.get(item.name.value) ?? Number.MAX_SAFE_INTEGER;
|
|
44680
|
+
layoutItems.sort((a, b) => rank(a) - rank(b));
|
|
44681
|
+
}
|
|
44647
44682
|
const partitionItems = (reserveOverflowTrigger) => {
|
|
44648
44683
|
const overflowItems = [];
|
|
44649
44684
|
const visibleItems = [];
|
|
@@ -44685,6 +44720,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44685
44720
|
if (insertAt === -1) visibleItems.push(overflowTrigger);
|
|
44686
44721
|
else visibleItems.splice(insertAt, 0, overflowTrigger);
|
|
44687
44722
|
}
|
|
44723
|
+
visibleItems = normalizeSeparators(visibleItems);
|
|
44688
44724
|
return {
|
|
44689
44725
|
defaultItems: visibleItems,
|
|
44690
44726
|
overflowItems: overflowItems.filter((item) => item.type !== "separator")
|
|
@@ -44905,6 +44941,7 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
44905
44941
|
responsiveToContainer: false,
|
|
44906
44942
|
mode: "docx",
|
|
44907
44943
|
excludeItems: [],
|
|
44944
|
+
toolbarButtonsExclude: [],
|
|
44908
44945
|
groups: null,
|
|
44909
44946
|
customButtons: [],
|
|
44910
44947
|
showFormattingMarksButton: false,
|
|
@@ -45070,7 +45107,7 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
45070
45107
|
const selectedCustomOptions = new Map(this.#getAllToolbarItems().filter((item) => item.isCustomToolbarItem && item.type === "dropdown").map((item) => [item.name.value, item.selectedValue.value]));
|
|
45071
45108
|
const hasExplicitGroupComposition = this.config.groups && !Array.isArray(this.config.groups) && Object.keys(this.config.groups).length > 0;
|
|
45072
45109
|
const configuredItemNames = hasExplicitGroupComposition ? new Set(Object.values(this.config.groups).flatMap((items) => items)) : null;
|
|
45073
|
-
const excludedItemNames = new Set(this.config.excludeItems);
|
|
45110
|
+
const excludedItemNames = /* @__PURE__ */ new Set([...this.config.excludeItems ?? [], ...this.config.toolbarButtonsExclude ?? []]);
|
|
45074
45111
|
const customItems = this.config.customButtons || [];
|
|
45075
45112
|
const takenNames = new Set(RESERVED_TOOLBAR_ITEM_NAMES);
|
|
45076
45113
|
const customToolbarItems = customItems.map((item, index) => {
|
|
@@ -45091,6 +45128,12 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
45091
45128
|
}).filter(Boolean);
|
|
45092
45129
|
const configuredGroups = hasExplicitGroupComposition ? new Set(Object.keys(this.config.groups)) : null;
|
|
45093
45130
|
const layoutCustomItems = configuredGroups ? customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")) : customToolbarItems;
|
|
45131
|
+
let allConfigItems = null;
|
|
45132
|
+
if (hasExplicitGroupComposition) {
|
|
45133
|
+
const groupedItems = Object.values(this.config.groups).flatMap((item) => item);
|
|
45134
|
+
const groupedCustomItems = customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")).map((item) => item.name.value);
|
|
45135
|
+
allConfigItems = [.../* @__PURE__ */ new Set([...groupedItems, ...groupedCustomItems])];
|
|
45136
|
+
}
|
|
45094
45137
|
const { defaultItems, overflowItems } = makeDefaultItems({
|
|
45095
45138
|
superToolbar: this,
|
|
45096
45139
|
toolbarIcons: this.config.icons,
|
|
@@ -45101,18 +45144,29 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
45101
45144
|
role: this.role,
|
|
45102
45145
|
isDev: this.isDev,
|
|
45103
45146
|
configuredItemNames,
|
|
45147
|
+
configuredItemOrder: allConfigItems,
|
|
45104
45148
|
excludedItemNames,
|
|
45105
45149
|
additionalItems: layoutCustomItems
|
|
45106
45150
|
});
|
|
45107
|
-
|
|
45108
|
-
if (hasExplicitGroupComposition) {
|
|
45109
|
-
const groupedItems = Object.values(this.config.groups).flatMap((item) => item);
|
|
45110
|
-
const groupedCustomItems = customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")).map((item) => item.name.value);
|
|
45111
|
-
allConfigItems = [.../* @__PURE__ */ new Set([...groupedItems, ...groupedCustomItems])];
|
|
45112
|
-
}
|
|
45151
|
+
if (!hasExplicitGroupComposition) allConfigItems = [...defaultItems.map((item) => item.name.value), ...overflowItems.map((item) => item.name.value)];
|
|
45113
45152
|
const configuredOverflowItems = overflowItems.filter((item) => allConfigItems.includes(item.name.value) && !excludedItemNames.has(item.name.value));
|
|
45114
45153
|
const visibleItemNames = configuredOverflowItems.length ? [...allConfigItems, "overflow"] : allConfigItems;
|
|
45115
45154
|
const filteredItems = defaultItems.filter((item) => visibleItemNames.includes(item.name.value)).filter((item) => !excludedItemNames.has(item.name.value));
|
|
45155
|
+
if (hasExplicitGroupComposition) {
|
|
45156
|
+
const orderIndex = new Map(allConfigItems.map((name, index) => [name, index]));
|
|
45157
|
+
const rank = (item) => orderIndex.get(item.name.value) ?? Number.MAX_SAFE_INTEGER;
|
|
45158
|
+
const overflowTrigger = filteredItems.find((item) => item.name.value === "overflow");
|
|
45159
|
+
const originalIndex = new Map(filteredItems.map((item, index) => [item, index]));
|
|
45160
|
+
const reordered = filteredItems.filter((item) => item !== overflowTrigger);
|
|
45161
|
+
reordered.sort((a, b) => rank(a) - rank(b));
|
|
45162
|
+
if (overflowTrigger) {
|
|
45163
|
+
const triggerOriginalIndex = originalIndex.get(overflowTrigger);
|
|
45164
|
+
const insertAt = reordered.findIndex((item) => originalIndex.get(item) > triggerOriginalIndex);
|
|
45165
|
+
insertAt === -1 ? reordered.push(overflowTrigger) : reordered.splice(insertAt, 0, overflowTrigger);
|
|
45166
|
+
}
|
|
45167
|
+
filteredItems.splice(0, filteredItems.length, ...reordered);
|
|
45168
|
+
configuredOverflowItems.sort((a, b) => rank(a) - rank(b));
|
|
45169
|
+
}
|
|
45116
45170
|
if (hasExplicitGroupComposition) {
|
|
45117
45171
|
for (const [group, names] of Object.entries(this.config.groups)) for (const item of filteredItems) if (names.includes(item.name.value)) item.group.value = group;
|
|
45118
45172
|
}
|
|
@@ -46212,7 +46266,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46212
46266
|
this.config.colors = shuffleArray(this.config.colors);
|
|
46213
46267
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
46214
46268
|
this.colorIndex = 0;
|
|
46215
|
-
this.version = "2.20.
|
|
46269
|
+
this.version = "2.20.1-next.2";
|
|
46216
46270
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
46217
46271
|
this.superdocId = config.superdocId || v4();
|
|
46218
46272
|
this.colors = this.config.colors ?? [];
|