roosterjs-content-model-plugins 0.24.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/autoFormat/AutoFormatPlugin.d.ts +53 -0
- package/lib/autoFormat/AutoFormatPlugin.js +81 -0
- package/lib/autoFormat/AutoFormatPlugin.js.map +1 -0
- package/lib/autoFormat/keyboardListTrigger.d.ts +5 -0
- package/lib/autoFormat/keyboardListTrigger.js +46 -0
- package/lib/autoFormat/keyboardListTrigger.js.map +1 -0
- package/lib/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
- package/lib/autoFormat/utils/convertAlphaToDecimals.js +23 -0
- package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
- package/lib/autoFormat/utils/getIndex.d.ts +4 -0
- package/lib/autoFormat/utils/getIndex.js +14 -0
- package/lib/autoFormat/utils/getIndex.js.map +1 -0
- package/lib/autoFormat/utils/getListTypeStyle.d.ts +14 -0
- package/lib/autoFormat/utils/getListTypeStyle.js +88 -0
- package/lib/autoFormat/utils/getListTypeStyle.js.map +1 -0
- package/lib/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
- package/lib/autoFormat/utils/getNumberingListStyle.js +154 -0
- package/lib/autoFormat/utils/getNumberingListStyle.js.map +1 -0
- package/{lib-mjs/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-mjs/paste/ContentModelPastePlugin.d.ts → lib/paste/PastePlugin.d.ts} +43 -43
- package/lib/paste/{ContentModelPastePlugin.js → PastePlugin.js} +131 -132
- 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/AutoFormatPlugin.d.ts +53 -0
- package/lib-amd/autoFormat/AutoFormatPlugin.js +82 -0
- package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -0
- package/lib-amd/autoFormat/keyboardListTrigger.d.ts +5 -0
- package/lib-amd/autoFormat/keyboardListTrigger.js +44 -0
- package/lib-amd/autoFormat/keyboardListTrigger.js.map +1 -0
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js +25 -0
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
- package/lib-amd/autoFormat/utils/getIndex.d.ts +4 -0
- package/lib-amd/autoFormat/utils/getIndex.js +15 -0
- package/lib-amd/autoFormat/utils/getIndex.js.map +1 -0
- package/lib-amd/autoFormat/utils/getListTypeStyle.d.ts +14 -0
- package/lib-amd/autoFormat/utils/getListTypeStyle.js +87 -0
- package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +1 -0
- package/lib-amd/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js +154 -0
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +1 -0
- package/lib-amd/edit/{ContentModelEditPlugin.d.ts → 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 -124
- 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-mjs/autoFormat/AutoFormatPlugin.d.ts +53 -0
- package/lib-mjs/autoFormat/AutoFormatPlugin.js +78 -0
- package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -0
- package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +5 -0
- package/lib-mjs/autoFormat/keyboardListTrigger.js +42 -0
- package/lib-mjs/autoFormat/keyboardListTrigger.js.map +1 -0
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js +19 -0
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
- package/lib-mjs/autoFormat/utils/getIndex.d.ts +4 -0
- package/lib-mjs/autoFormat/utils/getIndex.js +10 -0
- package/lib-mjs/autoFormat/utils/getIndex.js.map +1 -0
- package/lib-mjs/autoFormat/utils/getListTypeStyle.d.ts +14 -0
- package/lib-mjs/autoFormat/utils/getListTypeStyle.js +84 -0
- package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +1 -0
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js +150 -0
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +1 -0
- 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-amd/paste/ContentModelPastePlugin.d.ts → lib-mjs/paste/PastePlugin.d.ts} +43 -43
- package/lib-mjs/paste/{ContentModelPastePlugin.js → PastePlugin.js} +128 -129
- 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 -7
- package/lib/edit/ContentModelEditPlugin.js +0 -75
- package/lib/edit/ContentModelEditPlugin.js.map +0 -1
- package/lib/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
- package/lib/entityDelimiter/EntityDelimiterPlugin.js +0 -257
- package/lib/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
- package/lib/paste/ContentModelPastePlugin.js.map +0 -1
- package/lib-amd/edit/ContentModelEditPlugin.js +0 -75
- package/lib-amd/edit/ContentModelEditPlugin.js.map +0 -1
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js +0 -256
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
- package/lib-amd/paste/ContentModelPastePlugin.js.map +0 -1
- package/lib-mjs/edit/ContentModelEditPlugin.js +0 -72
- package/lib-mjs/edit/ContentModelEditPlugin.js.map +0 -1
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js +0 -253
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
- package/lib-mjs/paste/ContentModelPastePlugin.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-core", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_core_1, roosterjs_content_model_dom_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.handleEnterOnList = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
var handleEnterOnList = function (context) {
|
|
9
|
+
if (context.deleteResult == 'nothingToDelete' ||
|
|
10
|
+
context.deleteResult == 'notDeleted' ||
|
|
11
|
+
context.deleteResult == 'range') {
|
|
12
|
+
var insertPoint = context.insertPoint, formatContext = context.formatContext;
|
|
13
|
+
var path = insertPoint.path;
|
|
14
|
+
var rawEvent = formatContext === null || formatContext === void 0 ? void 0 : formatContext.rawEvent;
|
|
15
|
+
var index = (0, roosterjs_content_model_core_1.getClosestAncestorBlockGroupIndex)(path, ['ListItem'], ['TableCell']);
|
|
16
|
+
var listItem = path[index];
|
|
17
|
+
if (listItem && listItem.blockGroupType === 'ListItem') {
|
|
18
|
+
var listParent = path[index + 1];
|
|
19
|
+
if (isEmptyListItem(listItem)) {
|
|
20
|
+
listItem.levels.pop();
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
createNewListItem(context, listItem, listParent);
|
|
24
|
+
}
|
|
25
|
+
rawEvent === null || rawEvent === void 0 ? void 0 : rawEvent.preventDefault();
|
|
26
|
+
context.deleteResult = 'range';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.handleEnterOnList = handleEnterOnList;
|
|
31
|
+
var isEmptyListItem = function (listItem) {
|
|
32
|
+
return (listItem.blocks.length === 1 &&
|
|
33
|
+
listItem.blocks[0].blockType === 'Paragraph' &&
|
|
34
|
+
listItem.blocks[0].segments.length === 2 &&
|
|
35
|
+
listItem.blocks[0].segments[0].segmentType === 'SelectionMarker' &&
|
|
36
|
+
listItem.blocks[0].segments[1].segmentType === 'Br');
|
|
37
|
+
};
|
|
38
|
+
var createNewListItem = function (context, listItem, listParent) {
|
|
39
|
+
var insertPoint = context.insertPoint;
|
|
40
|
+
var listIndex = listParent.blocks.indexOf(listItem);
|
|
41
|
+
var newParagraph = createNewParagraph(insertPoint);
|
|
42
|
+
var levels = createNewListLevel(listItem);
|
|
43
|
+
var newListItem = (0, roosterjs_content_model_dom_1.createListItem)(levels, insertPoint.marker.format);
|
|
44
|
+
newListItem.blocks.push(newParagraph);
|
|
45
|
+
listParent.blocks.splice(listIndex + 1, 0, newListItem);
|
|
46
|
+
};
|
|
47
|
+
var createNewListLevel = function (listItem) {
|
|
48
|
+
return listItem.levels.map(function (level) {
|
|
49
|
+
return (0, roosterjs_content_model_dom_1.createListLevel)(level.listType, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, level.format), { startNumberOverride: undefined }), level.dataset);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
var createNewParagraph = function (insertPoint) {
|
|
53
|
+
var _a;
|
|
54
|
+
var paragraph = insertPoint.paragraph, marker = insertPoint.marker;
|
|
55
|
+
var newParagraph = (0, roosterjs_content_model_dom_1.createParagraph)(false /*isImplicit*/, paragraph.format, paragraph.segmentFormat);
|
|
56
|
+
var markerIndex = paragraph.segments.indexOf(marker);
|
|
57
|
+
var segments = paragraph.segments.splice(markerIndex, paragraph.segments.length - markerIndex);
|
|
58
|
+
(_a = newParagraph.segments).push.apply(_a, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(segments), false));
|
|
59
|
+
(0, roosterjs_content_model_dom_1.setParagraphNotImplicit)(paragraph);
|
|
60
|
+
if (paragraph.segments.every(function (x) { return x.segmentType == 'SelectionMarker'; })) {
|
|
61
|
+
paragraph.segments.push((0, roosterjs_content_model_dom_1.createBr)(marker.format));
|
|
62
|
+
}
|
|
63
|
+
(0, roosterjs_content_model_dom_1.normalizeParagraph)(newParagraph);
|
|
64
|
+
return newParagraph;
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=handleEnterOnList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleEnterOnList.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/inputSteps/handleEnterOnList.ts"],"names":[],"mappings":";;;;IAiBA;;OAEG;IACI,IAAM,iBAAiB,GAAwB,UAAA,OAAO;QACzD,IACI,OAAO,CAAC,YAAY,IAAI,iBAAiB;YACzC,OAAO,CAAC,YAAY,IAAI,YAAY;YACpC,OAAO,CAAC,YAAY,IAAI,OAAO,EACjC;YACU,IAAA,WAAW,GAAoB,OAAO,YAA3B,EAAE,aAAa,GAAK,OAAO,cAAZ,CAAa;YACvC,IAAA,IAAI,GAAK,WAAW,KAAhB,CAAiB;YAC7B,IAAM,QAAQ,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,CAAC;YACzC,IAAM,KAAK,GAAG,IAAA,gEAAiC,EAAC,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;YAEnF,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAE7B,IAAI,QAAQ,IAAI,QAAQ,CAAC,cAAc,KAAK,UAAU,EAAE;gBACpD,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;gBACnC,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE;oBAC3B,QAAQ,CAAC,MAAM,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AC;QACjC,OAAO,YAAY,CAAC;IACxB,CAAC,CAAC","sourcesContent":["import { getClosestAncestorBlockGroupIndex } from 'roosterjs-content-model-core';\r\nimport {\r\n createBr,\r\n createListItem,\r\n createListLevel,\r\n createParagraph,\r\n normalizeParagraph,\r\n setParagraphNotImplicit,\r\n} from 'roosterjs-content-model-dom';\r\nimport type {\r\n ContentModelBlockGroup,\r\n ContentModelListItem,\r\n DeleteSelectionStep,\r\n InsertPoint,\r\n ValidDeleteSelectionContext,\r\n} from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport const handleEnterOnList: DeleteSelectionStep = context => {\r\n if (\r\n context.deleteResult == 'nothingToDelete' ||\r\n context.deleteResult == 'notDeleted' ||\r\n context.deleteResult == 'range'\r\n ) {\r\n const { insertPoint, formatContext } = context;\r\n const { path } = insertPoint;\r\n const rawEvent = formatContext?.rawEvent;\r\n const index = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\r\n\r\n const listItem = path[index];\r\n\r\n if (listItem && listItem.blockGroupType === 'ListItem') {\r\n const listParent = path[index + 1];\r\n if (isEmptyListItem(listItem)) {\r\n listItem.levels.pop();\r\n } else {\r\n createNewListItem(context, listItem, listParent);\r\n }\r\n rawEvent?.preventDefault();\r\n context.deleteResult = 'range';\r\n }\r\n }\r\n};\r\n\r\nconst isEmptyListItem = (listItem: ContentModelListItem) => {\r\n return (\r\n listItem.blocks.length === 1 &&\r\n listItem.blocks[0].blockType === 'Paragraph' &&\r\n listItem.blocks[0].segments.length === 2 &&\r\n listItem.blocks[0].segments[0].segmentType === 'SelectionMarker' &&\r\n listItem.blocks[0].segments[1].segmentType === 'Br'\r\n );\r\n};\r\n\r\nconst createNewListItem = (\r\n context: ValidDeleteSelectionContext,\r\n listItem: ContentModelListItem,\r\n listParent: ContentModelBlockGroup\r\n) => {\r\n const { insertPoint } = context;\r\n const listIndex = listParent.blocks.indexOf(listItem);\r\n const newParagraph = createNewParagraph(insertPoint);\r\n const levels = createNewListLevel(listItem);\r\n const newListItem = createListItem(levels, insertPoint.marker.format);\r\n newListItem.blocks.push(newParagraph);\r\n listParent.blocks.splice(listIndex + 1, 0, newListItem);\r\n};\r\n\r\nconst createNewListLevel = (listItem: ContentModelListItem) => {\r\n return listItem.levels.map(level => {\r\n return createListLevel(\r\n level.listType,\r\n {\r\n ...level.format,\r\n startNumberOverride: undefined,\r\n },\r\n level.dataset\r\n );\r\n });\r\n};\r\n\r\nconst createNewParagraph = (insertPoint: InsertPoint) => {\r\n const { paragraph, marker } = insertPoint;\r\n const newParagraph = createParagraph(\r\n false /*isImplicit*/,\r\n paragraph.format,\r\n paragraph.segmentFormat\r\n );\r\n\r\n const markerIndex = paragraph.segments.indexOf(marker);\r\n const segments = paragraph.segments.splice(\r\n markerIndex,\r\n paragraph.segments.length - markerIndex\r\n );\r\n\r\n newParagraph.segments.push(...segments);\r\n\r\n setParagraphNotImplicit(paragraph);\r\n\r\n if (paragraph.segments.every(x => x.segmentType == 'SelectionMarker')) {\r\n paragraph.segments.push(createBr(marker.format));\r\n }\r\n\r\n normalizeParagraph(newParagraph);\r\n return newParagraph;\r\n};\r\n"]}
|
|
@@ -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,70 +1,67 @@
|
|
|
1
|
-
define(["require", "exports", "roosterjs-content-model-core", "./deleteSteps/deleteAllSegmentBefore", "./deleteSteps/deleteList", "roosterjs-content-model-dom", "./handleKeyboardEventCommon", "./deleteSteps/deleteWordSelection", "./deleteSteps/deleteCollapsedSelection"], function (require, exports, roosterjs_content_model_core_1, deleteAllSegmentBefore_1, deleteList_1, roosterjs_content_model_dom_1, handleKeyboardEventCommon_1, deleteWordSelection_1, deleteCollapsedSelection_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.keyboardDelete = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* Do keyboard event handling for DELETE/BACKSPACE key
|
|
8
|
-
* @param editor The Content Model Editor
|
|
9
|
-
* @param rawEvent DOM keyboard event
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (!selection) {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
else
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
range.startOffset < ((_b = (_a = range.startContainer.nodeValue) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - 1);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-core", "./deleteSteps/deleteAllSegmentBefore", "./deleteSteps/deleteList", "roosterjs-content-model-dom", "./handleKeyboardEventCommon", "./deleteSteps/deleteWordSelection", "./deleteSteps/deleteCollapsedSelection"], function (require, exports, roosterjs_content_model_core_1, deleteAllSegmentBefore_1, deleteList_1, roosterjs_content_model_dom_1, handleKeyboardEventCommon_1, deleteWordSelection_1, deleteCollapsedSelection_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.keyboardDelete = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* Do keyboard event handling for DELETE/BACKSPACE key
|
|
8
|
+
* @param editor The Content Model Editor
|
|
9
|
+
* @param rawEvent DOM keyboard event
|
|
10
|
+
* @returns True if the event is handled by content model, otherwise false
|
|
11
|
+
*/
|
|
12
|
+
function keyboardDelete(editor, rawEvent) {
|
|
13
|
+
var handled = false;
|
|
14
|
+
var selection = editor.getDOMSelection();
|
|
15
|
+
if (shouldDeleteWithContentModel(selection, rawEvent)) {
|
|
16
|
+
editor.formatContentModel(function (model, context) {
|
|
17
|
+
var result = (0, roosterjs_content_model_core_1.deleteSelection)(model, getDeleteSteps(rawEvent, !!editor.getEnvironment().isMac), context).deleteResult;
|
|
18
|
+
handled = (0, handleKeyboardEventCommon_1.handleKeyboardEventResult)(editor, model, rawEvent, result, context);
|
|
19
|
+
return handled;
|
|
20
|
+
}, {
|
|
21
|
+
rawEvent: rawEvent,
|
|
22
|
+
changeSource: roosterjs_content_model_core_1.ChangeSource.Keyboard,
|
|
23
|
+
getChangeData: function () { return rawEvent.which; },
|
|
24
|
+
apiName: rawEvent.key == 'Delete' ? 'handleDeleteKey' : 'handleBackspaceKey',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return handled;
|
|
28
|
+
}
|
|
29
|
+
exports.keyboardDelete = keyboardDelete;
|
|
30
|
+
function getDeleteSteps(rawEvent, isMac) {
|
|
31
|
+
var isForward = rawEvent.key == 'Delete';
|
|
32
|
+
var deleteAllSegmentBeforeStep = (0, handleKeyboardEventCommon_1.shouldDeleteAllSegmentsBefore)(rawEvent) && !isForward ? deleteAllSegmentBefore_1.deleteAllSegmentBefore : null;
|
|
33
|
+
var deleteWordSelection = (0, handleKeyboardEventCommon_1.shouldDeleteWord)(rawEvent, isMac)
|
|
34
|
+
? isForward
|
|
35
|
+
? deleteWordSelection_1.forwardDeleteWordSelection
|
|
36
|
+
: deleteWordSelection_1.backwardDeleteWordSelection
|
|
37
|
+
: null;
|
|
38
|
+
var deleteCollapsedSelection = isForward
|
|
39
|
+
? deleteCollapsedSelection_1.forwardDeleteCollapsedSelection
|
|
40
|
+
: deleteCollapsedSelection_1.backwardDeleteCollapsedSelection;
|
|
41
|
+
return [deleteAllSegmentBeforeStep, deleteWordSelection, deleteCollapsedSelection, deleteList_1.deleteList];
|
|
42
|
+
}
|
|
43
|
+
function shouldDeleteWithContentModel(selection, rawEvent) {
|
|
44
|
+
if (!selection) {
|
|
45
|
+
return false; // Nothing to delete
|
|
46
|
+
}
|
|
47
|
+
else if (selection.type != 'range' || !selection.range.collapsed) {
|
|
48
|
+
return true; // Selection is not collapsed, need to delete all selections
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
var range = selection.range;
|
|
52
|
+
// When selection is collapsed and is in middle of text node, no need to use Content Model to delete
|
|
53
|
+
return !((0, roosterjs_content_model_dom_1.isNodeOfType)(range.startContainer, 'TEXT_NODE') &&
|
|
54
|
+
!(0, roosterjs_content_model_core_1.isModifierKey)(rawEvent) &&
|
|
55
|
+
(canDeleteBefore(rawEvent, range) || canDeleteAfter(rawEvent, range)));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function canDeleteBefore(rawEvent, range) {
|
|
59
|
+
return rawEvent.key == 'Backspace' && range.startOffset > 1;
|
|
60
|
+
}
|
|
61
|
+
function canDeleteAfter(rawEvent, range) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return (rawEvent.key == 'Delete' &&
|
|
64
|
+
range.startOffset < ((_b = (_a = range.startContainer.nodeValue) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - 1);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
70
67
|
//# 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":";;;;IAuBA
|
|
1
|
+
{"version":3,"file":"keyboardDelete.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/keyboardDelete.ts"],"names":[],"mappings":";;;;IAuBA;;;;;;OAMG;IACH,SAAgB,cAAc,CAAC,MAAyB,EAAE,QAAuB;QAC7E,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;QAE3C,IAAI,4BAA4B,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;YACnD,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;gBACX,IAAM,MAAM,GAAG,IAAA,8CAAe,EAC1B,KAAK,EACL,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,EACzD,OAAO,CACV,CAAC,YAAY,CAAC;gBAEf,OAAO,GAAG,IAAA,qDAAyB,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;g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AG,SAAS,CAAC,KAAK,CAAC;YAE9B,oGAAoG;YACpG,OAAO,CAAC,CACJ,IAAA,0CAAY,EAAC,KAAK,CAAC,cAAc,EAAE,WAAW,CAAC;gBAC/C,CAAC,IAAA,4CAAa,EAAC,QAAQ,CAAC;gBACxB,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CACxE,CAAC;SACL;IACL,CAAC;IAED,SAAS,eAAe,CAAC,QAAuB,EAAE,KAAY;QAC1D,OAAO,QAAQ,CAAC,GAAG,IAAI,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;IAChE,CAAC;IAED,SAAS,cAAc,CAAC,QAAuB,EAAE,KAAY;;QACzD,OAAO,CACH,QAAQ,CAAC,GAAG,IAAI,QAAQ;YACxB,KAAK,CAAC,WAAW,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,cAAc,CAAC,SAAS,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,CAAC,CACxE,CAAC;IACN,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,51 +1,58 @@
|
|
|
1
|
-
define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_core_1, roosterjs_content_model_dom_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.keyboardInput = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
function keyboardInput(editor, rawEvent) {
|
|
9
|
-
var selection = editor.getDOMSelection();
|
|
10
|
-
if (shouldInputWithContentModel(selection, rawEvent
|
|
11
|
-
editor.takeSnapshot();
|
|
12
|
-
editor.formatContentModel(function (model, context) {
|
|
13
|
-
var _a;
|
|
14
|
-
var result = (0, roosterjs_content_model_core_1.deleteSelection)(model,
|
|
15
|
-
// We have deleted selection then we will let browser to handle the input.
|
|
16
|
-
// With this combined operation, we don't wan to mass up the cached model so clear it
|
|
17
|
-
context.clearModelCache = true;
|
|
18
|
-
// 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
|
|
19
|
-
context.skipUndoSnapshot = true;
|
|
20
|
-
if (result.deleteResult == 'range') {
|
|
21
|
-
// We have deleted something, next input should inherit the segment format from deleted content, so set pending format here
|
|
22
|
-
context.newPendingFormat = (_a = result.insertPoint) === null || _a === void 0 ? void 0 : _a.marker.format;
|
|
23
|
-
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
24
|
-
// Do not preventDefault since we still want browser to handle the final input for now
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}, {
|
|
31
|
-
rawEvent: rawEvent,
|
|
32
|
-
});
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.keyboardInput = keyboardInput;
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-core", "./inputSteps/handleEnterOnList", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_core_1, handleEnterOnList_1, roosterjs_content_model_dom_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.keyboardInput = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function keyboardInput(editor, rawEvent) {
|
|
9
|
+
var selection = editor.getDOMSelection();
|
|
10
|
+
if (shouldInputWithContentModel(selection, rawEvent)) {
|
|
11
|
+
editor.takeSnapshot();
|
|
12
|
+
editor.formatContentModel(function (model, context) {
|
|
13
|
+
var _a;
|
|
14
|
+
var result = (0, roosterjs_content_model_core_1.deleteSelection)(model, getInputSteps(selection, rawEvent), context);
|
|
15
|
+
// We have deleted selection then we will let browser to handle the input.
|
|
16
|
+
// With this combined operation, we don't wan to mass up the cached model so clear it
|
|
17
|
+
context.clearModelCache = true;
|
|
18
|
+
// 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
|
|
19
|
+
context.skipUndoSnapshot = true;
|
|
20
|
+
if (result.deleteResult == 'range') {
|
|
21
|
+
// We have deleted something, next input should inherit the segment format from deleted content, so set pending format here
|
|
22
|
+
context.newPendingFormat = (_a = result.insertPoint) === null || _a === void 0 ? void 0 : _a.marker.format;
|
|
23
|
+
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
24
|
+
// Do not preventDefault since we still want browser to handle the final input for now
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
rawEvent: rawEvent,
|
|
32
|
+
});
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.keyboardInput = keyboardInput;
|
|
37
|
+
function getInputSteps(selection, rawEvent) {
|
|
38
|
+
return shouldHandleEnterKey(selection, rawEvent) ? [handleEnterOnList_1.handleEnterOnList] : [];
|
|
39
|
+
}
|
|
40
|
+
function shouldInputWithContentModel(selection, rawEvent) {
|
|
41
|
+
if (!selection) {
|
|
42
|
+
return false; // Nothing to delete
|
|
43
|
+
}
|
|
44
|
+
else if (!(0, roosterjs_content_model_core_1.isModifierKey)(rawEvent) &&
|
|
45
|
+
(rawEvent.key == 'Enter' || rawEvent.key == 'Space' || rawEvent.key.length == 1)) {
|
|
46
|
+
return (selection.type != 'range' ||
|
|
47
|
+
!selection.range.collapsed ||
|
|
48
|
+
shouldHandleEnterKey(selection, rawEvent));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var shouldHandleEnterKey = function (selection, rawEvent) {
|
|
55
|
+
return selection && selection.type == 'range' && rawEvent.key == 'Enter' && !rawEvent.shiftKey;
|
|
56
|
+
};
|
|
57
|
+
});
|
|
51
58
|
//# 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":";;;;
|
|
1
|
+
{"version":3,"file":"keyboardInput.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/keyboardInput.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACH,SAAgB,aAAa,CAAC,MAAyB,EAAE,QAAuB;QAC5E,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;QAE3C,IAAI,2BAA2B,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;YAClD,MAAM,CAAC,YAAY,EAAE,CAAC;YAEtB,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;;gBACX,IAAM,MAAM,GAAG,IAAA,8CAAe,EAAC,KAAK,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;gBAEnF,0EAA0E;gBAC1E,qFAAqF;gBACrF,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;gBAE/B,oJAAoJ;gBACpJ,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;gBAEhC,IAAI,MAAM,CAAC,YAAY,IAAI,OAAO,EAAE;oBAChC,2HAA2H;oBAC3H,OAAO,CAAC,gBAAgB,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,MAAM,CAAC,MAAM,CAAC;oBAE7D,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;oBAE7B,sFAAsF;oBACtF,OAAO,IAAI,CAAC;iBACf;qBAAM;oBACH,OAAO,KAAK,CAAC;iBAChB;YACL,CAAC,EACD;gBACI,QAAQ,UAAA;aACX,CACJ,CAAC;YAEF,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IApCD,sCAoCC;IAED,SAAS,aAAa,CAAC,SAA8B,EAAE,QAAuB;QAC1E,OAAO,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,qCAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChF,CAAC;IAED,SAAS,2BAA2B,CAAC,SAA8B,EAAE,QAAuB;QACxF,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO,KAAK,CAAC,CAAC,oBAAoB;SACrC;aAAM,IACH,CAAC,IAAA,4CAAa,EAAC,QAAQ,CAAC;YACxB,CAAC,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,EAClF;YACE,OAAO,CACH,SAAS,CAAC,IAAI,IAAI,OAAO;gBACzB,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS;gBAC1B,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAC5C,CAAC;SACL;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IAED,IAAM,oBAAoB,GAAG,UAAC,SAA8B,EAAE,QAAuB;QACjF,OAAO,SAAS,IAAI,SAAS,CAAC,IAAI,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACnG,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,35 @@
|
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_core_1, roosterjs_content_model_api_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.keyboardTab = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function keyboardTab(editor, rawEvent) {
|
|
9
|
+
var selection = editor.getDOMSelection();
|
|
10
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'range') {
|
|
11
|
+
editor.takeSnapshot();
|
|
12
|
+
editor.formatContentModel(function (model, _context) {
|
|
13
|
+
return handleTabOnList(model, rawEvent);
|
|
14
|
+
});
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.keyboardTab = keyboardTab;
|
|
19
|
+
function isMarkerAtStartOfBlock(listItem) {
|
|
20
|
+
return (listItem.blocks[0].blockType == 'Paragraph' &&
|
|
21
|
+
listItem.blocks[0].segments[0].segmentType == 'SelectionMarker');
|
|
22
|
+
}
|
|
23
|
+
function handleTabOnList(model, rawEvent) {
|
|
24
|
+
var blocks = (0, roosterjs_content_model_core_1.getOperationalBlocks)(model, ['ListItem'], ['TableCell']);
|
|
25
|
+
var listItem = blocks[0].block;
|
|
26
|
+
if ((0, roosterjs_content_model_core_1.isBlockGroupOfType)(listItem, 'ListItem') &&
|
|
27
|
+
isMarkerAtStartOfBlock(listItem)) {
|
|
28
|
+
(0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent');
|
|
29
|
+
rawEvent.preventDefault();
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=keyboardTab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,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;
|