roosterjs-content-model-plugins 0.26.4 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/autoFormat/AutoFormatPlugin.d.ts +11 -2
- package/lib/autoFormat/AutoFormatPlugin.js +24 -4
- package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib/autoFormat/link/createLink.d.ts +5 -0
- package/lib/autoFormat/link/createLink.js +26 -0
- package/lib/autoFormat/link/createLink.js.map +1 -0
- package/lib/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
- package/lib/autoFormat/link/createLinkAfterSpace.js +39 -0
- package/lib/autoFormat/link/createLinkAfterSpace.js.map +1 -0
- package/lib/autoFormat/link/getLinkSegment.d.ts +5 -0
- package/lib/autoFormat/link/getLinkSegment.js +27 -0
- package/lib/autoFormat/link/getLinkSegment.js.map +1 -0
- package/lib/autoFormat/link/unlink.d.ts +5 -0
- package/lib/autoFormat/link/unlink.js +20 -0
- package/lib/autoFormat/link/unlink.js.map +1 -0
- package/lib/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
- package/lib/autoFormat/list/getIndex.js.map +1 -0
- package/lib/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
- package/lib/autoFormat/list/getListTypeStyle.js.map +1 -0
- package/lib/autoFormat/list/getNumberingListStyle.js.map +1 -0
- package/lib/autoFormat/list/keyboardListTrigger.d.ts +5 -0
- package/lib/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
- package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -0
- package/lib/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
- package/lib/contextMenuBase/ContextMenuPluginBase.js +84 -0
- package/lib/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
- package/lib/edit/EditPlugin.d.ts +3 -3
- package/lib/edit/EditPlugin.js +1 -1
- package/lib/edit/EditPlugin.js.map +1 -1
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js +20 -1
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
- package/lib/edit/deleteSteps/deleteEmptyQuote.js +60 -0
- package/lib/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
- package/lib/edit/deleteSteps/deleteList.js +2 -1
- package/lib/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib/edit/handleKeyboardEventCommon.d.ts +2 -2
- package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib/edit/inputSteps/handleEnterOnList.js +40 -10
- package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib/edit/keyboardDelete.d.ts +3 -3
- package/lib/edit/keyboardDelete.js +10 -2
- package/lib/edit/keyboardDelete.js.map +1 -1
- package/lib/edit/keyboardInput.d.ts +2 -2
- package/lib/edit/keyboardInput.js +2 -1
- package/lib/edit/keyboardInput.js.map +1 -1
- package/lib/edit/keyboardTab.d.ts +2 -2
- package/lib/edit/keyboardTab.js +19 -11
- package/lib/edit/keyboardTab.js.map +1 -1
- package/lib/edit/tabUtils/handleTabOnList.d.ts +7 -0
- package/lib/edit/tabUtils/handleTabOnList.js +34 -0
- package/lib/edit/tabUtils/handleTabOnList.js.map +1 -0
- package/lib/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
- package/lib/edit/tabUtils/handleTabOnParagraph.js +81 -0
- package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
- package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.js +22 -1
- package/lib/index.js.map +1 -1
- package/lib/paste/Excel/processPastedContentFromExcel.js +1 -1
- package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib/paste/PastePlugin.d.ts +2 -3
- package/lib/paste/PastePlugin.js +6 -7
- package/lib/paste/PastePlugin.js.map +1 -1
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib/paste/WacComponents/constants.js.map +1 -1
- package/lib/paste/WacComponents/processPastedContentWacComponents.js +6 -6
- package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
- package/lib/paste/WordDesktop/getStyleMetadata.js +2 -1
- package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib/paste/utils/addParser.d.ts +1 -1
- package/lib/paste/utils/addParser.js +2 -1
- package/lib/paste/utils/addParser.js.map +1 -1
- package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib/paste/utils/getStyles.js.map +1 -1
- package/lib/paste/utils/linkParser.js.map +1 -1
- package/lib/paste/utils/setProcessor.js.map +1 -1
- package/lib/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
- package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib/pluginUtils/CreateElement/createElement.d.ts +2 -2
- package/lib/pluginUtils/CreateElement/createElement.js +2 -1
- package/lib/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib/pluginUtils/Disposable.d.ts +1 -1
- package/lib/pluginUtils/Disposable.js.map +1 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
- package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
- package/lib/pluginUtils/Rect/getIntersectedRect.js +4 -3
- package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib/shortcut/ShortcutCommand.d.ts +44 -0
- package/lib/shortcut/ShortcutCommand.js +3 -0
- package/lib/shortcut/ShortcutCommand.js.map +1 -0
- package/lib/shortcut/ShortcutPlugin.d.ts +51 -0
- package/lib/shortcut/ShortcutPlugin.js +120 -0
- package/lib/shortcut/ShortcutPlugin.js.map +1 -0
- package/lib/shortcut/shortcuts.d.ts +85 -0
- package/lib/shortcut/shortcuts.js +211 -0
- package/lib/shortcut/shortcuts.js.map +1 -0
- package/lib/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
- package/lib/shortcut/utils/setShortcutIndentationCommand.js +22 -0
- package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
- package/lib/tableEdit/TableEditPlugin.d.ts +47 -0
- package/lib/tableEdit/TableEditPlugin.js +156 -0
- package/lib/tableEdit/TableEditPlugin.js.map +1 -0
- package/lib/tableEdit/editors/TableEditor.d.ts +73 -0
- package/lib/tableEdit/editors/TableEditor.js +294 -0
- package/lib/tableEdit/editors/TableEditor.js.map +1 -0
- package/lib/tableEdit/editors/features/CellResizer.d.ts +6 -0
- package/lib/tableEdit/editors/features/CellResizer.js +169 -0
- package/lib/tableEdit/editors/features/CellResizer.js.map +1 -0
- package/lib/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
- package/lib/tableEdit/editors/features/TableEditFeature.js +17 -0
- package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib/tableEdit/editors/features/TableInserter.d.ts +6 -0
- package/lib/tableEdit/editors/features/TableInserter.js +113 -0
- package/lib/tableEdit/editors/features/TableInserter.js.map +1 -0
- package/lib/tableEdit/editors/features/TableMover.d.ts +8 -0
- package/lib/tableEdit/editors/features/TableMover.js +83 -0
- package/lib/tableEdit/editors/features/TableMover.js.map +1 -0
- package/lib/tableEdit/editors/features/TableResizer.d.ts +6 -0
- package/lib/tableEdit/editors/features/TableResizer.js +166 -0
- package/lib/tableEdit/editors/features/TableResizer.js.map +1 -0
- package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +11 -2
- package/lib-amd/autoFormat/AutoFormatPlugin.js +21 -4
- package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-amd/autoFormat/link/createLink.d.ts +5 -0
- package/lib-amd/autoFormat/link/createLink.js +26 -0
- package/lib-amd/autoFormat/link/createLink.js.map +1 -0
- package/lib-amd/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
- package/lib-amd/autoFormat/link/createLinkAfterSpace.js +38 -0
- package/lib-amd/autoFormat/link/createLinkAfterSpace.js.map +1 -0
- package/lib-amd/autoFormat/link/getLinkSegment.d.ts +5 -0
- package/lib-amd/autoFormat/link/getLinkSegment.js +27 -0
- package/lib-amd/autoFormat/link/getLinkSegment.js.map +1 -0
- package/lib-amd/autoFormat/link/unlink.d.ts +5 -0
- package/lib-amd/autoFormat/link/unlink.js +21 -0
- package/lib-amd/autoFormat/link/unlink.js.map +1 -0
- package/lib-amd/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
- package/lib-amd/autoFormat/list/getIndex.js.map +1 -0
- package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
- package/lib-amd/autoFormat/list/getListTypeStyle.js.map +1 -0
- package/lib-amd/autoFormat/list/getNumberingListStyle.js.map +1 -0
- package/lib-amd/autoFormat/list/keyboardListTrigger.d.ts +5 -0
- package/lib-amd/autoFormat/list/keyboardListTrigger.js +46 -0
- package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -0
- package/lib-amd/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
- package/lib-amd/contextMenuBase/ContextMenuPluginBase.js +86 -0
- package/lib-amd/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
- package/lib-amd/edit/EditPlugin.d.ts +3 -3
- package/lib-amd/edit/EditPlugin.js +1 -1
- package/lib-amd/edit/EditPlugin.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +19 -1
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
- package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js +60 -0
- package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
- package/lib-amd/edit/deleteSteps/deleteList.js +2 -1
- package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-amd/edit/handleKeyboardEventCommon.d.ts +2 -2
- package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-amd/edit/inputSteps/handleEnterOnList.js +40 -10
- package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-amd/edit/keyboardDelete.d.ts +3 -3
- package/lib-amd/edit/keyboardDelete.js +10 -3
- package/lib-amd/edit/keyboardDelete.js.map +1 -1
- package/lib-amd/edit/keyboardInput.d.ts +2 -2
- package/lib-amd/edit/keyboardInput.js +2 -2
- package/lib-amd/edit/keyboardInput.js.map +1 -1
- package/lib-amd/edit/keyboardTab.d.ts +2 -2
- package/lib-amd/edit/keyboardTab.js +18 -12
- package/lib-amd/edit/keyboardTab.js.map +1 -1
- package/lib-amd/edit/tabUtils/handleTabOnList.d.ts +7 -0
- package/lib-amd/edit/tabUtils/handleTabOnList.js +34 -0
- package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -0
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +81 -0
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
- package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-amd/index.d.ts +5 -0
- package/lib-amd/index.js +19 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js +1 -1
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-amd/paste/PastePlugin.d.ts +2 -3
- package/lib-amd/paste/PastePlugin.js +6 -7
- package/lib-amd/paste/PastePlugin.js.map +1 -1
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-amd/paste/WacComponents/constants.js.map +1 -1
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +6 -6
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-amd/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
- package/lib-amd/paste/WordDesktop/getStyleMetadata.js +2 -1
- package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib-amd/paste/utils/addParser.d.ts +1 -1
- package/lib-amd/paste/utils/addParser.js +2 -1
- package/lib-amd/paste/utils/addParser.js.map +1 -1
- package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib-amd/paste/utils/getStyles.js.map +1 -1
- package/lib-amd/paste/utils/linkParser.js.map +1 -1
- package/lib-amd/paste/utils/setProcessor.js.map +1 -1
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
- package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +2 -2
- package/lib-amd/pluginUtils/CreateElement/createElement.js +2 -1
- package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib-amd/pluginUtils/Disposable.d.ts +1 -1
- package/lib-amd/pluginUtils/Disposable.js.map +1 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
- package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +4 -3
- package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib-amd/shortcut/ShortcutCommand.d.ts +44 -0
- package/lib-amd/shortcut/ShortcutCommand.js +5 -0
- package/lib-amd/shortcut/ShortcutCommand.js.map +1 -0
- package/lib-amd/shortcut/ShortcutPlugin.d.ts +51 -0
- package/lib-amd/shortcut/ShortcutPlugin.js +120 -0
- package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -0
- package/lib-amd/shortcut/shortcuts.d.ts +85 -0
- package/lib-amd/shortcut/shortcuts.js +210 -0
- package/lib-amd/shortcut/shortcuts.js.map +1 -0
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +22 -0
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
- package/lib-amd/tableEdit/TableEditPlugin.d.ts +47 -0
- package/lib-amd/tableEdit/TableEditPlugin.js +156 -0
- package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -0
- package/lib-amd/tableEdit/editors/TableEditor.d.ts +73 -0
- package/lib-amd/tableEdit/editors/TableEditor.js +290 -0
- package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/CellResizer.d.ts +6 -0
- package/lib-amd/tableEdit/editors/features/CellResizer.js +166 -0
- package/lib-amd/tableEdit/editors/features/CellResizer.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
- package/lib-amd/tableEdit/editors/features/TableEditFeature.js +19 -0
- package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +6 -0
- package/lib-amd/tableEdit/editors/features/TableInserter.js +111 -0
- package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableMover.d.ts +8 -0
- package/lib-amd/tableEdit/editors/features/TableMover.js +81 -0
- package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +6 -0
- package/lib-amd/tableEdit/editors/features/TableResizer.js +164 -0
- package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -0
- package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +11 -2
- package/lib-mjs/autoFormat/AutoFormatPlugin.js +24 -4
- package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-mjs/autoFormat/link/createLink.d.ts +5 -0
- package/lib-mjs/autoFormat/link/createLink.js +22 -0
- package/lib-mjs/autoFormat/link/createLink.js.map +1 -0
- package/lib-mjs/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
- package/lib-mjs/autoFormat/link/createLinkAfterSpace.js +35 -0
- package/lib-mjs/autoFormat/link/createLinkAfterSpace.js.map +1 -0
- package/lib-mjs/autoFormat/link/getLinkSegment.d.ts +5 -0
- package/lib-mjs/autoFormat/link/getLinkSegment.js +23 -0
- package/lib-mjs/autoFormat/link/getLinkSegment.js.map +1 -0
- package/lib-mjs/autoFormat/link/unlink.d.ts +5 -0
- package/lib-mjs/autoFormat/link/unlink.js +16 -0
- package/lib-mjs/autoFormat/link/unlink.js.map +1 -0
- package/lib-mjs/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
- package/lib-mjs/autoFormat/list/getIndex.js.map +1 -0
- package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
- package/lib-mjs/autoFormat/list/getListTypeStyle.js.map +1 -0
- package/lib-mjs/autoFormat/list/getNumberingListStyle.js.map +1 -0
- package/lib-mjs/autoFormat/list/keyboardListTrigger.d.ts +5 -0
- package/lib-mjs/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
- package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -0
- package/lib-mjs/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
- package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js +81 -0
- package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
- package/lib-mjs/edit/EditPlugin.d.ts +3 -3
- package/lib-mjs/edit/EditPlugin.js +1 -1
- package/lib-mjs/edit/EditPlugin.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +20 -1
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
- package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js +56 -0
- package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
- package/lib-mjs/edit/deleteSteps/deleteList.js +2 -1
- package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +2 -2
- package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js +42 -12
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-mjs/edit/keyboardDelete.d.ts +3 -3
- package/lib-mjs/edit/keyboardDelete.js +10 -2
- package/lib-mjs/edit/keyboardDelete.js.map +1 -1
- package/lib-mjs/edit/keyboardInput.d.ts +2 -2
- package/lib-mjs/edit/keyboardInput.js +2 -1
- package/lib-mjs/edit/keyboardInput.js.map +1 -1
- package/lib-mjs/edit/keyboardTab.d.ts +2 -2
- package/lib-mjs/edit/keyboardTab.js +19 -11
- package/lib-mjs/edit/keyboardTab.js.map +1 -1
- package/lib-mjs/edit/tabUtils/handleTabOnList.d.ts +7 -0
- package/lib-mjs/edit/tabUtils/handleTabOnList.js +30 -0
- package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -0
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +77 -0
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
- package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-mjs/index.d.ts +5 -0
- package/lib-mjs/index.js +4 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +1 -1
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-mjs/paste/PastePlugin.d.ts +2 -3
- package/lib-mjs/paste/PastePlugin.js +1 -2
- package/lib-mjs/paste/PastePlugin.js.map +1 -1
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-mjs/paste/WacComponents/constants.js.map +1 -1
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +1 -1
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/WordMetadata.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.js +1 -1
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +2 -14
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib-mjs/paste/utils/addParser.d.ts +1 -1
- package/lib-mjs/paste/utils/addParser.js +1 -1
- package/lib-mjs/paste/utils/addParser.js.map +1 -1
- package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib-mjs/paste/utils/getStyles.js.map +1 -1
- package/lib-mjs/paste/utils/linkParser.js.map +1 -1
- package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
- package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
- package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +2 -2
- package/lib-mjs/pluginUtils/CreateElement/createElement.js +1 -1
- package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -1
- package/lib-mjs/pluginUtils/Disposable.d.ts +1 -1
- package/lib-mjs/pluginUtils/Disposable.js.map +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +1 -1
- package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +2 -2
- package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
- package/lib-mjs/shortcut/ShortcutCommand.d.ts +44 -0
- package/lib-mjs/shortcut/ShortcutCommand.js +2 -0
- package/lib-mjs/shortcut/ShortcutCommand.js.map +1 -0
- package/lib-mjs/shortcut/ShortcutPlugin.d.ts +51 -0
- package/lib-mjs/shortcut/ShortcutPlugin.js +117 -0
- package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -0
- package/lib-mjs/shortcut/shortcuts.d.ts +85 -0
- package/lib-mjs/shortcut/shortcuts.js +208 -0
- package/lib-mjs/shortcut/shortcuts.js.map +1 -0
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +18 -0
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
- package/lib-mjs/tableEdit/TableEditPlugin.d.ts +47 -0
- package/lib-mjs/tableEdit/TableEditPlugin.js +153 -0
- package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -0
- package/lib-mjs/tableEdit/editors/TableEditor.d.ts +73 -0
- package/lib-mjs/tableEdit/editors/TableEditor.js +291 -0
- package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/CellResizer.d.ts +6 -0
- package/lib-mjs/tableEdit/editors/features/CellResizer.js +165 -0
- package/lib-mjs/tableEdit/editors/features/CellResizer.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.js +13 -0
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +6 -0
- package/lib-mjs/tableEdit/editors/features/TableInserter.js +109 -0
- package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +8 -0
- package/lib-mjs/tableEdit/editors/features/TableMover.js +79 -0
- package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +6 -0
- package/lib-mjs/tableEdit/editors/features/TableResizer.js +162 -0
- package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -0
- package/package.json +5 -5
- package/lib/autoFormat/keyboardListTrigger.d.ts +0 -5
- package/lib/autoFormat/keyboardListTrigger.js.map +0 -1
- package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
- package/lib/autoFormat/utils/getIndex.js.map +0 -1
- package/lib/autoFormat/utils/getListTypeStyle.js.map +0 -1
- package/lib/autoFormat/utils/getNumberingListStyle.js.map +0 -1
- package/lib/pluginUtils/Rect/normalizeRect.d.ts +0 -7
- package/lib/pluginUtils/Rect/normalizeRect.js +0 -20
- package/lib/pluginUtils/Rect/normalizeRect.js.map +0 -1
- package/lib-amd/autoFormat/keyboardListTrigger.d.ts +0 -5
- package/lib-amd/autoFormat/keyboardListTrigger.js +0 -44
- package/lib-amd/autoFormat/keyboardListTrigger.js.map +0 -1
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
- package/lib-amd/autoFormat/utils/getIndex.js.map +0 -1
- package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +0 -1
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +0 -1
- package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +0 -7
- package/lib-amd/pluginUtils/Rect/normalizeRect.js +0 -22
- package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +0 -1
- package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +0 -5
- package/lib-mjs/autoFormat/keyboardListTrigger.js.map +0 -1
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
- package/lib-mjs/autoFormat/utils/getIndex.js.map +0 -1
- package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +0 -1
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +0 -1
- package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +0 -7
- package/lib-mjs/pluginUtils/Rect/normalizeRect.js +0 -17
- package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +0 -1
- /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
- /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
- /package/lib/autoFormat/{utils → list}/getIndex.d.ts +0 -0
- /package/lib/autoFormat/{utils → list}/getIndex.js +0 -0
- /package/lib/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
- /package/lib/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
- /package/lib/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
- /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
- /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getIndex.d.ts +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getIndex.js +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
- /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getIndex.d.ts +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getIndex.js +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
- /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleEnterOnList.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"handleEnterOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/inputSteps/handleEnterOnList.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,iCAAiC,EACjC,kBAAkB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,QAAQ,EACR,cAAc,EACd,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,GAC1B,MAAM,6BAA6B,CAAC;AASrC;;GAEG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAwB,UAAA,OAAO;IACjD,IAAA,YAAY,GAAK,OAAO,aAAZ,CAAa;IACjC,IACI,YAAY,IAAI,iBAAiB;QACjC,YAAY,IAAI,YAAY;QAC5B,YAAY,IAAI,OAAO,EACzB;QACU,IAAA,WAAW,GAAoB,OAAO,YAA3B,EAAE,aAAa,GAAK,OAAO,cAAZ,CAAa;QACvC,IAAA,IAAI,GAAK,WAAW,KAAhB,CAAiB;QAC7B,IAAM,QAAQ,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,CAAC;QACzC,IAAM,KAAK,GAAG,iCAAiC,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;QAEnF,IAAM,UAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAEnC,IAAI,UAAQ,IAAI,UAAQ,CAAC,cAAc,KAAK,UAAU,IAAI,UAAU,EAAE;YAClE,IAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAQ,CAAC,CAAC;YACtD,I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EAAE;QACnE,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;KACpD;IAED,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAEjC,OAAO,YAAY,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import {\n getClosestAncestorBlockGroupIndex,\n isBlockGroupOfType,\n} from 'roosterjs-content-model-core';\nimport {\n createBr,\n createListItem,\n createListLevel,\n createParagraph,\n createSelectionMarker,\n normalizeContentModel,\n normalizeParagraph,\n setParagraphNotImplicit,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlockGroup,\n ContentModelListItem,\n DeleteSelectionStep,\n InsertPoint,\n ValidDeleteSelectionContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const handleEnterOnList: DeleteSelectionStep = context => {\n const { deleteResult } = context;\n if (\n deleteResult == 'nothingToDelete' ||\n deleteResult == 'notDeleted' ||\n deleteResult == 'range'\n ) {\n const { insertPoint, formatContext } = context;\n const { path } = insertPoint;\n const rawEvent = formatContext?.rawEvent;\n const index = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n\n const listItem = path[index];\n const listParent = path[index + 1];\n\n if (listItem && listItem.blockGroupType === 'ListItem' && listParent) {\n const listIndex = listParent.blocks.indexOf(listItem);\n const nextBlock = listParent.blocks[listIndex + 1];\n if (deleteResult == 'range' && nextBlock) {\n normalizeContentModel(listParent);\n const nextListItem = listParent.blocks[listIndex + 1];\n if (\n isBlockGroupOfType<ContentModelListItem>(nextListItem, 'ListItem') &&\n nextListItem.levels[0]\n ) {\n nextListItem.levels.forEach((level, index) => {\n level.format.startNumberOverride = undefined;\n level.dataset = listItem.levels[index]\n ? listItem.levels[index].dataset\n : {};\n });\n const lastParagraph = listItem.blocks[listItem.blocks.length - 1];\n const nextParagraph = nextListItem.blocks[0];\n if (\n nextParagraph.blockType === 'Paragraph' &&\n lastParagraph.blockType === 'Paragraph' &&\n lastParagraph.segments[lastParagraph.segments.length - 1].segmentType ===\n 'SelectionMarker'\n ) {\n lastParagraph.segments.pop();\n\n nextParagraph.segments.unshift(\n createSelectionMarker(insertPoint.marker.format)\n );\n }\n context.lastParagraph = undefined;\n }\n } else if (deleteResult !== 'range') {\n if (isEmptyListItem(listItem)) {\n listItem.levels.pop();\n } else {\n createNewListItem(context, listItem, listParent);\n }\n }\n rawEvent?.preventDefault();\n context.deleteResult = 'range';\n }\n }\n};\n\nconst isEmptyListItem = (listItem: ContentModelListItem) => {\n return (\n listItem.blocks.length === 1 &&\n listItem.blocks[0].blockType === 'Paragraph' &&\n listItem.blocks[0].segments.length === 2 &&\n listItem.blocks[0].segments[0].segmentType === 'SelectionMarker' &&\n listItem.blocks[0].segments[1].segmentType === 'Br'\n );\n};\n\nconst createNewListItem = (\n context: ValidDeleteSelectionContext,\n listItem: ContentModelListItem,\n listParent: ContentModelBlockGroup\n) => {\n const { insertPoint } = context;\n const listIndex = listParent.blocks.indexOf(listItem);\n const newParagraph = createNewParagraph(insertPoint);\n\n const levels = createNewListLevel(listItem);\n const newListItem = createListItem(levels, insertPoint.marker.format);\n newListItem.blocks.push(newParagraph);\n insertPoint.paragraph = newParagraph;\n context.lastParagraph = newParagraph;\n listParent.blocks.splice(listIndex + 1, 0, newListItem);\n};\n\nconst createNewListLevel = (listItem: ContentModelListItem) => {\n return listItem.levels.map(level => {\n return createListLevel(\n level.listType,\n {\n ...level.format,\n startNumberOverride: undefined,\n },\n level.dataset\n );\n });\n};\n\nconst createNewParagraph = (insertPoint: InsertPoint) => {\n const { paragraph, marker } = insertPoint;\n const newParagraph = createParagraph(\n false /*isImplicit*/,\n paragraph.format,\n paragraph.segmentFormat\n );\n\n const markerIndex = paragraph.segments.indexOf(marker);\n const segments = paragraph.segments.splice(\n markerIndex,\n paragraph.segments.length - markerIndex\n );\n\n newParagraph.segments.push(...segments);\n\n setParagraphNotImplicit(paragraph);\n\n if (paragraph.segments.every(x => x.segmentType == 'SelectionMarker')) {\n paragraph.segments.push(createBr(marker.format));\n }\n\n normalizeParagraph(newParagraph);\n\n return newParagraph;\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
* Do keyboard event handling for DELETE/BACKSPACE key
|
|
5
|
-
* @param editor The
|
|
5
|
+
* @param editor The editor object
|
|
6
6
|
* @param rawEvent DOM keyboard event
|
|
7
7
|
* @returns True if the event is handled by content model, otherwise false
|
|
8
8
|
*/
|
|
9
|
-
export declare function keyboardDelete(editor:
|
|
9
|
+
export declare function keyboardDelete(editor: IEditor, rawEvent: KeyboardEvent): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChangeSource, deleteSelection, isModifierKey } from 'roosterjs-content-model-core';
|
|
2
2
|
import { deleteAllSegmentBefore } from './deleteSteps/deleteAllSegmentBefore';
|
|
3
|
+
import { deleteEmptyQuote } from './deleteSteps/deleteEmptyQuote';
|
|
3
4
|
import { deleteList } from './deleteSteps/deleteList';
|
|
4
5
|
import { isNodeOfType } from 'roosterjs-content-model-dom';
|
|
5
6
|
import { handleKeyboardEventResult, shouldDeleteAllSegmentsBefore, shouldDeleteWord, } from './handleKeyboardEventCommon';
|
|
@@ -8,7 +9,7 @@ import { backwardDeleteCollapsedSelection, forwardDeleteCollapsedSelection, } fr
|
|
|
8
9
|
/**
|
|
9
10
|
* @internal
|
|
10
11
|
* Do keyboard event handling for DELETE/BACKSPACE key
|
|
11
|
-
* @param editor The
|
|
12
|
+
* @param editor The editor object
|
|
12
13
|
* @param rawEvent DOM keyboard event
|
|
13
14
|
* @returns True if the event is handled by content model, otherwise false
|
|
14
15
|
*/
|
|
@@ -40,7 +41,14 @@ function getDeleteSteps(rawEvent, isMac) {
|
|
|
40
41
|
var deleteCollapsedSelection = isForward
|
|
41
42
|
? forwardDeleteCollapsedSelection
|
|
42
43
|
: backwardDeleteCollapsedSelection;
|
|
43
|
-
|
|
44
|
+
var deleteQuote = !isForward ? deleteEmptyQuote : null;
|
|
45
|
+
return [
|
|
46
|
+
deleteAllSegmentBeforeStep,
|
|
47
|
+
deleteWordSelection,
|
|
48
|
+
deleteCollapsedSelection,
|
|
49
|
+
deleteList,
|
|
50
|
+
deleteQuote,
|
|
51
|
+
];
|
|
44
52
|
}
|
|
45
53
|
function shouldDeleteWithContentModel(selection, rawEvent) {
|
|
46
54
|
if (!selection) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardDelete.js","sourceRoot":"","sources":["../../../../packages
|
|
1
|
+
{"version":3,"file":"keyboardDelete.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/keyboardDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAC7B,gBAAgB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,2BAA2B,EAC3B,0BAA0B,GAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,gCAAgC,EAChC,+BAA+B,GAClC,MAAM,wCAAwC,CAAC;AAGhD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,MAAe,EAAE,QAAuB;IACnE,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,IAAI,4BAA4B,CAAC,SAAS,EAAE,QAAQ,CAAC,EA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AC;IACzD,OAAO;QACH,0BAA0B;QAC1B,mBAAmB;QACnB,wBAAwB;QACxB,UAAU;QACV,WAAW;KACd,CAAC;AACN,CAAC;AAED,SAAS,4BAA4B,CAAC,SAA8B,EAAE,QAAuB;IACzF,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,KAAK,CAAC,CAAC,oBAAoB;KACrC;SAAM,IAAI,SAAS,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE;QAChE,OAAO,IAAI,CAAC,CAAC,4DAA4D;KAC5E;SAAM;QACH,IAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;QAE9B,oGAAoG;QACpG,OAAO,CAAC,CACJ,YAAY,CAAC,KAAK,CAAC,cAAc,EAAE,WAAW,CAAC;YAC/C,CAAC,aAAa,CAAC,QAAQ,CAAC;YACxB,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CACxE,CAAC;KACL;AACL,CAAC;AAED,SAAS,eAAe,CAAC,QAAuB,EAAE,KAAY;IAC1D,OAAO,QAAQ,CAAC,GAAG,IAAI,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,cAAc,CAAC,QAAuB,EAAE,KAAY;;IACzD,OAAO,CACH,QAAQ,CAAC,GAAG,IAAI,QAAQ;QACxB,KAAK,CAAC,WAAW,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,cAAc,CAAC,SAAS,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,CAAC,CACxE,CAAC;AACN,CAAC","sourcesContent":["import { ChangeSource, deleteSelection, isModifierKey } from 'roosterjs-content-model-core';\nimport { deleteAllSegmentBefore } from './deleteSteps/deleteAllSegmentBefore';\nimport { deleteEmptyQuote } from './deleteSteps/deleteEmptyQuote';\nimport { deleteList } from './deleteSteps/deleteList';\nimport { isNodeOfType } from 'roosterjs-content-model-dom';\nimport {\n handleKeyboardEventResult,\n shouldDeleteAllSegmentsBefore,\n shouldDeleteWord,\n} from './handleKeyboardEventCommon';\nimport {\n backwardDeleteWordSelection,\n forwardDeleteWordSelection,\n} from './deleteSteps/deleteWordSelection';\nimport {\n backwardDeleteCollapsedSelection,\n forwardDeleteCollapsedSelection,\n} from './deleteSteps/deleteCollapsedSelection';\nimport type { DOMSelection, DeleteSelectionStep, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Do keyboard event handling for DELETE/BACKSPACE key\n * @param editor The editor object\n * @param rawEvent DOM keyboard event\n * @returns True if the event is handled by content model, otherwise false\n */\nexport function keyboardDelete(editor: IEditor, rawEvent: KeyboardEvent) {\n let handled = false;\n const selection = editor.getDOMSelection();\n\n if (shouldDeleteWithContentModel(selection, rawEvent)) {\n editor.formatContentModel(\n (model, context) => {\n const result = deleteSelection(\n model,\n getDeleteSteps(rawEvent, !!editor.getEnvironment().isMac),\n context\n ).deleteResult;\n\n handled = handleKeyboardEventResult(editor, model, rawEvent, result, context);\n return handled;\n },\n {\n rawEvent,\n changeSource: ChangeSource.Keyboard,\n getChangeData: () => rawEvent.which,\n apiName: rawEvent.key == 'Delete' ? 'handleDeleteKey' : 'handleBackspaceKey',\n }\n );\n }\n\n return handled;\n}\n\nfunction getDeleteSteps(rawEvent: KeyboardEvent, isMac: boolean): (DeleteSelectionStep | null)[] {\n const isForward = rawEvent.key == 'Delete';\n const deleteAllSegmentBeforeStep =\n shouldDeleteAllSegmentsBefore(rawEvent) && !isForward ? deleteAllSegmentBefore : null;\n const deleteWordSelection = shouldDeleteWord(rawEvent, isMac)\n ? isForward\n ? forwardDeleteWordSelection\n : backwardDeleteWordSelection\n : null;\n const deleteCollapsedSelection = isForward\n ? forwardDeleteCollapsedSelection\n : backwardDeleteCollapsedSelection;\n const deleteQuote = !isForward ? deleteEmptyQuote : null;\n return [\n deleteAllSegmentBeforeStep,\n deleteWordSelection,\n deleteCollapsedSelection,\n deleteList,\n deleteQuote,\n ];\n}\n\nfunction shouldDeleteWithContentModel(selection: DOMSelection | null, rawEvent: KeyboardEvent) {\n if (!selection) {\n return false; // Nothing to delete\n } else if (selection.type != 'range' || !selection.range.collapsed) {\n return true; // Selection is not collapsed, need to delete all selections\n } else {\n const range = selection.range;\n\n // When selection is collapsed and is in middle of text node, no need to use Content Model to delete\n return !(\n isNodeOfType(range.startContainer, 'TEXT_NODE') &&\n !isModifierKey(rawEvent) &&\n (canDeleteBefore(rawEvent, range) || canDeleteAfter(rawEvent, range))\n );\n }\n}\n\nfunction canDeleteBefore(rawEvent: KeyboardEvent, range: Range) {\n return rawEvent.key == 'Backspace' && range.startOffset > 1;\n}\n\nfunction canDeleteAfter(rawEvent: KeyboardEvent, range: Range) {\n return (\n rawEvent.key == 'Delete' &&\n range.startOffset < (range.startContainer.nodeValue?.length ?? 0) - 1\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare function keyboardInput(editor:
|
|
5
|
+
export declare function keyboardInput(editor: IEditor, rawEvent: KeyboardEvent): true | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deleteEmptyQuote } from './deleteSteps/deleteEmptyQuote';
|
|
1
2
|
import { deleteSelection, isModifierKey } from 'roosterjs-content-model-core';
|
|
2
3
|
import { handleEnterOnList } from './inputSteps/handleEnterOnList';
|
|
3
4
|
import { normalizeContentModel } from 'roosterjs-content-model-dom';
|
|
@@ -33,7 +34,7 @@ export function keyboardInput(editor, rawEvent) {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
function getInputSteps(selection, rawEvent) {
|
|
36
|
-
return shouldHandleEnterKey(selection, rawEvent) ? [handleEnterOnList] : [];
|
|
37
|
+
return shouldHandleEnterKey(selection, rawEvent) ? [handleEnterOnList, deleteEmptyQuote] : [];
|
|
37
38
|
}
|
|
38
39
|
function shouldInputWithContentModel(selection, rawEvent) {
|
|
39
40
|
if (!selection) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardInput.js","sourceRoot":"","sources":["../../../../packages
|
|
1
|
+
{"version":3,"file":"keyboardInput.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/keyboardInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe,EAAE,QAAuB;IAClE,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,IAAI,2BAA2B,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;QAClD,MAAM,CAAC,YAAY,EAAE,CAAC;QAEtB,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;;YACX,IAAM,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;YAEnF,0EAA0E;YAC1E,qFAAqF;YACrF,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;YAE/B,oJAAoJ;YACpJ,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAEhC,IAAI,MAAM,CAAC,YAAY,IAAI,OAAO,EAAE;gBAChC,2HAA2H;gBAC3H,OAAO,CAAC,gBAAgB,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,MAAM,CAAC,MAAM,CAAC;gBAE7D,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAE7B,sFAAsF;gBACtF,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD;YACI,QAAQ,UAAA;SACX,CACJ,CAAC;QAEF,OAAO,IAAI,CAAC;KACf;AACL,CAAC;AAED,SAAS,aAAa,CAAC,SAA8B,EAAE,QAAuB;IAC1E,OAAO,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClG,CAAC;AAED,SAAS,2BAA2B,CAAC,SAA8B,EAAE,QAAuB;IACxF,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,KAAK,CAAC,CAAC,oBAAoB;KACrC;SAAM,IACH,CAAC,aAAa,CAAC,QAAQ,CAAC;QACxB,CAAC,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,EAClF;QACE,OAAO,CACH,SAAS,CAAC,IAAI,IAAI,OAAO;YACzB,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS;YAC1B,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAC5C,CAAC;KACL;SAAM;QACH,OAAO,KAAK,CAAC;KAChB;AACL,CAAC;AAED,IAAM,oBAAoB,GAAG,UAAC,SAA8B,EAAE,QAAuB;IACjF,OAAO,SAAS,IAAI,SAAS,CAAC,IAAI,IAAI,OAAO,IAAI,QAAQ,CAAC,GAAG,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACnG,CAAC,CAAC","sourcesContent":["import { deleteEmptyQuote } from './deleteSteps/deleteEmptyQuote';\nimport { deleteSelection, isModifierKey } from 'roosterjs-content-model-core';\nimport { handleEnterOnList } from './inputSteps/handleEnterOnList';\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport type { DOMSelection, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardInput(editor: IEditor, rawEvent: KeyboardEvent) {\n const selection = editor.getDOMSelection();\n\n if (shouldInputWithContentModel(selection, rawEvent)) {\n editor.takeSnapshot();\n\n editor.formatContentModel(\n (model, context) => {\n const result = deleteSelection(model, getInputSteps(selection, rawEvent), context);\n\n // We have deleted selection then we will let browser to handle the input.\n // With this combined operation, we don't wan to mass up the cached model so clear it\n context.clearModelCache = true;\n\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\n context.skipUndoSnapshot = true;\n\n if (result.deleteResult == 'range') {\n // We have deleted something, next input should inherit the segment format from deleted content, so set pending format here\n context.newPendingFormat = result.insertPoint?.marker.format;\n\n normalizeContentModel(model);\n\n // Do not preventDefault since we still want browser to handle the final input for now\n return true;\n } else {\n return false;\n }\n },\n {\n rawEvent,\n }\n );\n\n return true;\n }\n}\n\nfunction getInputSteps(selection: DOMSelection | null, rawEvent: KeyboardEvent) {\n return shouldHandleEnterKey(selection, rawEvent) ? [handleEnterOnList, deleteEmptyQuote] : [];\n}\n\nfunction shouldInputWithContentModel(selection: DOMSelection | null, rawEvent: KeyboardEvent) {\n if (!selection) {\n return false; // Nothing to delete\n } else if (\n !isModifierKey(rawEvent) &&\n (rawEvent.key == 'Enter' || rawEvent.key == 'Space' || rawEvent.key.length == 1)\n ) {\n return (\n selection.type != 'range' ||\n !selection.range.collapsed ||\n shouldHandleEnterKey(selection, rawEvent)\n );\n } else {\n return false;\n }\n}\n\nconst shouldHandleEnterKey = (selection: DOMSelection | null, rawEvent: KeyboardEvent) => {\n return selection && selection.type == 'range' && rawEvent.key == 'Enter' && !rawEvent.shiftKey;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare function keyboardTab(editor:
|
|
5
|
+
export declare function keyboardTab(editor: IEditor, rawEvent: KeyboardEvent): true | undefined;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-core';
|
|
2
|
+
import { handleTabOnList } from './tabUtils/handleTabOnList';
|
|
3
|
+
import { handleTabOnParagraph } from './tabUtils/handleTabOnParagraph';
|
|
2
4
|
import { setModelIndentation } from 'roosterjs-content-model-api';
|
|
3
5
|
/**
|
|
4
6
|
* @internal
|
|
@@ -6,26 +8,32 @@ import { setModelIndentation } from 'roosterjs-content-model-api';
|
|
|
6
8
|
export function keyboardTab(editor, rawEvent) {
|
|
7
9
|
var selection = editor.getDOMSelection();
|
|
8
10
|
if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'range') {
|
|
9
|
-
editor.
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
editor.formatContentModel(function (model) {
|
|
12
|
+
return handleTab(model, rawEvent);
|
|
13
|
+
}, {
|
|
14
|
+
apiName: 'handleTabKey',
|
|
12
15
|
});
|
|
13
16
|
return true;
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function
|
|
19
|
+
/**
|
|
20
|
+
* If multiple blocks are selected, indent or outdent the selected blocks with setModelIndentation.
|
|
21
|
+
* If only one block is selected, call handleTabOnParagraph or handleTabOnList to handle the tab key.
|
|
22
|
+
*/
|
|
23
|
+
function handleTab(model, rawEvent) {
|
|
21
24
|
var blocks = getOperationalBlocks(model, ['ListItem'], ['TableCell']);
|
|
22
|
-
var
|
|
23
|
-
if (
|
|
24
|
-
isMarkerAtStartOfBlock(listItem)) {
|
|
25
|
+
var block = blocks.length > 0 ? blocks[0].block : undefined;
|
|
26
|
+
if (blocks.length > 1) {
|
|
25
27
|
setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');
|
|
26
28
|
rawEvent.preventDefault();
|
|
27
29
|
return true;
|
|
28
30
|
}
|
|
31
|
+
else if ((block === null || block === void 0 ? void 0 : block.blockType) === 'Paragraph') {
|
|
32
|
+
return handleTabOnParagraph(model, block, rawEvent);
|
|
33
|
+
}
|
|
34
|
+
else if (isBlockGroupOfType(block, 'ListItem')) {
|
|
35
|
+
return handleTabOnList(model, block, rawEvent);
|
|
36
|
+
}
|
|
29
37
|
return false;
|
|
30
38
|
}
|
|
31
39
|
//# sourceMappingURL=keyboardTab.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardTab.js","sourceRoot":"","sources":["../../../../packages
|
|
1
|
+
{"version":3,"file":"keyboardTab.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/keyboardTab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAOlE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe,EAAE,QAAuB;IAChE,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,KAAI,OAAO,EAAE;QAC5B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACD,OAAO,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACtC,CAAC,EACD;YACI,OAAO,EAAE,cAAc;SAC1B,CACJ,CAAC;QAEF,OAAO,IAAI,CAAC;KACf;AACL,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAC,KAA2B,EAAE,QAAuB;IACnE,IAAM,MAAM,GAAG,oBAAoB,CAAuB,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9F,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACnB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrE,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;KACf;SAAM,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,WAAW,EAAE;QACzC,OAAO,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;KACvD;SAAM,IAAI,kBAAkB,CAAuB,KAAK,EAAE,UAAU,CAAC,EAAE;QACpE,OAAO,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;KAClD;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-core';\nimport { handleTabOnList } from './tabUtils/handleTabOnList';\nimport { handleTabOnParagraph } from './tabUtils/handleTabOnParagraph';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardTab(editor: IEditor, rawEvent: KeyboardEvent) {\n const selection = editor.getDOMSelection();\n\n if (selection?.type == 'range') {\n editor.formatContentModel(\n model => {\n return handleTab(model, rawEvent);\n },\n {\n apiName: 'handleTabKey',\n }\n );\n\n return true;\n }\n}\n\n/**\n * If multiple blocks are selected, indent or outdent the selected blocks with setModelIndentation.\n * If only one block is selected, call handleTabOnParagraph or handleTabOnList to handle the tab key.\n */\nfunction handleTab(model: ContentModelDocument, rawEvent: KeyboardEvent) {\n const blocks = getOperationalBlocks<ContentModelListItem>(model, ['ListItem'], ['TableCell']);\n const block = blocks.length > 0 ? blocks[0].block : undefined;\n if (blocks.length > 1) {\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n rawEvent.preventDefault();\n return true;\n } else if (block?.blockType === 'Paragraph') {\n return handleTabOnParagraph(model, block, rawEvent);\n } else if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n return handleTabOnList(model, block, rawEvent);\n }\n return false;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContentModelDocument, ContentModelListItem } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* 1. When the selection is collapsed and the cursor is at start of a list item, call setModelIndentation.
|
|
4
|
+
* 2. Otherwise call handleTabOnParagraph.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function handleTabOnList(model: ContentModelDocument, listItem: ContentModelListItem, rawEvent: KeyboardEvent): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { handleTabOnParagraph } from './handleTabOnParagraph';
|
|
2
|
+
import { setModelIndentation } from 'roosterjs-content-model-api';
|
|
3
|
+
/**
|
|
4
|
+
* 1. When the selection is collapsed and the cursor is at start of a list item, call setModelIndentation.
|
|
5
|
+
* 2. Otherwise call handleTabOnParagraph.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export function handleTabOnList(model, listItem, rawEvent) {
|
|
9
|
+
var selectedParagraph = findSelectedParagraph(listItem);
|
|
10
|
+
if (!isMarkerAtStartOfBlock(listItem) &&
|
|
11
|
+
selectedParagraph.length == 1 &&
|
|
12
|
+
selectedParagraph[0].blockType === 'Paragraph') {
|
|
13
|
+
return handleTabOnParagraph(model, selectedParagraph[0], rawEvent);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');
|
|
17
|
+
rawEvent.preventDefault();
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function isMarkerAtStartOfBlock(listItem) {
|
|
22
|
+
return (listItem.blocks[0].blockType == 'Paragraph' &&
|
|
23
|
+
listItem.blocks[0].segments[0].segmentType == 'SelectionMarker');
|
|
24
|
+
}
|
|
25
|
+
function findSelectedParagraph(listItem) {
|
|
26
|
+
return listItem.blocks.filter(function (block) {
|
|
27
|
+
return block.blockType == 'Paragraph' && block.segments.some(function (segment) { return segment.isSelected; });
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=handleTabOnList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleTabOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC3B,KAA2B,EAC3B,QAA8B,EAC9B,QAAuB;IAEvB,IAAM,iBAAiB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC1D,IACI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QACjC,iBAAiB,CAAC,MAAM,IAAI,CAAC;QAC7B,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,WAAW,EAChD;QACE,OAAO,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;KACtE;SAAM;QACH,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrE,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;KACf;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,QAA8B;IAC1D,OAAO,CACH,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,WAAW;QAC3C,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAClE,CAAC;AACN,CAAC;AAED,SAAS,qBAAqB,CAAC,QAA8B;IACzD,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CACzB,UAAA,KAAK;QACD,OAAA,KAAK,CAAC,SAAS,IAAI,WAAW,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC;IAApF,CAAoF,CAC3F,CAAC;AACN,CAAC","sourcesContent":["import { handleTabOnParagraph } from './handleTabOnParagraph';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type { ContentModelDocument, ContentModelListItem } from 'roosterjs-content-model-types';\n\n/**\n * 1. When the selection is collapsed and the cursor is at start of a list item, call setModelIndentation.\n * 2. Otherwise call handleTabOnParagraph.\n * @internal\n */\nexport function handleTabOnList(\n model: ContentModelDocument,\n listItem: ContentModelListItem,\n rawEvent: KeyboardEvent\n) {\n const selectedParagraph = findSelectedParagraph(listItem);\n if (\n !isMarkerAtStartOfBlock(listItem) &&\n selectedParagraph.length == 1 &&\n selectedParagraph[0].blockType === 'Paragraph'\n ) {\n return handleTabOnParagraph(model, selectedParagraph[0], rawEvent);\n } else {\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n rawEvent.preventDefault();\n return true;\n }\n}\n\nfunction isMarkerAtStartOfBlock(listItem: ContentModelListItem) {\n return (\n listItem.blocks[0].blockType == 'Paragraph' &&\n listItem.blocks[0].segments[0].segmentType == 'SelectionMarker'\n );\n}\n\nfunction findSelectedParagraph(listItem: ContentModelListItem) {\n return listItem.blocks.filter(\n block =>\n block.blockType == 'Paragraph' && block.segments.some(segment => segment.isSelected)\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentModelDocument, ContentModelParagraph } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
The handleTabOnParagraph function will handle the tab key in following scenarios:
|
|
5
|
+
* 1. When the selection is collapsed and the cursor is at the end of a paragraph, add 4 spaces.
|
|
6
|
+
* 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to indent the whole paragraph
|
|
7
|
+
* 3. When the selection is collapsed and the cursor is at the middle of a paragraph, add 4 spaces.
|
|
8
|
+
* 4. When the selection is not collapsed, replace the selected range with a single space.
|
|
9
|
+
* 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to indent the whole paragraph
|
|
10
|
+
The handleTabOnParagraph function will handle the shift + tab key in a indented paragraph in following scenarios:
|
|
11
|
+
* 1. When the selection is collapsed and the cursor is at the end of a paragraph, remove 4 spaces.
|
|
12
|
+
* 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to outdent the whole paragraph
|
|
13
|
+
* 3. When the selection is collapsed and the cursor is at the middle of a paragraph, remove 4 spaces.
|
|
14
|
+
* 4. When the selection is not collapsed, replace the selected range with a 4 space.
|
|
15
|
+
* 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleTabOnParagraph(model: ContentModelDocument, paragraph: ContentModelParagraph, rawEvent: KeyboardEvent): boolean;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createSelectionMarker, createText } from 'roosterjs-content-model-dom';
|
|
2
|
+
import { setModelIndentation } from 'roosterjs-content-model-api';
|
|
3
|
+
var tabSpaces = ' ';
|
|
4
|
+
var space = ' ';
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
The handleTabOnParagraph function will handle the tab key in following scenarios:
|
|
8
|
+
* 1. When the selection is collapsed and the cursor is at the end of a paragraph, add 4 spaces.
|
|
9
|
+
* 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to indent the whole paragraph
|
|
10
|
+
* 3. When the selection is collapsed and the cursor is at the middle of a paragraph, add 4 spaces.
|
|
11
|
+
* 4. When the selection is not collapsed, replace the selected range with a single space.
|
|
12
|
+
* 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to indent the whole paragraph
|
|
13
|
+
The handleTabOnParagraph function will handle the shift + tab key in a indented paragraph in following scenarios:
|
|
14
|
+
* 1. When the selection is collapsed and the cursor is at the end of a paragraph, remove 4 spaces.
|
|
15
|
+
* 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to outdent the whole paragraph
|
|
16
|
+
* 3. When the selection is collapsed and the cursor is at the middle of a paragraph, remove 4 spaces.
|
|
17
|
+
* 4. When the selection is not collapsed, replace the selected range with a 4 space.
|
|
18
|
+
* 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph
|
|
19
|
+
*/
|
|
20
|
+
export function handleTabOnParagraph(model, paragraph, rawEvent) {
|
|
21
|
+
var selectedSegments = paragraph.segments.filter(function (segment) { return segment.isSelected; });
|
|
22
|
+
var isCollapsed = selectedSegments.length === 1 && selectedSegments[0].segmentType === 'SelectionMarker';
|
|
23
|
+
var isAllSelected = paragraph.segments.every(function (segment) { return segment.isSelected; });
|
|
24
|
+
if ((paragraph.segments[0].segmentType === 'SelectionMarker' && isCollapsed) || isAllSelected) {
|
|
25
|
+
setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
if (!isCollapsed) {
|
|
29
|
+
var firstSelectedSegmentIndex_1 = undefined;
|
|
30
|
+
var lastSelectedSegmentIndex_1 = undefined;
|
|
31
|
+
paragraph.segments.forEach(function (segment, index) {
|
|
32
|
+
if (segment.isSelected) {
|
|
33
|
+
if (!firstSelectedSegmentIndex_1) {
|
|
34
|
+
firstSelectedSegmentIndex_1 = index;
|
|
35
|
+
}
|
|
36
|
+
lastSelectedSegmentIndex_1 = index;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
if (firstSelectedSegmentIndex_1 && lastSelectedSegmentIndex_1) {
|
|
40
|
+
var firstSelectedSegment = paragraph.segments[firstSelectedSegmentIndex_1];
|
|
41
|
+
var spaceText = createText(rawEvent.shiftKey ? tabSpaces : space, firstSelectedSegment.format);
|
|
42
|
+
var marker = createSelectionMarker(firstSelectedSegment.format);
|
|
43
|
+
paragraph.segments.splice(firstSelectedSegmentIndex_1, lastSelectedSegmentIndex_1 - firstSelectedSegmentIndex_1 + 1, spaceText, marker);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
var markerIndex = paragraph.segments.findIndex(function (segment) { return segment.segmentType === 'SelectionMarker'; });
|
|
51
|
+
if (!rawEvent.shiftKey) {
|
|
52
|
+
var markerFormat = paragraph.segments[markerIndex].format;
|
|
53
|
+
var tabText = createText(tabSpaces, markerFormat);
|
|
54
|
+
paragraph.segments.splice(markerIndex, 0, tabText);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
var tabText = paragraph.segments[markerIndex - 1];
|
|
58
|
+
var tabSpacesLength = tabSpaces.length;
|
|
59
|
+
if (tabText.segmentType == 'Text') {
|
|
60
|
+
var tabSpaceTextLength = tabText.text.length - tabSpacesLength;
|
|
61
|
+
if (tabText.text === tabSpaces) {
|
|
62
|
+
paragraph.segments.splice(markerIndex - 1, 1);
|
|
63
|
+
}
|
|
64
|
+
else if (tabText.text.substring(tabSpaceTextLength) === tabSpaces) {
|
|
65
|
+
tabText.text = tabText.text.substring(0, tabSpaceTextLength);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
rawEvent.preventDefault();
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=handleTabOnParagraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleTabOnParagraph.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnParagraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE,IAAM,SAAS,GAAG,MAAM,CAAC;AACzB,IAAM,KAAK,GAAG,GAAG,CAAC;AAElB;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAChC,KAA2B,EAC3B,SAAgC,EAChC,QAAuB;IAEvB,IAAM,gBAAgB,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC,CAAC;IAClF,IAAM,WAAW,GACb,gBAAgB,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,iBAAiB,CAAC;IAC3F,IAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC,CAAC;IAC9E,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,iBAAiB,IAAI,WAAW,CAAC,IAAI,aAAa,EAAE;QAC3F,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ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pD,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;aACtD;iBAAM;gBACH,IAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;gBACpD,IAAM,eAAe,GAAG,SAAS,CAAC,MAAM,CAAC;gBACzC,IAAI,OAAO,CAAC,WAAW,IAAI,MAAM,EAAE;oBAC/B,IAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;oBACjE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;wBAC5B,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;qBACjD;yBAAM,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE;wBACjE,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;qBAChE;yBAAM;wBACH,OAAO,KAAK,CAAC;qBAChB;iBACJ;aACJ;SACJ;KACJ;IAED,QAAQ,CAAC,cAAc,EAAE,CAAC;IAC1B,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { createSelectionMarker, createText } from 'roosterjs-content-model-dom';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type { ContentModelDocument, ContentModelParagraph } from 'roosterjs-content-model-types';\n\nconst tabSpaces = ' ';\nconst space = ' ';\n\n/**\n * @internal\n The handleTabOnParagraph function will handle the tab key in following scenarios:\n * 1. When the selection is collapsed and the cursor is at the end of a paragraph, add 4 spaces.\n * 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to indent the whole paragraph\n * 3. When the selection is collapsed and the cursor is at the middle of a paragraph, add 4 spaces.\n * 4. When the selection is not collapsed, replace the selected range with a single space.\n * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to indent the whole paragraph\n The handleTabOnParagraph function will handle the shift + tab key in a indented paragraph in following scenarios:\n * 1. When the selection is collapsed and the cursor is at the end of a paragraph, remove 4 spaces.\n * 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to outdent the whole paragraph\n * 3. When the selection is collapsed and the cursor is at the middle of a paragraph, remove 4 spaces.\n * 4. When the selection is not collapsed, replace the selected range with a 4 space.\n * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph\n */\nexport function handleTabOnParagraph(\n model: ContentModelDocument,\n paragraph: ContentModelParagraph,\n rawEvent: KeyboardEvent\n) {\n const selectedSegments = paragraph.segments.filter(segment => segment.isSelected);\n const isCollapsed =\n selectedSegments.length === 1 && selectedSegments[0].segmentType === 'SelectionMarker';\n const isAllSelected = paragraph.segments.every(segment => segment.isSelected);\n if ((paragraph.segments[0].segmentType === 'SelectionMarker' && isCollapsed) || isAllSelected) {\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n } else {\n if (!isCollapsed) {\n let firstSelectedSegmentIndex: number | undefined = undefined;\n let lastSelectedSegmentIndex: number | undefined = undefined;\n\n paragraph.segments.forEach((segment, index) => {\n if (segment.isSelected) {\n if (!firstSelectedSegmentIndex) {\n firstSelectedSegmentIndex = index;\n }\n lastSelectedSegmentIndex = index;\n }\n });\n if (firstSelectedSegmentIndex && lastSelectedSegmentIndex) {\n const firstSelectedSegment = paragraph.segments[firstSelectedSegmentIndex];\n const spaceText = createText(\n rawEvent.shiftKey ? tabSpaces : space,\n firstSelectedSegment.format\n );\n const marker = createSelectionMarker(firstSelectedSegment.format);\n paragraph.segments.splice(\n firstSelectedSegmentIndex,\n lastSelectedSegmentIndex - firstSelectedSegmentIndex + 1,\n spaceText,\n marker\n );\n } else {\n return false;\n }\n } else {\n const markerIndex = paragraph.segments.findIndex(\n segment => segment.segmentType === 'SelectionMarker'\n );\n if (!rawEvent.shiftKey) {\n const markerFormat = paragraph.segments[markerIndex].format;\n const tabText = createText(tabSpaces, markerFormat);\n paragraph.segments.splice(markerIndex, 0, tabText);\n } else {\n const tabText = paragraph.segments[markerIndex - 1];\n const tabSpacesLength = tabSpaces.length;\n if (tabText.segmentType == 'Text') {\n const tabSpaceTextLength = tabText.text.length - tabSpacesLength;\n if (tabText.text === tabSpaces) {\n paragraph.segments.splice(markerIndex - 1, 1);\n } else if (tabText.text.substring(tabSpaceTextLength) === tabSpaces) {\n tabText.text = tabText.text.substring(0, tabSpaceTextLength);\n } else {\n return false;\n }\n }\n }\n }\n }\n\n rawEvent.preventDefault();\n return true;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLeafSiblingBlock.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"getLeafSiblingBlock.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/utils/getLeafSiblingBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AA6B/D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAC/B,IAA8B,EAC9B,KAAwB,EACxB,MAAe;;IAEf,IAAM,OAAO,4BAAO,IAAI,SAAC,CAAC;;QAGtB,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE1C,IAAI,KAAK,GAAG,CAAC,EAAE;;SAEd;QAED,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,IAAI,SAAS,EAAE;YACX,OAAO,SAAS,CAAC,SAAS,IAAI,YAAY,EAAE;gBACxC,IAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CA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AI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,gBAAA,EAAE;iBACxD;qBAAM;oBACH,gDAAgD;oBAChD,KAAK,GAAG,IAAI,CAAC;iBAChB;aACJ;iBAAM;;aAGN;SACJ;aAAM,IAAI,KAAK,CAAC,cAAc,IAAI,UAAU,IAAI,KAAK,CAAC,cAAc,IAAI,WAAW,EAAE;YAClF,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,KAAK,GAAG,KAAK,CAAC;SACjB;aAAM;;SAEN;;IAzDL,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;;;;;;KA0DxB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { isGeneralSegment } from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelParagraph,\n ContentModelSegment,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport type BlockAndPath = {\n /**\n * The sibling block\n */\n block: ContentModelBlock;\n\n /**\n * Path of this sibling block\n */\n path: ContentModelBlockGroup[];\n\n /**\n * If the input block is under a general segment, it is possible there are sibling segments under the same paragraph.\n * Use this property to return the sibling sibling under the same paragraph\n */\n siblingSegment?: ContentModelSegment;\n};\n\n/**\n * @internal\n */\nexport function getLeafSiblingBlock(\n path: ContentModelBlockGroup[],\n block: ContentModelBlock,\n isNext: boolean\n): BlockAndPath | null {\n const newPath = [...path];\n\n while (newPath.length > 0) {\n const group = newPath[0];\n const index = group.blocks.indexOf(block);\n\n if (index < 0) {\n break;\n }\n\n let nextBlock = group.blocks[index + (isNext ? 1 : -1)];\n\n if (nextBlock) {\n while (nextBlock.blockType == 'BlockGroup') {\n const child = nextBlock.blocks[isNext ? 0 : nextBlock.blocks.length - 1];\n\n if (!child) {\n return { block: nextBlock, path: newPath };\n } else if (child.blockType != 'BlockGroup') {\n newPath.unshift(nextBlock);\n return { block: child, path: newPath };\n } else {\n newPath.unshift(nextBlock);\n nextBlock = child;\n }\n }\n\n return { block: nextBlock, path: newPath };\n } else if (isGeneralSegment(group)) {\n // For general segment, we need to check if there is sibling segment under the same paragraph\n // First let's find the parent paragraph of this segment\n newPath.shift();\n\n let segmentIndex = -1;\n const segment = group;\n const para = newPath[0]?.blocks.find(\n x => x.blockType == 'Paragraph' && (segmentIndex = x.segments.indexOf(segment)) >= 0\n ) as ContentModelParagraph;\n\n if (para) {\n // Now we have found the parent paragraph, so let's check if it has a sibling segment\n const siblingSegment = para.segments[segmentIndex + (isNext ? 1 : -1)];\n\n if (siblingSegment) {\n // Return this block, path and segment since we have found it\n return { block: para, path: newPath, siblingSegment };\n } else {\n // No sibling segment, let's keep go upper level\n block = para;\n }\n } else {\n // Parent sibling is not found (in theory this should never happen), just return null\n break;\n }\n } else if (group.blockGroupType != 'Document' && group.blockGroupType != 'TableCell') {\n newPath.shift();\n block = group;\n } else {\n break;\n }\n }\n\n return null;\n}\n"]}
|
package/lib-mjs/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export { TableEditPlugin } from './tableEdit/TableEditPlugin';
|
|
1
2
|
export { PastePlugin } from './paste/PastePlugin';
|
|
2
3
|
export { EditPlugin } from './edit/EditPlugin';
|
|
3
4
|
export { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';
|
|
5
|
+
export { ShortcutBold, ShortcutItalic, ShortcutUnderline, ShortcutClearFormat, ShortcutUndo, ShortcutUndo2, ShortcutRedo, ShortcutRedoMacOS, ShortcutBullet, ShortcutNumbering, ShortcutIncreaseFont, ShortcutDecreaseFont, ShortcutIndentList, ShortcutOutdentList, } from './shortcut/shortcuts';
|
|
6
|
+
export { ShortcutPlugin } from './shortcut/ShortcutPlugin';
|
|
7
|
+
export { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';
|
|
8
|
+
export { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';
|
package/lib-mjs/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export { TableEditPlugin } from './tableEdit/TableEditPlugin';
|
|
1
2
|
export { PastePlugin } from './paste/PastePlugin';
|
|
2
3
|
export { EditPlugin } from './edit/EditPlugin';
|
|
3
4
|
export { AutoFormatPlugin } from './autoFormat/AutoFormatPlugin';
|
|
5
|
+
export { ShortcutBold, ShortcutItalic, ShortcutUnderline, ShortcutClearFormat, ShortcutUndo, ShortcutUndo2, ShortcutRedo, ShortcutRedoMacOS, ShortcutBullet, ShortcutNumbering, ShortcutIncreaseFont, ShortcutDecreaseFont, ShortcutIndentList, ShortcutOutdentList, } from './shortcut/shortcuts';
|
|
6
|
+
export { ShortcutPlugin } from './shortcut/ShortcutPlugin';
|
|
7
|
+
export { ContextMenuPluginBase } from './contextMenuBase/ContextMenuPluginBase';
|
|
4
8
|
//# sourceMappingURL=index.js.map
|
package/lib-mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAqB,MAAM,+BAA+B,CAAC;AAEpF,OAAO,EACH,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAsB,MAAM,yCAAyC,CAAC","sourcesContent":["export { TableEditPlugin } from './tableEdit/TableEditPlugin';\nexport { PastePlugin } from './paste/PastePlugin';\nexport { EditPlugin } from './edit/EditPlugin';\nexport { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';\n\nexport {\n ShortcutBold,\n ShortcutItalic,\n ShortcutUnderline,\n ShortcutClearFormat,\n ShortcutUndo,\n ShortcutUndo2,\n ShortcutRedo,\n ShortcutRedoMacOS,\n ShortcutBullet,\n ShortcutNumbering,\n ShortcutIncreaseFont,\n ShortcutDecreaseFont,\n ShortcutIndentList,\n ShortcutOutdentList,\n} from './shortcut/shortcuts';\nexport { ShortcutPlugin } from './shortcut/ShortcutPlugin';\nexport { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';\nexport { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import addParser from '../utils/addParser';
|
|
2
|
+
import { addParser } from '../utils/addParser';
|
|
3
3
|
import { isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom';
|
|
4
4
|
import { setProcessor } from '../utils/setProcessor';
|
|
5
5
|
var LAST_TD_END_REGEX = /<\/\s*td\s*>((?!<\/\s*tr\s*>)[\s\S])*$/i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPastedContentFromExcel.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"processPastedContentFromExcel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC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,CAAC,SAAS,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AAEH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,UAAkB;IACzD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;QAC/B,IAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAChD,IAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACzC,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC;KAC9B;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;QAC/B,IAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACtD,IAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACrD,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;KACpC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { addParser } from '../utils/addParser';\nimport { isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom';\nimport { setProcessor } from '../utils/setProcessor';\nimport type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-content-model-types';\n\nconst LAST_TD_END_REGEX = /<\\/\\s*td\\s*>((?!<\\/\\s*tr\\s*>)[\\s\\S])*$/i;\nconst LAST_TR_END_REGEX = /<\\/\\s*tr\\s*>((?!<\\/\\s*table\\s*>)[\\s\\S])*$/i;\nconst LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;\nconst LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;\nconst DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';\n\n/**\n * @internal\n * Convert pasted content from Excel, add borders when source doc doesn't have a border\n * @param event The BeforePaste event\n */\n\nexport function processPastedContentFromExcel(\n event: BeforePasteEvent,\n trustedHTMLHandler: TrustedHTMLHandler,\n allowExcelNoBorderTable?: boolean\n) {\n const { fragment, htmlBefore, clipboardData } = event;\n const html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;\n\n if (html && clipboardData.html != html) {\n const doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');\n moveChildNodes(fragment, doc?.body);\n }\n\n // For Excel Online\n const firstChild = fragment.firstChild;\n if (\n isNodeOfType(firstChild, 'ELEMENT_NODE') &&\n firstChild.tagName == 'div' &&\n firstChild.firstChild\n ) {\n const tableFound = Array.from(firstChild.childNodes).every((child: Node) => {\n // Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag\n const tagName = isNodeOfType(child, 'ELEMENT_NODE') && child.tagName;\n\n return tagName == 'META'\n ? true\n : tagName == 'TABLE'\n ? child == firstChild.lastChild\n : false;\n });\n\n // Extract Table from Div\n if (tableFound && firstChild.lastChild) {\n event.fragment.replaceChildren(firstChild.lastChild);\n }\n }\n\n addParser(event.domToModelOption, 'tableCell', (format, element) => {\n if (!allowExcelNoBorderTable && element.style.borderStyle === 'none') {\n format.borderBottom = DEFAULT_BORDER_STYLE;\n format.borderLeft = DEFAULT_BORDER_STYLE;\n format.borderRight = DEFAULT_BORDER_STYLE;\n format.borderTop = DEFAULT_BORDER_STYLE;\n }\n });\n\n setProcessor(event.domToModelOption, 'child', (group, element, context) => {\n const segmentFormat = { ...context.segmentFormat };\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\n context.segmentFormat.textColor = group.format.textColor;\n }\n\n context.defaultElementProcessors.child(group, element, context);\n\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\n context.segmentFormat = segmentFormat;\n delete group.format.textColor;\n }\n });\n}\n\n/**\n * @internal Export for test only\n * @param html Source html\n */\n\nexport function excelHandler(html: string, htmlBefore: string): string {\n if (html.match(LAST_TD_END_REGEX)) {\n const trMatch = htmlBefore.match(LAST_TR_REGEX);\n const tr = trMatch ? trMatch[0] : '<TR>';\n html = tr + html + '</TR>';\n }\n if (html.match(LAST_TR_END_REGEX)) {\n const tableMatch = htmlBefore.match(LAST_TABLE_REGEX);\n const table = tableMatch ? tableMatch[0] : '<TABLE>';\n html = table + html + '</TABLE>';\n }\n\n return html;\n}\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { EditorPlugin,
|
|
1
|
+
import type { EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Paste plugin, handles BeforePaste event and reformat some special content, including:
|
|
4
4
|
* 1. Content copied from Word
|
|
5
5
|
* 2. Content copied from Excel
|
|
6
6
|
* 3. Content copied from Word Online or OneNote Online
|
|
7
7
|
* 4. Content copied from Power Point
|
|
8
|
-
* (This class is still under development, and may still be changed in the future with some breaking changes)
|
|
9
8
|
*/
|
|
10
9
|
export declare class PastePlugin implements EditorPlugin {
|
|
11
10
|
private allowExcelNoBorderTable?;
|
|
@@ -26,7 +25,7 @@ export declare class PastePlugin implements EditorPlugin {
|
|
|
26
25
|
* editor reference so that it can call to any editor method or format API later.
|
|
27
26
|
* @param editor The editor object
|
|
28
27
|
*/
|
|
29
|
-
initialize(editor:
|
|
28
|
+
initialize(editor: IEditor): void;
|
|
30
29
|
/**
|
|
31
30
|
* The last method that editor will call to a plugin before it is disposed.
|
|
32
31
|
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import addParser from './utils/addParser';
|
|
1
|
+
import { addParser } from './utils/addParser';
|
|
2
2
|
import { BorderKeys } from 'roosterjs-content-model-dom';
|
|
3
3
|
import { deprecatedBorderColorParser } from './utils/deprecatedColorParser';
|
|
4
4
|
import { getPasteSource } from './pasteSourceValidations/getPasteSource';
|
|
@@ -14,7 +14,6 @@ import { processPastedContentWacComponents } from './WacComponents/processPasted
|
|
|
14
14
|
* 2. Content copied from Excel
|
|
15
15
|
* 3. Content copied from Word Online or OneNote Online
|
|
16
16
|
* 4. Content copied from Power Point
|
|
17
|
-
* (This class is still under development, and may still be changed in the future with some breaking changes)
|
|
18
17
|
*/
|
|
19
18
|
var PastePlugin = /** @class */ (function () {
|
|
20
19
|
/**
|