superdoc 2.0.0-next.40 → 2.0.0-next.42
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-BDAxgGrE.es.js → create-super-doc-ui-BFz0iim0.es.js} +412 -6
- package/dist/chunks/{create-super-doc-ui-kkZK7Tc-.cjs → create-super-doc-ui-DYky1UEo.cjs} +415 -6
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/templates/apply.d.ts +0 -1
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +5 -5
- package/dist/style.layered.css +5 -5
- package/dist/superdoc/src/core/types/index.d.ts +4 -1
- package/dist/superdoc.cjs +9 -9
- package/dist/superdoc.es.js +9 -9
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +35 -35
- package/package.json +2 -2
package/dist/chunks/{create-super-doc-ui-BDAxgGrE.es.js → create-super-doc-ui-BFz0iim0.es.js}
RENAMED
|
@@ -1230,6 +1230,257 @@ const decodeLayoutStoryDataset = (raw) => {
|
|
|
1230
1230
|
};
|
|
1231
1231
|
`${DOM_CLASS_NAMES.BLOCK_SDT}${DATA_ATTRS.SDT_ID}`;
|
|
1232
1232
|
`${DATA_ATTRS.DRAGGABLE}`;
|
|
1233
|
+
var schemaBooleanOrNull = () => ({ oneOf: [{ type: "boolean" }, { type: "null" }] });
|
|
1234
|
+
var schemaStringOrNull = () => ({ oneOf: [{
|
|
1235
|
+
type: "string",
|
|
1236
|
+
minLength: 1
|
|
1237
|
+
}, { type: "null" }] });
|
|
1238
|
+
var schemaNumberOrNull = () => ({ oneOf: [{ type: "number" }, { type: "null" }] });
|
|
1239
|
+
var schemaObjectOrNull = (properties) => ({ oneOf: [{
|
|
1240
|
+
type: "object",
|
|
1241
|
+
properties,
|
|
1242
|
+
additionalProperties: false,
|
|
1243
|
+
minProperties: 1
|
|
1244
|
+
}, { type: "null" }] });
|
|
1245
|
+
var UNDERLINE_OBJECT_SCHEMA = {
|
|
1246
|
+
type: "object",
|
|
1247
|
+
properties: {
|
|
1248
|
+
style: { oneOf: [{
|
|
1249
|
+
type: "string",
|
|
1250
|
+
minLength: 1
|
|
1251
|
+
}, { type: "null" }] },
|
|
1252
|
+
color: { oneOf: [{
|
|
1253
|
+
type: "string",
|
|
1254
|
+
minLength: 1
|
|
1255
|
+
}, { type: "null" }] },
|
|
1256
|
+
themeColor: { oneOf: [{
|
|
1257
|
+
type: "string",
|
|
1258
|
+
minLength: 1
|
|
1259
|
+
}, { type: "null" }] }
|
|
1260
|
+
},
|
|
1261
|
+
additionalProperties: false,
|
|
1262
|
+
minProperties: 1
|
|
1263
|
+
};
|
|
1264
|
+
var STYLISTIC_SET_ITEM_SCHEMA = {
|
|
1265
|
+
type: "object",
|
|
1266
|
+
properties: {
|
|
1267
|
+
id: { type: "number" },
|
|
1268
|
+
val: { type: "boolean" }
|
|
1269
|
+
},
|
|
1270
|
+
required: ["id"],
|
|
1271
|
+
additionalProperties: false
|
|
1272
|
+
};
|
|
1273
|
+
var schemaUnderlinePatch = () => ({ oneOf: [
|
|
1274
|
+
{ type: "boolean" },
|
|
1275
|
+
{ type: "null" },
|
|
1276
|
+
UNDERLINE_OBJECT_SCHEMA
|
|
1277
|
+
] });
|
|
1278
|
+
var schemaStylisticSets = () => ({ oneOf: [{
|
|
1279
|
+
type: "array",
|
|
1280
|
+
items: STYLISTIC_SET_ITEM_SCHEMA,
|
|
1281
|
+
minItems: 1
|
|
1282
|
+
}, { type: "null" }] });
|
|
1283
|
+
function markCarrier(markName, textStyleAttr) {
|
|
1284
|
+
return {
|
|
1285
|
+
storage: "mark",
|
|
1286
|
+
markName,
|
|
1287
|
+
textStyleAttr
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
function runAttributeCarrier(runPropertyKey) {
|
|
1291
|
+
return {
|
|
1292
|
+
storage: "runAttribute",
|
|
1293
|
+
nodeName: "run",
|
|
1294
|
+
runPropertyKey
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
var markBoolean = (key, ooxmlElement, markName) => ({
|
|
1298
|
+
key,
|
|
1299
|
+
type: "boolean",
|
|
1300
|
+
ooxmlElement,
|
|
1301
|
+
storage: "mark",
|
|
1302
|
+
tracked: true,
|
|
1303
|
+
carrier: markCarrier(markName),
|
|
1304
|
+
schema: schemaBooleanOrNull()
|
|
1305
|
+
});
|
|
1306
|
+
var markTextStyleValue = (key, type, ooxmlElement, schema, textStyleAttr) => ({
|
|
1307
|
+
key,
|
|
1308
|
+
type,
|
|
1309
|
+
ooxmlElement,
|
|
1310
|
+
storage: "mark",
|
|
1311
|
+
tracked: true,
|
|
1312
|
+
carrier: markCarrier("textStyle", textStyleAttr ?? key),
|
|
1313
|
+
schema
|
|
1314
|
+
});
|
|
1315
|
+
var runAttribute = (key, type, ooxmlElement, schema, runPropertyKey) => ({
|
|
1316
|
+
key,
|
|
1317
|
+
type,
|
|
1318
|
+
ooxmlElement,
|
|
1319
|
+
storage: "runAttribute",
|
|
1320
|
+
tracked: false,
|
|
1321
|
+
carrier: runAttributeCarrier(runPropertyKey ?? key),
|
|
1322
|
+
schema
|
|
1323
|
+
});
|
|
1324
|
+
const INLINE_PROPERTY_REGISTRY = [
|
|
1325
|
+
markBoolean("bold", "w:b", "bold"),
|
|
1326
|
+
markBoolean("italic", "w:i", "italic"),
|
|
1327
|
+
markBoolean("strike", "w:strike", "strike"),
|
|
1328
|
+
{
|
|
1329
|
+
key: "underline",
|
|
1330
|
+
type: "object",
|
|
1331
|
+
ooxmlElement: "w:u",
|
|
1332
|
+
storage: "mark",
|
|
1333
|
+
tracked: true,
|
|
1334
|
+
carrier: markCarrier("underline"),
|
|
1335
|
+
schema: schemaUnderlinePatch()
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
key: "highlight",
|
|
1339
|
+
type: "string",
|
|
1340
|
+
ooxmlElement: "w:highlight",
|
|
1341
|
+
storage: "mark",
|
|
1342
|
+
tracked: true,
|
|
1343
|
+
carrier: markCarrier("highlight"),
|
|
1344
|
+
schema: schemaStringOrNull()
|
|
1345
|
+
},
|
|
1346
|
+
markTextStyleValue("color", "string", "w:color", schemaStringOrNull()),
|
|
1347
|
+
markTextStyleValue("fontSize", "number", "w:sz", schemaNumberOrNull()),
|
|
1348
|
+
markTextStyleValue("fontFamily", "string", "w:rFonts", schemaStringOrNull()),
|
|
1349
|
+
markTextStyleValue("letterSpacing", "number", "w:spacing", schemaNumberOrNull()),
|
|
1350
|
+
markTextStyleValue("vertAlign", "string", "w:vertAlign", { oneOf: [{ enum: [
|
|
1351
|
+
"superscript",
|
|
1352
|
+
"subscript",
|
|
1353
|
+
"baseline"
|
|
1354
|
+
] }, { type: "null" }] }),
|
|
1355
|
+
markTextStyleValue("position", "number", "w:position", schemaNumberOrNull()),
|
|
1356
|
+
runAttribute("dstrike", "boolean", "w:dstrike", schemaBooleanOrNull()),
|
|
1357
|
+
runAttribute("smallCaps", "boolean", "w:smallCaps", schemaBooleanOrNull()),
|
|
1358
|
+
markTextStyleValue("caps", "boolean", "w:caps", schemaBooleanOrNull(), "textTransform"),
|
|
1359
|
+
runAttribute("shading", "object", "w:shd", schemaObjectOrNull({
|
|
1360
|
+
fill: { oneOf: [{
|
|
1361
|
+
type: "string",
|
|
1362
|
+
minLength: 1
|
|
1363
|
+
}, { type: "null" }] },
|
|
1364
|
+
color: { oneOf: [{
|
|
1365
|
+
type: "string",
|
|
1366
|
+
minLength: 1
|
|
1367
|
+
}, { type: "null" }] },
|
|
1368
|
+
val: { oneOf: [{
|
|
1369
|
+
type: "string",
|
|
1370
|
+
minLength: 1
|
|
1371
|
+
}, { type: "null" }] }
|
|
1372
|
+
})),
|
|
1373
|
+
runAttribute("border", "object", "w:bdr", schemaObjectOrNull({
|
|
1374
|
+
val: { oneOf: [{
|
|
1375
|
+
type: "string",
|
|
1376
|
+
minLength: 1
|
|
1377
|
+
}, { type: "null" }] },
|
|
1378
|
+
sz: { oneOf: [{ type: "number" }, { type: "null" }] },
|
|
1379
|
+
color: { oneOf: [{
|
|
1380
|
+
type: "string",
|
|
1381
|
+
minLength: 1
|
|
1382
|
+
}, { type: "null" }] },
|
|
1383
|
+
space: { oneOf: [{ type: "number" }, { type: "null" }] }
|
|
1384
|
+
}), "borders"),
|
|
1385
|
+
runAttribute("outline", "boolean", "w:outline", schemaBooleanOrNull()),
|
|
1386
|
+
runAttribute("shadow", "boolean", "w:shadow", schemaBooleanOrNull()),
|
|
1387
|
+
runAttribute("emboss", "boolean", "w:emboss", schemaBooleanOrNull()),
|
|
1388
|
+
runAttribute("imprint", "boolean", "w:imprint", schemaBooleanOrNull()),
|
|
1389
|
+
runAttribute("charScale", "number", "w:w", schemaNumberOrNull(), "w"),
|
|
1390
|
+
runAttribute("kerning", "number", "w:kern", schemaNumberOrNull(), "kern"),
|
|
1391
|
+
runAttribute("vanish", "boolean", "w:vanish", schemaBooleanOrNull()),
|
|
1392
|
+
runAttribute("webHidden", "boolean", "w:webHidden", schemaBooleanOrNull()),
|
|
1393
|
+
runAttribute("specVanish", "boolean", "w:specVanish", schemaBooleanOrNull()),
|
|
1394
|
+
runAttribute("rtl", "boolean", "w:rtl", schemaBooleanOrNull()),
|
|
1395
|
+
runAttribute("cs", "boolean", "w:cs", schemaBooleanOrNull()),
|
|
1396
|
+
runAttribute("bCs", "boolean", "w:bCs", schemaBooleanOrNull(), "boldCs"),
|
|
1397
|
+
runAttribute("iCs", "boolean", "w:iCs", schemaBooleanOrNull(), "italicCs"),
|
|
1398
|
+
runAttribute("eastAsianLayout", "object", "w:eastAsianLayout", schemaObjectOrNull({
|
|
1399
|
+
id: { oneOf: [{
|
|
1400
|
+
type: "string",
|
|
1401
|
+
minLength: 1
|
|
1402
|
+
}, { type: "null" }] },
|
|
1403
|
+
combine: { oneOf: [{ type: "boolean" }, { type: "null" }] },
|
|
1404
|
+
combineBrackets: { oneOf: [{
|
|
1405
|
+
type: "string",
|
|
1406
|
+
minLength: 1
|
|
1407
|
+
}, { type: "null" }] },
|
|
1408
|
+
vert: { oneOf: [{ type: "boolean" }, { type: "null" }] },
|
|
1409
|
+
vertCompress: { oneOf: [{ type: "boolean" }, { type: "null" }] }
|
|
1410
|
+
})),
|
|
1411
|
+
runAttribute("em", "string", "w:em", schemaStringOrNull()),
|
|
1412
|
+
runAttribute("fitText", "object", "w:fitText", schemaObjectOrNull({
|
|
1413
|
+
val: { oneOf: [{ type: "number" }, { type: "null" }] },
|
|
1414
|
+
id: { oneOf: [{
|
|
1415
|
+
type: "string",
|
|
1416
|
+
minLength: 1
|
|
1417
|
+
}, { type: "null" }] }
|
|
1418
|
+
})),
|
|
1419
|
+
runAttribute("snapToGrid", "boolean", "w:snapToGrid", schemaBooleanOrNull()),
|
|
1420
|
+
runAttribute("lang", "object", "w:lang", schemaObjectOrNull({
|
|
1421
|
+
val: { oneOf: [{
|
|
1422
|
+
type: "string",
|
|
1423
|
+
minLength: 1
|
|
1424
|
+
}, { type: "null" }] },
|
|
1425
|
+
eastAsia: { oneOf: [{
|
|
1426
|
+
type: "string",
|
|
1427
|
+
minLength: 1
|
|
1428
|
+
}, { type: "null" }] },
|
|
1429
|
+
bidi: { oneOf: [{
|
|
1430
|
+
type: "string",
|
|
1431
|
+
minLength: 1
|
|
1432
|
+
}, { type: "null" }] }
|
|
1433
|
+
})),
|
|
1434
|
+
runAttribute("oMath", "boolean", "w:oMath", schemaBooleanOrNull()),
|
|
1435
|
+
runAttribute("rStyle", "string", "w:rStyle", schemaStringOrNull(), "styleId"),
|
|
1436
|
+
runAttribute("rFonts", "object", "w:rFonts", schemaObjectOrNull({
|
|
1437
|
+
ascii: { oneOf: [{
|
|
1438
|
+
type: "string",
|
|
1439
|
+
minLength: 1
|
|
1440
|
+
}, { type: "null" }] },
|
|
1441
|
+
hAnsi: { oneOf: [{
|
|
1442
|
+
type: "string",
|
|
1443
|
+
minLength: 1
|
|
1444
|
+
}, { type: "null" }] },
|
|
1445
|
+
eastAsia: { oneOf: [{
|
|
1446
|
+
type: "string",
|
|
1447
|
+
minLength: 1
|
|
1448
|
+
}, { type: "null" }] },
|
|
1449
|
+
cs: { oneOf: [{
|
|
1450
|
+
type: "string",
|
|
1451
|
+
minLength: 1
|
|
1452
|
+
}, { type: "null" }] },
|
|
1453
|
+
asciiTheme: { oneOf: [{
|
|
1454
|
+
type: "string",
|
|
1455
|
+
minLength: 1
|
|
1456
|
+
}, { type: "null" }] },
|
|
1457
|
+
hAnsiTheme: { oneOf: [{
|
|
1458
|
+
type: "string",
|
|
1459
|
+
minLength: 1
|
|
1460
|
+
}, { type: "null" }] },
|
|
1461
|
+
eastAsiaTheme: { oneOf: [{
|
|
1462
|
+
type: "string",
|
|
1463
|
+
minLength: 1
|
|
1464
|
+
}, { type: "null" }] },
|
|
1465
|
+
csTheme: { oneOf: [{
|
|
1466
|
+
type: "string",
|
|
1467
|
+
minLength: 1
|
|
1468
|
+
}, { type: "null" }] },
|
|
1469
|
+
hint: { oneOf: [{
|
|
1470
|
+
type: "string",
|
|
1471
|
+
minLength: 1
|
|
1472
|
+
}, { type: "null" }] }
|
|
1473
|
+
}), "fontFamily"),
|
|
1474
|
+
runAttribute("fontSizeCs", "number", "w:szCs", schemaNumberOrNull()),
|
|
1475
|
+
runAttribute("ligatures", "string", "w14:ligatures", schemaStringOrNull()),
|
|
1476
|
+
runAttribute("numForm", "string", "w14:numForm", schemaStringOrNull()),
|
|
1477
|
+
runAttribute("numSpacing", "string", "w14:numSpacing", schemaStringOrNull()),
|
|
1478
|
+
runAttribute("stylisticSets", "array", "w14:stylisticSets", schemaStylisticSets()),
|
|
1479
|
+
runAttribute("contextualAlternates", "boolean", "w14:cntxtAlts", schemaBooleanOrNull())
|
|
1480
|
+
];
|
|
1481
|
+
new Set(INLINE_PROPERTY_REGISTRY.map((entry) => entry.key));
|
|
1482
|
+
const INLINE_PROPERTY_BY_KEY = Object.fromEntries(INLINE_PROPERTY_REGISTRY.map((entry) => [entry.key, entry]));
|
|
1483
|
+
INLINE_PROPERTY_REGISTRY.filter((entry) => entry.storage === "mark").map((entry) => entry.key), INLINE_PROPERTY_REGISTRY.filter((entry) => entry.storage === "runAttribute").map((entry) => entry.key);
|
|
1233
1484
|
var POST_DECISION_TRACKED_CHANGES_LIST_OPTIONS = Object.freeze({
|
|
1234
1485
|
mode: "background-reconcile",
|
|
1235
1486
|
refreshReason: "post-decision-background",
|
|
@@ -1872,6 +2123,12 @@ var MIRRORED_EDIT_COMMAND_IDS = {
|
|
|
1872
2123
|
undo: "history.undo",
|
|
1873
2124
|
redo: "history.redo"
|
|
1874
2125
|
};
|
|
2126
|
+
var EFFECTIVE_MARK_KEYS = [
|
|
2127
|
+
"bold",
|
|
2128
|
+
"italic",
|
|
2129
|
+
"underline",
|
|
2130
|
+
"strikethrough"
|
|
2131
|
+
];
|
|
1875
2132
|
function isProjectedInlineSelectionValueKey(value) {
|
|
1876
2133
|
return PROJECTED_INLINE_SELECTION_VALUE_KEYS.includes(value);
|
|
1877
2134
|
}
|
|
@@ -2292,6 +2549,7 @@ var CLEAR_INLINE_PATCH = {
|
|
|
2292
2549
|
letterSpacing: null,
|
|
2293
2550
|
dstrike: null
|
|
2294
2551
|
};
|
|
2552
|
+
var TRACKED_CLEAR_INLINE_PATCH = Object.fromEntries(Object.entries(CLEAR_INLINE_PATCH).filter(([key]) => INLINE_PROPERTY_BY_KEY[key]?.tracked === true));
|
|
2295
2553
|
function buildInlineFormatInput(spec, target, payload, active) {
|
|
2296
2554
|
switch (spec.kind) {
|
|
2297
2555
|
case "toggle": {
|
|
@@ -3923,6 +4181,112 @@ function createSuperDocUI(options) {
|
|
|
3923
4181
|
if (sizes.size === 1) projection.fontSize = [...sizes][0];
|
|
3924
4182
|
return projection;
|
|
3925
4183
|
};
|
|
4184
|
+
const resolveEffectiveMarkValuesFromLayout = (selection$1) => {
|
|
4185
|
+
const host = getHost();
|
|
4186
|
+
const blockIds = new Set(selectionBlockIds(selection$1));
|
|
4187
|
+
if (blockIds.size === 0) return {};
|
|
4188
|
+
const readByIds = host?.readMountedProjectionBlocksByIds;
|
|
4189
|
+
const readAll = host?.readMountedProjectionBlocks;
|
|
4190
|
+
if (typeof readByIds !== "function" && typeof readAll !== "function") return {};
|
|
4191
|
+
const blocks = safeCall(() => {
|
|
4192
|
+
if (typeof readByIds !== "function") return readAll.call(host);
|
|
4193
|
+
const story = selectionStoryLocator(selection$1);
|
|
4194
|
+
return story ? readByIds.call(host, [...blockIds], story) : readByIds.call(host, [...blockIds]);
|
|
4195
|
+
}, null);
|
|
4196
|
+
if (!Array.isArray(blocks)) return {};
|
|
4197
|
+
const flatBlocks = collectProjectionTextBlocks(blocks);
|
|
4198
|
+
const runMarkValues = (run) => ({
|
|
4199
|
+
bold: run.bold === true,
|
|
4200
|
+
italic: run.italic === true,
|
|
4201
|
+
underline: run.underline != null,
|
|
4202
|
+
strikethrough: run.strike === true
|
|
4203
|
+
});
|
|
4204
|
+
const collapseMarkSets = (sets) => {
|
|
4205
|
+
const out = {};
|
|
4206
|
+
for (const key of EFFECTIVE_MARK_KEYS) {
|
|
4207
|
+
const set = sets[key];
|
|
4208
|
+
if (set.size === 1) out[key] = [...set][0];
|
|
4209
|
+
}
|
|
4210
|
+
return out;
|
|
4211
|
+
};
|
|
4212
|
+
const caret = collapsedTextAddressFromSelection(selection$1);
|
|
4213
|
+
const caretOffset = caret && typeof caret.range?.start === "number" ? caret.range.start : null;
|
|
4214
|
+
if (caret && caretOffset !== null && blockIds.has(caret.blockId)) {
|
|
4215
|
+
const block = flatBlocks.find((b) => projectionBlockMatchesId(b, caret.blockId));
|
|
4216
|
+
const runs = block && Array.isArray(block.runs) ? block.runs : null;
|
|
4217
|
+
if (runs && runs.length > 0 && runs.every((r) => r?.kind === "text" || r?.kind === "tab")) {
|
|
4218
|
+
let acc = 0;
|
|
4219
|
+
let chosen = null;
|
|
4220
|
+
for (const run of runs) {
|
|
4221
|
+
const len = typeof run.text === "string" ? run.text.length : 0;
|
|
4222
|
+
if (caretOffset >= acc && caretOffset < acc + len) {
|
|
4223
|
+
chosen = run;
|
|
4224
|
+
break;
|
|
4225
|
+
}
|
|
4226
|
+
acc += len;
|
|
4227
|
+
}
|
|
4228
|
+
if (!chosen) {
|
|
4229
|
+
for (let i = runs.length - 1; i >= 0 && !chosen; i -= 1) if (runs[i]?.kind === "text") chosen = runs[i];
|
|
4230
|
+
chosen ??= runs[runs.length - 1] ?? null;
|
|
4231
|
+
}
|
|
4232
|
+
if (!chosen) return {};
|
|
4233
|
+
return runMarkValues(chosen);
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
const segments = selectionTextSegments(selection$1);
|
|
4237
|
+
if (segments.length > 0) {
|
|
4238
|
+
const rangeSets = {
|
|
4239
|
+
bold: /* @__PURE__ */ new Set(),
|
|
4240
|
+
italic: /* @__PURE__ */ new Set(),
|
|
4241
|
+
underline: /* @__PURE__ */ new Set(),
|
|
4242
|
+
strikethrough: /* @__PURE__ */ new Set()
|
|
4243
|
+
};
|
|
4244
|
+
let rangeSawRun = false;
|
|
4245
|
+
let offsetSafe = true;
|
|
4246
|
+
for (const seg of segments) {
|
|
4247
|
+
const block = flatBlocks.find((b) => projectionBlockMatchesId(b, seg.blockId));
|
|
4248
|
+
if (!block) return {};
|
|
4249
|
+
const runs = Array.isArray(block.runs) ? block.runs : [];
|
|
4250
|
+
if (runs.length === 0) continue;
|
|
4251
|
+
if (!runs.every((r) => r?.kind === "text" || r?.kind === "tab")) {
|
|
4252
|
+
offsetSafe = false;
|
|
4253
|
+
break;
|
|
4254
|
+
}
|
|
4255
|
+
let acc = 0;
|
|
4256
|
+
for (const run of runs) {
|
|
4257
|
+
const len = typeof run.text === "string" ? run.text.length : 0;
|
|
4258
|
+
const runStart = acc;
|
|
4259
|
+
const runEnd = acc + len;
|
|
4260
|
+
if (runStart < seg.end && runEnd > seg.start) {
|
|
4261
|
+
rangeSawRun = true;
|
|
4262
|
+
const values = runMarkValues(run);
|
|
4263
|
+
for (const key of EFFECTIVE_MARK_KEYS) rangeSets[key].add(values[key]);
|
|
4264
|
+
}
|
|
4265
|
+
acc = runEnd;
|
|
4266
|
+
}
|
|
4267
|
+
}
|
|
4268
|
+
if (offsetSafe && rangeSawRun) return collapseMarkSets(rangeSets);
|
|
4269
|
+
}
|
|
4270
|
+
const wholeSets = {
|
|
4271
|
+
bold: /* @__PURE__ */ new Set(),
|
|
4272
|
+
italic: /* @__PURE__ */ new Set(),
|
|
4273
|
+
underline: /* @__PURE__ */ new Set(),
|
|
4274
|
+
strikethrough: /* @__PURE__ */ new Set()
|
|
4275
|
+
};
|
|
4276
|
+
let sawWholeRun = false;
|
|
4277
|
+
for (const block of flatBlocks) {
|
|
4278
|
+
if (![...blockIds].some((id) => projectionBlockMatchesId(block, id))) continue;
|
|
4279
|
+
const runs = Array.isArray(block.runs) ? block.runs : [];
|
|
4280
|
+
for (const run of runs) {
|
|
4281
|
+
if (run?.kind !== "text") continue;
|
|
4282
|
+
sawWholeRun = true;
|
|
4283
|
+
const values = runMarkValues(run);
|
|
4284
|
+
for (const key of EFFECTIVE_MARK_KEYS) wholeSets[key].add(values[key]);
|
|
4285
|
+
}
|
|
4286
|
+
}
|
|
4287
|
+
if (!sawWholeRun) return {};
|
|
4288
|
+
return collapseMarkSets(wholeSets);
|
|
4289
|
+
};
|
|
3926
4290
|
const completeProjectedInlineValues = (selection$1, direct) => {
|
|
3927
4291
|
if (direct.fontFamily !== void 0 && direct.fontSize !== void 0 && direct.color !== void 0 && direct.highlight !== void 0) return {
|
|
3928
4292
|
values: direct,
|
|
@@ -3952,21 +4316,33 @@ function createSuperDocUI(options) {
|
|
|
3952
4316
|
effectiveUniformityStatus: "ready"
|
|
3953
4317
|
};
|
|
3954
4318
|
};
|
|
3955
|
-
const
|
|
4319
|
+
const EFFECTIVE_INLINE_UNIFORMITY_KEYS = [
|
|
4320
|
+
"fontFamily",
|
|
4321
|
+
"fontSize",
|
|
4322
|
+
"bold",
|
|
4323
|
+
"italic",
|
|
4324
|
+
"underline",
|
|
4325
|
+
"strikethrough"
|
|
4326
|
+
];
|
|
4327
|
+
const readEffectiveInlineUniformityCached = (selection$1) => {
|
|
3956
4328
|
const target = selection$1.selectionTarget;
|
|
3957
4329
|
if (!target) return {
|
|
3958
|
-
|
|
4330
|
+
value: null,
|
|
3959
4331
|
status: "ready"
|
|
3960
4332
|
};
|
|
3961
4333
|
const op = resolveDocOperation(getDoc(), "format.readEffectiveInlineUniformity");
|
|
3962
4334
|
if (!op) return {
|
|
3963
|
-
|
|
4335
|
+
value: null,
|
|
3964
4336
|
status: "ready"
|
|
3965
4337
|
};
|
|
3966
|
-
|
|
4338
|
+
return readAsync(`effInline:${selectionEffectiveUniformitySignature(selection$1) ?? selectionSignature(selection$1)}`, contentToken(), () => op({
|
|
3967
4339
|
target,
|
|
3968
|
-
offsetSpace: "selection"
|
|
4340
|
+
offsetSpace: "selection",
|
|
4341
|
+
keys: EFFECTIVE_INLINE_UNIFORMITY_KEYS
|
|
3969
4342
|
}), (raw) => raw && typeof raw === "object" ? raw : null);
|
|
4343
|
+
};
|
|
4344
|
+
const resolveEffectiveInlineUniformityValues = (selection$1) => {
|
|
4345
|
+
const { value, status } = readEffectiveInlineUniformityCached(selection$1);
|
|
3970
4346
|
if (!value || value.success !== true) return {
|
|
3971
4347
|
values: null,
|
|
3972
4348
|
status
|
|
@@ -3985,6 +4361,33 @@ function createSuperDocUI(options) {
|
|
|
3985
4361
|
status
|
|
3986
4362
|
};
|
|
3987
4363
|
};
|
|
4364
|
+
const resolveEffectiveMarkUniformityValues = (selection$1) => {
|
|
4365
|
+
const { value, status } = readEffectiveInlineUniformityCached(selection$1);
|
|
4366
|
+
if (!value || value.success !== true) return {
|
|
4367
|
+
values: null,
|
|
4368
|
+
status
|
|
4369
|
+
};
|
|
4370
|
+
const states = value.values;
|
|
4371
|
+
const values = {};
|
|
4372
|
+
for (const key of EFFECTIVE_MARK_KEYS) {
|
|
4373
|
+
const entry = states?.[key];
|
|
4374
|
+
if (entry?.state === "uniform" && (entry.value === "true" || entry.value === "false")) values[key] = entry.value === "true";
|
|
4375
|
+
}
|
|
4376
|
+
return {
|
|
4377
|
+
values,
|
|
4378
|
+
status
|
|
4379
|
+
};
|
|
4380
|
+
};
|
|
4381
|
+
const effectiveMarkActiveState = (descriptor, selection$1) => {
|
|
4382
|
+
const mark = descriptor.activeMark;
|
|
4383
|
+
if (!mark || !EFFECTIVE_MARK_KEYS.includes(mark)) return null;
|
|
4384
|
+
const key = mark;
|
|
4385
|
+
const fromLayout = resolveEffectiveMarkValuesFromLayout(selection$1)[key];
|
|
4386
|
+
if (fromLayout !== void 0) return fromLayout;
|
|
4387
|
+
const { values } = resolveEffectiveMarkUniformityValues(selection$1);
|
|
4388
|
+
const fromWorker = values?.[key];
|
|
4389
|
+
return fromWorker !== void 0 ? fromWorker : null;
|
|
4390
|
+
};
|
|
3988
4391
|
const readEffectiveInlineUniformityNow = async (selection$1) => {
|
|
3989
4392
|
const target = selection$1.selectionTarget;
|
|
3990
4393
|
if (!target) return null;
|
|
@@ -4353,6 +4756,8 @@ function createSuperDocUI(options) {
|
|
|
4353
4756
|
const optimistic = optimisticInlineToggles.get(descriptor.id);
|
|
4354
4757
|
const selectionSignature$1 = selectionInlineValueSignature(selection$1);
|
|
4355
4758
|
if (selectionSignature$1 && optimistic?.selectionSignature === selectionSignature$1) return optimistic.active;
|
|
4759
|
+
const effective = effectiveMarkActiveState(descriptor, selection$1);
|
|
4760
|
+
if (effective !== null) return effective;
|
|
4356
4761
|
return commandIsActive(descriptor, selection$1);
|
|
4357
4762
|
};
|
|
4358
4763
|
const routedCommandValue = (descriptor, doc, selection$1, projectedInlineValues) => {
|
|
@@ -5621,6 +6026,7 @@ function createSuperDocUI(options) {
|
|
|
5621
6026
|
if (UNSUPPORTED_TRACKED_UI_MUTATION_ROUTES.has(route)) return unsupportedTrackedMutationReceipt(route);
|
|
5622
6027
|
return { changeMode: "tracked" };
|
|
5623
6028
|
};
|
|
6029
|
+
const clearInlinePatchForMode = () => readDocumentMode() === "suggesting" ? TRACKED_CLEAR_INLINE_PATCH : CLEAR_INLINE_PATCH;
|
|
5624
6030
|
const callEditorMutation = (route, op, input) => {
|
|
5625
6031
|
const options$1 = editorMutationOptionsForRoute(route);
|
|
5626
6032
|
if (options$1 && options$1.success === false) return options$1;
|
|
@@ -5877,7 +6283,7 @@ function createSuperDocUI(options) {
|
|
|
5877
6283
|
if (inlineOp) try {
|
|
5878
6284
|
record(callInlineFormatMutation("format.apply", inlineOp, {
|
|
5879
6285
|
target: rangeTarget,
|
|
5880
|
-
inline: { ...
|
|
6286
|
+
inline: { ...clearInlinePatchForMode() }
|
|
5881
6287
|
}));
|
|
5882
6288
|
} catch {
|
|
5883
6289
|
immediateResults.push(false);
|