@superdoc-dev/mcp 0.12.0-next.45 → 0.12.0-next.46
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.js +166 -38
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -50479,7 +50479,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
|
|
|
50479
50479
|
emptyOptions2 = {};
|
|
50480
50480
|
});
|
|
50481
50481
|
|
|
50482
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter
|
|
50482
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-DRKaQwZS.es.js
|
|
50483
50483
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
50484
50484
|
const fieldValue = extension$1.config[field];
|
|
50485
50485
|
if (typeof fieldValue === "function")
|
|
@@ -72321,6 +72321,7 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
|
|
|
72321
72321
|
const context = getParagraphRunContext($pos, editor);
|
|
72322
72322
|
const currentRunProperties = context?.runProperties || null;
|
|
72323
72323
|
const cursorMarks = $pos.marks();
|
|
72324
|
+
const directMarkRunProperties = decodeRPrFromMarks(cursorMarks);
|
|
72324
72325
|
const hasStoredMarks = storedMarks !== null;
|
|
72325
72326
|
const hasExplicitEmptyStoredMarks = hasStoredMarks && storedMarks.length === 0;
|
|
72326
72327
|
const resolvedMarks = [];
|
|
@@ -72348,7 +72349,9 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
|
|
|
72348
72349
|
inlineMarks: [],
|
|
72349
72350
|
resolvedRunProperties: {},
|
|
72350
72351
|
inlineRunProperties: {},
|
|
72351
|
-
styleRunProperties: {}
|
|
72352
|
+
styleRunProperties: {},
|
|
72353
|
+
directMarkRunProperties: {},
|
|
72354
|
+
mixedRunProperties: null
|
|
72352
72355
|
};
|
|
72353
72356
|
const resolvedFromSelection = getInheritedRunProperties($pos, editor, preferParagraphRunProperties || !hasStoredMarks && context?.isEmpty ? context?.paragraphAttrs?.paragraphProperties?.runProperties || null : inlineRunProperties);
|
|
72354
72357
|
const resolvedRunProperties = resolvedFromSelection?.resolvedRunProperties ?? inlineRunProperties;
|
|
@@ -72362,7 +72365,9 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
|
|
|
72362
72365
|
inlineMarks,
|
|
72363
72366
|
resolvedRunProperties,
|
|
72364
72367
|
inlineRunProperties,
|
|
72365
|
-
styleRunProperties
|
|
72368
|
+
styleRunProperties,
|
|
72369
|
+
directMarkRunProperties,
|
|
72370
|
+
mixedRunProperties: null
|
|
72366
72371
|
};
|
|
72367
72372
|
}
|
|
72368
72373
|
function getFormattingStateForRange(state, from, to, editor) {
|
|
@@ -72382,9 +72387,14 @@ function getFormattingStateForRange(state, from, to, editor) {
|
|
|
72382
72387
|
return aggregateFormattingSegments(state, editor, segments);
|
|
72383
72388
|
}
|
|
72384
72389
|
function aggregateFormattingSegments(state, editor, segments) {
|
|
72385
|
-
const
|
|
72386
|
-
const
|
|
72387
|
-
const
|
|
72390
|
+
const resolvedRunPropertiesList = segments.map((segment) => segment.resolvedRunProperties);
|
|
72391
|
+
const inlineRunPropertiesList = segments.map((segment) => segment.inlineRunProperties);
|
|
72392
|
+
const styleRunPropertiesList = segments.map((segment) => segment.styleRunProperties);
|
|
72393
|
+
const directMarkRunPropertiesList = segments.map((segment) => segment.directMarkRunProperties);
|
|
72394
|
+
const resolvedRunProperties = intersectRunProperties(resolvedRunPropertiesList);
|
|
72395
|
+
const inlineRunProperties = intersectRunProperties(inlineRunPropertiesList);
|
|
72396
|
+
const styleRunProperties = intersectRunProperties(styleRunPropertiesList);
|
|
72397
|
+
const directMarkRunProperties = intersectRunProperties(directMarkRunPropertiesList);
|
|
72388
72398
|
const resolvedMarks = createMarksFromRunProperties(state, resolvedRunProperties, editor);
|
|
72389
72399
|
const inlineMarks = createMarksFromRunProperties(state, inlineRunProperties, editor);
|
|
72390
72400
|
return {
|
|
@@ -72392,7 +72402,9 @@ function aggregateFormattingSegments(state, editor, segments) {
|
|
|
72392
72402
|
inlineMarks,
|
|
72393
72403
|
resolvedRunProperties,
|
|
72394
72404
|
inlineRunProperties,
|
|
72395
|
-
styleRunProperties
|
|
72405
|
+
styleRunProperties,
|
|
72406
|
+
directMarkRunProperties,
|
|
72407
|
+
mixedRunProperties: getMixedRunProperties(resolvedRunPropertiesList, directMarkRunPropertiesList)
|
|
72396
72408
|
};
|
|
72397
72409
|
}
|
|
72398
72410
|
function mergeResolvedMarksWithInlineFallback(resolvedMarks, inlineMarks) {
|
|
@@ -72417,6 +72429,41 @@ function intersectRunProperties(runPropertiesList) {
|
|
|
72417
72429
|
});
|
|
72418
72430
|
return Object.keys(intersection3).length ? intersection3 : null;
|
|
72419
72431
|
}
|
|
72432
|
+
function getMixedRunProperties(runPropertiesList, directRunPropertiesList = []) {
|
|
72433
|
+
const filtered = runPropertiesList.filter((props) => props && typeof props === "object");
|
|
72434
|
+
if (filtered.length <= 1)
|
|
72435
|
+
return null;
|
|
72436
|
+
const keys$1 = new Set(filtered.flatMap((props) => Object.keys(props)));
|
|
72437
|
+
const mixed = {};
|
|
72438
|
+
keys$1.forEach((key) => {
|
|
72439
|
+
if (key === "fontFamily" && hasUniformDirectFontFamily(directRunPropertiesList))
|
|
72440
|
+
return;
|
|
72441
|
+
const values = filtered.map((props) => Object.prototype.hasOwnProperty.call(props, key) ? props[key] : undefined);
|
|
72442
|
+
const first = JSON.stringify(values[0]);
|
|
72443
|
+
if (values.some((value) => JSON.stringify(value) !== first))
|
|
72444
|
+
mixed[key] = true;
|
|
72445
|
+
});
|
|
72446
|
+
return Object.keys(mixed).length ? mixed : null;
|
|
72447
|
+
}
|
|
72448
|
+
function hasUniformDirectFontFamily(runPropertiesList) {
|
|
72449
|
+
if (runPropertiesList.length <= 1)
|
|
72450
|
+
return false;
|
|
72451
|
+
let firstValue;
|
|
72452
|
+
let hasFirstValue = false;
|
|
72453
|
+
for (const props of runPropertiesList) {
|
|
72454
|
+
if (!props || typeof props !== "object" || !Object.prototype.hasOwnProperty.call(props, "fontFamily"))
|
|
72455
|
+
return false;
|
|
72456
|
+
const value = props.fontFamily;
|
|
72457
|
+
if (!hasFirstValue) {
|
|
72458
|
+
firstValue = value;
|
|
72459
|
+
hasFirstValue = true;
|
|
72460
|
+
continue;
|
|
72461
|
+
}
|
|
72462
|
+
if (JSON.stringify(value) !== JSON.stringify(firstValue))
|
|
72463
|
+
return false;
|
|
72464
|
+
}
|
|
72465
|
+
return hasFirstValue;
|
|
72466
|
+
}
|
|
72420
72467
|
function getInheritedRunProperties($pos, editor, inlineRunProperties) {
|
|
72421
72468
|
if (!editor)
|
|
72422
72469
|
return {
|
|
@@ -118716,7 +118763,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
|
|
|
118716
118763
|
state.kern = kernNode.attributes["w:val"];
|
|
118717
118764
|
}
|
|
118718
118765
|
}, SuperConverter;
|
|
118719
|
-
var
|
|
118766
|
+
var init_SuperConverter_DRKaQwZS_es = __esm(() => {
|
|
118720
118767
|
init_rolldown_runtime_Bg48TavK_es();
|
|
118721
118768
|
init_jszip_C49i9kUs_es();
|
|
118722
118769
|
init_xml_js_CqGKpaft_es();
|
|
@@ -147642,7 +147689,7 @@ var init_SuperConverter_x_mSI6o_es = __esm(() => {
|
|
|
147642
147689
|
};
|
|
147643
147690
|
});
|
|
147644
147691
|
|
|
147645
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
147692
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-ChACxHAH.es.js
|
|
147646
147693
|
function parseSizeUnit(val = "0") {
|
|
147647
147694
|
const length = val.toString() || "0";
|
|
147648
147695
|
const value = Number.parseFloat(length);
|
|
@@ -157607,6 +157654,14 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
|
|
|
157607
157654
|
if (!rawActiveMark || !hasFormattingAttrs(rawActiveMark))
|
|
157608
157655
|
return false;
|
|
157609
157656
|
return isNegatedMark(rawActiveMark.name, rawActiveMark.attrs);
|
|
157657
|
+
}, getPrimaryFontFamily = (value) => {
|
|
157658
|
+
if (typeof value === "string")
|
|
157659
|
+
return value.split(",")[0].trim();
|
|
157660
|
+
if (!value || typeof value !== "object")
|
|
157661
|
+
return null;
|
|
157662
|
+
const fontFamily = value;
|
|
157663
|
+
const primary = fontFamily.ascii ?? fontFamily.hAnsi ?? fontFamily.eastAsia ?? fontFamily.cs;
|
|
157664
|
+
return typeof primary === "string" ? primary.split(",")[0].trim() : null;
|
|
157610
157665
|
}, isFormatCommandsStorage = (value) => {
|
|
157611
157666
|
return typeof value === "object" && value !== null && "storedStyle" in value;
|
|
157612
157667
|
}, hasStoredCopyFormat = (context) => {
|
|
@@ -157699,15 +157754,20 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
|
|
|
157699
157754
|
disabled: true,
|
|
157700
157755
|
value: null
|
|
157701
157756
|
};
|
|
157702
|
-
const
|
|
157757
|
+
const values = getFormattingAttr(formatting, "fontFamily", "fontFamily");
|
|
157758
|
+
const selectionFormattingState = stateEditor?.state?.selection?.empty === false ? getSelectionFormattingState(stateEditor.state, stateEditor) : null;
|
|
157759
|
+
const normalizedValues = values.map((value$1) => normalizeFontFamilyValue(value$1));
|
|
157703
157760
|
const uniqueValues = [...new Set(normalizedValues)];
|
|
157704
|
-
const
|
|
157761
|
+
const hasDirectValue = uniqueValues.length > 0;
|
|
157762
|
+
const hasMixedFontFamily = Boolean(selectionFormattingState?.mixedRunProperties?.fontFamily);
|
|
157763
|
+
const directSelectionValue = normalizeFontFamilyValue(getPrimaryFontFamily(selectionFormattingState?.directMarkRunProperties?.fontFamily));
|
|
157764
|
+
const canUseLinkedStyle = !hasDirectValue && !hasMixedFontFamily && isFormattingActivatedFromLinkedStyle(context, "font-family");
|
|
157705
157765
|
const paragraphProps = canUseLinkedStyle ? getCurrentResolvedParagraphProperties(context) : null;
|
|
157706
157766
|
const documentEditor = context?.presentationEditor?.editor ?? context?.editor ?? null;
|
|
157707
157767
|
const linkedStyleValue = normalizeFontFamilyValue((canUseLinkedStyle ? documentEditor?.converter?.linkedStyles?.find((style) => style.id === paragraphProps?.styleId) : null)?.definition?.styles?.["font-family"]) ?? null;
|
|
157708
|
-
const value = uniqueValues.length === 1 ? uniqueValues[0] : linkedStyleValue;
|
|
157768
|
+
const value = hasMixedFontFamily ? null : directSelectionValue || (uniqueValues.length === 1 ? uniqueValues[0] : linkedStyleValue);
|
|
157709
157769
|
return {
|
|
157710
|
-
active: uniqueValues.length > 0 || linkedStyleValue != null,
|
|
157770
|
+
active: hasMixedFontFamily || uniqueValues.length > 0 || directSelectionValue != null || linkedStyleValue != null,
|
|
157711
157771
|
disabled: false,
|
|
157712
157772
|
value
|
|
157713
157773
|
};
|
|
@@ -158432,9 +158492,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
|
|
|
158432
158492
|
}
|
|
158433
158493
|
};
|
|
158434
158494
|
};
|
|
158435
|
-
var
|
|
158495
|
+
var init_create_headless_toolbar_ChACxHAH_es = __esm(() => {
|
|
158436
158496
|
init_rolldown_runtime_Bg48TavK_es();
|
|
158437
|
-
|
|
158497
|
+
init_SuperConverter_DRKaQwZS_es();
|
|
158438
158498
|
init_jszip_C49i9kUs_es();
|
|
158439
158499
|
init_uuid_B2wVPhPi_es();
|
|
158440
158500
|
init_constants_D9qj59G2_es();
|
|
@@ -214048,7 +214108,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
|
|
|
214048
214108
|
init_remark_gfm_BUJjZJLy_es();
|
|
214049
214109
|
});
|
|
214050
214110
|
|
|
214051
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
214111
|
+
// ../../packages/superdoc/dist/chunks/src-ly1ZYfUZ.es.js
|
|
214052
214112
|
function deleteProps(obj, propOrProps) {
|
|
214053
214113
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
214054
214114
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -290713,7 +290773,12 @@ var Node$13 = class Node$14 {
|
|
|
290713
290773
|
suppressActiveHighlight: true,
|
|
290714
290774
|
attributes: { ariaLabel: "Font family" },
|
|
290715
290775
|
options: fontOptions,
|
|
290716
|
-
onActivate: ({ fontFamily }) => {
|
|
290776
|
+
onActivate: ({ fontFamily } = {}, isMultiple = false) => {
|
|
290777
|
+
if (isMultiple) {
|
|
290778
|
+
fontButton.label.value = "";
|
|
290779
|
+
fontButton.selectedValue.value = "";
|
|
290780
|
+
return;
|
|
290781
|
+
}
|
|
290717
290782
|
if (!fontFamily)
|
|
290718
290783
|
return;
|
|
290719
290784
|
fontFamily = fontFamily.split(",")[0];
|
|
@@ -314131,13 +314196,13 @@ menclose::after {
|
|
|
314131
314196
|
return;
|
|
314132
314197
|
console.log(...args$1);
|
|
314133
314198
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
|
|
314134
|
-
var
|
|
314199
|
+
var init_src_ly1ZYfUZ_es = __esm(() => {
|
|
314135
314200
|
init_rolldown_runtime_Bg48TavK_es();
|
|
314136
|
-
|
|
314201
|
+
init_SuperConverter_DRKaQwZS_es();
|
|
314137
314202
|
init_jszip_C49i9kUs_es();
|
|
314138
314203
|
init_xml_js_CqGKpaft_es();
|
|
314139
314204
|
init_uuid_B2wVPhPi_es();
|
|
314140
|
-
|
|
314205
|
+
init_create_headless_toolbar_ChACxHAH_es();
|
|
314141
314206
|
init_constants_D9qj59G2_es();
|
|
314142
314207
|
init_unified_BDuVPlMu_es();
|
|
314143
314208
|
init_remark_gfm_BUJjZJLy_es();
|
|
@@ -320899,10 +320964,18 @@ ${err.toString()}`);
|
|
|
320899
320964
|
addCommands() {
|
|
320900
320965
|
return {
|
|
320901
320966
|
setFontFamily: (fontFamily) => ({ chain }) => {
|
|
320902
|
-
return chain().setMark("textStyle", {
|
|
320967
|
+
return chain().setMark("textStyle", {
|
|
320968
|
+
fontFamily,
|
|
320969
|
+
eastAsiaFontFamily: null,
|
|
320970
|
+
csFontFamily: null
|
|
320971
|
+
}).run();
|
|
320903
320972
|
},
|
|
320904
320973
|
unsetFontFamily: () => ({ chain }) => {
|
|
320905
|
-
return chain().setMark("textStyle", {
|
|
320974
|
+
return chain().setMark("textStyle", {
|
|
320975
|
+
fontFamily: null,
|
|
320976
|
+
eastAsiaFontFamily: null,
|
|
320977
|
+
csFontFamily: null
|
|
320978
|
+
}).removeEmptyTextStyle().run();
|
|
320906
320979
|
}
|
|
320907
320980
|
};
|
|
320908
320981
|
}
|
|
@@ -344067,7 +344140,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344067
344140
|
return null;
|
|
344068
344141
|
return getParagraphFontFamilyFromProperties(calculateResolvedParagraphProperties(this.activeEditor, paragraphParent.node, state.doc.resolve(paragraphParent.pos)), this.activeEditor?.converter?.convertedXml ?? {}) || null;
|
|
344069
344142
|
}
|
|
344070
|
-
#
|
|
344143
|
+
#isMixedState(commandState) {
|
|
344071
344144
|
return Boolean(commandState?.active) && commandState?.value == null;
|
|
344072
344145
|
}
|
|
344073
344146
|
#applyHeadlessState(item) {
|
|
@@ -344111,6 +344184,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344111
344184
|
item.activate({ fontFamily: commandState.value });
|
|
344112
344185
|
return;
|
|
344113
344186
|
}
|
|
344187
|
+
if (this.#isMixedState(commandState)) {
|
|
344188
|
+
item.activate({}, true);
|
|
344189
|
+
return;
|
|
344190
|
+
}
|
|
344114
344191
|
const fallbackFontFamily = this.#getFontFamilyFallbackValue();
|
|
344115
344192
|
if (fallbackFontFamily) {
|
|
344116
344193
|
item.activate({ fontFamily: fallbackFontFamily });
|
|
@@ -344123,7 +344200,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344123
344200
|
item.activate({ fontSize: commandState.value });
|
|
344124
344201
|
return;
|
|
344125
344202
|
}
|
|
344126
|
-
if (this.#
|
|
344203
|
+
if (this.#isMixedState(commandState)) {
|
|
344127
344204
|
item.activate({}, true);
|
|
344128
344205
|
return;
|
|
344129
344206
|
}
|
|
@@ -357380,11 +357457,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357380
357457
|
]);
|
|
357381
357458
|
});
|
|
357382
357459
|
|
|
357383
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
357460
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-CjKDFHjb.es.js
|
|
357384
357461
|
var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, FONT_SIZE_OPTIONS;
|
|
357385
|
-
var
|
|
357386
|
-
|
|
357387
|
-
|
|
357462
|
+
var init_create_super_doc_ui_CjKDFHjb_es = __esm(() => {
|
|
357463
|
+
init_SuperConverter_DRKaQwZS_es();
|
|
357464
|
+
init_create_headless_toolbar_ChACxHAH_es();
|
|
357388
357465
|
DEFAULT_TEXT_ALIGN_OPTIONS = [
|
|
357389
357466
|
{
|
|
357390
357467
|
label: "Left",
|
|
@@ -357675,15 +357752,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
|
|
|
357675
357752
|
|
|
357676
357753
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
357677
357754
|
var init_super_editor_es = __esm(() => {
|
|
357678
|
-
|
|
357679
|
-
|
|
357755
|
+
init_src_ly1ZYfUZ_es();
|
|
357756
|
+
init_SuperConverter_DRKaQwZS_es();
|
|
357680
357757
|
init_jszip_C49i9kUs_es();
|
|
357681
357758
|
init_xml_js_CqGKpaft_es();
|
|
357682
|
-
|
|
357759
|
+
init_create_headless_toolbar_ChACxHAH_es();
|
|
357683
357760
|
init_constants_D9qj59G2_es();
|
|
357684
357761
|
init_unified_BDuVPlMu_es();
|
|
357685
357762
|
init_DocxZipper_BzS208BW_es();
|
|
357686
|
-
|
|
357763
|
+
init_create_super_doc_ui_CjKDFHjb_es();
|
|
357687
357764
|
init_ui_CGB3qmy3_es();
|
|
357688
357765
|
init_eventemitter3_UwU_CLPU_es();
|
|
357689
357766
|
init_errors_C_DoKMoN_es();
|
|
@@ -469684,6 +469761,7 @@ function getFormattingStateAtPos2(state, pos, editor, options = {}) {
|
|
|
469684
469761
|
const context = getParagraphRunContext2($pos, editor);
|
|
469685
469762
|
const currentRunProperties = context?.runProperties || null;
|
|
469686
469763
|
const cursorMarks = $pos.marks();
|
|
469764
|
+
const directMarkRunProperties = decodeRPrFromMarks2(cursorMarks);
|
|
469687
469765
|
const hasStoredMarks = storedMarks !== null;
|
|
469688
469766
|
const hasExplicitEmptyStoredMarks = hasStoredMarks && storedMarks.length === 0;
|
|
469689
469767
|
const resolvedMarks = [];
|
|
@@ -469711,7 +469789,9 @@ function getFormattingStateAtPos2(state, pos, editor, options = {}) {
|
|
|
469711
469789
|
inlineMarks: [],
|
|
469712
469790
|
resolvedRunProperties: {},
|
|
469713
469791
|
inlineRunProperties: {},
|
|
469714
|
-
styleRunProperties: {}
|
|
469792
|
+
styleRunProperties: {},
|
|
469793
|
+
directMarkRunProperties: {},
|
|
469794
|
+
mixedRunProperties: null
|
|
469715
469795
|
};
|
|
469716
469796
|
}
|
|
469717
469797
|
const resolvedFromSelection = getInheritedRunProperties2($pos, editor, preferParagraphRunProperties || !hasStoredMarks && context?.isEmpty ? context?.paragraphAttrs?.paragraphProperties?.runProperties || null : inlineRunProperties);
|
|
@@ -469727,7 +469807,9 @@ function getFormattingStateAtPos2(state, pos, editor, options = {}) {
|
|
|
469727
469807
|
inlineMarks,
|
|
469728
469808
|
resolvedRunProperties,
|
|
469729
469809
|
inlineRunProperties,
|
|
469730
|
-
styleRunProperties
|
|
469810
|
+
styleRunProperties,
|
|
469811
|
+
directMarkRunProperties,
|
|
469812
|
+
mixedRunProperties: null
|
|
469731
469813
|
};
|
|
469732
469814
|
}
|
|
469733
469815
|
function getFormattingStateForRange2(state, from4, to, editor) {
|
|
@@ -469748,9 +469830,14 @@ function getFormattingStateForRange2(state, from4, to, editor) {
|
|
|
469748
469830
|
return aggregateFormattingSegments2(state, editor, segments);
|
|
469749
469831
|
}
|
|
469750
469832
|
function aggregateFormattingSegments2(state, editor, segments) {
|
|
469751
|
-
const
|
|
469752
|
-
const
|
|
469753
|
-
const
|
|
469833
|
+
const resolvedRunPropertiesList = segments.map((segment) => segment.resolvedRunProperties);
|
|
469834
|
+
const inlineRunPropertiesList = segments.map((segment) => segment.inlineRunProperties);
|
|
469835
|
+
const styleRunPropertiesList = segments.map((segment) => segment.styleRunProperties);
|
|
469836
|
+
const directMarkRunPropertiesList = segments.map((segment) => segment.directMarkRunProperties);
|
|
469837
|
+
const resolvedRunProperties = intersectRunProperties2(resolvedRunPropertiesList);
|
|
469838
|
+
const inlineRunProperties = intersectRunProperties2(inlineRunPropertiesList);
|
|
469839
|
+
const styleRunProperties = intersectRunProperties2(styleRunPropertiesList);
|
|
469840
|
+
const directMarkRunProperties = intersectRunProperties2(directMarkRunPropertiesList);
|
|
469754
469841
|
const resolvedMarks = createMarksFromRunProperties2(state, resolvedRunProperties, editor);
|
|
469755
469842
|
const inlineMarks = createMarksFromRunProperties2(state, inlineRunProperties, editor);
|
|
469756
469843
|
return {
|
|
@@ -469758,7 +469845,9 @@ function aggregateFormattingSegments2(state, editor, segments) {
|
|
|
469758
469845
|
inlineMarks,
|
|
469759
469846
|
resolvedRunProperties,
|
|
469760
469847
|
inlineRunProperties,
|
|
469761
|
-
styleRunProperties
|
|
469848
|
+
styleRunProperties,
|
|
469849
|
+
directMarkRunProperties,
|
|
469850
|
+
mixedRunProperties: getMixedRunProperties2(resolvedRunPropertiesList, directMarkRunPropertiesList)
|
|
469762
469851
|
};
|
|
469763
469852
|
}
|
|
469764
469853
|
function mergeResolvedMarksWithInlineFallback2(resolvedMarks, inlineMarks) {
|
|
@@ -469784,6 +469873,45 @@ function intersectRunProperties2(runPropertiesList) {
|
|
|
469784
469873
|
});
|
|
469785
469874
|
return Object.keys(intersection3).length ? intersection3 : null;
|
|
469786
469875
|
}
|
|
469876
|
+
function getMixedRunProperties2(runPropertiesList, directRunPropertiesList = []) {
|
|
469877
|
+
const filtered = runPropertiesList.filter((props) => props && typeof props === "object");
|
|
469878
|
+
if (filtered.length <= 1)
|
|
469879
|
+
return null;
|
|
469880
|
+
const keys7 = new Set(filtered.flatMap((props) => Object.keys(props)));
|
|
469881
|
+
const mixed = {};
|
|
469882
|
+
keys7.forEach((key2) => {
|
|
469883
|
+
if (key2 === "fontFamily" && hasUniformDirectFontFamily2(directRunPropertiesList)) {
|
|
469884
|
+
return;
|
|
469885
|
+
}
|
|
469886
|
+
const values2 = filtered.map((props) => Object.prototype.hasOwnProperty.call(props, key2) ? props[key2] : undefined);
|
|
469887
|
+
const first2 = JSON.stringify(values2[0]);
|
|
469888
|
+
if (values2.some((value) => JSON.stringify(value) !== first2)) {
|
|
469889
|
+
mixed[key2] = true;
|
|
469890
|
+
}
|
|
469891
|
+
});
|
|
469892
|
+
return Object.keys(mixed).length ? mixed : null;
|
|
469893
|
+
}
|
|
469894
|
+
function hasUniformDirectFontFamily2(runPropertiesList) {
|
|
469895
|
+
if (runPropertiesList.length <= 1)
|
|
469896
|
+
return false;
|
|
469897
|
+
let firstValue;
|
|
469898
|
+
let hasFirstValue = false;
|
|
469899
|
+
for (const props of runPropertiesList) {
|
|
469900
|
+
if (!props || typeof props !== "object" || !Object.prototype.hasOwnProperty.call(props, "fontFamily")) {
|
|
469901
|
+
return false;
|
|
469902
|
+
}
|
|
469903
|
+
const value = props.fontFamily;
|
|
469904
|
+
if (!hasFirstValue) {
|
|
469905
|
+
firstValue = value;
|
|
469906
|
+
hasFirstValue = true;
|
|
469907
|
+
continue;
|
|
469908
|
+
}
|
|
469909
|
+
if (JSON.stringify(value) !== JSON.stringify(firstValue)) {
|
|
469910
|
+
return false;
|
|
469911
|
+
}
|
|
469912
|
+
}
|
|
469913
|
+
return hasFirstValue;
|
|
469914
|
+
}
|
|
469787
469915
|
function getInheritedRunProperties2($pos, editor, inlineRunProperties) {
|
|
469788
469916
|
if (!editor) {
|
|
469789
469917
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/mcp",
|
|
3
|
-
"version": "0.12.0-next.
|
|
3
|
+
"version": "0.12.0-next.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"@types/bun": "^1.3.8",
|
|
20
20
|
"@types/node": "22.19.2",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
|
+
"@superdoc/super-editor": "0.0.1",
|
|
22
23
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
23
|
-
"superdoc": "1.43.1"
|
|
24
|
-
"@superdoc/super-editor": "0.0.1"
|
|
24
|
+
"superdoc": "1.43.1"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|