roosterjs-content-model-plugins 0.26.4 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/autoFormat/AutoFormatPlugin.d.ts +11 -2
- package/lib/autoFormat/AutoFormatPlugin.js +24 -4
- package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib/autoFormat/link/createLink.d.ts +5 -0
- package/lib/autoFormat/link/createLink.js +26 -0
- package/lib/autoFormat/link/createLink.js.map +1 -0
- package/lib/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
- package/lib/autoFormat/link/createLinkAfterSpace.js +39 -0
- package/lib/autoFormat/link/createLinkAfterSpace.js.map +1 -0
- package/lib/autoFormat/link/getLinkSegment.d.ts +5 -0
- package/lib/autoFormat/link/getLinkSegment.js +27 -0
- package/lib/autoFormat/link/getLinkSegment.js.map +1 -0
- package/lib/autoFormat/link/unlink.d.ts +5 -0
- package/lib/autoFormat/link/unlink.js +20 -0
- package/lib/autoFormat/link/unlink.js.map +1 -0
- package/lib/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
- package/lib/autoFormat/list/getIndex.js.map +1 -0
- package/lib/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
- package/lib/autoFormat/list/getListTypeStyle.js.map +1 -0
- package/lib/autoFormat/list/getNumberingListStyle.js.map +1 -0
- package/lib/autoFormat/list/keyboardListTrigger.d.ts +5 -0
- package/lib/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
- package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -0
- package/lib/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
- package/lib/contextMenuBase/ContextMenuPluginBase.js +84 -0
- package/lib/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
- package/lib/edit/EditPlugin.d.ts +3 -3
- package/lib/edit/EditPlugin.js +1 -1
- package/lib/edit/EditPlugin.js.map +1 -1
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js +20 -1
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
- package/lib/edit/deleteSteps/deleteEmptyQuote.js +60 -0
- package/lib/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
- package/lib/edit/deleteSteps/deleteList.js +2 -1
- package/lib/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib/edit/handleKeyboardEventCommon.d.ts +2 -2
- package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib/edit/inputSteps/handleEnterOnList.js +40 -10
- package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib/edit/keyboardDelete.d.ts +3 -3
- package/lib/edit/keyboardDelete.js +10 -2
- package/lib/edit/keyboardDelete.js.map +1 -1
- package/lib/edit/keyboardInput.d.ts +2 -2
- package/lib/edit/keyboardInput.js +2 -1
- package/lib/edit/keyboardInput.js.map +1 -1
- package/lib/edit/keyboardTab.d.ts +2 -2
- package/lib/edit/keyboardTab.js +19 -11
- package/lib/edit/keyboardTab.js.map +1 -1
- package/lib/edit/tabUtils/handleTabOnList.d.ts +7 -0
- package/lib/edit/tabUtils/handleTabOnList.js +34 -0
- package/lib/edit/tabUtils/handleTabOnList.js.map +1 -0
- package/lib/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
- package/lib/edit/tabUtils/handleTabOnParagraph.js +81 -0
- package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
- package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.js +22 -1
- package/lib/index.js.map +1 -1
- package/lib/paste/Excel/processPastedContentFromExcel.js +1 -1
- package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib/paste/PastePlugin.d.ts +2 -3
- package/lib/paste/PastePlugin.js +6 -7
- package/lib/paste/PastePlugin.js.map +1 -1
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib/paste/WacComponents/constants.js.map +1 -1
- package/lib/paste/WacComponents/processPastedContentWacComponents.js +6 -6
- package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
- package/lib/paste/WordDesktop/getStyleMetadata.js +2 -1
- package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib/paste/utils/addParser.d.ts +1 -1
- package/lib/paste/utils/addParser.js +2 -1
- package/lib/paste/utils/addParser.js.map +1 -1
- package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib/paste/utils/getStyles.js.map +1 -1
- package/lib/paste/utils/linkParser.js.map +1 -1
- package/lib/paste/utils/setProcessor.js.map +1 -1
- package/lib/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
- package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib/pluginUtils/CreateElement/createElement.d.ts +2 -2
- package/lib/pluginUtils/CreateElement/createElement.js +2 -1
- package/lib/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib/pluginUtils/Disposable.d.ts +1 -1
- package/lib/pluginUtils/Disposable.js.map +1 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
- package/lib/pluginUtils/Rect/getIntersectedRect.js +4 -3
- package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib/shortcut/ShortcutCommand.d.ts +44 -0
- package/lib/shortcut/ShortcutCommand.js +3 -0
- package/lib/shortcut/ShortcutCommand.js.map +1 -0
- package/lib/shortcut/ShortcutPlugin.d.ts +51 -0
- package/lib/shortcut/ShortcutPlugin.js +120 -0
- package/lib/shortcut/ShortcutPlugin.js.map +1 -0
- package/lib/shortcut/shortcuts.d.ts +85 -0
- package/lib/shortcut/shortcuts.js +211 -0
- package/lib/shortcut/shortcuts.js.map +1 -0
- package/lib/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
- package/lib/shortcut/utils/setShortcutIndentationCommand.js +22 -0
- package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
- package/lib/tableEdit/TableEditPlugin.d.ts +47 -0
- package/lib/tableEdit/TableEditPlugin.js +156 -0
- package/lib/tableEdit/TableEditPlugin.js.map +1 -0
- package/lib/tableEdit/editors/TableEditor.d.ts +73 -0
- package/lib/tableEdit/editors/TableEditor.js +294 -0
- package/lib/tableEdit/editors/TableEditor.js.map +1 -0
- package/lib/tableEdit/editors/features/CellResizer.d.ts +6 -0
- package/lib/tableEdit/editors/features/CellResizer.js +169 -0
- package/lib/tableEdit/editors/features/CellResizer.js.map +1 -0
- package/lib/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
- package/lib/tableEdit/editors/features/TableEditFeature.js +17 -0
- package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib/tableEdit/editors/features/TableInserter.d.ts +6 -0
- package/lib/tableEdit/editors/features/TableInserter.js +113 -0
- package/lib/tableEdit/editors/features/TableInserter.js.map +1 -0
- package/lib/tableEdit/editors/features/TableMover.d.ts +8 -0
- package/lib/tableEdit/editors/features/TableMover.js +83 -0
- package/lib/tableEdit/editors/features/TableMover.js.map +1 -0
- package/lib/tableEdit/editors/features/TableResizer.d.ts +6 -0
- package/lib/tableEdit/editors/features/TableResizer.js +166 -0
- package/lib/tableEdit/editors/features/TableResizer.js.map +1 -0
- package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +11 -2
- package/lib-amd/autoFormat/AutoFormatPlugin.js +21 -4
- package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-amd/autoFormat/link/createLink.d.ts +5 -0
- package/lib-amd/autoFormat/link/createLink.js +26 -0
- package/lib-amd/autoFormat/link/createLink.js.map +1 -0
- package/lib-amd/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
- package/lib-amd/autoFormat/link/createLinkAfterSpace.js +38 -0
- package/lib-amd/autoFormat/link/createLinkAfterSpace.js.map +1 -0
- package/lib-amd/autoFormat/link/getLinkSegment.d.ts +5 -0
- package/lib-amd/autoFormat/link/getLinkSegment.js +27 -0
- package/lib-amd/autoFormat/link/getLinkSegment.js.map +1 -0
- package/lib-amd/autoFormat/link/unlink.d.ts +5 -0
- package/lib-amd/autoFormat/link/unlink.js +21 -0
- package/lib-amd/autoFormat/link/unlink.js.map +1 -0
- package/lib-amd/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
- package/lib-amd/autoFormat/list/getIndex.js.map +1 -0
- package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
- package/lib-amd/autoFormat/list/getListTypeStyle.js.map +1 -0
- package/lib-amd/autoFormat/list/getNumberingListStyle.js.map +1 -0
- package/lib-amd/autoFormat/list/keyboardListTrigger.d.ts +5 -0
- package/lib-amd/autoFormat/list/keyboardListTrigger.js +46 -0
- package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -0
- package/lib-amd/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
- package/lib-amd/contextMenuBase/ContextMenuPluginBase.js +86 -0
- package/lib-amd/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
- package/lib-amd/edit/EditPlugin.d.ts +3 -3
- package/lib-amd/edit/EditPlugin.js +1 -1
- package/lib-amd/edit/EditPlugin.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +19 -1
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
- package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js +60 -0
- package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
- package/lib-amd/edit/deleteSteps/deleteList.js +2 -1
- package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-amd/edit/handleKeyboardEventCommon.d.ts +2 -2
- package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-amd/edit/inputSteps/handleEnterOnList.js +40 -10
- package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-amd/edit/keyboardDelete.d.ts +3 -3
- package/lib-amd/edit/keyboardDelete.js +10 -3
- package/lib-amd/edit/keyboardDelete.js.map +1 -1
- package/lib-amd/edit/keyboardInput.d.ts +2 -2
- package/lib-amd/edit/keyboardInput.js +2 -2
- package/lib-amd/edit/keyboardInput.js.map +1 -1
- package/lib-amd/edit/keyboardTab.d.ts +2 -2
- package/lib-amd/edit/keyboardTab.js +18 -12
- package/lib-amd/edit/keyboardTab.js.map +1 -1
- package/lib-amd/edit/tabUtils/handleTabOnList.d.ts +7 -0
- package/lib-amd/edit/tabUtils/handleTabOnList.js +34 -0
- package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -0
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +81 -0
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
- package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-amd/index.d.ts +5 -0
- package/lib-amd/index.js +19 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js +1 -1
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-amd/paste/PastePlugin.d.ts +2 -3
- package/lib-amd/paste/PastePlugin.js +6 -7
- package/lib-amd/paste/PastePlugin.js.map +1 -1
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-amd/paste/WacComponents/constants.js.map +1 -1
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +6 -6
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-amd/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
- package/lib-amd/paste/WordDesktop/getStyleMetadata.js +2 -1
- package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib-amd/paste/utils/addParser.d.ts +1 -1
- package/lib-amd/paste/utils/addParser.js +2 -1
- package/lib-amd/paste/utils/addParser.js.map +1 -1
- package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib-amd/paste/utils/getStyles.js.map +1 -1
- package/lib-amd/paste/utils/linkParser.js.map +1 -1
- package/lib-amd/paste/utils/setProcessor.js.map +1 -1
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +2 -2
- package/lib-amd/pluginUtils/CreateElement/createElement.js +2 -1
- package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib-amd/pluginUtils/Disposable.d.ts +1 -1
- package/lib-amd/pluginUtils/Disposable.js.map +1 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +4 -3
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib-amd/shortcut/ShortcutCommand.d.ts +44 -0
- package/lib-amd/shortcut/ShortcutCommand.js +5 -0
- package/lib-amd/shortcut/ShortcutCommand.js.map +1 -0
- package/lib-amd/shortcut/ShortcutPlugin.d.ts +51 -0
- package/lib-amd/shortcut/ShortcutPlugin.js +120 -0
- package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -0
- package/lib-amd/shortcut/shortcuts.d.ts +85 -0
- package/lib-amd/shortcut/shortcuts.js +210 -0
- package/lib-amd/shortcut/shortcuts.js.map +1 -0
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +22 -0
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
- package/lib-amd/tableEdit/TableEditPlugin.d.ts +47 -0
- package/lib-amd/tableEdit/TableEditPlugin.js +156 -0
- package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -0
- package/lib-amd/tableEdit/editors/TableEditor.d.ts +73 -0
- package/lib-amd/tableEdit/editors/TableEditor.js +290 -0
- package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/CellResizer.d.ts +6 -0
- package/lib-amd/tableEdit/editors/features/CellResizer.js +166 -0
- package/lib-amd/tableEdit/editors/features/CellResizer.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
- package/lib-amd/tableEdit/editors/features/TableEditFeature.js +19 -0
- package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +6 -0
- package/lib-amd/tableEdit/editors/features/TableInserter.js +111 -0
- package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableMover.d.ts +8 -0
- package/lib-amd/tableEdit/editors/features/TableMover.js +81 -0
- package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +6 -0
- package/lib-amd/tableEdit/editors/features/TableResizer.js +164 -0
- package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -0
- package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +11 -2
- package/lib-mjs/autoFormat/AutoFormatPlugin.js +24 -4
- package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-mjs/autoFormat/link/createLink.d.ts +5 -0
- package/lib-mjs/autoFormat/link/createLink.js +22 -0
- package/lib-mjs/autoFormat/link/createLink.js.map +1 -0
- package/lib-mjs/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
- package/lib-mjs/autoFormat/link/createLinkAfterSpace.js +35 -0
- package/lib-mjs/autoFormat/link/createLinkAfterSpace.js.map +1 -0
- package/lib-mjs/autoFormat/link/getLinkSegment.d.ts +5 -0
- package/lib-mjs/autoFormat/link/getLinkSegment.js +23 -0
- package/lib-mjs/autoFormat/link/getLinkSegment.js.map +1 -0
- package/lib-mjs/autoFormat/link/unlink.d.ts +5 -0
- package/lib-mjs/autoFormat/link/unlink.js +16 -0
- package/lib-mjs/autoFormat/link/unlink.js.map +1 -0
- package/lib-mjs/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
- package/lib-mjs/autoFormat/list/getIndex.js.map +1 -0
- package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
- package/lib-mjs/autoFormat/list/getListTypeStyle.js.map +1 -0
- package/lib-mjs/autoFormat/list/getNumberingListStyle.js.map +1 -0
- package/lib-mjs/autoFormat/list/keyboardListTrigger.d.ts +5 -0
- package/lib-mjs/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
- package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -0
- package/lib-mjs/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
- package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js +81 -0
- package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
- package/lib-mjs/edit/EditPlugin.d.ts +3 -3
- package/lib-mjs/edit/EditPlugin.js +1 -1
- package/lib-mjs/edit/EditPlugin.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +20 -1
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
- package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js +56 -0
- package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
- package/lib-mjs/edit/deleteSteps/deleteList.js +2 -1
- package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +2 -2
- package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js +42 -12
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-mjs/edit/keyboardDelete.d.ts +3 -3
- package/lib-mjs/edit/keyboardDelete.js +10 -2
- package/lib-mjs/edit/keyboardDelete.js.map +1 -1
- package/lib-mjs/edit/keyboardInput.d.ts +2 -2
- package/lib-mjs/edit/keyboardInput.js +2 -1
- package/lib-mjs/edit/keyboardInput.js.map +1 -1
- package/lib-mjs/edit/keyboardTab.d.ts +2 -2
- package/lib-mjs/edit/keyboardTab.js +19 -11
- package/lib-mjs/edit/keyboardTab.js.map +1 -1
- package/lib-mjs/edit/tabUtils/handleTabOnList.d.ts +7 -0
- package/lib-mjs/edit/tabUtils/handleTabOnList.js +30 -0
- package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -0
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +77 -0
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
- package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-mjs/index.d.ts +5 -0
- package/lib-mjs/index.js +4 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +1 -1
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-mjs/paste/PastePlugin.d.ts +2 -3
- package/lib-mjs/paste/PastePlugin.js +1 -2
- package/lib-mjs/paste/PastePlugin.js.map +1 -1
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-mjs/paste/WacComponents/constants.js.map +1 -1
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +1 -1
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.js +1 -1
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +2 -14
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib-mjs/paste/utils/addParser.d.ts +1 -1
- package/lib-mjs/paste/utils/addParser.js +1 -1
- package/lib-mjs/paste/utils/addParser.js.map +1 -1
- package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib-mjs/paste/utils/getStyles.js.map +1 -1
- package/lib-mjs/paste/utils/linkParser.js.map +1 -1
- package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +2 -2
- package/lib-mjs/pluginUtils/CreateElement/createElement.js +1 -1
- package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib-mjs/pluginUtils/Disposable.d.ts +1 -1
- package/lib-mjs/pluginUtils/Disposable.js.map +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +2 -2
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib-mjs/shortcut/ShortcutCommand.d.ts +44 -0
- package/lib-mjs/shortcut/ShortcutCommand.js +2 -0
- package/lib-mjs/shortcut/ShortcutCommand.js.map +1 -0
- package/lib-mjs/shortcut/ShortcutPlugin.d.ts +51 -0
- package/lib-mjs/shortcut/ShortcutPlugin.js +117 -0
- package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -0
- package/lib-mjs/shortcut/shortcuts.d.ts +85 -0
- package/lib-mjs/shortcut/shortcuts.js +208 -0
- package/lib-mjs/shortcut/shortcuts.js.map +1 -0
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +18 -0
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
- package/lib-mjs/tableEdit/TableEditPlugin.d.ts +47 -0
- package/lib-mjs/tableEdit/TableEditPlugin.js +153 -0
- package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -0
- package/lib-mjs/tableEdit/editors/TableEditor.d.ts +73 -0
- package/lib-mjs/tableEdit/editors/TableEditor.js +291 -0
- package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/CellResizer.d.ts +6 -0
- package/lib-mjs/tableEdit/editors/features/CellResizer.js +165 -0
- package/lib-mjs/tableEdit/editors/features/CellResizer.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.js +13 -0
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +6 -0
- package/lib-mjs/tableEdit/editors/features/TableInserter.js +109 -0
- package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +8 -0
- package/lib-mjs/tableEdit/editors/features/TableMover.js +79 -0
- package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +6 -0
- package/lib-mjs/tableEdit/editors/features/TableResizer.js +162 -0
- package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -0
- package/package.json +5 -5
- package/lib/autoFormat/keyboardListTrigger.d.ts +0 -5
- package/lib/autoFormat/keyboardListTrigger.js.map +0 -1
- package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
- package/lib/autoFormat/utils/getIndex.js.map +0 -1
- package/lib/autoFormat/utils/getListTypeStyle.js.map +0 -1
- package/lib/autoFormat/utils/getNumberingListStyle.js.map +0 -1
- package/lib/pluginUtils/Rect/normalizeRect.d.ts +0 -7
- package/lib/pluginUtils/Rect/normalizeRect.js +0 -20
- package/lib/pluginUtils/Rect/normalizeRect.js.map +0 -1
- package/lib-amd/autoFormat/keyboardListTrigger.d.ts +0 -5
- package/lib-amd/autoFormat/keyboardListTrigger.js +0 -44
- package/lib-amd/autoFormat/keyboardListTrigger.js.map +0 -1
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
- package/lib-amd/autoFormat/utils/getIndex.js.map +0 -1
- package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +0 -1
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +0 -1
- package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +0 -7
- package/lib-amd/pluginUtils/Rect/normalizeRect.js +0 -22
- package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +0 -1
- package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +0 -5
- package/lib-mjs/autoFormat/keyboardListTrigger.js.map +0 -1
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
- package/lib-mjs/autoFormat/utils/getIndex.js.map +0 -1
- package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +0 -1
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +0 -1
- package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +0 -7
- package/lib-mjs/pluginUtils/Rect/normalizeRect.js +0 -17
- package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +0 -1
- /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
- /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
- /package/lib/autoFormat/{utils → list}/getIndex.d.ts +0 -0
- /package/lib/autoFormat/{utils → list}/getIndex.js +0 -0
- /package/lib/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
- /package/lib/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
- /package/lib/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
- /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
- /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getIndex.d.ts +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getIndex.js +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getIndex.d.ts +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getIndex.js +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPastedContentFromWordDesktop.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"processPastedContentFromWordDesktop.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/WordDesktop/processPastedContentFromWordDesktop.ts"],"names":[],"mappings":";;;;IAiBA;;;;OAIG;IACH,SAAgB,mCAAmC,CAC/C,EAAoB,EACpB,kBAA4C;QAE5C,IAAM,WAAW,GAA8B,IAAA,mCAAgB,EAAC,EAAE,EAAE,kBAAkB,CAAC,CAAC;QAExF,IAAA,2BAAY,EAAC,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,2BAA2B,CAAC,WAAW,CAAC,CAAC,CAAC;QACvF,IAAA,qBAAS,EAAC,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,+DAA8B,CAAC,CAAC;QACxE,IAAA,qBAAS,EAAC,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;QAC7D,IAAA,qBAAS,EAAC,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;QAC7D,IAAA,qBAAS,EAAC,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAC7D,CAAC;IAXD,kFAWC;IAED,IAAM,2BAA2B,GAAG,UAChC,WAAsC;QAEtC,OAAO,UAAC,KAAK,EAAE,OAAO,EAAE,OAAO;YAC3B,IAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,OAAO,CAAC,CAAC;YAClC,4FAA4F;YAC5F,IACI,CAAC,CACG,IAAA,kCAAe,EAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC;gBAC7D,IAAA,yCAAmB,EAAC,MAAM,EAAE,OAAO,CAAC,CACvC,EACH;gBACE,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;aACrE;QACL,CAAC,CAAC;IACN,CAAC,CAAC;IAEF,SAAS,eAAe,CACpB,MAAuC,EACvC,OAAoB,EACpB,OAA0B,EAC1B,YAAoD;QAEpD,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE;YAChC,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;SAC/C;QAED,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;IACpC,CAAC;IAED,IAAM,eAAe,GAA0C,UAAC,MAAM;;QAClE,IAAI,MAAA,MAAM,CAAC,UAAU,0CAAE,UAAU,CAAC,GAAG,CAAC,EAAE;YACpC,OAAO,MAAM,CAAC,UAAU,CAAC;SAC5B;IACL,CAAC,CAAC","sourcesContent":["import { addParser } from '../utils/addParser';\nimport { getStyleMetadata } from './getStyleMetadata';\nimport { getStyles } from '../utils/getStyles';\nimport { processWordComments } from './processWordComments';\nimport { processWordList } from './processWordLists';\nimport { removeNegativeTextIndentParser } from './removeNegativeTextIndentParser';\nimport { setProcessor } from '../utils/setProcessor';\nimport type { WordMetadata } from './WordMetadata';\nimport type {\n BeforePasteEvent,\n ContentModelListItemLevelFormat,\n ContentModelTableFormat,\n DomToModelContext,\n ElementProcessor,\n FormatParser,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Handles Pasted content when source is Word Desktop\n * @param ev BeforePasteEvent\n */\nexport function processPastedContentFromWordDesktop(\n ev: BeforePasteEvent,\n trustedHTMLHandler: (text: string) => string\n) {\n const metadataMap: Map<string, WordMetadata> = getStyleMetadata(ev, trustedHTMLHandler);\n\n setProcessor(ev.domToModelOption, 'element', wordDesktopElementProcessor(metadataMap));\n addParser(ev.domToModelOption, 'block', removeNegativeTextIndentParser);\n addParser(ev.domToModelOption, 'listLevel', listLevelParser);\n addParser(ev.domToModelOption, 'container', wordTableParser);\n addParser(ev.domToModelOption, 'table', wordTableParser);\n}\n\nconst wordDesktopElementProcessor = (\n metadataKey: Map<string, WordMetadata>\n): ElementProcessor<HTMLElement> => {\n return (group, element, context) => {\n const styles = getStyles(element);\n // Process Word Lists or Word Commands, otherwise use the default processor on this element.\n if (\n !(\n processWordList(styles, group, element, context, metadataKey) ||\n processWordComments(styles, element)\n )\n ) {\n context.defaultElementProcessors.element(group, element, context);\n }\n };\n};\n\nfunction listLevelParser(\n format: ContentModelListItemLevelFormat,\n element: HTMLElement,\n context: DomToModelContext,\n defaultStyle: Readonly<Partial<CSSStyleDeclaration>>\n): void {\n if (element.style.marginLeft != '') {\n format.marginLeft = defaultStyle.marginLeft;\n }\n\n format.marginBottom = undefined;\n}\n\nconst wordTableParser: FormatParser<ContentModelTableFormat> = (format): void => {\n if (format.marginLeft?.startsWith('-')) {\n delete format.marginLeft;\n }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processWordComments.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"processWordComments.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordComments.ts"],"names":[],"mappings":";;;;IAEA,IAAM,6BAA6B,GAAG,WAAW,CAAC;IAClD,IAAM,qBAAqB,GAAG,uBAAuB,CAAC;IACtD,IAAM,6BAA6B,GAAG,SAAS,CAAC;IAChD,IAAM,WAAW,GAAG,aAAa,CAAC;IAClC,IAAM,wBAAwB,GAAG,cAAc,CAAC;IAEhD;;;;;OAKG;IACH,SAAgB,mBAAmB,CAAC,MAA8B,EAAE,OAAoB;QACpF,OAAO,CACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,6BAA6B;YAC9D,CAAC,IAAA,6CAAe,EAAC,OAAO,EAAE,GAAG,CAAC,IAAI,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnF,MAAM,CAAC,WAAW,CAAC,IAAI,wBAAwB,CAClD,CAAC;IACN,CAAC;IAND,kDAMC","sourcesContent":["import { isElementOfType } from 'roosterjs-content-model-dom';\n\nconst MSO_COMMENT_ANCHOR_HREF_REGEX = /#_msocom_/;\nconst MSO_SPECIAL_CHARACTER = 'mso-special-character';\nconst MSO_SPECIAL_CHARACTER_COMMENT = 'comment';\nconst MSO_ELEMENT = 'mso-element';\nconst MSO_ELEMENT_COMMENT_LIST = 'comment-list';\n\n/**\n * @internal\n * Check whether the element contain Word attributes related to comments and if it does we should no process\n * this element.\n * @returns\n */\nexport function processWordComments(styles: Record<string, string>, element: HTMLElement) {\n return (\n styles[MSO_SPECIAL_CHARACTER] == MSO_SPECIAL_CHARACTER_COMMENT ||\n (isElementOfType(element, 'a') && MSO_COMMENT_ANCHOR_HREF_REGEX.test(element.href)) ||\n styles[MSO_ELEMENT] == MSO_ELEMENT_COMMENT_LIST\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processWordLists.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordLists.ts"],"names":[],"mappings":";;;;IAoBA,oCAAoC;IACpC,IAAM,QAAQ,GAAG,UAAU,CAAC;IAC5B,IAAM,eAAe,GAAG,QAAQ,CAAC;IACjC,IAAM,eAAe,GAAG,IAAI,CAAC;IAC7B,IAAM,oBAAoB,GAAG,gBAAgB,CAAC;IAY9C,IAAM,eAAe,GAAG,QAAQ,CAAC;IACjC;;;;;;;OAOG;IACH,SAAgB,eAAe,CAC3B,MAA8B,EAC9B,KAA6B,EAC7B,OAAoB,EACpB,OAA0B,EAC1B,QAAmC;;QAEnC,IAAM,UAAU,GAAG,OAAO,CAAC,UAAmC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE;YAC7B,UAAU,CAAC,eAAe,GAAG,IAAI,GAAG,EAAmC,CAAC;SAC3E;QACD,IAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE7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AAI,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE;gBAC3E,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,GAAG,KAAK,CAAC;aAClF;SACJ;IACL,CAAC;IAED,SAAS,oBAAoB,CAAC,UAA8C;QACxE,KAAK,IAAI,KAAK,GAAG,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAC,MAAM,KAAI,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;YACvE,IAAM,MAAM,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YACzC,IAAI,MAAM,IAAI,CAAC,IAAA,qCAAO,EAAC,MAAM,CAAC,EAAE;gBAC5B,OAAO,MAAM,CAAC;aACjB;SACJ;QAED,OAAO,SAAS,CAAC;IACrB,CAAC","sourcesContent":["import { getListStyleTypeFromString, updateListMetadata } from 'roosterjs-content-model-core';\nimport { removeNegativeTextIndentParser } from './removeNegativeTextIndentParser';\nimport type { WordMetadata } from './WordMetadata';\nimport {\n addBlock,\n createListItem,\n createListLevel,\n isEmpty,\n parseFormat,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlockGroup,\n ContentModelListItem,\n ContentModelListItemFormat,\n ContentModelListItemLevelFormat,\n ContentModelListLevel,\n DomToModelContext,\n DomToModelListFormat,\n} from 'roosterjs-content-model-types';\n\n/** Word list metadata style name */\nconst MSO_LIST = 'mso-list';\nconst MSO_LIST_IGNORE = 'ignore';\nconst WORD_FIRST_LIST = 'l0';\nconst TEMPLATE_VALUE_REGEX = /%[0-9a-zA-Z]+/g;\n\ninterface WordDesktopListFormat extends DomToModelListFormat {\n wordLevel?: number | '';\n wordList?: string;\n wordKnownLevels?: Map<string, ContentModelListLevel[]>;\n}\n\ninterface WordListFormat extends ContentModelListItemFormat {\n wordList?: string;\n}\n\nconst BULLET_METADATA = 'bullet';\n/**\n * @internal\n * @param styles\n * @param group\n * @param element\n * @param context\n * @returns\n */\nexport function processWordList(\n styles: Record<string, string>,\n group: ContentModelBlockGroup,\n element: HTMLElement,\n context: DomToModelContext,\n metadata: Map<string, WordMetadata>\n) {\n const listFormat = context.listFormat as WordDesktopListFormat;\n if (!listFormat.wordKnownLevels) {\n listFormat.wordKnownLevels = new Map<string, ContentModelListLevel[]>();\n }\n const wordListStyle = styles[MSO_LIST] || '';\n\n // If the element contains Ignore style, do not process it,\n // Usually this element contains the fake bullet used in Word Desktop.\n if (wordListStyle.toLowerCase() === MSO_LIST_IGNORE) {\n return true;\n }\n\n const [lNumber, level] = wordListStyle.split(' ');\n // Try get the list metadata from word, which follows this format: l1 level1 lfo2\n // If we are able to get the level property means we can process this element to be a list\n listFormat.wordLevel = level && parseInt(level.substr('level'.length));\n\n listFormat.wordList = lNumber || WORD_FIRST_LIST;\n if (listFormat.levels.length == 0) {\n listFormat.levels =\n (listFormat.wordList && listFormat.wordKnownLevels.get(listFormat.wordList)) || [];\n }\n\n if (wordListStyle && group && typeof listFormat.wordLevel === 'number') {\n const { wordLevel, wordList } = listFormat;\n // Retrieve the Fake bullet on the element and also the list type\n const listMetadata = metadata.get(`${lNumber}:${level}`);\n const listType =\n listMetadata?.['mso-level-number-format']?.toLowerCase() != BULLET_METADATA\n ? 'OL'\n : 'UL';\n\n // Create the new level of the list item and parse the format\n const newLevel: ContentModelListLevel = createListLevel(listType);\n parseFormat(\n element,\n [...context.formatParsers.listLevel, wordListPaddingParser],\n newLevel.format,\n context\n );\n\n // If the list format is in a different level, update the array so we get the new item\n // To be in the same level as the provided level metadata.\n if (wordLevel > listFormat.levels.length) {\n while (wordLevel != listFormat.levels.length) {\n listFormat.levels.push(newLevel);\n }\n } else {\n listFormat.levels.splice(wordLevel, listFormat.levels.length - 1);\n listFormat.levels[wordLevel - 1] = newLevel;\n }\n (listFormat.levels[listFormat.levels.length - 1]\n .format as WordListFormat).wordList = wordList;\n\n listFormat.listParent = group;\n\n processAsListItem(listFormat, context, element, group, listMetadata);\n\n if (\n listFormat.levels.length > 0 &&\n listFormat.wordKnownLevels.get(wordList) != listFormat.levels\n ) {\n listFormat.wordKnownLevels.set(wordList, [...listFormat.levels]);\n }\n return true;\n }\n\n return false;\n}\n\nfunction processAsListItem(\n listFormat: WordDesktopListFormat,\n context: DomToModelContext,\n element: HTMLElement,\n group: ContentModelBlockGroup,\n listMetadata: WordMetadata | undefined\n) {\n const listLevel = listFormat.levels[listFormat.levels.length - 1];\n const { listType } = listLevel;\n const bullet = getBulletFromMetadata(listMetadata, listType);\n if (bullet) {\n updateListMetadata(listFormat.levels[listFormat.levels.length - 1], metadata =>\n Object.assign({}, metadata, {\n unorderedStyleType: listType == 'UL' ? bullet : undefined,\n orderedStyleType: listType == 'OL' ? bullet : undefined,\n })\n );\n }\n\n const listItem = createListItem(listFormat.levels, context.segmentFormat);\n\n parseFormat(element, context.formatParsers.segmentOnBlock, context.segmentFormat, context);\n parseFormat(element, context.formatParsers.listItemElement, listItem.format, context);\n parseFormat(element, [removeNegativeTextIndentParser], listItem.format, context);\n\n if (listType == 'OL') {\n setStartNumber(listItem, context, listMetadata);\n }\n\n context.elementProcessors.child(listItem, element, context);\n addBlock(group, listItem);\n}\n\nfunction getBulletFromMetadata(listMetadata: WordMetadata | undefined, listType: 'OL' | 'UL') {\n const templateType = listMetadata?.['mso-level-number-format'] || 'decimal';\n let templateFinal: string;\n\n if (listMetadata?.['mso-level-text']) {\n let templateValue: string = '';\n switch (templateType) {\n case 'alpha-upper':\n templateValue = 'UpperAlpha';\n break;\n case 'alpha-lower':\n templateValue = 'LowerAlpha';\n break;\n case 'roman-lower':\n templateValue = 'LowerRoman';\n break;\n case 'roman-upper':\n templateValue = 'UpperRoman';\n break;\n default:\n templateValue = 'Number';\n break;\n }\n const template = (listMetadata['mso-level-text'] || '')\n .replace('\\\\', '')\n .replace('\"', '')\n .replace(TEMPLATE_VALUE_REGEX, '${' + templateValue + '}');\n\n templateFinal = '\"' + template + ' \"';\n } else {\n switch (templateType) {\n case 'alpha-lower':\n templateFinal = 'lower-alpha';\n break;\n case 'roman-lower':\n templateFinal = 'lower-roman';\n break;\n case 'roman-upper':\n templateFinal = 'upper-roman';\n break;\n default:\n templateFinal = 'decimal';\n break;\n }\n }\n\n return getListStyleTypeFromString(listType, templateFinal);\n}\n\nfunction wordListPaddingParser(\n format: ContentModelListItemLevelFormat,\n element: HTMLElement\n): void {\n if (element.style.marginLeft && element.style.marginLeft != '0in') {\n format.paddingLeft = '0px';\n }\n if (element.style.marginRight && element.style.marginRight != '0in') {\n format.paddingRight = '0px';\n }\n}\n\nfunction setStartNumber(\n listItem: ContentModelListItem,\n context: DomToModelContext,\n listMetadata: WordMetadata | undefined\n) {\n const {\n listParent,\n wordList,\n wordKnownLevels,\n wordLevel,\n levels,\n } = context.listFormat as WordDesktopListFormat;\n\n const block = getLastNotEmptyBlock(listParent);\n if (\n (block?.blockType != 'BlockGroup' ||\n block.blockGroupType != 'ListItem' ||\n (wordLevel &&\n (block.levels[wordLevel]?.format as WordListFormat)?.wordList != wordList)) &&\n wordList\n ) {\n const start = listMetadata?.['mso-level-start-at']\n ? parseInt(listMetadata['mso-level-start-at'])\n : NaN;\n const knownLevel = wordKnownLevels?.get(wordList) || [];\n\n if (start != undefined && !isNaN(start) && knownLevel.length != levels.length) {\n listItem.levels[listItem.levels.length - 1].format.startNumberOverride = start;\n }\n }\n}\n\nfunction getLastNotEmptyBlock(listParent: ContentModelBlockGroup | undefined) {\n for (let index = (listParent?.blocks.length || 0) - 1; index > 0; index--) {\n const result = listParent?.blocks[index];\n if (result && !isEmpty(result)) {\n return result;\n }\n }\n\n return undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"processWordLists.js","sourceRoot":"","sources":["../../../../../packages/rooster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AAO,MAAM,CAAC;aACjB;SACJ;QAED,OAAO,SAAS,CAAC;IACrB,CAAC","sourcesContent":["import { getListStyleTypeFromString, updateListMetadata } from 'roosterjs-content-model-core';\nimport { removeNegativeTextIndentParser } from './removeNegativeTextIndentParser';\nimport type { WordMetadata } from './WordMetadata';\nimport {\n addBlock,\n createListItem,\n createListLevel,\n isEmpty,\n parseFormat,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlockGroup,\n ContentModelListItem,\n ContentModelListItemFormat,\n ContentModelListItemLevelFormat,\n ContentModelListLevel,\n DomToModelContext,\n DomToModelListFormat,\n} from 'roosterjs-content-model-types';\n\n/** Word list metadata style name */\nconst MSO_LIST = 'mso-list';\nconst MSO_LIST_IGNORE = 'ignore';\nconst WORD_FIRST_LIST = 'l0';\nconst TEMPLATE_VALUE_REGEX = /%[0-9a-zA-Z]+/g;\n\ninterface WordDesktopListFormat extends DomToModelListFormat {\n wordLevel?: number | '';\n wordList?: string;\n wordKnownLevels?: Map<string, ContentModelListLevel[]>;\n}\n\ninterface WordListFormat extends ContentModelListItemFormat {\n wordList?: string;\n}\n\nconst BULLET_METADATA = 'bullet';\n/**\n * @internal\n * @param styles\n * @param group\n * @param element\n * @param context\n * @returns\n */\nexport function processWordList(\n styles: Record<string, string>,\n group: ContentModelBlockGroup,\n element: HTMLElement,\n context: DomToModelContext,\n metadata: Map<string, WordMetadata>\n) {\n const listFormat = context.listFormat as WordDesktopListFormat;\n if (!listFormat.wordKnownLevels) {\n listFormat.wordKnownLevels = new Map<string, ContentModelListLevel[]>();\n }\n const wordListStyle = styles[MSO_LIST] || '';\n\n // If the element contains Ignore style, do not process it,\n // Usually this element contains the fake bullet used in Word Desktop.\n if (wordListStyle.toLowerCase() === MSO_LIST_IGNORE) {\n return true;\n }\n\n const [lNumber, level] = wordListStyle.split(' ');\n // Try get the list metadata from word, which follows this format: l1 level1 lfo2\n // If we are able to get the level property means we can process this element to be a list\n listFormat.wordLevel = level && parseInt(level.substr('level'.length));\n\n listFormat.wordList = lNumber || WORD_FIRST_LIST;\n if (listFormat.levels.length == 0) {\n listFormat.levels =\n (listFormat.wordList && listFormat.wordKnownLevels.get(listFormat.wordList)) || [];\n }\n\n if (wordListStyle && group && typeof listFormat.wordLevel === 'number') {\n const { wordLevel, wordList } = listFormat;\n // Retrieve the Fake bullet on the element and also the list type\n const listMetadata = metadata.get(`${lNumber}:${level}`);\n const listType =\n listMetadata?.['mso-level-number-format']?.toLowerCase() != BULLET_METADATA\n ? 'OL'\n : 'UL';\n\n // Create the new level of the list item and parse the format\n const newLevel: ContentModelListLevel = createListLevel(listType);\n parseFormat(\n element,\n [...context.formatParsers.listLevel, wordListPaddingParser],\n newLevel.format,\n context\n );\n\n // If the list format is in a different level, update the array so we get the new item\n // To be in the same level as the provided level metadata.\n if (wordLevel > listFormat.levels.length) {\n while (wordLevel != listFormat.levels.length) {\n listFormat.levels.push(newLevel);\n }\n } else {\n listFormat.levels.splice(wordLevel, listFormat.levels.length - 1);\n listFormat.levels[wordLevel - 1] = newLevel;\n }\n (listFormat.levels[listFormat.levels.length - 1]\n .format as WordListFormat).wordList = wordList;\n\n listFormat.listParent = group;\n\n processAsListItem(listFormat, context, element, group, listMetadata);\n\n if (\n listFormat.levels.length > 0 &&\n listFormat.wordKnownLevels.get(wordList) != listFormat.levels\n ) {\n listFormat.wordKnownLevels.set(wordList, [...listFormat.levels]);\n }\n return true;\n }\n\n return false;\n}\n\nfunction processAsListItem(\n listFormat: WordDesktopListFormat,\n context: DomToModelContext,\n element: HTMLElement,\n group: ContentModelBlockGroup,\n listMetadata: WordMetadata | undefined\n) {\n const listLevel = listFormat.levels[listFormat.levels.length - 1];\n const { listType } = listLevel;\n const bullet = getBulletFromMetadata(listMetadata, listType);\n if (bullet) {\n updateListMetadata(listFormat.levels[listFormat.levels.length - 1], metadata =>\n Object.assign({}, metadata, {\n unorderedStyleType: listType == 'UL' ? bullet : undefined,\n orderedStyleType: listType == 'OL' ? bullet : undefined,\n })\n );\n }\n\n const listItem = createListItem(listFormat.levels, context.segmentFormat);\n\n parseFormat(element, context.formatParsers.segmentOnBlock, context.segmentFormat, context);\n parseFormat(element, context.formatParsers.listItemElement, listItem.format, context);\n parseFormat(element, [removeNegativeTextIndentParser], listItem.format, context);\n\n if (listType == 'OL') {\n setStartNumber(listItem, context, listMetadata);\n }\n\n context.elementProcessors.child(listItem, element, context);\n addBlock(group, listItem);\n}\n\nfunction getBulletFromMetadata(listMetadata: WordMetadata | undefined, listType: 'OL' | 'UL') {\n const templateType = listMetadata?.['mso-level-number-format'] || 'decimal';\n let templateFinal: string;\n\n if (listMetadata?.['mso-level-text']) {\n let templateValue: string = '';\n switch (templateType) {\n case 'alpha-upper':\n templateValue = 'UpperAlpha';\n break;\n case 'alpha-lower':\n templateValue = 'LowerAlpha';\n break;\n case 'roman-lower':\n templateValue = 'LowerRoman';\n break;\n case 'roman-upper':\n templateValue = 'UpperRoman';\n break;\n default:\n templateValue = 'Number';\n break;\n }\n const template = (listMetadata['mso-level-text'] || '')\n .replace('\\\\', '')\n .replace('\"', '')\n .replace(TEMPLATE_VALUE_REGEX, '${' + templateValue + '}');\n\n templateFinal = '\"' + template + ' \"';\n } else {\n switch (templateType) {\n case 'alpha-lower':\n templateFinal = 'lower-alpha';\n break;\n case 'roman-lower':\n templateFinal = 'lower-roman';\n break;\n case 'roman-upper':\n templateFinal = 'upper-roman';\n break;\n default:\n templateFinal = 'decimal';\n break;\n }\n }\n\n return getListStyleTypeFromString(listType, templateFinal);\n}\n\nfunction wordListPaddingParser(\n format: ContentModelListItemLevelFormat,\n element: HTMLElement\n): void {\n if (element.style.marginLeft && element.style.marginLeft != '0in') {\n format.paddingLeft = '0px';\n }\n if (element.style.marginRight && element.style.marginRight != '0in') {\n format.paddingRight = '0px';\n }\n}\n\nfunction setStartNumber(\n listItem: ContentModelListItem,\n context: DomToModelContext,\n listMetadata: WordMetadata | undefined\n) {\n const {\n listParent,\n wordList,\n wordKnownLevels,\n wordLevel,\n levels,\n } = context.listFormat as WordDesktopListFormat;\n\n const block = getLastNotEmptyBlock(listParent);\n if (\n (block?.blockType != 'BlockGroup' ||\n block.blockGroupType != 'ListItem' ||\n (wordLevel &&\n (block.levels[wordLevel]?.format as WordListFormat)?.wordList != wordList)) &&\n wordList\n ) {\n const start = listMetadata?.['mso-level-start-at']\n ? parseInt(listMetadata['mso-level-start-at'])\n : NaN;\n const knownLevel = wordKnownLevels?.get(wordList) || [];\n\n if (start != undefined && !isNaN(start) && knownLevel.length != levels.length) {\n listItem.levels[listItem.levels.length - 1].format.startNumberOverride = start;\n }\n }\n}\n\nfunction getLastNotEmptyBlock(listParent: ContentModelBlockGroup | undefined) {\n for (let index = (listParent?.blocks.length || 0) - 1; index > 0; index--) {\n const result = listParent?.blocks[index];\n if (result && !isEmpty(result)) {\n return result;\n }\n }\n\n return undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeNegativeTextIndentParser.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"removeNegativeTextIndentParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/WordDesktop/removeNegativeTextIndentParser.ts"],"names":[],"mappings":";;;;IAEA;;OAEG;IACI,IAAM,8BAA8B,GAAmC,UAAC,MAAM,EAAE,OAAO;;QAC1F,IAAI,MAAA,MAAM,CAAC,UAAU,0CAAE,UAAU,CAAC,GAAG,CAAC,EAAE;YACpC,OAAO,MAAM,CAAC,UAAU,CAAC;SAC5B;IACL,CAAC,CAAC;IAJW,QAAA,8BAA8B,kCAIzC","sourcesContent":["import type { FormatParser, TextIndentFormat } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const removeNegativeTextIndentParser: FormatParser<TextIndentFormat> = (format, element) => {\n if (format.textIndent?.startsWith('-')) {\n delete format.textIndent;\n }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/constants.ts"],"names":[],"mappings":";;;;IAAA;;OAEG;IACU,QAAA,kBAAkB,GAAG;QAC9B;;WAEG;QACH,sBAAsB,EAAE,2BAA2B;QAEnD;;WAEG;QACH,YAAY,EAAE,QAAQ;QAEtB;;WAEG;QACH,4BAA4B,EAAE,SAAS;KAC1C,CAAC","sourcesContent":["/**\n * @internal\n */\nexport const PastePropertyNames = {\n /**\n * Node attribute used to identify if the content is from Google Sheets.\n */\n GOOGLE_SHEET_NODE_NAME: 'google-sheets-html-origin',\n\n /**\n * Name of the HTMLMeta Property that provides the Office App Source of the pasted content\n */\n PROG_ID_NAME: 'ProgId',\n\n /**\n * Name of the HTMLMeta Property that identifies pated content as from Excel Desktop\n */\n EXCEL_DESKTOP_ATTRIBUTE_NAME: 'xmlns:x',\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentContainWacElements.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"documentContainWacElements.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/documentContainWacElements.ts"],"names":[],"mappings":";;;;IAGA;;;;;OAKG;IACI,IAAM,0BAA0B,GAAsB,UAAA,KAAK;QACtD,IAAA,QAAQ,GAAK,KAAK,SAAV,CAAW;QAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,iCAAqB,CAAC,CAAC;IAC3D,CAAC,CAAC;IAHW,QAAA,0BAA0B,8BAGrC","sourcesContent":["import { WAC_IDENTIFY_SELECTOR } from '../WacComponents/constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\n/**\n * @internal\n * Check whether the fragment provided contain Wac Elements\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const documentContainWacElements: GetSourceFunction = props => {\n const { fragment } = props;\n return !!fragment.querySelector(WAC_IDENTIFY_SELECTOR);\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPasteSource.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"getPasteSource.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/getPasteSource.ts"],"names":[],"mappings":";;;;IAsCA,IAAM,kBAAkB,GAAG,IAAI,GAAG,CAA0C;QACxE,CAAC,aAAa,EAAE,6CAAqB,CAAC;QACtC,CAAC,cAAc,EAAE,+CAAsB,CAAC;QACxC,CAAC,aAAa,EAAE,6CAAqB,CAAC;QACtC,CAAC,mBAAmB,EAAE,yDAA2B,CAAC;QAClD,CAAC,eAAe,EAAE,uDAA0B,CAAC;QAC7C,CAAC,cAAc,EAAE,6CAAqB,CAAC;QACvC,CAAC,aAAa,EAAE,uDAA0B,CAAC;KAC9C,CAAC,CAAC;IAEH;;;;;;OAMG;IACH,SAAgB,cAAc,CAC1B,KAAuB,EACvB,wBAAiC;QAEzB,IAAA,cAAc,GAA8B,KAAK,eAAnC,EAAE,aAAa,GAAe,KAAK,cAApB,EAAE,QAAQ,GAAK,KAAK,SAAV,CAAW;QAE1D,IAAI,MAAM,GAAgC,IAAI,CAAC;QAC/C,IAAM,KAAK,GAAyB;YAChC,cAAc,gBAAA;YACd,QAAQ,UAAA;YACR,wBAAwB,0BAAA;YACxB,aAAa,eAAA;SAChB,CAAC;QAEF,kBAAkB,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,GAAG;YACjC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE;gBACxB,MAAM,GAAG,GAAG,CAAC;aAChB;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS,CAAC;IAC/B,CAAC;IArBD,wCAqBC","sourcesContent":["import { documentContainWacElements } from './documentContainWacElements';\nimport { isExcelDesktopDocument } from './isExcelDesktopDocument';\nimport { isExcelOnlineDocument } from './isExcelOnlineDocument';\nimport { isGoogleSheetDocument } from './isGoogleSheetDocument';\nimport { isPowerPointDesktopDocument } from './isPowerPointDesktopDocument';\nimport { isWordDesktopDocument } from './isWordDesktopDocument';\nimport { shouldConvertToSingleImage } from './shouldConvertToSingleImage';\nimport type { BeforePasteEvent, ClipboardData } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport type GetSourceInputParams = {\n htmlAttributes: Record<string, string>;\n fragment: DocumentFragment;\n shouldConvertSingleImage: boolean;\n clipboardData: ClipboardData;\n};\n\n/**\n * @internal\n * Represent the types of sources to handle in the Paste Plugin\n */\nexport type KnownPasteSourceType =\n | 'wordDesktop'\n | 'excelDesktop'\n | 'excelOnline'\n | 'powerPointDesktop'\n | 'googleSheets'\n | 'wacComponents'\n | 'default'\n | 'singleImage';\n\n/**\n * @internal\n */\nexport type GetSourceFunction = (props: GetSourceInputParams) => boolean;\n\nconst getSourceFunctions = new Map<KnownPasteSourceType, GetSourceFunction>([\n ['wordDesktop', isWordDesktopDocument],\n ['excelDesktop', isExcelDesktopDocument],\n ['excelOnline', isExcelOnlineDocument],\n ['powerPointDesktop', isPowerPointDesktopDocument],\n ['wacComponents', documentContainWacElements],\n ['googleSheets', isGoogleSheetDocument],\n ['singleImage', shouldConvertToSingleImage],\n]);\n\n/**\n * @internal\n * This function tries to get the source of the Pasted content\n * @param event the before paste event\n * @param shouldConvertSingleImage Whether convert single image is enabled.\n * @returns The Type of pasted content, if no type found will return {KnownSourceType.Default}\n */\nexport function getPasteSource(\n event: BeforePasteEvent,\n shouldConvertSingleImage: boolean\n): KnownPasteSourceType {\n const { htmlAttributes, clipboardData, fragment } = event;\n\n let result: KnownPasteSourceType | null = null;\n const param: GetSourceInputParams = {\n htmlAttributes,\n fragment,\n shouldConvertSingleImage,\n clipboardData,\n };\n\n getSourceFunctions.forEach((func, key) => {\n if (!result && func(param)) {\n result = key;\n }\n });\n\n return result ?? 'default';\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isExcelDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"isExcelDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isExcelDesktopDocument.ts"],"names":[],"mappings":";;;;IAGA,IAAM,qBAAqB,GAAG,wCAAwC,CAAC;IAEvE;;;;;OAKG;IACI,IAAM,sBAAsB,GAAsB,UAAA,KAAK;QAClD,IAAA,cAAc,GAAK,KAAK,eAAV,CAAW;QACjC,wEAAwE;QACxE,OAAO,cAAc,CAAC,8BAAkB,CAAC,4BAA4B,CAAC,IAAI,qBAAqB,CAAC;IACpG,CAAC,CAAC;IAJW,QAAA,sBAAsB,0BAIjC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\nconst EXCEL_ATTRIBUTE_VALUE = 'urn:schemas-microsoft-com:office:excel';\n\n/**\n * @internal\n * Checks whether the Array provided contains strings that identify Excel Desktop documents\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isExcelDesktopDocument: GetSourceFunction = props => {\n const { htmlAttributes } = props;\n // The presence of this attribute confirms its origin from Excel Desktop\n return htmlAttributes[PastePropertyNames.EXCEL_DESKTOP_ATTRIBUTE_NAME] == EXCEL_ATTRIBUTE_VALUE;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isExcelOnlineDocument.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"isExcelOnlineDocument.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isExcelOnlineDocument.ts"],"names":[],"mappings":";;;;IAGA,wCAAwC;IACxC,IAAM,4BAA4B,GAAG,aAAa,CAAC;IAEnD;;;;;OAKG;IACI,IAAM,qBAAqB,GAAsB,UAAA,KAAK;QACjD,IAAA,cAAc,GAAK,KAAK,eAAV,CAAW;QACjC,iJAAiJ;QACjJ,OAAO,CACH,cAAc,CAAC,8BAAkB,CAAC,YAAY,CAAC,IAAI,4BAA4B;YAC/E,cAAc,CAAC,8BAAkB,CAAC,4BAA4B,CAAC,IAAI,SAAS,CAC/E,CAAC;IACN,CAAC,CAAC;IAPW,QAAA,qBAAqB,yBAOhC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\n// Excel Desktop also has this attribute\nconst EXCEL_ONLINE_ATTRIBUTE_VALUE = 'Excel.Sheet';\n\n/**\n * @internal\n * Checks whether the Array provided contains strings that identify Excel Online documents\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isExcelOnlineDocument: GetSourceFunction = props => {\n const { htmlAttributes } = props;\n // The presence of Excel.Sheet confirms its origin from Excel, the absence of EXCEL_DESKTOP_ATTRIBUTE_NAME confirms it is from the Online version\n return (\n htmlAttributes[PastePropertyNames.PROG_ID_NAME] == EXCEL_ONLINE_ATTRIBUTE_VALUE &&\n htmlAttributes[PastePropertyNames.EXCEL_DESKTOP_ATTRIBUTE_NAME] == undefined\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isGoogleSheetDocument.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"isGoogleSheetDocument.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isGoogleSheetDocument.ts"],"names":[],"mappings":";;;;IAGA;;;;;OAKG;IACI,IAAM,qBAAqB,GAAsB,UAAA,KAAK;QACjD,IAAA,QAAQ,GAAK,KAAK,SAAV,CAAW;QAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,8BAAkB,CAAC,sBAAsB,CAAC,CAAC;IAC/E,CAAC,CAAC;IAHW,QAAA,qBAAqB,yBAGhC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\n/**\n * @internal\n * Checks whether the fragment provided contain elements from Google sheets\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isGoogleSheetDocument: GetSourceFunction = props => {\n const { fragment } = props;\n return !!fragment.querySelector(PastePropertyNames.GOOGLE_SHEET_NODE_NAME);\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPowerPointDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"isPowerPointDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.ts"],"names":[],"mappings":";;;;IAGA,IAAM,0BAA0B,GAAG,kBAAkB,CAAC;IAEtD;;;;;OAKG;IACI,IAAM,2BAA2B,GAAsB,UAAA,KAAK;QAC/D,OAAO,KAAK,CAAC,cAAc,CAAC,8BAAkB,CAAC,YAAY,CAAC,IAAI,0BAA0B,CAAC;IAC/F,CAAC,CAAC;IAFW,QAAA,2BAA2B,+BAEtC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\nconst POWERPOINT_ATTRIBUTE_VALUE = 'PowerPoint.Slide';\n\n/**\n * @internal\n * Checks whether the Array provided contains strings that identify Power Point Desktop documents\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isPowerPointDesktopDocument: GetSourceFunction = props => {\n return props.htmlAttributes[PastePropertyNames.PROG_ID_NAME] == POWERPOINT_ATTRIBUTE_VALUE;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isWordDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"isWordDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isWordDesktopDocument.ts"],"names":[],"mappings":";;;;IAGA,IAAM,mBAAmB,GAAG,SAAS,CAAC;IACtC,IAAM,oBAAoB,GAAG,uCAAuC,CAAC;IACrE,IAAM,YAAY,GAAG,eAAe,CAAC;IAErC;;;;;OAKG;IACI,IAAM,qBAAqB,GAAsB,UAAA,KAAK;QACjD,IAAA,cAAc,GAAK,KAAK,eAAV,CAAW;QACjC,OAAO,CACH,cAAc,CAAC,mBAAmB,CAAC,IAAI,oBAAoB;YAC3D,cAAc,CAAC,8BAAkB,CAAC,YAAY,CAAC,IAAI,YAAY,CAClE,CAAC;IACN,CAAC,CAAC;IANW,QAAA,qBAAqB,yBAMhC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\nconst WORD_ATTRIBUTE_NAME = 'xmlns:w';\nconst WORD_ATTRIBUTE_VALUE = 'urn:schemas-microsoft-com:office:word';\nconst WORD_PROG_ID = 'Word.Document';\n\n/**\n * @internal\n * Checks whether the Array provided contains strings that identify Word Desktop documents\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isWordDesktopDocument: GetSourceFunction = props => {\n const { htmlAttributes } = props;\n return (\n htmlAttributes[WORD_ATTRIBUTE_NAME] == WORD_ATTRIBUTE_VALUE ||\n htmlAttributes[PastePropertyNames.PROG_ID_NAME] == WORD_PROG_ID\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shouldConvertToSingleImage.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"shouldConvertToSingleImage.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.ts"],"names":[],"mappings":";;;;IAEA;;;;;;OAMG;IACI,IAAM,0BAA0B,GAAsB,UAAA,KAAK;;QACtD,IAAA,wBAAwB,GAAoB,KAAK,yBAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QAC1D,OAAO,CACH,wBAAwB;YACxB,CAAA,MAAA,aAAa,CAAC,uBAAuB,0CAAE,MAAM,KAAI,CAAC;YAClD,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,KAAK,CACpD,CAAC;IACN,CAAC,CAAC;IAPW,QAAA,0BAA0B,8BAOrC","sourcesContent":["import type { GetSourceFunction } from './getPasteSource';\n\n/**\n * @internal\n * Checks whether the fragment only contains a single image to paste\n * and the editor have the ConvertSingleImageBody Experimental feature\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const shouldConvertToSingleImage: GetSourceFunction = props => {\n const { shouldConvertSingleImage, clipboardData } = props;\n return (\n shouldConvertSingleImage &&\n clipboardData.htmlFirstLevelChildTags?.length == 1 &&\n clipboardData.htmlFirstLevelChildTags[0] == 'IMG'\n );\n};\n"]}
|
|
@@ -2,4 +2,4 @@ import type { ContentModelFormatMap, DomToModelOption, FormatParser, ElementForm
|
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export declare function addParser<TKey extends keyof ElementFormatParserPerCategory>(domToModelOption: DomToModelOption, entry: TKey, additionalFormatParsers: FormatParser<ContentModelFormatMap[TKey]>): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports"], function (require, exports) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.addParser = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
@@ -14,6 +15,6 @@ define(["require", "exports"], function (require, exports) {
|
|
|
14
15
|
}
|
|
15
16
|
(_a = domToModelOption.additionalFormatParsers[entry]) === null || _a === void 0 ? void 0 : _a.push(additionalFormatParsers);
|
|
16
17
|
}
|
|
17
|
-
exports.
|
|
18
|
+
exports.addParser = addParser;
|
|
18
19
|
});
|
|
19
20
|
//# sourceMappingURL=addParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addParser.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"addParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/utils/addParser.ts"],"names":[],"mappings":";;;;IAOA;;OAEG;IACH,SAAgB,SAAS,CACrB,gBAAkC,EAClC,KAAW,EACX,uBAAkE;;QAElE,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE;YAC3C,gBAAgB,CAAC,uBAAuB,GAAG,EAAE,CAAC;SACjD;QACD,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE;YAClD,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;SACxD;QAED,MAAA,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,0CAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACnF,CAAC;IAbD,8BAaC","sourcesContent":["import type {\n ContentModelFormatMap,\n DomToModelOption,\n FormatParser,\n ElementFormatParserPerCategory,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function addParser<TKey extends keyof ElementFormatParserPerCategory>(\n domToModelOption: DomToModelOption,\n entry: TKey,\n additionalFormatParsers: FormatParser<ContentModelFormatMap[TKey]>\n) {\n if (!domToModelOption.additionalFormatParsers) {\n domToModelOption.additionalFormatParsers = {};\n }\n if (!domToModelOption.additionalFormatParsers[entry]) {\n domToModelOption.additionalFormatParsers[entry] = [];\n }\n\n domToModelOption.additionalFormatParsers[entry]?.push(additionalFormatParsers);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecatedColorParser.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"deprecatedColorParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/utils/deprecatedColorParser.ts"],"names":[],"mappings":";;;;IAGA;;OAEG;IACI,IAAM,2BAA2B,GAA+B,UACnE,MAAoB;QAEpB,wCAAU,CAAC,OAAO,CAAC,UAAA,GAAG;YAClB,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1B,IAAI,KAAK,GAAW,EAAE,CAAC;YACvB,IACI,KAAK;gBACL,8CAAgB,CAAC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,EAA9C,CAA8C,CAAC,EACjF;gBACE,IAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;gBACtD,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;aAC1B;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAdW,QAAA,2BAA2B,+BActC","sourcesContent":["import { BorderKeys, DeprecatedColors } from 'roosterjs-content-model-dom';\nimport type { BorderFormat, FormatParser } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const deprecatedBorderColorParser: FormatParser<BorderFormat> = (\n format: BorderFormat\n): void => {\n BorderKeys.forEach(key => {\n const value = format[key];\n let color: string = '';\n if (\n value &&\n DeprecatedColors.some(dColor => value.indexOf(dColor) > -1 && (color = dColor))\n ) {\n const newValue = value.replace(color, '').trimRight();\n format[key] = newValue;\n }\n });\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStyles.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"getStyles.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/utils/getStyles.ts"],"names":[],"mappings":";;;;IAAA;;;;OAIG;IACH,SAAgB,SAAS,CAAC,OAAoB;QAC1C,IAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,IAAM,KAAK,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC,OAAO,CAAC,KAAI,EAAE,CAAC;QACnD,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAA,IAAI;YACzB,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACrC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;YACvC,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YACzC,IAAI,IAAI,IAAI,KAAK,EAAE;gBACf,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;aACtC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC;IAZD,8BAYC","sourcesContent":["/**\n * @internal\n * Get CSS styles of a given element in name-value pair format\n * @param element The element to get styles from\n */\nexport function getStyles(element: HTMLElement): Record<string, string> {\n const result: Record<string, string> = {};\n const style = element?.getAttribute('style') || '';\n style.split(';').forEach(pair => {\n const valueIndex = pair.indexOf(':');\n const name = pair.slice(0, valueIndex);\n const value = pair.slice(valueIndex + 1);\n if (name && value) {\n result[name.trim()] = value.trim();\n }\n });\n return result;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkParser.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"linkParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/utils/linkParser.ts"],"names":[],"mappings":";;;;IAGA,IAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACjF,IAAM,mBAAmB,GAAG,yBAAyB,CAAC;IAEtD;;OAEG;IACI,IAAM,SAAS,GAA8C,UAAC,MAAM,EAAE,OAAO;QAChF,IAAI,CAAC,IAAA,6CAAe,EAAC,OAAO,EAAE,GAAG,CAAC,EAAE;YAChC,OAAO;SACV;QAED,IAAI,GAAoB,CAAC;QACzB,IAAI;YACA,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC/B;QAAC,WAAM;YACJ,GAAG,GAAG,SAAS,CAAC;SACnB;QAED,IACI,CAAC,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACzD,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EACxC;YACE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;SACpB;IACL,CAAC,CAAC;IAnBW,QAAA,SAAS,aAmBpB","sourcesContent":["import { isElementOfType } from 'roosterjs-content-model-dom';\nimport type { ContentModelHyperLinkFormat, FormatParser } from 'roosterjs-content-model-types';\n\nconst SUPPORTED_PROTOCOLS = ['http:', 'https:', 'notes:', 'mailto:', 'onenote:'];\nconst INVALID_LINKS_REGEX = /^file:\\/\\/\\/[a-zA-Z\\/]/i;\n\n/**\n * @internal\n */\nexport const parseLink: FormatParser<ContentModelHyperLinkFormat> = (format, element) => {\n if (!isElementOfType(element, 'a')) {\n return;\n }\n\n let url: URL | undefined;\n try {\n url = new URL(element.href);\n } catch {\n url = undefined;\n }\n\n if (\n (url && SUPPORTED_PROTOCOLS.indexOf(url.protocol) === -1) ||\n INVALID_LINKS_REGEX.test(element.href)\n ) {\n element.removeAttribute('href');\n format.href = '';\n }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setProcessor.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setProcessor.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/utils/setProcessor.ts"],"names":[],"mappings":";;;;IAEA;;OAEG;IACH,SAAgB,YAAY,CACxB,gBAAkC,EAClC,KAAW,EACX,iBAAqD;QAErD,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE;YACrC,gBAAgB,CAAC,iBAAiB,GAAG,EAAE,CAAC;SAC3C;QAED,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC;IAClE,CAAC;IAVD,oCAUC","sourcesContent":["import type { DomToModelOption, ElementProcessorMap } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function setProcessor<TKey extends keyof ElementProcessorMap>(\n domToModelOption: DomToModelOption,\n entry: TKey,\n processorOverride: Partial<ElementProcessorMap>[TKey]\n) {\n if (!domToModelOption.processorOverride) {\n domToModelOption.processorOverride = {};\n }\n\n domToModelOption.processorOverride[entry] = processorOverride;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @internal
|
|
3
3
|
* An interface represents the data for creating element used by createElement()
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export interface CreateElementData {
|
|
6
6
|
/**
|
|
7
7
|
* Tag name of this element.
|
|
8
8
|
* It can be just a tag, or in format "namespace:tag"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateElementData.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"CreateElementData.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/CreateElement/CreateElementData.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n * An interface represents the data for creating element used by createElement()\n */\nexport interface CreateElementData {\n /**\n * Tag name of this element.\n * It can be just a tag, or in format \"namespace:tag\"\n */\n tag: string;\n\n /**\n * Namespace of this tag\n */\n namespace?: string;\n\n /**\n * CSS class name\n */\n className?: string;\n\n /**\n * CSS style\n */\n style?: string;\n\n /**\n * Dataset of this element\n */\n dataset?: Record<string, string>;\n\n /**\n * Additional attributes of this element\n */\n attributes?: Record<string, string>;\n\n /**\n * Child nodes of this element, can be another CreateElementData, or a string which represents a text node\n */\n children?: (CreateElementData | string)[];\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type CreateElementData from './CreateElementData';
|
|
1
|
+
import type { CreateElementData } from './CreateElementData';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
* Create DOM element from the given CreateElementData
|
|
@@ -6,4 +6,4 @@ import type CreateElementData from './CreateElementData';
|
|
|
6
6
|
* @param document The document to create the element from
|
|
7
7
|
* @returns The root DOM element just created
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function createElement(elementData: CreateElementData, document: Document): Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createElement = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
* Create DOM element from the given CreateElementData
|
|
@@ -47,6 +48,6 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require,
|
|
|
47
48
|
}
|
|
48
49
|
return result;
|
|
49
50
|
}
|
|
50
|
-
exports.
|
|
51
|
+
exports.createElement = createElement;
|
|
51
52
|
});
|
|
52
53
|
//# sourceMappingURL=createElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createElement.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"createElement.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/CreateElement/createElement.ts"],"names":[],"mappings":";;;;IAGA;;;;;;OAMG;IACH,SAAgB,aAAa,CAAC,WAA8B,EAAE,QAAkB;QAC5E,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE;YAClC,OAAO,IAAI,CAAC;SACf;QAEO,IAAA,GAAG,GAAiE,WAAW,IAA5E,EAAE,SAAS,GAA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,CAAC,CAAC;oBACpD,IAAI,YAAY,EAAE;wBACd,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;qBACpC;iBACJ;YACL,CAAC,CAAC,CAAC;SACN;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IA5CD,sCA4CC","sourcesContent":["import { getObjectKeys, isNodeOfType } from 'roosterjs-content-model-dom';\nimport type { CreateElementData } from './CreateElementData';\n\n/**\n * @internal\n * Create DOM element from the given CreateElementData\n * @param elementData The CreateElementData or an index of a known CreateElementData used for creating this element\n * @param document The document to create the element from\n * @returns The root DOM element just created\n */\nexport function createElement(elementData: CreateElementData, document: Document): Element | null {\n if (!elementData || !elementData.tag) {\n return null;\n }\n\n const { tag, namespace, className, style, dataset, attributes, children } = elementData;\n const result = namespace\n ? document.createElementNS(namespace, tag)\n : document.createElement(tag);\n\n if (style) {\n result.setAttribute('style', style);\n }\n\n if (className) {\n result.className = className;\n }\n\n if (dataset && isNodeOfType(result, 'ELEMENT_NODE')) {\n getObjectKeys(dataset).forEach(datasetName => {\n result.dataset[datasetName] = dataset[datasetName];\n });\n }\n\n if (attributes) {\n getObjectKeys(attributes).forEach(attrName => {\n result.setAttribute(attrName, attributes[attrName]);\n });\n }\n\n if (children) {\n children.forEach(child => {\n if (typeof child === 'string') {\n result.appendChild(document.createTextNode(child));\n } else if (child) {\n const childElement = createElement(child, document);\n if (childElement) {\n result.appendChild(childElement);\n }\n }\n });\n }\n\n return result;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Disposable.js","sourceRoot":"","sources":["../../../../packages
|
|
1
|
+
{"version":3,"file":"Disposable.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/Disposable.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n * Represents a disposable object\n */\nexport interface Disposable {\n /**\n * Dispose this object\n */\n dispose: () => void;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @internal
|
|
3
3
|
* Drag and drop handler interface, used for implementing a handler object and pass into DragAndDropHelper class
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export interface DragAndDropHandler<TContext, TInitValue> {
|
|
6
6
|
/**
|
|
7
7
|
* A callback that will be called when user starts to drag (mouse down event from the trigger element)
|
|
8
8
|
* @param context The context object that was passed into DragAndDropHelper from its constructor. We can use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragAndDropHandler.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"DragAndDropHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/DragAndDrop/DragAndDropHandler.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n * Drag and drop handler interface, used for implementing a handler object and pass into DragAndDropHelper class\n */\nexport interface DragAndDropHandler<TContext, TInitValue> {\n /**\n * A callback that will be called when user starts to drag (mouse down event from the trigger element)\n * @param context The context object that was passed into DragAndDropHelper from its constructor. We can use\n * this object to communicate between caller code and this handler\n * @param event The mouse event that triggers this callback\n * @returns An optional object, which will be passed into onDragging and onDragEnd callback. It normally used\n * for passing an initial state of the target object\n */\n onDragStart?: (context: TContext, event: MouseEvent) => TInitValue;\n\n /**\n * A callback that will be called when user moves mouse and drag the trigger element.\n * @param context The context object that was passed into DragAndDropHelper from its constructor. We can use\n * this object to communicate between caller code and this handler.If an object is used as context, here it will\n * be the same object that passed into constructor of DragAndDropHelper class. Inside this callback you can change\n * its sub value so that caller can get the changed result.\n * @param event The mouse event that triggers this callback\n * @param initValue The initial value that is returned from onDragStart callback. It normally used\n * for passing an initial state of the target object\n * @param deltaX x delta value. It equals to current event.pageX - initial pageX (captured when mousedown happens)\n * @param deltaY y delta value. It equals to current event.pageY - initial pageY (captured when mousedown happens)\n * @returns Whether the onSubmit callback passed into constructor of DragAndDropHelper class should be invoked.\n * Returns true will invoke the onSubmit callback, it means this is a meaningful dragging action, something (mostly\n * under context object) has been changed, and caller should handle this change. Otherwise, return false.\n */\n onDragging?: (\n context: TContext,\n event: MouseEvent,\n initValue: TInitValue,\n deltaX: number,\n deltaY: number\n ) => boolean;\n\n /**\n * A callback that will be called when user stops dragging the trigger element.\n * @param context The context object that was passed into DragAndDropHelper from its constructor. We can use\n * this object to communicate between caller code and this handler.If an object is used as context, here it will\n * be the same object that passed into constructor of DragAndDropHelper class. Inside this callback you can change\n * its sub value so that caller can get the changed result.\n * @param event The mouse event that triggers this callback\n * @param initValue The initial value that is returned from onDragStart callback. It normally used\n * for passing an initial state of the target object\n * @returns Whether the onSubmit callback passed into constructor of DragAndDropHelper class should be invoked.\n * Returns true will invoke the onSubmit callback, it means this is a meaningful dragging action, something (mostly\n * under context object) has been changed, and caller should handle this change. Otherwise, return false.\n */\n onDragEnd?: (\n context: TContext,\n event: MouseEvent,\n initValue: TInitValue | undefined\n ) => boolean;\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type Disposable from '../Disposable';
|
|
2
|
-
import type DragAndDropHandler from './DragAndDropHandler';
|
|
1
|
+
import type { Disposable } from '../Disposable';
|
|
2
|
+
import type { DragAndDropHandler } from './DragAndDropHandler';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
* A helper class to help manage drag and drop to an HTML element
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare class DragAndDropHelper<TContext, TInitValue> implements Disposable {
|
|
8
8
|
private trigger;
|
|
9
9
|
private context;
|
|
10
10
|
private onSubmit;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DragAndDropHelper = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers
|
|
6
7
|
*/
|
|
@@ -116,6 +117,6 @@ define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
|
|
|
116
117
|
};
|
|
117
118
|
return DragAndDropHelper;
|
|
118
119
|
}());
|
|
119
|
-
exports.
|
|
120
|
+
exports.DragAndDropHelper = DragAndDropHelper;
|
|
120
121
|
});
|
|
121
122
|
//# sourceMappingURL=DragAndDropHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragAndDropHelper.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"DragAndDropHelper.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/DragAndDrop/DragAndDropHelper.ts"],"names":[],"mappings":";;;;IA2BA;;OAEG;IACH,IAAM,wBAAwB,GAAmB,CAAC;QAC9C,OAAO;YACH,SAAS,EAAE,WAAW;YACtB,SAAS,EAAE,WAAW;YACtB,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,mBAAmB;SACjC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC;IAEL,IAAM,uBAAuB,GAAmB,CAAC;QAC7C,OAAO;YACH,SAAS,EAAE,YAAY;YACvB,SAAS,EAAE,WAAW;YACtB,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,mBAAmB;SACjC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC;IAEL,SAAS,mBAAmB,CAAC,CAAa;QACtC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,mBAAmB,CAAC,CAAa;QACtC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/C,IAAM,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YACjC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YACpB,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AAQ,IAAI,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YACxE,CAAC;;;WAAA;QAEO,6CAAiB,GAAzB;YACI,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;YACvC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YACrF,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACrF,CAAC;QAEO,gDAAoB,GAA5B;YACI,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;YACvC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YACxF,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACxF,CAAC;QA8BL,wBAAC;IAAD,CAAC,AAjFD,IAiFC;IAjFY,8CAAiB","sourcesContent":["import type { Disposable } from '../Disposable';\nimport type { DragAndDropHandler } from './DragAndDropHandler';\n\n/**\n * @internal\n */\ninterface MouseEventMoves {\n MOUSEDOWN: string;\n MOUSEMOVE: string;\n MOUSEUP: string;\n}\n\n/**\n * @internal\n */\ninterface MouseEventInfo extends MouseEventMoves {\n getPageXY: (e: MouseEvent) => number[];\n}\n\n/**\n * @internal\n * Compatible mouse event names for different platform\n */\ninterface TouchEventInfo extends MouseEventMoves {\n getPageXY: (e: TouchEvent) => number[];\n}\n\n/**\n * Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers\n */\nconst MOUSE_EVENT_INFO_DESKTOP: MouseEventInfo = (() => {\n return {\n MOUSEDOWN: 'mousedown',\n MOUSEMOVE: 'mousemove',\n MOUSEUP: 'mouseup',\n getPageXY: getMouseEventPageXY,\n };\n})();\n\nconst MOUSE_EVENT_INFO_MOBILE: TouchEventInfo = (() => {\n return {\n MOUSEDOWN: 'touchstart',\n MOUSEMOVE: 'touchmove',\n MOUSEUP: 'touchend',\n getPageXY: getTouchEventPageXY,\n };\n})();\n\nfunction getMouseEventPageXY(e: MouseEvent): [number, number] {\n return [e.pageX, e.pageY];\n}\n\nfunction getTouchEventPageXY(e: TouchEvent): [number, number] {\n let pageX = 0;\n let pageY = 0;\n if (e.targetTouches && e.targetTouches.length > 0) {\n const touch = e.targetTouches[0];\n pageX = touch.pageX;\n pageY = touch.pageY;\n }\n return [pageX, pageY];\n}\n\n/**\n * @internal\n * A helper class to help manage drag and drop to an HTML element\n */\nexport class DragAndDropHelper<TContext, TInitValue> implements Disposable {\n private initX: number = 0;\n private initY: number = 0;\n private initValue: TInitValue | undefined = undefined;\n private dndMouse: MouseEventInfo | TouchEventInfo;\n\n /**\n * Create a new instance of DragAndDropHelper class\n * @param trigger The trigger element. When user start drag on this element,\n * events will be fired to the handler object\n * @param context Context object that will be passed to handler function when event is fired,\n * so that the handler object knows which element it is triggered from.\n * @param onSubmit A callback that will be invoked when event handler in handler object returns true\n * @param handler The event handler object, see DragAndDropHandler interface for more information\n * @param zoomScale The zoom scale of the editor\n * @param forceMobile A boolean to force the use of touch controls for the helper\n */\n constructor(\n private trigger: HTMLElement,\n private context: TContext,\n private onSubmit: (context: TContext, trigger: HTMLElement) => void,\n private handler: DragAndDropHandler<TContext, TInitValue>,\n private zoomScale: number,\n forceMobile?: boolean\n ) {\n this.dndMouse = forceMobile ? MOUSE_EVENT_INFO_MOBILE : MOUSE_EVENT_INFO_DESKTOP;\n trigger.addEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\n }\n\n /**\n * Dispose this object, remove all event listeners that has been attached\n */\n dispose() {\n this.trigger.removeEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\n this.removeDocumentEvents();\n }\n\n public get mouseType(): string {\n return this.dndMouse == MOUSE_EVENT_INFO_MOBILE ? 'touch' : 'mouse';\n }\n\n private addDocumentEvents() {\n const doc = this.trigger.ownerDocument;\n doc.addEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\n doc.addEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\n }\n\n private removeDocumentEvents() {\n const doc = this.trigger.ownerDocument;\n doc.removeEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\n doc.removeEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\n }\n\n private onMouseDown = (e: Event) => {\n e.preventDefault();\n e.stopPropagation();\n this.addDocumentEvents();\n [this.initX, this.initY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\n this.initValue = this.handler.onDragStart?.(this.context, e as MouseEvent);\n };\n\n private onMouseMove = (e: Event) => {\n e.preventDefault();\n const [pageX, pageY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\n const deltaX = (pageX - this.initX) / this.zoomScale;\n const deltaY = (pageY - this.initY) / this.zoomScale;\n if (\n this.initValue &&\n this.handler.onDragging?.(this.context, e as MouseEvent, this.initValue, deltaX, deltaY)\n ) {\n this.onSubmit?.(this.context, this.trigger);\n }\n };\n\n private onMouseUp = (e: Event) => {\n e.preventDefault();\n this.removeDocumentEvents();\n if (this.handler.onDragEnd?.(this.context, e as MouseEvent, this.initValue)) {\n this.onSubmit?.(this.context, this.trigger);\n }\n };\n}\n"]}
|
|
@@ -24,4 +24,4 @@ import type { Rect } from 'roosterjs-content-model-types';
|
|
|
24
24
|
* @param additionalRects additional rects to use
|
|
25
25
|
* @returns If the Rect is valid return the rect, if not, return null.
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export declare function getIntersectedRect(elements: HTMLElement[], additionalRects?: Rect[]): Rect | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getIntersectedRect = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Get the intersected Rect of elements provided
|
|
6
7
|
*
|
|
@@ -29,7 +30,7 @@ define(["require", "exports", "tslib", "./normalizeRect"], function (require, ex
|
|
|
29
30
|
function getIntersectedRect(elements, additionalRects) {
|
|
30
31
|
if (additionalRects === void 0) { additionalRects = []; }
|
|
31
32
|
var rects = elements
|
|
32
|
-
.map(function (element) { return (0,
|
|
33
|
+
.map(function (element) { return (0, roosterjs_content_model_dom_1.normalizeRect)(element.getBoundingClientRect()); })
|
|
33
34
|
.concat(additionalRects)
|
|
34
35
|
.filter(function (element) { return !!element; });
|
|
35
36
|
var result = {
|
|
@@ -40,6 +41,6 @@ define(["require", "exports", "tslib", "./normalizeRect"], function (require, ex
|
|
|
40
41
|
};
|
|
41
42
|
return result.top < result.bottom && result.left < result.right ? result : null;
|
|
42
43
|
}
|
|
43
|
-
exports.
|
|
44
|
+
exports.getIntersectedRect = getIntersectedRect;
|
|
44
45
|
});
|
|
45
46
|
//# sourceMappingURL=getIntersectedRect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/Rect/getIntersectedRect.ts"],"names":[],"mappings":";;;;IAGA;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAgB,kBAAkB,CAC9B,QAAuB,EACvB,eAA4B;QAA5B,gCAAA,EAAA,oBAA4B;QAE5B,IAAM,KAAK,GAAG,QAAQ;aACjB,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,IAAA,2CAAa,EAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,EAA9C,CAA8C,CAAC;aAC9D,MAAM,CAAC,eAAe,CAAC;aACvB,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAW,CAAC;QAE5C,IAAM,MAAM,GAAS;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,UAAC;YACvC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC,UAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,UAAC;YACzC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,EAAP,CAAO,CAAC,UAAC;SAC9C,CAAC;QAEF,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACpF,CAAC;IAjBD,gDAiBC","sourcesContent":["import { normalizeRect } from 'roosterjs-content-model-dom';\nimport type { Rect } from 'roosterjs-content-model-types';\n\n/**\n * Get the intersected Rect of elements provided\n *\n * @example\n * The result of the following Elements Rects would be:\n {\n top: Element2.top,\n bottom: Element1.bottom,\n left: Element2.left,\n right: Element2.right\n }\n +-------------------------+\n | Element 1 |\n | +-----------------+ |\n | | Element2 | |\n | | | |\n | | | |\n +-------------------------+\n | |\n +-----------------+\n * @internal\n * @param elements Elements to use.\n * @param additionalRects additional rects to use\n * @returns If the Rect is valid return the rect, if not, return null.\n */\nexport function getIntersectedRect(\n elements: HTMLElement[],\n additionalRects: Rect[] = []\n): Rect | null {\n const rects = elements\n .map(element => normalizeRect(element.getBoundingClientRect()))\n .concat(additionalRects)\n .filter(element => !!element) as Rect[];\n\n const result: Rect = {\n top: Math.max(...rects.map(r => r.top)),\n bottom: Math.min(...rects.map(r => r.bottom)),\n left: Math.max(...rects.map(r => r.left)),\n right: Math.min(...rects.map(r => r.right)),\n };\n\n return result.top < result.bottom && result.left < result.right ? result : null;\n}\n"]}
|