@portone/docx-editor 0.1.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.
Files changed (347) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/CONTRIBUTING.md +63 -0
  3. package/LICENSE +203 -0
  4. package/README.md +48 -0
  5. package/assets/editor.png +0 -0
  6. package/dist/DocxEditor.d.ts +123 -0
  7. package/dist/DocxEditor.js +348 -0
  8. package/dist/core.d.ts +36 -0
  9. package/dist/core.js +38 -0
  10. package/dist/docx/comments/constants.d.ts +8 -0
  11. package/dist/docx/comments/constants.js +20 -0
  12. package/dist/docx/comments/model.d.ts +37 -0
  13. package/dist/docx/comments/model.js +104 -0
  14. package/dist/docx/comments/reading.d.ts +36 -0
  15. package/dist/docx/comments/reading.js +149 -0
  16. package/dist/docx/comments/writing.d.ts +11 -0
  17. package/dist/docx/comments/writing.js +327 -0
  18. package/dist/docx/comments.d.ts +3 -0
  19. package/dist/docx/comments.js +4 -0
  20. package/dist/docx/container.d.ts +12 -0
  21. package/dist/docx/container.js +130 -0
  22. package/dist/docx/documentSettings.d.ts +4 -0
  23. package/dist/docx/documentSettings.js +14 -0
  24. package/dist/docx/exportDocx.d.ts +15 -0
  25. package/dist/docx/exportDocx.js +163 -0
  26. package/dist/docx/exportRefs.d.ts +16 -0
  27. package/dist/docx/exportRefs.js +10 -0
  28. package/dist/docx/formatting/direct.d.ts +30 -0
  29. package/dist/docx/formatting/direct.js +201 -0
  30. package/dist/docx/formatting/effectiveParagraph.d.ts +15 -0
  31. package/dist/docx/formatting/effectiveParagraph.js +81 -0
  32. package/dist/docx/formatting/styles.d.ts +67 -0
  33. package/dist/docx/formatting/styles.js +165 -0
  34. package/dist/docx/formatting/tabStops.d.ts +8 -0
  35. package/dist/docx/formatting/tabStops.js +65 -0
  36. package/dist/docx/formatting.d.ts +4 -0
  37. package/dist/docx/formatting.js +4 -0
  38. package/dist/docx/headersFooters.d.ts +36 -0
  39. package/dist/docx/headersFooters.js +218 -0
  40. package/dist/docx/hyperlink.d.ts +75 -0
  41. package/dist/docx/hyperlink.js +71 -0
  42. package/dist/docx/importDocx.d.ts +21 -0
  43. package/dist/docx/importDocx.js +263 -0
  44. package/dist/docx/importParagraph.d.ts +32 -0
  45. package/dist/docx/importParagraph.js +308 -0
  46. package/dist/docx/importTable.d.ts +9 -0
  47. package/dist/docx/importTable.js +275 -0
  48. package/dist/docx/media.d.ts +60 -0
  49. package/dist/docx/media.js +213 -0
  50. package/dist/docx/notes.d.ts +22 -0
  51. package/dist/docx/notes.js +71 -0
  52. package/dist/docx/pageGeometry.d.ts +75 -0
  53. package/dist/docx/pageGeometry.js +88 -0
  54. package/dist/docx/paraProps.d.ts +74 -0
  55. package/dist/docx/paraProps.js +167 -0
  56. package/dist/docx/propsXml.d.ts +49 -0
  57. package/dist/docx/propsXml.js +302 -0
  58. package/dist/docx/relationships.d.ts +42 -0
  59. package/dist/docx/relationships.js +94 -0
  60. package/dist/docx/runProps.d.ts +51 -0
  61. package/dist/docx/runProps.js +207 -0
  62. package/dist/docx/scan.d.ts +20 -0
  63. package/dist/docx/scan.js +110 -0
  64. package/dist/docx/sdt.d.ts +56 -0
  65. package/dist/docx/sdt.js +104 -0
  66. package/dist/docx/sdtProps.d.ts +18 -0
  67. package/dist/docx/sdtProps.js +11 -0
  68. package/dist/docx/serializeBlock.d.ts +4 -0
  69. package/dist/docx/serializeBlock.js +30 -0
  70. package/dist/docx/serializeParagraph.d.ts +15 -0
  71. package/dist/docx/serializeParagraph.js +208 -0
  72. package/dist/docx/serializeTable.d.ts +12 -0
  73. package/dist/docx/serializeTable.js +134 -0
  74. package/dist/docx/session.d.ts +81 -0
  75. package/dist/docx/session.js +79 -0
  76. package/dist/docx/tableFormatting/editing.d.ts +64 -0
  77. package/dist/docx/tableFormatting/editing.js +318 -0
  78. package/dist/docx/tableFormatting/reading.d.ts +96 -0
  79. package/dist/docx/tableFormatting/reading.js +221 -0
  80. package/dist/docx/tableFormatting.d.ts +2 -0
  81. package/dist/docx/tableFormatting.js +3 -0
  82. package/dist/docx/tableTemplate.d.ts +22 -0
  83. package/dist/docx/tableTemplate.js +111 -0
  84. package/dist/docx/theme.d.ts +40 -0
  85. package/dist/docx/theme.js +61 -0
  86. package/dist/docx/uniqueControls.d.ts +14 -0
  87. package/dist/docx/uniqueControls.js +62 -0
  88. package/dist/download.d.ts +57 -0
  89. package/dist/download.js +44 -0
  90. package/dist/editor/clipboard/images.d.ts +14 -0
  91. package/dist/editor/clipboard/images.js +158 -0
  92. package/dist/editor/clipboard/inlineFormatting.d.ts +21 -0
  93. package/dist/editor/clipboard/inlineFormatting.js +232 -0
  94. package/dist/editor/commands/breakCommands.d.ts +8 -0
  95. package/dist/editor/commands/breakCommands.js +19 -0
  96. package/dist/editor/commands/canRunCommand.d.ts +6 -0
  97. package/dist/editor/commands/canRunCommand.js +10 -0
  98. package/dist/editor/commands/commentCommands.d.ts +3 -0
  99. package/dist/editor/commands/commentCommands.js +4 -0
  100. package/dist/editor/commands/comments/editing.d.ts +21 -0
  101. package/dist/editor/commands/comments/editing.js +305 -0
  102. package/dist/editor/commands/comments/model.d.ts +31 -0
  103. package/dist/editor/commands/comments/model.js +0 -0
  104. package/dist/editor/commands/comments/reading.d.ts +8 -0
  105. package/dist/editor/commands/comments/reading.js +58 -0
  106. package/dist/editor/commands/formatting/editing.d.ts +32 -0
  107. package/dist/editor/commands/formatting/editing.js +138 -0
  108. package/dist/editor/commands/formatting/reading.d.ts +57 -0
  109. package/dist/editor/commands/formatting/reading.js +82 -0
  110. package/dist/editor/commands/formatting/shared.d.ts +32 -0
  111. package/dist/editor/commands/formatting/shared.js +53 -0
  112. package/dist/editor/commands/formattingCommands.d.ts +2 -0
  113. package/dist/editor/commands/formattingCommands.js +3 -0
  114. package/dist/editor/commands/historyCommands.d.ts +11 -0
  115. package/dist/editor/commands/historyCommands.js +16 -0
  116. package/dist/editor/commands/indentCommands.d.ts +15 -0
  117. package/dist/editor/commands/indentCommands.js +44 -0
  118. package/dist/editor/commands/index.d.ts +82 -0
  119. package/dist/editor/commands/index.js +171 -0
  120. package/dist/editor/commands/linkCommands.d.ts +56 -0
  121. package/dist/editor/commands/linkCommands.js +146 -0
  122. package/dist/editor/commands/listCommands.d.ts +58 -0
  123. package/dist/editor/commands/listCommands.js +140 -0
  124. package/dist/editor/commands/lockCommands.d.ts +47 -0
  125. package/dist/editor/commands/lockCommands.js +198 -0
  126. package/dist/editor/commands/noteQueries.d.ts +12 -0
  127. package/dist/editor/commands/noteQueries.js +29 -0
  128. package/dist/editor/commands/paragraphCommands.d.ts +59 -0
  129. package/dist/editor/commands/paragraphCommands.js +113 -0
  130. package/dist/editor/commands/spacingCommands.d.ts +23 -0
  131. package/dist/editor/commands/spacingCommands.js +48 -0
  132. package/dist/editor/commands/tabCommands.d.ts +5 -0
  133. package/dist/editor/commands/tabCommands.js +65 -0
  134. package/dist/editor/createEditor.d.ts +59 -0
  135. package/dist/editor/createEditor.js +160 -0
  136. package/dist/editor/documentStyles.d.ts +60 -0
  137. package/dist/editor/documentStyles.js +80 -0
  138. package/dist/editor/externalClipboard.d.ts +11 -0
  139. package/dist/editor/externalClipboard.js +323 -0
  140. package/dist/editor/imageFiles.d.ts +74 -0
  141. package/dist/editor/imageFiles.js +173 -0
  142. package/dist/editor/insertImage.d.ts +31 -0
  143. package/dist/editor/insertImage.js +35 -0
  144. package/dist/editor/insertTable.d.ts +18 -0
  145. package/dist/editor/insertTable.js +44 -0
  146. package/dist/editor/paragraphEdits.d.ts +42 -0
  147. package/dist/editor/paragraphEdits.js +59 -0
  148. package/dist/editor/plainText.d.ts +3 -0
  149. package/dist/editor/plainText.js +50 -0
  150. package/dist/editor/plugins/bookmarkProtection.d.ts +3 -0
  151. package/dist/editor/plugins/bookmarkProtection.js +28 -0
  152. package/dist/editor/plugins/columnResize.d.ts +27 -0
  153. package/dist/editor/plugins/columnResize.js +192 -0
  154. package/dist/editor/plugins/commentDecorations.d.ts +3 -0
  155. package/dist/editor/plugins/commentDecorations.js +23 -0
  156. package/dist/editor/plugins/commentReservations.d.ts +5 -0
  157. package/dist/editor/plugins/commentReservations.js +26 -0
  158. package/dist/editor/plugins/dropCaret.d.ts +10 -0
  159. package/dist/editor/plugins/dropCaret.js +11 -0
  160. package/dist/editor/plugins/imagePaste.d.ts +8 -0
  161. package/dist/editor/plugins/imagePaste.js +265 -0
  162. package/dist/editor/plugins/keymap.d.ts +5 -0
  163. package/dist/editor/plugins/keymap.js +94 -0
  164. package/dist/editor/plugins/linkPanel.d.ts +23 -0
  165. package/dist/editor/plugins/linkPanel.js +39 -0
  166. package/dist/editor/plugins/listInputRules.d.ts +14 -0
  167. package/dist/editor/plugins/listInputRules.js +36 -0
  168. package/dist/editor/plugins/lockedContent.d.ts +6 -0
  169. package/dist/editor/plugins/lockedContent.js +41 -0
  170. package/dist/editor/plugins/noteProtection.d.ts +3 -0
  171. package/dist/editor/plugins/noteProtection.js +25 -0
  172. package/dist/editor/plugins/numberingDecorations.d.ts +42 -0
  173. package/dist/editor/plugins/numberingDecorations.js +110 -0
  174. package/dist/editor/plugins/rowResize.d.ts +15 -0
  175. package/dist/editor/plugins/rowResize.js +196 -0
  176. package/dist/editor/plugins/styledParagraphs.d.ts +15 -0
  177. package/dist/editor/plugins/styledParagraphs.js +65 -0
  178. package/dist/editor/plugins/tabCaret.d.ts +3 -0
  179. package/dist/editor/plugins/tabCaret.js +126 -0
  180. package/dist/editor/plugins/tabDecorations.d.ts +11 -0
  181. package/dist/editor/plugins/tabDecorations.js +87 -0
  182. package/dist/editor/plugins/tabLayout.d.ts +16 -0
  183. package/dist/editor/plugins/tabLayout.js +328 -0
  184. package/dist/editor/plugins/tabPointer.d.ts +7 -0
  185. package/dist/editor/plugins/tabPointer.js +95 -0
  186. package/dist/editor/plugins/tableContextMenu.d.ts +21 -0
  187. package/dist/editor/plugins/tableContextMenu.js +88 -0
  188. package/dist/editor/plugins/textContextMenu.d.ts +15 -0
  189. package/dist/editor/plugins/textContextMenu.js +90 -0
  190. package/dist/editor/views/imageResize.d.ts +53 -0
  191. package/dist/editor/views/imageResize.js +167 -0
  192. package/dist/editor/views/runMarkView.d.ts +15 -0
  193. package/dist/editor/views/runMarkView.js +9 -0
  194. package/dist/editor/views/tableView.d.ts +24 -0
  195. package/dist/editor/views/tableView.js +32 -0
  196. package/dist/index.d.ts +44 -0
  197. package/dist/index.js +38 -0
  198. package/dist/model/format.d.ts +240 -0
  199. package/dist/model/format.js +305 -0
  200. package/dist/model/tabStops.d.ts +17 -0
  201. package/dist/model/tabStops.js +22 -0
  202. package/dist/numbering/listTemplate.d.ts +29 -0
  203. package/dist/numbering/listTemplate.js +83 -0
  204. package/dist/numbering/markers.d.ts +24 -0
  205. package/dist/numbering/markers.js +93 -0
  206. package/dist/numbering/parseNumbering.d.ts +65 -0
  207. package/dist/numbering/parseNumbering.js +116 -0
  208. package/dist/numbering/writeNumbering.d.ts +13 -0
  209. package/dist/numbering/writeNumbering.js +49 -0
  210. package/dist/ooxml/errors.d.ts +39 -0
  211. package/dist/ooxml/errors.js +21 -0
  212. package/dist/ooxml/image.d.ts +88 -0
  213. package/dist/ooxml/image.js +106 -0
  214. package/dist/ooxml/tabStops.d.ts +3 -0
  215. package/dist/ooxml/tabStops.js +51 -0
  216. package/dist/ooxml/units.d.ts +37 -0
  217. package/dist/ooxml/units.js +116 -0
  218. package/dist/ooxml/xml.d.ts +36 -0
  219. package/dist/ooxml/xml.js +89 -0
  220. package/dist/page/PageGuides.d.ts +16 -0
  221. package/dist/page/PageGuides.js +114 -0
  222. package/dist/page/measureBlocks.d.ts +25 -0
  223. package/dist/page/measureBlocks.js +80 -0
  224. package/dist/page/pageDecorations.d.ts +36 -0
  225. package/dist/page/pageDecorations.js +211 -0
  226. package/dist/page/pageLayout.d.ts +176 -0
  227. package/dist/page/pageLayout.js +157 -0
  228. package/dist/page/tableMeasurements.d.ts +10 -0
  229. package/dist/page/tableMeasurements.js +115 -0
  230. package/dist/page/usePageLayout.d.ts +57 -0
  231. package/dist/page/usePageLayout.js +141 -0
  232. package/dist/schema/docxSchema.d.ts +9 -0
  233. package/dist/schema/docxSchema.js +863 -0
  234. package/dist/schema/index.d.ts +2 -0
  235. package/dist/schema/index.js +9 -0
  236. package/dist/schema/locks.d.ts +112 -0
  237. package/dist/schema/locks.js +211 -0
  238. package/dist/schema/rendering.d.ts +6 -0
  239. package/dist/schema/rendering.js +46 -0
  240. package/dist/styles/classNames.d.ts +214 -0
  241. package/dist/styles/classNames.js +208 -0
  242. package/dist/styles/colors.d.ts +11 -0
  243. package/dist/styles/colors.js +14 -0
  244. package/dist/styles/fontSizes.d.ts +6 -0
  245. package/dist/styles/fontSizes.js +20 -0
  246. package/dist/styles/fontStack.d.ts +55 -0
  247. package/dist/styles/fontStack.js +262 -0
  248. package/dist/styles/fonts.d.ts +6 -0
  249. package/dist/styles/fonts.js +11 -0
  250. package/dist/styles/inlineStyle.d.ts +67 -0
  251. package/dist/styles/inlineStyle.js +212 -0
  252. package/dist/styles/lineSpacings.d.ts +11 -0
  253. package/dist/styles/lineSpacings.js +10 -0
  254. package/dist/styles.css +1650 -0
  255. package/dist/table/cellBorders.d.ts +12 -0
  256. package/dist/table/cellBorders.js +9 -0
  257. package/dist/table/cellFormatting.d.ts +57 -0
  258. package/dist/table/cellFormatting.js +173 -0
  259. package/dist/table/columns.d.ts +25 -0
  260. package/dist/table/columns.js +155 -0
  261. package/dist/table/commands.d.ts +19 -0
  262. package/dist/table/commands.js +63 -0
  263. package/dist/table/format.d.ts +35 -0
  264. package/dist/table/format.js +26 -0
  265. package/dist/table/gridBorders.d.ts +42 -0
  266. package/dist/table/gridBorders.js +192 -0
  267. package/dist/table/index.d.ts +16 -0
  268. package/dist/table/index.js +52 -0
  269. package/dist/table/merge.d.ts +36 -0
  270. package/dist/table/merge.js +125 -0
  271. package/dist/table/resize.d.ts +55 -0
  272. package/dist/table/resize.js +66 -0
  273. package/dist/table/rowResize.d.ts +14 -0
  274. package/dist/table/rowResize.js +44 -0
  275. package/dist/table/rows.d.ts +32 -0
  276. package/dist/table/rows.js +89 -0
  277. package/dist/table/widths.d.ts +69 -0
  278. package/dist/table/widths.js +97 -0
  279. package/dist/ui/AlignMenu.d.ts +15 -0
  280. package/dist/ui/AlignMenu.js +64 -0
  281. package/dist/ui/CellStyleGroup.d.ts +15 -0
  282. package/dist/ui/CellStyleGroup.js +232 -0
  283. package/dist/ui/ColorPicker.d.ts +13 -0
  284. package/dist/ui/ColorPicker.js +165 -0
  285. package/dist/ui/CommentsPanel.d.ts +15 -0
  286. package/dist/ui/CommentsPanel.js +348 -0
  287. package/dist/ui/FontFamilySelect.d.ts +14 -0
  288. package/dist/ui/FontFamilySelect.js +59 -0
  289. package/dist/ui/FontSizeSelect.d.ts +11 -0
  290. package/dist/ui/FontSizeSelect.js +49 -0
  291. package/dist/ui/InsertImageButton.d.ts +9 -0
  292. package/dist/ui/InsertImageButton.js +47 -0
  293. package/dist/ui/LinkCard.d.ts +12 -0
  294. package/dist/ui/LinkCard.js +127 -0
  295. package/dist/ui/LinkPanel.d.ts +9 -0
  296. package/dist/ui/LinkPanel.js +121 -0
  297. package/dist/ui/MenuChoice.d.ts +11 -0
  298. package/dist/ui/MenuChoice.js +32 -0
  299. package/dist/ui/NotesPanel.d.ts +6 -0
  300. package/dist/ui/NotesPanel.js +33 -0
  301. package/dist/ui/ParagraphStyleSelect.d.ts +11 -0
  302. package/dist/ui/ParagraphStyleSelect.js +62 -0
  303. package/dist/ui/Popover.d.ts +22 -0
  304. package/dist/ui/Popover.js +74 -0
  305. package/dist/ui/SpacingMenu.d.ts +12 -0
  306. package/dist/ui/SpacingMenu.js +54 -0
  307. package/dist/ui/TableMenu.d.ts +12 -0
  308. package/dist/ui/TableMenu.js +112 -0
  309. package/dist/ui/TableSizePicker.d.ts +9 -0
  310. package/dist/ui/TableSizePicker.js +53 -0
  311. package/dist/ui/TextMenu.d.ts +15 -0
  312. package/dist/ui/TextMenu.js +194 -0
  313. package/dist/ui/Toolbar.d.ts +19 -0
  314. package/dist/ui/Toolbar.js +448 -0
  315. package/dist/ui/ToolbarButton.d.ts +23 -0
  316. package/dist/ui/ToolbarButton.js +56 -0
  317. package/dist/ui/Tooltip.d.ts +19 -0
  318. package/dist/ui/Tooltip.js +47 -0
  319. package/dist/ui/ZoomSelect.d.ts +7 -0
  320. package/dist/ui/ZoomSelect.js +44 -0
  321. package/dist/ui/comments/CommentComposer.d.ts +17 -0
  322. package/dist/ui/comments/CommentComposer.js +59 -0
  323. package/dist/ui/comments/useCommentRailLayout.d.ts +18 -0
  324. package/dist/ui/comments/useCommentRailLayout.js +183 -0
  325. package/dist/ui/keyboardWalk.d.ts +22 -0
  326. package/dist/ui/keyboardWalk.js +70 -0
  327. package/dist/ui/openAddress.d.ts +11 -0
  328. package/dist/ui/openAddress.js +16 -0
  329. package/dist/ui/panelPlacement.d.ts +51 -0
  330. package/dist/ui/panelPlacement.js +71 -0
  331. package/dist/ui/presets.d.ts +11 -0
  332. package/dist/ui/presets.js +0 -0
  333. package/dist/ui/rovingFocus.d.ts +20 -0
  334. package/dist/ui/rovingFocus.js +61 -0
  335. package/dist/ui/runCommand.d.ts +5 -0
  336. package/dist/ui/runCommand.js +13 -0
  337. package/dist/ui/useDismiss.d.ts +6 -0
  338. package/dist/ui/useDismiss.js +31 -0
  339. package/dist/ui/useFitWidthZoom.d.ts +2 -0
  340. package/dist/ui/useFitWidthZoom.js +26 -0
  341. package/dist/ui/useGridKeyboard.d.ts +12 -0
  342. package/dist/ui/useGridKeyboard.js +90 -0
  343. package/dist/ui/useMenuKeyboard.d.ts +12 -0
  344. package/dist/ui/useMenuKeyboard.js +56 -0
  345. package/dist/ui/zoom.d.ts +4 -0
  346. package/dist/ui/zoom.js +21 -0
  347. package/package.json +120 -0
@@ -0,0 +1,176 @@
1
+ /**
2
+ * The arithmetic that makes one continuous sheet look like separate pages.
3
+ *
4
+ * The push amounts, the space opened at each page break and the places where a gap opens up
5
+ * between pages are all decided here in one pass, and the view simply uses those values.
6
+ * A page break is the one thing split inside a block; nothing else is broken line by line, so
7
+ * the places where Word actually breaks may differ.
8
+ *
9
+ * The size of a page is the document's own (`docx/pageGeometry`), not a fixed A4: a Letter
10
+ * document breaks at Letter's height and fits its tables to Letter's width.
11
+ */
12
+ import { type PageGeometry } from "../docx/pageGeometry";
13
+ /** The paper measured in the pixels the sheet is drawn with */
14
+ export interface PagePixels {
15
+ /** The whole sheet, padding included */
16
+ pageWidth: number;
17
+ pageHeight: number;
18
+ /** The width one line of body text occupies: the sheet less its side padding */
19
+ bodyWidth: number;
20
+ /** The height the body occupies on one page */
21
+ bodyHeight: number;
22
+ marginLeft: number;
23
+ marginRight: number;
24
+ marginTop: number;
25
+ marginBottom: number;
26
+ /** From the end of one page's body to the top of the next page's body */
27
+ pageStep: number;
28
+ }
29
+ /** The grey gap visible between one page and the next. The one number the paper does not decide */
30
+ export declare const PAGE_SPLIT_PX = 24;
31
+ /**
32
+ * The paper as the sheet draws it.
33
+ *
34
+ * Every width and height on screen comes from here, so the document's own `w:pgSz` and
35
+ * `w:pgMar` decide the sheet, the page breaks, and the width a table or an image is fitted to.
36
+ */
37
+ export declare function pagePixels(geometry: PageGeometry): PagePixels;
38
+ /** The paper a document that names none is drawn on */
39
+ export declare const A4_PAGE_PIXELS: PagePixels;
40
+ /**
41
+ * The paper the document names, as the CSS variables the sheet is drawn from.
42
+ *
43
+ * The page breaks above are worked out from the same geometry, so the divider drawn between
44
+ * pages lands where the paper actually ends. `editor.css` carries A4 as the fallback for the
45
+ * moment before a document is opened.
46
+ */
47
+ export declare function pageGeometryStyle(page: PagePixels): string;
48
+ /** One body block as drawn on screen */
49
+ export interface MeasuredBlock {
50
+ /** The position where this block starts in the document */
51
+ pos: number;
52
+ /** The height that naturally opens up between the previous block and this one */
53
+ gap: number;
54
+ height: number;
55
+ /** Set when the document records that a new page starts at this block */
56
+ breakBefore: boolean;
57
+ /**
58
+ * Every page break inside the block, in document order, each measured from the block's own top
59
+ * so that the block can be laid out wherever it lands.
60
+ * That top is the one the block would be drawn at with no space in it, so a space opened at one
61
+ * break shifts the ones after it.
62
+ */
63
+ breaks: readonly number[];
64
+ /** Row boundaries available when this block is an editable table */
65
+ table?: MeasuredTable;
66
+ }
67
+ /** A row that may start the continued part of a table */
68
+ export interface TableBoundary {
69
+ /** The row's document position */
70
+ pos: number;
71
+ /** Its top measured from the table's natural top */
72
+ offset: number;
73
+ }
74
+ /** The measurements needed to continue a table without changing the document */
75
+ export interface MeasuredTable {
76
+ boundaries: readonly TableBoundary[];
77
+ /** The smallest useful first piece: headers followed by one body row group */
78
+ firstPageMinimum: number;
79
+ repeatHeaderHeight: number;
80
+ /** Document positions of the contiguous header rows at the start of the table */
81
+ headerRows: readonly number[];
82
+ /** Changes when any projected header content or formatting changes */
83
+ headerSignature: string;
84
+ columns: number;
85
+ }
86
+ /** The space opened up at one page break, so that what follows it starts the next page */
87
+ export interface BreakSpace {
88
+ /** The position where the block holding the break starts */
89
+ pos: number;
90
+ /** Which break inside that block, counted in document order */
91
+ index: number;
92
+ height: number;
93
+ }
94
+ /** One block to be moved down to the next page */
95
+ export interface BlockPush {
96
+ pos: number;
97
+ /** The gap to place above the block: the original gap plus the push */
98
+ marginTop: number;
99
+ /** Of that, the extra amount pushed for the page's sake */
100
+ push: number;
101
+ }
102
+ /** A display-only row inserted before the row that continues on the next page */
103
+ export interface TableContinuation {
104
+ /** The position of the first original row on the next page */
105
+ pos: number;
106
+ /** Space from the previous page's row boundary to the next page body */
107
+ height: number;
108
+ /** Header rows to project immediately after the space */
109
+ headerRows: readonly number[];
110
+ headerSignature: string;
111
+ columns: number;
112
+ }
113
+ /** A place where one page parts from the next */
114
+ export interface PageSplit {
115
+ /** Where the previous page's body ends, measured from the top of the body */
116
+ y: number;
117
+ /** The number of the page that follows this place */
118
+ page: number;
119
+ /** Whether the document records a break at this place */
120
+ forced: boolean;
121
+ /**
122
+ * Whether every place before this one was recorded by the document, so the number can
123
+ * be trusted
124
+ */
125
+ exactPage: boolean;
126
+ /**
127
+ * Whether the block is taller than one page, so it cannot be pushed and the text
128
+ * crosses this place
129
+ */
130
+ crossed: boolean;
131
+ }
132
+ /** Where one page starts */
133
+ export interface PageStart {
134
+ page: number;
135
+ /** Where this page's body starts, measured from the top of the body */
136
+ bodyStart: number;
137
+ /**
138
+ * Whether every place before this one was recorded by the document, so the number can
139
+ * be trusted
140
+ */
141
+ exactPage: boolean;
142
+ /**
143
+ * Whether text crosses over from the previous page, so this page continues with no top
144
+ * margin
145
+ */
146
+ crossed: boolean;
147
+ }
148
+ export interface PageLayout {
149
+ /** Only the blocks to be moved down to the next page */
150
+ pushes: BlockPush[];
151
+ spaces: BreakSpace[];
152
+ tableContinuations: TableContinuation[];
153
+ splits: PageSplit[];
154
+ /** One per page, the first page included */
155
+ pages: PageStart[];
156
+ /** The body height with the last page filled out in full */
157
+ bodyHeight: number;
158
+ }
159
+ export interface PageLayoutInput {
160
+ blocks: readonly MeasuredBlock[];
161
+ pageBodyHeight: number;
162
+ /** From the end of the previous page's body to the top of the next page's body */
163
+ pageStep: number;
164
+ }
165
+ /**
166
+ * Distributes the blocks across pages.
167
+ *
168
+ * A block straddling the end of a page is pushed to the top of the next page, and the
169
+ * blocks below it move down by the same amount.
170
+ * A block taller than one page cannot be pushed, so it is left where it is and only the
171
+ * places it crosses are reported.
172
+ * A page break inside a block is filled out to the end of the page it falls on, which carries
173
+ * the rest of that block - the rest of the sentence, the rest of the list item - to the top of
174
+ * the next page while the block itself stays whole.
175
+ */
176
+ export declare function pageLayout({ blocks, pageBodyHeight, pageStep, }: PageLayoutInput): PageLayout;
@@ -0,0 +1,157 @@
1
+ // src/page/pageLayout.ts
2
+ import {
3
+ A4_PORTRAIT,
4
+ bodyHeightTwips,
5
+ bodyWidth,
6
+ twipsToPx
7
+ } from "../docx/pageGeometry.js";
8
+ import { editorCssVariables } from "../styles/classNames.js";
9
+ var PAGE_SPLIT_PX = 24;
10
+ function pagePixels(geometry) {
11
+ const marginTop = twipsToPx(geometry.marginTopTwips);
12
+ const marginBottom = twipsToPx(geometry.marginBottomTwips);
13
+ return {
14
+ pageWidth: twipsToPx(geometry.widthTwips),
15
+ pageHeight: twipsToPx(geometry.heightTwips),
16
+ // The same width a table is fitted to, so the sheet and the tables on it cannot drift
17
+ bodyWidth: bodyWidth(geometry).px,
18
+ bodyHeight: twipsToPx(bodyHeightTwips(geometry)),
19
+ marginLeft: twipsToPx(geometry.marginLeftTwips),
20
+ marginRight: twipsToPx(geometry.marginRightTwips),
21
+ marginTop,
22
+ marginBottom,
23
+ pageStep: marginTop + marginBottom + PAGE_SPLIT_PX
24
+ };
25
+ }
26
+ var A4_PAGE_PIXELS = pagePixels(A4_PORTRAIT);
27
+ function px(value) {
28
+ return `${Math.round(value * 100) / 100}px`;
29
+ }
30
+ function pageGeometryStyle(page) {
31
+ return [
32
+ `${editorCssVariables.pageWidth}:${px(page.pageWidth)}`,
33
+ `${editorCssVariables.pageHeight}:${px(page.pageHeight)}`,
34
+ `${editorCssVariables.pageMarginTop}:${px(page.marginTop)}`,
35
+ `${editorCssVariables.pageMarginRight}:${px(page.marginRight)}`,
36
+ `${editorCssVariables.pageMarginBottom}:${px(page.marginBottom)}`,
37
+ `${editorCssVariables.pageMarginLeft}:${px(page.marginLeft)}`
38
+ ].join(";");
39
+ }
40
+ var TOLERANCE_PX = 0.5;
41
+ function round(value) {
42
+ return Math.round(value * 100) / 100;
43
+ }
44
+ function pageLayout({
45
+ blocks,
46
+ pageBodyHeight,
47
+ pageStep
48
+ }) {
49
+ const pushes = [];
50
+ const spaces = [];
51
+ const tableContinuations = [];
52
+ const splits = [];
53
+ const firstPage = {
54
+ page: 1,
55
+ bodyStart: 0,
56
+ exactPage: true,
57
+ crossed: false
58
+ };
59
+ const pages = [firstPage];
60
+ if (!(pageBodyHeight > 0)) {
61
+ return {
62
+ pushes,
63
+ spaces,
64
+ tableContinuations,
65
+ splits,
66
+ pages,
67
+ bodyHeight: 0
68
+ };
69
+ }
70
+ let pageStart = 0;
71
+ let cursor = 0;
72
+ let exactPage = true;
73
+ const split = (y, crossed, forced) => {
74
+ if (!forced) exactPage = false;
75
+ const page = splits.length + 2;
76
+ splits.push({ y: round(y), page, forced, exactPage, crossed });
77
+ pageStart = crossed ? y : y + pageStep;
78
+ pages.push({ page, bodyStart: round(pageStart), exactPage, crossed });
79
+ };
80
+ const crossTo = (y) => {
81
+ while (y > pageStart + pageBodyHeight + TOLERANCE_PX) {
82
+ split(pageStart + pageBodyHeight, true, false);
83
+ }
84
+ };
85
+ for (const block of blocks) {
86
+ const pageEnd = pageStart + pageBodyHeight;
87
+ const top = cursor + block.gap;
88
+ const startsPage = block.breakBefore && top > pageStart + TOLERANCE_PX;
89
+ const first = block.breaks[0] ?? block.table?.firstPageMinimum ?? block.height;
90
+ const overflows = top + first > pageEnd + TOLERANCE_PX;
91
+ const fits = first <= pageBodyHeight + TOLERANCE_PX;
92
+ const push = startsPage || overflows && fits ? Math.max(0, pageEnd + pageStep - top) : 0;
93
+ if (push > 0 || startsPage) split(pageEnd, false, startsPage);
94
+ if (push > 0) {
95
+ pushes.push({
96
+ pos: block.pos,
97
+ marginTop: round(block.gap + push),
98
+ push: round(push)
99
+ });
100
+ }
101
+ let contentTop = top + push;
102
+ for (const [index, offset] of block.breaks.entries()) {
103
+ const breakY = contentTop + offset;
104
+ crossTo(breakY);
105
+ split(pageStart + pageBodyHeight, false, true);
106
+ const height = Math.max(0, pageStart - breakY);
107
+ spaces.push({ pos: block.pos, index, height: round(height) });
108
+ contentTop += height;
109
+ }
110
+ let tableAdded = 0;
111
+ if (block.table) {
112
+ let segmentStart = 0;
113
+ for (let index = 0; index <= block.table.boundaries.length; index += 1) {
114
+ const segmentEnd = block.table.boundaries[index]?.offset ?? block.height;
115
+ const segmentTop = contentTop + segmentStart + tableAdded;
116
+ let segmentBottom = contentTop + segmentEnd + tableAdded;
117
+ const pageEnd2 = pageStart + pageBodyHeight;
118
+ const overflows2 = segmentBottom > pageEnd2 + TOLERANCE_PX;
119
+ const boundary = index === 0 ? null : block.table.boundaries[index - 1];
120
+ const segmentHeight = segmentEnd - segmentStart;
121
+ if (overflows2 && boundary && segmentTop > pageStart + TOLERANCE_PX && segmentHeight <= pageBodyHeight + TOLERANCE_PX) {
122
+ split(pageEnd2, false, false);
123
+ const height = Math.max(0, pageStart - segmentTop);
124
+ tableContinuations.push({
125
+ pos: boundary.pos,
126
+ height: round(height),
127
+ headerRows: block.table.headerRows,
128
+ headerSignature: block.table.headerSignature,
129
+ columns: block.table.columns
130
+ });
131
+ tableAdded += height + block.table.repeatHeaderHeight;
132
+ segmentBottom = contentTop + segmentEnd + tableAdded;
133
+ }
134
+ crossTo(segmentBottom);
135
+ segmentStart = segmentEnd;
136
+ }
137
+ }
138
+ const bottom = contentTop + block.height + tableAdded;
139
+ crossTo(bottom);
140
+ cursor = bottom;
141
+ }
142
+ return {
143
+ pushes,
144
+ spaces,
145
+ tableContinuations,
146
+ splits,
147
+ pages,
148
+ bodyHeight: round(pageStart + pageBodyHeight)
149
+ };
150
+ }
151
+ export {
152
+ A4_PAGE_PIXELS,
153
+ PAGE_SPLIT_PX,
154
+ pageGeometryStyle,
155
+ pageLayout,
156
+ pagePixels
157
+ };
@@ -0,0 +1,10 @@
1
+ /** Measures safe row boundaries without treating pagination decorations as document content. */
2
+ import type { Node as PMNode } from "prosemirror-model";
3
+ import type { EditorView } from "prosemirror-view";
4
+ import type { MeasuredTable } from "./pageLayout";
5
+ export interface TableMeasure {
6
+ table: MeasuredTable;
7
+ /** Height already added by the previous pagination pass */
8
+ appliedHeight: number;
9
+ }
10
+ export declare function measureTable(view: EditorView, tableNode: PMNode, tablePos: number, tableDom: HTMLElement, scale?: number): TableMeasure | null;
@@ -0,0 +1,115 @@
1
+ // src/page/tableMeasurements.ts
2
+ import { toRowFormat } from "../model/format.js";
3
+ import { editorAttributes } from "../styles/classNames.js";
4
+ function span(value) {
5
+ return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : 1;
6
+ }
7
+ function paginationRows(table) {
8
+ return Array.from(
9
+ table.querySelectorAll(
10
+ `[${editorAttributes.tablePageSpace}],[${editorAttributes.tableRepeatedHeader}]`
11
+ )
12
+ );
13
+ }
14
+ function before(candidate, row) {
15
+ return Boolean(
16
+ candidate.compareDocumentPosition(row) & Node.DOCUMENT_POSITION_FOLLOWING
17
+ );
18
+ }
19
+ function rowEntries(view, tableNode, tablePos, tableDom, appliedRows, scale) {
20
+ const entries = [];
21
+ const tableTop = tableDom.getBoundingClientRect().top;
22
+ tableNode.forEach((row, offset) => {
23
+ const pos = tablePos + 1 + offset;
24
+ const dom = view.nodeDOM(pos);
25
+ if (!(dom instanceof HTMLElement)) return;
26
+ const rect = dom.getBoundingClientRect();
27
+ const appliedBefore = appliedRows.reduce(
28
+ (total, candidate) => total + (before(candidate, dom) ? candidate.getBoundingClientRect().height / scale : 0),
29
+ 0
30
+ );
31
+ entries.push({
32
+ node: row,
33
+ pos,
34
+ top: (rect.top - tableTop) / scale - appliedBefore,
35
+ height: rect.height / scale
36
+ });
37
+ });
38
+ return entries;
39
+ }
40
+ function unsafeBoundaries(rows) {
41
+ const unsafe = /* @__PURE__ */ new Set();
42
+ rows.forEach((row, rowIndex) => {
43
+ row.node.forEach((cell) => {
44
+ const bottom = Math.min(rows.length, rowIndex + span(cell.attrs.rowspan));
45
+ for (let boundary = rowIndex + 1; boundary < bottom; boundary += 1) {
46
+ unsafe.add(boundary);
47
+ }
48
+ });
49
+ });
50
+ return unsafe;
51
+ }
52
+ function headerCount(rows) {
53
+ let count = 0;
54
+ while (count < rows.length && toRowFormat(rows[count]?.node.attrs.format)?.repeatHeader === true) {
55
+ count += 1;
56
+ }
57
+ return count;
58
+ }
59
+ function columnCount(tableNode) {
60
+ const grid = tableNode.attrs.gridCols;
61
+ if (Array.isArray(grid) && grid.length > 0) return grid.length;
62
+ const first = tableNode.firstChild;
63
+ if (!first) return 1;
64
+ let columns = 0;
65
+ first.forEach((cell) => {
66
+ columns += span(cell.attrs.colspan);
67
+ });
68
+ return Math.max(1, columns);
69
+ }
70
+ function measureTable(view, tableNode, tablePos, tableDom, scale = 1) {
71
+ if (tableNode.type.spec.tableRole !== "table") return null;
72
+ const appliedRows = paginationRows(tableDom);
73
+ const rows = rowEntries(
74
+ view,
75
+ tableNode,
76
+ tablePos,
77
+ tableDom,
78
+ appliedRows,
79
+ scale
80
+ );
81
+ if (rows.length === 0) return null;
82
+ const headers = headerCount(rows);
83
+ const unsafe = unsafeBoundaries(rows);
84
+ const boundaries = [];
85
+ for (let rowIndex = Math.max(1, headers); rowIndex < rows.length; rowIndex += 1) {
86
+ const row = rows[rowIndex];
87
+ if (row && !unsafe.has(rowIndex)) {
88
+ boundaries.push({ pos: row.pos, offset: row.top });
89
+ }
90
+ }
91
+ const repeatHeaderHeight = rows.slice(0, headers).reduce((total, row) => total + row.height, 0);
92
+ const firstBodyBoundary = boundaries.find(
93
+ (boundary) => boundary.offset > repeatHeaderHeight + 0.5
94
+ );
95
+ const appliedHeight = appliedRows.reduce(
96
+ (total, row) => total + row.getBoundingClientRect().height / scale,
97
+ 0
98
+ );
99
+ return {
100
+ table: {
101
+ boundaries,
102
+ firstPageMinimum: firstBodyBoundary?.offset ?? tableDom.getBoundingClientRect().height / scale - appliedHeight,
103
+ repeatHeaderHeight,
104
+ headerRows: rows.slice(0, headers).map((row) => row.pos),
105
+ headerSignature: JSON.stringify(
106
+ rows.slice(0, headers).map((row) => row.node.toJSON())
107
+ ),
108
+ columns: columnCount(tableNode)
109
+ },
110
+ appliedHeight
111
+ };
112
+ }
113
+ export {
114
+ measureTable
115
+ };
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Measures the sheet, moves straddling blocks down to the next page, and hands the
3
+ * page-boundary positions over to the view. It remeasures whenever the text changes or the
4
+ * box is resized.
5
+ *
6
+ * A measurement hands new pushes and break spaces to the view (`./pageDecorations`), which is a
7
+ * decoration transaction against the very paragraph an IME may be composing in, and a composition
8
+ * in Japanese or Chinese stays open across a whole clause while the text grows line by line. So no
9
+ * measurement is taken while a composition is open: the frame is taken again until it is over.
10
+ */
11
+ import type { EditorView } from "prosemirror-view";
12
+ import { type RefObject } from "react";
13
+ import type { PageGeometry } from "../docx/pageGeometry";
14
+ /** One place where a page parts from the next. The position is measured on the sheet */
15
+ export interface PageMark {
16
+ page: number;
17
+ top: number;
18
+ /** The height of the gap between pages. 0 where the text crosses the boundary */
19
+ height: number;
20
+ crossed: boolean;
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
+ /** The paper area of one visual page, used to place its header and footer stories. */
29
+ export interface PageFace {
30
+ page: number;
31
+ headerTop: number;
32
+ footerTop: number;
33
+ left: number;
34
+ width: number;
35
+ crossed: boolean;
36
+ }
37
+ export interface PageOverlay {
38
+ left: number;
39
+ top: number;
40
+ width: number;
41
+ /** The sheet height with the last page filled out in full */
42
+ sheetHeight: number;
43
+ marks: PageMark[];
44
+ badges: PageBadge[];
45
+ pages: PageFace[];
46
+ }
47
+ interface PageLayoutOptions {
48
+ view: EditorView | null;
49
+ layer: RefObject<HTMLElement | null>;
50
+ enabled: boolean;
51
+ /** A value that differs every time the text changes */
52
+ revision: unknown;
53
+ /** The paper the open document names. A4 where a document names none */
54
+ geometry?: PageGeometry;
55
+ }
56
+ export declare function usePageLayout({ view, layer, enabled, revision, geometry, }: PageLayoutOptions): PageOverlay | null;
57
+ export {};
@@ -0,0 +1,141 @@
1
+ // src/page/usePageLayout.ts
2
+ import {
3
+ useCallback,
4
+ useEffect,
5
+ useMemo,
6
+ useRef,
7
+ useState
8
+ } from "react";
9
+ import { editorCssVariables } from "../styles/classNames.js";
10
+ import { measureSheet } from "./measureBlocks.js";
11
+ import {
12
+ setPageBreakSpaces,
13
+ setPagePushes,
14
+ setTableContinuations
15
+ } from "./pageDecorations.js";
16
+ import {
17
+ A4_PAGE_PIXELS,
18
+ PAGE_SPLIT_PX,
19
+ pageLayout,
20
+ pagePixels
21
+ } from "./pageLayout.js";
22
+ var BADGE_INSET_PX = 8;
23
+ function useFrameThrottle(run, hold) {
24
+ const latest = useRef({ run, hold });
25
+ const frame = useRef(0);
26
+ useEffect(() => {
27
+ latest.current = { run, hold };
28
+ });
29
+ useEffect(() => {
30
+ return () => {
31
+ if (frame.current !== 0) {
32
+ cancelAnimationFrame(frame.current);
33
+ frame.current = 0;
34
+ }
35
+ };
36
+ }, []);
37
+ return useCallback(() => {
38
+ if (frame.current !== 0) return;
39
+ const take = () => {
40
+ frame.current = requestAnimationFrame(() => {
41
+ if (latest.current.hold()) {
42
+ take();
43
+ return;
44
+ }
45
+ frame.current = 0;
46
+ latest.current.run();
47
+ });
48
+ };
49
+ take();
50
+ }, []);
51
+ }
52
+ function sameOverlay(a, b) {
53
+ 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.badges) === JSON.stringify(b.badges) && JSON.stringify(a.pages) === JSON.stringify(b.pages);
54
+ }
55
+ function usePageLayout({
56
+ view,
57
+ layer,
58
+ enabled,
59
+ revision,
60
+ geometry
61
+ }) {
62
+ const [overlay, setOverlay] = useState(null);
63
+ const page = useMemo(
64
+ () => geometry ? pagePixels(geometry) : A4_PAGE_PIXELS,
65
+ [geometry]
66
+ );
67
+ const remeasure = useFrameThrottle(
68
+ () => {
69
+ const box = layer.current;
70
+ if (!view || !box || !enabled) return;
71
+ const measured = measureSheet(view, box);
72
+ const layout = pageLayout({
73
+ blocks: measured.blocks,
74
+ pageBodyHeight: page.bodyHeight,
75
+ pageStep: page.pageStep
76
+ });
77
+ setPagePushes(view, layout.pushes);
78
+ setPageBreakSpaces(view, layout.spaces);
79
+ setTableContinuations(view, layout.tableContinuations);
80
+ const sheetHeight = measured.contentTop + layout.bodyHeight + measured.contentBottom;
81
+ box.style.setProperty(editorCssVariables.sheetHeight, `${sheetHeight}px`);
82
+ const next = {
83
+ left: measured.left,
84
+ top: measured.top,
85
+ width: measured.width,
86
+ sheetHeight,
87
+ marks: layout.splits.map((split) => ({
88
+ page: split.page,
89
+ top: measured.contentTop + split.y + (split.crossed ? 0 : page.marginBottom),
90
+ height: split.crossed ? 0 : PAGE_SPLIT_PX,
91
+ crossed: split.crossed
92
+ })),
93
+ // The number is laid on the page's top corner. A page crossed into has no margin,
94
+ // so the place it was split at is its corner
95
+ badges: layout.pages.map((start) => ({
96
+ page: start.page,
97
+ top: measured.contentTop + start.bodyStart - (start.crossed ? 0 : page.marginTop) + BADGE_INSET_PX,
98
+ exactPage: start.exactPage
99
+ })),
100
+ pages: layout.pages.map((start) => {
101
+ const paperTop = measured.contentTop + start.bodyStart - (start.crossed ? 0 : page.marginTop);
102
+ return {
103
+ page: start.page,
104
+ headerTop: paperTop + page.marginTop / 2,
105
+ footerTop: paperTop + page.pageHeight - page.marginBottom / 2,
106
+ left: page.marginLeft,
107
+ width: page.bodyWidth,
108
+ crossed: start.crossed
109
+ };
110
+ })
111
+ };
112
+ setOverlay((previous) => sameOverlay(previous, next) ? previous : next);
113
+ },
114
+ () => view?.composing === true
115
+ );
116
+ useEffect(() => {
117
+ if (enabled) remeasure();
118
+ }, [remeasure, revision, enabled]);
119
+ useEffect(() => {
120
+ if (enabled) return;
121
+ layer.current?.style.removeProperty(editorCssVariables.sheetHeight);
122
+ if (!view) return;
123
+ setPagePushes(view, []);
124
+ setPageBreakSpaces(view, []);
125
+ setTableContinuations(view, []);
126
+ }, [enabled, layer, view]);
127
+ useEffect(() => {
128
+ const box = layer.current;
129
+ if (!view || !box || !enabled || typeof ResizeObserver === "undefined") {
130
+ return;
131
+ }
132
+ const observer = new ResizeObserver(remeasure);
133
+ observer.observe(view.dom);
134
+ observer.observe(box);
135
+ return () => observer.disconnect();
136
+ }, [view, layer, enabled, remeasure]);
137
+ return enabled ? overlay : null;
138
+ }
139
+ export {
140
+ usePageLayout
141
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ProseMirror schema joining preserved DOCX fragments with validated display values. Original XML
3
+ * remains on nodes and marks so untouched content can round-trip verbatim.
4
+ */
5
+ import { Schema } from "prosemirror-model";
6
+ export { imageNodeSpec, runMarkSpec } from "./rendering";
7
+ /** Whether this is a page-splitting break (`<w:br w:type="page"/>`). Read straight from the original attribute text */
8
+ export declare function isPageBreak(brAttrs: unknown): boolean;
9
+ export declare const docxSchema: Schema<"bookmarkBlock" | "commentEnd" | "commentReference" | "commentStart" | "doc" | "docxRaw" | "hardBreak" | "image" | "noteReference" | "paragraph" | "rawBlock" | "rawInline" | "table" | "tableCell" | "tableRow" | "text", "link" | "run" | "sdt" | "tab">;