documentation-hub 5.7.2

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 (271) hide show
  1. package/.eslintrc.json +43 -0
  2. package/.github/workflows/build.yml +64 -0
  3. package/.github/workflows/ci.yml +39 -0
  4. package/.vscode/extensions.json +3 -0
  5. package/Current.md +97 -0
  6. package/DocHub_Image.png +0 -0
  7. package/README.md +666 -0
  8. package/USER_GUIDE.md +1173 -0
  9. package/Updater.md +311 -0
  10. package/build/256x256.png +0 -0
  11. package/build/512x512.png +0 -0
  12. package/build/app-update.yml +4 -0
  13. package/build/create-icon.js +208 -0
  14. package/build/icon.ico +0 -0
  15. package/build/icon.png +0 -0
  16. package/build/icon_1024x1024.png +0 -0
  17. package/dist/assets/Analytics-BpsG9895.js +1 -0
  18. package/dist/assets/Card-IAZin8kp.js +1 -0
  19. package/dist/assets/CurrentSession-B-rFkHvf.js +12 -0
  20. package/dist/assets/Dashboard-C_5gMb0q.js +1 -0
  21. package/dist/assets/Documents-CqZ25axS.js +1 -0
  22. package/dist/assets/Input-l89xwXBi.js +1 -0
  23. package/dist/assets/Reporting-DqdHJY_a.js +1 -0
  24. package/dist/assets/Search-XNbu5z_3.js +1 -0
  25. package/dist/assets/SessionManager-lH9hZfzH.js +1 -0
  26. package/dist/assets/Sessions-ClZOPYNc.js +1 -0
  27. package/dist/assets/Settings-DUEHGURa.js +11 -0
  28. package/dist/assets/index-8xUe8ptc.js +24 -0
  29. package/dist/assets/index-RYyJqF7O.css +1 -0
  30. package/dist/assets/path-BkOl0AGO.js +1 -0
  31. package/dist/assets/promises-ID_B9S-h.js +1 -0
  32. package/dist/assets/urlHelpers-TvgahX0r.js +1 -0
  33. package/dist/assets/useToast-yRSO1dkm.js +1 -0
  34. package/dist/assets/vendor-charts-RkGK5ROP.js +36 -0
  35. package/dist/assets/vendor-db-l0sNRNKZ.js +1 -0
  36. package/dist/assets/vendor-react-BVZ_anCF.js +4 -0
  37. package/dist/assets/vendor-search-Dw8P0qyA.js +1 -0
  38. package/dist/assets/vendor-ui-BU7NfluV.js +53 -0
  39. package/dist/electron/PowerAutomateApiService-LfW09ZGr.js +147 -0
  40. package/dist/electron/main-CXkNtyv-.js +19789 -0
  41. package/dist/electron/main.js +5 -0
  42. package/dist/electron/preload.js +1 -0
  43. package/dist/icon.png +0 -0
  44. package/dist/index.html +27 -0
  45. package/docs/CODEBASE_ANALYSIS_REPORT.md +309 -0
  46. package/docs/DEBUG_LOGGING_GUIDE.md +244 -0
  47. package/docs/README.md +115 -0
  48. package/docs/TOC_WIRING_GUIDE.md +344 -0
  49. package/docs/analysis/Bullet_Symbol_Bug_Analysis.md +136 -0
  50. package/docs/analysis/DOCXMLATER_ANALYSIS_SUMMARY.txt +169 -0
  51. package/docs/analysis/Document_Processing_Issues_Analysis.md +704 -0
  52. package/docs/analysis/FIELD_PRESERVATION_ANALYSIS.md +1200 -0
  53. package/docs/analysis/INDENTATION_PRESERVE_ANALYSIS.md +181 -0
  54. package/docs/analysis/INDENTATION_PRESERVE_IMPLEMENTATION.md +207 -0
  55. package/docs/analysis/List_Implementation.md +206 -0
  56. package/docs/analysis/List_Implementation_Accuracy_Report.md +366 -0
  57. package/docs/analysis/PROCESSING_OPTIONS_UI_UPDATES.md +220 -0
  58. package/docs/analysis/RefactorStyles.md +852 -0
  59. package/docs/analysis/STYLE_PARAMETER_ENHANCEMENT.md +143 -0
  60. package/docs/analysis/docxmlater-comparison-todo-2025-11-13.md +636 -0
  61. package/docs/analysis/docxmlater-implementation-analysis-2025-11-13.md +340 -0
  62. package/docs/analysis/docxmlater-template_ui-integration-analysis.md +263 -0
  63. package/docs/analysis/github-issues-to-create.md +237 -0
  64. package/docs/api/API_README.md +538 -0
  65. package/docs/api/API_REFERENCE.md +751 -0
  66. package/docs/api/TYPE_DEFINITIONS.md +869 -0
  67. package/docs/architecture/FONT_EMBEDDING_GUIDE.md +318 -0
  68. package/docs/architecture/docxmlater-functions-and-structure.md +726 -0
  69. package/docs/docxmlater-readme.md +1341 -0
  70. package/docs/fixes/EXECUTION_LOG_TEST_BASE.md +573 -0
  71. package/docs/fixes/HYPERLINK_TEXT_SANITIZATION.md +253 -0
  72. package/docs/fixes/README.md +37 -0
  73. package/docs/github-issues/issue-1-body.md +125 -0
  74. package/docs/github-issues/issue-10-body.md +850 -0
  75. package/docs/github-issues/issue-2-body.md +200 -0
  76. package/docs/github-issues/issue-3-body.md +270 -0
  77. package/docs/github-issues/issue-4-body.md +169 -0
  78. package/docs/github-issues/issue-5-body.md +173 -0
  79. package/docs/github-issues/issue-6-body.md +158 -0
  80. package/docs/github-issues/issue-7-body.md +171 -0
  81. package/docs/github-issues/issue-8-body.md +407 -0
  82. package/docs/github-issues/issue-9-body.md +515 -0
  83. package/docs/github-issues/issue-tracker.md +274 -0
  84. package/docs/github-issues/predictive-analysis-2025-10-18.md +2131 -0
  85. package/docs/implementation/List_Framework_Refactor_Plan.md +336 -0
  86. package/docs/implementation/PRIMARY_TEXT_COLOR_FEATURE.md +217 -0
  87. package/docs/implementation/RELEASE_PLAN_v2.1.0.md +362 -0
  88. package/docs/implementation/RefactorStyles.md +588 -0
  89. package/docs/implementation/implement-plan.md +489 -0
  90. package/docs/implementation/missing-helpers-implementation.md +391 -0
  91. package/docs/implementation/refactor-plan.md +520 -0
  92. package/docs/implementation/session-implementation-complete.md +233 -0
  93. package/docs/implementation/session-management-plan.md +250 -0
  94. package/docs/setup-checklist.md +77 -0
  95. package/docs/versions/changelog.md +345 -0
  96. package/electron/customUpdater.ts +656 -0
  97. package/electron/main.ts +2441 -0
  98. package/electron/memoryConfig.ts +187 -0
  99. package/electron/preload.ts +394 -0
  100. package/electron/proxyConfig.ts +340 -0
  101. package/electron/services/BackupService.ts +452 -0
  102. package/electron/services/DictionaryService.ts +402 -0
  103. package/electron/services/LocalDictionaryLookupService.ts +147 -0
  104. package/electron/services/PowerAutomateApiService.ts +231 -0
  105. package/electron/services/SharePointSyncService.ts +474 -0
  106. package/electron/windowsCertStore.ts +427 -0
  107. package/electron/zscalerConfig.ts +381 -0
  108. package/eslint.config.js +92 -0
  109. package/jest.config.js +52 -0
  110. package/package.json +214 -0
  111. package/postcss.config.mjs +6 -0
  112. package/public/icon.png +0 -0
  113. package/publish-release.ps1 +5 -0
  114. package/renovate.json +30 -0
  115. package/src/App.tsx +216 -0
  116. package/src/__mocks__/p-limit.js +12 -0
  117. package/src/__mocks__/styleMock.js +1 -0
  118. package/src/components/common/BugReportButton.tsx +44 -0
  119. package/src/components/common/BugReportDialog.tsx +193 -0
  120. package/src/components/common/Button.tsx +153 -0
  121. package/src/components/common/Card.tsx +86 -0
  122. package/src/components/common/ColorPickerDialog.tsx +177 -0
  123. package/src/components/common/ConfirmDialog.tsx +96 -0
  124. package/src/components/common/DebugConsole.tsx +275 -0
  125. package/src/components/common/EmptyState.tsx +183 -0
  126. package/src/components/common/ErrorBoundary.tsx +98 -0
  127. package/src/components/common/ErrorDetailsDialog.tsx +153 -0
  128. package/src/components/common/ErrorFallback.tsx +218 -0
  129. package/src/components/common/Input.tsx +109 -0
  130. package/src/components/common/Skeleton.tsx +184 -0
  131. package/src/components/common/SplashScreen.tsx +81 -0
  132. package/src/components/common/Toast.tsx +155 -0
  133. package/src/components/common/Tooltip.tsx +79 -0
  134. package/src/components/common/UpdateNotification.tsx +320 -0
  135. package/src/components/comparison/ComparisonWindow.tsx +374 -0
  136. package/src/components/comparison/SideBySideDiff.tsx +486 -0
  137. package/src/components/comparison/index.ts +8 -0
  138. package/src/components/document/DocumentUploader.tsx +288 -0
  139. package/src/components/document/HyperlinkPreview.tsx +430 -0
  140. package/src/components/document/HyperlinkService.md +1484 -0
  141. package/src/components/document/Hyperlink_Technical_Documentation.md +496 -0
  142. package/src/components/document/InlineChangesView.tsx +707 -0
  143. package/src/components/document/ProcessingProgress.tsx +303 -0
  144. package/src/components/document/ProcessingResults.tsx +256 -0
  145. package/src/components/document/TrackedChangesDetail.tsx +530 -0
  146. package/src/components/document/TrackedChangesPanel.tsx +546 -0
  147. package/src/components/document/VirtualDocumentList.tsx +240 -0
  148. package/src/components/editor/DocumentEditor.tsx +723 -0
  149. package/src/components/editor/DocumentEditorModal.tsx +640 -0
  150. package/src/components/editor/EditorQuickActions.tsx +502 -0
  151. package/src/components/editor/EditorToolbar.tsx +312 -0
  152. package/src/components/editor/TableEditor.tsx +926 -0
  153. package/src/components/editor/index.ts +18 -0
  154. package/src/components/layout/Header.tsx +190 -0
  155. package/src/components/layout/Sidebar.tsx +313 -0
  156. package/src/components/layout/TitleBar.tsx +190 -0
  157. package/src/components/navigation/CommandPalette.tsx +233 -0
  158. package/src/components/navigation/KeyboardShortcutsModal.tsx +173 -0
  159. package/src/components/sessions/ChangeItem.tsx +408 -0
  160. package/src/components/sessions/ChangeViewer.tsx +1155 -0
  161. package/src/components/sessions/DocumentComparisonModal.tsx +314 -0
  162. package/src/components/sessions/ProcessingOptions.tsx +297 -0
  163. package/src/components/sessions/ReplacementsTab.tsx +438 -0
  164. package/src/components/sessions/RevisionHandlingOptions.tsx +87 -0
  165. package/src/components/sessions/SessionManager.tsx +188 -0
  166. package/src/components/sessions/StylesEditor.tsx +1335 -0
  167. package/src/components/sessions/TabContainer.tsx +151 -0
  168. package/src/components/sessions/VirtualSessionList.tsx +157 -0
  169. package/src/components/sessions/sessionToProcessorManager.tsx +420 -0
  170. package/src/components/settings/CertificateManager.tsx +410 -0
  171. package/src/components/settings/SegmentedControl.tsx +88 -0
  172. package/src/components/settings/SettingRow.tsx +52 -0
  173. package/src/contexts/GlobalStatsContext.tsx +396 -0
  174. package/src/contexts/SessionContext.tsx +2129 -0
  175. package/src/contexts/ThemeContext.tsx +428 -0
  176. package/src/contexts/UserSettingsContext.tsx +290 -0
  177. package/src/contexts/__tests__/GlobalStatsContext.test.tsx +390 -0
  178. package/src/global.d.ts +273 -0
  179. package/src/hooks/useDocumentQueue.tsx +210 -0
  180. package/src/hooks/useToast.tsx +55 -0
  181. package/src/main.tsx +10 -0
  182. package/src/pages/Analytics.tsx +386 -0
  183. package/src/pages/CurrentSession.tsx +1174 -0
  184. package/src/pages/Dashboard.tsx +319 -0
  185. package/src/pages/Documents.tsx +317 -0
  186. package/src/pages/Projects.tsx +250 -0
  187. package/src/pages/Reporting.tsx +386 -0
  188. package/src/pages/Search.tsx +349 -0
  189. package/src/pages/Sessions.tsx +285 -0
  190. package/src/pages/Settings.tsx +2662 -0
  191. package/src/services/HyperlinkService.ts +1085 -0
  192. package/src/services/document/DocXMLaterProcessor.ts +617 -0
  193. package/src/services/document/DocumentProcessingComparison.ts +856 -0
  194. package/src/services/document/DocumentSnapshotService.ts +575 -0
  195. package/src/services/document/WordDocumentProcessor.ts +10509 -0
  196. package/src/services/document/__tests__/DocXMLaterProcessor.hyperlinks.test.md +311 -0
  197. package/src/services/document/__tests__/WordDocumentProcessor.integration.test.ts +515 -0
  198. package/src/services/document/__tests__/WordDocumentProcessor.test.ts +812 -0
  199. package/src/services/document/blanklines/BlankLineManager.ts +658 -0
  200. package/src/services/document/blanklines/__tests__/paragraphChecks.test.ts +281 -0
  201. package/src/services/document/blanklines/helpers/blankLineInsertion.ts +87 -0
  202. package/src/services/document/blanklines/helpers/blankLineSnapshot.ts +251 -0
  203. package/src/services/document/blanklines/helpers/clearCustom.ts +121 -0
  204. package/src/services/document/blanklines/helpers/contextChecks.ts +117 -0
  205. package/src/services/document/blanklines/helpers/imageChecks.ts +51 -0
  206. package/src/services/document/blanklines/helpers/paragraphChecks.ts +236 -0
  207. package/src/services/document/blanklines/helpers/removeBlanksBetweenListItems.ts +91 -0
  208. package/src/services/document/blanklines/helpers/removeTrailingBlanks.ts +35 -0
  209. package/src/services/document/blanklines/helpers/tableGuards.ts +21 -0
  210. package/src/services/document/blanklines/index.ts +67 -0
  211. package/src/services/document/blanklines/rules/additionRules.ts +337 -0
  212. package/src/services/document/blanklines/rules/indentationRules.ts +317 -0
  213. package/src/services/document/blanklines/rules/removalRules.ts +362 -0
  214. package/src/services/document/blanklines/rules/ruleTypes.ts +92 -0
  215. package/src/services/document/blanklines/types.ts +29 -0
  216. package/src/services/document/helpers/ImageBorderCropper.ts +377 -0
  217. package/src/services/document/helpers/__tests__/whitespace.test.ts +272 -0
  218. package/src/services/document/helpers/whitespace.ts +117 -0
  219. package/src/services/document/list/ListNormalizer.ts +947 -0
  220. package/src/services/document/list/index.ts +45 -0
  221. package/src/services/document/list/list-detection.ts +275 -0
  222. package/src/services/document/list/list-types.ts +162 -0
  223. package/src/services/document/processors/HyperlinkProcessor.ts +370 -0
  224. package/src/services/document/processors/ListProcessor.ts +257 -0
  225. package/src/services/document/processors/StructureProcessor.ts +176 -0
  226. package/src/services/document/processors/StyleProcessor.ts +389 -0
  227. package/src/services/document/processors/TableProcessor.ts +2238 -0
  228. package/src/services/document/processors/__tests__/HyperlinkProcessor.test.ts +314 -0
  229. package/src/services/document/processors/__tests__/ListProcessor.test.ts +291 -0
  230. package/src/services/document/processors/__tests__/StructureProcessor.test.ts +257 -0
  231. package/src/services/document/processors/__tests__/TableProcessor.hlp-tips-bullets.test.ts +459 -0
  232. package/src/services/document/processors/__tests__/TableProcessor.test.ts +1604 -0
  233. package/src/services/document/processors/index.ts +28 -0
  234. package/src/services/document/types/docx-processing.ts +310 -0
  235. package/src/services/editor/EditorActionHandlers.ts +901 -0
  236. package/src/services/editor/index.ts +13 -0
  237. package/src/setupTests.ts +47 -0
  238. package/src/styles/global.css +782 -0
  239. package/src/types/backup.ts +132 -0
  240. package/src/types/dictionary.ts +125 -0
  241. package/src/types/document-processing.ts +331 -0
  242. package/src/types/docxmlater-augments.d.ts +142 -0
  243. package/src/types/editor.ts +280 -0
  244. package/src/types/electron.ts +340 -0
  245. package/src/types/globalStats.ts +155 -0
  246. package/src/types/hyperlink.ts +471 -0
  247. package/src/types/operations.ts +354 -0
  248. package/src/types/session.ts +427 -0
  249. package/src/types/settings.ts +112 -0
  250. package/src/utils/MemoryMonitor.ts +248 -0
  251. package/src/utils/cn.ts +6 -0
  252. package/src/utils/colorConvert.ts +306 -0
  253. package/src/utils/diffUtils.ts +347 -0
  254. package/src/utils/documentUtils.ts +202 -0
  255. package/src/utils/electronGuard.ts +62 -0
  256. package/src/utils/indexedDB.ts +915 -0
  257. package/src/utils/logger.ts +717 -0
  258. package/src/utils/pathSecurity.ts +232 -0
  259. package/src/utils/pathValidator.ts +236 -0
  260. package/src/utils/processingTimeEstimator.ts +153 -0
  261. package/src/utils/safeJsonParse.ts +62 -0
  262. package/src/utils/textSanitizer.ts +162 -0
  263. package/src/utils/urlHelpers.ts +304 -0
  264. package/src/utils/urlPatterns.ts +198 -0
  265. package/src/utils/urlSanitizer.ts +152 -0
  266. package/src/vite-env.d.ts +11 -0
  267. package/tsconfig.electron.json +19 -0
  268. package/tsconfig.json +36 -0
  269. package/tsconfig.node.json +12 -0
  270. package/typedoc.json +45 -0
  271. package/vite.config.ts +152 -0
package/docs/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Documentation Hub - Technical Documentation
2
+
3
+ This directory contains all technical documentation for the Documentation Hub application.
4
+
5
+ ## Directory Structure
6
+
7
+ ```
8
+ docs/
9
+ ├── analysis/ # Bug analysis and technical investigations
10
+ │ ├── Bug fix summaries
11
+ │ ├── Implementation analyses
12
+ │ ├── Document processing issue reports
13
+ │ └── Performance and accuracy reports
14
+
15
+ ├── api/ # API documentation
16
+ │ ├── API_README.md
17
+ │ ├── API_REFERENCE.md
18
+ │ └── TYPE_DEFINITIONS.md
19
+
20
+ ├── architecture/ # System architecture and design documents
21
+ │ ├── Complete processing flow diagrams
22
+ │ ├── Integration guides
23
+ │ ├── OOXML architecture specifications
24
+ │ └── Font embedding guides
25
+
26
+ ├── fixes/ # Bug fix documentation
27
+ │ ├── Detailed fix summaries
28
+ │ ├── SDT and table protection fixes
29
+ │ ├── Corruption and spacing fixes
30
+ │ └── README with fix index
31
+
32
+ ├── github-issues/ # GitHub issue documentation and tracking
33
+ │ ├── Issue body templates (issue-1-body.md through issue-10-body.md)
34
+ │ ├── Issue tracker and management
35
+ │ └── Predictive analysis documents
36
+
37
+ ├── hooks/ # Development hooks documentation
38
+ │ └── README.md
39
+
40
+ ├── implementation/ # Implementation guides and summaries
41
+ │ ├── Feature implementation plans
42
+ │ ├── Refactoring summaries
43
+ │ ├── Session management guides
44
+ │ ├── Plugin marketplace plans
45
+ │ └── Migration summaries
46
+
47
+ ├── research/ # Research notes and analysis
48
+ │ ├── DOCXMLATER analysis and examples
49
+ │ ├── GitHub issue analysis
50
+ │ └── Code location documentation
51
+
52
+ ├── versions/ # Version history
53
+ │ └── changelog.md
54
+
55
+ ├── docxmlater-readme.md # Third-party library documentation
56
+ ├── DEBUG_LOGGING_GUIDE.md # Debug logging instructions
57
+ ├── README.md # This file
58
+ └── TOC_WIRING_GUIDE.md # Table of Contents implementation guide
59
+ ```
60
+
61
+ ## Document Categories
62
+
63
+ ### Analysis Documents
64
+ Bug analyses, technical investigations, implementation accuracy reports, and processing issue documentation.
65
+
66
+ ### API Documentation
67
+ Complete API reference, type definitions, and usage guides for developers.
68
+
69
+ ### Architecture Documents
70
+ High-level system design, architecture decisions, technical specifications, and integration guides.
71
+
72
+ ### Bug Fixes
73
+ Detailed documentation of bug fixes, including corruption fixes, protection fixes, and spacing corrections.
74
+
75
+ ### GitHub Issues
76
+ Issue templates, tracking documents, and issue-specific research for GitHub issue management.
77
+
78
+ ### Implementation Guides
79
+ Step-by-step implementation plans, feature specifications, refactoring guides, and migration summaries.
80
+
81
+ ### Research Notes
82
+ Analysis documents, proof-of-concepts, technical investigations, and third-party library research.
83
+
84
+ ### Version History
85
+ Changelog and version-specific documentation.
86
+
87
+ ## Personal vs Public Documentation
88
+
89
+ **Public Documentation** (tracked in git):
90
+ - Architecture diagrams and specifications
91
+ - Implementation guides
92
+ - API documentation
93
+ - User guides
94
+ - Contributing guidelines
95
+
96
+ **Personal Documentation** (gitignored):
97
+ - TODO.md, NOTES.md, SCRATCH.md
98
+ - Personal status tracking
99
+ - Developer-specific workspace files
100
+
101
+ See `.gitignore` for complete list of excluded personal files.
102
+
103
+ ## Documentation Standards
104
+
105
+ When adding new documentation:
106
+ 1. Place in appropriate subdirectory based on content type
107
+ 2. Use descriptive filenames with context (e.g., `FEATURE_NAME_implementation.md`)
108
+ 3. Include dates for time-sensitive documents (e.g., `analysis-2025-10-19.md`)
109
+ 4. Update this README if adding new categories or major documents
110
+ 5. Keep technical documentation separate from user-facing guides (see root `/USER_GUIDE.md`)
111
+
112
+ ## Maintenance History
113
+
114
+ - **2025-10-19**: Initial documentation structure created to organize scattered markdown files
115
+ - **2025-11-25**: Major cleanup - removed duplicate user guides, reorganized analysis/implementation files, moved test files to scripts/, removed personal workspace files from root
@@ -0,0 +1,344 @@
1
+ # Table of Contents (TOC) Wiring Guide
2
+
3
+ ## Overview
4
+
5
+ This guide explains how to enable automatic Table of Contents generation in dochub-app. The framework (`docxmlater`) has full TOC generation capability built-in, but it requires proper option wiring from the UI.
6
+
7
+ ## Current Problem
8
+
9
+ Users see only placeholder text in their TOC:
10
+
11
+ - "Table of Contents" (header)
12
+ - "Right-click to update field." (placeholder)
13
+
14
+ This happens because `options.operations?.updateTocHyperlinks` is not being set by the UI, so the post-save TOC population never runs.
15
+
16
+ ## How TOC Generation Works
17
+
18
+ ### Framework Implementation (Already Complete)
19
+
20
+ Located in `src/services/document/WordDocumentProcessor.ts` lines 933-946:
21
+
22
+ ```typescript
23
+ if (options.operations?.updateTocHyperlinks) {
24
+ this.log.debug('=== GENERATING/UPDATING TABLE OF CONTENTS ===');
25
+
26
+ // Use DocXMLater's replaceTableOfContents() to populate TOC entries
27
+ const tocCount = await doc.replaceTableOfContents(filePath);
28
+
29
+ this.log.info(`Replaced ${tocCount} Table of Contents element(s) with generated entries`);
30
+
31
+ if (tocCount === 0) {
32
+ this.log.warn(
33
+ 'No TOC elements found in document. To create a TOC, insert a Table of Contents field in Word first.'
34
+ );
35
+ }
36
+ }
37
+ ```
38
+
39
+ ### What It Does
40
+
41
+ 1. **Scans document** for TOC fields (identified by `<w:docPartGallery w:val="Table of Contents">`)
42
+ 2. **Extracts field instructions** (e.g., `\o "1-3"` for outline levels 1-3)
43
+ 3. **Finds all headings** throughout the document (including tables)
44
+ 4. **Generates hyperlinked entries** with correct indentation per heading level
45
+ 5. **Writes entries** back into the TOC while preserving the field structure
46
+
47
+ ### Technical Details
48
+
49
+ - **Runs after** `doc.save()` to avoid overwriting changes
50
+ - **Modifies** the saved file on disk directly
51
+ - **Preserves** the TOC field code so Word still recognizes it as a TOC
52
+ - **Creates** internal bookmarks (`_Toc123...`) for each heading
53
+ - **Applies** standard formatting: Verdana 12pt, blue (#0000FF), underlined
54
+
55
+ ## UI Integration Options
56
+
57
+ ### Option 1: Add Dedicated Checkbox (Recommended)
58
+
59
+ Add a new checkbox in the Processing Options → Operations section:
60
+
61
+ **UI Component:**
62
+
63
+ ```typescript
64
+ {
65
+ id: 'update-toc-hyperlinks',
66
+ label: 'Generate/Update Table of Contents',
67
+ description: 'Automatically populate TOC with hyperlinked entries from document headings',
68
+ category: 'operations',
69
+ type: 'checkbox',
70
+ defaultValue: false,
71
+ }
72
+ ```
73
+
74
+ **Option Mapping:**
75
+
76
+ ```typescript
77
+ const processingOptions: WordProcessingOptions = {
78
+ // ... other options
79
+ operations: {
80
+ // ... other operations
81
+ updateTocHyperlinks: formData['update-toc-hyperlinks'], // Map UI checkbox to option
82
+ },
83
+ };
84
+ ```
85
+
86
+ ### Option 2: Rename Existing Option
87
+
88
+ If there's already a TOC-related option with a confusing name:
89
+
90
+ **Current (unclear):**
91
+
92
+ ```typescript
93
+ operations: {
94
+ updateTocHyperlinks: true; // Unclear what this does
95
+ }
96
+ ```
97
+
98
+ **Better naming:**
99
+
100
+ ```typescript
101
+ operations: {
102
+ populateToc: true, // OR
103
+ generateTocEntries: true, // OR
104
+ autoUpdateToc: true
105
+ }
106
+ ```
107
+
108
+ Keep backward compatibility:
109
+
110
+ ```typescript
111
+ // In WordDocumentProcessor
112
+ const shouldPopulateToc =
113
+ options.operations?.populateToc ?? options.operations?.updateTocHyperlinks ?? false;
114
+ ```
115
+
116
+ ### Option 3: Separate TOC & Hyperlink Operations
117
+
118
+ If you want fine-grained control:
119
+
120
+ ```typescript
121
+ operations: {
122
+ populateToc: true, // Generate TOC entries
123
+ standardizeHyperlinkColor: true, // Separate hyperlink formatting
124
+ standardizeHyperlinkFormatting: true, // Remove bold/italic from links
125
+ }
126
+ ```
127
+
128
+ ## User Workflow
129
+
130
+ ### Steps to Use TOC Generation
131
+
132
+ 1. **User prepares document in Word:**
133
+ - Insert → Table of Contents
134
+ - Choose a TOC style (e.g., Automatic Table 1)
135
+ - Word creates the TOC field with placeholder text
136
+
137
+ 2. **User enables option in dochub-app:**
138
+ - Check "Generate/Update Table of Contents"
139
+ - Configure other processing options as needed
140
+ - Process the document
141
+
142
+ 3. **Result:**
143
+ - dochub-app saves the document
144
+ - Post-save: Scans for headings and populates TOC
145
+ - Recipient opens document and sees fully clickable TOC
146
+
147
+ ### Example Document Flow
148
+
149
+ **Before Processing:**
150
+
151
+ ```
152
+ Table of Contents
153
+ Right-click to update field.
154
+
155
+ [Document content with headings...]
156
+ ```
157
+
158
+ **After Processing (with option enabled):**
159
+
160
+ ```
161
+ Table of Contents
162
+ Introduction ..................................... 1
163
+ Background ...................................... 2
164
+ Project Overview .............................. 2
165
+ Objectives .................................... 3
166
+ Methodology ..................................... 4
167
+ [etc.]
168
+
169
+ [Document content with headings...]
170
+ ```
171
+
172
+ ## Implementation Checklist
173
+
174
+ - [ ] Add UI checkbox/control for TOC generation
175
+ - [ ] Map UI value to `options.operations.updateTocHyperlinks`
176
+ - [ ] Update user documentation/help text
177
+ - [ ] Add tooltip explaining prerequisites (TOC field must exist)
178
+ - [ ] Test with documents containing:
179
+ - [ ] Single TOC
180
+ - [ ] Multiple TOCs
181
+ - [ ] No TOC (should log warning, not error)
182
+ - [ ] Headings in tables
183
+ - [ ] 100+ headings (performance test)
184
+
185
+ ## Error Handling
186
+
187
+ ### Case 1: No TOC Field in Document
188
+
189
+ **Behavior:** Logs warning, continues processing
190
+
191
+ **Log Output:**
192
+
193
+ ```
194
+ WARN: No TOC elements found in document. To create a TOC, insert a Table of Contents field in Word first.
195
+ ```
196
+
197
+ **User Action Required:** Insert TOC field in Word before processing
198
+
199
+ ### Case 2: Invalid TOC Field Structure
200
+
201
+ **Behavior:** Framework detects and skips malformed TOC
202
+
203
+ **Log Output:**
204
+
205
+ ```
206
+ WARN: Found TOC element but could not parse field instructions
207
+ ```
208
+
209
+ **User Action Required:** Recreate TOC field in Word
210
+
211
+ ### Case 3: No Headings in Document
212
+
213
+ **Behavior:** TOC is populated but empty (no entries)
214
+
215
+ **Result:** Only "Table of Contents" header appears
216
+
217
+ **User Action Required:** Add heading styles to document content
218
+
219
+ ## Advanced Configuration
220
+
221
+ ### Custom TOC Properties (Future Enhancement)
222
+
223
+ The framework supports `TOCProperties` for advanced configuration:
224
+
225
+ ```typescript
226
+ interface TOCProperties {
227
+ levels: number[]; // Which heading levels to include (default: [1,2,3])
228
+ hyperlinked: boolean; // Use hyperlinks vs page numbers
229
+ includePageNumbers: boolean; // Show page numbers
230
+ rightAlignPageNumbers: boolean; // Right-align page numbers
231
+ tabLeaderStyle: 'none' | 'dots' | 'dashes' | 'underline';
232
+ spacingBetweenEntries: number; // Points
233
+ hyperlinkColor: string; // Hex color
234
+ }
235
+ ```
236
+
237
+ To expose this in UI:
238
+
239
+ ```typescript
240
+ tableOfContentsSettings?: {
241
+ enabled: boolean;
242
+ includeHeadingLevels: number[]; // [1, 2, 3]
243
+ showPageNumbers: boolean;
244
+ rightAlignPageNumbers: boolean;
245
+ useHyperlinks: boolean;
246
+ tabLeaderStyle: 'none' | 'dots' | 'dashes' | 'underline';
247
+ tocTitle: string;
248
+ showTocTitle: boolean;
249
+ spacingBetweenHyperlinks: number; // in points
250
+ }
251
+ ```
252
+
253
+ ## Testing Strategy
254
+
255
+ ### Manual Testing
256
+
257
+ 1. **Create test document with 20+ headings**
258
+ 2. **Insert TOC field in Word**
259
+ 3. **Process with option enabled**
260
+ 4. **Verify:**
261
+ - TOC contains all headings
262
+ - Hyperlinks work (click → jump to section)
263
+ - Formatting is consistent (Verdana 12pt blue)
264
+ - Indentation matches heading levels
265
+
266
+ ### Automated Testing
267
+
268
+ ```typescript
269
+ describe('TOC Generation', () => {
270
+ it('should populate TOC when option enabled', async () => {
271
+ const options = {
272
+ operations: { updateTocHyperlinks: true },
273
+ };
274
+
275
+ const result = await processor.processDocument('test-with-toc.docx', options);
276
+
277
+ expect(result.success).toBe(true);
278
+ // Verify TOC was populated (check logs or inspect document)
279
+ });
280
+
281
+ it('should skip TOC when option disabled', async () => {
282
+ const options = {
283
+ operations: { updateTocHyperlinks: false },
284
+ };
285
+
286
+ const result = await processor.processDocument('test-with-toc.docx', options);
287
+
288
+ expect(result.success).toBe(true);
289
+ // Verify TOC still shows placeholder
290
+ });
291
+ });
292
+ ```
293
+
294
+ ## Troubleshooting
295
+
296
+ ### Problem: TOC Still Shows Placeholder
297
+
298
+ **Check:**
299
+
300
+ 1. Is `operations.updateTocHyperlinks` actually `true`?
301
+ 2. Does document have TOC field? (Insert → Table of Contents in Word)
302
+ 3. Check logs for "GENERATING/UPDATING TABLE OF CONTENTS"
303
+
304
+ **Debug:**
305
+
306
+ ```typescript
307
+ // Add logging to verify option value
308
+ console.log('TOC option:', options.operations?.updateTocHyperlinks);
309
+ ```
310
+
311
+ ### Problem: TOC Missing Some Headings
312
+
313
+ **Check:**
314
+
315
+ 1. Are headings using proper styles (Heading 1, Heading 2, etc.)?
316
+ 2. Does TOC field instruction match heading levels? (e.g., `\o "1-3"`)
317
+ 3. Are headings in tables? (Framework supports this)
318
+
319
+ **Solution:** Adjust TOC field switches in Word or heading styles
320
+
321
+ ### Problem: TOC Hyperlinks Don't Work
322
+
323
+ **Check:**
324
+
325
+ 1. Are bookmarks created? (Framework should create `_Toc123...` bookmarks)
326
+ 2. Is document corrupted?
327
+
328
+ **Solution:** Recreate document or use docXMLater validation
329
+
330
+ ## Related Documentation
331
+
332
+ - [WordDocumentProcessor.ts](../src/services/document/WordDocumentProcessor.ts) - Implementation
333
+ - [Processing Options Documentation](./PROCESSING_OPTIONS_UI_UPDATES.md) - All options
334
+ - [DocXMLater Library](../docxmlater-readme.md) - Framework capabilities
335
+
336
+ ## Version History
337
+
338
+ - **v1.19.0**: TOC generation fully implemented in framework
339
+ - **Current**: Requires UI wiring to enable feature
340
+ - **Next**: Plan to add advanced TOC configuration options
341
+
342
+ ---
343
+
344
+ **Need Help?** Contact the development team or file an issue in the repository.
@@ -0,0 +1,136 @@
1
+ # Bullet Symbol Replacement Bug Analysis
2
+
3
+ ## Problem Statement
4
+
5
+ "Bullet 3" still shows a square symbol (■) instead of the user-configured bullet character after processing.
6
+
7
+ ## Root Cause Analysis
8
+
9
+ ### Document Structure
10
+
11
+ ```xml
12
+ <!-- Bullets 1-3 use abstractNum w:abstractNumId="2" -->
13
+ <w:numPr><w:ilvl w:val="0"/><w:numId w:val="2"/></w:numPr>
14
+
15
+ <!-- Bullets 4-6 use abstractNum w:abstractNumId="1" -->
16
+ <w:numPr><w:ilvl w:val="0"/><w:numId w:val="1"/></w:numPr>
17
+ ```
18
+
19
+ ### Numbering Definitions (BEFORE)
20
+
21
+ AbstractNum 2 has variable symbols per level:
22
+
23
+ - Level 0: ● (filled circle)
24
+ - Level 1: ○ (hollow circle)
25
+ - Level 2: ■ (SQUARE - the problematic symbol)
26
+
27
+ ### Current Implementation Flow
28
+
29
+ ```typescript
30
+ // Step 1: applyBulletUniformity() creates NEW custom list
31
+ const numId = manager.createCustomList(levels, 'UI Bullet List');
32
+
33
+ // Step 2: Assigns new list to bullet paragraphs
34
+ para.setNumbering(numId, level);
35
+
36
+ // Step 3: standardizeBulletSymbols() applies formatting
37
+ doc.standardizeBulletSymbols({
38
+ font: '
39
+
40
+ Verdana',
41
+ fontSize: 12,
42
+ color: '000000',
43
+ bold: true
44
+ });
45
+ ```
46
+
47
+ ## The Critical Issue
48
+
49
+ **`standardizeBulletSymbols()` PRESERVES existing bullet symbols by design!**
50
+
51
+ From the framework documentation:
52
+
53
+ > "Preserves user's chosen bullet characters - only standardizes font, size, color, and weight"
54
+
55
+ This means:
56
+
57
+ - ✅ It updates font, size, color, bold
58
+ - ❌ It does NOT change the bullet character itself
59
+
60
+ ## Why Bullet 3 Shows a Square
61
+
62
+ 1. "Bullet 3" paragraph references `numId="2", level="0"`
63
+ 2. **BUT** the paragraph might be at a DEEPER indent level in the original document
64
+ 3. The framework sees it as using the level 2 symbol (■) from abstractNum 2
65
+ 4. Creating a new custom list doesn't help if paragraphs aren't reassigned to it
66
+ 5. `standardizeBulletSymbols()` then preserves the ■ symbol
67
+
68
+ ## Solution Options
69
+
70
+ ### Option A: Framework-Only Approach (RECOMMENDED)
71
+
72
+ Use ONLY the framework's `standardizeBulletSymbols()` but with explicit symbol replacement:
73
+
74
+ ```typescript
75
+ // Check if framework supports symbol replacement
76
+ const result = doc.standardizeBulletSymbols({
77
+ symbol: bullet, // NEW: explicit symbol replacement
78
+ font: 'Verdana',
79
+ fontSize: 12,
80
+ color: '000000',
81
+ bold: true,
82
+ });
83
+ ```
84
+
85
+ **Problem:** Need to verify if framework supports `symbol` parameter.
86
+
87
+ ### Option B: Ensure All Paragraphs Are Reassigned
88
+
89
+ Make sure `applyBulletUniformity()` actually reassigns ALL bullet paragraphs:
90
+
91
+ ```typescript
92
+ for (const para of paragraphs) {
93
+ const numbering = para.getNumbering();
94
+ if (numbering && this.isBulletList(doc, numbering.numId)) {
95
+ const level = Math.min(numbering.level || 0, levels.length - 1);
96
+ para.setNumbering(numId, level); // ← Verify this executes
97
+ standardizedCount++;
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Option C: Direct XML Modification (HYBRID)
103
+
104
+ Keep custom list creation but also modify abstractNum 2 directly:
105
+
106
+ ```typescript
107
+ // After creating custom list
108
+ // Also update existing abstractNum 2 to use user's bullets
109
+ const existingAbstractNums = manager.getAllAbstractNumberings();
110
+ for (const abstractNum of existingAbstractNums) {
111
+ for (let i = 0; i < levels.length; i++) {
112
+ const level = abstractNum.getLevel(i);
113
+ if (level && level.getFormat() === 'bullet') {
114
+ level.setText(bullets[i]); // Replace symbol
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ ## Recommended Fix
121
+
122
+ **Use Option C (Hybrid Approach):**
123
+
124
+ 1. Keep existing custom list creation (for new documents)
125
+ 2. ALSO update ALL existing abstractNum definitions
126
+ 3. Then apply formatting standardization
127
+
128
+ This ensures:
129
+
130
+ - New lists get user symbols ✅
131
+ - Existing lists get user symbols ✅
132
+ - All formatting is standardized ✅
133
+
134
+ ## Implementation Priority
135
+
136
+ **HIGH** - This is a visible bug that affects user experience.