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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragAndDropHelper.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/DragAndDrop/DragAndDropHelper.ts"],"names":[],"mappings":";;;AA2BA;;GAEG;AACH,IAAM,wBAAwB,GAAmB,CAAC;IAC9C,OAAO;QACH,SAAS,EAAE,WAAW;QACtB,SAAS,EAAE,WAAW;QACtB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,mBAAmB;KACjC,CAAC;AACN,CAAC,CAAC,EAAE,CAAC;AAEL,IAAM,uBAAuB,GAAmB,CAAC;IAC7C,OAAO;QACH,SAAS,EAAE,YAAY;QACvB,SAAS,EAAE,WAAW;QACtB,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE,mBAAmB;KACjC,CAAC;AACN,CAAC,CAAC,EAAE,CAAC;AAEL,SAAS,mBAAmB,CAAC,CAAa;IACtC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,mBAAmB,CAAC,CAAa;IACtC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/C,IAAM,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACjC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACpB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;KACvB;IACD,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH;IAMI;;;;;;;;;;OAUG;IACH,2BACY,OAAoB,EACpB,OAAiB,EACjB,QAA2D,EAC3D,OAAiD,EACjD,SAAiB,EACzB,WAAqB;QANzB,iBAUC;QATW,YAAO,GAAP,OAAO,CAAa;QACpB,YAAO,GAAP,OAAO,CAAU;QACjB,aAAQ,GAAR,QAAQ,CAAmD;QAC3D,YAAO,GAAP,OAAO,CAA0C;QACjD,cAAS,GAAT,SAAS,CAAQ;QArBrB,UAAK,GAAW,CAAC,CAAC;QAClB,UAAK,GAAW,CAAC,CAAC;QAClB,cAAS,GAA2B,SAAS,CAAC;QAkD9C,gBAAW,GAAG,UAAC,CAAQ;;;YAC3B,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,KAAA,oBAA2B,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAA4B,CAAC,IAAA,EAA/E,KAAI,CAAC,KAAK,QAAA,EAAE,KAAI,CAAC,KAAK,QAAA,CAA0D;YACjF,KAAI,CAAC,SAAS,GAAG,MAAA,MAAA,KAAI,CAAC,OAAO,EAAC,WAAW,mDAAG,KAAI,CAAC,OAAO,EAAE,CAAe,CAAC,CAAC;QAC/E,CAAC,CAAC;QAEM,gBAAW,GAAG,UAAC,CAAQ;;YAC3B,CAAC,CAAC,cAAc,EAAE,CAAC;YACb,IAAA,KAAA,oBAAiB,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAA4B,CAAC,IAAA,EAArE,KAAK,QAAA,EAAE,KAAK,QAAyD,CAAC;YAC7E,IAAM,MAAM,GAAG,CAAC,KAAK,GAAG,KAAI,CAAC,KAAK,CAAC,GAAG,KAAI,CAAC,SAAS,CAAC;YACrD,IAAM,MAAM,GAAG,CAAC,KAAK,GAAG,KAAI,CAAC,KAAK,CAAC,GAAG,KAAI,CAAC,SAAS,CAAC;YACrD,IACI,KAAI,CAAC,SAAS;iBACd,MAAA,MAAA,KAAI,CAAC,OAAO,EAAC,UAAU,mDAAG,KAAI,CAAC,OAAO,EAAE,CAAe,EAAE,KAAI,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA,EAC1F;gBACE,MAAA,KAAI,CAAC,QAAQ,+CAAb,KAAI,EAAY,KAAI,CAAC,OAAO,EAAE,KAAI,CAAC,OAAO,CAAC,CAAC;aAC/C;QACL,CAAC,CAAC;QAEM,cAAS,GAAG,UAAC,CAAQ;;YACzB,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,KAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,MAAA,MAAA,KAAI,CAAC,OAAO,EAAC,SAAS,mDAAG,KAAI,CAAC,OAAO,EAAE,CAAe,EAAE,KAAI,CAAC,SAAS,CAAC,EAAE;gBACzE,MAAA,KAAI,CAAC,QAAQ,+CAAb,KAAI,EAAY,KAAI,CAAC,OAAO,EAAE,KAAI,CAAC,OAAO,CAAC,CAAC;aAC/C;QACL,CAAC,CAAC;QAvDE,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,wBAAwB,CAAC;QACjF,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,mCAAO,GAAP;QACI,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5E,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAED,sBAAW,wCAAS;aAApB;YACI,OAAO,IAAI,CAAC,QAAQ,IAAI,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QACxE,CAAC;;;OAAA;IAEO,6CAAiB,GAAzB;QACI,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;QACvC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACrF,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACrF,CAAC;IAEO,gDAAoB,GAA5B;QACI,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;QACvC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACxF,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACxF,CAAC;IA8BL,wBAAC;AAAD,CAAC,AAjFD,IAiFC","sourcesContent":["import type Disposable from '../Disposable';\r\nimport type DragAndDropHandler from './DragAndDropHandler';\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface MouseEventMoves {\r\n MOUSEDOWN: string;\r\n MOUSEMOVE: string;\r\n MOUSEUP: string;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface MouseEventInfo extends MouseEventMoves {\r\n getPageXY: (e: MouseEvent) => number[];\r\n}\r\n\r\n/**\r\n * @internal\r\n * Compatible mouse event names for different platform\r\n */\r\ninterface TouchEventInfo extends MouseEventMoves {\r\n getPageXY: (e: TouchEvent) => number[];\r\n}\r\n\r\n/**\r\n * Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers\r\n */\r\nconst MOUSE_EVENT_INFO_DESKTOP: MouseEventInfo = (() => {\r\n return {\r\n MOUSEDOWN: 'mousedown',\r\n MOUSEMOVE: 'mousemove',\r\n MOUSEUP: 'mouseup',\r\n getPageXY: getMouseEventPageXY,\r\n };\r\n})();\r\n\r\nconst MOUSE_EVENT_INFO_MOBILE: TouchEventInfo = (() => {\r\n return {\r\n MOUSEDOWN: 'touchstart',\r\n MOUSEMOVE: 'touchmove',\r\n MOUSEUP: 'touchend',\r\n getPageXY: getTouchEventPageXY,\r\n };\r\n})();\r\n\r\nfunction getMouseEventPageXY(e: MouseEvent): [number, number] {\r\n return [e.pageX, e.pageY];\r\n}\r\n\r\nfunction getTouchEventPageXY(e: TouchEvent): [number, number] {\r\n let pageX = 0;\r\n let pageY = 0;\r\n if (e.targetTouches && e.targetTouches.length > 0) {\r\n const touch = e.targetTouches[0];\r\n pageX = touch.pageX;\r\n pageY = touch.pageY;\r\n }\r\n return [pageX, pageY];\r\n}\r\n\r\n/**\r\n * @internal\r\n * A helper class to help manage drag and drop to an HTML element\r\n */\r\nexport default class DragAndDropHelper<TContext, TInitValue> implements Disposable {\r\n private initX: number = 0;\r\n private initY: number = 0;\r\n private initValue: TInitValue | undefined = undefined;\r\n private dndMouse: MouseEventInfo | TouchEventInfo;\r\n\r\n /**\r\n * Create a new instance of DragAndDropHelper class\r\n * @param trigger The trigger element. When user start drag on this element,\r\n * events will be fired to the handler object\r\n * @param context Context object that will be passed to handler function when event is fired,\r\n * so that the handler object knows which element it is triggered from.\r\n * @param onSubmit A callback that will be invoked when event handler in handler object returns true\r\n * @param handler The event handler object, see DragAndDropHandler interface for more information\r\n * @param zoomScale The zoom scale of the editor\r\n * @param forceMobile A boolean to force the use of touch controls for the helper\r\n */\r\n constructor(\r\n private trigger: HTMLElement,\r\n private context: TContext,\r\n private onSubmit: (context: TContext, trigger: HTMLElement) => void,\r\n private handler: DragAndDropHandler<TContext, TInitValue>,\r\n private zoomScale: number,\r\n forceMobile?: boolean\r\n ) {\r\n this.dndMouse = forceMobile ? MOUSE_EVENT_INFO_MOBILE : MOUSE_EVENT_INFO_DESKTOP;\r\n trigger.addEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\r\n }\r\n\r\n /**\r\n * Dispose this object, remove all event listeners that has been attached\r\n */\r\n dispose() {\r\n this.trigger.removeEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\r\n this.removeDocumentEvents();\r\n }\r\n\r\n public get mouseType(): string {\r\n return this.dndMouse == MOUSE_EVENT_INFO_MOBILE ? 'touch' : 'mouse';\r\n }\r\n\r\n private addDocumentEvents() {\r\n const doc = this.trigger.ownerDocument;\r\n doc.addEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\r\n doc.addEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\r\n }\r\n\r\n private removeDocumentEvents() {\r\n const doc = this.trigger.ownerDocument;\r\n doc.removeEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\r\n doc.removeEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\r\n }\r\n\r\n private onMouseDown = (e: Event) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this.addDocumentEvents();\r\n [this.initX, this.initY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\r\n this.initValue = this.handler.onDragStart?.(this.context, e as MouseEvent);\r\n };\r\n\r\n private onMouseMove = (e: Event) => {\r\n e.preventDefault();\r\n const [pageX, pageY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\r\n const deltaX = (pageX - this.initX) / this.zoomScale;\r\n const deltaY = (pageY - this.initY) / this.zoomScale;\r\n if (\r\n this.initValue &&\r\n this.handler.onDragging?.(this.context, e as MouseEvent, this.initValue, deltaX, deltaY)\r\n ) {\r\n this.onSubmit?.(this.context, this.trigger);\r\n }\r\n };\r\n\r\n private onMouseUp = (e: Event) => {\r\n e.preventDefault();\r\n this.removeDocumentEvents();\r\n if (this.handler.onDragEnd?.(this.context, e as MouseEvent, this.initValue)) {\r\n this.onSubmit?.(this.context, this.trigger);\r\n }\r\n };\r\n}\r\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Rect } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Get the intersected Rect of elements provided
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* The result of the following Elements Rects would be:
|
|
7
|
+
{
|
|
8
|
+
top: Element2.top,
|
|
9
|
+
bottom: Element1.bottom,
|
|
10
|
+
left: Element2.left,
|
|
11
|
+
right: Element2.right
|
|
12
|
+
}
|
|
13
|
+
+-------------------------+
|
|
14
|
+
| Element 1 |
|
|
15
|
+
| +-----------------+ |
|
|
16
|
+
| | Element2 | |
|
|
17
|
+
| | | |
|
|
18
|
+
| | | |
|
|
19
|
+
+-------------------------+
|
|
20
|
+
| |
|
|
21
|
+
+-----------------+
|
|
22
|
+
* @internal
|
|
23
|
+
* @param elements Elements to use.
|
|
24
|
+
* @param additionalRects additional rects to use
|
|
25
|
+
* @returns If the Rect is valid return the rect, if not, return null.
|
|
26
|
+
*/
|
|
27
|
+
export default function getIntersectedRect(elements: HTMLElement[], additionalRects?: Rect[]): Rect | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var normalizeRect_1 = require("./normalizeRect");
|
|
5
|
+
/**
|
|
6
|
+
* Get the intersected Rect of elements provided
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* The result of the following Elements Rects would be:
|
|
10
|
+
{
|
|
11
|
+
top: Element2.top,
|
|
12
|
+
bottom: Element1.bottom,
|
|
13
|
+
left: Element2.left,
|
|
14
|
+
right: Element2.right
|
|
15
|
+
}
|
|
16
|
+
+-------------------------+
|
|
17
|
+
| Element 1 |
|
|
18
|
+
| +-----------------+ |
|
|
19
|
+
| | Element2 | |
|
|
20
|
+
| | | |
|
|
21
|
+
| | | |
|
|
22
|
+
+-------------------------+
|
|
23
|
+
| |
|
|
24
|
+
+-----------------+
|
|
25
|
+
* @internal
|
|
26
|
+
* @param elements Elements to use.
|
|
27
|
+
* @param additionalRects additional rects to use
|
|
28
|
+
* @returns If the Rect is valid return the rect, if not, return null.
|
|
29
|
+
*/
|
|
30
|
+
function getIntersectedRect(elements, additionalRects) {
|
|
31
|
+
if (additionalRects === void 0) { additionalRects = []; }
|
|
32
|
+
var rects = elements
|
|
33
|
+
.map(function (element) { return (0, normalizeRect_1.default)(element.getBoundingClientRect()); })
|
|
34
|
+
.concat(additionalRects)
|
|
35
|
+
.filter(function (element) { return !!element; });
|
|
36
|
+
var result = {
|
|
37
|
+
top: Math.max.apply(Math, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(rects.map(function (r) { return r.top; })), false)),
|
|
38
|
+
bottom: Math.min.apply(Math, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(rects.map(function (r) { return r.bottom; })), false)),
|
|
39
|
+
left: Math.max.apply(Math, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(rects.map(function (r) { return r.left; })), false)),
|
|
40
|
+
right: Math.min.apply(Math, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(rects.map(function (r) { return r.right; })), false)),
|
|
41
|
+
};
|
|
42
|
+
return result.top < result.bottom && result.left < result.right ? result : null;
|
|
43
|
+
}
|
|
44
|
+
exports.default = getIntersectedRect;
|
|
45
|
+
//# sourceMappingURL=getIntersectedRect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/Rect/getIntersectedRect.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAwB,kBAAkB,CACtC,QAAuB,EACvB,eAA4B;IAA5B,gCAAA,EAAA,oBAA4B;IAE5B,IAAM,KAAK,GAAG,QAAQ;SACjB,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,IAAA,uBAAa,EAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,EAA9C,CAA8C,CAAC;SAC9D,MAAM,CAAC,eAAe,CAAC;SACvB,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAW,CAAC;IAE5C,IAAM,MAAM,GAAS;QACjB,GAAG,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,UAAC;QACvC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC,UAAC;QAC7C,IAAI,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,UAAC;QACzC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,EAAP,CAAO,CAAC,UAAC;KAC9C,CAAC;IAEF,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC;AAjBD,qCAiBC","sourcesContent":["import normalizeRect from './normalizeRect';\r\nimport type { Rect } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * Get the intersected Rect of elements provided\r\n *\r\n * @example\r\n * The result of the following Elements Rects would be:\r\n {\r\n top: Element2.top,\r\n bottom: Element1.bottom,\r\n left: Element2.left,\r\n right: Element2.right\r\n }\r\n +-------------------------+\r\n | Element 1 |\r\n | +-----------------+ |\r\n | | Element2 | |\r\n | | | |\r\n | | | |\r\n +-------------------------+\r\n | |\r\n +-----------------+\r\n * @internal\r\n * @param elements Elements to use.\r\n * @param additionalRects additional rects to use\r\n * @returns If the Rect is valid return the rect, if not, return null.\r\n */\r\nexport default function getIntersectedRect(\r\n elements: HTMLElement[],\r\n additionalRects: Rect[] = []\r\n): Rect | null {\r\n const rects = elements\r\n .map(element => normalizeRect(element.getBoundingClientRect()))\r\n .concat(additionalRects)\r\n .filter(element => !!element) as Rect[];\r\n\r\n const result: Rect = {\r\n top: Math.max(...rects.map(r => r.top)),\r\n bottom: Math.min(...rects.map(r => r.bottom)),\r\n left: Math.max(...rects.map(r => r.left)),\r\n right: Math.min(...rects.map(r => r.right)),\r\n };\r\n\r\n return result.top < result.bottom && result.left < result.right ? result : null;\r\n}\r\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Rect } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p
|
|
5
|
+
* We validate that and only return a rect when the passed in ClientRect is valid
|
|
6
|
+
*/
|
|
7
|
+
export default function normalizeRect(clientRect: DOMRect): Rect | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p
|
|
6
|
+
* We validate that and only return a rect when the passed in ClientRect is valid
|
|
7
|
+
*/
|
|
8
|
+
function normalizeRect(clientRect) {
|
|
9
|
+
var _a = clientRect || { left: 0, right: 0, top: 0, bottom: 0 }, left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom;
|
|
10
|
+
return left === 0 && right === 0 && top === 0 && bottom === 0
|
|
11
|
+
? null
|
|
12
|
+
: {
|
|
13
|
+
left: Math.round(left),
|
|
14
|
+
right: Math.round(right),
|
|
15
|
+
top: Math.round(top),
|
|
16
|
+
bottom: Math.round(bottom),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.default = normalizeRect;
|
|
20
|
+
//# sourceMappingURL=normalizeRect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeRect.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/Rect/normalizeRect.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;AACH,SAAwB,aAAa,CAAC,UAAmB;IAC/C,IAAA,KACF,UAAU,IAAa,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAD3D,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,GAAG,SAAA,EAAE,MAAM,YACmC,CAAC;IACpE,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC;QACzD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC;YACI,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YACxB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACpB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;SAC7B,CAAC;AACZ,CAAC;AAXD,gCAWC","sourcesContent":["import type { Rect } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n * A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p\r\n * We validate that and only return a rect when the passed in ClientRect is valid\r\n */\r\nexport default function normalizeRect(clientRect: DOMRect): Rect | null {\r\n const { left, right, top, bottom } =\r\n clientRect || <DOMRect>{ left: 0, right: 0, top: 0, bottom: 0 };\r\n return left === 0 && right === 0 && top === 0 && bottom === 0\r\n ? null\r\n : {\r\n left: Math.round(left),\r\n right: Math.round(right),\r\n top: Math.round(top),\r\n bottom: Math.round(bottom),\r\n };\r\n}\r\n"]}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import type { EditorPlugin, IStandaloneEditor, PluginEvent } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* Options to customize the Content Model Auto Format Plugin
|
|
4
|
-
*/
|
|
5
|
-
export declare type AutoFormatOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* When true, after type *, ->, -, --, => , —, > and space key a type of bullet list will be triggered. @default true
|
|
8
|
-
*/
|
|
9
|
-
autoBullet: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* When true, after type 1, A, a, i, I followed by ., ), - or between () and space key a type of numbering list will be triggered. @default true
|
|
12
|
-
*/
|
|
13
|
-
autoNumbering: boolean;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
|
|
17
|
-
* It can be customized with options to enable or disable auto list features.
|
|
18
|
-
*/
|
|
19
|
-
export declare class
|
|
20
|
-
private options;
|
|
21
|
-
private editor;
|
|
22
|
-
/**
|
|
23
|
-
* @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
|
|
24
|
-
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to true.
|
|
25
|
-
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to true.
|
|
26
|
-
*/
|
|
27
|
-
constructor(options?: AutoFormatOptions);
|
|
28
|
-
/**
|
|
29
|
-
* Get name of this plugin
|
|
30
|
-
*/
|
|
31
|
-
getName(): string;
|
|
32
|
-
/**
|
|
33
|
-
* The first method that editor will call to a plugin when editor is initializing.
|
|
34
|
-
* It will pass in the editor instance, plugin should take this chance to save the
|
|
35
|
-
* editor reference so that it can call to any editor method or format API later.
|
|
36
|
-
* @param editor The editor object
|
|
37
|
-
*/
|
|
38
|
-
initialize(editor: IStandaloneEditor): void;
|
|
39
|
-
/**
|
|
40
|
-
* The last method that editor will call to a plugin before it is disposed.
|
|
41
|
-
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
42
|
-
* called, plugin should not call to any editor method since it will result in error.
|
|
43
|
-
*/
|
|
44
|
-
dispose(): void;
|
|
45
|
-
/**
|
|
46
|
-
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
47
|
-
* method of each plugin to handle the event as long as the event is not handled
|
|
48
|
-
* exclusively by another plugin.
|
|
49
|
-
* @param event The event to handle:
|
|
50
|
-
*/
|
|
51
|
-
onPluginEvent(event: PluginEvent): void;
|
|
52
|
-
private handleKeyDownEvent;
|
|
53
|
-
}
|
|
1
|
+
import type { EditorPlugin, IStandaloneEditor, PluginEvent } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Options to customize the Content Model Auto Format Plugin
|
|
4
|
+
*/
|
|
5
|
+
export declare type AutoFormatOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* When true, after type *, ->, -, --, => , —, > and space key a type of bullet list will be triggered. @default true
|
|
8
|
+
*/
|
|
9
|
+
autoBullet: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When true, after type 1, A, a, i, I followed by ., ), - or between () and space key a type of numbering list will be triggered. @default true
|
|
12
|
+
*/
|
|
13
|
+
autoNumbering: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
|
|
17
|
+
* It can be customized with options to enable or disable auto list features.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AutoFormatPlugin implements EditorPlugin {
|
|
20
|
+
private options;
|
|
21
|
+
private editor;
|
|
22
|
+
/**
|
|
23
|
+
* @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
|
|
24
|
+
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to true.
|
|
25
|
+
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to true.
|
|
26
|
+
*/
|
|
27
|
+
constructor(options?: AutoFormatOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Get name of this plugin
|
|
30
|
+
*/
|
|
31
|
+
getName(): string;
|
|
32
|
+
/**
|
|
33
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
34
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
35
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
36
|
+
* @param editor The editor object
|
|
37
|
+
*/
|
|
38
|
+
initialize(editor: IStandaloneEditor): void;
|
|
39
|
+
/**
|
|
40
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
41
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
42
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
43
|
+
*/
|
|
44
|
+
dispose(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
47
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
48
|
+
* exclusively by another plugin.
|
|
49
|
+
* @param event The event to handle:
|
|
50
|
+
*/
|
|
51
|
+
onPluginEvent(event: PluginEvent): void;
|
|
52
|
+
private handleKeyDownEvent;
|
|
53
|
+
}
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
define(["require", "exports", "./keyboardListTrigger"], function (require, exports, keyboardListTrigger_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
var DefaultOptions = {
|
|
9
|
-
autoBullet: true,
|
|
10
|
-
autoNumbering: true,
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
|
|
14
|
-
* It can be customized with options to enable or disable auto list features.
|
|
15
|
-
*/
|
|
16
|
-
var
|
|
17
|
-
/**
|
|
18
|
-
* @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
|
|
19
|
-
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to true.
|
|
20
|
-
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to true.
|
|
21
|
-
*/
|
|
22
|
-
function
|
|
23
|
-
if (options === void 0) { options = DefaultOptions; }
|
|
24
|
-
this.options = options;
|
|
25
|
-
this.editor = null;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get name of this plugin
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
return '
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The first method that editor will call to a plugin when editor is initializing.
|
|
35
|
-
* It will pass in the editor instance, plugin should take this chance to save the
|
|
36
|
-
* editor reference so that it can call to any editor method or format API later.
|
|
37
|
-
* @param editor The editor object
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
this.editor = editor;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* The last method that editor will call to a plugin before it is disposed.
|
|
44
|
-
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
45
|
-
* called, plugin should not call to any editor method since it will result in error.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
this.editor = null;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
52
|
-
* method of each plugin to handle the event as long as the event is not handled
|
|
53
|
-
* exclusively by another plugin.
|
|
54
|
-
* @param event The event to handle:
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
if (this.editor) {
|
|
58
|
-
switch (event.eventType) {
|
|
59
|
-
case 'keyDown':
|
|
60
|
-
this.handleKeyDownEvent(this.editor, event);
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
var rawEvent = event.rawEvent;
|
|
67
|
-
if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {
|
|
68
|
-
switch (rawEvent.key) {
|
|
69
|
-
case ' ':
|
|
70
|
-
var _a = this.options, autoBullet = _a.autoBullet, autoNumbering = _a.autoNumbering;
|
|
71
|
-
if (autoBullet || autoNumbering) {
|
|
72
|
-
(0, keyboardListTrigger_1.keyboardListTrigger)(editor, rawEvent, autoBullet, autoNumbering);
|
|
73
|
-
}
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
return
|
|
79
|
-
}());
|
|
80
|
-
exports.
|
|
81
|
-
});
|
|
82
|
-
//# sourceMappingURL=
|
|
1
|
+
define(["require", "exports", "./keyboardListTrigger"], function (require, exports, keyboardListTrigger_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AutoFormatPlugin = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
var DefaultOptions = {
|
|
9
|
+
autoBullet: true,
|
|
10
|
+
autoNumbering: true,
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
|
|
14
|
+
* It can be customized with options to enable or disable auto list features.
|
|
15
|
+
*/
|
|
16
|
+
var AutoFormatPlugin = /** @class */ (function () {
|
|
17
|
+
/**
|
|
18
|
+
* @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
|
|
19
|
+
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to true.
|
|
20
|
+
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to true.
|
|
21
|
+
*/
|
|
22
|
+
function AutoFormatPlugin(options) {
|
|
23
|
+
if (options === void 0) { options = DefaultOptions; }
|
|
24
|
+
this.options = options;
|
|
25
|
+
this.editor = null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get name of this plugin
|
|
29
|
+
*/
|
|
30
|
+
AutoFormatPlugin.prototype.getName = function () {
|
|
31
|
+
return 'AutoFormat';
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
35
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
36
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
37
|
+
* @param editor The editor object
|
|
38
|
+
*/
|
|
39
|
+
AutoFormatPlugin.prototype.initialize = function (editor) {
|
|
40
|
+
this.editor = editor;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
44
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
45
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
46
|
+
*/
|
|
47
|
+
AutoFormatPlugin.prototype.dispose = function () {
|
|
48
|
+
this.editor = null;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
52
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
53
|
+
* exclusively by another plugin.
|
|
54
|
+
* @param event The event to handle:
|
|
55
|
+
*/
|
|
56
|
+
AutoFormatPlugin.prototype.onPluginEvent = function (event) {
|
|
57
|
+
if (this.editor) {
|
|
58
|
+
switch (event.eventType) {
|
|
59
|
+
case 'keyDown':
|
|
60
|
+
this.handleKeyDownEvent(this.editor, event);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
AutoFormatPlugin.prototype.handleKeyDownEvent = function (editor, event) {
|
|
66
|
+
var rawEvent = event.rawEvent;
|
|
67
|
+
if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {
|
|
68
|
+
switch (rawEvent.key) {
|
|
69
|
+
case ' ':
|
|
70
|
+
var _a = this.options, autoBullet = _a.autoBullet, autoNumbering = _a.autoNumbering;
|
|
71
|
+
if (autoBullet || autoNumbering) {
|
|
72
|
+
(0, keyboardListTrigger_1.keyboardListTrigger)(editor, rawEvent, autoBullet, autoNumbering);
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return AutoFormatPlugin;
|
|
79
|
+
}());
|
|
80
|
+
exports.AutoFormatPlugin = AutoFormatPlugin;
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=AutoFormatPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoFormatPlugin.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/AutoFormatPlugin.ts"],"names":[],"mappings":";;;;IAuBA;;OAEG;IACH,IAAM,cAAc,GAAgC;QAChD,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACtB,CAAC;IAEF;;;OAGG;IACH;QAGI;;;;WAIG;QACH,0BAAoB,OAA2C;YAA3C,wBAAA,EAAA,wBAA2C;YAA3C,YAAO,GAAP,OAAO,CAAoC;YAPvD,WAAM,GAA6B,IAAI,CAAC;QAOkB,CAAC;QAEnE;;WAEG;QACH,kCAAO,GAAP;YACI,OAAO,YAAY,CAAC;QACxB,CAAC;QAED;;;;;WAKG;QACH,qCAAU,GAAV,UAAW,MAAyB;YAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;QAED;;;;WAIG;QACH,kCAAO,GAAP;YACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACvB,CAAC;QAED;;;;;WAKG;QACH,wCAAa,GAAb,UAAc,KAAkB;YAC5B,IAAI,IAAI,CAAC,MAAM,EAAE;gBACb,QAAQ,KAAK,CAAC,SAAS,EAAE;oBACrB,KAAK,SAAS;wBACV,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;wBAC5C,MAAM;iBACb;aACJ;QACL,CAAC;QAEO,6CAAkB,GAA1B,UAA2B,MAAyB,EAAE,KAAmB;YACrE,IAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE;gBAC3D,QAAQ,QAAQ,CAAC,GAAG,EAAE;oBAClB,KAAK,GAAG;wBACE,IAAA,KAAgC,IAAI,CAAC,OAAO,EAA1C,UAAU,gBAAA,EAAE,aAAa,mBAAiB,CAAC;wBACnD,IAAI,UAAU,IAAI,aAAa,EAAE;4BAC7B,IAAA,yCAAmB,EAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;yBACpE;wBACD,MAAM;iBACb;aACJ;QACL,CAAC;QACL,uBAAC;IAAD,CAAC,AAjED,IAiEC;IAjEY,4CAAgB","sourcesContent":["import { keyboardListTrigger } from './keyboardListTrigger';\r\nimport type {\r\n EditorPlugin,\r\n IStandaloneEditor,\r\n KeyDownEvent,\r\n PluginEvent,\r\n} from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * Options to customize the Content Model Auto Format Plugin\r\n */\r\nexport type AutoFormatOptions = {\r\n /**\r\n * When true, after type *, ->, -, --, => , —, > and space key a type of bullet list will be triggered. @default true\r\n */\r\n autoBullet: boolean;\r\n\r\n /**\r\n * When true, after type 1, A, a, i, I followed by ., ), - or between () and space key a type of numbering list will be triggered. @default true\r\n */\r\n autoNumbering: boolean;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\nconst DefaultOptions: Required<AutoFormatOptions> = {\r\n autoBullet: true,\r\n autoNumbering: true,\r\n};\r\n\r\n/**\r\n * Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.\r\n * It can be customized with options to enable or disable auto list features.\r\n */\r\nexport class AutoFormatPlugin implements EditorPlugin {\r\n private editor: IStandaloneEditor | null = null;\r\n\r\n /**\r\n * @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:\r\n * - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to true.\r\n * - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to true.\r\n */\r\n constructor(private options: AutoFormatOptions = DefaultOptions) {}\r\n\r\n /**\r\n * Get name of this plugin\r\n */\r\n getName() {\r\n return 'AutoFormat';\r\n }\r\n\r\n /**\r\n * The first method that editor will call to a plugin when editor is initializing.\r\n * It will pass in the editor instance, plugin should take this chance to save the\r\n * editor reference so that it can call to any editor method or format API later.\r\n * @param editor The editor object\r\n */\r\n initialize(editor: IStandaloneEditor) {\r\n this.editor = editor;\r\n }\r\n\r\n /**\r\n * The last method that editor will call to a plugin before it is disposed.\r\n * Plugin can take this chance to clear the reference to editor. After this method is\r\n * called, plugin should not call to any editor method since it will result in error.\r\n */\r\n dispose() {\r\n this.editor = null;\r\n }\r\n\r\n /**\r\n * Core method for a plugin. Once an event happens in editor, editor will call this\r\n * method of each plugin to handle the event as long as the event is not handled\r\n * exclusively by another plugin.\r\n * @param event The event to handle:\r\n */\r\n onPluginEvent(event: PluginEvent) {\r\n if (this.editor) {\r\n switch (event.eventType) {\r\n case 'keyDown':\r\n this.handleKeyDownEvent(this.editor, event);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n private handleKeyDownEvent(editor: IStandaloneEditor, event: KeyDownEvent) {\r\n const rawEvent = event.rawEvent;\r\n if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {\r\n switch (rawEvent.key) {\r\n case ' ':\r\n const { autoBullet, autoNumbering } = this.options;\r\n if (autoBullet || autoNumbering) {\r\n keyboardListTrigger(editor, rawEvent, autoBullet, autoNumbering);\r\n }\r\n break;\r\n }\r\n }\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 keyboardListTrigger(editor: IStandaloneEditor, rawEvent: KeyboardEvent, shouldSearchForBullet?: boolean, shouldSearchForNumbering?: boolean): void;
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function keyboardListTrigger(editor: IStandaloneEditor, rawEvent: KeyboardEvent, shouldSearchForBullet?: boolean, shouldSearchForNumbering?: boolean): void;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
define(["require", "exports", "./utils/getListTypeStyle", "roosterjs-content-model-core", "roosterjs-content-model-dom", "roosterjs-content-model-api"], function (require, exports, getListTypeStyle_1, roosterjs_content_model_core_1, roosterjs_content_model_dom_1, roosterjs_content_model_api_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.keyboardListTrigger = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
function keyboardListTrigger(editor, rawEvent, shouldSearchForBullet, shouldSearchForNumbering) {
|
|
9
|
-
if (shouldSearchForBullet === void 0) { shouldSearchForBullet = true; }
|
|
10
|
-
if (shouldSearchForNumbering === void 0) { shouldSearchForNumbering = true; }
|
|
11
|
-
editor.formatContentModel(function (model, _context) {
|
|
12
|
-
var listStyleType = (0, getListTypeStyle_1.getListTypeStyle)(model, shouldSearchForBullet, shouldSearchForNumbering);
|
|
13
|
-
if (listStyleType) {
|
|
14
|
-
var segmentsAndParagraphs = (0, roosterjs_content_model_core_1.getSelectedSegmentsAndParagraphs)(model, false);
|
|
15
|
-
if (segmentsAndParagraphs[0] && segmentsAndParagraphs[0][1]) {
|
|
16
|
-
segmentsAndParagraphs[0][1].segments.splice(0, 1);
|
|
17
|
-
}
|
|
18
|
-
var listType = listStyleType.listType, styleType = listStyleType.styleType, index = listStyleType.index;
|
|
19
|
-
triggerList(editor, model, listType, styleType, index);
|
|
20
|
-
rawEvent.preventDefault();
|
|
21
|
-
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.keyboardListTrigger = keyboardListTrigger;
|
|
28
|
-
var triggerList = function (editor, model, listType, styleType, index) {
|
|
29
|
-
(0, roosterjs_content_model_api_1.setListType)(model, listType);
|
|
30
|
-
var isOrderedList = listType == 'OL';
|
|
31
|
-
// If the index < 1, it is a new list, so it will be starting by 1, then no need to set startNumber
|
|
32
|
-
if (index && index > 1 && isOrderedList) {
|
|
33
|
-
(0, roosterjs_content_model_api_1.setListStartNumber)(editor, index);
|
|
34
|
-
}
|
|
35
|
-
(0, roosterjs_content_model_api_1.setListStyle)(editor, isOrderedList
|
|
36
|
-
? {
|
|
37
|
-
orderedStyleType: styleType,
|
|
38
|
-
}
|
|
39
|
-
: {
|
|
40
|
-
unorderedStyleType: styleType,
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
});
|
|
1
|
+
define(["require", "exports", "./utils/getListTypeStyle", "roosterjs-content-model-core", "roosterjs-content-model-dom", "roosterjs-content-model-api"], function (require, exports, getListTypeStyle_1, roosterjs_content_model_core_1, roosterjs_content_model_dom_1, roosterjs_content_model_api_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.keyboardListTrigger = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function keyboardListTrigger(editor, rawEvent, shouldSearchForBullet, shouldSearchForNumbering) {
|
|
9
|
+
if (shouldSearchForBullet === void 0) { shouldSearchForBullet = true; }
|
|
10
|
+
if (shouldSearchForNumbering === void 0) { shouldSearchForNumbering = true; }
|
|
11
|
+
editor.formatContentModel(function (model, _context) {
|
|
12
|
+
var listStyleType = (0, getListTypeStyle_1.getListTypeStyle)(model, shouldSearchForBullet, shouldSearchForNumbering);
|
|
13
|
+
if (listStyleType) {
|
|
14
|
+
var segmentsAndParagraphs = (0, roosterjs_content_model_core_1.getSelectedSegmentsAndParagraphs)(model, false);
|
|
15
|
+
if (segmentsAndParagraphs[0] && segmentsAndParagraphs[0][1]) {
|
|
16
|
+
segmentsAndParagraphs[0][1].segments.splice(0, 1);
|
|
17
|
+
}
|
|
18
|
+
var listType = listStyleType.listType, styleType = listStyleType.styleType, index = listStyleType.index;
|
|
19
|
+
triggerList(editor, model, listType, styleType, index);
|
|
20
|
+
rawEvent.preventDefault();
|
|
21
|
+
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.keyboardListTrigger = keyboardListTrigger;
|
|
28
|
+
var triggerList = function (editor, model, listType, styleType, index) {
|
|
29
|
+
(0, roosterjs_content_model_api_1.setListType)(model, listType);
|
|
30
|
+
var isOrderedList = listType == 'OL';
|
|
31
|
+
// If the index < 1, it is a new list, so it will be starting by 1, then no need to set startNumber
|
|
32
|
+
if (index && index > 1 && isOrderedList) {
|
|
33
|
+
(0, roosterjs_content_model_api_1.setListStartNumber)(editor, index);
|
|
34
|
+
}
|
|
35
|
+
(0, roosterjs_content_model_api_1.setListStyle)(editor, isOrderedList
|
|
36
|
+
? {
|
|
37
|
+
orderedStyleType: styleType,
|
|
38
|
+
}
|
|
39
|
+
: {
|
|
40
|
+
unorderedStyleType: styleType,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
44
|
//# sourceMappingURL=keyboardListTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/keyboardListTrigger.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/keyboardListTrigger.ts"],"names":[],"mappings":";;;;IAOA;;OAEG;IACH,SAAgB,mBAAmB,CAC/B,MAAyB,EACzB,QAAuB,EACvB,qBAAqC,EACrC,wBAAwC;QADxC,sCAAA,EAAA,4BAAqC;QACrC,yCAAA,EAAA,+BAAwC;QAExC,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,QAAQ;YACtC,IAAM,aAAa,GAAG,IAAA,mCAAgB,EAClC,KAAK,EACL,qBAAqB,EACrB,wBAAwB,CAC3B,CAAC;YACF,IAAI,aAAa,EAAE;gBACf,IAAM,qBAAqB,GAAG,IAAA,+DAAgC,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAC7E,IAAI,qBAAqB,CAAC,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;oBACzD,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBACrD;gBACO,IAAA,QAAQ,GAAuB,aAAa,SAApC,EAAE,SAAS,GAAY,aAAa,UAAzB,EAAE,KAAK,GAAK,aAAa,MAAlB,CAAmB;gBACrD,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;gBACvD,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAC1B,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;gBAE7B,OAAO,IAAI,CAAC;aACf;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC,CAAC;IACP,CAAC;IA1BD,kDA0BC;IAED,IAAM,WAAW,GAAG,UAChB,MAAyB,EACzB,KAA2B,EAC3B,QAAqB,EACrB,SAAiB,EACjB,KAAc;QAEd,IAAA,yCAAW,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7B,IAAM,aAAa,GAAG,QAAQ,IAAI,IAAI,CAAC;QACvC,mGAAmG;QACnG,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,IAAI,aAAa,EAAE;YACrC,IAAA,gDAAkB,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACrC;QACD,IAAA,0CAAY,EACR,MAAM,EACN,aAAa;YACT,CAAC,CAAC;gBACI,gBAAgB,EAAE,SAAS;aAC9B;YACH,CAAC,CAAC;gBACI,kBAAkB,EAAE,SAAS;aAChC,CACV,CAAC;IACN,CAAC,CAAC","sourcesContent":["import { getListTypeStyle } from './utils/getListTypeStyle';\r\nimport { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-core';\r\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\r\nimport { setListStartNumber, setListStyle, setListType } from 'roosterjs-content-model-api';\r\n\r\nimport type { ContentModelDocument, IStandaloneEditor } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function keyboardListTrigger(\r\n editor: IStandaloneEditor,\r\n rawEvent: KeyboardEvent,\r\n shouldSearchForBullet: boolean = true,\r\n shouldSearchForNumbering: boolean = true\r\n) {\r\n editor.formatContentModel((model, _context) => {\r\n const listStyleType = getListTypeStyle(\r\n model,\r\n shouldSearchForBullet,\r\n shouldSearchForNumbering\r\n );\r\n if (listStyleType) {\r\n const segmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, false);\r\n if (segmentsAndParagraphs[0] && segmentsAndParagraphs[0][1]) {\r\n segmentsAndParagraphs[0][1].segments.splice(0, 1);\r\n }\r\n const { listType, styleType, index } = listStyleType;\r\n triggerList(editor, model, listType, styleType, index);\r\n rawEvent.preventDefault();\r\n normalizeContentModel(model);\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n}\r\n\r\nconst triggerList = (\r\n editor: IStandaloneEditor,\r\n model: ContentModelDocument,\r\n listType: 'OL' | 'UL',\r\n styleType: number,\r\n index?: number\r\n) => {\r\n setListType(model, listType);\r\n const isOrderedList = listType == 'OL';\r\n // If the index < 1, it is a new list, so it will be starting by 1, then no need to set startNumber\r\n if (index && index > 1 && isOrderedList) {\r\n setListStartNumber(editor, index);\r\n }\r\n setListStyle(\r\n editor,\r\n isOrderedList\r\n ? {\r\n orderedStyleType: styleType,\r\n }\r\n : {\r\n unorderedStyleType: styleType,\r\n }\r\n );\r\n};\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
* Convert english alphabet numbers into decimal numbers
|
|
4
|
-
* @param letter The letter that needs to be converted
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertAlphaToDecimals(letter: string): number | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* Convert english alphabet numbers into decimal numbers
|
|
4
|
+
* @param letter The letter that needs to be converted
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertAlphaToDecimals(letter: string): number | undefined;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.convertAlphaToDecimals = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* Convert english alphabet numbers into decimal numbers
|
|
8
|
-
* @param letter The letter that needs to be converted
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
function convertAlphaToDecimals(letter) {
|
|
12
|
-
var alpha = letter.toUpperCase();
|
|
13
|
-
if (alpha) {
|
|
14
|
-
var result = 0;
|
|
15
|
-
for (var i = 0; i < alpha.length; i++) {
|
|
16
|
-
var charCode = alpha.charCodeAt(i) - 65 + 1;
|
|
17
|
-
result = result * 26 + charCode;
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
exports.convertAlphaToDecimals = convertAlphaToDecimals;
|
|
24
|
-
});
|
|
1
|
+
define(["require", "exports"], function (require, exports) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.convertAlphaToDecimals = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* Convert english alphabet numbers into decimal numbers
|
|
8
|
+
* @param letter The letter that needs to be converted
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function convertAlphaToDecimals(letter) {
|
|
12
|
+
var alpha = letter.toUpperCase();
|
|
13
|
+
if (alpha) {
|
|
14
|
+
var result = 0;
|
|
15
|
+
for (var i = 0; i < alpha.length; i++) {
|
|
16
|
+
var charCode = alpha.charCodeAt(i) - 65 + 1;
|
|
17
|
+
result = result * 26 + charCode;
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
exports.convertAlphaToDecimals = convertAlphaToDecimals;
|
|
24
|
+
});
|
|
25
25
|
//# sourceMappingURL=convertAlphaToDecimals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertAlphaToDecimals.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/convertAlphaToDecimals.ts"],"names":[],"mappings":";;;;IAAA;;;;;OAKG;IACH,SAAgB,sBAAsB,CAAC,MAAc;QACjD,IAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACnC,IAAI,KAAK,EAAE;YACP,IAAI,MAAM,GAAG,CAAC,CAAC;YACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACnC,IAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBAC9C,MAAM,GAAG,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC;aACnC;YAED,OAAO,MAAM,CAAC;SACjB;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAZD,wDAYC","sourcesContent":["/**\n * @internal\n * Convert english alphabet numbers into decimal numbers\n * @param letter The letter that needs to be converted\n * @returns\n */\nexport function convertAlphaToDecimals(letter: string): number | undefined {\n const alpha = letter.toUpperCase();\n if (alpha) {\n let result = 0;\n for (let i = 0; i < alpha.length; i++) {\n const charCode = alpha.charCodeAt(i) - 65 + 1;\n result = result * 26 + charCode;\n }\n\n return result;\n }\n return undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"convertAlphaToDecimals.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/convertAlphaToDecimals.ts"],"names":[],"mappings":";;;;IAAA;;;;;OAKG;IACH,SAAgB,sBAAsB,CAAC,MAAc;QACjD,IAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACnC,IAAI,KAAK,EAAE;YACP,IAAI,MAAM,GAAG,CAAC,CAAC;YACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACnC,IAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBAC9C,MAAM,GAAG,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC;aACnC;YAED,OAAO,MAAM,CAAC;SACjB;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAZD,wDAYC","sourcesContent":["/**\r\n * @internal\r\n * Convert english alphabet numbers into decimal numbers\r\n * @param letter The letter that needs to be converted\r\n * @returns\r\n */\r\nexport function convertAlphaToDecimals(letter: string): number | undefined {\r\n const alpha = letter.toUpperCase();\r\n if (alpha) {\r\n let result = 0;\r\n for (let i = 0; i < alpha.length; i++) {\r\n const charCode = alpha.charCodeAt(i) - 65 + 1;\r\n result = result * 26 + charCode;\r\n }\r\n\r\n return result;\r\n }\r\n return undefined;\r\n}\r\n"]}
|