@portone/docx-editor 0.3.0 → 0.5.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/CHANGELOG.md +205 -0
- package/assets/editor.png +0 -0
- package/dist/DocxEditor.d.ts +1 -1
- package/dist/DocxEditor.js +45 -25
- package/dist/core.d.ts +1 -1
- package/dist/docx/cloning.js +4 -9
- package/dist/docx/commentOnlyChange.d.ts +5 -3
- package/dist/docx/comments/grammar.d.ts +27 -10
- package/dist/docx/comments/grammar.js +18 -67
- package/dist/docx/comments/model.d.ts +5 -6
- package/dist/docx/comments/model.js +0 -9
- package/dist/docx/comments/parts.d.ts +16 -10
- package/dist/docx/comments/parts.js +65 -13
- package/dist/docx/comments/people.d.ts +11 -3
- package/dist/docx/comments/people.js +20 -6
- package/dist/docx/comments/policy.js +7 -1
- package/dist/docx/comments/reading.d.ts +4 -2
- package/dist/docx/comments/reading.js +1 -14
- package/dist/docx/comments/writing.js +78 -35
- package/dist/docx/exportDocx.js +30 -18
- package/dist/docx/exportRefs.d.ts +8 -3
- package/dist/docx/exportRefs.js +2 -1
- package/dist/docx/fidelity.js +24 -10
- package/dist/docx/fields.d.ts +42 -0
- package/dist/docx/fields.js +76 -0
- package/dist/docx/formatting/attrs.d.ts +20 -2
- package/dist/docx/formatting/attrs.js +57 -2
- package/dist/docx/formatting/context.d.ts +10 -2
- package/dist/docx/formatting/context.js +23 -5
- package/dist/docx/formatting/resolve.d.ts +10 -4
- package/dist/docx/formatting/resolve.js +31 -11
- package/dist/docx/formatting/styles.d.ts +25 -2
- package/dist/docx/formatting/styles.js +84 -3
- package/dist/docx/headersFooters.d.ts +89 -20
- package/dist/docx/headersFooters.js +163 -172
- package/dist/docx/hyperlink.d.ts +14 -4
- package/dist/docx/hyperlink.js +4 -1
- package/dist/docx/importDocx.d.ts +1 -1
- package/dist/docx/importDocx.js +135 -74
- package/dist/docx/importParagraph.d.ts +16 -4
- package/dist/docx/importParagraph.js +87 -93
- package/dist/docx/importPolicy.d.ts +70 -0
- package/dist/docx/importPolicy.js +190 -0
- package/dist/docx/importPreserved.d.ts +30 -0
- package/dist/docx/importPreserved.js +54 -0
- package/dist/docx/importTable.d.ts +2 -2
- package/dist/docx/importTable.js +107 -66
- package/dist/docx/invariants.js +42 -31
- package/dist/docx/newLists.d.ts +30 -0
- package/dist/docx/newLists.js +24 -1
- package/dist/docx/notes.d.ts +6 -1
- package/dist/docx/notes.js +6 -16
- package/dist/docx/numberingPlanner.d.ts +6 -3
- package/dist/docx/numberingPlanner.js +38 -7
- package/dist/docx/pageGeometry.d.ts +5 -14
- package/dist/docx/pageGeometry.js +0 -12
- package/dist/docx/protectionPolicy.d.ts +13 -5
- package/dist/docx/protectionPolicy.js +32 -22
- package/dist/docx/scan.d.ts +18 -8
- package/dist/docx/scan.js +17 -11
- package/dist/docx/sections.d.ts +126 -0
- package/dist/docx/sections.js +207 -0
- package/dist/docx/serializeBlock.d.ts +13 -4
- package/dist/docx/serializeBlock.js +16 -18
- package/dist/docx/serializeParagraph.d.ts +4 -0
- package/dist/docx/serializeParagraph.js +1 -0
- package/dist/docx/serializePreserved.d.ts +14 -0
- package/dist/docx/serializePreserved.js +24 -0
- package/dist/docx/serializeStory.d.ts +17 -0
- package/dist/docx/serializeStory.js +17 -0
- package/dist/docx/serializeTable.js +10 -13
- package/dist/docx/session.d.ts +24 -7
- package/dist/docx/session.js +37 -6
- package/dist/docx/story.d.ts +140 -0
- package/dist/docx/story.js +237 -0
- package/dist/docx/storyProjection.js +6 -1
- package/dist/docx/tableFormatting/conditions.d.ts +76 -0
- package/dist/docx/tableFormatting/conditions.js +196 -0
- package/dist/docx/tableFormatting/editing.d.ts +7 -3
- package/dist/docx/tableFormatting/editing.js +4 -5
- package/dist/docx/tableFormatting/reading.d.ts +49 -19
- package/dist/docx/tableFormatting/reading.js +109 -35
- package/dist/docx/tableFormatting.d.ts +1 -0
- package/dist/docx/tableFormatting.js +1 -0
- package/dist/docx/tableTemplate.js +12 -12
- package/dist/editor/clipboard/htmlReader.d.ts +30 -0
- package/dist/editor/clipboard/htmlReader.js +302 -0
- package/dist/editor/clipboard/internalChannel.d.ts +57 -0
- package/dist/editor/clipboard/internalChannel.js +58 -0
- package/dist/editor/clipboard/normalizers.d.ts +99 -0
- package/dist/editor/clipboard/normalizers.js +199 -0
- package/dist/editor/clipboard/parser.d.ts +34 -0
- package/dist/editor/clipboard/parser.js +58 -0
- package/dist/editor/clipboard/plugin.d.ts +21 -0
- package/dist/editor/clipboard/plugin.js +320 -0
- package/dist/editor/clipboard/readContext.d.ts +24 -0
- package/dist/editor/clipboard/readContext.js +19 -0
- package/dist/editor/clipboard/readers.d.ts +33 -0
- package/dist/editor/clipboard/readers.js +37 -0
- package/dist/editor/commands/comments/editing.d.ts +26 -6
- package/dist/editor/commands/comments/editing.js +175 -105
- package/dist/editor/commands/comments/model.d.ts +34 -17
- package/dist/editor/commands/comments/model.js +11 -0
- package/dist/editor/commands/comments/reading.d.ts +5 -3
- package/dist/editor/commands/comments/reading.js +8 -58
- package/dist/editor/commands/formatting/propertyCommands.js +6 -1
- package/dist/editor/commands/index.d.ts +2 -2
- package/dist/editor/commands/index.js +2 -0
- package/dist/editor/commands/listCommands.d.ts +12 -3
- package/dist/editor/commands/listCommands.js +76 -30
- package/dist/editor/commands/noteQueries.d.ts +22 -5
- package/dist/editor/commands/noteQueries.js +34 -6
- package/dist/editor/commands/paragraphCommands.js +6 -1
- package/dist/editor/createEditor.js +14 -4
- package/dist/editor/documentStyles.d.ts +26 -4
- package/dist/editor/documentStyles.js +9 -4
- package/dist/editor/editorDocument.d.ts +7 -6
- package/dist/editor/editorDocument.js +18 -6
- package/dist/editor/imageFiles.d.ts +2 -2
- package/dist/editor/imageFiles.js +2 -0
- package/dist/editor/insertTable.d.ts +1 -1
- package/dist/editor/insertTable.js +2 -2
- package/dist/editor/paragraphEdits.d.ts +16 -1
- package/dist/editor/paragraphEdits.js +13 -5
- package/dist/editor/paragraphPlacement.d.ts +11 -0
- package/dist/editor/paragraphPlacement.js +18 -0
- package/dist/editor/plainText.d.ts +12 -0
- package/dist/editor/plainText.js +2 -1
- package/dist/editor/plugins/columnResize.js +6 -3
- package/dist/editor/plugins/commentComposer.d.ts +28 -0
- package/dist/editor/plugins/commentComposer.js +46 -0
- package/dist/editor/plugins/commentDecorations.d.ts +29 -2
- package/dist/editor/plugins/commentDecorations.js +89 -15
- package/dist/editor/plugins/documentProjection.d.ts +31 -0
- package/dist/editor/plugins/documentProjection.js +22 -0
- package/dist/editor/plugins/imagePaste.js +20 -10
- package/dist/editor/plugins/linkPanel.d.ts +7 -3
- package/dist/editor/plugins/linkPanel.js +13 -27
- package/dist/editor/plugins/numberingDecorations.d.ts +10 -4
- package/dist/editor/plugins/numberingDecorations.js +43 -2
- package/dist/editor/plugins/panelState.d.ts +67 -0
- package/dist/editor/plugins/panelState.js +54 -0
- package/dist/editor/plugins/paragraphDisplay.js +9 -3
- package/dist/editor/plugins/tableContextMenu.d.ts +1 -1
- package/dist/editor/plugins/tableContextMenu.js +30 -47
- package/dist/editor/plugins/tableDisplay.js +19 -5
- package/dist/editor/plugins/textContextMenu.d.ts +1 -1
- package/dist/editor/plugins/textContextMenu.js +30 -47
- package/dist/model/format.d.ts +50 -0
- package/dist/model/format.js +65 -0
- package/dist/numbering/listRegistry.d.ts +37 -0
- package/dist/numbering/listRegistry.js +112 -0
- package/dist/numbering/listTemplate.d.ts +26 -17
- package/dist/numbering/listTemplate.js +66 -20
- package/dist/numbering/markers.d.ts +15 -6
- package/dist/numbering/markers.js +26 -59
- package/dist/numbering/parseNumbering.d.ts +70 -5
- package/dist/numbering/parseNumbering.js +100 -26
- package/dist/numbering/spellers.d.ts +15 -0
- package/dist/numbering/spellers.js +96 -0
- package/dist/numbering/writeNumbering.d.ts +5 -3
- package/dist/numbering/writeNumbering.js +15 -15
- package/dist/ooxml/conformance.d.ts +28 -0
- package/dist/ooxml/conformance.js +20 -0
- package/dist/ooxml/errors.d.ts +5 -5
- package/dist/ooxml/fragment.d.ts +11 -0
- package/dist/ooxml/fragment.js +14 -4
- package/dist/ooxml/image.d.ts +3 -4
- package/dist/ooxml/image.js +50 -5
- package/dist/ooxml/names.d.ts +15 -0
- package/dist/ooxml/names.js +10 -1
- package/dist/ooxml/partSplice.d.ts +1 -1
- package/dist/ooxml/partSplice.js +10 -3
- package/dist/ooxml/props.d.ts +8 -0
- package/dist/ooxml/props.js +14 -4
- package/dist/ooxml/rangeMarkers.d.ts +5 -0
- package/dist/ooxml/rangeMarkers.js +24 -0
- package/dist/ooxml/xml.d.ts +8 -9
- package/dist/ooxml/xml.js +6 -6
- package/dist/page/PageGuides.d.ts +8 -4
- package/dist/page/PageGuides.js +13 -37
- package/dist/page/pageLayout.d.ts +62 -13
- package/dist/page/pageLayout.js +91 -37
- package/dist/page/usePageLayout.d.ts +14 -11
- package/dist/page/usePageLayout.js +21 -29
- package/dist/schema/attrRoles.js +44 -19
- package/dist/schema/docxSchema.d.ts +9 -1
- package/dist/schema/docxSchema.js +220 -139
- package/dist/schema/editGuard.d.ts +1 -1
- package/dist/schema/guards.js +2 -2
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/preservedFragments.d.ts +12 -0
- package/dist/schema/preservedFragments.js +38 -0
- package/dist/schema/preservedGuards.d.ts +9 -7
- package/dist/schema/preservedGuards.js +112 -11
- package/dist/schema/protection.d.ts +34 -5
- package/dist/schema/protection.js +42 -14
- package/dist/schema/rendering.js +3 -1
- package/dist/schema/stories.d.ts +49 -0
- package/dist/schema/stories.js +78 -0
- package/dist/styles/classNames.d.ts +16 -7
- package/dist/styles/classNames.js +16 -7
- package/dist/styles.css +90 -30
- package/dist/table/cellFormatting.js +1 -2
- package/dist/table/gridBorders.d.ts +11 -15
- package/dist/table/gridBorders.js +32 -18
- package/dist/table/resize.d.ts +5 -3
- package/dist/ui/CommentsPanel.d.ts +1 -3
- package/dist/ui/CommentsPanel.js +24 -15
- package/dist/ui/NotesPanel.js +2 -2
- package/dist/ui/TextMenu.d.ts +1 -3
- package/dist/ui/TextMenu.js +10 -6
- package/dist/ui/comments/CommentComposer.d.ts +6 -1
- package/dist/ui/comments/CommentComposer.js +26 -3
- package/package.json +1 -1
- package/dist/editor/externalClipboard.d.ts +0 -11
- package/dist/editor/externalClipboard.js +0 -456
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { EditorView } from "prosemirror-view";
|
|
12
12
|
import { type RefObject } from "react";
|
|
13
|
-
import type
|
|
13
|
+
import { type SectionPixels } from "./pageLayout";
|
|
14
14
|
/** One place where a page parts from the next. The position is measured on the sheet */
|
|
15
15
|
export interface PageMark {
|
|
16
16
|
page: number;
|
|
@@ -19,15 +19,16 @@ export interface PageMark {
|
|
|
19
19
|
height: number;
|
|
20
20
|
crossed: boolean;
|
|
21
21
|
}
|
|
22
|
-
/** The number laid on the corner of a page */
|
|
23
|
-
export interface PageBadge {
|
|
24
|
-
page: number;
|
|
25
|
-
top: number;
|
|
26
|
-
exactPage: boolean;
|
|
27
|
-
}
|
|
28
22
|
/** The paper area of one visual page, used to place its header and footer stories. */
|
|
29
23
|
export interface PageFace {
|
|
30
24
|
page: number;
|
|
25
|
+
/** The position of the block this page opens with, which says which section it belongs to */
|
|
26
|
+
pos: number;
|
|
27
|
+
/**
|
|
28
|
+
* The place this page takes within that section, counted from 1 again at every section, which is
|
|
29
|
+
* what its header and footer variant is chosen by (`docx/headersFooters`)
|
|
30
|
+
*/
|
|
31
|
+
pageInSection: number;
|
|
31
32
|
headerTop: number;
|
|
32
33
|
footerTop: number;
|
|
33
34
|
left: number;
|
|
@@ -41,7 +42,6 @@ export interface PageOverlay {
|
|
|
41
42
|
/** The sheet height with the last page filled out in full */
|
|
42
43
|
sheetHeight: number;
|
|
43
44
|
marks: PageMark[];
|
|
44
|
-
badges: PageBadge[];
|
|
45
45
|
pages: PageFace[];
|
|
46
46
|
}
|
|
47
47
|
interface PageLayoutOptions {
|
|
@@ -50,8 +50,11 @@ interface PageLayoutOptions {
|
|
|
50
50
|
enabled: boolean;
|
|
51
51
|
/** A value that differs every time the text changes */
|
|
52
52
|
revision: unknown;
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The paper of each section of the open document (`page/pageLayout`), read once per document
|
|
55
|
+
* change by the caller. A4 where a document names none, and where none is open
|
|
56
|
+
*/
|
|
57
|
+
sections?: readonly SectionPixels[];
|
|
55
58
|
}
|
|
56
|
-
export declare function usePageLayout({ view, layer, enabled, revision,
|
|
59
|
+
export declare function usePageLayout({ view, layer, enabled, revision, sections, }: PageLayoutOptions): PageOverlay | null;
|
|
57
60
|
export {};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
useCallback,
|
|
4
4
|
useEffect,
|
|
5
|
-
useMemo,
|
|
6
5
|
useRef,
|
|
7
6
|
useState
|
|
8
7
|
} from "react";
|
|
@@ -10,12 +9,11 @@ import { editorCssVariables } from "../styles/classNames.js";
|
|
|
10
9
|
import { measureSheet } from "./measureBlocks.js";
|
|
11
10
|
import { setPageMarks } from "./pageDecorations.js";
|
|
12
11
|
import {
|
|
13
|
-
|
|
12
|
+
A4_SECTION_PIXELS,
|
|
14
13
|
PAGE_SPLIT_PX,
|
|
15
14
|
pageLayout,
|
|
16
|
-
|
|
15
|
+
sectionPaperAt
|
|
17
16
|
} from "./pageLayout.js";
|
|
18
|
-
var BADGE_INSET_PX = 8;
|
|
19
17
|
function useFrameThrottle(run, hold) {
|
|
20
18
|
const latest = useRef({ run, hold });
|
|
21
19
|
const frame = useRef(0);
|
|
@@ -46,59 +44,53 @@ function useFrameThrottle(run, hold) {
|
|
|
46
44
|
}, []);
|
|
47
45
|
}
|
|
48
46
|
function sameOverlay(a, b) {
|
|
49
|
-
return a !== null && a.left === b.left && a.top === b.top && a.width === b.width && a.sheetHeight === b.sheetHeight && JSON.stringify(a.marks) === JSON.stringify(b.marks) && JSON.stringify(a.
|
|
47
|
+
return a !== null && a.left === b.left && a.top === b.top && a.width === b.width && a.sheetHeight === b.sheetHeight && JSON.stringify(a.marks) === JSON.stringify(b.marks) && JSON.stringify(a.pages) === JSON.stringify(b.pages);
|
|
50
48
|
}
|
|
51
49
|
function usePageLayout({
|
|
52
50
|
view,
|
|
53
51
|
layer,
|
|
54
52
|
enabled,
|
|
55
53
|
revision,
|
|
56
|
-
|
|
54
|
+
sections
|
|
57
55
|
}) {
|
|
58
56
|
const [overlay, setOverlay] = useState(null);
|
|
59
|
-
const
|
|
60
|
-
() => geometry ? pagePixels(geometry) : A4_PAGE_PIXELS,
|
|
61
|
-
[geometry]
|
|
62
|
-
);
|
|
57
|
+
const papers = sections === void 0 || sections.length === 0 ? A4_SECTION_PIXELS : sections;
|
|
63
58
|
const remeasure = useFrameThrottle(
|
|
64
59
|
() => {
|
|
65
60
|
const box = layer.current;
|
|
66
61
|
if (!view || !box || !enabled) return;
|
|
67
62
|
const measured = measureSheet(view, box);
|
|
68
|
-
const layout = pageLayout({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
pageStep: page.pageStep
|
|
72
|
-
});
|
|
63
|
+
const layout = pageLayout({ blocks: measured.blocks, sections: papers });
|
|
64
|
+
const paperOf = (pos) => sectionPaperAt(papers, pos);
|
|
65
|
+
const sheet = paperOf(0);
|
|
73
66
|
setPageMarks(view, { pushes: layout.pushes, cuts: layout.cuts });
|
|
74
|
-
const sheetHeight = measured.contentTop + layout.bodyHeight + measured.contentBottom;
|
|
67
|
+
const sheetHeight = measured.contentTop + layout.bodyHeight + Math.max(measured.contentBottom, layout.marginBottom);
|
|
75
68
|
box.style.setProperty(editorCssVariables.sheetHeight, `${sheetHeight}px`);
|
|
76
69
|
const next = {
|
|
77
70
|
left: measured.left,
|
|
78
71
|
top: measured.top,
|
|
79
72
|
width: measured.width,
|
|
80
73
|
sheetHeight,
|
|
74
|
+
// A gap opens below the page that ends at this place, so it is that page's own margin
|
|
75
|
+
// the band is drawn under
|
|
81
76
|
marks: layout.splits.map((split) => ({
|
|
82
77
|
page: split.page,
|
|
83
|
-
top: measured.contentTop + split.y + (split.crossed ? 0 : page.marginBottom),
|
|
78
|
+
top: measured.contentTop + split.y + (split.crossed ? 0 : paperOf(layout.pages[split.page - 2]?.pos ?? 0).marginBottom),
|
|
84
79
|
height: split.crossed ? 0 : PAGE_SPLIT_PX,
|
|
85
80
|
crossed: split.crossed
|
|
86
81
|
})),
|
|
87
|
-
//
|
|
88
|
-
// so the place it was split at is its corner
|
|
89
|
-
badges: layout.pages.map((start) => ({
|
|
90
|
-
page: start.page,
|
|
91
|
-
top: measured.contentTop + start.bodyStart - (start.crossed ? 0 : page.marginTop) + BADGE_INSET_PX,
|
|
92
|
-
exactPage: start.exactPage
|
|
93
|
-
})),
|
|
82
|
+
// A page crossed into has no margin, so the place it was split at is its top corner
|
|
94
83
|
pages: layout.pages.map((start) => {
|
|
95
|
-
const
|
|
84
|
+
const paper = paperOf(start.pos);
|
|
85
|
+
const paperTop = measured.contentTop + start.bodyStart - (start.crossed ? 0 : paper.marginTop);
|
|
96
86
|
return {
|
|
97
87
|
page: start.page,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
pos: start.pos,
|
|
89
|
+
pageInSection: start.pageInSection,
|
|
90
|
+
headerTop: paperTop + paper.marginTop / 2,
|
|
91
|
+
footerTop: paperTop + paper.pageHeight - paper.marginBottom / 2,
|
|
92
|
+
left: sheet.marginLeft,
|
|
93
|
+
width: sheet.bodyWidth,
|
|
102
94
|
crossed: start.crossed
|
|
103
95
|
};
|
|
104
96
|
})
|
package/dist/schema/attrRoles.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
// src/schema/attrRoles.ts
|
|
2
2
|
import { NodeType } from "prosemirror-model";
|
|
3
3
|
var NODE_ATTR_ROLES = {
|
|
4
|
+
doc: {
|
|
5
|
+
// The definitions of the lists started while editing. The export writes numbering.xml from
|
|
6
|
+
// them and nothing derives them again, so they are a source value the document node holds
|
|
7
|
+
newLists: { role: "source", class: "model" },
|
|
8
|
+
// The section that closes the body, as the document wrote it. The export writes it back out
|
|
9
|
+
// between the blocks and the tail, so a change to it is a change to the document
|
|
10
|
+
sectPr: { role: "source", class: "preserved" },
|
|
11
|
+
// What each side story currently says. The comment writer puts a comment's back into the
|
|
12
|
+
// Comments part, so a change to one is a change to the document
|
|
13
|
+
stories: { role: "source", class: "model" }
|
|
14
|
+
},
|
|
4
15
|
paragraph: {
|
|
5
16
|
srcId: { role: "session", class: "identity" },
|
|
6
17
|
pAttrs: { role: "source", class: "preserved" },
|
|
@@ -18,13 +29,20 @@ var NODE_ATTR_ROLES = {
|
|
|
18
29
|
gridChange: { role: "source", class: "preserved" },
|
|
19
30
|
format: { role: "display", class: "derived" },
|
|
20
31
|
styleInside: { role: "display", class: "derived" },
|
|
21
|
-
styleCellMargins: { role: "display", class: "derived" }
|
|
32
|
+
styleCellMargins: { role: "display", class: "derived" },
|
|
33
|
+
styleConditions: { role: "display", class: "derived" },
|
|
34
|
+
styleBands: { role: "display", class: "derived" },
|
|
35
|
+
// The markers a table and a row carry are content the writer puts back exactly where it
|
|
36
|
+
// stood, so a change to one is a change to the table rather than a display refresh
|
|
37
|
+
leadingXml: { role: "source", class: "preserved" }
|
|
22
38
|
},
|
|
23
39
|
tableRow: {
|
|
24
40
|
trAttrs: { role: "source", class: "preserved" },
|
|
25
41
|
tblPrEx: { role: "source", class: "preserved" },
|
|
26
42
|
trPr: { role: "source", class: "preserved" },
|
|
27
|
-
format: { role: "display", class: "derived" }
|
|
43
|
+
format: { role: "display", class: "derived" },
|
|
44
|
+
leadingXml: { role: "source", class: "preserved" },
|
|
45
|
+
trailingXml: { role: "source", class: "preserved" }
|
|
28
46
|
},
|
|
29
47
|
tableCell: {
|
|
30
48
|
colspan: { role: "source", class: "model" },
|
|
@@ -40,19 +58,15 @@ var NODE_ATTR_ROLES = {
|
|
|
40
58
|
// it out of the comparison would let a step that unlocks a cell pass as a re-derivation
|
|
41
59
|
sdtPrefix: { role: "source", class: "preserved" },
|
|
42
60
|
sdtContentsLocked: { role: "source", class: "derived" },
|
|
43
|
-
sdtDeletionLocked: { role: "source", class: "derived" }
|
|
61
|
+
sdtDeletionLocked: { role: "source", class: "derived" },
|
|
62
|
+
trailingXml: { role: "source", class: "preserved" }
|
|
44
63
|
},
|
|
45
64
|
rawBlock: {
|
|
46
65
|
xml: { role: "source", class: "preserved" },
|
|
47
|
-
name: { role: "source", class: "identity" }
|
|
48
|
-
},
|
|
49
|
-
docxRaw: {
|
|
50
66
|
srcId: { role: "session", class: "identity" },
|
|
51
|
-
name: { role: "session", class: "identity" }
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
srcId: { role: "session", class: "identity" },
|
|
55
|
-
name: { role: "session", class: "identity" }
|
|
67
|
+
name: { role: "session", class: "identity" },
|
|
68
|
+
display: { role: "session", class: "derived" },
|
|
69
|
+
guarded: { role: "session", class: "derived" }
|
|
56
70
|
},
|
|
57
71
|
hardBreak: { brAttrs: { role: "source", class: "preserved" } },
|
|
58
72
|
image: {
|
|
@@ -77,14 +91,11 @@ var NODE_ATTR_ROLES = {
|
|
|
77
91
|
authorId: { role: "source", class: "model" },
|
|
78
92
|
initials: { role: "source", class: "model" },
|
|
79
93
|
date: { role: "source", class: "model" },
|
|
80
|
-
text: { role: "source", class: "model" },
|
|
81
|
-
commentXml: { role: "source", class: "preserved" },
|
|
82
94
|
paraId: { role: "source", class: "identity" },
|
|
83
95
|
resolved: { role: "source", class: "model" },
|
|
84
96
|
extensionXml: { role: "source", class: "preserved" },
|
|
85
97
|
replies: { role: "source", class: "model" },
|
|
86
|
-
// Read to decide whether the comment
|
|
87
|
-
imported: { role: "session", class: "derived" },
|
|
98
|
+
// Read to decide whether the extended comment part is rewritten at all; it is never written
|
|
88
99
|
threadImported: { role: "session", class: "derived" }
|
|
89
100
|
},
|
|
90
101
|
noteReference: {
|
|
@@ -92,12 +103,26 @@ var NODE_ATTR_ROLES = {
|
|
|
92
103
|
id: { role: "source", class: "identity" },
|
|
93
104
|
customMarkFollows: { role: "source", class: "model" },
|
|
94
105
|
referenceXml: { role: "source", class: "preserved" },
|
|
95
|
-
//
|
|
106
|
+
// Worked out from the notes part as the document was opened, and the writer puts back the
|
|
96
107
|
// reference alone: a note renumbered around an edit is the same reference it was
|
|
97
|
-
label: { role: "display", class: "derived" }
|
|
98
|
-
|
|
108
|
+
label: { role: "display", class: "derived" }
|
|
109
|
+
},
|
|
110
|
+
rawRunContent: {
|
|
111
|
+
xml: { role: "source", class: "preserved" },
|
|
112
|
+
// What the fragment is and how it is drawn are read off the preservation table when the
|
|
113
|
+
// document is opened and never worked out again, so they travel with the fragment itself
|
|
114
|
+
element: { role: "session", class: "identity" },
|
|
115
|
+
display: { role: "session", class: "derived" },
|
|
116
|
+
text: { role: "session", class: "derived" },
|
|
117
|
+
guarded: { role: "session", class: "derived" }
|
|
99
118
|
},
|
|
100
|
-
rawInline: {
|
|
119
|
+
rawInline: {
|
|
120
|
+
xml: { role: "source", class: "preserved" },
|
|
121
|
+
element: { role: "session", class: "identity" },
|
|
122
|
+
display: { role: "session", class: "derived" },
|
|
123
|
+
text: { role: "session", class: "derived" },
|
|
124
|
+
guarded: { role: "session", class: "derived" }
|
|
125
|
+
}
|
|
101
126
|
};
|
|
102
127
|
var MARK_ATTR_ROLES = {
|
|
103
128
|
run: {
|
|
@@ -15,4 +15,12 @@ import { Schema } from "prosemirror-model";
|
|
|
15
15
|
export { imageNodeSpec, runMarkSpec } from "./rendering";
|
|
16
16
|
/** Whether this is a page-splitting break (`<w:br w:type="page"/>`). Read straight from the original attribute text */
|
|
17
17
|
export declare function isPageBreak(brAttrs: unknown): boolean;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* How a preserved fragment is drawn, baked into the node's attrs when the document is opened
|
|
20
|
+
* (`docx/importPolicy`) so that this layer reads a value rather than a vocabulary.
|
|
21
|
+
*
|
|
22
|
+
* `hidden` puts nothing on screen, `text` draws the character the fragment stands for, `break`
|
|
23
|
+
* ends the line where it stood, and `chip` draws a small box naming the element.
|
|
24
|
+
*/
|
|
25
|
+
export type PreservedDisplay = "hidden" | "text" | "break" | "chip";
|
|
26
|
+
export declare const docxSchema: Schema<"commentEnd" | "commentReference" | "commentStart" | "doc" | "hardBreak" | "image" | "noteReference" | "paragraph" | "rawBlock" | "rawInline" | "rawRunContent" | "table" | "tableCell" | "tableRow" | "text", "link" | "run" | "sdt" | "tab">;
|