roosterjs-content-model-plugins 0.25.0 → 0.26.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-mjs/autoFormat/ContentModelAutoFormatPlugin.d.ts → lib/autoFormat/AutoFormatPlugin.d.ts} +53 -53
- package/lib/autoFormat/{ContentModelAutoFormatPlugin.js → AutoFormatPlugin.js} +81 -81
- package/lib/autoFormat/AutoFormatPlugin.js.map +1 -0
- 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 -79
- 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 -152
- package/lib/autoFormat/utils/getNumberingListStyle.js.map +1 -1
- package/{lib-amd/edit/ContentModelEditPlugin.d.ts → lib/edit/EditPlugin.d.ts} +39 -35
- package/lib/edit/EditPlugin.js +129 -0
- package/lib/edit/EditPlugin.js.map +1 -0
- 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 -0
- package/lib/edit/inputSteps/handleEnterOnList.js +68 -0
- package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -0
- package/lib/edit/keyboardDelete.d.ts +9 -8
- package/lib/edit/keyboardDelete.js +71 -74
- package/lib/edit/keyboardDelete.js.map +1 -1
- package/lib/edit/keyboardInput.d.ts +5 -5
- package/lib/edit/keyboardInput.js +58 -50
- package/lib/edit/keyboardInput.js.map +1 -1
- package/lib/edit/keyboardTab.d.ts +5 -0
- package/lib/edit/keyboardTab.js +35 -0
- package/lib/edit/keyboardTab.js.map +1 -0
- 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-amd/paste/ContentModelPastePlugin.d.ts → lib/paste/PastePlugin.d.ts} +43 -43
- package/lib/paste/{ContentModelPastePlugin.js → PastePlugin.js} +131 -131
- package/lib/paste/PastePlugin.js.map +1 -0
- 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 -0
- package/lib/pluginUtils/CreateElement/CreateElementData.js +3 -0
- package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
- package/lib/pluginUtils/CreateElement/createElement.d.ts +9 -0
- package/lib/pluginUtils/CreateElement/createElement.js +51 -0
- package/lib/pluginUtils/CreateElement/createElement.js.map +1 -0
- package/lib/pluginUtils/Disposable.d.ts +10 -0
- package/lib/pluginUtils/Disposable.js +3 -0
- package/lib/pluginUtils/Disposable.js.map +1 -0
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js +3 -0
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +120 -0
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
- package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
- package/lib/pluginUtils/Rect/getIntersectedRect.js +45 -0
- package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
- package/lib/pluginUtils/Rect/normalizeRect.d.ts +7 -0
- package/lib/pluginUtils/Rect/normalizeRect.js +20 -0
- package/lib/pluginUtils/Rect/normalizeRect.js.map +1 -0
- package/lib-amd/autoFormat/{ContentModelAutoFormatPlugin.d.ts → AutoFormatPlugin.d.ts} +53 -53
- package/lib-amd/autoFormat/{ContentModelAutoFormatPlugin.js → AutoFormatPlugin.js} +82 -82
- package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -0
- 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 -78
- 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 -152
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +1 -1
- package/{lib-mjs/edit/ContentModelEditPlugin.d.ts → lib-amd/edit/EditPlugin.d.ts} +39 -35
- package/lib-amd/edit/EditPlugin.js +128 -0
- package/lib-amd/edit/EditPlugin.js.map +1 -0
- 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 -0
- package/lib-amd/edit/inputSteps/handleEnterOnList.js +67 -0
- package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -0
- package/lib-amd/edit/keyboardDelete.d.ts +9 -8
- package/lib-amd/edit/keyboardDelete.js +66 -69
- 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 -50
- package/lib-amd/edit/keyboardInput.js.map +1 -1
- package/lib-amd/edit/keyboardTab.d.ts +5 -0
- package/lib-amd/edit/keyboardTab.js +35 -0
- package/lib-amd/edit/keyboardTab.js.map +1 -0
- 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/paste/ContentModelPastePlugin.d.ts → lib-amd/paste/PastePlugin.d.ts} +43 -43
- package/lib-amd/paste/{ContentModelPastePlugin.js → PastePlugin.js} +123 -123
- package/lib-amd/paste/PastePlugin.js.map +1 -0
- 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 -0
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.js +5 -0
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
- package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +9 -0
- package/lib-amd/pluginUtils/CreateElement/createElement.js +52 -0
- package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -0
- package/lib-amd/pluginUtils/Disposable.d.ts +10 -0
- package/lib-amd/pluginUtils/Disposable.js +5 -0
- package/lib-amd/pluginUtils/Disposable.js.map +1 -0
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js +5 -0
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +121 -0
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +45 -0
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
- package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +7 -0
- package/lib-amd/pluginUtils/Rect/normalizeRect.js +22 -0
- package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +1 -0
- package/{lib/autoFormat/ContentModelAutoFormatPlugin.d.ts → lib-mjs/autoFormat/AutoFormatPlugin.d.ts} +53 -53
- package/lib-mjs/autoFormat/{ContentModelAutoFormatPlugin.js → AutoFormatPlugin.js} +78 -78
- package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -0
- 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 -75
- 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 -148
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +1 -1
- package/{lib/edit/ContentModelEditPlugin.d.ts → lib-mjs/edit/EditPlugin.d.ts} +39 -35
- package/lib-mjs/edit/EditPlugin.js +126 -0
- package/lib-mjs/edit/EditPlugin.js.map +1 -0
- 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 -0
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js +64 -0
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -0
- package/lib-mjs/edit/keyboardDelete.d.ts +9 -8
- package/lib-mjs/edit/keyboardDelete.js +67 -70
- 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 -46
- package/lib-mjs/edit/keyboardInput.js.map +1 -1
- package/lib-mjs/edit/keyboardTab.d.ts +5 -0
- package/lib-mjs/edit/keyboardTab.js +31 -0
- package/lib-mjs/edit/keyboardTab.js.map +1 -0
- 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/{ContentModelPastePlugin.d.ts → PastePlugin.d.ts} +43 -43
- package/lib-mjs/paste/{ContentModelPastePlugin.js → PastePlugin.js} +128 -128
- package/lib-mjs/paste/PastePlugin.js.map +1 -0
- 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 -0
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js +2 -0
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
- package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +9 -0
- package/lib-mjs/pluginUtils/CreateElement/createElement.js +48 -0
- package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -0
- package/lib-mjs/pluginUtils/Disposable.d.ts +10 -0
- package/lib-mjs/pluginUtils/Disposable.js +2 -0
- package/lib-mjs/pluginUtils/Disposable.js.map +1 -0
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js +2 -0
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +118 -0
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +42 -0
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
- package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +7 -0
- package/lib-mjs/pluginUtils/Rect/normalizeRect.js +17 -0
- package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +1 -0
- package/package.json +5 -5
- package/lib/autoFormat/ContentModelAutoFormatPlugin.js.map +0 -1
- package/lib/edit/ContentModelEditPlugin.js +0 -74
- package/lib/edit/ContentModelEditPlugin.js.map +0 -1
- package/lib/paste/ContentModelPastePlugin.js.map +0 -1
- package/lib-amd/autoFormat/ContentModelAutoFormatPlugin.js.map +0 -1
- package/lib-amd/edit/ContentModelEditPlugin.js +0 -74
- package/lib-amd/edit/ContentModelEditPlugin.js.map +0 -1
- package/lib-amd/paste/ContentModelPastePlugin.js.map +0 -1
- package/lib-mjs/autoFormat/ContentModelAutoFormatPlugin.js.map +0 -1
- package/lib-mjs/edit/ContentModelEditPlugin.js +0 -71
- package/lib-mjs/edit/ContentModelEditPlugin.js.map +0 -1
- package/lib-mjs/paste/ContentModelPastePlugin.js.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* Do keyboard event handling for DELETE/BACKSPACE key
|
|
5
|
-
* @param editor The Content Model Editor
|
|
6
|
-
* @param rawEvent DOM keyboard event
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Do keyboard event handling for DELETE/BACKSPACE key
|
|
5
|
+
* @param editor The Content Model Editor
|
|
6
|
+
* @param rawEvent DOM keyboard event
|
|
7
|
+
* @returns True if the event is handled by content model, otherwise false
|
|
8
|
+
*/
|
|
9
|
+
export declare function keyboardDelete(editor: IStandaloneEditor, rawEvent: KeyboardEvent): boolean;
|
|
@@ -1,71 +1,68 @@
|
|
|
1
|
-
import { ChangeSource, deleteSelection, isModifierKey } from 'roosterjs-content-model-core';
|
|
2
|
-
import { deleteAllSegmentBefore } from './deleteSteps/deleteAllSegmentBefore';
|
|
3
|
-
import { deleteList } from './deleteSteps/deleteList';
|
|
4
|
-
import { isNodeOfType } from 'roosterjs-content-model-dom';
|
|
5
|
-
import { handleKeyboardEventResult, shouldDeleteAllSegmentsBefore, shouldDeleteWord, } from './handleKeyboardEventCommon';
|
|
6
|
-
import { backwardDeleteWordSelection, forwardDeleteWordSelection, } from './deleteSteps/deleteWordSelection';
|
|
7
|
-
import { backwardDeleteCollapsedSelection, forwardDeleteCollapsedSelection, } from './deleteSteps/deleteCollapsedSelection';
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
* Do keyboard event handling for DELETE/BACKSPACE key
|
|
11
|
-
* @param editor The Content Model Editor
|
|
12
|
-
* @param rawEvent DOM keyboard event
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (!selection) {
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
else
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return (rawEvent.key == 'Delete' &&
|
|
69
|
-
range.startOffset < ((_b = (_a = range.startContainer.nodeValue) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - 1);
|
|
70
|
-
}
|
|
1
|
+
import { ChangeSource, deleteSelection, isModifierKey } from 'roosterjs-content-model-core';
|
|
2
|
+
import { deleteAllSegmentBefore } from './deleteSteps/deleteAllSegmentBefore';
|
|
3
|
+
import { deleteList } from './deleteSteps/deleteList';
|
|
4
|
+
import { isNodeOfType } from 'roosterjs-content-model-dom';
|
|
5
|
+
import { handleKeyboardEventResult, shouldDeleteAllSegmentsBefore, shouldDeleteWord, } from './handleKeyboardEventCommon';
|
|
6
|
+
import { backwardDeleteWordSelection, forwardDeleteWordSelection, } from './deleteSteps/deleteWordSelection';
|
|
7
|
+
import { backwardDeleteCollapsedSelection, forwardDeleteCollapsedSelection, } from './deleteSteps/deleteCollapsedSelection';
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
* Do keyboard event handling for DELETE/BACKSPACE key
|
|
11
|
+
* @param editor The Content Model Editor
|
|
12
|
+
* @param rawEvent DOM keyboard event
|
|
13
|
+
* @returns True if the event is handled by content model, otherwise false
|
|
14
|
+
*/
|
|
15
|
+
export function keyboardDelete(editor, rawEvent) {
|
|
16
|
+
var handled = false;
|
|
17
|
+
var selection = editor.getDOMSelection();
|
|
18
|
+
if (shouldDeleteWithContentModel(selection, rawEvent)) {
|
|
19
|
+
editor.formatContentModel(function (model, context) {
|
|
20
|
+
var result = deleteSelection(model, getDeleteSteps(rawEvent, !!editor.getEnvironment().isMac), context).deleteResult;
|
|
21
|
+
handled = handleKeyboardEventResult(editor, model, rawEvent, result, context);
|
|
22
|
+
return handled;
|
|
23
|
+
}, {
|
|
24
|
+
rawEvent: rawEvent,
|
|
25
|
+
changeSource: ChangeSource.Keyboard,
|
|
26
|
+
getChangeData: function () { return rawEvent.which; },
|
|
27
|
+
apiName: rawEvent.key == 'Delete' ? 'handleDeleteKey' : 'handleBackspaceKey',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return handled;
|
|
31
|
+
}
|
|
32
|
+
function getDeleteSteps(rawEvent, isMac) {
|
|
33
|
+
var isForward = rawEvent.key == 'Delete';
|
|
34
|
+
var deleteAllSegmentBeforeStep = shouldDeleteAllSegmentsBefore(rawEvent) && !isForward ? deleteAllSegmentBefore : null;
|
|
35
|
+
var deleteWordSelection = shouldDeleteWord(rawEvent, isMac)
|
|
36
|
+
? isForward
|
|
37
|
+
? forwardDeleteWordSelection
|
|
38
|
+
: backwardDeleteWordSelection
|
|
39
|
+
: null;
|
|
40
|
+
var deleteCollapsedSelection = isForward
|
|
41
|
+
? forwardDeleteCollapsedSelection
|
|
42
|
+
: backwardDeleteCollapsedSelection;
|
|
43
|
+
return [deleteAllSegmentBeforeStep, deleteWordSelection, deleteCollapsedSelection, deleteList];
|
|
44
|
+
}
|
|
45
|
+
function shouldDeleteWithContentModel(selection, rawEvent) {
|
|
46
|
+
if (!selection) {
|
|
47
|
+
return false; // Nothing to delete
|
|
48
|
+
}
|
|
49
|
+
else if (selection.type != 'range' || !selection.range.collapsed) {
|
|
50
|
+
return true; // Selection is not collapsed, need to delete all selections
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
var range = selection.range;
|
|
54
|
+
// When selection is collapsed and is in middle of text node, no need to use Content Model to delete
|
|
55
|
+
return !(isNodeOfType(range.startContainer, 'TEXT_NODE') &&
|
|
56
|
+
!isModifierKey(rawEvent) &&
|
|
57
|
+
(canDeleteBefore(rawEvent, range) || canDeleteAfter(rawEvent, range)));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function canDeleteBefore(rawEvent, range) {
|
|
61
|
+
return rawEvent.key == 'Backspace' && range.startOffset > 1;
|
|
62
|
+
}
|
|
63
|
+
function canDeleteAfter(rawEvent, range) {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
return (rawEvent.key == 'Delete' &&
|
|
66
|
+
range.startOffset < ((_b = (_a = range.startContainer.nodeValue) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - 1);
|
|
67
|
+
}
|
|
71
68
|
//# sourceMappingURL=keyboardDelete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardDelete.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/keyboardDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAC7B,gBAAgB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,2BAA2B,EAC3B,0BAA0B,GAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,gCAAgC,EAChC,+BAA+B,GAClC,MAAM,wCAAwC,CAAC;AAOhD
|
|
1
|
+
{"version":3,"file":"keyboardDelete.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/keyboardDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAC7B,gBAAgB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,2BAA2B,EAC3B,0BAA0B,GAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,gCAAgC,EAChC,+BAA+B,GAClC,MAAM,wCAAwC,CAAC;AAOhD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,MAAyB,EAAE,QAAuB;IAC7E,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,IAAI,4BAA4B,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;QACnD,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;YACX,IAAM,MAAM,GAAG,eAAe,CAC1B,KAAK,EACL,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,EACzD,OAAO,CACV,CAAC,YAAY,CAAC;YAEf,OAAO,GAAG,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAC9E,OAAO,OAAO,CAAC;QACnB,CAAC,EACD;YACI,QAAQ,UAAA;YACR,YAAY,EAAE,YAAY,CAAC,QAAQ;YACnC,aAAa,EAAE,cAAM,OAAA,QAAQ,CAAC,KAAK,EAAd,CAAc;YACnC,OAAO,EAAE,QAAQ,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,oBAAoB;SAC/E,CACJ,CAAC;KACL;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,SAAS,cAAc,CAAC,QAAuB,EAAE,KAAc;IAC3D,IAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,IAAI,QAAQ,CAAC;IAC3C,IAAM,0BAA0B,GAC5B,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1F,IAAM,mBAAmB,GAAG,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC;QACzD,CAAC,CAAC,SAAS;YACP,CAAC,CAAC,0BAA0B;YAC5B,CAAC,CAAC,2BAA2B;QACjC,CAAC,CAAC,IAAI,CAAC;IACX,IAAM,wBAAwB,GAAG,SAAS;QACtC,CAAC,CAAC,+BAA+B;QACjC,CAAC,CAAC,gCAAgC,CAAC;IACvC,OAAO,CAAC,0BAA0B,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,UAAU,CAAC,CAAC;AACnG,CAAC;AAED,SAAS,4BAA4B,CAAC,SAA8B,EAAE,QAAuB;IACzF,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,KAAK,CAAC,CAAC,oBAAoB;KACrC;SAAM,IAAI,SAAS,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE;QAChE,OAAO,IAAI,CAAC,CAAC,4DAA4D;KAC5E;SAAM;QACH,IAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;QAE9B,oGAAoG;QACpG,OAAO,CAAC,CACJ,YAAY,CAAC,KAAK,CAAC,cAAc,EAAE,WAAW,CAAC;YAC/C,CAAC,aAAa,CAAC,QAAQ,CAAC;YACxB,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CACxE,CAAC;KACL;AACL,CAAC;AAED,SAAS,eAAe,CAAC,QAAuB,EAAE,KAAY;IAC1D,OAAO,QAAQ,CAAC,GAAG,IAAI,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,cAAc,CAAC,QAAuB,EAAE,KAAY;;IACzD,OAAO,CACH,QAAQ,CAAC,GAAG,IAAI,QAAQ;QACxB,KAAK,CAAC,WAAW,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,cAAc,CAAC,SAAS,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,CAAC,CACxE,CAAC;AACN,CAAC","sourcesContent":["import { ChangeSource, deleteSelection, isModifierKey } from 'roosterjs-content-model-core';\r\nimport { deleteAllSegmentBefore } from './deleteSteps/deleteAllSegmentBefore';\r\nimport { deleteList } from './deleteSteps/deleteList';\r\nimport { isNodeOfType } from 'roosterjs-content-model-dom';\r\nimport {\r\n handleKeyboardEventResult,\r\n shouldDeleteAllSegmentsBefore,\r\n shouldDeleteWord,\r\n} from './handleKeyboardEventCommon';\r\nimport {\r\n backwardDeleteWordSelection,\r\n forwardDeleteWordSelection,\r\n} from './deleteSteps/deleteWordSelection';\r\nimport {\r\n backwardDeleteCollapsedSelection,\r\n forwardDeleteCollapsedSelection,\r\n} from './deleteSteps/deleteCollapsedSelection';\r\nimport type {\r\n DOMSelection,\r\n DeleteSelectionStep,\r\n IStandaloneEditor,\r\n} from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n * Do keyboard event handling for DELETE/BACKSPACE key\r\n * @param editor The Content Model Editor\r\n * @param rawEvent DOM keyboard event\r\n * @returns True if the event is handled by content model, otherwise false\r\n */\r\nexport function keyboardDelete(editor: IStandaloneEditor, rawEvent: KeyboardEvent) {\r\n let handled = false;\r\n const selection = editor.getDOMSelection();\r\n\r\n if (shouldDeleteWithContentModel(selection, rawEvent)) {\r\n editor.formatContentModel(\r\n (model, context) => {\r\n const result = deleteSelection(\r\n model,\r\n getDeleteSteps(rawEvent, !!editor.getEnvironment().isMac),\r\n context\r\n ).deleteResult;\r\n\r\n handled = handleKeyboardEventResult(editor, model, rawEvent, result, context);\r\n return handled;\r\n },\r\n {\r\n rawEvent,\r\n changeSource: ChangeSource.Keyboard,\r\n getChangeData: () => rawEvent.which,\r\n apiName: rawEvent.key == 'Delete' ? 'handleDeleteKey' : 'handleBackspaceKey',\r\n }\r\n );\r\n }\r\n\r\n return handled;\r\n}\r\n\r\nfunction getDeleteSteps(rawEvent: KeyboardEvent, isMac: boolean): (DeleteSelectionStep | null)[] {\r\n const isForward = rawEvent.key == 'Delete';\r\n const deleteAllSegmentBeforeStep =\r\n shouldDeleteAllSegmentsBefore(rawEvent) && !isForward ? deleteAllSegmentBefore : null;\r\n const deleteWordSelection = shouldDeleteWord(rawEvent, isMac)\r\n ? isForward\r\n ? forwardDeleteWordSelection\r\n : backwardDeleteWordSelection\r\n : null;\r\n const deleteCollapsedSelection = isForward\r\n ? forwardDeleteCollapsedSelection\r\n : backwardDeleteCollapsedSelection;\r\n return [deleteAllSegmentBeforeStep, deleteWordSelection, deleteCollapsedSelection, deleteList];\r\n}\r\n\r\nfunction shouldDeleteWithContentModel(selection: DOMSelection | null, rawEvent: KeyboardEvent) {\r\n if (!selection) {\r\n return false; // Nothing to delete\r\n } else if (selection.type != 'range' || !selection.range.collapsed) {\r\n return true; // Selection is not collapsed, need to delete all selections\r\n } else {\r\n const range = selection.range;\r\n\r\n // When selection is collapsed and is in middle of text node, no need to use Content Model to delete\r\n return !(\r\n isNodeOfType(range.startContainer, 'TEXT_NODE') &&\r\n !isModifierKey(rawEvent) &&\r\n (canDeleteBefore(rawEvent, range) || canDeleteAfter(rawEvent, range))\r\n );\r\n }\r\n}\r\n\r\nfunction canDeleteBefore(rawEvent: KeyboardEvent, range: Range) {\r\n return rawEvent.key == 'Backspace' && range.startOffset > 1;\r\n}\r\n\r\nfunction canDeleteAfter(rawEvent: KeyboardEvent, range: Range) {\r\n return (\r\n rawEvent.key == 'Delete' &&\r\n range.startOffset < (range.startContainer.nodeValue?.length ?? 0) - 1\r\n );\r\n}\r\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export declare function keyboardInput(editor: IStandaloneEditor, rawEvent: KeyboardEvent): true | undefined;
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function keyboardInput(editor: IStandaloneEditor, rawEvent: KeyboardEvent): true | undefined;
|
|
@@ -1,47 +1,55 @@
|
|
|
1
|
-
import { deleteSelection, isModifierKey } from 'roosterjs-content-model-core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
editor.
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
import { deleteSelection, isModifierKey } from 'roosterjs-content-model-core';
|
|
2
|
+
import { handleEnterOnList } from './inputSteps/handleEnterOnList';
|
|
3
|
+
import { normalizeContentModel } from 'roosterjs-content-model-dom';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export function keyboardInput(editor, rawEvent) {
|
|
8
|
+
var selection = editor.getDOMSelection();
|
|
9
|
+
if (shouldInputWithContentModel(selection, rawEvent)) {
|
|
10
|
+
editor.takeSnapshot();
|
|
11
|
+
editor.formatContentModel(function (model, context) {
|
|
12
|
+
var _a;
|
|
13
|
+
var result = deleteSelection(model, getInputSteps(selection, rawEvent), context);
|
|
14
|
+
// We have deleted selection then we will let browser to handle the input.
|
|
15
|
+
// With this combined operation, we don't wan to mass up the cached model so clear it
|
|
16
|
+
context.clearModelCache = true;
|
|
17
|
+
// Skip undo snapshot here and add undo snapshot before the operation so that we don't add another undo snapshot in middle of this replace operation
|
|
18
|
+
context.skipUndoSnapshot = true;
|
|
19
|
+
if (result.deleteResult == 'range') {
|
|
20
|
+
// We have deleted something, next input should inherit the segment format from deleted content, so set pending format here
|
|
21
|
+
context.newPendingFormat = (_a = result.insertPoint) === null || _a === void 0 ? void 0 : _a.marker.format;
|
|
22
|
+
normalizeContentModel(model);
|
|
23
|
+
// Do not preventDefault since we still want browser to handle the final input for now
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
rawEvent: rawEvent,
|
|
31
|
+
});
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function getInputSteps(selection, rawEvent) {
|
|
36
|
+
return shouldHandleEnterKey(selection, rawEvent) ? [handleEnterOnList] : [];
|
|
37
|
+
}
|
|
38
|
+
function shouldInputWithContentModel(selection, rawEvent) {
|
|
39
|
+
if (!selection) {
|
|
40
|
+
return false; // Nothing to delete
|
|
41
|
+
}
|
|
42
|
+
else if (!isModifierKey(rawEvent) &&
|
|
43
|
+
(rawEvent.key == 'Enter' || rawEvent.key == 'Space' || rawEvent.key.length == 1)) {
|
|
44
|
+
return (selection.type != 'range' ||
|
|
45
|
+
!selection.range.collapsed ||
|
|
46
|
+
shouldHandleEnterKey(selection, rawEvent));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var shouldHandleEnterKey = function (selection, rawEvent) {
|
|
53
|
+
return selection && selection.type == 'range' && rawEvent.key == 'Enter' && !rawEvent.shiftKey;
|
|
54
|
+
};
|
|
47
55
|
//# sourceMappingURL=keyboardInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardInput.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/keyboardInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAyB,EAAE,QAAuB;IAC5E,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,IAAI,2BAA2B,CAAC,SAAS,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"keyboardInput.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/keyboardInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAyB,EAAE,QAAuB;IAC5E,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,IAAI,2BAA2B,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;QAClD,MAAM,CAAC,YAAY,EAAE,CAAC;QAEtB,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;;YACX,IAAM,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;YAEnF,0EAA0E;YAC1E,qFAAqF;YACrF,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;YAE/B,oJAAoJ;YACpJ,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAEhC,IAAI,MAAM,CAAC,YAAY,IAAI,OAAO,EAAE;gBAChC,2HAA2H;gBAC3H,OAAO,CAAC,gBAAgB,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,MAAM,CAAC,MAAM,CAAC;gBAE7D,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAE7B,sFAAsF;gBACtF,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD;YACI,QAAQ,UAAA;SACX,CACJ,CAAC;QAEF,OAAO,IAAI,CAAC;KACf;AACL,CAAC;AAED,SAAS,aAAa,CAAC,SAA8B,EAAE,QAAuB;IAC1E,OAAO,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChF,CAAC;AAED,SAAS,2BAA2B,CAAC,SAA8B,EAAE,QAAuB;IACxF,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,KAAK,CAAC,CAAC,oBAAoB;KACrC;SAAM,IACH,CAAC,aAAa,CAAC,QAAQ,CAAC;QACxB,CAAC,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,EAClF;QACE,OAAO,CACH,SAAS,CAAC,IAAI,IAAI,OAAO;YACzB,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS;YAC1B,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAC5C,CAAC;KACL;SAAM;QACH,OAAO,KAAK,CAAC;KAChB;AACL,CAAC;AAED,IAAM,oBAAoB,GAAG,UAAC,SAA8B,EAAE,QAAuB;IACjF,OAAO,SAAS,IAAI,SAAS,CAAC,IAAI,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACnG,CAAC,CAAC","sourcesContent":["import { deleteSelection, isModifierKey } from 'roosterjs-content-model-core';\r\nimport { handleEnterOnList } from './inputSteps/handleEnterOnList';\r\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\r\nimport type { DOMSelection, IStandaloneEditor } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function keyboardInput(editor: IStandaloneEditor, rawEvent: KeyboardEvent) {\r\n const selection = editor.getDOMSelection();\r\n\r\n if (shouldInputWithContentModel(selection, rawEvent)) {\r\n editor.takeSnapshot();\r\n\r\n editor.formatContentModel(\r\n (model, context) => {\r\n const result = deleteSelection(model, getInputSteps(selection, rawEvent), context);\r\n\r\n // We have deleted selection then we will let browser to handle the input.\r\n // With this combined operation, we don't wan to mass up the cached model so clear it\r\n context.clearModelCache = true;\r\n\r\n // Skip undo snapshot here and add undo snapshot before the operation so that we don't add another undo snapshot in middle of this replace operation\r\n context.skipUndoSnapshot = true;\r\n\r\n if (result.deleteResult == 'range') {\r\n // We have deleted something, next input should inherit the segment format from deleted content, so set pending format here\r\n context.newPendingFormat = result.insertPoint?.marker.format;\r\n\r\n normalizeContentModel(model);\r\n\r\n // Do not preventDefault since we still want browser to handle the final input for now\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n },\r\n {\r\n rawEvent,\r\n }\r\n );\r\n\r\n return true;\r\n }\r\n}\r\n\r\nfunction getInputSteps(selection: DOMSelection | null, rawEvent: KeyboardEvent) {\r\n return shouldHandleEnterKey(selection, rawEvent) ? [handleEnterOnList] : [];\r\n}\r\n\r\nfunction shouldInputWithContentModel(selection: DOMSelection | null, rawEvent: KeyboardEvent) {\r\n if (!selection) {\r\n return false; // Nothing to delete\r\n } else if (\r\n !isModifierKey(rawEvent) &&\r\n (rawEvent.key == 'Enter' || rawEvent.key == 'Space' || rawEvent.key.length == 1)\r\n ) {\r\n return (\r\n selection.type != 'range' ||\r\n !selection.range.collapsed ||\r\n shouldHandleEnterKey(selection, rawEvent)\r\n );\r\n } else {\r\n return false;\r\n }\r\n}\r\n\r\nconst shouldHandleEnterKey = (selection: DOMSelection | null, rawEvent: KeyboardEvent) => {\r\n return selection && selection.type == 'range' && rawEvent.key == 'Enter' && !rawEvent.shiftKey;\r\n};\r\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-core';
|
|
2
|
+
import { setModelIndentation } from 'roosterjs-content-model-api';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export function keyboardTab(editor, rawEvent) {
|
|
7
|
+
var selection = editor.getDOMSelection();
|
|
8
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'range') {
|
|
9
|
+
editor.takeSnapshot();
|
|
10
|
+
editor.formatContentModel(function (model, _context) {
|
|
11
|
+
return handleTabOnList(model, rawEvent);
|
|
12
|
+
});
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function isMarkerAtStartOfBlock(listItem) {
|
|
17
|
+
return (listItem.blocks[0].blockType == 'Paragraph' &&
|
|
18
|
+
listItem.blocks[0].segments[0].segmentType == 'SelectionMarker');
|
|
19
|
+
}
|
|
20
|
+
function handleTabOnList(model, rawEvent) {
|
|
21
|
+
var blocks = getOperationalBlocks(model, ['ListItem'], ['TableCell']);
|
|
22
|
+
var listItem = blocks[0].block;
|
|
23
|
+
if (isBlockGroupOfType(listItem, 'ListItem') &&
|
|
24
|
+
isMarkerAtStartOfBlock(listItem)) {
|
|
25
|
+
setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');
|
|
26
|
+
rawEvent.preventDefault();
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=keyboardTab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboardTab.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/keyboardTab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAOlE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAyB,EAAE,QAAuB;IAC1E,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,KAAI,OAAO,EAAE;QAC5B,MAAM,CAAC,YAAY,EAAE,CAAC;QAEtB,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,QAAQ;YACtC,OAAO,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;KACf;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,QAA8B;IAC1D,OAAO,CACH,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,WAAW;QAC3C,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAClE,CAAC;AACN,CAAC;AAED,SAAS,eAAe,CAAC,KAA2B,EAAE,QAAuB;IACzE,IAAM,MAAM,GAAG,oBAAoB,CAAuB,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9F,IAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEjC,IACI,kBAAkB,CAAuB,QAAQ,EAAE,UAAU,CAAC;QAC9D,sBAAsB,CAAC,QAAQ,CAAC,EAClC;QACE,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrE,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-core';\r\nimport { setModelIndentation } from 'roosterjs-content-model-api';\r\nimport type {\r\n ContentModelDocument,\r\n ContentModelListItem,\r\n IStandaloneEditor,\r\n} from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function keyboardTab(editor: IStandaloneEditor, rawEvent: KeyboardEvent) {\r\n const selection = editor.getDOMSelection();\r\n\r\n if (selection?.type == 'range') {\r\n editor.takeSnapshot();\r\n\r\n editor.formatContentModel((model, _context) => {\r\n return handleTabOnList(model, rawEvent);\r\n });\r\n\r\n return true;\r\n }\r\n}\r\n\r\nfunction isMarkerAtStartOfBlock(listItem: ContentModelListItem) {\r\n return (\r\n listItem.blocks[0].blockType == 'Paragraph' &&\r\n listItem.blocks[0].segments[0].segmentType == 'SelectionMarker'\r\n );\r\n}\r\n\r\nfunction handleTabOnList(model: ContentModelDocument, rawEvent: KeyboardEvent) {\r\n const blocks = getOperationalBlocks<ContentModelListItem>(model, ['ListItem'], ['TableCell']);\r\n const listItem = blocks[0].block;\r\n\r\n if (\r\n isBlockGroupOfType<ContentModelListItem>(listItem, 'ListItem') &&\r\n isMarkerAtStartOfBlock(listItem)\r\n ) {\r\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\r\n rawEvent.preventDefault();\r\n return true;\r\n }\r\n return false;\r\n}\r\n"]}
|
|
@@ -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,72 +1,72 @@
|
|
|
1
|
-
import { __read, __spreadArray } from "tslib";
|
|
2
|
-
import { isGeneralSegment } from 'roosterjs-content-model-dom';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export function getLeafSiblingBlock(path, block, isNext) {
|
|
7
|
-
var _a;
|
|
8
|
-
var newPath = __spreadArray([], __read(path), false);
|
|
9
|
-
var _loop_1 = function () {
|
|
10
|
-
var group = newPath[0];
|
|
11
|
-
var index = group.blocks.indexOf(block);
|
|
12
|
-
if (index < 0) {
|
|
13
|
-
return "break";
|
|
14
|
-
}
|
|
15
|
-
var nextBlock = group.blocks[index + (isNext ? 1 : -1)];
|
|
16
|
-
if (nextBlock) {
|
|
17
|
-
while (nextBlock.blockType == 'BlockGroup') {
|
|
18
|
-
var child = nextBlock.blocks[isNext ? 0 : nextBlock.blocks.length - 1];
|
|
19
|
-
if (!child) {
|
|
20
|
-
return { value: { block: nextBlock, path: newPath } };
|
|
21
|
-
}
|
|
22
|
-
else if (child.blockType != 'BlockGroup') {
|
|
23
|
-
newPath.unshift(nextBlock);
|
|
24
|
-
return { value: { block: child, path: newPath } };
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
newPath.unshift(nextBlock);
|
|
28
|
-
nextBlock = child;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return { value: { block: nextBlock, path: newPath } };
|
|
32
|
-
}
|
|
33
|
-
else if (isGeneralSegment(group)) {
|
|
34
|
-
// For general segment, we need to check if there is sibling segment under the same paragraph
|
|
35
|
-
// First let's find the parent paragraph of this segment
|
|
36
|
-
newPath.shift();
|
|
37
|
-
var segmentIndex_1 = -1;
|
|
38
|
-
var segment_1 = group;
|
|
39
|
-
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; });
|
|
40
|
-
if (para) {
|
|
41
|
-
// Now we have found the parent paragraph, so let's check if it has a sibling segment
|
|
42
|
-
var siblingSegment = para.segments[segmentIndex_1 + (isNext ? 1 : -1)];
|
|
43
|
-
if (siblingSegment) {
|
|
44
|
-
return { value: { block: para, path: newPath, siblingSegment: siblingSegment } };
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
// No sibling segment, let's keep go upper level
|
|
48
|
-
block = para;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return "break";
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else if (group.blockGroupType != 'Document' && group.blockGroupType != 'TableCell') {
|
|
56
|
-
newPath.shift();
|
|
57
|
-
block = group;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
return "break";
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
while (newPath.length > 0) {
|
|
64
|
-
var state_1 = _loop_1();
|
|
65
|
-
if (typeof state_1 === "object")
|
|
66
|
-
return state_1.value;
|
|
67
|
-
if (state_1 === "break")
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
|
+
import { isGeneralSegment } from 'roosterjs-content-model-dom';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export function getLeafSiblingBlock(path, block, isNext) {
|
|
7
|
+
var _a;
|
|
8
|
+
var newPath = __spreadArray([], __read(path), false);
|
|
9
|
+
var _loop_1 = function () {
|
|
10
|
+
var group = newPath[0];
|
|
11
|
+
var index = group.blocks.indexOf(block);
|
|
12
|
+
if (index < 0) {
|
|
13
|
+
return "break";
|
|
14
|
+
}
|
|
15
|
+
var nextBlock = group.blocks[index + (isNext ? 1 : -1)];
|
|
16
|
+
if (nextBlock) {
|
|
17
|
+
while (nextBlock.blockType == 'BlockGroup') {
|
|
18
|
+
var child = nextBlock.blocks[isNext ? 0 : nextBlock.blocks.length - 1];
|
|
19
|
+
if (!child) {
|
|
20
|
+
return { value: { block: nextBlock, path: newPath } };
|
|
21
|
+
}
|
|
22
|
+
else if (child.blockType != 'BlockGroup') {
|
|
23
|
+
newPath.unshift(nextBlock);
|
|
24
|
+
return { value: { block: child, path: newPath } };
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
newPath.unshift(nextBlock);
|
|
28
|
+
nextBlock = child;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { value: { block: nextBlock, path: newPath } };
|
|
32
|
+
}
|
|
33
|
+
else if (isGeneralSegment(group)) {
|
|
34
|
+
// For general segment, we need to check if there is sibling segment under the same paragraph
|
|
35
|
+
// First let's find the parent paragraph of this segment
|
|
36
|
+
newPath.shift();
|
|
37
|
+
var segmentIndex_1 = -1;
|
|
38
|
+
var segment_1 = group;
|
|
39
|
+
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; });
|
|
40
|
+
if (para) {
|
|
41
|
+
// Now we have found the parent paragraph, so let's check if it has a sibling segment
|
|
42
|
+
var siblingSegment = para.segments[segmentIndex_1 + (isNext ? 1 : -1)];
|
|
43
|
+
if (siblingSegment) {
|
|
44
|
+
return { value: { block: para, path: newPath, siblingSegment: siblingSegment } };
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// No sibling segment, let's keep go upper level
|
|
48
|
+
block = para;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return "break";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else if (group.blockGroupType != 'Document' && group.blockGroupType != 'TableCell') {
|
|
56
|
+
newPath.shift();
|
|
57
|
+
block = group;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return "break";
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
while (newPath.length > 0) {
|
|
64
|
+
var state_1 = _loop_1();
|
|
65
|
+
if (typeof state_1 === "object")
|
|
66
|
+
return state_1.value;
|
|
67
|
+
if (state_1 === "break")
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
72
|
//# sourceMappingURL=getLeafSiblingBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLeafSiblingBlock.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/utils/getLeafSiblingBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AA6B/D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAC/B,IAA8B,EAC9B,KAAwB,EACxB,MAAe;;IAEf,IAAM,OAAO,4BAAO,IAAI,SAAC,CAAC;;QAGtB,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE1C,IAAI,KAAK,GAAG,CAAC,EAAE;;SAEd;QAED,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,IAAI,SAAS,EAAE;YACX,OAAO,SAAS,CAAC,SAAS,IAAI,YAAY,EAAE;gBACxC,IAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAEzE,IAAI,CAAC,KAAK,EAAE;oCACD,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;iBAC7C;qBAAM,IAAI,KAAK,CAAC,SAAS,IAAI,YAAY,EAAE;oBACxC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;oCACpB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE;iBACzC;qBAAM;oBACH,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;oBAC3B,SAAS,GAAG,KAAK,CAAC;iBACrB;aACJ;4BAEM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;SAC7C;aAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAChC,6FAA6F;YAC7F,wDAAwD;YACxD,OAAO,CAAC,KAAK,EAAE,CAAC;YAEhB,IAAI,cAAY,GAAG,CAAC,CAAC,CAAC;YACtB,IAAM,SAAO,GAAG,KAAK,CAAC;YACtB,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;YAE3B,IAAI,IAAI,EAAE;gBACN,qFAAqF;gBACrF,IAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAY,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAEvE,IAAI,cAAc,EAAE;oCAET,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,gBAAA,EAAE;iBACxD;qBAAM;oBACH,gDAAgD;oBAChD,KAAK,GAAG,IAAI,CAAC;iBAChB;aACJ;iBAAM;;aAGN;SACJ;aAAM,IAAI,KAAK,CAAC,cAAc,IAAI,UAAU,IAAI,KAAK,CAAC,cAAc,IAAI,WAAW,EAAE;YAClF,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,KAAK,GAAG,KAAK,CAAC;SACjB;aAAM;;SAEN;;IAzDL,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;;;;;;KA0DxB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","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"]}
|
|
1
|
+
{"version":3,"file":"getLeafSiblingBlock.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/utils/getLeafSiblingBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AA6B/D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAC/B,IAA8B,EAC9B,KAAwB,EACxB,MAAe;;IAEf,IAAM,OAAO,4BAAO,IAAI,SAAC,CAAC;;QAGtB,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE1C,IAAI,KAAK,GAAG,CAAC,EAAE;;SAEd;QAED,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,IAAI,SAAS,EAAE;YACX,OAAO,SAAS,CAAC,SAAS,IAAI,YAAY,EAAE;gBACxC,IAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAEzE,IAAI,CAAC,KAAK,EAAE;oCACD,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;iBAC7C;qBAAM,IAAI,KAAK,CAAC,SAAS,IAAI,YAAY,EAAE;oBACxC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;oCACpB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE;iBACzC;qBAAM;oBACH,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;oBAC3B,SAAS,GAAG,KAAK,CAAC;iBACrB;aACJ;4BAEM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;SAC7C;aAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAChC,6FAA6F;YAC7F,wDAAwD;YACxD,OAAO,CAAC,KAAK,EAAE,CAAC;YAEhB,IAAI,cAAY,GAAG,CAAC,CAAC,CAAC;YACtB,IAAM,SAAO,GAAG,KAAK,CAAC;YACtB,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;YAE3B,IAAI,IAAI,EAAE;gBACN,qFAAqF;gBACrF,IAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAY,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAEvE,IAAI,cAAc,EAAE;oCAET,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,gBAAA,EAAE;iBACxD;qBAAM;oBACH,gDAAgD;oBAChD,KAAK,GAAG,IAAI,CAAC;iBAChB;aACJ;iBAAM;;aAGN;SACJ;aAAM,IAAI,KAAK,CAAC,cAAc,IAAI,UAAU,IAAI,KAAK,CAAC,cAAc,IAAI,WAAW,EAAE;YAClF,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,KAAK,GAAG,KAAK,CAAC;SACjB;aAAM;;SAEN;;IAzDL,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;;;;;;KA0DxB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { isGeneralSegment } from 'roosterjs-content-model-dom';\r\nimport type {\r\n ContentModelBlock,\r\n ContentModelBlockGroup,\r\n ContentModelParagraph,\r\n ContentModelSegment,\r\n} from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type BlockAndPath = {\r\n /**\r\n * The sibling block\r\n */\r\n block: ContentModelBlock;\r\n\r\n /**\r\n * Path of this sibling block\r\n */\r\n path: ContentModelBlockGroup[];\r\n\r\n /**\r\n * If the input block is under a general segment, it is possible there are sibling segments under the same paragraph.\r\n * Use this property to return the sibling sibling under the same paragraph\r\n */\r\n siblingSegment?: ContentModelSegment;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getLeafSiblingBlock(\r\n path: ContentModelBlockGroup[],\r\n block: ContentModelBlock,\r\n isNext: boolean\r\n): BlockAndPath | null {\r\n const newPath = [...path];\r\n\r\n while (newPath.length > 0) {\r\n const group = newPath[0];\r\n const index = group.blocks.indexOf(block);\r\n\r\n if (index < 0) {\r\n break;\r\n }\r\n\r\n let nextBlock = group.blocks[index + (isNext ? 1 : -1)];\r\n\r\n if (nextBlock) {\r\n while (nextBlock.blockType == 'BlockGroup') {\r\n const child = nextBlock.blocks[isNext ? 0 : nextBlock.blocks.length - 1];\r\n\r\n if (!child) {\r\n return { block: nextBlock, path: newPath };\r\n } else if (child.blockType != 'BlockGroup') {\r\n newPath.unshift(nextBlock);\r\n return { block: child, path: newPath };\r\n } else {\r\n newPath.unshift(nextBlock);\r\n nextBlock = child;\r\n }\r\n }\r\n\r\n return { block: nextBlock, path: newPath };\r\n } else if (isGeneralSegment(group)) {\r\n // For general segment, we need to check if there is sibling segment under the same paragraph\r\n // First let's find the parent paragraph of this segment\r\n newPath.shift();\r\n\r\n let segmentIndex = -1;\r\n const segment = group;\r\n const para = newPath[0]?.blocks.find(\r\n x => x.blockType == 'Paragraph' && (segmentIndex = x.segments.indexOf(segment)) >= 0\r\n ) as ContentModelParagraph;\r\n\r\n if (para) {\r\n // Now we have found the parent paragraph, so let's check if it has a sibling segment\r\n const siblingSegment = para.segments[segmentIndex + (isNext ? 1 : -1)];\r\n\r\n if (siblingSegment) {\r\n // Return this block, path and segment since we have found it\r\n return { block: para, path: newPath, siblingSegment };\r\n } else {\r\n // No sibling segment, let's keep go upper level\r\n block = para;\r\n }\r\n } else {\r\n // Parent sibling is not found (in theory this should never happen), just return null\r\n break;\r\n }\r\n } else if (group.blockGroupType != 'Document' && group.blockGroupType != 'TableCell') {\r\n newPath.shift();\r\n block = group;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n"]}
|
package/lib-mjs/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { PastePlugin } from './paste/PastePlugin';
|
|
2
|
+
export { EditPlugin } from './edit/EditPlugin';
|
|
3
|
+
export { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';
|