@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,2 @@
1
+ export { docxSchema, isPageBreak } from "./docxSchema";
2
+ export { imageNodeSpec, runMarkSpec } from "./rendering";
@@ -0,0 +1,9 @@
1
+ // src/schema/index.ts
2
+ import { docxSchema, isPageBreak } from "./docxSchema.js";
3
+ import { imageNodeSpec, runMarkSpec } from "./rendering.js";
4
+ export {
5
+ docxSchema,
6
+ imageNodeSpec,
7
+ isPageBreak,
8
+ runMarkSpec
9
+ };
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Evaluates OOXML content and deletion locks for inline controls and whole table cells. Commands
3
+ * query these predicates before editing; `editor/plugins/lockedContent` enforces them at runtime.
4
+ */
5
+ import type { Mark, Node as PMNode } from "prosemirror-model";
6
+ import { PluginKey, type Selection, type Transaction } from "prosemirror-state";
7
+ /**
8
+ * The pass that lets a transaction through the guard, which is how a lock can be lifted at all.
9
+ * A plugin key is used as the name so that it cannot collide with a consumer's own metadata.
10
+ */
11
+ export declare const unlockAllowed: PluginKey<boolean>;
12
+ /**
13
+ * The pass an undo or a redo carries (`editor/commands/historyCommands`).
14
+ *
15
+ * Every step the history replays is the reverse of a step that passed the guard when it was made,
16
+ * so replaying one leads back to a state that was allowed and nothing else. Without the pass the
17
+ * reverse of a lock - a step across the very stretch that lock shut - would be refused, and the
18
+ * refusal would take the whole history behind it down as well.
19
+ */
20
+ export declare const historyReplay: PluginKey<boolean>;
21
+ interface StepRange {
22
+ from: number;
23
+ to: number;
24
+ }
25
+ /**
26
+ * The control shutting the contents this inline node is part of. Null when it sits in no control,
27
+ * or in one whose contents stand open, a control locked against deletion alone included.
28
+ */
29
+ export declare function lockedMarkOf(node: PMNode | null | undefined): Mark | null;
30
+ /** Whether the control around this cell shuts its contents (`sdtContentsLocked` in `schema`) */
31
+ export declare function isLockedCell(node: PMNode | null | undefined): boolean;
32
+ /**
33
+ * Whether this node carries a lock of either clause, an inline one wearing a control's mark and a
34
+ * wrapped cell alike.
35
+ * This is the question about the document holding a lock at all rather than about editing a spot,
36
+ * so a control locked against deletion alone counts (`editor/commands/lockCommands`).
37
+ */
38
+ export declare function carriesLock(node: PMNode): boolean;
39
+ /** A textblock a judgement or an edit runs through, and where its content begins */
40
+ export interface Textblock {
41
+ node: PMNode;
42
+ start: number;
43
+ }
44
+ /** One content control inside a textblock, as the one whole stretch it covers */
45
+ export interface ControlSpan extends StepRange {
46
+ mark: Mark;
47
+ }
48
+ /**
49
+ * Every control in this textblock, locked or open, each as the one whole stretch it covers.
50
+ *
51
+ * A control that wrapped several runs comes in as several inlines wearing the very same mark, and
52
+ * what a lock answers for is the control rather than the run: a stretch covering one run of a
53
+ * control whole still covers only a part of the control.
54
+ */
55
+ export declare function controlSpans(block: Textblock): ControlSpan[];
56
+ /**
57
+ * Whether what stands at this position sits inside a cell a control shuts.
58
+ *
59
+ * This is the question a paragraph edit leaves its locked paragraphs out by
60
+ * (`editor/paragraphEdits`), and it is deliberately not `rangeTouchesLocked` over the paragraph:
61
+ * a paragraph merely holding a locked control keeps its own alignment and indent.
62
+ */
63
+ export declare function insideLockedCell(doc: PMNode, pos: number): boolean;
64
+ /**
65
+ * Whether this stretch reaches contents a lock shuts: text inside a control that shuts its
66
+ * contents, or what a locked cell holds, the cell itself included.
67
+ *
68
+ * This is the question about editing what stands there rather than about taking it away, so every
69
+ * control the stretch meets answers with its contents clause. The lock commands and the formatting
70
+ * commands ask it of the stretch they are about to mark, so it is exported.
71
+ */
72
+ export declare function rangeTouchesLocked(doc: PMNode, from: number, to: number): boolean;
73
+ /**
74
+ * Whether something inserted at this spot would land inside a locked control or a locked cell.
75
+ *
76
+ * Only a spot with the very same control on both sides is inside one. At either edge the other
77
+ * side belongs to a different control or to none, and since the mark is not inclusive what goes
78
+ * in there falls outside the control.
79
+ */
80
+ export declare function insertionInsideLocked(doc: PMNode, pos: number): boolean;
81
+ /**
82
+ * Whether the guard shuts editing where this selection stands.
83
+ *
84
+ * This is the question a command that rewrites whatever is selected has to ask before it reports
85
+ * that it applies (`editor/insertImage`), and the one a menu offering to lift a lock is built on
86
+ * (`editor/commands/lockCommands`). A caret is shut by standing inside a control rather than
87
+ * against its edge, which is the same rule an insertion follows.
88
+ * A control locked against deletion alone shuts nothing here: its contents stand open, so editing
89
+ * where it stands goes through, and only taking the control away is refused.
90
+ */
91
+ export declare function selectionShut(selection: Selection, doc: PMNode): boolean;
92
+ /**
93
+ * Whether the guard would refuse putting something in place of what this selection covers, which
94
+ * is what an image insertion does (`editor/insertImage`).
95
+ *
96
+ * A different question from `selectionShut`: what the selection covers whole goes away rather than
97
+ * being edited, so the deletion clause answers for it. A control that may be taken away whole may
98
+ * therefore be replaced, and one locked against deletion alone may not, even though editing inside
99
+ * it would have gone through.
100
+ */
101
+ export declare function replacementShut(selection: Selection, doc: PMNode): boolean;
102
+ /**
103
+ * Whether the guard would let this transaction through, decided and nothing else.
104
+ *
105
+ * The refusal the guard itself answers with carries a side effect - the composition it ends
106
+ * (`editor/plugins/lockedContent`) - which a query about a button's state may not set off, so the
107
+ * decision stands apart from it and every caller building an edit asks this rather than handing
108
+ * the transaction to a state.
109
+ * `doc` only stands in for a step the transaction kept no document for.
110
+ */
111
+ export declare function transactionAllowed(tr: Transaction, doc: PMNode): boolean;
112
+ export {};
@@ -0,0 +1,211 @@
1
+ // src/schema/locks.ts
2
+ import { PluginKey } from "prosemirror-state";
3
+ import {
4
+ AddMarkStep,
5
+ AddNodeMarkStep,
6
+ AttrStep,
7
+ RemoveMarkStep,
8
+ RemoveNodeMarkStep,
9
+ ReplaceAroundStep,
10
+ ReplaceStep
11
+ } from "prosemirror-transform";
12
+ import { docxSchema } from "./index.js";
13
+ var unlockAllowed = new PluginKey("docxEditorUnlockAllowed");
14
+ var historyReplay = new PluginKey("docxEditorHistoryReplay");
15
+ var OPEN = { contents: false, deletion: false };
16
+ function sdtMarkOf(node) {
17
+ return node?.marks.find((mark) => mark.type === docxSchema.marks.sdt) ?? null;
18
+ }
19
+ function markLocks(mark) {
20
+ return {
21
+ contents: mark.attrs.contentsLocked === true,
22
+ deletion: mark.attrs.deletionLocked === true
23
+ };
24
+ }
25
+ function lockedMarkOf(node) {
26
+ const mark = sdtMarkOf(node);
27
+ return mark !== null && markLocks(mark).contents ? mark : null;
28
+ }
29
+ var CELL_CONTENTS_ATTR = "sdtContentsLocked";
30
+ var CELL_DELETION_ATTR = "sdtDeletionLocked";
31
+ function isCell(node) {
32
+ return node?.type.spec.tableRole === "cell";
33
+ }
34
+ function cellLocks(node) {
35
+ if (!node || !isCell(node)) return OPEN;
36
+ return {
37
+ contents: node.attrs[CELL_CONTENTS_ATTR] === true,
38
+ deletion: node.attrs[CELL_DELETION_ATTR] === true
39
+ };
40
+ }
41
+ function isLockedCell(node) {
42
+ return cellLocks(node).contents;
43
+ }
44
+ function carriesLock(node) {
45
+ const mark = node.isInline ? sdtMarkOf(node) : null;
46
+ const locks = mark === null ? cellLocks(node) : markLocks(mark);
47
+ return locks.contents || locks.deletion;
48
+ }
49
+ function controlSpans(block) {
50
+ const spans = [];
51
+ block.node.forEach((child, offset) => {
52
+ const mark = sdtMarkOf(child);
53
+ if (!mark) return;
54
+ const from = block.start + offset;
55
+ const to = from + child.nodeSize;
56
+ const last = spans.at(-1);
57
+ if (last && last.to === from && last.mark.eq(mark)) last.to = to;
58
+ else spans.push({ from, to, mark });
59
+ });
60
+ return spans;
61
+ }
62
+ function lockedCellContent($pos) {
63
+ for (let depth = $pos.depth; depth > 0; depth -= 1) {
64
+ const node = $pos.node(depth);
65
+ if (!isLockedCell(node)) continue;
66
+ const from = $pos.before(depth) + 1;
67
+ return { from, to: from + node.content.size };
68
+ }
69
+ return null;
70
+ }
71
+ function insideLockedCell(doc, pos) {
72
+ return lockedCellContent(doc.resolve(pos)) !== null;
73
+ }
74
+ function reachesLockedCell(doc, range) {
75
+ const content = lockedCellContent(doc.resolve(range.from)) ?? lockedCellContent(doc.resolve(range.to));
76
+ if (!content) return false;
77
+ if (range.from === range.to) return true;
78
+ return range.from < content.to && range.to > content.from;
79
+ }
80
+ function coversWhole(range, span) {
81
+ return range.from <= span.from && range.to >= span.to;
82
+ }
83
+ function overlaps(range, span) {
84
+ return range.from < span.to && range.to > span.from;
85
+ }
86
+ function shuts(locks, range, span) {
87
+ return range.takesAway && coversWhole(range, span) ? locks.deletion : locks.contents && overlaps(range, span);
88
+ }
89
+ function rangeShut(doc, range) {
90
+ if (reachesLockedCell(doc, range)) return true;
91
+ let shut = false;
92
+ doc.nodesBetween(range.from, range.to, (node, pos) => {
93
+ if (shut) return false;
94
+ if (isCell(node)) {
95
+ const locks = cellLocks(node);
96
+ if (coversWhole(range, { from: pos, to: pos + node.nodeSize })) {
97
+ if (range.takesAway ? locks.deletion : locks.contents) shut = true;
98
+ }
99
+ return !shut;
100
+ }
101
+ if (!node.isTextblock) return true;
102
+ shut ||= controlSpans({ node, start: pos + 1 }).some(
103
+ (span) => shuts(markLocks(span.mark), range, span)
104
+ );
105
+ return false;
106
+ });
107
+ return shut;
108
+ }
109
+ function rangeTouchesLocked(doc, from, to) {
110
+ return rangeShut(doc, { from, to, takesAway: false });
111
+ }
112
+ function insertionInsideLocked(doc, pos) {
113
+ const $pos = doc.resolve(pos);
114
+ if (lockedCellContent($pos)) return true;
115
+ const before = lockedMarkOf($pos.nodeBefore);
116
+ const after = lockedMarkOf($pos.nodeAfter);
117
+ return before !== null && after !== null && before.eq(after);
118
+ }
119
+ function selectionShut(selection, doc) {
120
+ return selection.ranges.some(
121
+ (range) => range.$from.pos === range.$to.pos ? insertionInsideLocked(doc, range.$from.pos) : rangeTouchesLocked(doc, range.$from.pos, range.$to.pos)
122
+ );
123
+ }
124
+ function replacementShut(selection, doc) {
125
+ return selection.ranges.some((range) => {
126
+ const from = range.$from.pos;
127
+ const to = range.$to.pos;
128
+ return from === to ? insertionInsideLocked(doc, from) : rangeShut(doc, { from, to, takesAway: true });
129
+ });
130
+ }
131
+ function editedRanges(step) {
132
+ if (step instanceof ReplaceAroundStep) {
133
+ return [
134
+ { from: step.from, to: step.gapFrom, takesAway: true },
135
+ { from: step.gapTo, to: step.to, takesAway: true }
136
+ ];
137
+ }
138
+ if (step instanceof ReplaceStep) {
139
+ return [{ from: step.from, to: step.to, takesAway: true }];
140
+ }
141
+ if (step instanceof AddMarkStep || step instanceof RemoveMarkStep) {
142
+ return [{ from: step.from, to: step.to, takesAway: false }];
143
+ }
144
+ return null;
145
+ }
146
+ function rangeAllowed(doc, range) {
147
+ return range.from < range.to ? !rangeShut(doc, range) : !insertionInsideLocked(doc, range.from);
148
+ }
149
+ function plantedLock(node) {
150
+ if (node.isInline) return lockedMarkOf(node) !== null;
151
+ return isLockedCell(node) && node.content.size > 0;
152
+ }
153
+ function lockedInside(content) {
154
+ let found = false;
155
+ content.descendants((node) => {
156
+ if (found) return false;
157
+ if (plantedLock(node)) found = true;
158
+ return !found;
159
+ });
160
+ return found;
161
+ }
162
+ function plantsLocked(step) {
163
+ const carried = step instanceof ReplaceStep || step instanceof ReplaceAroundStep ? step.slice.content : null;
164
+ return carried !== null && lockedInside(carried);
165
+ }
166
+ function clearsCellLock(step, doc) {
167
+ if (step instanceof AttrStep) {
168
+ if (step.value === true) return false;
169
+ const locks = cellLocks(doc.nodeAt(step.pos));
170
+ if (step.attr === CELL_CONTENTS_ATTR) return locks.contents;
171
+ if (step.attr === CELL_DELETION_ATTR) return locks.deletion;
172
+ return false;
173
+ }
174
+ if (!(step instanceof ReplaceAroundStep)) return false;
175
+ const was = cellLocks(doc.nodeAt(step.from));
176
+ const now = cellLocks(step.slice.content.firstChild);
177
+ return was.contents && !now.contents || was.deletion && !now.deletion;
178
+ }
179
+ function stepAllowed(step, doc) {
180
+ if (plantsLocked(step) || clearsCellLock(step, doc)) return false;
181
+ const ranges = editedRanges(step);
182
+ if (ranges) return ranges.every((range) => rangeAllowed(doc, range));
183
+ if (step instanceof AttrStep || step instanceof AddNodeMarkStep || step instanceof RemoveNodeMarkStep) {
184
+ return lockedCellContent(doc.resolve(step.pos)) === null && lockedMarkOf(doc.nodeAt(step.pos)) === null;
185
+ }
186
+ return true;
187
+ }
188
+ function carriesPass(tr) {
189
+ return tr.getMeta(unlockAllowed) === true || tr.getMeta(historyReplay) === true;
190
+ }
191
+ function transactionAllowed(tr, doc) {
192
+ if (!tr.docChanged) return true;
193
+ if (carriesPass(tr)) return true;
194
+ return tr.steps.every(
195
+ (step, index) => stepAllowed(step, tr.docs[index] ?? doc)
196
+ );
197
+ }
198
+ export {
199
+ carriesLock,
200
+ controlSpans,
201
+ historyReplay,
202
+ insertionInsideLocked,
203
+ insideLockedCell,
204
+ isLockedCell,
205
+ lockedMarkOf,
206
+ rangeTouchesLocked,
207
+ replacementShut,
208
+ selectionShut,
209
+ transactionAllowed,
210
+ unlockAllowed
211
+ };
@@ -0,0 +1,6 @@
1
+ import type { Attrs, DOMOutputSpec } from "prosemirror-model";
2
+ import type { FontFallbacks } from "../styles/fontStack";
3
+ /** The DOM representation shared by the schema and the editor's custom run mark view. */
4
+ export declare function runMarkSpec(attrs: Attrs, fontFallbacks: FontFallbacks): DOMOutputSpec;
5
+ /** The image element shared by the schema and the resizable image node view. */
6
+ export declare function imageNodeSpec(attrs: Attrs): DOMOutputSpec;
@@ -0,0 +1,46 @@
1
+ // src/schema/rendering.ts
2
+ import { toRunFormat } from "../model/format.js";
3
+ import { emuToPx, toImageExtent, toImageSrc } from "../ooxml/image.js";
4
+ import { editorClassNames } from "../styles/classNames.js";
5
+ import { runStyle } from "../styles/inlineStyle.js";
6
+ function text(value) {
7
+ return typeof value === "string" ? value : void 0;
8
+ }
9
+ function formatJson(format) {
10
+ return format ? JSON.stringify(format) : void 0;
11
+ }
12
+ function runMarkSpec(attrs, fontFallbacks) {
13
+ const format = toRunFormat(attrs.format);
14
+ return [
15
+ "span",
16
+ {
17
+ class: editorClassNames.run,
18
+ style: runStyle(format, fontFallbacks),
19
+ // Which shape of a Han character the browser draws is decided by this and nothing else
20
+ lang: format?.lang,
21
+ "data-rattrs": text(attrs.rAttrs),
22
+ "data-rpr": text(attrs.rPr),
23
+ "data-fmt": formatJson(format)
24
+ },
25
+ 0
26
+ ];
27
+ }
28
+ function imageNodeSpec(attrs) {
29
+ const extent = toImageExtent(attrs.extent);
30
+ return [
31
+ "img",
32
+ {
33
+ class: editorClassNames.image,
34
+ src: toImageSrc(attrs.src) ?? void 0,
35
+ alt: text(attrs.alt) ?? "",
36
+ width: extent ? `${Math.round(emuToPx(extent.cx))}` : void 0,
37
+ height: extent ? `${Math.round(emuToPx(extent.cy))}` : void 0,
38
+ "data-extent": formatJson(extent),
39
+ "data-xml": text(attrs.xml)
40
+ }
41
+ ];
42
+ }
43
+ export {
44
+ imageNodeSpec,
45
+ runMarkSpec
46
+ };
@@ -0,0 +1,214 @@
1
+ /**
2
+ * The CSS class and variable names attached to the UI.
3
+ *
4
+ * They are built only here, so that renaming the package means changing a single
5
+ * prefix line.
6
+ * `editor.css` uses the same prefix, so change it along with this file.
7
+ */
8
+ export declare const editorClassNames: {
9
+ /** The outermost box holding both the toolbar and the paper */
10
+ readonly frame: "docx-editor-frame";
11
+ /** The box that owns the scrolling */
12
+ readonly root: "docx-editor-editor";
13
+ /** The paper the text sits on (contenteditable) */
14
+ readonly sheet: "docx-editor-sheet";
15
+ readonly paragraph: "docx-editor-p";
16
+ readonly run: "docx-editor-run";
17
+ readonly tab: "docx-editor-tab";
18
+ /** The independently measurable DOM range around one tab character. */
19
+ readonly tabSlot: "docx-editor-tab-slot";
20
+ /** The caret drawn at an unambiguous edge of a laid-out tab. */
21
+ readonly tabCaret: "docx-editor-tab-caret";
22
+ /** Attached to the contenteditable while its native caret is replaced. */
23
+ readonly tabCaretActive: "docx-editor-tab-caret-active";
24
+ /** An inline image (`w:drawing` holding a picture) */
25
+ readonly image: "docx-editor-img";
26
+ /** The box the image sits in, which is also what the resize handles stand in */
27
+ readonly imageBox: "docx-editor-img-box";
28
+ /** Attached to that box while the image is the selection */
29
+ readonly imageSelected: "docx-editor-img-selected";
30
+ /** One of the four corner handles a selected image is resized by */
31
+ readonly imageHandle: "docx-editor-img-handle";
32
+ readonly table: "docx-editor-tbl";
33
+ readonly tableRow: "docx-editor-tr";
34
+ readonly tableCell: "docx-editor-tc";
35
+ /** Attached alongside it when the control around the cell says the cell may not be edited */
36
+ readonly cellLocked: "docx-editor-tc-locked";
37
+ /** A stretch of text sitting inside a content control (`w:sdt`) */
38
+ readonly sdt: "docx-editor-sdt";
39
+ /** Attached alongside it when the control says its contents may not be edited */
40
+ readonly sdtLocked: "docx-editor-sdt-locked";
41
+ /** A stretch of text inside a hyperlink (`w:hyperlink`) */
42
+ readonly link: "docx-editor-link";
43
+ /** A stretch of text carrying a comment anchor */
44
+ readonly commentRange: "docx-editor-comment-range";
45
+ /** An invisible OOXML comment marker inside the editable text flow */
46
+ readonly commentMarker: "docx-editor-comment-marker";
47
+ /** A superscript footnote or endnote reference */
48
+ readonly noteReference: "docx-editor-note-reference";
49
+ /** An invisible bookmark marker that occurs between body blocks */
50
+ readonly bookmarkBlock: "docx-editor-bookmark-block";
51
+ readonly rawInline: "docx-editor-raw-inline";
52
+ readonly rawBlock: "docx-editor-raw-block";
53
+ /** A preserved block that carries the original XML directly (inside a table cell, and so on) */
54
+ readonly rawXmlBlock: "docx-editor-raw-xml";
55
+ readonly tablePlaceholder: "docx-editor-table";
56
+ /** The box holding both the paper and the marks overlaid on it */
57
+ readonly pageLayer: "docx-editor-page-layer";
58
+ /** All of the page marks drawn over the paper */
59
+ readonly pageGuides: "docx-editor-page-guides";
60
+ /** The band that covers the space between one page and the next */
61
+ readonly pageSplit: "docx-editor-page-split";
62
+ /** The line drawn where a block that cannot be pushed down crosses a page */
63
+ readonly pageCrossed: "docx-editor-page-crossed";
64
+ /** The page number laid on the top corner of a page */
65
+ readonly pageBadge: "docx-editor-page-badge";
66
+ /** A first-section header story projected into a visual page margin */
67
+ readonly pageHeader: "docx-editor-page-header";
68
+ /** A first-section footer story projected into a visual page margin */
69
+ readonly pageFooter: "docx-editor-page-footer";
70
+ /** The mark that changes the cursor while it is over a column boundary or while a boundary is being dragged. Attached to the sheet */
71
+ readonly columnResize: "docx-editor-col-resize";
72
+ /** The vertical line that shows where the boundary stands while it is being dragged */
73
+ readonly columnResizeGuide: "docx-editor-col-guide";
74
+ readonly rowResize: "docx-editor-row-resize";
75
+ readonly rowResizeGuide: "docx-editor-row-guide";
76
+ readonly toolbar: "docx-editor-toolbar";
77
+ /** A bundle of buttons set off by a single separator */
78
+ readonly toolbarGroup: "docx-editor-toolbar-group";
79
+ readonly toolbarSeparator: "docx-editor-toolbar-sep";
80
+ readonly toolbarButton: "docx-editor-toolbar-btn";
81
+ readonly toolbarColorIcon: "docx-editor-toolbar-color-icon";
82
+ readonly toolbarColorIndicator: "docx-editor-toolbar-color-indicator";
83
+ readonly toolbarSelect: "docx-editor-toolbar-select";
84
+ readonly fontFamilySelect: "docx-editor-font-family-select";
85
+ readonly zoomSelect: "docx-editor-zoom-select";
86
+ /** The box wrapped around a control that cannot draw its own tooltip (a native `select`) */
87
+ readonly tooltipWrapper: "docx-editor-tooltip-wrap";
88
+ /** The box around the button a panel opens from. A click inside it counts as a click on the panel */
89
+ readonly popoverBox: "docx-editor-popover-box";
90
+ /** The small panel that opens below a button, floated against the screen */
91
+ readonly popover: "docx-editor-popover";
92
+ /** The grid for picking a table size */
93
+ readonly sizeGrid: "docx-editor-size-grid";
94
+ readonly sizeGridRow: "docx-editor-size-row";
95
+ readonly sizeGridCell: "docx-editor-size-cell";
96
+ readonly sizeGridLabel: "docx-editor-size-label";
97
+ readonly colorPicker: "docx-editor-color-picker";
98
+ /** The text color palette. A grid of rows, so the markup says what the layout shows */
99
+ readonly colorGrid: "docx-editor-color-grid";
100
+ /** One row of the palette. Ten swatches of a family, light to dark */
101
+ readonly colorRow: "docx-editor-color-row";
102
+ /** The row at the head of the palette holding the entry that withdraws the color */
103
+ readonly colorClearRow: "docx-editor-color-clear-row";
104
+ readonly swatch: "docx-editor-swatch";
105
+ readonly colorCustom: "docx-editor-color-custom";
106
+ readonly colorNativeInput: "docx-editor-color-native-input";
107
+ readonly colorHexInput: "docx-editor-color-hex-input";
108
+ readonly colorApply: "docx-editor-color-apply";
109
+ /** The table menu opened with the right button, and the choice menus inside the toolbar panels */
110
+ readonly menu: "docx-editor-menu";
111
+ /** A menu of choices inside a toolbar panel, where one of them is the current one */
112
+ readonly menuList: "docx-editor-menu-list";
113
+ readonly menuItem: "docx-editor-menu-item";
114
+ /** The slot at the head of a menu row where the check mark of the current choice goes */
115
+ readonly menuCheck: "docx-editor-menu-check";
116
+ /** The keyboard shortcut written on the right of a menu row */
117
+ readonly menuHint: "docx-editor-menu-hint";
118
+ readonly menuSeparator: "docx-editor-menu-sep";
119
+ /** The panel that reads and writes a link's address, floated over the selection */
120
+ readonly linkPanel: "docx-editor-link-panel";
121
+ /** The field the address is typed into */
122
+ readonly linkAddress: "docx-editor-link-address";
123
+ /** The row of buttons under it */
124
+ readonly linkPanelRow: "docx-editor-link-row";
125
+ readonly linkPanelIcon: "docx-editor-link-icon";
126
+ /** A button of that panel, and of the card below, which offer the same actions */
127
+ /** The card that says where the link under the cursor points, floated under the link's first line */
128
+ readonly linkCard: "docx-editor-link-card";
129
+ /** The address it shows, cut off with an ellipsis where it is longer than the card */
130
+ readonly linkCardAddress: "docx-editor-link-card-address";
131
+ /** What it says in place of an address for a link that names a place in the document */
132
+ readonly linkCardNote: "docx-editor-link-card-note";
133
+ /** The document and its comment rail, laid out side by side */
134
+ readonly workspace: "docx-editor-workspace";
135
+ readonly commentsPanel: "docx-editor-comments";
136
+ readonly commentsToggle: "docx-editor-comments-toggle";
137
+ readonly commentsHeading: "docx-editor-comments-heading";
138
+ readonly commentsCanvas: "docx-editor-comments-canvas";
139
+ readonly commentsEmpty: "docx-editor-comments-empty";
140
+ readonly commentPosition: "docx-editor-comment-position";
141
+ readonly commentCard: "docx-editor-comment-card";
142
+ readonly commentHeader: "docx-editor-comment-header";
143
+ readonly commentReply: "docx-editor-comment-reply";
144
+ readonly commentMeta: "docx-editor-comment-meta";
145
+ readonly commentAuthor: "docx-editor-comment-author";
146
+ readonly commentDate: "docx-editor-comment-date";
147
+ readonly commentBody: "docx-editor-comment-body";
148
+ readonly commentActions: "docx-editor-comment-actions";
149
+ readonly commentPrimaryAction: "docx-editor-comment-primary-action";
150
+ readonly commentIconActions: "docx-editor-comment-icon-actions";
151
+ readonly commentComposer: "docx-editor-comment-composer";
152
+ readonly commentInput: "docx-editor-comment-input";
153
+ readonly notesPanel: "docx-editor-notes";
154
+ readonly notesHeading: "docx-editor-notes-heading";
155
+ readonly notesList: "docx-editor-notes-list";
156
+ readonly noteLabel: "docx-editor-note-label";
157
+ readonly noteBody: "docx-editor-note-body";
158
+ /** The panel drawn in place of the editor when a document was refused and the consumer wrote no panel of its own */
159
+ readonly rejection: "docx-editor-rejection";
160
+ readonly rejectionTitle: "docx-editor-rejection-title";
161
+ };
162
+ export declare const editorCssVariables: {
163
+ readonly fontSize: "--docx-editor-font-size";
164
+ readonly fontFamily: "--docx-editor-font-family";
165
+ readonly lineHeight: "--docx-editor-line-height";
166
+ /** The hanging indent width the list marker sits in */
167
+ readonly markerWidth: "--docx-editor-marker-width";
168
+ /** The width calculated for a tab using custom paragraph stops. */
169
+ readonly tabWidth: "--docx-editor-tab-width";
170
+ /** The paper height, grown to match the page count */
171
+ readonly sheetHeight: "--docx-editor-sheet-height";
172
+ /** The paper the open document names, and the margins printed inside it */
173
+ readonly pageWidth: "--docx-editor-page-width";
174
+ readonly pageHeight: "--docx-editor-page-height";
175
+ readonly pageMarginTop: "--docx-editor-page-margin-top";
176
+ readonly pageMarginRight: "--docx-editor-page-margin-right";
177
+ readonly pageMarginBottom: "--docx-editor-page-margin-bottom";
178
+ readonly pageMarginLeft: "--docx-editor-page-margin-left";
179
+ };
180
+ /**
181
+ * The attributes that carry marks which exist only on screen.
182
+ * A list marker is a decoration rather than part of the document model, so CSS
183
+ * draws it from this attribute alone.
184
+ * The boundary guides use these attributes to find the places that ask for a page
185
+ * break.
186
+ */
187
+ export declare const editorAttributes: {
188
+ readonly listMarker: "data-marker";
189
+ /** A new page starts at this paragraph */
190
+ readonly pageBreakBefore: "data-page-break";
191
+ /** The kind of line break. `page` when the break splits the page */
192
+ readonly breakType: "data-break";
193
+ /** Which corner of the image a resize handle stands at (`nw`, `ne`, `sw`, `se`) */
194
+ readonly imageCorner: "data-corner";
195
+ /** The extra height opened up to push content down to the top of the next page */
196
+ readonly pagePush: "data-page-push";
197
+ /** The space opened up at a page break, so what follows the break starts the next page */
198
+ readonly pageBreakSpace: "data-page-space";
199
+ /** A display-only table row that fills the remainder between page bodies */
200
+ readonly tablePageSpace: "data-table-page-space";
201
+ /** A display-only copy of a table header row on a continued page */
202
+ readonly tableRepeatedHeader: "data-table-repeated-header";
203
+ /**
204
+ * The tooltip a control shows on hover, drawn by the CSS straight from this attribute.
205
+ * It is the one mark here whose selector is the attribute on its own rather than a
206
+ * class of ours, so it carries the prefix and cannot collide with the host app.
207
+ */
208
+ readonly tooltip: "data-docx-editor-tooltip";
209
+ /**
210
+ * Put on the box the tooltips are drawn inside while they are hushed, which is what Escape
211
+ * does to the one standing in the way (`ui/Tooltip.tsx`).
212
+ */
213
+ readonly tooltipsHushed: "data-docx-editor-tooltips-off";
214
+ };