@stll/docx-core 0.45.1 → 0.47.0
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/ops/documentOps.d.ts +30 -6
- package/dist/ops/documentOps.js +493 -251
- package/package.json +1 -1
|
@@ -1522,7 +1522,11 @@ export declare class DocumentOpRefusal extends DocumentOpRefusalBase<{
|
|
|
1522
1522
|
message: string;
|
|
1523
1523
|
reason: DocumentOpRefusalReason;
|
|
1524
1524
|
opType: DocumentOpType | undefined;
|
|
1525
|
-
/**
|
|
1525
|
+
/**
|
|
1526
|
+
* Paragraph-mark revision whose resolution the document blocks: it would
|
|
1527
|
+
* move text across a standing range boundary, or leave its container
|
|
1528
|
+
* without a final paragraph.
|
|
1529
|
+
*/
|
|
1526
1530
|
blockedParagraphMarkRevisionId?: number;
|
|
1527
1531
|
}> {}
|
|
1528
1532
|
/**
|
|
@@ -2018,18 +2022,22 @@ export declare const captureDocumentOp: (op: DocumentOp) => DocumentOp;
|
|
|
2018
2022
|
* one suggestion. A reply is removed with the comment it answers.
|
|
2019
2023
|
*/
|
|
2020
2024
|
export declare const suggestedCommentIds: (document: Document, suggestionId?: string) => number[];
|
|
2025
|
+
type PendingSuggestionProjectionOptions = {
|
|
2026
|
+
/** Host receipts also identify comments belonging to a pending proposal. */
|
|
2027
|
+
commentIds?: ReadonlySet<number>;
|
|
2028
|
+
onAbsorptions?: (story: OpStory, absorptions: readonly ParagraphAbsorption[]) => void;
|
|
2029
|
+
};
|
|
2021
2030
|
/**
|
|
2022
2031
|
* The document as a save writes it: every pending suggestion rejected. A
|
|
2023
2032
|
* suggestion is a proposal the host holds, not a change in the file, so the
|
|
2024
2033
|
* file reads as if it had never been made; ordinary tracked changes stay. A
|
|
2025
2034
|
* comment a suggestion proposes is left out with it.
|
|
2026
2035
|
*/
|
|
2027
|
-
export declare const withoutPendingSuggestions: (document: Document) => Result<Document, DocumentOpRefusal>;
|
|
2028
|
-
/**
|
|
2029
|
-
* The revisions of one pending suggestion in a story, one info per revision
|
|
2030
|
-
* id, in document order.
|
|
2031
|
-
*/
|
|
2036
|
+
export declare const withoutPendingSuggestions: (document: Document, { commentIds, onAbsorptions }?: PendingSuggestionProjectionOptions) => Result<Document, DocumentOpRefusal>;
|
|
2037
|
+
/** Revisions of one pending suggestion, one info per ID in document order. */
|
|
2032
2038
|
export declare const suggestionRevisionInfos: (document: Document, story: OpStory, suggestionId: string) => TrackedChangeInfo[];
|
|
2039
|
+
/** The first proposal owning each physical revision ID in this story. */
|
|
2040
|
+
export declare const suggestionOwnersInStory: (document: Document, story: OpStory) => ReadonlyMap<number, string>;
|
|
2033
2041
|
/**
|
|
2034
2042
|
* The ids of every pending suggestion in a document, in every story, and of
|
|
2035
2043
|
* every suggestion that proposes a comment.
|
|
@@ -2260,6 +2268,22 @@ type EditorIntent = HyperlinkEditorIntent | GenerateTOCIntent | {
|
|
|
2260
2268
|
paragraphs: readonly Paragraph[];
|
|
2261
2269
|
openStart: 0 | 1;
|
|
2262
2270
|
openEnd: 0 | 1;
|
|
2271
|
+
} | {
|
|
2272
|
+
/**
|
|
2273
|
+
* Blocks, tables among them, dragged from a range to a target. The
|
|
2274
|
+
* tables standing wholly between `from` and `to` are removed, or in
|
|
2275
|
+
* suggesting mode recorded as deleted, the text of the range is
|
|
2276
|
+
* deleted as `moveFragment` deletes it, and the blocks go in at the
|
|
2277
|
+
* target as `pasteBlocks` places them, a suggestion recording them as
|
|
2278
|
+
* inserted. Without a table it is `moveFragment`.
|
|
2279
|
+
*/
|
|
2280
|
+
type: "moveBlocks";
|
|
2281
|
+
from: TextPosition;
|
|
2282
|
+
to: TextPosition;
|
|
2283
|
+
target: TextPosition;
|
|
2284
|
+
blocks: readonly (Paragraph | Table)[];
|
|
2285
|
+
openStart: 0 | 1;
|
|
2286
|
+
openEnd: 0 | 1;
|
|
2263
2287
|
} | {
|
|
2264
2288
|
type: "replaceText";
|
|
2265
2289
|
from: TextPosition;
|
package/dist/ops/documentOps.js
CHANGED
|
@@ -381,16 +381,16 @@ const ROOT_CONTEXT = {
|
|
|
381
381
|
ownerType: void 0
|
|
382
382
|
};
|
|
383
383
|
const censusWalker = (ownKeys, sharing) => {
|
|
384
|
-
const known = /* @__PURE__ */ new
|
|
384
|
+
const known = /* @__PURE__ */ new Map();
|
|
385
385
|
const remembered = (value, key, census) => {
|
|
386
386
|
if (key === void 0 || !census.shareable) return census;
|
|
387
|
-
const keys = census.keys
|
|
388
|
-
let
|
|
389
|
-
if (
|
|
390
|
-
|
|
391
|
-
known.set(
|
|
387
|
+
const keys = Object.isFrozen(census.keys) ? census.keys : Object.freeze([...census.keys]);
|
|
388
|
+
let byRecord = known.get(key);
|
|
389
|
+
if (byRecord === void 0) {
|
|
390
|
+
byRecord = /* @__PURE__ */ new WeakMap();
|
|
391
|
+
known.set(key, byRecord);
|
|
392
392
|
}
|
|
393
|
-
|
|
393
|
+
byRecord.set(value, keys);
|
|
394
394
|
return {
|
|
395
395
|
keys,
|
|
396
396
|
shareable: true
|
|
@@ -401,7 +401,7 @@ const censusWalker = (ownKeys, sharing) => {
|
|
|
401
401
|
const isList = Array.isArray(value) || value instanceof Map;
|
|
402
402
|
if (!isList && !isPlainRecord$1(value)) return EMPTY_CENSUS;
|
|
403
403
|
const key = sharing === "full" ? void 0 : contextKey(context);
|
|
404
|
-
const cached = key === void 0 ? void 0 : known.get(
|
|
404
|
+
const cached = key === void 0 ? void 0 : known.get(key)?.get(value);
|
|
405
405
|
if (cached !== void 0) return {
|
|
406
406
|
keys: cached,
|
|
407
407
|
shareable: true
|
|
@@ -9498,13 +9498,17 @@ const deleteBlocks = ({ document, op, applyOps }) => {
|
|
|
9498
9498
|
}]);
|
|
9499
9499
|
if (rejected.isErr()) return refuse(rejected.error.reason, rejected.error.message);
|
|
9500
9500
|
const { document: retracted, inverse, touched } = rejected.value;
|
|
9501
|
-
if ((broken.propertyChanges?.length ?? 0) === 0) return Result.ok({
|
|
9502
|
-
document: retracted,
|
|
9503
|
-
inverse,
|
|
9504
|
-
touched
|
|
9505
|
-
});
|
|
9506
9501
|
const survivor = storyParagraphs(storyBody$1(retracted, op.story)).find(({ paragraph }) => idKey(paragraph.paraId ?? "") === idKey(broken.paraId ?? ""))?.paragraph ?? panic("A taken-back insertion lost the paragraph it broke.");
|
|
9507
9502
|
const { pPrMark: _addedMark, ...restyle } = reviewFieldsOf(broken);
|
|
9503
|
+
if (!broken.propertyChanges?.length) {
|
|
9504
|
+
const recorded = last.paragraph.propertyChanges?.[0];
|
|
9505
|
+
if (!recorded || sameParagraphProperties(survivor.formatting, broken.formatting)) return Result.ok({
|
|
9506
|
+
document: retracted,
|
|
9507
|
+
inverse,
|
|
9508
|
+
touched
|
|
9509
|
+
});
|
|
9510
|
+
restyle.propertyChanges = [paragraphPropertyChange$1(recorded.info, survivor, restyle.formatting)];
|
|
9511
|
+
}
|
|
9508
9512
|
const kept = applyOps(retracted, [{
|
|
9509
9513
|
type: DOCUMENT_OP_TYPES.SET_PARAGRAPH_REVIEW,
|
|
9510
9514
|
story: op.story,
|
|
@@ -14316,9 +14320,65 @@ const withMergesEnded = (table, rowIndex) => {
|
|
|
14316
14320
|
cells
|
|
14317
14321
|
};
|
|
14318
14322
|
};
|
|
14323
|
+
const BOUNDARIES = rangeBoundaryDefinitions();
|
|
14324
|
+
/** Every range boundary in `value`, at any depth, in source order. */
|
|
14325
|
+
const boundariesIn = (value, out = []) => {
|
|
14326
|
+
if (typeof value !== "object" || value === null) return out;
|
|
14327
|
+
const type = Reflect.get(value, "type");
|
|
14328
|
+
if (typeof type === "string" && Object.hasOwn(BOUNDARIES, type)) out.push(value);
|
|
14329
|
+
else for (const field of Object.values(value)) boundariesIn(field, out);
|
|
14330
|
+
return out;
|
|
14331
|
+
};
|
|
14332
|
+
/**
|
|
14333
|
+
* The range boundaries in `removed`, other than those `kept` still holds,
|
|
14334
|
+
* whose other end stands outside it. Removed content takes its words, not
|
|
14335
|
+
* the end of a range reaching past it: these ends stay where it was. A range
|
|
14336
|
+
* wholly inside goes with it.
|
|
14337
|
+
*/
|
|
14338
|
+
const rangeEndsReachingPast = (removed, kept) => {
|
|
14339
|
+
const keeps = new Set(boundariesIn(kept));
|
|
14340
|
+
const key = (node) => `${BOUNDARIES[node.type].family}:${node.id}`;
|
|
14341
|
+
const lost = boundariesIn(removed).filter((node) => !keeps.has(node));
|
|
14342
|
+
return lost.filter((node) => lost.filter((other) => key(other) === key(node)).length === 1);
|
|
14343
|
+
};
|
|
14344
|
+
/**
|
|
14345
|
+
* `rows` with the ends of ranges reaching past the removed row
|
|
14346
|
+
* ({@link rangeEndsReachingPast}) where the row was: at the start of the row
|
|
14347
|
+
* after it, else at the end of the row before. With no row left the table
|
|
14348
|
+
* goes, and its removal keeps them.
|
|
14349
|
+
*/
|
|
14350
|
+
const withRangeEndsKept = (removed, rows, rowIndex) => {
|
|
14351
|
+
const ends = rangeEndsReachingPast(removed, rows[rowIndex]);
|
|
14352
|
+
const after = rowIndex < rows.length;
|
|
14353
|
+
const at = after ? rowIndex : rowIndex - 1;
|
|
14354
|
+
const row = rows[at];
|
|
14355
|
+
const cellAt = after ? 0 : (row?.cells.length ?? 0) - 1;
|
|
14356
|
+
const cell = row?.cells[cellAt];
|
|
14357
|
+
if (ends.length === 0 || row === void 0 || cell === void 0) return rows;
|
|
14358
|
+
const content = [...cell.content];
|
|
14359
|
+
const index = after ? content.findIndex((block) => block.type === "paragraph") : content.findLastIndex((block) => block.type === "paragraph");
|
|
14360
|
+
const paragraph = content[index];
|
|
14361
|
+
if (paragraph?.type !== "paragraph") return rows;
|
|
14362
|
+
content[index] = {
|
|
14363
|
+
...paragraph,
|
|
14364
|
+
content: after ? [...ends, ...paragraph.content] : [...paragraph.content, ...ends]
|
|
14365
|
+
};
|
|
14366
|
+
const cells = [...row.cells];
|
|
14367
|
+
cells[cellAt] = {
|
|
14368
|
+
...cell,
|
|
14369
|
+
content
|
|
14370
|
+
};
|
|
14371
|
+
const out = [...rows];
|
|
14372
|
+
out[at] = {
|
|
14373
|
+
...row,
|
|
14374
|
+
cells
|
|
14375
|
+
};
|
|
14376
|
+
return out;
|
|
14377
|
+
};
|
|
14319
14378
|
/**
|
|
14320
14379
|
* The table's rows without row `rowIndex`: the merges it starts handed on,
|
|
14321
|
-
*
|
|
14380
|
+
* those it alone continues ended, and the ends of ranges reaching past it
|
|
14381
|
+
* kept.
|
|
14322
14382
|
*/
|
|
14323
14383
|
const rowsWithoutRow = (table, rowIndex) => {
|
|
14324
14384
|
const rows = [...table.rows];
|
|
@@ -14327,7 +14387,8 @@ const rowsWithoutRow = (table, rowIndex) => {
|
|
|
14327
14387
|
const next = withMergesHandedOn(table, rowIndex);
|
|
14328
14388
|
if (next === void 0) rows.splice(rowIndex, 1);
|
|
14329
14389
|
else rows.splice(rowIndex, 2, next);
|
|
14330
|
-
|
|
14390
|
+
const removed = table.rows[rowIndex];
|
|
14391
|
+
return removed === void 0 ? rows : withRangeEndsKept(removed, rows, rowIndex);
|
|
14331
14392
|
};
|
|
14332
14393
|
/**
|
|
14333
14394
|
* Whether taking rows out left a vertical merge without the cell that starts
|
|
@@ -16284,7 +16345,7 @@ const withRejoinedBlockers = ({ nodes, retired, resolution }) => {
|
|
|
16284
16345
|
}
|
|
16285
16346
|
}
|
|
16286
16347
|
if (children === void 0) next = withKeptCutHoldersRenamed(next, successor);
|
|
16287
|
-
if (next !== node) carryResolutionState(resolution, node, next);
|
|
16348
|
+
if (next !== node && resolution !== void 0) carryResolutionState(resolution, node, next);
|
|
16288
16349
|
return next;
|
|
16289
16350
|
};
|
|
16290
16351
|
return nodes.map(rewrite);
|
|
@@ -16359,7 +16420,11 @@ const cutReach = ({ before, after, depth, spanning, resolution }) => {
|
|
|
16359
16420
|
const node = chains[side][index];
|
|
16360
16421
|
if (node === void 0 || !isTrackedWrapper(node) || !resolution.ids.has(node.info.id) || !removesContent(node, resolution.decision)) return false;
|
|
16361
16422
|
const chain = edgeChainPastRemoved(chains[side], index, side === "before" ? "end" : "start");
|
|
16362
|
-
if (chain === void 0)
|
|
16423
|
+
if (chain === void 0) {
|
|
16424
|
+
const parent = chains[side][index - 1];
|
|
16425
|
+
if (parent !== void 0 && childNodes(parent)?.length === 1) reach.gone = true;
|
|
16426
|
+
return false;
|
|
16427
|
+
}
|
|
16363
16428
|
chains[side] = chain;
|
|
16364
16429
|
return true;
|
|
16365
16430
|
};
|
|
@@ -17848,6 +17913,14 @@ const resolveList = ({ nodes: listed, resolution, path }) => {
|
|
|
17848
17913
|
if (inner.edges.first !== void 0) edges.first = inner.edges.first + 1;
|
|
17849
17914
|
if (inner.edges.last !== void 0) edges.last = inner.edges.last + 1;
|
|
17850
17915
|
resolution.cutEdges.set(rebuilt, edges);
|
|
17916
|
+
if ((rebuilt.type === "deletion" || rebuilt.type === "moveFrom") && rebuilt.resolutionJoins !== void 0) {
|
|
17917
|
+
const joins = rebuilt.resolutionJoins;
|
|
17918
|
+
rebuilt = Object.assign({}, rebuilt, { resolutionJoins: Object.assign({}, joins, {
|
|
17919
|
+
before: Math.max(joins.before, inner.edges.first ?? 0),
|
|
17920
|
+
after: Math.max(joins.after, inner.edges.last ?? 0)
|
|
17921
|
+
}) });
|
|
17922
|
+
resolution.cutEdges.set(rebuilt, edges);
|
|
17923
|
+
}
|
|
17851
17924
|
}
|
|
17852
17925
|
appendSource(rebuilt, index);
|
|
17853
17926
|
}
|
|
@@ -19029,7 +19102,10 @@ const joinOps = (document, { op, story, paraId, revisionId, added, depth, holder
|
|
|
19029
19102
|
})) rejoined.set(id, into);
|
|
19030
19103
|
const keepsFirst = paragraph.pPrMark?.survivor === "first";
|
|
19031
19104
|
ends.set(keepsFirst ? idKey(paraId) : nextId, emptiedEndsOf(merged, emptied));
|
|
19032
|
-
const mergedContent = asParagraphContent(
|
|
19105
|
+
const mergedContent = asParagraphContent(withRejoinedBlockers({
|
|
19106
|
+
nodes: merged,
|
|
19107
|
+
retired: rejoined
|
|
19108
|
+
}));
|
|
19033
19109
|
let survivor;
|
|
19034
19110
|
if (keepsFirst) survivor = joinedKeepingFirst(paragraph, next, mergedContent);
|
|
19035
19111
|
else if (structurallyEqual(mergedContent, next.content)) survivor = next;
|
|
@@ -19103,7 +19179,7 @@ const joinOps = (document, { op, story, paraId, revisionId, added, depth, holder
|
|
|
19103
19179
|
...paragraph,
|
|
19104
19180
|
content: [...joining, paragraph].flatMap(({ content }) => content)
|
|
19105
19181
|
};
|
|
19106
|
-
const goesBeforeBlock = follows === "block" && added &&
|
|
19182
|
+
const goesBeforeBlock = follows === "block" && added && blocks.some((block) => block.type === "paragraph" && block !== paragraph && !joining.includes(block));
|
|
19107
19183
|
const outcome = paragraphMarkOutcome({
|
|
19108
19184
|
follows,
|
|
19109
19185
|
holdsContent: paragraphHoldsContent(chained),
|
|
@@ -19120,7 +19196,12 @@ const joinOps = (document, { op, story, paraId, revisionId, added, depth, holder
|
|
|
19120
19196
|
emptyInsertedTableBoundary: tableBoundary?.type === "blocked" && tableBoundary.reason === "review" ? "pendingReview" : "unavailable",
|
|
19121
19197
|
precededByBlock: location.index > 0
|
|
19122
19198
|
});
|
|
19123
|
-
if (outcome.kind === "refuse") return Result.err(
|
|
19199
|
+
if (outcome.kind === "refuse") return Result.err(new DocumentOpRefusal({
|
|
19200
|
+
opType: op.type,
|
|
19201
|
+
reason: outcome.reason,
|
|
19202
|
+
message: `Resolving the mark of ${paraId} would leave its container without a final paragraph.`,
|
|
19203
|
+
blockedParagraphMarkRevisionId: revisionId
|
|
19204
|
+
}));
|
|
19124
19205
|
const tableOutcome = outcome.kind === "remove" && runInReceiver !== void 0 && paragraph.content.length > 0 && ranInto.has(idKey(runInReceiver.paraId ?? "")) ? "run-in" : outcome.kind;
|
|
19125
19206
|
if (standing.length > 0 && tableOutcome === "run-in" && !followsBlock) return Result.err(new DocumentOpRefusal({
|
|
19126
19207
|
opType: op.type,
|
|
@@ -19297,7 +19378,7 @@ const removeEmptiedHolder = ({ document, story, paraId, applyOps }) => {
|
|
|
19297
19378
|
if (paragraph.content.length > 0 || paragraph.pPrMark !== void 0 || paragraph.sectionProperties !== void 0) return Result.ok(void 0);
|
|
19298
19379
|
const anchor = blocks.find((block, position) => position !== index && block.type === "paragraph");
|
|
19299
19380
|
const endsControl = index > 0 && index === blocks.length - 1 && list.at(-1)?.kind === "blockSdt" && !endsItsContainer(body, location);
|
|
19300
|
-
const standsBeforeBlock = anchor !== void 0 && isOpaqueFollower(blockFollower(blocks, index).block)
|
|
19381
|
+
const standsBeforeBlock = anchor !== void 0 && isOpaqueFollower(blockFollower(blocks, index).block);
|
|
19301
19382
|
if (!endsControl && !standsBeforeBlock && !opensSectionBeforeTrailingBoundaries(blocks, index)) return Result.ok(void 0);
|
|
19302
19383
|
const removed = applyOps(document, [anchor === void 0 ? {
|
|
19303
19384
|
type: DOCUMENT_OP_TYPES.REPLACE_BLOCKS,
|
|
@@ -19897,7 +19978,7 @@ const planSingleRecordResolution = ({ document, op, applyOps }, paragraphs) => {
|
|
|
19897
19978
|
const key = idKey(candidate.paraId ?? "");
|
|
19898
19979
|
const firstCut = resolvedCutEdges.get(key)?.first ?? 0;
|
|
19899
19980
|
const mark = candidate.pPrMark;
|
|
19900
|
-
if ((resolvedContents.get(key)
|
|
19981
|
+
if (!(resolvedContents.get(key) ?? []).every(isKeptBoundaryCarrier) || mark === void 0 || !markWasAdded(mark.kind)) {
|
|
19901
19982
|
suffix = {
|
|
19902
19983
|
leadingCut: firstCut,
|
|
19903
19984
|
chainCut: 0
|
|
@@ -20469,9 +20550,9 @@ const tableEditBoundaryRefusal = (op) => {
|
|
|
20469
20550
|
// src/ops/tableEditDependencies.ts
|
|
20470
20551
|
/**
|
|
20471
20552
|
* Records a removed column cell cannot take with it: comments and moves pair
|
|
20472
|
-
* with records outside the cell, and captured markup is opaque.
|
|
20473
|
-
*
|
|
20474
|
-
* words go with the cell
|
|
20553
|
+
* with records outside the cell, and captured markup is opaque. Bookmarks
|
|
20554
|
+
* wholly in the cell, content controls and the review records of the cell's
|
|
20555
|
+
* own words go with the cell.
|
|
20475
20556
|
*/
|
|
20476
20557
|
const REACHING_TYPES = /* @__PURE__ */ new Set([
|
|
20477
20558
|
"commentRangeStart",
|
|
@@ -21269,8 +21350,17 @@ const applyTableOp = (document, op) => {
|
|
|
21269
21350
|
message: "Removing a table requires a surviving paragraph in its block list."
|
|
21270
21351
|
});
|
|
21271
21352
|
const blocks = [...blockListAt(body.content, location.list)];
|
|
21272
|
-
if (op.revision === void 0)
|
|
21273
|
-
|
|
21353
|
+
if (op.revision === void 0) {
|
|
21354
|
+
blocks.splice(location.index, 1);
|
|
21355
|
+
const ends = rangeEndsReachingPast(location.table);
|
|
21356
|
+
const before = blocks[location.index - 1]?.type === "paragraph";
|
|
21357
|
+
const at = before ? location.index - 1 : blocks.findIndex((block, index) => index >= location.index && block.type === "paragraph");
|
|
21358
|
+
const host = blocks[at];
|
|
21359
|
+
if (ends.length > 0 && host?.type === "paragraph") blocks[at] = {
|
|
21360
|
+
...host,
|
|
21361
|
+
content: before ? [...host.content, ...ends] : [...ends, ...host.content]
|
|
21362
|
+
};
|
|
21363
|
+
} else {
|
|
21274
21364
|
if (location.table.preserved !== void 0 || location.table.bookmarks !== void 0 || location.table.carrierStack !== void 0 || (location.table.propertyChanges?.length ?? 0) > 0) return refuse$4({
|
|
21275
21365
|
op,
|
|
21276
21366
|
reason: DOCUMENT_OP_REFUSAL_REASONS.UNTRACKABLE,
|
|
@@ -21585,7 +21675,15 @@ const withOmission = (row, side, value) => {
|
|
|
21585
21675
|
formatting
|
|
21586
21676
|
};
|
|
21587
21677
|
};
|
|
21588
|
-
|
|
21678
|
+
/**
|
|
21679
|
+
* Markup a column or cell edit would have to relocate: what a row keeps
|
|
21680
|
+
* beside its cells, counted by the cells before it. A column or cell edit
|
|
21681
|
+
* keeps every row, so what stands beside or around rows keeps its place as
|
|
21682
|
+
* it stands: bookmarks and captured markup beside a table's rows count the
|
|
21683
|
+
* rows before them, and a row content control or another wrapper around the
|
|
21684
|
+
* table or its rows wraps them whatever cells they hold.
|
|
21685
|
+
*/
|
|
21686
|
+
const hasStructuralMarkup = (table) => table.rows.some((row) => row.preserved !== void 0);
|
|
21589
21687
|
/** A cell holding one paragraph with nothing in it. */
|
|
21590
21688
|
const isEmptyCell = (cell) => cell.content.length === 1 && cell.content[0]?.type === "paragraph" && cell.content[0].content.length === 0;
|
|
21591
21689
|
const hasReview = (table) => table.formatting?.gridChange !== void 0 || table.propertyChanges !== void 0 || table.rows.some((row) => row.structuralChange !== void 0 || row.propertyChanges !== void 0 || row.cells.some((cell) => cell.structuralChange !== void 0 || cell.propertyChanges !== void 0));
|
|
@@ -25658,21 +25756,16 @@ const inspectDocumentOps = (document, ops) => applyDocumentOpsForPurpose({
|
|
|
25658
25756
|
purpose: "inspect-inverse"
|
|
25659
25757
|
});
|
|
25660
25758
|
// src/ops/suggestions.ts
|
|
25661
|
-
|
|
25662
|
-
* The ids of the revisions in a value that belong to a pending suggestion:
|
|
25663
|
-
* tracked insertions and deletions, moves, property changes and paragraph
|
|
25664
|
-
* mark revisions, at any depth.
|
|
25665
|
-
*/
|
|
25666
|
-
const suggestedRevisionIdsIn = (value, out) => {
|
|
25759
|
+
const visitSuggestionRevisions = (value, visit) => {
|
|
25667
25760
|
if (typeof value !== "object" || value === null) return;
|
|
25668
25761
|
if (Array.isArray(value)) {
|
|
25669
|
-
for (const item of value)
|
|
25762
|
+
for (const item of value) visitSuggestionRevisions(item, visit);
|
|
25670
25763
|
return;
|
|
25671
25764
|
}
|
|
25672
25765
|
const record = value;
|
|
25673
25766
|
const info = record["info"];
|
|
25674
|
-
if (typeof info === "object" && info !== null && typeof info
|
|
25675
|
-
for (const child of Object.values(record))
|
|
25767
|
+
if (typeof info === "object" && info !== null && typeof info.suggestionId === "string" && typeof info.id === "number") visit(info);
|
|
25768
|
+
for (const child of Object.values(record)) visitSuggestionRevisions(child, visit);
|
|
25676
25769
|
};
|
|
25677
25770
|
/**
|
|
25678
25771
|
* The ids of the comments pending suggestions propose: every one, or those of
|
|
@@ -25699,13 +25792,18 @@ const withoutSuggestedComments = (document, ids) => {
|
|
|
25699
25792
|
* file reads as if it had never been made; ordinary tracked changes stay. A
|
|
25700
25793
|
* comment a suggestion proposes is left out with it.
|
|
25701
25794
|
*/
|
|
25702
|
-
const withoutPendingSuggestions = (document) => {
|
|
25703
|
-
const
|
|
25795
|
+
const withoutPendingSuggestions = (document, { commentIds, onAbsorptions } = {}) => {
|
|
25796
|
+
const proposedComments = new Set(suggestedCommentIds(document));
|
|
25797
|
+
if (commentIds !== void 0) {
|
|
25798
|
+
for (const { id } of document.package.document.comments ?? []) if (commentIds.has(id)) proposedComments.add(id);
|
|
25799
|
+
}
|
|
25800
|
+
const uncommented = withoutSuggestedComments(document, [...proposedComments]);
|
|
25704
25801
|
if (uncommented.isErr()) return uncommented;
|
|
25705
25802
|
let current = uncommented.value;
|
|
25803
|
+
const receipts = [];
|
|
25706
25804
|
for (const story of documentStories(current)) {
|
|
25707
25805
|
const ids = /* @__PURE__ */ new Set();
|
|
25708
|
-
|
|
25806
|
+
visitSuggestionRevisions(storyBody$1(current, story), ({ id }) => ids.add(id));
|
|
25709
25807
|
if (ids.size === 0) continue;
|
|
25710
25808
|
const rejected = applyDocumentOp(current, {
|
|
25711
25809
|
type: DOCUMENT_OP_TYPES.RESOLVE_REVISION,
|
|
@@ -25714,32 +25812,38 @@ const withoutPendingSuggestions = (document) => {
|
|
|
25714
25812
|
decision: REVISION_DECISIONS.REJECT
|
|
25715
25813
|
});
|
|
25716
25814
|
if (rejected.isErr()) return Result.err(rejected.error);
|
|
25815
|
+
const absorbed = rejected.value.touched.absorbed;
|
|
25816
|
+
if (onAbsorptions !== void 0 && absorbed !== void 0 && absorbed.length > 0) receipts.push({
|
|
25817
|
+
story,
|
|
25818
|
+
absorbed
|
|
25819
|
+
});
|
|
25717
25820
|
current = rejected.value.document;
|
|
25718
25821
|
}
|
|
25822
|
+
for (const { story, absorbed } of receipts) onAbsorptions?.(story, absorbed);
|
|
25719
25823
|
return Result.ok(current);
|
|
25720
25824
|
};
|
|
25721
|
-
|
|
25722
|
-
|
|
25723
|
-
|
|
25724
|
-
|
|
25825
|
+
const visitStorySuggestionRevisions = (body, visit) => {
|
|
25826
|
+
visitSuggestionRevisions(body.content, (info) => visit(info, info.suggestionId));
|
|
25827
|
+
for (const { info } of body.finalSectionProperties?.propertyChanges ?? []) if (info.suggestionId !== void 0) visit(info, info.suggestionId);
|
|
25828
|
+
};
|
|
25829
|
+
/** Revisions of one pending suggestion, one info per ID in document order. */
|
|
25725
25830
|
const suggestionRevisionInfos = (document, story, suggestionId) => {
|
|
25726
25831
|
const out = /* @__PURE__ */ new Map();
|
|
25727
|
-
|
|
25728
|
-
if (
|
|
25729
|
-
|
|
25730
|
-
for (const item of value) visit(item);
|
|
25731
|
-
return;
|
|
25732
|
-
}
|
|
25733
|
-
const record = value;
|
|
25734
|
-
const info = record["info"];
|
|
25735
|
-
if (typeof info === "object" && info !== null && info.suggestionId === suggestionId && typeof info.id === "number" && !out.has(info.id)) out.set(info.id, info);
|
|
25736
|
-
for (const child of Object.values(record)) visit(child);
|
|
25737
|
-
};
|
|
25738
|
-
const body = storyBody$1(document, story);
|
|
25739
|
-
visit(body.content);
|
|
25740
|
-
for (const { info } of body.finalSectionProperties?.propertyChanges ?? []) if (info.suggestionId === suggestionId && !out.has(info.id)) out.set(info.id, info);
|
|
25832
|
+
visitStorySuggestionRevisions(storyBody$1(document, story), (info, owner) => {
|
|
25833
|
+
if (owner === suggestionId && !out.has(info.id)) out.set(info.id, info);
|
|
25834
|
+
});
|
|
25741
25835
|
return [...out.values()];
|
|
25742
25836
|
};
|
|
25837
|
+
/** The first proposal owning each physical revision ID in this story. */
|
|
25838
|
+
const suggestionOwnersInStory = (document, story) => {
|
|
25839
|
+
const owners = /* @__PURE__ */ new Map();
|
|
25840
|
+
const body = findStoryBody$1(document, story);
|
|
25841
|
+
if (body === void 0) return owners;
|
|
25842
|
+
visitStorySuggestionRevisions(body, ({ id }, suggestionId) => {
|
|
25843
|
+
if (!owners.has(id)) owners.set(id, suggestionId);
|
|
25844
|
+
});
|
|
25845
|
+
return owners;
|
|
25846
|
+
};
|
|
25743
25847
|
/**
|
|
25744
25848
|
* The ids of every pending suggestion in a document, in every story, and of
|
|
25745
25849
|
* every suggestion that proposes a comment.
|
|
@@ -25747,22 +25851,7 @@ const suggestionRevisionInfos = (document, story, suggestionId) => {
|
|
|
25747
25851
|
const pendingSuggestionIdsIn = (document) => {
|
|
25748
25852
|
const out = /* @__PURE__ */ new Set();
|
|
25749
25853
|
for (const comment of document.package.document.comments ?? []) if (comment.suggestionId !== void 0) out.add(comment.suggestionId);
|
|
25750
|
-
const
|
|
25751
|
-
if (typeof value !== "object" || value === null) return;
|
|
25752
|
-
if (Array.isArray(value)) {
|
|
25753
|
-
for (const item of value) visit(item);
|
|
25754
|
-
return;
|
|
25755
|
-
}
|
|
25756
|
-
const record = value;
|
|
25757
|
-
const info = record["info"];
|
|
25758
|
-
if (typeof info === "object" && info !== null && typeof info.suggestionId === "string") out.add(info.suggestionId);
|
|
25759
|
-
for (const child of Object.values(record)) visit(child);
|
|
25760
|
-
};
|
|
25761
|
-
for (const story of documentStories(document)) {
|
|
25762
|
-
const body = storyBody$1(document, story);
|
|
25763
|
-
visit(body.content);
|
|
25764
|
-
for (const { info } of body.finalSectionProperties?.propertyChanges ?? []) if (info.suggestionId !== void 0) out.add(info.suggestionId);
|
|
25765
|
-
}
|
|
25854
|
+
for (const story of documentStories(document)) visitStorySuggestionRevisions(storyBody$1(document, story), (_info, suggestionId) => out.add(suggestionId));
|
|
25766
25855
|
return out;
|
|
25767
25856
|
};
|
|
25768
25857
|
// src/ops/compoundIntent.ts
|
|
@@ -28389,6 +28478,7 @@ const intentEndpoints = (intent) => {
|
|
|
28389
28478
|
case "replaceFragment":
|
|
28390
28479
|
case "pasteBlocks":
|
|
28391
28480
|
case "moveFragment":
|
|
28481
|
+
case "moveBlocks":
|
|
28392
28482
|
case "replaceText":
|
|
28393
28483
|
case "insertAtom":
|
|
28394
28484
|
case "formatRun": return {
|
|
@@ -28519,9 +28609,10 @@ const createEditorIntentIdAllocator = ({ reservedBlockIds } = {}) => {
|
|
|
28519
28609
|
for (const span of leafSpans(paragraph.content)) demand += 4 * (1 + span.ancestors.length);
|
|
28520
28610
|
}
|
|
28521
28611
|
if (incoming.length > 0) demand += 8;
|
|
28522
|
-
if (intent.type === "pasteBlocks") {
|
|
28612
|
+
if (intent.type === "pasteBlocks" || intent.type === "moveBlocks") {
|
|
28523
28613
|
demand += 11;
|
|
28524
28614
|
for (const block of intent.blocks) {
|
|
28615
|
+
if (intent.type === "moveBlocks" && block.type === "table") demand += 2 + block.rows.length;
|
|
28525
28616
|
const paragraphs = block.type === "table" ? storyParagraphs({ content: [block] }).map(({ paragraph }) => paragraph) : [block];
|
|
28526
28617
|
if (block.type === "table") demand += 2 + block.rows.length;
|
|
28527
28618
|
for (const paragraph of paragraphs) {
|
|
@@ -28534,7 +28625,7 @@ const createEditorIntentIdAllocator = ({ reservedBlockIds } = {}) => {
|
|
|
28534
28625
|
demand += 4;
|
|
28535
28626
|
continue;
|
|
28536
28627
|
}
|
|
28537
|
-
const note = intent.annotations?.notes.find(({ type, id }) => type === anchor.note && id === anchor.id);
|
|
28628
|
+
const note = (intent.type === "pasteBlocks" ? intent.annotations : void 0)?.notes.find(({ type, id }) => type === anchor.note && id === anchor.id);
|
|
28538
28629
|
demand += 4;
|
|
28539
28630
|
for (const block of note?.content ?? []) {
|
|
28540
28631
|
if (block.type !== "paragraph") continue;
|
|
@@ -28545,7 +28636,7 @@ const createEditorIntentIdAllocator = ({ reservedBlockIds } = {}) => {
|
|
|
28545
28636
|
}
|
|
28546
28637
|
if (intent.type === "setHyperlink" || intent.type === "removeHyperlink" || intent.type === "insertHyperlink") demand = 2 * demand + 8;
|
|
28547
28638
|
if (intent.type === "generateTOC") demand += 8 + (intent.headings.length + 1) * (PARAGRAPH_REVISION_DEMAND + 4 * leafRevisionDemand(3));
|
|
28548
|
-
if (intent.type === "moveFragment") {
|
|
28639
|
+
if (intent.type === "moveFragment" || intent.type === "moveBlocks") {
|
|
28549
28640
|
const target = storyParagraphs(storyBody$1(document, intent.target.story)).find(({ paragraph }) => idKey(paragraph.paraId ?? "") === idKey(intent.target.blockId));
|
|
28550
28641
|
if (target !== void 0) {
|
|
28551
28642
|
demand += 3;
|
|
@@ -29911,6 +30002,303 @@ const gapWithoutLeaves = (content, at, removed) => {
|
|
|
29911
30002
|
zeroWidthBefore
|
|
29912
30003
|
};
|
|
29913
30004
|
};
|
|
30005
|
+
/**
|
|
30006
|
+
* A move of the text between `from` and `to`: the range is deleted, as
|
|
30007
|
+
* `replaceText` with no text deletes it (a suggestion records the
|
|
30008
|
+
* deletion), and the moved content goes in where the target stands once
|
|
30009
|
+
* the deletion is made. A target inside the range moves nothing.
|
|
30010
|
+
*/
|
|
30011
|
+
const compileRangeMove = (document, { intent, mode, insert }) => {
|
|
30012
|
+
const range = selectedParagraphRuns(document, intent.from, intent.to);
|
|
30013
|
+
if (range.isErr()) return Result.err(range.error);
|
|
30014
|
+
const sourceParagraph = paragraphAt(document, intent.from);
|
|
30015
|
+
const fromGap = intent.from.zeroWidthBefore ?? (sourceParagraph === void 0 ? 0 : zeroWidthLeavesAt(sourceParagraph.content, intent.from.offset).length);
|
|
30016
|
+
const toGap = intent.to.zeroWidthBefore ?? 0;
|
|
30017
|
+
if (idKey(intent.from.blockId) === idKey(intent.to.blockId) && intent.from.offset === intent.to.offset && fromGap >= toGap) {
|
|
30018
|
+
if (fromGap > toGap && (intent.from.zeroWidthBefore !== void 0 || intent.to.zeroWidthBefore !== void 0)) return Result.err(new DocumentOpRefusal({
|
|
30019
|
+
reason: DOCUMENT_OP_REFUSAL_REASONS.INVALID_OFFSET,
|
|
30020
|
+
message: "The move source marker gaps are reversed.",
|
|
30021
|
+
opType: DOCUMENT_OP_TYPES.DELETE_RANGE
|
|
30022
|
+
}));
|
|
30023
|
+
return Result.ok({
|
|
30024
|
+
ops: [],
|
|
30025
|
+
selection: intent.target
|
|
30026
|
+
});
|
|
30027
|
+
}
|
|
30028
|
+
const locations = storyParagraphs(storyBody$1(document, intent.from.story));
|
|
30029
|
+
const indexOf = (at) => locations.findIndex(({ paragraph }) => idKey(paragraph.paraId ?? "") === idKey(at.blockId));
|
|
30030
|
+
const first = indexOf(intent.from);
|
|
30031
|
+
const last = indexOf(intent.to);
|
|
30032
|
+
const targetIndex = indexOf(intent.target);
|
|
30033
|
+
const targetGap = intent.target.zeroWidthBefore ?? defaultInsertionGap(paragraphAt(document, intent.target)?.content ?? [], intent.target.offset).zeroWidthBefore;
|
|
30034
|
+
const targetPosition = {
|
|
30035
|
+
offset: intent.target.offset,
|
|
30036
|
+
zeroWidthBefore: targetGap
|
|
30037
|
+
};
|
|
30038
|
+
if (intent.target.story === intent.from.story && targetIndex >= first && targetIndex <= last && (targetIndex !== first || compareGaps(targetPosition, {
|
|
30039
|
+
offset: intent.from.offset,
|
|
30040
|
+
zeroWidthBefore: fromGap
|
|
30041
|
+
}) >= 0) && (targetIndex !== last || compareGaps(targetPosition, {
|
|
30042
|
+
offset: intent.to.offset,
|
|
30043
|
+
zeroWidthBefore: toGap
|
|
30044
|
+
}) <= 0)) return Result.ok({
|
|
30045
|
+
ops: [],
|
|
30046
|
+
selection: intent.target
|
|
30047
|
+
});
|
|
30048
|
+
const anchorDeletions = [];
|
|
30049
|
+
const sourceAnchors = mode.type === "editing" ? range.value.flat() : [];
|
|
30050
|
+
for (const { paragraph } of sourceAnchors) {
|
|
30051
|
+
const blockId = paragraph.paraId ?? "";
|
|
30052
|
+
const from = idKey(blockId) === idKey(intent.from.blockId) ? {
|
|
30053
|
+
offset: intent.from.offset,
|
|
30054
|
+
zeroWidthBefore: fromGap
|
|
30055
|
+
} : {
|
|
30056
|
+
offset: 0,
|
|
30057
|
+
zeroWidthBefore: 0
|
|
30058
|
+
};
|
|
30059
|
+
const to = idKey(blockId) === idKey(intent.to.blockId) ? {
|
|
30060
|
+
offset: intent.to.offset,
|
|
30061
|
+
zeroWidthBefore: toGap
|
|
30062
|
+
} : {
|
|
30063
|
+
offset: paragraphLength(paragraph),
|
|
30064
|
+
zeroWidthBefore: zeroWidthLeavesAt(paragraph.content, paragraphLength(paragraph)).length
|
|
30065
|
+
};
|
|
30066
|
+
for (const span of leafSpans(paragraph.content)) {
|
|
30067
|
+
if (!isMoveAnchor(span.node) || span.ancestors.some(isRemovedRevisionNode) || compareGaps(span.before, from) < 0 || compareGaps(span.after, to) > 0) continue;
|
|
30068
|
+
anchorDeletions.push({
|
|
30069
|
+
type: DOCUMENT_OP_TYPES.DELETE_RANGE,
|
|
30070
|
+
from: {
|
|
30071
|
+
story: intent.from.story,
|
|
30072
|
+
blockId,
|
|
30073
|
+
...span.before
|
|
30074
|
+
},
|
|
30075
|
+
to: {
|
|
30076
|
+
story: intent.from.story,
|
|
30077
|
+
blockId,
|
|
30078
|
+
...span.after
|
|
30079
|
+
}
|
|
30080
|
+
});
|
|
30081
|
+
}
|
|
30082
|
+
}
|
|
30083
|
+
const deleted = compileEditorIntent(document, {
|
|
30084
|
+
intent: {
|
|
30085
|
+
type: "replaceText",
|
|
30086
|
+
from: intent.from,
|
|
30087
|
+
to: intent.to,
|
|
30088
|
+
text: ""
|
|
30089
|
+
},
|
|
30090
|
+
mode
|
|
30091
|
+
});
|
|
30092
|
+
if (deleted.isErr()) return deleted;
|
|
30093
|
+
const logicalDeletions = anchorDeletions.length === 0 ? deleted.value.ops : [...deleted.value.ops.filter((op) => op.type === DOCUMENT_OP_TYPES.DELETE_RANGE).concat(anchorDeletions).sort((left, right) => indexOf(right.from) - indexOf(left.from) || compareGaps({
|
|
30094
|
+
offset: right.from.offset,
|
|
30095
|
+
zeroWidthBefore: right.from.zeroWidthBefore ?? 0
|
|
30096
|
+
}, {
|
|
30097
|
+
offset: left.from.offset,
|
|
30098
|
+
zeroWidthBefore: left.from.zeroWidthBefore ?? 0
|
|
30099
|
+
})), ...deleted.value.ops.filter((op) => op.type !== DOCUMENT_OP_TYPES.DELETE_RANGE)];
|
|
30100
|
+
const anchors = new Set(anchorDeletions);
|
|
30101
|
+
const deletionOps = [];
|
|
30102
|
+
const movedNoteBodies = [];
|
|
30103
|
+
let afterDeletion = document;
|
|
30104
|
+
for (const planned of logicalDeletions) {
|
|
30105
|
+
let op = planned;
|
|
30106
|
+
if (planned.type === DOCUMENT_OP_TYPES.DELETE_RANGE && anchors.has(planned)) {
|
|
30107
|
+
const paragraph = paragraphAt(afterDeletion, planned.from);
|
|
30108
|
+
if (paragraph === void 0) panic("A move anchor lost its selected paragraph.");
|
|
30109
|
+
op = {
|
|
30110
|
+
type: DOCUMENT_OP_TYPES.REPLACE_INLINE,
|
|
30111
|
+
story: planned.from.story,
|
|
30112
|
+
blockId: planned.from.blockId,
|
|
30113
|
+
expected: paragraph.content,
|
|
30114
|
+
content: deleteBetween(paragraph.content, {
|
|
30115
|
+
offset: planned.from.offset,
|
|
30116
|
+
zeroWidthBefore: planned.from.zeroWidthBefore ?? 0
|
|
30117
|
+
}, {
|
|
30118
|
+
offset: planned.to.offset,
|
|
30119
|
+
zeroWidthBefore: planned.to.zeroWidthBefore ?? 0
|
|
30120
|
+
}).content
|
|
30121
|
+
};
|
|
30122
|
+
}
|
|
30123
|
+
const applied = applyDocumentOps(afterDeletion, [op]);
|
|
30124
|
+
if (applied.isErr()) return Result.err(applied.error);
|
|
30125
|
+
afterDeletion = applied.value.document;
|
|
30126
|
+
deletionOps.push(op);
|
|
30127
|
+
for (const inverse of applied.value.inverse) if (inverse.type === DOCUMENT_OP_TYPES.RESTORE_STORY_PARTS && (inverse.parts.footnotes !== void 0 || inverse.parts.endnotes !== void 0)) movedNoteBodies.push({
|
|
30128
|
+
type: DOCUMENT_OP_TYPES.RESTORE_STORY_PARTS,
|
|
30129
|
+
expected: {
|
|
30130
|
+
...inverse.expected.footnotes === void 0 ? {} : { footnotes: inverse.expected.footnotes },
|
|
30131
|
+
...inverse.expected.endnotes === void 0 ? {} : { endnotes: inverse.expected.endnotes }
|
|
30132
|
+
},
|
|
30133
|
+
parts: {
|
|
30134
|
+
...inverse.parts.footnotes === void 0 ? {} : { footnotes: inverse.parts.footnotes },
|
|
30135
|
+
...inverse.parts.endnotes === void 0 ? {} : { endnotes: inverse.parts.endnotes }
|
|
30136
|
+
}
|
|
30137
|
+
});
|
|
30138
|
+
}
|
|
30139
|
+
if (movedNoteBodies.length > 0) {
|
|
30140
|
+
const restorations = movedNoteBodies.toReversed();
|
|
30141
|
+
const restored = applyDocumentOps(afterDeletion, restorations);
|
|
30142
|
+
if (restored.isErr()) return Result.err(restored.error);
|
|
30143
|
+
afterDeletion = restored.value.document;
|
|
30144
|
+
deletionOps.push(...restorations);
|
|
30145
|
+
}
|
|
30146
|
+
let target = intent.target;
|
|
30147
|
+
for (const op of logicalDeletions) {
|
|
30148
|
+
if (op.type === DOCUMENT_OP_TYPES.DELETE_RANGE && op.revision === void 0 && idKey(target.blockId) === idKey(op.from.blockId) && target.story === op.from.story && target.offset >= op.to.offset) {
|
|
30149
|
+
const source = paragraphAt(document, op.from);
|
|
30150
|
+
const deletionFromGap = op.from.zeroWidthBefore ?? zeroWidthLeavesAt(source?.content ?? [], op.from.offset).length;
|
|
30151
|
+
const deletionToGap = op.to.zeroWidthBefore ?? 0;
|
|
30152
|
+
const deletionTargetGap = target.zeroWidthBefore ?? defaultInsertionGap(source?.content ?? [], target.offset).zeroWidthBefore;
|
|
30153
|
+
const rebased = Object.assign({}, target, { offset: target.offset - (op.to.offset - op.from.offset) });
|
|
30154
|
+
if (target.offset === op.to.offset) rebased.zeroWidthBefore = deletionFromGap + deletionTargetGap - deletionToGap;
|
|
30155
|
+
target = rebased;
|
|
30156
|
+
}
|
|
30157
|
+
if (op.type === DOCUMENT_OP_TYPES.JOIN_BLOCKS && op.revision === void 0 && idKey(target.blockId) === idKey(op.blockId) && target.story === op.story) target = Object.assign({}, target, { blockId: op.nextBlockId });
|
|
30158
|
+
else if (op.type === DOCUMENT_OP_TYPES.JOIN_BLOCKS && op.revision === void 0 && idKey(target.blockId) === idKey(op.nextBlockId) && target.story === op.story) {
|
|
30159
|
+
const prefix = paragraphAt(document, {
|
|
30160
|
+
story: op.story,
|
|
30161
|
+
blockId: op.blockId,
|
|
30162
|
+
offset: 0
|
|
30163
|
+
});
|
|
30164
|
+
const remaining = idKey(op.blockId) === idKey(intent.from.blockId) ? intent.from.offset : 0;
|
|
30165
|
+
if (prefix !== void 0) {
|
|
30166
|
+
const rebased = Object.assign({}, target, { offset: target.offset + remaining });
|
|
30167
|
+
if (target.offset === 0 && idKey(op.blockId) === idKey(intent.from.blockId)) rebased.zeroWidthBefore = fromGap + (target.zeroWidthBefore ?? 0);
|
|
30168
|
+
target = rebased;
|
|
30169
|
+
}
|
|
30170
|
+
}
|
|
30171
|
+
}
|
|
30172
|
+
const inserted = insert(afterDeletion, target, modeAfterOps(afterDeletion, mode));
|
|
30173
|
+
if (inserted.isErr()) return inserted;
|
|
30174
|
+
return Result.ok({
|
|
30175
|
+
ops: [...deletionOps, ...inserted.value.ops],
|
|
30176
|
+
selection: inserted.value.selection
|
|
30177
|
+
});
|
|
30178
|
+
};
|
|
30179
|
+
/**
|
|
30180
|
+
* A paragraph without the move range markers it carried: a suggested move is
|
|
30181
|
+
* recorded as a deletion and an insertion, and a copied marker would pair
|
|
30182
|
+
* with no range.
|
|
30183
|
+
*/
|
|
30184
|
+
const withoutParagraphMoveAnchors = (paragraph) => Object.assign({}, paragraph, { content: asParagraphContent(withoutMoveAnchors(paragraph.content)) });
|
|
30185
|
+
/** A block without move range markers, a table's cell paragraphs among them. */
|
|
30186
|
+
const withoutBlockMoveAnchors = (block) => block.type === "paragraph" ? withoutParagraphMoveAnchors(block) : {
|
|
30187
|
+
...block,
|
|
30188
|
+
rows: block.rows.map((row) => ({
|
|
30189
|
+
...row,
|
|
30190
|
+
cells: row.cells.map((cell) => ({
|
|
30191
|
+
...cell,
|
|
30192
|
+
content: cell.content.map((inner) => inner.type === "paragraph" || inner.type === "table" ? withoutBlockMoveAnchors(inner) : inner)
|
|
30193
|
+
}))
|
|
30194
|
+
}))
|
|
30195
|
+
};
|
|
30196
|
+
/**
|
|
30197
|
+
* Blocks, tables among them, moved from a range to a target. The tables
|
|
30198
|
+
* standing wholly between the range's paragraphs are removed, the latest
|
|
30199
|
+
* first, or in suggesting mode recorded as deleted; the range's text is then
|
|
30200
|
+
* deleted and the blocks placed at the rebased target as a paste places them.
|
|
30201
|
+
* A suggestion records the move as the deletion of its source and the
|
|
30202
|
+
* insertion of its copy, as a moved paragraph is recorded. A target inside
|
|
30203
|
+
* the range, a moved table's cell among them, moves nothing.
|
|
30204
|
+
*/
|
|
30205
|
+
const compileBlockMove = (document, { intent, mode, firstBlockId }) => {
|
|
30206
|
+
const { blocks, ...range } = intent;
|
|
30207
|
+
const paragraphs = blocks.filter((block) => block.type === "paragraph");
|
|
30208
|
+
if (paragraphs.length === blocks.length) return compileEditorIntent(document, {
|
|
30209
|
+
intent: {
|
|
30210
|
+
...range,
|
|
30211
|
+
type: "moveFragment",
|
|
30212
|
+
paragraphs
|
|
30213
|
+
},
|
|
30214
|
+
mode,
|
|
30215
|
+
...firstBlockId === void 0 ? {} : { firstBlockId }
|
|
30216
|
+
});
|
|
30217
|
+
const story = intent.from.story;
|
|
30218
|
+
const body = storyBody$1(document, story);
|
|
30219
|
+
const locations = storyParagraphs(body);
|
|
30220
|
+
const indexOf = (at) => locations.findIndex(({ paragraph }) => idKey(paragraph.paraId ?? "") === idKey(at.blockId));
|
|
30221
|
+
const first = indexOf(intent.from);
|
|
30222
|
+
const last = indexOf(intent.to);
|
|
30223
|
+
const start = locations[first];
|
|
30224
|
+
const end = locations[last];
|
|
30225
|
+
if (start === void 0 || end === void 0 || intent.to.story !== story) return Result.err(new DocumentOpRefusal({
|
|
30226
|
+
reason: DOCUMENT_OP_REFUSAL_REASONS.BLOCK_NOT_FOUND,
|
|
30227
|
+
message: "The moved range names a paragraph the story does not hold.",
|
|
30228
|
+
opType: DOCUMENT_OP_TYPES.DELETE_RANGE
|
|
30229
|
+
}));
|
|
30230
|
+
if (!sameBlockList(start.list, end.list) || last < first) return Result.err(new DocumentOpRefusal({
|
|
30231
|
+
reason: DOCUMENT_OP_REFUSAL_REASONS.INVALID_OPERATION,
|
|
30232
|
+
message: "Moved blocks start and end in one block list.",
|
|
30233
|
+
opType: DOCUMENT_OP_TYPES.DELETE_RANGE
|
|
30234
|
+
}));
|
|
30235
|
+
const target = indexOf(intent.target);
|
|
30236
|
+
if (intent.target.story === story && target > first && target < last) return Result.ok({
|
|
30237
|
+
ops: [],
|
|
30238
|
+
selection: intent.target
|
|
30239
|
+
});
|
|
30240
|
+
const covered = blockListAt(body.content, start.list).slice(start.index + 1, end.index).filter((block) => block.type === "table");
|
|
30241
|
+
const reserved = mode.reservedBlockIds === void 0 ? {} : { reservedBlockIds: mode.reservedBlockIds };
|
|
30242
|
+
const ops = [];
|
|
30243
|
+
let current = document;
|
|
30244
|
+
let currentMode = mode;
|
|
30245
|
+
for (const table of covered.toReversed()) {
|
|
30246
|
+
const blockId = storyParagraphs({ content: [table] }).at(0)?.paragraph.paraId;
|
|
30247
|
+
if (blockId === void 0) return Result.err(new DocumentOpRefusal({
|
|
30248
|
+
reason: DOCUMENT_OP_REFUSAL_REASONS.MISSING_BLOCK_ID,
|
|
30249
|
+
message: "A moved table holds no paragraph that addresses it.",
|
|
30250
|
+
opType: DOCUMENT_OP_TYPES.DELETE_TABLE
|
|
30251
|
+
}));
|
|
30252
|
+
const removed = compileEditorIntent(current, {
|
|
30253
|
+
intent: {
|
|
30254
|
+
type: "tableBlock",
|
|
30255
|
+
operation: {
|
|
30256
|
+
type: DOCUMENT_OP_TYPES.DELETE_TABLE,
|
|
30257
|
+
story,
|
|
30258
|
+
blockId
|
|
30259
|
+
}
|
|
30260
|
+
},
|
|
30261
|
+
mode: currentMode
|
|
30262
|
+
});
|
|
30263
|
+
if (removed.isErr()) return removed;
|
|
30264
|
+
const applied = applyDocumentOps(current, removed.value.ops);
|
|
30265
|
+
if (applied.isErr()) return Result.err(applied.error);
|
|
30266
|
+
ops.push(...removed.value.ops);
|
|
30267
|
+
current = applied.value.document;
|
|
30268
|
+
currentMode = {
|
|
30269
|
+
...modeAfterOps(current, currentMode),
|
|
30270
|
+
...reserved
|
|
30271
|
+
};
|
|
30272
|
+
}
|
|
30273
|
+
const moved = compileRangeMove(current, {
|
|
30274
|
+
intent: range,
|
|
30275
|
+
mode: currentMode,
|
|
30276
|
+
insert: (afterDeletion, at, insertMode) => compileEditorIntent(afterDeletion, {
|
|
30277
|
+
intent: {
|
|
30278
|
+
type: "pasteBlocks",
|
|
30279
|
+
from: at,
|
|
30280
|
+
to: at,
|
|
30281
|
+
blocks: mode.type === "suggesting" ? blocks.map(withoutBlockMoveAnchors) : blocks,
|
|
30282
|
+
openStart: intent.openStart,
|
|
30283
|
+
openEnd: intent.openEnd
|
|
30284
|
+
},
|
|
30285
|
+
mode: {
|
|
30286
|
+
...insertMode,
|
|
30287
|
+
...reserved
|
|
30288
|
+
},
|
|
30289
|
+
...firstBlockId === void 0 ? {} : { firstBlockId }
|
|
30290
|
+
})
|
|
30291
|
+
});
|
|
30292
|
+
if (moved.isErr()) return moved;
|
|
30293
|
+
if (moved.value.ops.length === 0) return Result.ok({
|
|
30294
|
+
ops: [],
|
|
30295
|
+
selection: intent.target
|
|
30296
|
+
});
|
|
30297
|
+
return Result.ok({
|
|
30298
|
+
ops: [...ops, ...moved.value.ops],
|
|
30299
|
+
selection: moved.value.selection
|
|
30300
|
+
});
|
|
30301
|
+
};
|
|
29914
30302
|
/** Compile one batch; the caller applies it atomically and journals its exact inverse. */
|
|
29915
30303
|
const compileEditorIntent = (document, input) => {
|
|
29916
30304
|
const routed = textBoxOfIntent(document, input.intent);
|
|
@@ -30347,182 +30735,36 @@ const compileInStory = (document, { intent, mode, firstBlockId, typedFormatting
|
|
|
30347
30735
|
break;
|
|
30348
30736
|
}
|
|
30349
30737
|
case "moveFragment": {
|
|
30350
|
-
const
|
|
30351
|
-
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30356
|
-
|
|
30357
|
-
|
|
30358
|
-
|
|
30359
|
-
|
|
30360
|
-
|
|
30361
|
-
return Result.ok({
|
|
30362
|
-
ops: [],
|
|
30363
|
-
selection: intent.target
|
|
30364
|
-
});
|
|
30365
|
-
}
|
|
30366
|
-
const locations = storyParagraphs(storyBody$1(document, intent.from.story));
|
|
30367
|
-
const indexOf = (at) => locations.findIndex(({ paragraph }) => idKey(paragraph.paraId ?? "") === idKey(at.blockId));
|
|
30368
|
-
const first = indexOf(intent.from);
|
|
30369
|
-
const last = indexOf(intent.to);
|
|
30370
|
-
const targetIndex = indexOf(intent.target);
|
|
30371
|
-
const targetGap = intent.target.zeroWidthBefore ?? defaultInsertionGap(paragraphAt(document, intent.target)?.content ?? [], intent.target.offset).zeroWidthBefore;
|
|
30372
|
-
const targetPosition = {
|
|
30373
|
-
offset: intent.target.offset,
|
|
30374
|
-
zeroWidthBefore: targetGap
|
|
30375
|
-
};
|
|
30376
|
-
if (intent.target.story === intent.from.story && targetIndex >= first && targetIndex <= last && (targetIndex !== first || compareGaps(targetPosition, {
|
|
30377
|
-
offset: intent.from.offset,
|
|
30378
|
-
zeroWidthBefore: fromGap
|
|
30379
|
-
}) >= 0) && (targetIndex !== last || compareGaps(targetPosition, {
|
|
30380
|
-
offset: intent.to.offset,
|
|
30381
|
-
zeroWidthBefore: toGap
|
|
30382
|
-
}) <= 0)) return Result.ok({
|
|
30383
|
-
ops: [],
|
|
30384
|
-
selection: intent.target
|
|
30385
|
-
});
|
|
30386
|
-
const anchorDeletions = [];
|
|
30387
|
-
const sourceAnchors = mode.type === "editing" ? range.value.flat() : [];
|
|
30388
|
-
for (const { paragraph } of sourceAnchors) {
|
|
30389
|
-
const blockId = paragraph.paraId ?? "";
|
|
30390
|
-
const from = idKey(blockId) === idKey(intent.from.blockId) ? {
|
|
30391
|
-
offset: intent.from.offset,
|
|
30392
|
-
zeroWidthBefore: fromGap
|
|
30393
|
-
} : {
|
|
30394
|
-
offset: 0,
|
|
30395
|
-
zeroWidthBefore: 0
|
|
30396
|
-
};
|
|
30397
|
-
const to = idKey(blockId) === idKey(intent.to.blockId) ? {
|
|
30398
|
-
offset: intent.to.offset,
|
|
30399
|
-
zeroWidthBefore: toGap
|
|
30400
|
-
} : {
|
|
30401
|
-
offset: paragraphLength(paragraph),
|
|
30402
|
-
zeroWidthBefore: zeroWidthLeavesAt(paragraph.content, paragraphLength(paragraph)).length
|
|
30403
|
-
};
|
|
30404
|
-
for (const span of leafSpans(paragraph.content)) {
|
|
30405
|
-
if (!isMoveAnchor(span.node) || span.ancestors.some(isRemovedRevisionNode) || compareGaps(span.before, from) < 0 || compareGaps(span.after, to) > 0) continue;
|
|
30406
|
-
anchorDeletions.push({
|
|
30407
|
-
type: DOCUMENT_OP_TYPES.DELETE_RANGE,
|
|
30408
|
-
from: {
|
|
30409
|
-
story: intent.from.story,
|
|
30410
|
-
blockId,
|
|
30411
|
-
...span.before
|
|
30412
|
-
},
|
|
30413
|
-
to: {
|
|
30414
|
-
story: intent.from.story,
|
|
30415
|
-
blockId,
|
|
30416
|
-
...span.after
|
|
30417
|
-
}
|
|
30418
|
-
});
|
|
30419
|
-
}
|
|
30420
|
-
}
|
|
30421
|
-
const deleted = compileEditorIntent(document, {
|
|
30422
|
-
intent: {
|
|
30423
|
-
type: "replaceText",
|
|
30424
|
-
from: intent.from,
|
|
30425
|
-
to: intent.to,
|
|
30426
|
-
text: ""
|
|
30427
|
-
},
|
|
30428
|
-
mode
|
|
30429
|
-
});
|
|
30430
|
-
if (deleted.isErr()) return deleted;
|
|
30431
|
-
const logicalDeletions = anchorDeletions.length === 0 ? deleted.value.ops : [...deleted.value.ops.filter((op) => op.type === DOCUMENT_OP_TYPES.DELETE_RANGE).concat(anchorDeletions).sort((left, right) => indexOf(right.from) - indexOf(left.from) || compareGaps({
|
|
30432
|
-
offset: right.from.offset,
|
|
30433
|
-
zeroWidthBefore: right.from.zeroWidthBefore ?? 0
|
|
30434
|
-
}, {
|
|
30435
|
-
offset: left.from.offset,
|
|
30436
|
-
zeroWidthBefore: left.from.zeroWidthBefore ?? 0
|
|
30437
|
-
})), ...deleted.value.ops.filter((op) => op.type !== DOCUMENT_OP_TYPES.DELETE_RANGE)];
|
|
30438
|
-
const anchors = new Set(anchorDeletions);
|
|
30439
|
-
const deletionOps = [];
|
|
30440
|
-
const movedNoteBodies = [];
|
|
30441
|
-
let afterDeletion = document;
|
|
30442
|
-
for (const planned of logicalDeletions) {
|
|
30443
|
-
let op = planned;
|
|
30444
|
-
if (planned.type === DOCUMENT_OP_TYPES.DELETE_RANGE && anchors.has(planned)) {
|
|
30445
|
-
const paragraph = paragraphAt(afterDeletion, planned.from);
|
|
30446
|
-
if (paragraph === void 0) panic("A move anchor lost its selected paragraph.");
|
|
30447
|
-
op = {
|
|
30448
|
-
type: DOCUMENT_OP_TYPES.REPLACE_INLINE,
|
|
30449
|
-
story: planned.from.story,
|
|
30450
|
-
blockId: planned.from.blockId,
|
|
30451
|
-
expected: paragraph.content,
|
|
30452
|
-
content: deleteBetween(paragraph.content, {
|
|
30453
|
-
offset: planned.from.offset,
|
|
30454
|
-
zeroWidthBefore: planned.from.zeroWidthBefore ?? 0
|
|
30455
|
-
}, {
|
|
30456
|
-
offset: planned.to.offset,
|
|
30457
|
-
zeroWidthBefore: planned.to.zeroWidthBefore ?? 0
|
|
30458
|
-
}).content
|
|
30459
|
-
};
|
|
30460
|
-
}
|
|
30461
|
-
const applied = applyDocumentOps(afterDeletion, [op]);
|
|
30462
|
-
if (applied.isErr()) return Result.err(applied.error);
|
|
30463
|
-
afterDeletion = applied.value.document;
|
|
30464
|
-
deletionOps.push(op);
|
|
30465
|
-
for (const inverse of applied.value.inverse) if (inverse.type === DOCUMENT_OP_TYPES.RESTORE_STORY_PARTS && (inverse.parts.footnotes !== void 0 || inverse.parts.endnotes !== void 0)) movedNoteBodies.push({
|
|
30466
|
-
type: DOCUMENT_OP_TYPES.RESTORE_STORY_PARTS,
|
|
30467
|
-
expected: {
|
|
30468
|
-
...inverse.expected.footnotes === void 0 ? {} : { footnotes: inverse.expected.footnotes },
|
|
30469
|
-
...inverse.expected.endnotes === void 0 ? {} : { endnotes: inverse.expected.endnotes }
|
|
30738
|
+
const compiled = compileRangeMove(document, {
|
|
30739
|
+
intent,
|
|
30740
|
+
mode,
|
|
30741
|
+
insert: (afterDeletion, target, insertMode) => compileEditorIntent(afterDeletion, {
|
|
30742
|
+
intent: {
|
|
30743
|
+
type: "replaceFragment",
|
|
30744
|
+
from: target,
|
|
30745
|
+
to: target,
|
|
30746
|
+
paragraphs: mode.type === "suggesting" ? intent.paragraphs.map(withoutParagraphMoveAnchors) : intent.paragraphs,
|
|
30747
|
+
openStart: intent.openStart,
|
|
30748
|
+
openEnd: intent.openEnd
|
|
30470
30749
|
},
|
|
30471
|
-
|
|
30472
|
-
|
|
30473
|
-
|
|
30474
|
-
|
|
30475
|
-
|
|
30476
|
-
|
|
30477
|
-
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
|
|
30482
|
-
|
|
30483
|
-
|
|
30484
|
-
let target = intent.target;
|
|
30485
|
-
for (const op of logicalDeletions) {
|
|
30486
|
-
if (op.type === DOCUMENT_OP_TYPES.DELETE_RANGE && op.revision === void 0 && idKey(target.blockId) === idKey(op.from.blockId) && target.story === op.from.story && target.offset >= op.to.offset) {
|
|
30487
|
-
const source = paragraphAt(document, op.from);
|
|
30488
|
-
const deletionFromGap = op.from.zeroWidthBefore ?? zeroWidthLeavesAt(source?.content ?? [], op.from.offset).length;
|
|
30489
|
-
const deletionToGap = op.to.zeroWidthBefore ?? 0;
|
|
30490
|
-
const deletionTargetGap = target.zeroWidthBefore ?? defaultInsertionGap(source?.content ?? [], target.offset).zeroWidthBefore;
|
|
30491
|
-
const rebased = Object.assign({}, target, { offset: target.offset - (op.to.offset - op.from.offset) });
|
|
30492
|
-
if (target.offset === op.to.offset) rebased.zeroWidthBefore = deletionFromGap + deletionTargetGap - deletionToGap;
|
|
30493
|
-
target = rebased;
|
|
30494
|
-
}
|
|
30495
|
-
if (op.type === DOCUMENT_OP_TYPES.JOIN_BLOCKS && op.revision === void 0 && idKey(target.blockId) === idKey(op.blockId) && target.story === op.story) target = Object.assign({}, target, { blockId: op.nextBlockId });
|
|
30496
|
-
else if (op.type === DOCUMENT_OP_TYPES.JOIN_BLOCKS && op.revision === void 0 && idKey(target.blockId) === idKey(op.nextBlockId) && target.story === op.story) {
|
|
30497
|
-
const prefix = paragraphAt(document, {
|
|
30498
|
-
story: op.story,
|
|
30499
|
-
blockId: op.blockId,
|
|
30500
|
-
offset: 0
|
|
30501
|
-
});
|
|
30502
|
-
const remaining = idKey(op.blockId) === idKey(intent.from.blockId) ? intent.from.offset : 0;
|
|
30503
|
-
if (prefix !== void 0) {
|
|
30504
|
-
const rebased = Object.assign({}, target, { offset: target.offset + remaining });
|
|
30505
|
-
if (target.offset === 0 && idKey(op.blockId) === idKey(intent.from.blockId)) rebased.zeroWidthBefore = fromGap + (target.zeroWidthBefore ?? 0);
|
|
30506
|
-
target = rebased;
|
|
30507
|
-
}
|
|
30508
|
-
}
|
|
30509
|
-
}
|
|
30510
|
-
const paragraphs = mode.type === "suggesting" ? intent.paragraphs.map((paragraph) => Object.assign({}, paragraph, { content: asParagraphContent(withoutMoveAnchors(paragraph.content)) })) : intent.paragraphs;
|
|
30511
|
-
const inserted = compileEditorIntent(afterDeletion, {
|
|
30512
|
-
intent: {
|
|
30513
|
-
type: "replaceFragment",
|
|
30514
|
-
from: target,
|
|
30515
|
-
to: target,
|
|
30516
|
-
paragraphs,
|
|
30517
|
-
openStart: intent.openStart,
|
|
30518
|
-
openEnd: intent.openEnd
|
|
30519
|
-
},
|
|
30520
|
-
mode: modeAfterOps(afterDeletion, mode),
|
|
30750
|
+
mode: insertMode,
|
|
30751
|
+
...firstBlockId === void 0 ? {} : { firstBlockId }
|
|
30752
|
+
})
|
|
30753
|
+
});
|
|
30754
|
+
if (compiled.isErr()) return compiled;
|
|
30755
|
+
ops = compiled.value.ops;
|
|
30756
|
+
selection = compiled.value.selection;
|
|
30757
|
+
break;
|
|
30758
|
+
}
|
|
30759
|
+
case "moveBlocks": {
|
|
30760
|
+
const compiled = compileBlockMove(document, {
|
|
30761
|
+
intent,
|
|
30762
|
+
mode,
|
|
30521
30763
|
...firstBlockId === void 0 ? {} : { firstBlockId }
|
|
30522
30764
|
});
|
|
30523
|
-
if (
|
|
30524
|
-
ops =
|
|
30525
|
-
selection =
|
|
30765
|
+
if (compiled.isErr()) return compiled;
|
|
30766
|
+
ops = compiled.value.ops;
|
|
30767
|
+
selection = compiled.value.selection;
|
|
30526
30768
|
break;
|
|
30527
30769
|
}
|
|
30528
30770
|
case "table": {
|
|
@@ -37040,4 +37282,4 @@ const resolvedDocumentView = (document, decision) => {
|
|
|
37040
37282
|
const storyBody = storyBody$1;
|
|
37041
37283
|
const findStoryBody = findStoryBody$1;
|
|
37042
37284
|
const sameStory = sameStory$2;
|
|
37043
|
-
export { BATCH_ANNOTATION_KINDS, BATCH_REJECTION_REASONS, BATCH_WIRE_OP_TYPES, BatchRejection, DEFAULT_ID_BLOCK_SIZES, DOCUMENT_OP_REFUSAL_REASONS, DOCUMENT_OP_SCHEMA_VERSION, DOCUMENT_OP_TYPES, DocumentOpRefusal, DocumentOpsContractError, EMPTY_PROPERTY_SETS, EXCLUSIVE_PARTS, ID_KIND_LIMITS, ID_LEASE_KINDS, ID_LEASE_REFUSAL_REASONS, INHERIT_RUN_PROPS, IdLeaseRefusal, MAX_BATCH_WIRE_BYTES, OBJECT_REPLACEMENT_CHARACTER, OP_STORIES, PARAGRAPH_MARK_FORMATTING_KEYS, PROPERTY_REVIEW_POLICIES, REVISION_DECISIONS, SPLIT_HALVES, TYPED_TEXT_FORMATTING, acceptCopyOriginAncestors, addCopyOriginAncestor, allocateCommentAnchorIds, applyBatch, applyDocumentOp, applyDocumentOpEnvelope, applyDocumentOps, beginTrackedInsertionCompilation, blockControlHolding, captureDocumentOp, captureStoryParts, combineEditEffects, combineEdits, combineRecordedRevisions, commentAnchorSequence, commentDocumentIssue, commentReferenceOffsets, compareBatchOrder, compareGaps, compileEditorIntent, contentRank, createClient, createEditorIntentIdAllocator, createSequencer, defaultInsertionGap, deletionRemovesBlock, documentStories, editorParagraphGroups, editorParagraphGroupsThroughTextBoxes, editorPositionAtPhysicalPosition, finalBreakCarrier, findStoryBody, formatParaId, formattingEquals, freshCommentId, freshLeasedIds, groupInsertionRuns, idKey, idLeaseHolds, idLeaseRemaining, inlineLeafSpans, introducedDocumentIds, introducedIds, inverseMeetingDocument, isBlockBoundary, isCommentAnchorCarrierType, isCommentExhausted, isCopyOriginAncestors, isKeptCut, isKeptCutPiece, isTextOnlyRun, joinPropertyChangeLink, leasedIdCensus, locateParagraphInBlockList, locateParagraphThroughTextBoxes, mapTocBookmarkPosition, mergeRunContent, normalizeForOps, noteDeletionOps, noteUsesCustomMark, orderAddressingBeforeRemoval, orderBatchOperations, orphanRootCommentIds, packageParagraphIds, packageResourcesOpOf, paragraphContentVerdict, paragraphHoldsContent, paragraphHoldsContentOnceAccepted, paragraphIdsIn, paragraphKeptCutsFromChanges, paragraphLength, paragraphLogicalText, paragraphMarkOutcome, paragraphPropertySnapshotToken, paragraphStatesItsFormatting, paragraphVisibleText, paragraphsThroughTextBoxes, parseDocumentBatch, pendingSuggestionIdsIn, physicalOffsetAtVisibleOffset, physicalPositionAtEditorOffset, planTrackedDeletion, planTrackedReplace, planWellFormedRanges, planWholeParagraphReplacement, preservedCommentRangeMarkersAt, reconcileDocumentPartRelationships, recordsCopyOrigin, registerParagraphPropertySnapshot, registerStatedParagraphFormatting, rejectCopyOriginAncestors, replaceStoryBody, resolveSectionChange, resolveSectionChanges, resolvedDocumentView, reviewFieldsOf, revisionIdDemand, revisionSpan, runsMergeable, sameStory, sectionPropertiesAt, sectionRejectProperties, sectionResolutionPatch, shiftCopyOriginAncestors, storyBody, storyLacksClosingParagraph, storyParagraphs, storyPartsOpOf, suggestedCommentIds, suggestionRevisionInfos, survivingComments, textBoxContentsIn, toOpEnvelope, transferParagraphPropertySnapshot, transformBatch, transformPosition, trimIdLease, tryTrackedInsertionGroup, validateDocumentBatch, validateOpsDocument, validateSequencedBatch, withBodyContent, withParagraphCopies, withParagraphRenderings, withTextBoxesClosed, withoutCommentThreads, withoutPendingSuggestions, zeroWidthLeavesAt };
|
|
37285
|
+
export { BATCH_ANNOTATION_KINDS, BATCH_REJECTION_REASONS, BATCH_WIRE_OP_TYPES, BatchRejection, DEFAULT_ID_BLOCK_SIZES, DOCUMENT_OP_REFUSAL_REASONS, DOCUMENT_OP_SCHEMA_VERSION, DOCUMENT_OP_TYPES, DocumentOpRefusal, DocumentOpsContractError, EMPTY_PROPERTY_SETS, EXCLUSIVE_PARTS, ID_KIND_LIMITS, ID_LEASE_KINDS, ID_LEASE_REFUSAL_REASONS, INHERIT_RUN_PROPS, IdLeaseRefusal, MAX_BATCH_WIRE_BYTES, OBJECT_REPLACEMENT_CHARACTER, OP_STORIES, PARAGRAPH_MARK_FORMATTING_KEYS, PROPERTY_REVIEW_POLICIES, REVISION_DECISIONS, SPLIT_HALVES, TYPED_TEXT_FORMATTING, acceptCopyOriginAncestors, addCopyOriginAncestor, allocateCommentAnchorIds, applyBatch, applyDocumentOp, applyDocumentOpEnvelope, applyDocumentOps, beginTrackedInsertionCompilation, blockControlHolding, captureDocumentOp, captureStoryParts, combineEditEffects, combineEdits, combineRecordedRevisions, commentAnchorSequence, commentDocumentIssue, commentReferenceOffsets, compareBatchOrder, compareGaps, compileEditorIntent, contentRank, createClient, createEditorIntentIdAllocator, createSequencer, defaultInsertionGap, deletionRemovesBlock, documentStories, editorParagraphGroups, editorParagraphGroupsThroughTextBoxes, editorPositionAtPhysicalPosition, finalBreakCarrier, findStoryBody, formatParaId, formattingEquals, freshCommentId, freshLeasedIds, groupInsertionRuns, idKey, idLeaseHolds, idLeaseRemaining, inlineLeafSpans, introducedDocumentIds, introducedIds, inverseMeetingDocument, isBlockBoundary, isCommentAnchorCarrierType, isCommentExhausted, isCopyOriginAncestors, isKeptCut, isKeptCutPiece, isTextOnlyRun, joinPropertyChangeLink, leasedIdCensus, locateParagraphInBlockList, locateParagraphThroughTextBoxes, mapTocBookmarkPosition, mergeRunContent, normalizeForOps, noteDeletionOps, noteUsesCustomMark, orderAddressingBeforeRemoval, orderBatchOperations, orphanRootCommentIds, packageParagraphIds, packageResourcesOpOf, paragraphContentVerdict, paragraphHoldsContent, paragraphHoldsContentOnceAccepted, paragraphIdsIn, paragraphKeptCutsFromChanges, paragraphLength, paragraphLogicalText, paragraphMarkOutcome, paragraphPropertySnapshotToken, paragraphStatesItsFormatting, paragraphVisibleText, paragraphsThroughTextBoxes, parseDocumentBatch, pendingSuggestionIdsIn, physicalOffsetAtVisibleOffset, physicalPositionAtEditorOffset, planTrackedDeletion, planTrackedReplace, planWellFormedRanges, planWholeParagraphReplacement, preservedCommentRangeMarkersAt, reconcileDocumentPartRelationships, recordsCopyOrigin, registerParagraphPropertySnapshot, registerStatedParagraphFormatting, rejectCopyOriginAncestors, replaceStoryBody, resolveSectionChange, resolveSectionChanges, resolvedDocumentView, reviewFieldsOf, revisionIdDemand, revisionSpan, runsMergeable, sameStory, sectionPropertiesAt, sectionRejectProperties, sectionResolutionPatch, shiftCopyOriginAncestors, storyBody, storyLacksClosingParagraph, storyParagraphs, storyPartsOpOf, suggestedCommentIds, suggestionOwnersInStory, suggestionRevisionInfos, survivingComments, textBoxContentsIn, toOpEnvelope, transferParagraphPropertySnapshot, transformBatch, transformPosition, trimIdLease, tryTrackedInsertionGroup, validateDocumentBatch, validateOpsDocument, validateSequencedBatch, withBodyContent, withParagraphCopies, withParagraphRenderings, withTextBoxesClosed, withoutCommentThreads, withoutPendingSuggestions, zeroWidthLeavesAt };
|
package/package.json
CHANGED