roosterjs-content-model-plugins 0.26.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/autoFormat/AutoFormatPlugin.d.ts +53 -53
- package/lib/autoFormat/AutoFormatPlugin.js +80 -80
- package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib/autoFormat/keyboardListTrigger.d.ts +5 -5
- package/lib/autoFormat/keyboardListTrigger.js +45 -45
- package/lib/autoFormat/keyboardListTrigger.js.map +1 -1
- package/lib/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -7
- package/lib/autoFormat/utils/convertAlphaToDecimals.js +22 -22
- package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +1 -1
- package/lib/autoFormat/utils/getIndex.d.ts +4 -4
- package/lib/autoFormat/utils/getIndex.js +13 -13
- package/lib/autoFormat/utils/getIndex.js.map +1 -1
- package/lib/autoFormat/utils/getListTypeStyle.d.ts +14 -14
- package/lib/autoFormat/utils/getListTypeStyle.js +87 -87
- package/lib/autoFormat/utils/getListTypeStyle.js.map +1 -1
- package/lib/autoFormat/utils/getNumberingListStyle.d.ts +4 -4
- package/lib/autoFormat/utils/getNumberingListStyle.js +153 -153
- package/lib/autoFormat/utils/getNumberingListStyle.js.map +1 -1
- package/lib/edit/EditPlugin.d.ts +39 -39
- package/lib/edit/EditPlugin.js +128 -128
- package/lib/edit/EditPlugin.js.map +1 -1
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js +22 -22
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js +93 -93
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib/edit/deleteSteps/deleteList.d.ts +5 -5
- package/lib/edit/deleteSteps/deleteList.js +23 -23
- package/lib/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
- package/lib/edit/deleteSteps/deleteWordSelection.js +173 -173
- package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib/edit/handleKeyboardEventCommon.d.ts +14 -14
- package/lib/edit/handleKeyboardEventCommon.js +54 -54
- package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib/edit/inputSteps/handleEnterOnList.d.ts +5 -5
- package/lib/edit/inputSteps/handleEnterOnList.js +67 -67
- package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib/edit/keyboardDelete.d.ts +9 -9
- package/lib/edit/keyboardDelete.js +71 -71
- package/lib/edit/keyboardDelete.js.map +1 -1
- package/lib/edit/keyboardInput.d.ts +5 -5
- package/lib/edit/keyboardInput.js +58 -58
- package/lib/edit/keyboardInput.js.map +1 -1
- package/lib/edit/keyboardTab.d.ts +5 -5
- package/lib/edit/keyboardTab.js +34 -34
- package/lib/edit/keyboardTab.js.map +1 -1
- package/lib/edit/utils/getLeafSiblingBlock.d.ts +23 -23
- package/lib/edit/utils/getLeafSiblingBlock.js +75 -75
- package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
- package/lib/paste/Excel/processPastedContentFromExcel.js +82 -82
- package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib/paste/PastePlugin.d.ts +43 -43
- package/lib/paste/PastePlugin.js +130 -130
- package/lib/paste/PastePlugin.js.map +1 -1
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js +19 -19
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib/paste/WacComponents/constants.d.ts +48 -48
- package/lib/paste/WacComponents/constants.js +62 -62
- package/lib/paste/WacComponents/constants.js.map +1 -1
- package/lib/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
- package/lib/paste/WacComponents/processPastedContentWacComponents.js +188 -188
- package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib/paste/WordDesktop/WordMetadata.d.ts +9 -9
- package/lib/paste/WordDesktop/WordMetadata.js +2 -2
- package/lib/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
- package/lib/paste/WordDesktop/getStyleMetadata.js +78 -78
- package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +58 -58
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib/paste/WordDesktop/processWordComments.d.ts +7 -7
- package/lib/paste/WordDesktop/processWordComments.js +21 -21
- package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib/paste/WordDesktop/processWordLists.d.ts +11 -11
- package/lib/paste/WordDesktop/processWordLists.js +179 -179
- package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
- package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js +13 -13
- package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib/paste/pasteSourceValidations/constants.d.ts +17 -17
- package/lib/paste/pasteSourceValidations/constants.js +20 -20
- package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/documentContainWacElements.js +15 -15
- package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
- package/lib/paste/pasteSourceValidations/getPasteSource.js +43 -43
- package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js +17 -17
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js +19 -19
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js +15 -15
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +15 -15
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js +19 -19
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
- package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js +18 -18
- package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib/paste/utils/addParser.d.ts +5 -5
- package/lib/paste/utils/addParser.js +16 -16
- package/lib/paste/utils/addParser.js.map +1 -1
- package/lib/paste/utils/deprecatedColorParser.d.ts +5 -5
- package/lib/paste/utils/deprecatedColorParser.js +19 -19
- package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib/paste/utils/getStyles.d.ts +6 -6
- package/lib/paste/utils/getStyles.js +22 -22
- package/lib/paste/utils/getStyles.js.map +1 -1
- package/lib/paste/utils/linkParser.d.ts +5 -5
- package/lib/paste/utils/linkParser.js +27 -27
- package/lib/paste/utils/linkParser.js.map +1 -1
- package/lib/paste/utils/setProcessor.d.ts +5 -5
- package/lib/paste/utils/setProcessor.js +13 -13
- package/lib/paste/utils/setProcessor.js.map +1 -1
- package/lib/pluginUtils/CreateElement/CreateElementData.d.ts +35 -35
- package/lib/pluginUtils/CreateElement/CreateElementData.js +2 -2
- package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib/pluginUtils/CreateElement/createElement.d.ts +9 -9
- package/lib/pluginUtils/CreateElement/createElement.js +50 -50
- package/lib/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib/pluginUtils/Disposable.d.ts +10 -10
- package/lib/pluginUtils/Disposable.js +2 -2
- package/lib/pluginUtils/Disposable.js.map +1 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -45
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js +2 -2
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -39
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +119 -119
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +27 -27
- package/lib/pluginUtils/Rect/getIntersectedRect.js +44 -44
- package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib/pluginUtils/Rect/normalizeRect.d.ts +7 -7
- package/lib/pluginUtils/Rect/normalizeRect.js +19 -19
- package/lib/pluginUtils/Rect/normalizeRect.js.map +1 -1
- package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +53 -53
- package/lib-amd/autoFormat/AutoFormatPlugin.js +81 -81
- package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-amd/autoFormat/keyboardListTrigger.d.ts +5 -5
- package/lib-amd/autoFormat/keyboardListTrigger.js +43 -43
- package/lib-amd/autoFormat/keyboardListTrigger.js.map +1 -1
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -7
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js +24 -24
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +1 -1
- package/lib-amd/autoFormat/utils/getIndex.d.ts +4 -4
- package/lib-amd/autoFormat/utils/getIndex.js +14 -14
- package/lib-amd/autoFormat/utils/getIndex.js.map +1 -1
- package/lib-amd/autoFormat/utils/getListTypeStyle.d.ts +14 -14
- package/lib-amd/autoFormat/utils/getListTypeStyle.js +86 -86
- package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +1 -1
- package/lib-amd/autoFormat/utils/getNumberingListStyle.d.ts +4 -4
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js +153 -153
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +1 -1
- package/lib-amd/edit/EditPlugin.d.ts +39 -39
- package/lib-amd/edit/EditPlugin.js +127 -127
- package/lib-amd/edit/EditPlugin.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js +23 -23
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +92 -92
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteList.d.ts +5 -5
- package/lib-amd/edit/deleteSteps/deleteList.js +24 -24
- package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
- package/lib-amd/edit/deleteSteps/deleteWordSelection.js +172 -172
- package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-amd/edit/handleKeyboardEventCommon.d.ts +14 -14
- package/lib-amd/edit/handleKeyboardEventCommon.js +55 -55
- package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-amd/edit/inputSteps/handleEnterOnList.d.ts +5 -5
- package/lib-amd/edit/inputSteps/handleEnterOnList.js +66 -66
- package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-amd/edit/keyboardDelete.d.ts +9 -9
- package/lib-amd/edit/keyboardDelete.js +66 -66
- package/lib-amd/edit/keyboardDelete.js.map +1 -1
- package/lib-amd/edit/keyboardInput.d.ts +5 -5
- package/lib-amd/edit/keyboardInput.js +57 -57
- package/lib-amd/edit/keyboardInput.js.map +1 -1
- package/lib-amd/edit/keyboardTab.d.ts +5 -5
- package/lib-amd/edit/keyboardTab.js +34 -34
- package/lib-amd/edit/keyboardTab.js.map +1 -1
- package/lib-amd/edit/utils/getLeafSiblingBlock.d.ts +23 -23
- package/lib-amd/edit/utils/getLeafSiblingBlock.js +75 -75
- package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-amd/index.d.ts +3 -3
- package/lib-amd/index.js +8 -8
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js +80 -80
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-amd/paste/PastePlugin.d.ts +43 -43
- package/lib-amd/paste/PastePlugin.js +122 -122
- package/lib-amd/paste/PastePlugin.js.map +1 -1
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js +20 -20
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-amd/paste/WacComponents/constants.d.ts +48 -48
- package/lib-amd/paste/WacComponents/constants.js +63 -63
- package/lib-amd/paste/WacComponents/constants.js.map +1 -1
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +185 -185
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-amd/paste/WordDesktop/WordMetadata.d.ts +9 -9
- package/lib-amd/paste/WordDesktop/WordMetadata.js +4 -4
- package/lib-amd/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
- package/lib-amd/paste/WordDesktop/getStyleMetadata.js +78 -78
- package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +53 -53
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordComments.d.ts +7 -7
- package/lib-amd/paste/WordDesktop/processWordComments.js +22 -22
- package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordLists.d.ts +11 -11
- package/lib-amd/paste/WordDesktop/processWordLists.js +177 -177
- package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
- package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js +15 -15
- package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/constants.d.ts +17 -17
- package/lib-amd/paste/pasteSourceValidations/constants.js +22 -22
- package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js +16 -16
- package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.js +38 -38
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js +18 -18
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js +20 -20
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js +16 -16
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +16 -16
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js +20 -20
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
- package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js +20 -20
- package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib-amd/paste/utils/addParser.d.ts +5 -5
- package/lib-amd/paste/utils/addParser.js +18 -18
- package/lib-amd/paste/utils/addParser.js.map +1 -1
- package/lib-amd/paste/utils/deprecatedColorParser.d.ts +5 -5
- package/lib-amd/paste/utils/deprecatedColorParser.js +20 -20
- package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib-amd/paste/utils/getStyles.d.ts +6 -6
- package/lib-amd/paste/utils/getStyles.js +24 -24
- package/lib-amd/paste/utils/getStyles.js.map +1 -1
- package/lib-amd/paste/utils/linkParser.d.ts +5 -5
- package/lib-amd/paste/utils/linkParser.js +28 -28
- package/lib-amd/paste/utils/linkParser.js.map +1 -1
- package/lib-amd/paste/utils/setProcessor.d.ts +5 -5
- package/lib-amd/paste/utils/setProcessor.js +15 -15
- package/lib-amd/paste/utils/setProcessor.js.map +1 -1
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.d.ts +35 -35
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.js +4 -4
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +9 -9
- package/lib-amd/pluginUtils/CreateElement/createElement.js +51 -51
- package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib-amd/pluginUtils/Disposable.d.ts +10 -10
- package/lib-amd/pluginUtils/Disposable.js +4 -4
- package/lib-amd/pluginUtils/Disposable.js.map +1 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -45
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js +4 -4
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -39
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +120 -120
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +27 -27
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +44 -44
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +7 -7
- package/lib-amd/pluginUtils/Rect/normalizeRect.js +21 -21
- package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +1 -1
- package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +53 -53
- package/lib-mjs/autoFormat/AutoFormatPlugin.js +77 -77
- package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +5 -5
- package/lib-mjs/autoFormat/keyboardListTrigger.js +41 -41
- package/lib-mjs/autoFormat/keyboardListTrigger.js.map +1 -1
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -7
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js +18 -18
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +1 -1
- package/lib-mjs/autoFormat/utils/getIndex.d.ts +4 -4
- package/lib-mjs/autoFormat/utils/getIndex.js +9 -9
- package/lib-mjs/autoFormat/utils/getIndex.js.map +1 -1
- package/lib-mjs/autoFormat/utils/getListTypeStyle.d.ts +14 -14
- package/lib-mjs/autoFormat/utils/getListTypeStyle.js +83 -83
- package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +1 -1
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.d.ts +4 -4
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js +149 -149
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +1 -1
- package/lib-mjs/edit/EditPlugin.d.ts +39 -39
- package/lib-mjs/edit/EditPlugin.js +125 -125
- package/lib-mjs/edit/EditPlugin.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js +18 -18
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +90 -90
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteList.d.ts +5 -5
- package/lib-mjs/edit/deleteSteps/deleteList.js +19 -19
- package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.js +170 -170
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +14 -14
- package/lib-mjs/edit/handleKeyboardEventCommon.js +48 -48
- package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.d.ts +5 -5
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js +63 -63
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-mjs/edit/keyboardDelete.d.ts +9 -9
- package/lib-mjs/edit/keyboardDelete.js +67 -67
- package/lib-mjs/edit/keyboardDelete.js.map +1 -1
- package/lib-mjs/edit/keyboardInput.d.ts +5 -5
- package/lib-mjs/edit/keyboardInput.js +54 -54
- package/lib-mjs/edit/keyboardInput.js.map +1 -1
- package/lib-mjs/edit/keyboardTab.d.ts +5 -5
- package/lib-mjs/edit/keyboardTab.js +30 -30
- package/lib-mjs/edit/keyboardTab.js.map +1 -1
- package/lib-mjs/edit/utils/getLeafSiblingBlock.d.ts +23 -23
- package/lib-mjs/edit/utils/getLeafSiblingBlock.js +71 -71
- package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-mjs/index.d.ts +3 -3
- package/lib-mjs/index.js +3 -3
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +77 -77
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-mjs/paste/PastePlugin.d.ts +43 -43
- package/lib-mjs/paste/PastePlugin.js +127 -127
- package/lib-mjs/paste/PastePlugin.js.map +1 -1
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js +15 -15
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-mjs/paste/WacComponents/constants.d.ts +48 -48
- package/lib-mjs/paste/WacComponents/constants.js +59 -59
- package/lib-mjs/paste/WacComponents/constants.js.map +1 -1
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +184 -184
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/WordMetadata.d.ts +9 -9
- package/lib-mjs/paste/WordDesktop/WordMetadata.js +1 -1
- package/lib-mjs/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.js +75 -75
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +54 -54
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordComments.d.ts +7 -7
- package/lib-mjs/paste/WordDesktop/processWordComments.js +17 -17
- package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordLists.d.ts +11 -11
- package/lib-mjs/paste/WordDesktop/processWordLists.js +175 -175
- package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
- package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js +9 -9
- package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/constants.d.ts +17 -17
- package/lib-mjs/paste/pasteSourceValidations/constants.js +17 -17
- package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js +11 -11
- package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js +39 -39
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js +13 -13
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js +15 -15
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js +11 -11
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +11 -11
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js +15 -15
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
- package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js +14 -14
- package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib-mjs/paste/utils/addParser.d.ts +5 -5
- package/lib-mjs/paste/utils/addParser.js +13 -13
- package/lib-mjs/paste/utils/addParser.js.map +1 -1
- package/lib-mjs/paste/utils/deprecatedColorParser.d.ts +5 -5
- package/lib-mjs/paste/utils/deprecatedColorParser.js +15 -15
- package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib-mjs/paste/utils/getStyles.d.ts +6 -6
- package/lib-mjs/paste/utils/getStyles.js +18 -18
- package/lib-mjs/paste/utils/getStyles.js.map +1 -1
- package/lib-mjs/paste/utils/linkParser.d.ts +5 -5
- package/lib-mjs/paste/utils/linkParser.js +23 -23
- package/lib-mjs/paste/utils/linkParser.js.map +1 -1
- package/lib-mjs/paste/utils/setProcessor.d.ts +5 -5
- package/lib-mjs/paste/utils/setProcessor.js +9 -9
- package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.d.ts +35 -35
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js +1 -1
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +9 -9
- package/lib-mjs/pluginUtils/CreateElement/createElement.js +47 -47
- package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib-mjs/pluginUtils/Disposable.d.ts +10 -10
- package/lib-mjs/pluginUtils/Disposable.js +1 -1
- package/lib-mjs/pluginUtils/Disposable.js.map +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -45
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -39
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +117 -117
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +27 -27
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +41 -41
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +7 -7
- package/lib-mjs/pluginUtils/Rect/normalizeRect.js +16 -16
- package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { ContentModelBlock, ContentModelBlockGroup, ContentModelSegment } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export declare type BlockAndPath = {
|
|
6
|
-
/**
|
|
7
|
-
* The sibling block
|
|
8
|
-
*/
|
|
9
|
-
block: ContentModelBlock;
|
|
10
|
-
/**
|
|
11
|
-
* Path of this sibling block
|
|
12
|
-
*/
|
|
13
|
-
path: ContentModelBlockGroup[];
|
|
14
|
-
/**
|
|
15
|
-
* If the input block is under a general segment, it is possible there are sibling segments under the same paragraph.
|
|
16
|
-
* Use this property to return the sibling sibling under the same paragraph
|
|
17
|
-
*/
|
|
18
|
-
siblingSegment?: ContentModelSegment;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
export declare function getLeafSiblingBlock(path: ContentModelBlockGroup[], block: ContentModelBlock, isNext: boolean): BlockAndPath | null;
|
|
1
|
+
import type { ContentModelBlock, ContentModelBlockGroup, ContentModelSegment } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare type BlockAndPath = {
|
|
6
|
+
/**
|
|
7
|
+
* The sibling block
|
|
8
|
+
*/
|
|
9
|
+
block: ContentModelBlock;
|
|
10
|
+
/**
|
|
11
|
+
* Path of this sibling block
|
|
12
|
+
*/
|
|
13
|
+
path: ContentModelBlockGroup[];
|
|
14
|
+
/**
|
|
15
|
+
* If the input block is under a general segment, it is possible there are sibling segments under the same paragraph.
|
|
16
|
+
* Use this property to return the sibling sibling under the same paragraph
|
|
17
|
+
*/
|
|
18
|
+
siblingSegment?: ContentModelSegment;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function getLeafSiblingBlock(path: ContentModelBlockGroup[], block: ContentModelBlock, isNext: boolean): BlockAndPath | null;
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getLeafSiblingBlock = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
function getLeafSiblingBlock(path, block, isNext) {
|
|
9
|
-
var _a;
|
|
10
|
-
var newPath = (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(path), false);
|
|
11
|
-
var _loop_1 = function () {
|
|
12
|
-
var group = newPath[0];
|
|
13
|
-
var index = group.blocks.indexOf(block);
|
|
14
|
-
if (index < 0) {
|
|
15
|
-
return "break";
|
|
16
|
-
}
|
|
17
|
-
var nextBlock = group.blocks[index + (isNext ? 1 : -1)];
|
|
18
|
-
if (nextBlock) {
|
|
19
|
-
while (nextBlock.blockType == 'BlockGroup') {
|
|
20
|
-
var child = nextBlock.blocks[isNext ? 0 : nextBlock.blocks.length - 1];
|
|
21
|
-
if (!child) {
|
|
22
|
-
return { value: { block: nextBlock, path: newPath } };
|
|
23
|
-
}
|
|
24
|
-
else if (child.blockType != 'BlockGroup') {
|
|
25
|
-
newPath.unshift(nextBlock);
|
|
26
|
-
return { value: { block: child, path: newPath } };
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
newPath.unshift(nextBlock);
|
|
30
|
-
nextBlock = child;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return { value: { block: nextBlock, path: newPath } };
|
|
34
|
-
}
|
|
35
|
-
else if ((0, roosterjs_content_model_dom_1.isGeneralSegment)(group)) {
|
|
36
|
-
// For general segment, we need to check if there is sibling segment under the same paragraph
|
|
37
|
-
// First let's find the parent paragraph of this segment
|
|
38
|
-
newPath.shift();
|
|
39
|
-
var segmentIndex_1 = -1;
|
|
40
|
-
var segment_1 = group;
|
|
41
|
-
var para = (_a = newPath[0]) === null || _a === void 0 ? void 0 : _a.blocks.find(function (x) { return x.blockType == 'Paragraph' && (segmentIndex_1 = x.segments.indexOf(segment_1)) >= 0; });
|
|
42
|
-
if (para) {
|
|
43
|
-
// Now we have found the parent paragraph, so let's check if it has a sibling segment
|
|
44
|
-
var siblingSegment = para.segments[segmentIndex_1 + (isNext ? 1 : -1)];
|
|
45
|
-
if (siblingSegment) {
|
|
46
|
-
return { value: { block: para, path: newPath, siblingSegment: siblingSegment } };
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
// No sibling segment, let's keep go upper level
|
|
50
|
-
block = para;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return "break";
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else if (group.blockGroupType != 'Document' && group.blockGroupType != 'TableCell') {
|
|
58
|
-
newPath.shift();
|
|
59
|
-
block = group;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
return "break";
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
while (newPath.length > 0) {
|
|
66
|
-
var state_1 = _loop_1();
|
|
67
|
-
if (typeof state_1 === "object")
|
|
68
|
-
return state_1.value;
|
|
69
|
-
if (state_1 === "break")
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
exports.getLeafSiblingBlock = getLeafSiblingBlock;
|
|
75
|
-
});
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getLeafSiblingBlock = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function getLeafSiblingBlock(path, block, isNext) {
|
|
9
|
+
var _a;
|
|
10
|
+
var newPath = (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(path), false);
|
|
11
|
+
var _loop_1 = function () {
|
|
12
|
+
var group = newPath[0];
|
|
13
|
+
var index = group.blocks.indexOf(block);
|
|
14
|
+
if (index < 0) {
|
|
15
|
+
return "break";
|
|
16
|
+
}
|
|
17
|
+
var nextBlock = group.blocks[index + (isNext ? 1 : -1)];
|
|
18
|
+
if (nextBlock) {
|
|
19
|
+
while (nextBlock.blockType == 'BlockGroup') {
|
|
20
|
+
var child = nextBlock.blocks[isNext ? 0 : nextBlock.blocks.length - 1];
|
|
21
|
+
if (!child) {
|
|
22
|
+
return { value: { block: nextBlock, path: newPath } };
|
|
23
|
+
}
|
|
24
|
+
else if (child.blockType != 'BlockGroup') {
|
|
25
|
+
newPath.unshift(nextBlock);
|
|
26
|
+
return { value: { block: child, path: newPath } };
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
newPath.unshift(nextBlock);
|
|
30
|
+
nextBlock = child;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { value: { block: nextBlock, path: newPath } };
|
|
34
|
+
}
|
|
35
|
+
else if ((0, roosterjs_content_model_dom_1.isGeneralSegment)(group)) {
|
|
36
|
+
// For general segment, we need to check if there is sibling segment under the same paragraph
|
|
37
|
+
// First let's find the parent paragraph of this segment
|
|
38
|
+
newPath.shift();
|
|
39
|
+
var segmentIndex_1 = -1;
|
|
40
|
+
var segment_1 = group;
|
|
41
|
+
var para = (_a = newPath[0]) === null || _a === void 0 ? void 0 : _a.blocks.find(function (x) { return x.blockType == 'Paragraph' && (segmentIndex_1 = x.segments.indexOf(segment_1)) >= 0; });
|
|
42
|
+
if (para) {
|
|
43
|
+
// Now we have found the parent paragraph, so let's check if it has a sibling segment
|
|
44
|
+
var siblingSegment = para.segments[segmentIndex_1 + (isNext ? 1 : -1)];
|
|
45
|
+
if (siblingSegment) {
|
|
46
|
+
return { value: { block: para, path: newPath, siblingSegment: siblingSegment } };
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// No sibling segment, let's keep go upper level
|
|
50
|
+
block = para;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return "break";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (group.blockGroupType != 'Document' && group.blockGroupType != 'TableCell') {
|
|
58
|
+
newPath.shift();
|
|
59
|
+
block = group;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return "break";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
while (newPath.length > 0) {
|
|
66
|
+
var state_1 = _loop_1();
|
|
67
|
+
if (typeof state_1 === "object")
|
|
68
|
+
return state_1.value;
|
|
69
|
+
if (state_1 === "break")
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
exports.getLeafSiblingBlock = getLeafSiblingBlock;
|
|
75
|
+
});
|
|
76
76
|
//# sourceMappingURL=getLeafSiblingBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLeafSiblingBlock.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model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F,wDAAwD;gBACxD,OAAO,CAAC,KAAK,EAAE,CAAC;gBAEhB,IAAI,cAAY,GAAG,CAAC,CAAC,CAAC;gBACtB,IAAM,SAAO,GAAG,KAAK,CAAC;gBACtB,IAAM,IAAI,GAAG,MAAA,OAAO,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,IAAI,CAChC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,SAAS,IAAI,WAAW,IAAI,CAAC,cAAY,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAO,CAAC,CAAC,IAAI,CAAC,EAA/E,CAA+E,CAC9D,CAAC;gBAE3B,IAAI,IAAI,EAAE;oBACN,qFAAqF;oBACrF,IAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAY,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAEvE,IAAI,cAAc,EAAE;wCAET,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,gBAAA,EAAE;qBACxD;yBAAM;wBACH,gDAAgD;wBAChD,KAAK,GAAG,IAAI,CAAC;qBAChB;iBACJ;qBAAM;;iBAGN;aACJ;iBAAM,IAAI,KAAK,CAAC,cAAc,IAAI,UAAU,IAAI,KAAK,CAAC,cAAc,IAAI,WAAW,EAAE;gBAClF,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,KAAK,GAAG,KAAK,CAAC;aACjB;iBAAM;;aAEN;;QAzDL,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;;;;;;SA0DxB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IApED,kDAoEC","sourcesContent":["import { isGeneralSegment } from 'roosterjs-content-model-dom';\
|
|
1
|
+
{"version":3,"file":"getLeafSiblingBlock.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/utils/getLeafSiblingBlock.ts"],"names":[],"m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AC;gBAEhB,IAAI,cAAY,GAAG,CAAC,CAAC,CAAC;gBACtB,IAAM,SAAO,GAAG,KAAK,CAAC;gBACtB,IAAM,IAAI,GAAG,MAAA,OAAO,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,IAAI,CAChC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,SAAS,IAAI,WAAW,IAAI,CAAC,cAAY,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAO,CAAC,CAAC,IAAI,CAAC,EAA/E,CAA+E,CAC9D,CAAC;gBAE3B,IAAI,IAAI,EAAE;oBACN,qFAAqF;oBACrF,IAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAY,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAEvE,IAAI,cAAc,EAAE;wCAET,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,gBAAA,EAAE;qBACxD;yBAAM;wBACH,gDAAgD;wBAChD,KAAK,GAAG,IAAI,CAAC;qBAChB;iBACJ;qBAAM;;iBAGN;aACJ;iBAAM,IAAI,KAAK,CAAC,cAAc,IAAI,UAAU,IAAI,KAAK,CAAC,cAAc,IAAI,WAAW,EAAE;gBAClF,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,KAAK,GAAG,KAAK,CAAC;aACjB;iBAAM;;aAEN;;QAzDL,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;;;;;;SA0DxB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IApED,kDAoEC","sourcesContent":["import { isGeneralSegment } from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelParagraph,\n ContentModelSegment,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport type BlockAndPath = {\n /**\n * The sibling block\n */\n block: ContentModelBlock;\n\n /**\n * Path of this sibling block\n */\n path: ContentModelBlockGroup[];\n\n /**\n * If the input block is under a general segment, it is possible there are sibling segments under the same paragraph.\n * Use this property to return the sibling sibling under the same paragraph\n */\n siblingSegment?: ContentModelSegment;\n};\n\n/**\n * @internal\n */\nexport function getLeafSiblingBlock(\n path: ContentModelBlockGroup[],\n block: ContentModelBlock,\n isNext: boolean\n): BlockAndPath | null {\n const newPath = [...path];\n\n while (newPath.length > 0) {\n const group = newPath[0];\n const index = group.blocks.indexOf(block);\n\n if (index < 0) {\n break;\n }\n\n let nextBlock = group.blocks[index + (isNext ? 1 : -1)];\n\n if (nextBlock) {\n while (nextBlock.blockType == 'BlockGroup') {\n const child = nextBlock.blocks[isNext ? 0 : nextBlock.blocks.length - 1];\n\n if (!child) {\n return { block: nextBlock, path: newPath };\n } else if (child.blockType != 'BlockGroup') {\n newPath.unshift(nextBlock);\n return { block: child, path: newPath };\n } else {\n newPath.unshift(nextBlock);\n nextBlock = child;\n }\n }\n\n return { block: nextBlock, path: newPath };\n } else if (isGeneralSegment(group)) {\n // For general segment, we need to check if there is sibling segment under the same paragraph\n // First let's find the parent paragraph of this segment\n newPath.shift();\n\n let segmentIndex = -1;\n const segment = group;\n const para = newPath[0]?.blocks.find(\n x => x.blockType == 'Paragraph' && (segmentIndex = x.segments.indexOf(segment)) >= 0\n ) as ContentModelParagraph;\n\n if (para) {\n // Now we have found the parent paragraph, so let's check if it has a sibling segment\n const siblingSegment = para.segments[segmentIndex + (isNext ? 1 : -1)];\n\n if (siblingSegment) {\n // Return this block, path and segment since we have found it\n return { block: para, path: newPath, siblingSegment };\n } else {\n // No sibling segment, let's keep go upper level\n block = para;\n }\n } else {\n // Parent sibling is not found (in theory this should never happen), just return null\n break;\n }\n } else if (group.blockGroupType != 'Document' && group.blockGroupType != 'TableCell') {\n newPath.shift();\n block = group;\n } else {\n break;\n }\n }\n\n return null;\n}\n"]}
|
package/lib-amd/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { PastePlugin } from './paste/PastePlugin';
|
|
2
|
-
export { EditPlugin } from './edit/EditPlugin';
|
|
3
|
-
export { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';
|
|
1
|
+
export { PastePlugin } from './paste/PastePlugin';
|
|
2
|
+
export { EditPlugin } from './edit/EditPlugin';
|
|
3
|
+
export { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';
|
package/lib-amd/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
define(["require", "exports", "./paste/PastePlugin", "./edit/EditPlugin", "./autoFormat/AutoFormatPlugin"], function (require, exports, PastePlugin_1, EditPlugin_1, AutoFormatPlugin_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.AutoFormatPlugin = exports.EditPlugin = exports.PastePlugin = void 0;
|
|
5
|
-
Object.defineProperty(exports, "PastePlugin", { enumerable: true, get: function () { return PastePlugin_1.PastePlugin; } });
|
|
6
|
-
Object.defineProperty(exports, "EditPlugin", { enumerable: true, get: function () { return EditPlugin_1.EditPlugin; } });
|
|
7
|
-
Object.defineProperty(exports, "AutoFormatPlugin", { enumerable: true, get: function () { return AutoFormatPlugin_1.AutoFormatPlugin; } });
|
|
8
|
-
});
|
|
1
|
+
define(["require", "exports", "./paste/PastePlugin", "./edit/EditPlugin", "./autoFormat/AutoFormatPlugin"], function (require, exports, PastePlugin_1, EditPlugin_1, AutoFormatPlugin_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AutoFormatPlugin = exports.EditPlugin = exports.PastePlugin = void 0;
|
|
5
|
+
Object.defineProperty(exports, "PastePlugin", { enumerable: true, get: function () { return PastePlugin_1.PastePlugin; } });
|
|
6
|
+
Object.defineProperty(exports, "EditPlugin", { enumerable: true, get: function () { return EditPlugin_1.EditPlugin; } });
|
|
7
|
+
Object.defineProperty(exports, "AutoFormatPlugin", { enumerable: true, get: function () { return AutoFormatPlugin_1.AutoFormatPlugin; } });
|
|
8
|
+
});
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/lib-amd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages-content-model/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":";;;;IAAS,0GAAA,WAAW,OAAA;IACX,wGAAA,UAAU,OAAA;IACV,oHAAA,gBAAgB,OAAA","sourcesContent":["export { PastePlugin } from './paste/PastePlugin';\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages-content-model/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":";;;;IAAS,0GAAA,WAAW,OAAA;IACX,wGAAA,UAAU,OAAA;IACV,oHAAA,gBAAgB,OAAA","sourcesContent":["export { PastePlugin } from './paste/PastePlugin';\nexport { EditPlugin } from './edit/EditPlugin';\nexport { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* Convert pasted content from Excel, add borders when source doc doesn't have a border
|
|
5
|
-
* @param event The BeforePaste event
|
|
6
|
-
*/
|
|
7
|
-
export declare function processPastedContentFromExcel(event: BeforePasteEvent, trustedHTMLHandler: TrustedHTMLHandler, allowExcelNoBorderTable?: boolean): void;
|
|
8
|
-
/**
|
|
9
|
-
* @internal Export for test only
|
|
10
|
-
* @param html Source html
|
|
11
|
-
*/
|
|
12
|
-
export declare function excelHandler(html: string, htmlBefore: string): string;
|
|
1
|
+
import type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Convert pasted content from Excel, add borders when source doc doesn't have a border
|
|
5
|
+
* @param event The BeforePaste event
|
|
6
|
+
*/
|
|
7
|
+
export declare function processPastedContentFromExcel(event: BeforePasteEvent, trustedHTMLHandler: TrustedHTMLHandler, allowExcelNoBorderTable?: boolean): void;
|
|
8
|
+
/**
|
|
9
|
+
* @internal Export for test only
|
|
10
|
+
* @param html Source html
|
|
11
|
+
*/
|
|
12
|
+
export declare function excelHandler(html: string, htmlBefore: string): string;
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "../utils/addParser", "roosterjs-content-model-dom", "../utils/setProcessor"], function (require, exports, tslib_1, addParser_1, roosterjs_content_model_dom_1, setProcessor_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.excelHandler = exports.processPastedContentFromExcel = void 0;
|
|
5
|
-
var LAST_TD_END_REGEX = /<\/\s*td\s*>((?!<\/\s*tr\s*>)[\s\S])*$/i;
|
|
6
|
-
var LAST_TR_END_REGEX = /<\/\s*tr\s*>((?!<\/\s*table\s*>)[\s\S])*$/i;
|
|
7
|
-
var LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;
|
|
8
|
-
var LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;
|
|
9
|
-
var DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
* Convert pasted content from Excel, add borders when source doc doesn't have a border
|
|
13
|
-
* @param event The BeforePaste event
|
|
14
|
-
*/
|
|
15
|
-
function processPastedContentFromExcel(event, trustedHTMLHandler, allowExcelNoBorderTable) {
|
|
16
|
-
var fragment = event.fragment, htmlBefore = event.htmlBefore, clipboardData = event.clipboardData;
|
|
17
|
-
var html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;
|
|
18
|
-
if (html && clipboardData.html != html) {
|
|
19
|
-
var doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');
|
|
20
|
-
(0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
|
|
21
|
-
}
|
|
22
|
-
// For Excel Online
|
|
23
|
-
var firstChild = fragment.firstChild;
|
|
24
|
-
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(firstChild, 'ELEMENT_NODE') &&
|
|
25
|
-
firstChild.tagName == 'div' &&
|
|
26
|
-
firstChild.firstChild) {
|
|
27
|
-
var tableFound = Array.from(firstChild.childNodes).every(function (child) {
|
|
28
|
-
// Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag
|
|
29
|
-
var tagName = (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'ELEMENT_NODE') && child.tagName;
|
|
30
|
-
return tagName == 'META'
|
|
31
|
-
? true
|
|
32
|
-
: tagName == 'TABLE'
|
|
33
|
-
? child == firstChild.lastChild
|
|
34
|
-
: false;
|
|
35
|
-
});
|
|
36
|
-
// Extract Table from Div
|
|
37
|
-
if (tableFound && firstChild.lastChild) {
|
|
38
|
-
event.fragment.replaceChildren(firstChild.lastChild);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
(0, addParser_1.default)(event.domToModelOption, 'tableCell', function (format, element) {
|
|
42
|
-
if (!allowExcelNoBorderTable && element.style.borderStyle === 'none') {
|
|
43
|
-
format.borderBottom = DEFAULT_BORDER_STYLE;
|
|
44
|
-
format.borderLeft = DEFAULT_BORDER_STYLE;
|
|
45
|
-
format.borderRight = DEFAULT_BORDER_STYLE;
|
|
46
|
-
format.borderTop = DEFAULT_BORDER_STYLE;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
(0, setProcessor_1.setProcessor)(event.domToModelOption, 'child', function (group, element, context) {
|
|
50
|
-
var segmentFormat = (0, tslib_1.__assign)({}, context.segmentFormat);
|
|
51
|
-
if (group.blockGroupType === 'TableCell' && group.format.textColor) {
|
|
52
|
-
context.segmentFormat.textColor = group.format.textColor;
|
|
53
|
-
}
|
|
54
|
-
context.defaultElementProcessors.child(group, element, context);
|
|
55
|
-
if (group.blockGroupType === 'TableCell' && group.format.textColor) {
|
|
56
|
-
context.segmentFormat = segmentFormat;
|
|
57
|
-
delete group.format.textColor;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
exports.processPastedContentFromExcel = processPastedContentFromExcel;
|
|
62
|
-
/**
|
|
63
|
-
* @internal Export for test only
|
|
64
|
-
* @param html Source html
|
|
65
|
-
*/
|
|
66
|
-
function excelHandler(html, htmlBefore) {
|
|
67
|
-
if (html.match(LAST_TD_END_REGEX)) {
|
|
68
|
-
var trMatch = htmlBefore.match(LAST_TR_REGEX);
|
|
69
|
-
var tr = trMatch ? trMatch[0] : '<TR>';
|
|
70
|
-
html = tr + html + '</TR>';
|
|
71
|
-
}
|
|
72
|
-
if (html.match(LAST_TR_END_REGEX)) {
|
|
73
|
-
var tableMatch = htmlBefore.match(LAST_TABLE_REGEX);
|
|
74
|
-
var table = tableMatch ? tableMatch[0] : '<TABLE>';
|
|
75
|
-
html = table + html + '</TABLE>';
|
|
76
|
-
}
|
|
77
|
-
return html;
|
|
78
|
-
}
|
|
79
|
-
exports.excelHandler = excelHandler;
|
|
80
|
-
});
|
|
1
|
+
define(["require", "exports", "tslib", "../utils/addParser", "roosterjs-content-model-dom", "../utils/setProcessor"], function (require, exports, tslib_1, addParser_1, roosterjs_content_model_dom_1, setProcessor_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.excelHandler = exports.processPastedContentFromExcel = void 0;
|
|
5
|
+
var LAST_TD_END_REGEX = /<\/\s*td\s*>((?!<\/\s*tr\s*>)[\s\S])*$/i;
|
|
6
|
+
var LAST_TR_END_REGEX = /<\/\s*tr\s*>((?!<\/\s*table\s*>)[\s\S])*$/i;
|
|
7
|
+
var LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;
|
|
8
|
+
var LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;
|
|
9
|
+
var DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
* Convert pasted content from Excel, add borders when source doc doesn't have a border
|
|
13
|
+
* @param event The BeforePaste event
|
|
14
|
+
*/
|
|
15
|
+
function processPastedContentFromExcel(event, trustedHTMLHandler, allowExcelNoBorderTable) {
|
|
16
|
+
var fragment = event.fragment, htmlBefore = event.htmlBefore, clipboardData = event.clipboardData;
|
|
17
|
+
var html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;
|
|
18
|
+
if (html && clipboardData.html != html) {
|
|
19
|
+
var doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');
|
|
20
|
+
(0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
|
|
21
|
+
}
|
|
22
|
+
// For Excel Online
|
|
23
|
+
var firstChild = fragment.firstChild;
|
|
24
|
+
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(firstChild, 'ELEMENT_NODE') &&
|
|
25
|
+
firstChild.tagName == 'div' &&
|
|
26
|
+
firstChild.firstChild) {
|
|
27
|
+
var tableFound = Array.from(firstChild.childNodes).every(function (child) {
|
|
28
|
+
// Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag
|
|
29
|
+
var tagName = (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'ELEMENT_NODE') && child.tagName;
|
|
30
|
+
return tagName == 'META'
|
|
31
|
+
? true
|
|
32
|
+
: tagName == 'TABLE'
|
|
33
|
+
? child == firstChild.lastChild
|
|
34
|
+
: false;
|
|
35
|
+
});
|
|
36
|
+
// Extract Table from Div
|
|
37
|
+
if (tableFound && firstChild.lastChild) {
|
|
38
|
+
event.fragment.replaceChildren(firstChild.lastChild);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
(0, addParser_1.default)(event.domToModelOption, 'tableCell', function (format, element) {
|
|
42
|
+
if (!allowExcelNoBorderTable && element.style.borderStyle === 'none') {
|
|
43
|
+
format.borderBottom = DEFAULT_BORDER_STYLE;
|
|
44
|
+
format.borderLeft = DEFAULT_BORDER_STYLE;
|
|
45
|
+
format.borderRight = DEFAULT_BORDER_STYLE;
|
|
46
|
+
format.borderTop = DEFAULT_BORDER_STYLE;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
(0, setProcessor_1.setProcessor)(event.domToModelOption, 'child', function (group, element, context) {
|
|
50
|
+
var segmentFormat = (0, tslib_1.__assign)({}, context.segmentFormat);
|
|
51
|
+
if (group.blockGroupType === 'TableCell' && group.format.textColor) {
|
|
52
|
+
context.segmentFormat.textColor = group.format.textColor;
|
|
53
|
+
}
|
|
54
|
+
context.defaultElementProcessors.child(group, element, context);
|
|
55
|
+
if (group.blockGroupType === 'TableCell' && group.format.textColor) {
|
|
56
|
+
context.segmentFormat = segmentFormat;
|
|
57
|
+
delete group.format.textColor;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.processPastedContentFromExcel = processPastedContentFromExcel;
|
|
62
|
+
/**
|
|
63
|
+
* @internal Export for test only
|
|
64
|
+
* @param html Source html
|
|
65
|
+
*/
|
|
66
|
+
function excelHandler(html, htmlBefore) {
|
|
67
|
+
if (html.match(LAST_TD_END_REGEX)) {
|
|
68
|
+
var trMatch = htmlBefore.match(LAST_TR_REGEX);
|
|
69
|
+
var tr = trMatch ? trMatch[0] : '<TR>';
|
|
70
|
+
html = tr + html + '</TR>';
|
|
71
|
+
}
|
|
72
|
+
if (html.match(LAST_TR_END_REGEX)) {
|
|
73
|
+
var tableMatch = htmlBefore.match(LAST_TABLE_REGEX);
|
|
74
|
+
var table = tableMatch ? tableMatch[0] : '<TABLE>';
|
|
75
|
+
html = table + html + '</TABLE>';
|
|
76
|
+
}
|
|
77
|
+
return html;
|
|
78
|
+
}
|
|
79
|
+
exports.excelHandler = excelHandler;
|
|
80
|
+
});
|
|
81
81
|
//# sourceMappingURL=processPastedContentFromExcel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPastedContentFromExcel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts"],"names":[],"mappings":";;;;IAKA,IAAM,iBAAiB,GAAG,yCAAyC,CAAC;IACpE,IAAM,iBAAiB,GAAG,4CAA4C,CAAC;IACvE,IAAM,aAAa,GAAG,iBAAiB,CAAC;IACxC,IAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC9C,IAAM,oBAAoB,GAAG,mBAAmB,CAAC;IAEjD;;;;OAIG;IAEH,SAAgB,6BAA6B,CACzC,KAAuB,EACvB,kBAAsC,EACtC,uBAAiC;QAEzB,IAAA,QAAQ,GAAgC,KAAK,SAArC,EAAE,UAAU,GAAoB,KAAK,WAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QACtD,IAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE3F,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,IAAI,IAAI,EAAE;YACpC,IAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;YACnF,IAAA,4CAAc,EAAC,QAAQ,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,CAAC;SACvC;QAED,mBAAmB;QACnB,IAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACvC,IACI,IAAA,0CAAY,EAAC,UAAU,EAAE,cAAc,CAAC;YACxC,UAAU,CAAC,OAAO,IAAI,KAAK;YAC3B,UAAU,CAAC,UAAU,EACvB;YACE,IAAM,UAAU,GAAG,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,SAAS,CAAC;aAC5D;YAED,OAAO,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAEhE,IAAI,KAAK,CAAC,cAAc,KAAK,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE;gBAChE,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;gBACtC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;aACjC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IA3DD,sEA2DC;IAED;;;OAGG;IAEH,SAAgB,YAAY,CAAC,IAAY,EAAE,UAAkB;QACzD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;YAC/B,IAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAChD,IAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACzC,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC;SAC9B;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;YAC/B,IAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtD,IAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACrD,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;SACpC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAbD,oCAaC","sourcesContent":["import addParser from '../utils/addParser';\
|
|
1
|
+
{"version":3,"file":"processPastedContentFromExcel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts"],"names":[],"mappings":";;;;IAKA,IAAM,iBAAiB,GAAG,yCAAyC,CAAC;IACpE,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C,SAAS,CAAC;aACjC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IA3DD,sEA2DC;IAED;;;OAGG;IAEH,SAAgB,YAAY,CAAC,IAAY,EAAE,UAAkB;QACzD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;YAC/B,IAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAChD,IAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACzC,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC;SAC9B;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;YAC/B,IAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtD,IAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACrD,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;SACpC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAbD,oCAaC","sourcesContent":["import addParser from '../utils/addParser';\nimport { isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom';\nimport { setProcessor } from '../utils/setProcessor';\nimport type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-content-model-types';\n\nconst LAST_TD_END_REGEX = /<\\/\\s*td\\s*>((?!<\\/\\s*tr\\s*>)[\\s\\S])*$/i;\nconst LAST_TR_END_REGEX = /<\\/\\s*tr\\s*>((?!<\\/\\s*table\\s*>)[\\s\\S])*$/i;\nconst LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;\nconst LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;\nconst DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';\n\n/**\n * @internal\n * Convert pasted content from Excel, add borders when source doc doesn't have a border\n * @param event The BeforePaste event\n */\n\nexport function processPastedContentFromExcel(\n event: BeforePasteEvent,\n trustedHTMLHandler: TrustedHTMLHandler,\n allowExcelNoBorderTable?: boolean\n) {\n const { fragment, htmlBefore, clipboardData } = event;\n const html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;\n\n if (html && clipboardData.html != html) {\n const doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');\n moveChildNodes(fragment, doc?.body);\n }\n\n // For Excel Online\n const firstChild = fragment.firstChild;\n if (\n isNodeOfType(firstChild, 'ELEMENT_NODE') &&\n firstChild.tagName == 'div' &&\n firstChild.firstChild\n ) {\n const tableFound = Array.from(firstChild.childNodes).every((child: Node) => {\n // Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag\n const tagName = isNodeOfType(child, 'ELEMENT_NODE') && child.tagName;\n\n return tagName == 'META'\n ? true\n : tagName == 'TABLE'\n ? child == firstChild.lastChild\n : false;\n });\n\n // Extract Table from Div\n if (tableFound && firstChild.lastChild) {\n event.fragment.replaceChildren(firstChild.lastChild);\n }\n }\n\n addParser(event.domToModelOption, 'tableCell', (format, element) => {\n if (!allowExcelNoBorderTable && element.style.borderStyle === 'none') {\n format.borderBottom = DEFAULT_BORDER_STYLE;\n format.borderLeft = DEFAULT_BORDER_STYLE;\n format.borderRight = DEFAULT_BORDER_STYLE;\n format.borderTop = DEFAULT_BORDER_STYLE;\n }\n });\n\n setProcessor(event.domToModelOption, 'child', (group, element, context) => {\n const segmentFormat = { ...context.segmentFormat };\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\n context.segmentFormat.textColor = group.format.textColor;\n }\n\n context.defaultElementProcessors.child(group, element, context);\n\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\n context.segmentFormat = segmentFormat;\n delete group.format.textColor;\n }\n });\n}\n\n/**\n * @internal Export for test only\n * @param html Source html\n */\n\nexport function excelHandler(html: string, htmlBefore: string): string {\n if (html.match(LAST_TD_END_REGEX)) {\n const trMatch = htmlBefore.match(LAST_TR_REGEX);\n const tr = trMatch ? trMatch[0] : '<TR>';\n html = tr + html + '</TR>';\n }\n if (html.match(LAST_TR_END_REGEX)) {\n const tableMatch = htmlBefore.match(LAST_TABLE_REGEX);\n const table = tableMatch ? tableMatch[0] : '<TABLE>';\n html = table + html + '</TABLE>';\n }\n\n return html;\n}\n"]}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import type { EditorPlugin, IStandaloneEditor, PluginEvent } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* Paste plugin, handles BeforePaste event and reformat some special content, including:
|
|
4
|
-
* 1. Content copied from Word
|
|
5
|
-
* 2. Content copied from Excel
|
|
6
|
-
* 3. Content copied from Word Online or OneNote Online
|
|
7
|
-
* 4. Content copied from Power Point
|
|
8
|
-
* (This class is still under development, and may still be changed in the future with some breaking changes)
|
|
9
|
-
*/
|
|
10
|
-
export declare class PastePlugin implements EditorPlugin {
|
|
11
|
-
private allowExcelNoBorderTable?;
|
|
12
|
-
private editor;
|
|
13
|
-
/**
|
|
14
|
-
* Construct a new instance of Paste class
|
|
15
|
-
* @param unknownTagReplacement Replace solution of unknown tags, default behavior is to replace with SPAN
|
|
16
|
-
* @param allowExcelNoBorderTable Allow table copied from Excel without border
|
|
17
|
-
*/
|
|
18
|
-
constructor(allowExcelNoBorderTable?: boolean | undefined);
|
|
19
|
-
/**
|
|
20
|
-
* Get name of this plugin
|
|
21
|
-
*/
|
|
22
|
-
getName(): string;
|
|
23
|
-
/**
|
|
24
|
-
* The first method that editor will call to a plugin when editor is initializing.
|
|
25
|
-
* It will pass in the editor instance, plugin should take this chance to save the
|
|
26
|
-
* editor reference so that it can call to any editor method or format API later.
|
|
27
|
-
* @param editor The editor object
|
|
28
|
-
*/
|
|
29
|
-
initialize(editor: IStandaloneEditor): void;
|
|
30
|
-
/**
|
|
31
|
-
* The last method that editor will call to a plugin before it is disposed.
|
|
32
|
-
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
33
|
-
* called, plugin should not call to any editor method since it will result in error.
|
|
34
|
-
*/
|
|
35
|
-
dispose(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
38
|
-
* method of each plugin to handle the event as long as the event is not handled
|
|
39
|
-
* exclusively by another plugin.
|
|
40
|
-
* @param event The event to handle:
|
|
41
|
-
*/
|
|
42
|
-
onPluginEvent(event: PluginEvent): void;
|
|
43
|
-
}
|
|
1
|
+
import type { EditorPlugin, IStandaloneEditor, PluginEvent } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Paste plugin, handles BeforePaste event and reformat some special content, including:
|
|
4
|
+
* 1. Content copied from Word
|
|
5
|
+
* 2. Content copied from Excel
|
|
6
|
+
* 3. Content copied from Word Online or OneNote Online
|
|
7
|
+
* 4. Content copied from Power Point
|
|
8
|
+
* (This class is still under development, and may still be changed in the future with some breaking changes)
|
|
9
|
+
*/
|
|
10
|
+
export declare class PastePlugin implements EditorPlugin {
|
|
11
|
+
private allowExcelNoBorderTable?;
|
|
12
|
+
private editor;
|
|
13
|
+
/**
|
|
14
|
+
* Construct a new instance of Paste class
|
|
15
|
+
* @param unknownTagReplacement Replace solution of unknown tags, default behavior is to replace with SPAN
|
|
16
|
+
* @param allowExcelNoBorderTable Allow table copied from Excel without border
|
|
17
|
+
*/
|
|
18
|
+
constructor(allowExcelNoBorderTable?: boolean | undefined);
|
|
19
|
+
/**
|
|
20
|
+
* Get name of this plugin
|
|
21
|
+
*/
|
|
22
|
+
getName(): string;
|
|
23
|
+
/**
|
|
24
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
25
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
26
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
27
|
+
* @param editor The editor object
|
|
28
|
+
*/
|
|
29
|
+
initialize(editor: IStandaloneEditor): void;
|
|
30
|
+
/**
|
|
31
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
32
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
33
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
34
|
+
*/
|
|
35
|
+
dispose(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
38
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
39
|
+
* exclusively by another plugin.
|
|
40
|
+
* @param event The event to handle:
|
|
41
|
+
*/
|
|
42
|
+
onPluginEvent(event: PluginEvent): void;
|
|
43
|
+
}
|