@stll/folio-core 0.0.1-placeholder.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE.md +29 -0
- package/README.md +41 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/ai-edits/apply.d.ts +35 -0
- package/dist/ai-edits/apply.js +683 -0
- package/dist/ai-edits/clean-text.d.ts +28 -0
- package/dist/ai-edits/clean-text.js +23 -0
- package/dist/ai-edits/headless.d.ts +225 -0
- package/dist/ai-edits/headless.js +513 -0
- package/dist/ai-edits/index.d.ts +6 -0
- package/dist/ai-edits/index.js +5 -0
- package/dist/ai-edits/inline-emphasis.d.ts +38 -0
- package/dist/ai-edits/inline-emphasis.js +78 -0
- package/dist/ai-edits/snapshot.d.ts +9 -0
- package/dist/ai-edits/snapshot.js +195 -0
- package/dist/ai-edits/types.d.ts +156 -0
- package/dist/ai-edits/types.js +0 -0
- package/dist/ai-edits/word-diff.d.ts +20 -0
- package/dist/ai-edits/word-diff.js +77 -0
- package/dist/ai-suggestions/apply.d.ts +17 -0
- package/dist/ai-suggestions/apply.js +64 -0
- package/dist/ai-suggestions/conflict.d.ts +22 -0
- package/dist/ai-suggestions/conflict.js +67 -0
- package/dist/ai-suggestions/text-positions.d.ts +21 -0
- package/dist/ai-suggestions/text-positions.js +48 -0
- package/dist/ai-suggestions/types.d.ts +199 -0
- package/dist/ai-suggestions/types.js +59 -0
- package/dist/content-controls/errors.d.ts +52 -0
- package/dist/content-controls/errors.js +36 -0
- package/dist/content-controls/findContentControls.d.ts +55 -0
- package/dist/content-controls/findContentControls.js +75 -0
- package/dist/content-controls/index.d.ts +4 -0
- package/dist/content-controls/index.js +4 -0
- package/dist/content-controls/mutateContentControls.d.ts +51 -0
- package/dist/content-controls/mutateContentControls.js +377 -0
- package/dist/controller/folioEditor.d.ts +21 -0
- package/dist/controller/folioEditor.js +29 -0
- package/dist/controller/folioEditorEvents.d.ts +23 -0
- package/dist/controller/folioEditorEvents.js +24 -0
- package/dist/controller/hiddenEditorApi.d.ts +35 -0
- package/dist/controller/hiddenEditorApi.js +112 -0
- package/dist/controller/hiddenEditorManager.d.ts +93 -0
- package/dist/controller/hiddenEditorManager.js +308 -0
- package/dist/controller/layoutPipeline.d.ts +63 -0
- package/dist/controller/layoutPipeline.js +406 -0
- package/dist/controller/layoutScheduler.d.ts +41 -0
- package/dist/controller/layoutScheduler.js +59 -0
- package/dist/controller/layoutSession.d.ts +24 -0
- package/dist/controller/layoutSession.js +13 -0
- package/dist/docx/blockContentParser.d.ts +13 -0
- package/dist/docx/blockContentParser.js +289 -0
- package/dist/docx/bookmarkParser.d.ts +178 -0
- package/dist/docx/bookmarkParser.js +246 -0
- package/dist/docx/bookmarkPlacement.d.ts +10 -0
- package/dist/docx/bookmarkPlacement.js +50 -0
- package/dist/docx/bulletMarkers.d.ts +4 -0
- package/dist/docx/bulletMarkers.js +42 -0
- package/dist/docx/commentParser.d.ts +34 -0
- package/dist/docx/commentParser.js +127 -0
- package/dist/docx/commentReferenceNormalization.d.ts +25 -0
- package/dist/docx/commentReferenceNormalization.js +97 -0
- package/dist/docx/commentReplyMarkers.d.ts +20 -0
- package/dist/docx/commentReplyMarkers.js +123 -0
- package/dist/docx/compatibility.d.ts +12 -0
- package/dist/docx/compatibility.js +77 -0
- package/dist/docx/documentParser.d.ts +65 -0
- package/dist/docx/documentParser.js +209 -0
- package/dist/docx/drawingUtils.d.ts +56 -0
- package/dist/docx/drawingUtils.js +305 -0
- package/dist/docx/fieldParser.d.ts +228 -0
- package/dist/docx/fieldParser.js +559 -0
- package/dist/docx/footnoteParser.d.ts +109 -0
- package/dist/docx/footnoteParser.js +270 -0
- package/dist/docx/headerFooterParser.d.ts +119 -0
- package/dist/docx/headerFooterParser.js +266 -0
- package/dist/docx/headerFooterRefParser.d.ts +22 -0
- package/dist/docx/headerFooterRefParser.js +52 -0
- package/dist/docx/headerFooterReferenceNormalization.d.ts +19 -0
- package/dist/docx/headerFooterReferenceNormalization.js +64 -0
- package/dist/docx/hyperlinkParser.d.ts +108 -0
- package/dist/docx/hyperlinkParser.js +230 -0
- package/dist/docx/imageParser.d.ts +93 -0
- package/dist/docx/imageParser.js +522 -0
- package/dist/docx/mathToMathml.d.ts +15 -0
- package/dist/docx/mathToMathml.js +357 -0
- package/dist/docx/modelValidation.d.ts +13 -0
- package/dist/docx/modelValidation.js +21 -0
- package/dist/docx/normalizeBaseDirection.d.ts +12 -0
- package/dist/docx/normalizeBaseDirection.js +81 -0
- package/dist/docx/notePropertiesParser.d.ts +16 -0
- package/dist/docx/notePropertiesParser.js +99 -0
- package/dist/docx/numberingParser.d.ts +86 -0
- package/dist/docx/numberingParser.js +735 -0
- package/dist/docx/numberingReferenceNormalization.d.ts +25 -0
- package/dist/docx/numberingReferenceNormalization.js +22 -0
- package/dist/docx/paragraphParser.d.ts +86 -0
- package/dist/docx/paragraphParser.js +1132 -0
- package/dist/docx/paragraphTraversal.d.ts +19 -0
- package/dist/docx/paragraphTraversal.js +76 -0
- package/dist/docx/parser.d.ts +67 -0
- package/dist/docx/parser.js +391 -0
- package/dist/docx/parserEnums.d.ts +45 -0
- package/dist/docx/parserEnums.js +70 -0
- package/dist/docx/relsParser.d.ts +160 -0
- package/dist/docx/relsParser.js +235 -0
- package/dist/docx/replyToComment.d.ts +29 -0
- package/dist/docx/replyToComment.js +73 -0
- package/dist/docx/rezip.d.ts +166 -0
- package/dist/docx/rezip.js +1194 -0
- package/dist/docx/runConsolidator.d.ts +57 -0
- package/dist/docx/runConsolidator.js +224 -0
- package/dist/docx/runParser.d.ts +78 -0
- package/dist/docx/runParser.js +661 -0
- package/dist/docx/sdtProperties.d.ts +15 -0
- package/dist/docx/sdtProperties.js +290 -0
- package/dist/docx/sdtPropertiesPatch.d.ts +16 -0
- package/dist/docx/sdtPropertiesPatch.js +144 -0
- package/dist/docx/sectionParser.d.ts +95 -0
- package/dist/docx/sectionParser.js +534 -0
- package/dist/docx/selectiveSave.d.ts +25 -0
- package/dist/docx/selectiveSave.js +247 -0
- package/dist/docx/selectiveSaveFlags.d.ts +33 -0
- package/dist/docx/selectiveSaveFlags.js +11 -0
- package/dist/docx/selectiveSaveTripwire.d.ts +33 -0
- package/dist/docx/selectiveSaveTripwire.js +79 -0
- package/dist/docx/selectiveXmlPatch.d.ts +103 -0
- package/dist/docx/selectiveXmlPatch.js +493 -0
- package/dist/docx/serializer/blockSdtSerializer.d.ts +6 -0
- package/dist/docx/serializer/blockSdtSerializer.js +88 -0
- package/dist/docx/serializer/borderSerializer.d.ts +25 -0
- package/dist/docx/serializer/borderSerializer.js +44 -0
- package/dist/docx/serializer/commentSerializer.d.ts +31 -0
- package/dist/docx/serializer/commentSerializer.js +184 -0
- package/dist/docx/serializer/documentSerializer.d.ts +65 -0
- package/dist/docx/serializer/documentSerializer.js +199 -0
- package/dist/docx/serializer/headerFooterSerializer.d.ts +12 -0
- package/dist/docx/serializer/headerFooterSerializer.js +84 -0
- package/dist/docx/serializer/noteSerializer.d.ts +19 -0
- package/dist/docx/serializer/noteSerializer.js +70 -0
- package/dist/docx/serializer/numberingSerializer.d.ts +12 -0
- package/dist/docx/serializer/numberingSerializer.js +93 -0
- package/dist/docx/serializer/paragraphSerializer.d.ts +48 -0
- package/dist/docx/serializer/paragraphSerializer.js +559 -0
- package/dist/docx/serializer/runSerializer.d.ts +56 -0
- package/dist/docx/serializer/runSerializer.js +621 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.d.ts +6 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +187 -0
- package/dist/docx/serializer/tableSerializer.d.ts +79 -0
- package/dist/docx/serializer/tableSerializer.js +422 -0
- package/dist/docx/serializer/xmlUtils.d.ts +20 -0
- package/dist/docx/serializer/xmlUtils.js +25 -0
- package/dist/docx/settingsParser.d.ts +8 -0
- package/dist/docx/settingsParser.js +36 -0
- package/dist/docx/shapeParser.d.ts +20 -0
- package/dist/docx/shapeParser.js +272 -0
- package/dist/docx/styleParser.d.ts +50 -0
- package/dist/docx/styleParser.js +905 -0
- package/dist/docx/tableParser.d.ts +202 -0
- package/dist/docx/tableParser.js +811 -0
- package/dist/docx/textBoxParser.d.ts +117 -0
- package/dist/docx/textBoxParser.js +262 -0
- package/dist/docx/themeParser.d.ts +77 -0
- package/dist/docx/themeParser.js +330 -0
- package/dist/docx/trackedMoveRangeNormalization.d.ts +22 -0
- package/dist/docx/trackedMoveRangeNormalization.js +100 -0
- package/dist/docx/unzip.d.ts +118 -0
- package/dist/docx/unzip.js +383 -0
- package/dist/docx/vmlImageParser.d.ts +16 -0
- package/dist/docx/vmlImageParser.js +100 -0
- package/dist/docx/watermarkParser.d.ts +45 -0
- package/dist/docx/watermarkParser.js +348 -0
- package/dist/docx/wrapTypes.d.ts +29 -0
- package/dist/docx/wrapTypes.js +48 -0
- package/dist/docx/xmlParser.d.ts +297 -0
- package/dist/docx/xmlParser.js +527 -0
- package/dist/fields/bookmarkPages.d.ts +13 -0
- package/dist/fields/bookmarkPages.js +66 -0
- package/dist/fields/bookmarkText.d.ts +16 -0
- package/dist/fields/bookmarkText.js +61 -0
- package/dist/fields/evaluateField.d.ts +23 -0
- package/dist/fields/evaluateField.js +77 -0
- package/dist/fields/fieldContext.d.ts +21 -0
- package/dist/fields/fieldContext.js +0 -0
- package/dist/fields/resolveFieldValues.d.ts +44 -0
- package/dist/fields/resolveFieldValues.js +204 -0
- package/dist/fields/sectionPageCounts.d.ts +11 -0
- package/dist/fields/sectionPageCounts.js +16 -0
- package/dist/fields/seqValues.d.ts +14 -0
- package/dist/fields/seqValues.js +36 -0
- package/dist/fonts/embeddedFontTable.d.ts +42 -0
- package/dist/fonts/embeddedFontTable.js +80 -0
- package/dist/fonts/embeddedFonts.d.ts +46 -0
- package/dist/fonts/embeddedFonts.js +112 -0
- package/dist/fonts/fontDeobfuscation.d.ts +30 -0
- package/dist/fonts/fontDeobfuscation.js +57 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +23 -0
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +57 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +316 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +74 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +432 -0
- package/dist/layout-bridge/convert/templatePreviewFlow.d.ts +36 -0
- package/dist/layout-bridge/convert/templatePreviewFlow.js +176 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +65 -0
- package/dist/layout-bridge/convert/toFlowBlocks.js +1309 -0
- package/dist/layout-bridge/convert/wrapEditorViewAsSurface.d.ts +17 -0
- package/dist/layout-bridge/convert/wrapEditorViewAsSurface.js +36 -0
- package/dist/layout-bridge/dom/clickToPositionDom.d.ts +66 -0
- package/dist/layout-bridge/dom/clickToPositionDom.js +304 -0
- package/dist/layout-bridge/dom/findBodyPmSpans.d.ts +7 -0
- package/dist/layout-bridge/dom/findBodyPmSpans.js +17 -0
- package/dist/layout-bridge/dom/findHfPmSpans.d.ts +62 -0
- package/dist/layout-bridge/dom/findHfPmSpans.js +197 -0
- package/dist/layout-bridge/engine/clickToPosition.d.ts +66 -0
- package/dist/layout-bridge/engine/clickToPosition.js +403 -0
- package/dist/layout-bridge/engine/hitTest.d.ts +135 -0
- package/dist/layout-bridge/engine/hitTest.js +375 -0
- package/dist/layout-bridge/engine/measuring/index.d.ts +10 -0
- package/dist/layout-bridge/engine/measuring/index.js +9 -0
- package/dist/layout-bridge/engine/selectionRects.d.ts +59 -0
- package/dist/layout-bridge/engine/selectionRects.js +485 -0
- package/dist/layout-bridge/engine/tableWidthUtils.d.ts +7 -0
- package/dist/layout-bridge/engine/tableWidthUtils.js +25 -0
- package/dist/layout-engine/index.d.ts +44 -0
- package/dist/layout-engine/index.js +691 -0
- package/dist/layout-engine/keep-together.d.ts +43 -0
- package/dist/layout-engine/keep-together.js +98 -0
- package/dist/layout-engine/layoutInstrumentation.d.ts +50 -0
- package/dist/layout-engine/layoutInstrumentation.js +43 -0
- package/dist/layout-engine/lineFlow.d.ts +8 -0
- package/dist/layout-engine/lineFlow.js +17 -0
- package/dist/layout-engine/measure/cache.d.ts +93 -0
- package/dist/layout-engine/measure/cache.js +245 -0
- package/dist/layout-engine/measure/clampFloatingWrapMargins.d.ts +20 -0
- package/dist/layout-engine/measure/clampFloatingWrapMargins.js +29 -0
- package/dist/layout-engine/measure/featureFlags.d.ts +44 -0
- package/dist/layout-engine/measure/featureFlags.js +19 -0
- package/dist/layout-engine/measure/floatingZones.d.ts +89 -0
- package/dist/layout-engine/measure/floatingZones.js +152 -0
- package/dist/layout-engine/measure/font-metrics.worker.d.ts +17 -0
- package/dist/layout-engine/measure/font-metrics.worker.js +104 -0
- package/dist/layout-engine/measure/index.d.ts +9 -0
- package/dist/layout-engine/measure/index.js +8 -0
- package/dist/layout-engine/measure/listMarkerWidth.d.ts +40 -0
- package/dist/layout-engine/measure/listMarkerWidth.js +76 -0
- package/dist/layout-engine/measure/measureBlocks.d.ts +25 -0
- package/dist/layout-engine/measure/measureBlocks.js +450 -0
- package/dist/layout-engine/measure/measureContainer.d.ts +24 -0
- package/dist/layout-engine/measure/measureContainer.js +280 -0
- package/dist/layout-engine/measure/measureHelpers.d.ts +82 -0
- package/dist/layout-engine/measure/measureHelpers.js +156 -0
- package/dist/layout-engine/measure/measureParagraph.d.ts +61 -0
- package/dist/layout-engine/measure/measureParagraph.js +724 -0
- package/dist/layout-engine/measure/measureProvider.d.ts +23 -0
- package/dist/layout-engine/measure/measureProvider.js +35 -0
- package/dist/layout-engine/measure/measureTypes.d.ts +61 -0
- package/dist/layout-engine/measure/measureTypes.js +0 -0
- package/dist/layout-engine/measure/measureWorker.d.ts +54 -0
- package/dist/layout-engine/measure/measureWorker.js +249 -0
- package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +88 -0
- package/dist/layout-engine/measure/measureWorkerProtocol.js +20 -0
- package/dist/layout-engine/measure/tableCellFloating.d.ts +26 -0
- package/dist/layout-engine/measure/tableCellFloating.js +99 -0
- package/dist/layout-engine/paginator.d.ts +84 -0
- package/dist/layout-engine/paginator.js +348 -0
- package/dist/layout-engine/paragraphFragmentRange.d.ts +9 -0
- package/dist/layout-engine/paragraphFragmentRange.js +40 -0
- package/dist/layout-engine/section-breaks.d.ts +78 -0
- package/dist/layout-engine/section-breaks.js +182 -0
- package/dist/layout-engine/tableRowBreak.d.ts +23 -0
- package/dist/layout-engine/tableRowBreak.js +147 -0
- package/dist/layout-engine/textBoxFlow.d.ts +50 -0
- package/dist/layout-engine/textBoxFlow.js +160 -0
- package/dist/layout-engine/types.d.ts +1031 -0
- package/dist/layout-engine/types.js +100 -0
- package/dist/layout-painter/documentColors.d.ts +4 -0
- package/dist/layout-painter/documentColors.js +40 -0
- package/dist/layout-painter/index.d.ts +110 -0
- package/dist/layout-painter/index.js +182 -0
- package/dist/layout-painter/registry/modules/image.d.ts +6 -0
- package/dist/layout-painter/registry/modules/image.js +17 -0
- package/dist/layout-painter/registry/modules/paragraph.d.ts +6 -0
- package/dist/layout-painter/registry/modules/paragraph.js +18 -0
- package/dist/layout-painter/registry/modules/table.d.ts +6 -0
- package/dist/layout-painter/registry/modules/table.js +16 -0
- package/dist/layout-painter/registry/modules/textBox.d.ts +6 -0
- package/dist/layout-painter/registry/modules/textBox.js +13 -0
- package/dist/layout-painter/registry/modules.d.ts +6 -0
- package/dist/layout-painter/registry/modules.js +26 -0
- package/dist/layout-painter/registry/registry.d.ts +24 -0
- package/dist/layout-painter/registry/registry.js +53 -0
- package/dist/layout-painter/registry/types.d.ts +61 -0
- package/dist/layout-painter/registry/types.js +0 -0
- package/dist/layout-painter/renderFragment.d.ts +32 -0
- package/dist/layout-painter/renderFragment.js +114 -0
- package/dist/layout-painter/renderImage.d.ts +88 -0
- package/dist/layout-painter/renderImage.js +130 -0
- package/dist/layout-painter/renderPage.d.ts +264 -0
- package/dist/layout-painter/renderPage.js +1795 -0
- package/dist/layout-painter/renderParagraph.d.ts +93 -0
- package/dist/layout-painter/renderParagraph.js +1300 -0
- package/dist/layout-painter/renderTable.d.ts +36 -0
- package/dist/layout-painter/renderTable.js +432 -0
- package/dist/layout-painter/renderTextBox.d.ts +22 -0
- package/dist/layout-painter/renderTextBox.js +67 -0
- package/dist/layout-painter/renderUtils.d.ts +42 -0
- package/dist/layout-painter/renderUtils.js +30 -0
- package/dist/layout-painter/renderWatermark.d.ts +16 -0
- package/dist/layout-painter/renderWatermark.js +61 -0
- package/dist/layout-painter/sdtBoundary.d.ts +6 -0
- package/dist/layout-painter/sdtBoundary.js +28 -0
- package/dist/managers/ContextMenuManager.d.ts +28 -0
- package/dist/managers/ContextMenuManager.js +48 -0
- package/dist/managers/DocumentLoaderManager.d.ts +47 -0
- package/dist/managers/DocumentLoaderManager.js +69 -0
- package/dist/managers/EditorModeManager.d.ts +28 -0
- package/dist/managers/EditorModeManager.js +50 -0
- package/dist/managers/ErrorManager.d.ts +26 -0
- package/dist/managers/ErrorManager.js +85 -0
- package/dist/managers/FindReplaceManager.d.ts +54 -0
- package/dist/managers/FindReplaceManager.js +104 -0
- package/dist/managers/HistoryManager.d.ts +92 -0
- package/dist/managers/HistoryManager.js +193 -0
- package/dist/managers/Subscribable.d.ts +34 -0
- package/dist/managers/Subscribable.js +46 -0
- package/dist/managers/TableSelectionManager.d.ts +74 -0
- package/dist/managers/TableSelectionManager.js +225 -0
- package/dist/managers/editorShortcuts.d.ts +42 -0
- package/dist/managers/editorShortcuts.js +60 -0
- package/dist/managers/types.d.ts +41 -0
- package/dist/managers/types.js +0 -0
- package/dist/markdown/annotations.d.ts +14 -0
- package/dist/markdown/annotations.js +42 -0
- package/dist/markdown/escape.d.ts +36 -0
- package/dist/markdown/escape.js +59 -0
- package/dist/markdown/fromMarkdown.d.ts +11 -0
- package/dist/markdown/fromMarkdown.js +223 -0
- package/dist/markdown/headings.d.ts +13 -0
- package/dist/markdown/headings.js +20 -0
- package/dist/markdown/images.d.ts +13 -0
- package/dist/markdown/images.js +63 -0
- package/dist/markdown/index.d.ts +18 -0
- package/dist/markdown/index.js +33 -0
- package/dist/markdown/internals.d.ts +15 -0
- package/dist/markdown/internals.js +35 -0
- package/dist/markdown/renderBlock.d.ts +7 -0
- package/dist/markdown/renderBlock.js +68 -0
- package/dist/markdown/renderParagraph.d.ts +11 -0
- package/dist/markdown/renderParagraph.js +64 -0
- package/dist/markdown/renderRuns.d.ts +11 -0
- package/dist/markdown/renderRuns.js +265 -0
- package/dist/markdown/renderTable.d.ts +8 -0
- package/dist/markdown/renderTable.js +229 -0
- package/dist/markdown/trailers.d.ts +13 -0
- package/dist/markdown/trailers.js +54 -0
- package/dist/markdown/types.d.ts +118 -0
- package/dist/markdown/types.js +0 -0
- package/dist/model.d.ts +13 -0
- package/dist/model.js +4 -0
- package/dist/paged-layout/LayoutSelectionGate.d.ts +80 -0
- package/dist/paged-layout/LayoutSelectionGate.js +131 -0
- package/dist/paged-layout/headerFooterMargins.d.ts +73 -0
- package/dist/paged-layout/headerFooterMargins.js +120 -0
- package/dist/paged-layout/hiddenEditorScroll.d.ts +4 -0
- package/dist/paged-layout/hiddenEditorScroll.js +4 -0
- package/dist/paged-layout/incrementalMeasure.d.ts +33 -0
- package/dist/paged-layout/incrementalMeasure.js +56 -0
- package/dist/paged-layout/rangeProjection.d.ts +51 -0
- package/dist/paged-layout/rangeProjection.js +153 -0
- package/dist/paged-layout/readOnlyEditAttempt.d.ts +5 -0
- package/dist/paged-layout/readOnlyEditAttempt.js +22 -0
- package/dist/paged-layout/scrollNavigation.d.ts +23 -0
- package/dist/paged-layout/scrollNavigation.js +31 -0
- package/dist/paged-layout/scrollPageInfo.d.ts +41 -0
- package/dist/paged-layout/scrollPageInfo.js +34 -0
- package/dist/paged-layout/scrollToPmPosition.d.ts +17 -0
- package/dist/paged-layout/scrollToPmPosition.js +95 -0
- package/dist/paged-layout/sectionBlockWidths.d.ts +35 -0
- package/dist/paged-layout/sectionBlockWidths.js +52 -0
- package/dist/paged-layout/sectionGeometry.d.ts +21 -0
- package/dist/paged-layout/sectionGeometry.js +36 -0
- package/dist/paged-layout/selectionViewportRect.d.ts +29 -0
- package/dist/paged-layout/selectionViewportRect.js +55 -0
- package/dist/paged-layout/tableColumnResize.d.ts +19 -0
- package/dist/paged-layout/tableColumnResize.js +28 -0
- package/dist/paged-layout/tableInsertButtonGeometry.d.ts +15 -0
- package/dist/paged-layout/tableInsertButtonGeometry.js +15 -0
- package/dist/paged-layout/transactionDirtyRange.d.ts +7 -0
- package/dist/paged-layout/transactionDirtyRange.js +27 -0
- package/dist/paged-layout/zoomScrollAnchor.d.ts +40 -0
- package/dist/paged-layout/zoomScrollAnchor.js +25 -0
- package/dist/prosemirror/attrs/index.d.ts +80 -0
- package/dist/prosemirror/attrs/index.js +1218 -0
- package/dist/prosemirror/autospacingBase.d.ts +11 -0
- package/dist/prosemirror/autospacingBase.js +16 -0
- package/dist/prosemirror/commands/comments.d.ts +93 -0
- package/dist/prosemirror/commands/comments.js +435 -0
- package/dist/prosemirror/commands/contentControls.d.ts +45 -0
- package/dist/prosemirror/commands/contentControls.js +294 -0
- package/dist/prosemirror/commands/contentControlsBlockFill.d.ts +15 -0
- package/dist/prosemirror/commands/contentControlsBlockFill.js +19 -0
- package/dist/prosemirror/commands/formatPainter.d.ts +31 -0
- package/dist/prosemirror/commands/formatPainter.js +130 -0
- package/dist/prosemirror/commands/formatting.d.ts +32 -0
- package/dist/prosemirror/commands/formatting.js +45 -0
- package/dist/prosemirror/commands/hyperlink.d.ts +31 -0
- package/dist/prosemirror/commands/hyperlink.js +79 -0
- package/dist/prosemirror/commands/image.d.ts +59 -0
- package/dist/prosemirror/commands/image.js +219 -0
- package/dist/prosemirror/commands/index.d.ts +13 -0
- package/dist/prosemirror/commands/index.js +13 -0
- package/dist/prosemirror/commands/pageBreak.d.ts +10 -0
- package/dist/prosemirror/commands/pageBreak.js +47 -0
- package/dist/prosemirror/commands/paragraph.d.ts +39 -0
- package/dist/prosemirror/commands/paragraph.js +64 -0
- package/dist/prosemirror/commands/pastePlainText.d.ts +39 -0
- package/dist/prosemirror/commands/pastePlainText.js +67 -0
- package/dist/prosemirror/commands/table.d.ts +83 -0
- package/dist/prosemirror/commands/table.js +105 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +27 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +1550 -0
- package/dist/prosemirror/conversion/index.d.ts +4 -0
- package/dist/prosemirror/conversion/index.js +4 -0
- package/dist/prosemirror/conversion/runShadingMark.d.ts +16 -0
- package/dist/prosemirror/conversion/runShadingMark.js +39 -0
- package/dist/prosemirror/conversion/toProseDoc.d.ts +39 -0
- package/dist/prosemirror/conversion/toProseDoc.js +1404 -0
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +43 -0
- package/dist/prosemirror/extensions/ExtensionManager.js +86 -0
- package/dist/prosemirror/extensions/StarterKit.d.ts +16 -0
- package/dist/prosemirror/extensions/StarterKit.js +132 -0
- package/dist/prosemirror/extensions/core/DocExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/core/DocExtension.js +12 -0
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/core/HistoryExtension.js +28 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +25 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +619 -0
- package/dist/prosemirror/extensions/core/TextExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/core/TextExtension.js +12 -0
- package/dist/prosemirror/extensions/create.d.ts +17 -0
- package/dist/prosemirror/extensions/create.js +129 -0
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +23 -0
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +106 -0
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.d.ts +8 -0
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +172 -0
- package/dist/prosemirror/extensions/features/BidiShortcutExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/features/BidiShortcutExtension.js +38 -0
- package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.js +21 -0
- package/dist/prosemirror/extensions/features/DropCursorExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/features/DropCursorExtension.js +20 -0
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.d.ts +8 -0
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +44 -0
- package/dist/prosemirror/extensions/features/GapCursorExtension.d.ts +19 -0
- package/dist/prosemirror/extensions/features/GapCursorExtension.js +24 -0
- package/dist/prosemirror/extensions/features/ImageDragExtension.d.ts +15 -0
- package/dist/prosemirror/extensions/features/ImageDragExtension.js +66 -0
- package/dist/prosemirror/extensions/features/ImagePasteExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +91 -0
- package/dist/prosemirror/extensions/features/ListExtension.d.ts +14 -0
- package/dist/prosemirror/extensions/features/ListExtension.js +340 -0
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +60 -0
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +35 -0
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +188 -0
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +20 -0
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +34 -0
- package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.d.ts +20 -0
- package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.js +145 -0
- package/dist/prosemirror/extensions/features/SelectionTrackerExtension.d.ts +10 -0
- package/dist/prosemirror/extensions/features/SelectionTrackerExtension.js +17 -0
- package/dist/prosemirror/extensions/features/bidiShortcutController.d.ts +31 -0
- package/dist/prosemirror/extensions/features/bidiShortcutController.js +27 -0
- package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +31 -0
- package/dist/prosemirror/extensions/features/pasteCleanup.js +159 -0
- package/dist/prosemirror/extensions/marks/AllCapsExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/AllCapsExtension.js +24 -0
- package/dist/prosemirror/extensions/marks/BoldExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/BoldExtension.js +41 -0
- package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.d.ts +14 -0
- package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.js +64 -0
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +23 -0
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.js +47 -0
- package/dist/prosemirror/extensions/marks/CommentExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/marks/CommentExtension.js +38 -0
- package/dist/prosemirror/extensions/marks/FontFamilyExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/FontFamilyExtension.js +55 -0
- package/dist/prosemirror/extensions/marks/FontSizeExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/FontSizeExtension.js +47 -0
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +92 -0
- package/dist/prosemirror/extensions/marks/HiddenTextExtension.d.ts +23 -0
- package/dist/prosemirror/extensions/marks/HiddenTextExtension.js +35 -0
- package/dist/prosemirror/extensions/marks/HighlightExtension.d.ts +10 -0
- package/dist/prosemirror/extensions/marks/HighlightExtension.js +115 -0
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +146 -0
- package/dist/prosemirror/extensions/marks/ItalicExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/ItalicExtension.js +34 -0
- package/dist/prosemirror/extensions/marks/RtlExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/marks/RtlExtension.js +21 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +75 -0
- package/dist/prosemirror/extensions/marks/RunShadingExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/marks/RunShadingExtension.js +38 -0
- package/dist/prosemirror/extensions/marks/SmallCapsExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/SmallCapsExtension.js +24 -0
- package/dist/prosemirror/extensions/marks/StrikeExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/StrikeExtension.js +33 -0
- package/dist/prosemirror/extensions/marks/SubscriptExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/SubscriptExtension.js +25 -0
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.js +25 -0
- package/dist/prosemirror/extensions/marks/TextColorExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/TextColorExtension.js +50 -0
- package/dist/prosemirror/extensions/marks/TextEffectExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/marks/TextEffectExtension.js +35 -0
- package/dist/prosemirror/extensions/marks/TextEffectsExtensions.d.ts +31 -0
- package/dist/prosemirror/extensions/marks/TextEffectsExtensions.js +134 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +22 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +113 -0
- package/dist/prosemirror/extensions/marks/UnderlineExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +60 -0
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +34 -0
- package/dist/prosemirror/extensions/marks/markUtils.js +233 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +22 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +122 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +87 -0
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.js +38 -0
- package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.js +18 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +132 -0
- package/dist/prosemirror/extensions/nodes/MathExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/nodes/MathExtension.js +56 -0
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.js +20 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.js +107 -0
- package/dist/prosemirror/extensions/nodes/ShapeExtension.d.ts +30 -0
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +502 -0
- package/dist/prosemirror/extensions/nodes/TabExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/TabExtension.js +27 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +34 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +1972 -0
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +34 -0
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +150 -0
- package/dist/prosemirror/extensions/types.d.ts +101 -0
- package/dist/prosemirror/extensions/types.js +10 -0
- package/dist/prosemirror/findReplaceSelection.d.ts +23 -0
- package/dist/prosemirror/findReplaceSelection.js +86 -0
- package/dist/prosemirror/index.d.ts +25 -0
- package/dist/prosemirror/index.js +23 -0
- package/dist/prosemirror/insertOperations.d.ts +12 -0
- package/dist/prosemirror/insertOperations.js +19 -0
- package/dist/prosemirror/paragraphDirection.d.ts +42 -0
- package/dist/prosemirror/paragraphDirection.js +33 -0
- package/dist/prosemirror/plugins/aiCitationDecorations.d.ts +40 -0
- package/dist/prosemirror/plugins/aiCitationDecorations.js +90 -0
- package/dist/prosemirror/plugins/aiSuggestionDecorations.d.ts +42 -0
- package/dist/prosemirror/plugins/aiSuggestionDecorations.js +135 -0
- package/dist/prosemirror/plugins/anonymizationDecorations.d.ts +60 -0
- package/dist/prosemirror/plugins/anonymizationDecorations.js +120 -0
- package/dist/prosemirror/plugins/autocompleteSuggestion.d.ts +123 -0
- package/dist/prosemirror/plugins/autocompleteSuggestion.js +283 -0
- package/dist/prosemirror/plugins/contentControlWidgets.d.ts +56 -0
- package/dist/prosemirror/plugins/contentControlWidgets.js +192 -0
- package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +37 -0
- package/dist/prosemirror/plugins/createDocScanPlugin.js +55 -0
- package/dist/prosemirror/plugins/documentStyles.d.ts +18 -0
- package/dist/prosemirror/plugins/documentStyles.js +46 -0
- package/dist/prosemirror/plugins/index.d.ts +3 -0
- package/dist/prosemirror/plugins/index.js +3 -0
- package/dist/prosemirror/plugins/pmTextScan.d.ts +19 -0
- package/dist/prosemirror/plugins/pmTextScan.js +39 -0
- package/dist/prosemirror/plugins/selectionTracker.d.ts +43 -0
- package/dist/prosemirror/plugins/selectionTracker.js +179 -0
- package/dist/prosemirror/plugins/suggestionMode.d.ts +70 -0
- package/dist/prosemirror/plugins/suggestionMode.js +489 -0
- package/dist/prosemirror/plugins/templateDirectives.d.ts +25 -0
- package/dist/prosemirror/plugins/templateDirectives.js +67 -0
- package/dist/prosemirror/plugins/templatePreviewValues.d.ts +49 -0
- package/dist/prosemirror/plugins/templatePreviewValues.js +117 -0
- package/dist/prosemirror/plugins/templateSlashMenu.d.ts +57 -0
- package/dist/prosemirror/plugins/templateSlashMenu.js +184 -0
- package/dist/prosemirror/schema/index.d.ts +15 -0
- package/dist/prosemirror/schema/index.js +20 -0
- package/dist/prosemirror/schema/marks.d.ts +118 -0
- package/dist/prosemirror/schema/marks.js +0 -0
- package/dist/prosemirror/schema/nodes.d.ts +389 -0
- package/dist/prosemirror/schema/nodes.js +0 -0
- package/dist/prosemirror/selectionState.d.ts +23 -0
- package/dist/prosemirror/selectionState.js +111 -0
- package/dist/prosemirror/styles/index.d.ts +2 -0
- package/dist/prosemirror/styles/index.js +2 -0
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +32 -0
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +108 -0
- package/dist/prosemirror/styles/styleResolver.d.ts +94 -0
- package/dist/prosemirror/styles/styleResolver.js +200 -0
- package/dist/prosemirror/utils/findParagraphByParaId.d.ts +26 -0
- package/dist/prosemirror/utils/findParagraphByParaId.js +37 -0
- package/dist/prosemirror/utils/tabCalculator.d.ts +110 -0
- package/dist/prosemirror/utils/tabCalculator.js +137 -0
- package/dist/prosemirror/validation.d.ts +20 -0
- package/dist/prosemirror/validation.js +177 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +6 -0
- package/dist/style-engine/index.d.ts +3 -0
- package/dist/style-engine/index.js +2 -0
- package/dist/style-engine/styleEngine.d.ts +67 -0
- package/dist/style-engine/styleEngine.js +70 -0
- package/dist/types/block-id.d.ts +66 -0
- package/dist/types/block-id.js +73 -0
- package/dist/types/colors.d.ts +2 -0
- package/dist/types/colors.js +0 -0
- package/dist/types/content.d.ts +2 -0
- package/dist/types/content.js +0 -0
- package/dist/types/document.d.ts +7 -0
- package/dist/types/document.js +0 -0
- package/dist/types/documentEnumValues.d.ts +89 -0
- package/dist/types/documentEnumValues.js +693 -0
- package/dist/types/formatting.d.ts +2 -0
- package/dist/types/formatting.js +0 -0
- package/dist/types/index.d.ts +107 -0
- package/dist/types/index.js +0 -0
- package/dist/utils/authorColors.d.ts +16 -0
- package/dist/utils/authorColors.js +30 -0
- package/dist/utils/baseDirection.d.ts +23 -0
- package/dist/utils/baseDirection.js +34 -0
- package/dist/utils/clipboard.d.ts +126 -0
- package/dist/utils/clipboard.js +622 -0
- package/dist/utils/colorResolver.d.ts +158 -0
- package/dist/utils/colorResolver.js +557 -0
- package/dist/utils/createDocument.d.ts +50 -0
- package/dist/utils/createDocument.js +262 -0
- package/dist/utils/documentLoaderBehavior.d.ts +22 -0
- package/dist/utils/documentLoaderBehavior.js +14 -0
- package/dist/utils/docxInput.d.ts +22 -0
- package/dist/utils/docxInput.js +16 -0
- package/dist/utils/domGuards.d.ts +59 -0
- package/dist/utils/domGuards.js +82 -0
- package/dist/utils/fontFamilyMerge.d.ts +7 -0
- package/dist/utils/fontFamilyMerge.js +31 -0
- package/dist/utils/fontLoader.d.ts +50 -0
- package/dist/utils/fontLoader.js +177 -0
- package/dist/utils/fontResolver.d.ts +61 -0
- package/dist/utils/fontResolver.js +651 -0
- package/dist/utils/fontWeights.d.ts +4 -0
- package/dist/utils/fontWeights.js +4 -0
- package/dist/utils/formatToStyle.d.ts +103 -0
- package/dist/utils/formatToStyle.js +289 -0
- package/dist/utils/headerFooter.d.ts +74 -0
- package/dist/utils/headerFooter.js +257 -0
- package/dist/utils/headingCollector.d.ts +22 -0
- package/dist/utils/headingCollector.js +36 -0
- package/dist/utils/hexId.d.ts +33 -0
- package/dist/utils/hexId.js +37 -0
- package/dist/utils/imageValidation.d.ts +5 -0
- package/dist/utils/imageValidation.js +31 -0
- package/dist/utils/paragraphFormattingMerge.d.ts +14 -0
- package/dist/utils/paragraphFormattingMerge.js +68 -0
- package/dist/utils/replaceText.d.ts +17 -0
- package/dist/utils/replaceText.js +161 -0
- package/dist/utils/rotationBoundingBox.d.ts +12 -0
- package/dist/utils/rotationBoundingBox.js +36 -0
- package/dist/utils/scriptSegments.d.ts +36 -0
- package/dist/utils/scriptSegments.js +52 -0
- package/dist/utils/tableOperations.d.ts +87 -0
- package/dist/utils/tableOperations.js +259 -0
- package/dist/utils/textFormattingMerge.d.ts +6 -0
- package/dist/utils/textFormattingMerge.js +31 -0
- package/dist/utils/tiffConverter.d.ts +18 -0
- package/dist/utils/tiffConverter.js +83 -0
- package/dist/utils/units.d.ts +99 -0
- package/dist/utils/units.js +139 -0
- package/dist/utils/urlSecurity.d.ts +7 -0
- package/dist/utils/urlSecurity.js +65 -0
- package/dist/watermark/index.d.ts +39 -0
- package/dist/watermark/index.js +149 -0
- package/package.json +122 -2
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { expectHyperlinkMarkAttrs } from "../attrs/index.js";
|
|
2
|
+
//#region src/prosemirror/commands/hyperlink.ts
|
|
3
|
+
const hyperlinkHref = (mark) => expectHyperlinkMarkAttrs(mark).href;
|
|
4
|
+
/**
|
|
5
|
+
* Contiguous ranges of text nodes in `parent` (starting at `parentStart`) that
|
|
6
|
+
* carry a hyperlink mark with the given `href`.
|
|
7
|
+
*/
|
|
8
|
+
const collectHyperlinkRanges = (parent, parentStart, hlType, href) => {
|
|
9
|
+
const ranges = [];
|
|
10
|
+
let current = null;
|
|
11
|
+
parent.forEach((node, offset) => {
|
|
12
|
+
const nodeStart = parentStart + offset;
|
|
13
|
+
const nodeEnd = nodeStart + node.nodeSize;
|
|
14
|
+
if (node.isText ? node.marks.some((m) => m.type === hlType && hyperlinkHref(m) === href) : false) if (current) current.end = nodeEnd;
|
|
15
|
+
else current = {
|
|
16
|
+
start: nodeStart,
|
|
17
|
+
end: nodeEnd
|
|
18
|
+
};
|
|
19
|
+
else if (current) {
|
|
20
|
+
ranges.push(current);
|
|
21
|
+
current = null;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if (current) ranges.push(current);
|
|
25
|
+
return ranges;
|
|
26
|
+
};
|
|
27
|
+
const rangeAtCursor = (ranges, cursorPos) => ranges.find((range) => range.start <= cursorPos && cursorPos <= range.end);
|
|
28
|
+
/**
|
|
29
|
+
* Replace the text and href of the hyperlink at the cursor.
|
|
30
|
+
*
|
|
31
|
+
* Returns whether the adapter should close the popup and refocus the editor:
|
|
32
|
+
* true after a successful edit and when the schema has no hyperlink behaviour
|
|
33
|
+
* to act on at the cursor; false only when a hyperlink mark is present but no
|
|
34
|
+
* contiguous range contains the cursor (the original's silent bail).
|
|
35
|
+
*/
|
|
36
|
+
const editHyperlinkAtCursor = (view, { displayText, href }) => {
|
|
37
|
+
const hlType = view.state.schema.marks["hyperlink"];
|
|
38
|
+
if (!hlType) return false;
|
|
39
|
+
const { $from } = view.state.selection;
|
|
40
|
+
const linkMark = $from.marks().find((m) => m.type === hlType);
|
|
41
|
+
if (!linkMark) return true;
|
|
42
|
+
const targetRange = rangeAtCursor(collectHyperlinkRanges($from.parent, $from.start(), hlType, hyperlinkHref(linkMark)), $from.pos);
|
|
43
|
+
if (!targetRange) return false;
|
|
44
|
+
const { tooltip } = expectHyperlinkMarkAttrs(linkMark);
|
|
45
|
+
const newMark = hlType.create({
|
|
46
|
+
href,
|
|
47
|
+
tooltip
|
|
48
|
+
});
|
|
49
|
+
const textNode = view.state.schema.text(displayText, [...$from.marks().filter((m) => m.type !== hlType), newMark]);
|
|
50
|
+
const tr = view.state.tr.replaceWith(targetRange.start, targetRange.end, textNode);
|
|
51
|
+
view.dispatch(tr.scrollIntoView());
|
|
52
|
+
return true;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Remove the hyperlink mark from the contiguous run at the cursor. Returns
|
|
56
|
+
* whether a link was actually removed (so the adapter can toast + refocus).
|
|
57
|
+
*/
|
|
58
|
+
const removeHyperlinkAtCursor = (view, { popupHref }) => {
|
|
59
|
+
const hlType = view.state.schema.marks["hyperlink"];
|
|
60
|
+
if (!hlType) return false;
|
|
61
|
+
const { $from } = view.state.selection;
|
|
62
|
+
let linkMark = $from.marks().find((m) => m.type === hlType);
|
|
63
|
+
if (!linkMark && $from.nodeAfter) linkMark = $from.nodeAfter.marks.find((m) => m.type === hlType);
|
|
64
|
+
if (!linkMark && $from.nodeBefore) linkMark = $from.nodeBefore.marks.find((m) => m.type === hlType);
|
|
65
|
+
if (!linkMark && popupHref !== void 0) $from.parent.forEach((node) => {
|
|
66
|
+
if (!linkMark && node.isText) {
|
|
67
|
+
const found = node.marks.find((m) => m.type === hlType && hyperlinkHref(m) === popupHref);
|
|
68
|
+
if (found) linkMark = found;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
if (!linkMark) return false;
|
|
72
|
+
const targetRange = rangeAtCursor(collectHyperlinkRanges($from.parent, $from.start(), hlType, hyperlinkHref(linkMark)), $from.pos);
|
|
73
|
+
if (!targetRange) return false;
|
|
74
|
+
const tr = view.state.tr.removeMark(targetRange.start, targetRange.end, hlType);
|
|
75
|
+
view.dispatch(tr.scrollIntoView());
|
|
76
|
+
return true;
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { editHyperlinkAtCursor, removeHyperlinkAtCursor };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ImageAttrs, ImagePositionAttrs } from "../schema/nodes.js";
|
|
2
|
+
import { EditorView } from "prosemirror-view";
|
|
3
|
+
|
|
4
|
+
//#region src/prosemirror/commands/image.d.ts
|
|
5
|
+
type ImagePositionInput = {
|
|
6
|
+
horizontal?: {
|
|
7
|
+
relativeTo?: string;
|
|
8
|
+
posOffset?: number;
|
|
9
|
+
align?: string;
|
|
10
|
+
};
|
|
11
|
+
vertical?: {
|
|
12
|
+
relativeTo?: string;
|
|
13
|
+
posOffset?: number;
|
|
14
|
+
align?: string;
|
|
15
|
+
};
|
|
16
|
+
distTop?: number;
|
|
17
|
+
distBottom?: number;
|
|
18
|
+
distLeft?: number;
|
|
19
|
+
distRight?: number;
|
|
20
|
+
};
|
|
21
|
+
type ImagePropertiesInput = {
|
|
22
|
+
alt?: string;
|
|
23
|
+
borderWidth?: number;
|
|
24
|
+
borderColor?: string;
|
|
25
|
+
borderStyle?: string;
|
|
26
|
+
};
|
|
27
|
+
type ImageTransformAction = "rotateCW" | "rotateCCW" | "flipH" | "flipV";
|
|
28
|
+
type ResolvedImageWrap = {
|
|
29
|
+
wrapType: ImageAttrs["wrapType"];
|
|
30
|
+
displayMode: ImageAttrs["displayMode"];
|
|
31
|
+
cssFloat: ImageAttrs["cssFloat"];
|
|
32
|
+
};
|
|
33
|
+
/** Map a toolbar wrap selection to the image's wrapType/displayMode/cssFloat, or null when unknown. */
|
|
34
|
+
declare const resolveImageWrap: (wrapType: string) => ResolvedImageWrap | null;
|
|
35
|
+
/** The CSS transform after applying a rotate/flip action to the current transform string. */
|
|
36
|
+
declare const computeImageTransform: (currentTransform: string, action: ImageTransformAction) => string | undefined;
|
|
37
|
+
declare const normalizeImageHorizontalPosition: (data: ImagePositionInput["horizontal"]) => ImagePositionAttrs["horizontal"] | undefined;
|
|
38
|
+
declare const normalizeImageVerticalPosition: (data: ImagePositionInput["vertical"]) => ImagePositionAttrs["vertical"] | undefined;
|
|
39
|
+
/** Clamp an image's intrinsic size to the page text width, preserving aspect ratio. */
|
|
40
|
+
declare const constrainImageSize: (width: number, height: number) => {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
/** Change the wrap mode of the image at `pos`. Returns whether it applied. */
|
|
45
|
+
declare const applyImageWrapType: (view: EditorView, pos: number, wrapType: string) => boolean;
|
|
46
|
+
/** Rotate or flip the image at `pos`. Returns whether it applied. */
|
|
47
|
+
declare const applyImageTransform: (view: EditorView, pos: number, action: ImageTransformAction) => boolean;
|
|
48
|
+
/** Apply position + text-wrap distances to the image at `pos`. Returns whether it applied. */
|
|
49
|
+
declare const applyImagePosition: (view: EditorView, pos: number, data: ImagePositionInput) => boolean;
|
|
50
|
+
/** Apply alt text + border properties to the image at `pos`. Returns whether it applied. */
|
|
51
|
+
declare const applyImageProperties: (view: EditorView, pos: number, data: ImagePropertiesInput) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Read an image file, then insert a constrained inline image node at the
|
|
54
|
+
* current selection. `onInserted` runs after the image is dispatched. No-ops
|
|
55
|
+
* when the file fails validation or the schema has no image node.
|
|
56
|
+
*/
|
|
57
|
+
declare const insertImageFromFile: (view: EditorView, file: File, onInserted: () => void) => Promise<void>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { ImagePositionInput, ImagePropertiesInput, ImageTransformAction, applyImagePosition, applyImageProperties, applyImageTransform, applyImageWrapType, computeImageTransform, constrainImageSize, insertImageFromFile, normalizeImageHorizontalPosition, normalizeImageVerticalPosition, resolveImageWrap };
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES } from "../../types/documentEnumValues.js";
|
|
2
|
+
import { expectImageAttrs, mergeImageAttrs } from "../attrs/index.js";
|
|
3
|
+
import { isSafeImageFile } from "../../utils/imageValidation.js";
|
|
4
|
+
//#region src/prosemirror/commands/image.ts
|
|
5
|
+
/** Map a toolbar wrap selection to the image's wrapType/displayMode/cssFloat, or null when unknown. */
|
|
6
|
+
const resolveImageWrap = (wrapType) => {
|
|
7
|
+
switch (wrapType) {
|
|
8
|
+
case "inline": return {
|
|
9
|
+
wrapType: "inline",
|
|
10
|
+
displayMode: "inline",
|
|
11
|
+
cssFloat: void 0
|
|
12
|
+
};
|
|
13
|
+
case "square":
|
|
14
|
+
case "tight":
|
|
15
|
+
case "through": return {
|
|
16
|
+
wrapType,
|
|
17
|
+
displayMode: "float",
|
|
18
|
+
cssFloat: "left"
|
|
19
|
+
};
|
|
20
|
+
case "topAndBottom": return {
|
|
21
|
+
wrapType: "topAndBottom",
|
|
22
|
+
displayMode: "block",
|
|
23
|
+
cssFloat: void 0
|
|
24
|
+
};
|
|
25
|
+
case "behind":
|
|
26
|
+
case "inFront": return {
|
|
27
|
+
wrapType,
|
|
28
|
+
displayMode: "float",
|
|
29
|
+
cssFloat: "none"
|
|
30
|
+
};
|
|
31
|
+
case "wrapLeft": return {
|
|
32
|
+
wrapType: "square",
|
|
33
|
+
displayMode: "float",
|
|
34
|
+
cssFloat: "right"
|
|
35
|
+
};
|
|
36
|
+
case "wrapRight": return {
|
|
37
|
+
wrapType: "square",
|
|
38
|
+
displayMode: "float",
|
|
39
|
+
cssFloat: "left"
|
|
40
|
+
};
|
|
41
|
+
default: return null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/** The CSS transform after applying a rotate/flip action to the current transform string. */
|
|
45
|
+
const computeImageTransform = (currentTransform, action) => {
|
|
46
|
+
const rotateMatch = /rotate\((?<degrees>-?\d+(?:\.\d+)?)deg\)/u.exec(currentTransform);
|
|
47
|
+
let rotation = rotateMatch ? Number.parseFloat(rotateMatch.groups["degrees"]) : 0;
|
|
48
|
+
let hasFlipH = currentTransform.includes("scaleX(-1)");
|
|
49
|
+
let hasFlipV = currentTransform.includes("scaleY(-1)");
|
|
50
|
+
switch (action) {
|
|
51
|
+
case "rotateCW":
|
|
52
|
+
rotation = (rotation + 90) % 360;
|
|
53
|
+
break;
|
|
54
|
+
case "rotateCCW":
|
|
55
|
+
rotation = (rotation - 90 + 360) % 360;
|
|
56
|
+
break;
|
|
57
|
+
case "flipH":
|
|
58
|
+
hasFlipH = !hasFlipH;
|
|
59
|
+
break;
|
|
60
|
+
case "flipV":
|
|
61
|
+
hasFlipV = !hasFlipV;
|
|
62
|
+
break;
|
|
63
|
+
default: break;
|
|
64
|
+
}
|
|
65
|
+
const parts = [];
|
|
66
|
+
if (rotation !== 0) parts.push(`rotate(${rotation}deg)`);
|
|
67
|
+
if (hasFlipH) parts.push("scaleX(-1)");
|
|
68
|
+
if (hasFlipV) parts.push("scaleY(-1)");
|
|
69
|
+
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
70
|
+
};
|
|
71
|
+
const isOneOf = (value, values) => value !== void 0 && values.some((allowed) => allowed === value);
|
|
72
|
+
const normalizeImageHorizontalPosition = (data) => {
|
|
73
|
+
if (!data) return;
|
|
74
|
+
if (!isOneOf(data.relativeTo, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES)) return;
|
|
75
|
+
const align = isOneOf(data.align, IMAGE_HORIZONTAL_ALIGNMENT_VALUES) ? data.align : void 0;
|
|
76
|
+
return {
|
|
77
|
+
relativeTo: data.relativeTo,
|
|
78
|
+
...typeof data.posOffset === "number" ? { posOffset: data.posOffset } : {},
|
|
79
|
+
...align ? { align } : {}
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const normalizeImageVerticalPosition = (data) => {
|
|
83
|
+
if (!data) return;
|
|
84
|
+
if (!isOneOf(data.relativeTo, IMAGE_VERTICAL_RELATIVE_TO_VALUES)) return;
|
|
85
|
+
const align = isOneOf(data.align, IMAGE_VERTICAL_ALIGNMENT_VALUES) ? data.align : void 0;
|
|
86
|
+
return {
|
|
87
|
+
relativeTo: data.relativeTo,
|
|
88
|
+
...typeof data.posOffset === "number" ? { posOffset: data.posOffset } : {},
|
|
89
|
+
...align ? { align } : {}
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
/** Clamp an image's intrinsic size to the page text width, preserving aspect ratio. */
|
|
93
|
+
const constrainImageSize = (width, height) => {
|
|
94
|
+
const maxWidth = 612;
|
|
95
|
+
if (width <= maxWidth) return {
|
|
96
|
+
width,
|
|
97
|
+
height
|
|
98
|
+
};
|
|
99
|
+
const scale = maxWidth / width;
|
|
100
|
+
return {
|
|
101
|
+
width: maxWidth,
|
|
102
|
+
height: Math.max(1, Math.round(height * scale))
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
const imageNodeAt = (view, pos) => {
|
|
106
|
+
const node = view.state.doc.nodeAt(pos);
|
|
107
|
+
return node && node.type.name === "image" ? node : null;
|
|
108
|
+
};
|
|
109
|
+
/** Change the wrap mode of the image at `pos`. Returns whether it applied. */
|
|
110
|
+
const applyImageWrapType = (view, pos, wrapType) => {
|
|
111
|
+
const node = imageNodeAt(view, pos);
|
|
112
|
+
if (!node) return false;
|
|
113
|
+
const resolved = resolveImageWrap(wrapType);
|
|
114
|
+
if (!resolved) return false;
|
|
115
|
+
const tr = view.state.tr.setNodeMarkup(pos, void 0, mergeImageAttrs(node, {
|
|
116
|
+
wrapType: resolved.wrapType,
|
|
117
|
+
displayMode: resolved.displayMode,
|
|
118
|
+
cssFloat: resolved.cssFloat
|
|
119
|
+
}));
|
|
120
|
+
view.dispatch(tr.scrollIntoView());
|
|
121
|
+
return true;
|
|
122
|
+
};
|
|
123
|
+
/** Rotate or flip the image at `pos`. Returns whether it applied. */
|
|
124
|
+
const applyImageTransform = (view, pos, action) => {
|
|
125
|
+
const node = imageNodeAt(view, pos);
|
|
126
|
+
if (!node) return false;
|
|
127
|
+
const transform = computeImageTransform(expectImageAttrs(node).transform ?? "", action);
|
|
128
|
+
const tr = view.state.tr.setNodeMarkup(pos, void 0, mergeImageAttrs(node, { transform }));
|
|
129
|
+
view.dispatch(tr.scrollIntoView());
|
|
130
|
+
return true;
|
|
131
|
+
};
|
|
132
|
+
/** Apply position + text-wrap distances to the image at `pos`. Returns whether it applied. */
|
|
133
|
+
const applyImagePosition = (view, pos, data) => {
|
|
134
|
+
const node = imageNodeAt(view, pos);
|
|
135
|
+
if (!node) return false;
|
|
136
|
+
const attrs = expectImageAttrs(node);
|
|
137
|
+
const horizontal = normalizeImageHorizontalPosition(data.horizontal);
|
|
138
|
+
const vertical = normalizeImageVerticalPosition(data.vertical);
|
|
139
|
+
const tr = view.state.tr.setNodeMarkup(pos, void 0, mergeImageAttrs(node, {
|
|
140
|
+
position: horizontal || vertical ? {
|
|
141
|
+
...horizontal ? { horizontal } : {},
|
|
142
|
+
...vertical ? { vertical } : {}
|
|
143
|
+
} : void 0,
|
|
144
|
+
distTop: data.distTop ?? attrs.distTop,
|
|
145
|
+
distBottom: data.distBottom ?? attrs.distBottom,
|
|
146
|
+
distLeft: data.distLeft ?? attrs.distLeft,
|
|
147
|
+
distRight: data.distRight ?? attrs.distRight
|
|
148
|
+
}));
|
|
149
|
+
view.dispatch(tr.scrollIntoView());
|
|
150
|
+
return true;
|
|
151
|
+
};
|
|
152
|
+
/** Apply alt text + border properties to the image at `pos`. Returns whether it applied. */
|
|
153
|
+
const applyImageProperties = (view, pos, data) => {
|
|
154
|
+
const node = imageNodeAt(view, pos);
|
|
155
|
+
if (!node) return false;
|
|
156
|
+
const tr = view.state.tr.setNodeMarkup(pos, void 0, mergeImageAttrs(node, {
|
|
157
|
+
alt: data.alt,
|
|
158
|
+
borderWidth: data.borderWidth,
|
|
159
|
+
borderColor: data.borderColor,
|
|
160
|
+
borderStyle: data.borderStyle
|
|
161
|
+
}));
|
|
162
|
+
view.dispatch(tr.scrollIntoView());
|
|
163
|
+
return true;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Read an image file, then insert a constrained inline image node at the
|
|
167
|
+
* current selection. `onInserted` runs after the image is dispatched. No-ops
|
|
168
|
+
* when the file fails validation or the schema has no image node.
|
|
169
|
+
*/
|
|
170
|
+
const insertImageFromFile = async (view, file, onInserted) => {
|
|
171
|
+
if (!await isSafeImageFile(file)) return;
|
|
172
|
+
const dataUrl = await readFileAsDataUrl(file);
|
|
173
|
+
const { width, height } = await loadImageDimensions(dataUrl);
|
|
174
|
+
const constrained = constrainImageSize(width, height);
|
|
175
|
+
const imageType = view.state.schema.nodes["image"];
|
|
176
|
+
if (!imageType) return;
|
|
177
|
+
const imageNode = imageType.create({
|
|
178
|
+
src: dataUrl,
|
|
179
|
+
alt: file.name,
|
|
180
|
+
width: constrained.width,
|
|
181
|
+
height: constrained.height,
|
|
182
|
+
rId: `rId_img_${Date.now()}`,
|
|
183
|
+
wrapType: "inline",
|
|
184
|
+
displayMode: "inline"
|
|
185
|
+
});
|
|
186
|
+
const { from } = view.state.selection;
|
|
187
|
+
const tr = view.state.tr.insert(from, imageNode);
|
|
188
|
+
view.dispatch(tr.scrollIntoView());
|
|
189
|
+
onInserted();
|
|
190
|
+
};
|
|
191
|
+
function readFileAsDataUrl(file) {
|
|
192
|
+
return new Promise((resolve, reject) => {
|
|
193
|
+
const reader = new FileReader();
|
|
194
|
+
reader.addEventListener("load", () => {
|
|
195
|
+
resolve(typeof reader.result === "string" ? reader.result : "");
|
|
196
|
+
});
|
|
197
|
+
reader.addEventListener("error", () => {
|
|
198
|
+
reject(reader.error ?? /* @__PURE__ */ new Error("Failed to read image file"));
|
|
199
|
+
});
|
|
200
|
+
reader.readAsDataURL(file);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function loadImageDimensions(src) {
|
|
204
|
+
return new Promise((resolve, reject) => {
|
|
205
|
+
const img = new Image();
|
|
206
|
+
img.addEventListener("load", () => {
|
|
207
|
+
resolve({
|
|
208
|
+
width: img.naturalWidth || 1,
|
|
209
|
+
height: img.naturalHeight || 1
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
img.addEventListener("error", () => {
|
|
213
|
+
reject(/* @__PURE__ */ new Error("Failed to load image"));
|
|
214
|
+
});
|
|
215
|
+
img.src = src;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
export { applyImagePosition, applyImageProperties, applyImageTransform, applyImageWrapType, computeImageTransform, constrainImageSize, insertImageFromFile, normalizeImageHorizontalPosition, normalizeImageVerticalPosition, resolveImageWrap };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { acceptAIEditRevision, acceptAllChanges, acceptChange, addCommentMark, findAIEditRevisionRange, findNextChange, findPreviousChange, rejectAIEditRevision, rejectAllChanges, rejectChange, removeCommentMark } from "./comments.js";
|
|
2
|
+
import { PAINTABLE_MARK_NAMES, applyFormatMarks, captureFormatMarks } from "./formatPainter.js";
|
|
3
|
+
import { clearFormatting, createRemoveMarkCommand, createSetMarkCommand, getMarkAttr, isMarkActive } from "../extensions/marks/markUtils.js";
|
|
4
|
+
import { getHyperlinkAttrs, getSelectedText, isHyperlinkActive } from "../extensions/marks/HyperlinkExtension.js";
|
|
5
|
+
import { clearFontFamily, clearFontSize, clearHighlight, clearTextColor, insertHyperlink, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, setUnderlineStyle, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "./formatting.js";
|
|
6
|
+
import { ResolvedStyleAttrs, getParagraphAlignment, getParagraphBidi, getStyleId } from "../extensions/core/ParagraphExtension.js";
|
|
7
|
+
import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
|
|
8
|
+
import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, decreaseIndent, decreaseListLevel, doubleSpacing, generateTOC, increaseIndent, increaseListLevel, oneAndHalfSpacing, removeList, removeTabStop, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setRtl, setSpaceAfter, setSpaceBefore, singleSpacing, toggleBidi, toggleBulletList, toggleNumberedList } from "./paragraph.js";
|
|
9
|
+
import { BorderPreset, TableBorderPreset, TableContextInfo, getTableContext, isInTable as isInTableCell } from "../extensions/nodes/TableExtension.js";
|
|
10
|
+
import { addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyTableStyle, autoFitContents, deleteColumn, deleteRow, deleteTable, distributeColumns, insertTable, mergeCells, removeTableBorders, selectColumn, selectRow, selectTable, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setInsideTableBorders, setOutsideTableBorders, setRowHeight, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, splitCell, toggleHeaderRow, toggleNoWrap } from "./table.js";
|
|
11
|
+
import { insertPageBreak } from "./pageBreak.js";
|
|
12
|
+
import { CLIPBOARD_READ_ERROR_EVENT, buildPlainTextSlice, pasteWithoutFormatting } from "./pastePlainText.js";
|
|
13
|
+
export { type BorderPreset, CLIPBOARD_READ_ERROR_EVENT, PAINTABLE_MARK_NAMES, type ResolvedStyleAttrs, type TableBorderPreset, type TableContextInfo, acceptAIEditRevision, acceptAllChanges, acceptChange, addColumnLeft, addColumnRight, addCommentMark, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, buildPlainTextSlice, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, createRemoveMarkCommand, createSetMarkCommand, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, doubleSpacing, findAIEditRevisionRange, findNextChange, findPreviousChange, generateTOC, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertPageBreak, insertTable, isHyperlinkActive, isInList, isInTableCell as isInTable, isMarkActive, mergeCells, oneAndHalfSpacing, pasteWithoutFormatting, rejectAIEditRevision, rejectAllChanges, rejectChange, removeCommentMark, removeHyperlink, removeList, removeTabStop, removeTableBorders, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setOutsideTableBorders, setRowHeight, setRtl, setSpaceAfter, setSpaceBefore, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, setUnderlineStyle, singleSpacing, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { acceptAIEditRevision, acceptAllChanges, acceptChange, addCommentMark, findAIEditRevisionRange, findNextChange, findPreviousChange, rejectAIEditRevision, rejectAllChanges, rejectChange, removeCommentMark } from "./comments.js";
|
|
2
|
+
import { getParagraphAlignment, getParagraphBidi, getStyleId } from "../extensions/core/ParagraphExtension.js";
|
|
3
|
+
import { clearFormatting, createRemoveMarkCommand, createSetMarkCommand, getMarkAttr, isMarkActive } from "../extensions/marks/markUtils.js";
|
|
4
|
+
import { getTableContext, isInTable as isInTableCell } from "../extensions/nodes/TableExtension.js";
|
|
5
|
+
import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
|
|
6
|
+
import { CLIPBOARD_READ_ERROR_EVENT, buildPlainTextSlice, pasteWithoutFormatting } from "./pastePlainText.js";
|
|
7
|
+
import { getHyperlinkAttrs, getSelectedText, isHyperlinkActive } from "../extensions/marks/HyperlinkExtension.js";
|
|
8
|
+
import { addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyTableStyle, autoFitContents, deleteColumn, deleteRow, deleteTable, distributeColumns, insertTable, mergeCells, removeTableBorders, selectColumn, selectRow, selectTable, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setInsideTableBorders, setOutsideTableBorders, setRowHeight, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, splitCell, toggleHeaderRow, toggleNoWrap } from "./table.js";
|
|
9
|
+
import { clearFontFamily, clearFontSize, clearHighlight, clearTextColor, insertHyperlink, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, setUnderlineStyle, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "./formatting.js";
|
|
10
|
+
import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, decreaseIndent, decreaseListLevel, doubleSpacing, generateTOC, increaseIndent, increaseListLevel, oneAndHalfSpacing, removeList, removeTabStop, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setRtl, setSpaceAfter, setSpaceBefore, singleSpacing, toggleBidi, toggleBulletList, toggleNumberedList } from "./paragraph.js";
|
|
11
|
+
import { PAINTABLE_MARK_NAMES, applyFormatMarks, captureFormatMarks } from "./formatPainter.js";
|
|
12
|
+
import { insertPageBreak } from "./pageBreak.js";
|
|
13
|
+
export { CLIPBOARD_READ_ERROR_EVENT, PAINTABLE_MARK_NAMES, acceptAIEditRevision, acceptAllChanges, acceptChange, addColumnLeft, addColumnRight, addCommentMark, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, buildPlainTextSlice, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, createRemoveMarkCommand, createSetMarkCommand, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, doubleSpacing, findAIEditRevisionRange, findNextChange, findPreviousChange, generateTOC, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertPageBreak, insertTable, isHyperlinkActive, isInList, isInTableCell as isInTable, isMarkActive, mergeCells, oneAndHalfSpacing, pasteWithoutFormatting, rejectAIEditRevision, rejectAllChanges, rejectChange, removeCommentMark, removeHyperlink, removeList, removeTabStop, removeTableBorders, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setOutsideTableBorders, setRowHeight, setRtl, setSpaceAfter, setSpaceBefore, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, setUnderlineStyle, singleSpacing, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "prosemirror-state";
|
|
2
|
+
|
|
3
|
+
//#region src/prosemirror/commands/pageBreak.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Insert a page break at the current cursor position.
|
|
6
|
+
* Always ensures a paragraph follows the page break and places the cursor there.
|
|
7
|
+
*/
|
|
8
|
+
declare const insertPageBreak: Command;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { insertPageBreak };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TextSelection } from "prosemirror-state";
|
|
2
|
+
import { Fragment } from "prosemirror-model";
|
|
3
|
+
//#region src/prosemirror/commands/pageBreak.ts
|
|
4
|
+
/**
|
|
5
|
+
* Page Break Commands
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Insert a page break at the current cursor position.
|
|
9
|
+
* Always ensures a paragraph follows the page break and places the cursor there.
|
|
10
|
+
*/
|
|
11
|
+
const insertPageBreak = (state, dispatch) => {
|
|
12
|
+
const { schema } = state;
|
|
13
|
+
const pageBreakType = schema.nodes["pageBreak"];
|
|
14
|
+
const paragraphType = schema.nodes["paragraph"];
|
|
15
|
+
if (!pageBreakType || !paragraphType) return false;
|
|
16
|
+
if (dispatch) {
|
|
17
|
+
const { $from } = state.selection;
|
|
18
|
+
const tr = state.tr;
|
|
19
|
+
const pbNode = pageBreakType.create();
|
|
20
|
+
const pbSize = pbNode.nodeSize;
|
|
21
|
+
let cursorPos;
|
|
22
|
+
if ($from.parent.isTextblock) if ($from.parentOffset > 0 && $from.parentOffset < $from.parent.content.size) {
|
|
23
|
+
tr.split($from.pos);
|
|
24
|
+
const mappedPos = tr.mapping.map($from.pos);
|
|
25
|
+
tr.insert(mappedPos, Fragment.from([pbNode, paragraphType.create()]));
|
|
26
|
+
cursorPos = mappedPos + pbSize + 1;
|
|
27
|
+
} else if ($from.parentOffset === $from.parent.content.size) {
|
|
28
|
+
const after = $from.after();
|
|
29
|
+
tr.insert(after, Fragment.from([pbNode, paragraphType.create()]));
|
|
30
|
+
cursorPos = after + pbSize + 1;
|
|
31
|
+
} else {
|
|
32
|
+
const before = $from.before();
|
|
33
|
+
tr.insert(before, pbNode);
|
|
34
|
+
cursorPos = before + pbSize + 1;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const pos = $from.pos;
|
|
38
|
+
tr.insert(pos, Fragment.from([pbNode, paragraphType.create()]));
|
|
39
|
+
cursorPos = pos + pbSize + 1;
|
|
40
|
+
}
|
|
41
|
+
tr.setSelection(TextSelection.create(tr.doc, cursorPos));
|
|
42
|
+
dispatch(tr.scrollIntoView());
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { insertPageBreak };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { document_d_exports } from "../../types/document.js";
|
|
2
|
+
import { ResolvedStyleAttrs, getParagraphAlignment, getParagraphBidi, getParagraphTabs, getStyleId } from "../extensions/core/ParagraphExtension.js";
|
|
3
|
+
import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
|
|
4
|
+
import { Command } from "prosemirror-state";
|
|
5
|
+
|
|
6
|
+
//#region src/prosemirror/commands/paragraph.d.ts
|
|
7
|
+
declare function setAlignment(alignment: document_d_exports.ParagraphAlignment): Command;
|
|
8
|
+
declare const alignLeft: Command;
|
|
9
|
+
declare const alignCenter: Command;
|
|
10
|
+
declare const alignRight: Command;
|
|
11
|
+
declare const alignJustify: Command;
|
|
12
|
+
declare function setLineSpacing(value: number, rule?: document_d_exports.LineSpacingRule): Command;
|
|
13
|
+
declare const singleSpacing: Command;
|
|
14
|
+
declare const oneAndHalfSpacing: Command;
|
|
15
|
+
declare const doubleSpacing: Command;
|
|
16
|
+
declare function increaseIndent(amount?: number): Command;
|
|
17
|
+
declare function decreaseIndent(amount?: number): Command;
|
|
18
|
+
declare function setIndentLeft(twips: number): Command;
|
|
19
|
+
declare function setIndentRight(twips: number): Command;
|
|
20
|
+
declare function setIndentFirstLine(twips: number, hanging?: boolean): Command;
|
|
21
|
+
declare const toggleBulletList: Command;
|
|
22
|
+
declare const toggleNumberedList: Command;
|
|
23
|
+
declare const increaseListLevel: Command;
|
|
24
|
+
declare const decreaseListLevel: Command;
|
|
25
|
+
declare const removeList: Command;
|
|
26
|
+
declare function setSpaceBefore(twips: number): Command;
|
|
27
|
+
declare function setSpaceAfter(twips: number): Command;
|
|
28
|
+
declare function applyStyle(styleId: string, resolvedAttrs?: ResolvedStyleAttrs): Command;
|
|
29
|
+
declare const clearStyle: Command;
|
|
30
|
+
declare function insertSectionBreak(breakType: "nextPage" | "continuous" | "oddPage" | "evenPage"): Command;
|
|
31
|
+
declare const removeSectionBreak: Command;
|
|
32
|
+
declare function addTabStop(position: number, alignment?: document_d_exports.TabStopAlignment, leader?: document_d_exports.TabLeader): Command;
|
|
33
|
+
declare function removeTabStop(position: number): Command;
|
|
34
|
+
declare const toggleBidi: Command;
|
|
35
|
+
declare const setRtl: Command;
|
|
36
|
+
declare const setLtr: Command;
|
|
37
|
+
declare const generateTOC: Command;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { type ResolvedStyleAttrs, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, decreaseIndent, decreaseListLevel, doubleSpacing, generateTOC, getListInfo, getParagraphAlignment, getParagraphBidi, getParagraphTabs, getStyleId, increaseIndent, increaseListLevel, insertSectionBreak, isInList, oneAndHalfSpacing, removeList, removeSectionBreak, removeTabStop, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setRtl, setSpaceAfter, setSpaceBefore, singleSpacing, toggleBidi, toggleBulletList, toggleNumberedList };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { getParagraphAlignment, getParagraphBidi, getParagraphTabs, getStyleId } from "../extensions/core/ParagraphExtension.js";
|
|
2
|
+
import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
|
|
3
|
+
import { singletonManager } from "../schema/index.js";
|
|
4
|
+
//#region src/prosemirror/commands/paragraph.ts
|
|
5
|
+
const cmds = singletonManager.getCommands();
|
|
6
|
+
function setAlignment(alignment) {
|
|
7
|
+
return cmds["setAlignment"](alignment);
|
|
8
|
+
}
|
|
9
|
+
const alignLeft = cmds["alignLeft"]();
|
|
10
|
+
const alignCenter = cmds["alignCenter"]();
|
|
11
|
+
const alignRight = cmds["alignRight"]();
|
|
12
|
+
const alignJustify = cmds["alignJustify"]();
|
|
13
|
+
function setLineSpacing(value, rule = "auto") {
|
|
14
|
+
return cmds["setLineSpacing"](value, rule);
|
|
15
|
+
}
|
|
16
|
+
const singleSpacing = cmds["singleSpacing"]();
|
|
17
|
+
const oneAndHalfSpacing = cmds["oneAndHalfSpacing"]();
|
|
18
|
+
const doubleSpacing = cmds["doubleSpacing"]();
|
|
19
|
+
function increaseIndent(amount = 720) {
|
|
20
|
+
return cmds["increaseIndent"](amount);
|
|
21
|
+
}
|
|
22
|
+
function decreaseIndent(amount = 720) {
|
|
23
|
+
return cmds["decreaseIndent"](amount);
|
|
24
|
+
}
|
|
25
|
+
function setIndentLeft(twips) {
|
|
26
|
+
return cmds["setIndentLeft"](twips);
|
|
27
|
+
}
|
|
28
|
+
function setIndentRight(twips) {
|
|
29
|
+
return cmds["setIndentRight"](twips);
|
|
30
|
+
}
|
|
31
|
+
function setIndentFirstLine(twips, hanging) {
|
|
32
|
+
return cmds["setIndentFirstLine"](twips, hanging);
|
|
33
|
+
}
|
|
34
|
+
const toggleBulletList = cmds["toggleBulletList"]();
|
|
35
|
+
const toggleNumberedList = cmds["toggleNumberedList"]();
|
|
36
|
+
const increaseListLevel = cmds["increaseListLevel"]();
|
|
37
|
+
const decreaseListLevel = cmds["decreaseListLevel"]();
|
|
38
|
+
const removeList = cmds["removeList"]();
|
|
39
|
+
function setSpaceBefore(twips) {
|
|
40
|
+
return cmds["setSpaceBefore"](twips);
|
|
41
|
+
}
|
|
42
|
+
function setSpaceAfter(twips) {
|
|
43
|
+
return cmds["setSpaceAfter"](twips);
|
|
44
|
+
}
|
|
45
|
+
function applyStyle(styleId, resolvedAttrs) {
|
|
46
|
+
return cmds["applyStyle"](styleId, resolvedAttrs);
|
|
47
|
+
}
|
|
48
|
+
const clearStyle = cmds["clearStyle"]();
|
|
49
|
+
function insertSectionBreak(breakType) {
|
|
50
|
+
return cmds["insertSectionBreak"](breakType);
|
|
51
|
+
}
|
|
52
|
+
const removeSectionBreak = cmds["removeSectionBreak"]();
|
|
53
|
+
function addTabStop(position, alignment = "left", leader = "none") {
|
|
54
|
+
return cmds["addTabStop"](position, alignment, leader);
|
|
55
|
+
}
|
|
56
|
+
function removeTabStop(position) {
|
|
57
|
+
return cmds["removeTabStop"](position);
|
|
58
|
+
}
|
|
59
|
+
const toggleBidi = cmds["toggleBidi"]();
|
|
60
|
+
const setRtl = cmds["setRtl"]();
|
|
61
|
+
const setLtr = cmds["setLtr"]();
|
|
62
|
+
const generateTOC = cmds["generateTOC"]();
|
|
63
|
+
//#endregion
|
|
64
|
+
export { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, decreaseIndent, decreaseListLevel, doubleSpacing, generateTOC, getListInfo, getParagraphAlignment, getParagraphBidi, getParagraphTabs, getStyleId, increaseIndent, increaseListLevel, insertSectionBreak, isInList, oneAndHalfSpacing, removeList, removeSectionBreak, removeTabStop, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setRtl, setSpaceAfter, setSpaceBefore, singleSpacing, toggleBidi, toggleBulletList, toggleNumberedList };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from "prosemirror-state";
|
|
2
|
+
import { Schema, Slice } from "prosemirror-model";
|
|
3
|
+
|
|
4
|
+
//#region src/prosemirror/commands/pastePlainText.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Dispatched on the editor view DOM when the clipboard read behind a
|
|
7
|
+
* "paste without formatting" keystroke fails (e.g. clipboard-read permission
|
|
8
|
+
* denied). The command owns no UI, so the host shell listens for this bubbling
|
|
9
|
+
* event and decides how to surface it (toast, telemetry, or no-op) rather than
|
|
10
|
+
* the keystroke silently doing nothing.
|
|
11
|
+
*/
|
|
12
|
+
declare const CLIPBOARD_READ_ERROR_EVENT = "folio:clipboard-read-error";
|
|
13
|
+
/**
|
|
14
|
+
* Build a mark-free slice from plain text, one paragraph per run of newlines.
|
|
15
|
+
*
|
|
16
|
+
* Pure and DOM-free so it is unit-testable and reusable from both the keymap
|
|
17
|
+
* command and the context menu. The slice is opened at both ends
|
|
18
|
+
* ({@link Slice.maxOpen}) so its first and last paragraphs merge into the
|
|
19
|
+
* surrounding block on {@link Transaction.replaceSelection}, matching how the
|
|
20
|
+
* editor's default text paste flows into the current line.
|
|
21
|
+
*/
|
|
22
|
+
declare function buildPlainTextSlice(text: string, schema: Schema): Slice;
|
|
23
|
+
/**
|
|
24
|
+
* Read the clipboard and insert it as unformatted text at the current selection.
|
|
25
|
+
*
|
|
26
|
+
* Dry-runnable per the ProseMirror command convention: applicability does not
|
|
27
|
+
* depend on the (asynchronously read) clipboard contents, so the command is
|
|
28
|
+
* "available" whenever the runtime exposes a clipboard reader. A probe with no
|
|
29
|
+
* `dispatch` (menus/toolbars) returns `true` without touching the clipboard or
|
|
30
|
+
* the document. Only when `dispatch` is provided does it read the clipboard and
|
|
31
|
+
* insert; it then returns `true` (claiming the key) so the browser's own
|
|
32
|
+
* "paste without formatting" shortcut does not also fire. A failed read (denied
|
|
33
|
+
* permission, unsupported) is surfaced to the host via a
|
|
34
|
+
* {@link CLIPBOARD_READ_ERROR_EVENT} on the view DOM so the keystroke is never a
|
|
35
|
+
* silent no-op.
|
|
36
|
+
*/
|
|
37
|
+
declare const pasteWithoutFormatting: Command;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { CLIPBOARD_READ_ERROR_EVENT, buildPlainTextSlice, pasteWithoutFormatting };
|