roosterjs-content-model-plugins 0.27.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/autoFormat/AutoFormatPlugin.d.ts +9 -0
- 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/{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.js.map +1 -1
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -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.js.map +1 -1
- package/lib/edit/inputSteps/handleEnterOnList.js +1 -1
- package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib/edit/keyboardDelete.js +9 -1
- package/lib/edit/keyboardDelete.js.map +1 -1
- package/lib/edit/keyboardInput.js +2 -1
- package/lib/edit/keyboardInput.js.map +1 -1
- package/lib/edit/keyboardTab.js.map +1 -1
- package/lib/edit/tabUtils/handleTabOnList.js.map +1 -1
- package/lib/edit/tabUtils/handleTabOnParagraph.js +7 -0
- package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
- package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +5 -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.js +6 -6
- 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.js.map +1 -1
- package/lib/shortcut/ShortcutPlugin.js +2 -0
- package/lib/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib/shortcut/shortcuts.d.ts +12 -0
- package/lib/shortcut/shortcuts.js +34 -1
- package/lib/shortcut/shortcuts.js.map +1 -1
- 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.js +5 -5
- package/lib/tableEdit/TableEditPlugin.js.map +1 -1
- package/lib/tableEdit/editors/TableEditor.d.ts +1 -1
- package/lib/tableEdit/editors/TableEditor.js +17 -17
- package/lib/tableEdit/editors/TableEditor.js.map +1 -1
- package/lib/tableEdit/editors/features/CellResizer.d.ts +2 -2
- package/lib/tableEdit/editors/features/CellResizer.js +7 -7
- package/lib/tableEdit/editors/features/CellResizer.js.map +1 -1
- package/{lib-mjs/tableEdit/editors/features/TableEditorFeature.d.ts → lib/tableEdit/editors/features/TableEditFeature.d.ts} +2 -2
- package/lib/tableEdit/editors/features/{TableEditorFeature.js → TableEditFeature.js} +1 -1
- package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib/tableEdit/editors/features/TableInserter.d.ts +2 -2
- package/lib/tableEdit/editors/features/TableInserter.js +5 -5
- package/lib/tableEdit/editors/features/TableInserter.js.map +1 -1
- package/lib/tableEdit/editors/features/TableMover.d.ts +2 -2
- package/lib/tableEdit/editors/features/TableMover.js +6 -6
- package/lib/tableEdit/editors/features/TableMover.js.map +1 -1
- package/lib/tableEdit/editors/features/TableResizer.d.ts +2 -2
- package/lib/tableEdit/editors/features/TableResizer.js +11 -8
- package/lib/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +9 -0
- 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.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.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -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.js.map +1 -1
- package/lib-amd/edit/inputSteps/handleEnterOnList.js +1 -1
- package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-amd/edit/keyboardDelete.js +9 -2
- package/lib-amd/edit/keyboardDelete.js.map +1 -1
- package/lib-amd/edit/keyboardInput.js +2 -2
- package/lib-amd/edit/keyboardInput.js.map +1 -1
- package/lib-amd/edit/keyboardTab.js.map +1 -1
- package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -1
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +7 -0
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
- package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-amd/index.d.ts +2 -1
- package/lib-amd/index.js +5 -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.js +6 -6
- 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.js.map +1 -1
- package/lib-amd/shortcut/ShortcutPlugin.js +2 -0
- package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib-amd/shortcut/shortcuts.d.ts +12 -0
- package/lib-amd/shortcut/shortcuts.js +34 -2
- package/lib-amd/shortcut/shortcuts.js.map +1 -1
- 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.js +5 -4
- package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -1
- package/lib-amd/tableEdit/editors/TableEditor.d.ts +1 -1
- package/lib-amd/tableEdit/editors/TableEditor.js +17 -16
- package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/CellResizer.d.ts +2 -2
- package/lib-amd/tableEdit/editors/features/CellResizer.js +8 -7
- package/lib-amd/tableEdit/editors/features/CellResizer.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/{TableEditorFeature.d.ts → TableEditFeature.d.ts} +2 -2
- package/lib-amd/tableEdit/editors/features/{TableEditorFeature.js → TableEditFeature.js} +1 -1
- package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +2 -2
- package/lib-amd/tableEdit/editors/features/TableInserter.js +6 -5
- package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/TableMover.d.ts +2 -2
- package/lib-amd/tableEdit/editors/features/TableMover.js +7 -6
- package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +2 -2
- package/lib-amd/tableEdit/editors/features/TableResizer.js +12 -8
- package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +9 -0
- 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/{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.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -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.js.map +1 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js +1 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-mjs/edit/keyboardDelete.js +9 -1
- package/lib-mjs/edit/keyboardDelete.js.map +1 -1
- package/lib-mjs/edit/keyboardInput.js +2 -1
- package/lib-mjs/edit/keyboardInput.js.map +1 -1
- package/lib-mjs/edit/keyboardTab.js.map +1 -1
- package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -1
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +7 -0
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
- package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-mjs/index.d.ts +2 -1
- package/lib-mjs/index.js +2 -1
- 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.js +1 -1
- 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.js.map +1 -1
- package/lib-mjs/shortcut/ShortcutPlugin.js +3 -1
- package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib-mjs/shortcut/shortcuts.d.ts +12 -0
- package/lib-mjs/shortcut/shortcuts.js +33 -0
- package/lib-mjs/shortcut/shortcuts.js.map +1 -1
- 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.js +4 -4
- package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -1
- package/lib-mjs/tableEdit/editors/TableEditor.d.ts +1 -1
- package/lib-mjs/tableEdit/editors/TableEditor.js +7 -8
- package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/CellResizer.d.ts +2 -2
- package/lib-mjs/tableEdit/editors/features/CellResizer.js +4 -5
- package/lib-mjs/tableEdit/editors/features/CellResizer.js.map +1 -1
- package/{lib/tableEdit/editors/features/TableEditorFeature.d.ts → lib-mjs/tableEdit/editors/features/TableEditFeature.d.ts} +2 -2
- package/lib-mjs/tableEdit/editors/features/{TableEditorFeature.js → TableEditFeature.js} +1 -1
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -0
- package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +2 -2
- package/lib-mjs/tableEdit/editors/features/TableInserter.js +4 -5
- package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +2 -2
- package/lib-mjs/tableEdit/editors/features/TableMover.js +4 -5
- package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +2 -2
- package/lib-mjs/tableEdit/editors/features/TableResizer.js +7 -5
- package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/package.json +5 -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/tableEdit/editors/features/TableEditorFeature.js.map +0 -1
- 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-amd/tableEdit/editors/features/TableEditorFeature.js.map +0 -1
- 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-mjs/tableEdit/editors/features/TableEditorFeature.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/autoFormat/{keyboardListTrigger.d.ts → list/keyboardListTrigger.d.ts} +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-amd/autoFormat/{keyboardListTrigger.d.ts → list/keyboardListTrigger.d.ts} +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
- /package/lib-mjs/autoFormat/{keyboardListTrigger.d.ts → list/keyboardListTrigger.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateElementData.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"CreateElementData.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/CreateElement/CreateElementData.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n * An interface represents the data for creating element used by createElement()\n */\nexport interface CreateElementData {\n /**\n * Tag name of this element.\n * It can be just a tag, or in format \"namespace:tag\"\n */\n tag: string;\n\n /**\n * Namespace of this tag\n */\n namespace?: string;\n\n /**\n * CSS class name\n */\n className?: string;\n\n /**\n * CSS style\n */\n style?: string;\n\n /**\n * Dataset of this element\n */\n dataset?: Record<string, string>;\n\n /**\n * Additional attributes of this element\n */\n attributes?: Record<string, string>;\n\n /**\n * Child nodes of this element, can be another CreateElementData, or a string which represents a text node\n */\n children?: (CreateElementData | string)[];\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type CreateElementData from './CreateElementData';
|
|
1
|
+
import type { CreateElementData } from './CreateElementData';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
* Create DOM element from the given CreateElementData
|
|
@@ -6,4 +6,4 @@ import type CreateElementData from './CreateElementData';
|
|
|
6
6
|
* @param document The document to create the element from
|
|
7
7
|
* @returns The root DOM element just created
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function createElement(elementData: CreateElementData, document: Document): Element | null;
|
|
@@ -6,7 +6,7 @@ import { getObjectKeys, isNodeOfType } from 'roosterjs-content-model-dom';
|
|
|
6
6
|
* @param document The document to create the element from
|
|
7
7
|
* @returns The root DOM element just created
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export function createElement(elementData, document) {
|
|
10
10
|
if (!elementData || !elementData.tag) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createElement.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"createElement.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/CreateElement/createElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG1E;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,WAA8B,EAAE,QAAkB;IAC5E,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,G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I,KAAK,EAAE;gBACd,IAAM,YAAY,GAAG,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBACpD,IAAI,YAAY,EAAE;oBACd,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;iBACpC;aACJ;QACL,CAAC,CAAC,CAAC;KACN;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { getObjectKeys, isNodeOfType } from 'roosterjs-content-model-dom';\nimport type { CreateElementData } from './CreateElementData';\n\n/**\n * @internal\n * Create DOM element from the given CreateElementData\n * @param elementData The CreateElementData or an index of a known CreateElementData used for creating this element\n * @param document The document to create the element from\n * @returns The root DOM element just created\n */\nexport function createElement(elementData: CreateElementData, document: Document): Element | null {\n if (!elementData || !elementData.tag) {\n return null;\n }\n\n const { tag, namespace, className, style, dataset, attributes, children } = elementData;\n const result = namespace\n ? document.createElementNS(namespace, tag)\n : document.createElement(tag);\n\n if (style) {\n result.setAttribute('style', style);\n }\n\n if (className) {\n result.className = className;\n }\n\n if (dataset && isNodeOfType(result, 'ELEMENT_NODE')) {\n getObjectKeys(dataset).forEach(datasetName => {\n result.dataset[datasetName] = dataset[datasetName];\n });\n }\n\n if (attributes) {\n getObjectKeys(attributes).forEach(attrName => {\n result.setAttribute(attrName, attributes[attrName]);\n });\n }\n\n if (children) {\n children.forEach(child => {\n if (typeof child === 'string') {\n result.appendChild(document.createTextNode(child));\n } else if (child) {\n const childElement = createElement(child, document);\n if (childElement) {\n result.appendChild(childElement);\n }\n }\n });\n }\n\n return result;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Disposable.js","sourceRoot":"","sources":["../../../../packages
|
|
1
|
+
{"version":3,"file":"Disposable.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/Disposable.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n * Represents a disposable object\n */\nexport interface Disposable {\n /**\n * Dispose this object\n */\n dispose: () => void;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @internal
|
|
3
3
|
* Drag and drop handler interface, used for implementing a handler object and pass into DragAndDropHelper class
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export interface DragAndDropHandler<TContext, TInitValue> {
|
|
6
6
|
/**
|
|
7
7
|
* A callback that will be called when user starts to drag (mouse down event from the trigger element)
|
|
8
8
|
* @param context The context object that was passed into DragAndDropHelper from its constructor. We can use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragAndDropHandler.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"DragAndDropHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/DragAndDrop/DragAndDropHandler.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n * Drag and drop handler interface, used for implementing a handler object and pass into DragAndDropHelper class\n */\nexport interface DragAndDropHandler<TContext, TInitValue> {\n /**\n * A callback that will be called when user starts to drag (mouse down event from the trigger element)\n * @param context The context object that was passed into DragAndDropHelper from its constructor. We can use\n * this object to communicate between caller code and this handler\n * @param event The mouse event that triggers this callback\n * @returns An optional object, which will be passed into onDragging and onDragEnd callback. It normally used\n * for passing an initial state of the target object\n */\n onDragStart?: (context: TContext, event: MouseEvent) => TInitValue;\n\n /**\n * A callback that will be called when user moves mouse and drag the trigger element.\n * @param context The context object that was passed into DragAndDropHelper from its constructor. We can use\n * this object to communicate between caller code and this handler.If an object is used as context, here it will\n * be the same object that passed into constructor of DragAndDropHelper class. Inside this callback you can change\n * its sub value so that caller can get the changed result.\n * @param event The mouse event that triggers this callback\n * @param initValue The initial value that is returned from onDragStart callback. It normally used\n * for passing an initial state of the target object\n * @param deltaX x delta value. It equals to current event.pageX - initial pageX (captured when mousedown happens)\n * @param deltaY y delta value. It equals to current event.pageY - initial pageY (captured when mousedown happens)\n * @returns Whether the onSubmit callback passed into constructor of DragAndDropHelper class should be invoked.\n * Returns true will invoke the onSubmit callback, it means this is a meaningful dragging action, something (mostly\n * under context object) has been changed, and caller should handle this change. Otherwise, return false.\n */\n onDragging?: (\n context: TContext,\n event: MouseEvent,\n initValue: TInitValue,\n deltaX: number,\n deltaY: number\n ) => boolean;\n\n /**\n * A callback that will be called when user stops dragging the trigger element.\n * @param context The context object that was passed into DragAndDropHelper from its constructor. We can use\n * this object to communicate between caller code and this handler.If an object is used as context, here it will\n * be the same object that passed into constructor of DragAndDropHelper class. Inside this callback you can change\n * its sub value so that caller can get the changed result.\n * @param event The mouse event that triggers this callback\n * @param initValue The initial value that is returned from onDragStart callback. It normally used\n * for passing an initial state of the target object\n * @returns Whether the onSubmit callback passed into constructor of DragAndDropHelper class should be invoked.\n * Returns true will invoke the onSubmit callback, it means this is a meaningful dragging action, something (mostly\n * under context object) has been changed, and caller should handle this change. Otherwise, return false.\n */\n onDragEnd?: (\n context: TContext,\n event: MouseEvent,\n initValue: TInitValue | undefined\n ) => boolean;\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type Disposable from '../Disposable';
|
|
2
|
-
import type DragAndDropHandler from './DragAndDropHandler';
|
|
1
|
+
import type { Disposable } from '../Disposable';
|
|
2
|
+
import type { DragAndDropHandler } from './DragAndDropHandler';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
* A helper class to help manage drag and drop to an HTML element
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare class DragAndDropHelper<TContext, TInitValue> implements Disposable {
|
|
8
8
|
private trigger;
|
|
9
9
|
private context;
|
|
10
10
|
private onSubmit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragAndDropHelper.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"DragAndDropHelper.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/DragAndDrop/DragAndDropHelper.ts"],"names":[],"mappings":";AA2BA;;G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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';\nimport type { DragAndDropHandler } from './DragAndDropHandler';\n\n/**\n * @internal\n */\ninterface MouseEventMoves {\n MOUSEDOWN: string;\n MOUSEMOVE: string;\n MOUSEUP: string;\n}\n\n/**\n * @internal\n */\ninterface MouseEventInfo extends MouseEventMoves {\n getPageXY: (e: MouseEvent) => number[];\n}\n\n/**\n * @internal\n * Compatible mouse event names for different platform\n */\ninterface TouchEventInfo extends MouseEventMoves {\n getPageXY: (e: TouchEvent) => number[];\n}\n\n/**\n * Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers\n */\nconst MOUSE_EVENT_INFO_DESKTOP: MouseEventInfo = (() => {\n return {\n MOUSEDOWN: 'mousedown',\n MOUSEMOVE: 'mousemove',\n MOUSEUP: 'mouseup',\n getPageXY: getMouseEventPageXY,\n };\n})();\n\nconst MOUSE_EVENT_INFO_MOBILE: TouchEventInfo = (() => {\n return {\n MOUSEDOWN: 'touchstart',\n MOUSEMOVE: 'touchmove',\n MOUSEUP: 'touchend',\n getPageXY: getTouchEventPageXY,\n };\n})();\n\nfunction getMouseEventPageXY(e: MouseEvent): [number, number] {\n return [e.pageX, e.pageY];\n}\n\nfunction getTouchEventPageXY(e: TouchEvent): [number, number] {\n let pageX = 0;\n let pageY = 0;\n if (e.targetTouches && e.targetTouches.length > 0) {\n const touch = e.targetTouches[0];\n pageX = touch.pageX;\n pageY = touch.pageY;\n }\n return [pageX, pageY];\n}\n\n/**\n * @internal\n * A helper class to help manage drag and drop to an HTML element\n */\nexport class DragAndDropHelper<TContext, TInitValue> implements Disposable {\n private initX: number = 0;\n private initY: number = 0;\n private initValue: TInitValue | undefined = undefined;\n private dndMouse: MouseEventInfo | TouchEventInfo;\n\n /**\n * Create a new instance of DragAndDropHelper class\n * @param trigger The trigger element. When user start drag on this element,\n * events will be fired to the handler object\n * @param context Context object that will be passed to handler function when event is fired,\n * so that the handler object knows which element it is triggered from.\n * @param onSubmit A callback that will be invoked when event handler in handler object returns true\n * @param handler The event handler object, see DragAndDropHandler interface for more information\n * @param zoomScale The zoom scale of the editor\n * @param forceMobile A boolean to force the use of touch controls for the helper\n */\n constructor(\n private trigger: HTMLElement,\n private context: TContext,\n private onSubmit: (context: TContext, trigger: HTMLElement) => void,\n private handler: DragAndDropHandler<TContext, TInitValue>,\n private zoomScale: number,\n forceMobile?: boolean\n ) {\n this.dndMouse = forceMobile ? MOUSE_EVENT_INFO_MOBILE : MOUSE_EVENT_INFO_DESKTOP;\n trigger.addEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\n }\n\n /**\n * Dispose this object, remove all event listeners that has been attached\n */\n dispose() {\n this.trigger.removeEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\n this.removeDocumentEvents();\n }\n\n public get mouseType(): string {\n return this.dndMouse == MOUSE_EVENT_INFO_MOBILE ? 'touch' : 'mouse';\n }\n\n private addDocumentEvents() {\n const doc = this.trigger.ownerDocument;\n doc.addEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\n doc.addEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\n }\n\n private removeDocumentEvents() {\n const doc = this.trigger.ownerDocument;\n doc.removeEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\n doc.removeEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\n }\n\n private onMouseDown = (e: Event) => {\n e.preventDefault();\n e.stopPropagation();\n this.addDocumentEvents();\n [this.initX, this.initY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\n this.initValue = this.handler.onDragStart?.(this.context, e as MouseEvent);\n };\n\n private onMouseMove = (e: Event) => {\n e.preventDefault();\n const [pageX, pageY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\n const deltaX = (pageX - this.initX) / this.zoomScale;\n const deltaY = (pageY - this.initY) / this.zoomScale;\n if (\n this.initValue &&\n this.handler.onDragging?.(this.context, e as MouseEvent, this.initValue, deltaX, deltaY)\n ) {\n this.onSubmit?.(this.context, this.trigger);\n }\n };\n\n private onMouseUp = (e: Event) => {\n e.preventDefault();\n this.removeDocumentEvents();\n if (this.handler.onDragEnd?.(this.context, e as MouseEvent, this.initValue)) {\n this.onSubmit?.(this.context, this.trigger);\n }\n };\n}\n"]}
|
|
@@ -24,4 +24,4 @@ import type { Rect } from 'roosterjs-content-model-types';
|
|
|
24
24
|
* @param additionalRects additional rects to use
|
|
25
25
|
* @returns If the Rect is valid return the rect, if not, return null.
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export declare function getIntersectedRect(elements: HTMLElement[], additionalRects?: Rect[]): Rect | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __read, __spreadArray } from "tslib";
|
|
2
|
-
import normalizeRect from '
|
|
2
|
+
import { normalizeRect } from 'roosterjs-content-model-dom';
|
|
3
3
|
/**
|
|
4
4
|
* Get the intersected Rect of elements provided
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ import normalizeRect from './normalizeRect';
|
|
|
25
25
|
* @param additionalRects additional rects to use
|
|
26
26
|
* @returns If the Rect is valid return the rect, if not, return null.
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export function getIntersectedRect(elements, additionalRects) {
|
|
29
29
|
if (additionalRects === void 0) { additionalRects = []; }
|
|
30
30
|
var rects = elements
|
|
31
31
|
.map(function (element) { return normalizeRect(element.getBoundingClientRect()); })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/Rect/getIntersectedRect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,kBAAkB,CAC9B,QAAuB,EACvB,eAA4B;IAA5B,gCAAA,EAAA,oBAA4B;IAE5B,IAAM,KAAK,GAAG,QAAQ;SACjB,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,aAAa,CAAC,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,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,UAAC;QACvC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC,UAAC;QAC7C,IAAI,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,UAAC;QACzC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,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","sourcesContent":["import { normalizeRect } from 'roosterjs-content-model-dom';\nimport type { Rect } from 'roosterjs-content-model-types';\n\n/**\n * Get the intersected Rect of elements provided\n *\n * @example\n * The result of the following Elements Rects would be:\n {\n top: Element2.top,\n bottom: Element1.bottom,\n left: Element2.left,\n right: Element2.right\n }\n +-------------------------+\n | Element 1 |\n | +-----------------+ |\n | | Element2 | |\n | | | |\n | | | |\n +-------------------------+\n | |\n +-----------------+\n * @internal\n * @param elements Elements to use.\n * @param additionalRects additional rects to use\n * @returns If the Rect is valid return the rect, if not, return null.\n */\nexport function getIntersectedRect(\n elements: HTMLElement[],\n additionalRects: Rect[] = []\n): Rect | null {\n const rects = elements\n .map(element => normalizeRect(element.getBoundingClientRect()))\n .concat(additionalRects)\n .filter(element => !!element) as Rect[];\n\n const result: Rect = {\n top: Math.max(...rects.map(r => r.top)),\n bottom: Math.min(...rects.map(r => r.bottom)),\n left: Math.max(...rects.map(r => r.left)),\n right: Math.min(...rects.map(r => r.right)),\n };\n\n return result.top < result.bottom && result.left < result.right ? result : null;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShortcutCommand.js","sourceRoot":"","sources":["../../../../packages
|
|
1
|
+
{"version":3,"file":"ShortcutCommand.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/shortcut/ShortcutCommand.ts"],"names":[],"mappings":"","sourcesContent":["import type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Definition of the shortcut key\n */\nexport interface ShortcutKeyDefinition {\n /**\n * Modifier key for this shortcut, allowed values are:\n * ctrl: Ctrl key (or Meta key on MacOS)\n * alt: Alt key\n */\n modifierKey: 'ctrl' | 'alt';\n\n /**\n * Whether ALT key is required for this shortcut\n */\n shiftKey: boolean;\n\n /**\n * Key code for this shortcut. The value should be the value of KeyboardEvent.which\n * We are still using key code here rather than key name (event.key) although event.which is deprecated because of globalization.\n * For example, on US keyboard, Shift+Comma=\"<\" but on Spanish keyboard it is \":\"\n * And we still want the shortcut key to be registered on the same key, in that case key name is different but key code keeps the same.\n */\n which: number;\n}\n\n/**\n * Represents a command for shortcut\n */\nexport interface ShortcutCommand {\n /**\n * Definition of the shortcut key\n */\n shortcutKey: ShortcutKeyDefinition;\n\n /**\n * @optional Required environment for this command\n * all: (Default) This feature is available for all environments\n * mac: This feature is available on MacOS only\n * nonMac: This feature is available on OS other than MacOS\n */\n environment?: 'all' | 'mac' | 'nonMac';\n\n /**\n * The callback function to invoke when this shortcut is triggered\n * @param editor The editor object\n */\n onClick: (editor: IEditor) => void;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cacheGetEventData } from 'roosterjs-content-model-core';
|
|
2
|
-
import { ShortcutBold, ShortcutBullet, ShortcutClearFormat, ShortcutDecreaseFont, ShortcutIncreaseFont, ShortcutItalic, ShortcutNumbering, ShortcutRedo, ShortcutRedoMacOS, ShortcutUnderline, ShortcutUndo, ShortcutUndo2, } from './shortcuts';
|
|
2
|
+
import { ShortcutBold, ShortcutBullet, ShortcutClearFormat, ShortcutDecreaseFont, ShortcutIncreaseFont, ShortcutIndentList, ShortcutItalic, ShortcutNumbering, ShortcutOutdentList, ShortcutRedo, ShortcutRedoMacOS, ShortcutUnderline, ShortcutUndo, ShortcutUndo2, } from './shortcuts';
|
|
3
3
|
var defaultShortcuts = [
|
|
4
4
|
ShortcutBold,
|
|
5
5
|
ShortcutItalic,
|
|
@@ -13,6 +13,8 @@ var defaultShortcuts = [
|
|
|
13
13
|
ShortcutNumbering,
|
|
14
14
|
ShortcutIncreaseFont,
|
|
15
15
|
ShortcutDecreaseFont,
|
|
16
|
+
ShortcutIndentList,
|
|
17
|
+
ShortcutOutdentList,
|
|
16
18
|
];
|
|
17
19
|
var CommandCacheKey = '__ShortcutCommandCache';
|
|
18
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShortcutPlugin.js","sourceRoot":"","sources":["../../../../packages
|
|
1
|
+
{"version":3,"file":"ShortcutPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/shortcut/ShortcutPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EACH,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GAChB,MAAM,aAAa,CAAC;AAQrB,IAAM,gBAAgB,GAAsB;IACxC,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,mBAAmB;IACnB,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,iBAAiB;IACjB,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,kBAAkB;IAClB,mBAAmB;CACtB,CAAC;AACF,IAAM,eAAe,GAAG,wBAAwB,CAAC;AAEjD;;GAEG;AACH;IAII;;;OAGG;IACH,wBAAoB,SAA+C;QAA/C,0BAAA,EAAA,4BAA+C;QAA/C,cAAS,GAAT,SAAS,CAAsC;QAP3D,WAAM,GAAmB,IAAI,CAAC;QAC9B,UAAK,GAAG,KAAK,CAAC;IAMgD,CAAC;IAEvE;;OAEG;IACH,gCAAO,GAAP;QACI,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,mCAAU,GAAV,UAAW,MAAe;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,C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AAC,CAAC,CAAC,CACP,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,gCAAO,GAAf,UAAgB,WAAsC;QAClD,QAAQ,WAAW,EAAE;YACjB,KAAK,KAAK;gBACN,OAAO,IAAI,CAAC,KAAK,CAAC;YAEtB,KAAK,QAAQ;gBACT,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAEvB;gBACI,OAAO,IAAI,CAAC;SACnB;IACL,CAAC;IAEO,sCAAa,GAArB,UAAsB,WAAkC,EAAE,KAAoB;QAClE,IAAA,OAAO,GAAuC,KAAK,QAA5C,EAAE,MAAM,GAA+B,KAAK,OAApC,EAAE,QAAQ,GAAqB,KAAK,SAA1B,EAAE,KAAK,GAAc,KAAK,MAAnB,EAAE,OAAO,GAAK,KAAK,QAAV,CAAW;QAC5D,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAClD,IAAM,aAAa,GACf,CAAC,WAAW,CAAC,WAAW,IAAI,MAAM,IAAI,UAAU,IAAI,CAAC,MAAM,CAAC;YAC5D,CAAC,WAAW,CAAC,WAAW,IAAI,KAAK,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC;QAEhE,OAAO,aAAa,IAAI,QAAQ,IAAI,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,KAAK,IAAI,KAAK,CAAC;IAC3F,CAAC;IACL,qBAAC;AAAD,CAAC,AA3GD,IA2GC","sourcesContent":["import { cacheGetEventData } from 'roosterjs-content-model-core';\nimport type { ShortcutCommand, ShortcutKeyDefinition } from './ShortcutCommand';\nimport {\n ShortcutBold,\n ShortcutBullet,\n ShortcutClearFormat,\n ShortcutDecreaseFont,\n ShortcutIncreaseFont,\n ShortcutIndentList,\n ShortcutItalic,\n ShortcutNumbering,\n ShortcutOutdentList,\n ShortcutRedo,\n ShortcutRedoMacOS,\n ShortcutUnderline,\n ShortcutUndo,\n ShortcutUndo2,\n} from './shortcuts';\nimport type {\n EditorPlugin,\n IEditor,\n KeyDownEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\nconst defaultShortcuts: ShortcutCommand[] = [\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];\nconst CommandCacheKey = '__ShortcutCommandCache';\n\n/**\n * Shortcut plugin hook on the specified shortcut keys and trigger related format API\n */\nexport class ShortcutPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private isMac = false;\n\n /**\n * Create a new instance of ShortcutPlugin\n * @param [shortcuts=defaultShortcuts] Allowed commands\n */\n constructor(private shortcuts: ShortcutCommand[] = defaultShortcuts) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'Shortcut';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n this.isMac = !!this.editor.getEnvironment().isMac;\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n }\n\n /**\n * Check if the plugin should handle the given event exclusively.\n * Handle an event exclusively means other plugin will not receive this event in\n * onPluginEvent method.\n * If two plugins will return true in willHandleEventExclusively() for the same event,\n * the final result depends on the order of the plugins are added into editor\n * @param event The event to check:\n */\n willHandleEventExclusively(event: PluginEvent) {\n return (\n event.eventType == 'keyDown' &&\n (event.rawEvent.ctrlKey || event.rawEvent.altKey || event.rawEvent.metaKey) &&\n !!this.cacheGetCommand(event)\n );\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor && event.eventType == 'keyDown') {\n const command = this.cacheGetCommand(event);\n\n if (command) {\n command.onClick(this.editor);\n event.rawEvent.preventDefault();\n }\n }\n }\n\n private cacheGetCommand(event: KeyDownEvent) {\n return cacheGetEventData(event, CommandCacheKey, event => {\n const editor = this.editor;\n\n return (\n editor &&\n this.shortcuts.filter(\n command =>\n this.matchOS(command.environment) &&\n this.matchShortcut(command.shortcutKey, event.rawEvent)\n )[0]\n );\n });\n }\n\n private matchOS(environment?: 'all' | 'mac' | 'nonMac') {\n switch (environment) {\n case 'mac':\n return this.isMac;\n\n case 'nonMac':\n return !this.isMac;\n\n default:\n return true;\n }\n }\n\n private matchShortcut(shortcutKey: ShortcutKeyDefinition, event: KeyboardEvent) {\n const { ctrlKey, altKey, shiftKey, which, metaKey } = event;\n const ctrlOrMeta = this.isMac ? metaKey : ctrlKey;\n const matchModifier =\n (shortcutKey.modifierKey == 'ctrl' && ctrlOrMeta && !altKey) ||\n (shortcutKey.modifierKey == 'alt' && altKey && !ctrlOrMeta);\n\n return matchModifier && shiftKey == shortcutKey.shiftKey && shortcutKey.which == which;\n }\n}\n"]}
|
|
@@ -71,3 +71,15 @@ export declare const ShortcutIncreaseFont: ShortcutCommand;
|
|
|
71
71
|
* MacOS: Meta + Shift + , (Comma)
|
|
72
72
|
*/
|
|
73
73
|
export declare const ShortcutDecreaseFont: ShortcutCommand;
|
|
74
|
+
/**
|
|
75
|
+
* Shortcut command for Intent list
|
|
76
|
+
* Windows: Alt + Shift + Arrow Right
|
|
77
|
+
* MacOS: Option + Shift+ Arrow Right
|
|
78
|
+
*/
|
|
79
|
+
export declare const ShortcutIndentList: ShortcutCommand;
|
|
80
|
+
/**
|
|
81
|
+
* Shortcut command for Outdent list
|
|
82
|
+
* Windows: Alt + Shift + Arrow Left
|
|
83
|
+
* MacOS: Option + Shift+ Arrow Left
|
|
84
|
+
*/
|
|
85
|
+
export declare const ShortcutOutdentList: ShortcutCommand;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { redo, undo } from 'roosterjs-content-model-core';
|
|
2
|
+
import { setShortcutIndentationCommand } from './utils/setShortcutIndentationCommand';
|
|
2
3
|
import { changeFontSize, clearFormat, toggleBold, toggleBullet, toggleItalic, toggleNumbering, toggleUnderline, } from 'roosterjs-content-model-api';
|
|
3
4
|
var Keys;
|
|
4
5
|
(function (Keys) {
|
|
@@ -12,6 +13,8 @@ var Keys;
|
|
|
12
13
|
Keys[Keys["COMMA"] = 188] = "COMMA";
|
|
13
14
|
Keys[Keys["PERIOD"] = 190] = "PERIOD";
|
|
14
15
|
Keys[Keys["FORWARD_SLASH"] = 191] = "FORWARD_SLASH";
|
|
16
|
+
Keys[Keys["ArrowRight"] = 39] = "ArrowRight";
|
|
17
|
+
Keys[Keys["ArrowLeft"] = 37] = "ArrowLeft";
|
|
15
18
|
})(Keys || (Keys = {}));
|
|
16
19
|
/**
|
|
17
20
|
* Shortcut command for Bold
|
|
@@ -172,4 +175,34 @@ export var ShortcutDecreaseFont = {
|
|
|
172
175
|
},
|
|
173
176
|
onClick: function (editor) { return changeFontSize(editor, 'decrease'); },
|
|
174
177
|
};
|
|
178
|
+
/**
|
|
179
|
+
* Shortcut command for Intent list
|
|
180
|
+
* Windows: Alt + Shift + Arrow Right
|
|
181
|
+
* MacOS: Option + Shift+ Arrow Right
|
|
182
|
+
*/
|
|
183
|
+
export var ShortcutIndentList = {
|
|
184
|
+
shortcutKey: {
|
|
185
|
+
modifierKey: 'alt',
|
|
186
|
+
shiftKey: true,
|
|
187
|
+
which: 39 /* ArrowRight */,
|
|
188
|
+
},
|
|
189
|
+
onClick: function (editor) {
|
|
190
|
+
setShortcutIndentationCommand(editor, 'indent');
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Shortcut command for Outdent list
|
|
195
|
+
* Windows: Alt + Shift + Arrow Left
|
|
196
|
+
* MacOS: Option + Shift+ Arrow Left
|
|
197
|
+
*/
|
|
198
|
+
export var ShortcutOutdentList = {
|
|
199
|
+
shortcutKey: {
|
|
200
|
+
modifierKey: 'alt',
|
|
201
|
+
shiftKey: true,
|
|
202
|
+
which: 37 /* ArrowLeft */,
|
|
203
|
+
},
|
|
204
|
+
onClick: function (editor) {
|
|
205
|
+
setShortcutIndentationCommand(editor, 'outdent');
|
|
206
|
+
},
|
|
207
|
+
};
|
|
175
208
|
//# sourceMappingURL=shortcuts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcuts.js","sourceRoot":"","sources":["../../../../packages
|
|
1
|
+
{"version":3,"file":"shortcuts.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/shortcut/shortcuts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EACH,cAAc,EACd,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,GAClB,MAAM,6BAA6B,CAAC;AAGrC,IAAW,IAaV;AAbD,WAAW,IAAI;IACX,yCAAa,CAAA;IACb,kCAAU,CAAA;IACV,0BAAM,CAAA;IACN,0BAAM,CAAA;IACN,0BAAM,CAAA;IACN,0BAAM,CAAA;IACN,0BAAM,CAAA;IACN,mCAAW,CAAA;IACX,qCAAY,CAAA;IACZ,mDAAmB,CAAA;IACnB,4CAAe,CAAA;IACf,0CAAc,CAAA;AAClB,CAAC,EAbU,IAAI,KAAJ,IAAI,QAad;AAED;;;;GAIG;AACH,MAAM,CAAC,IAAM,YAAY,GAAoB;IACzC,WAAW,EAAE;QACT,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,KAAK;QACf,KAAK,YAAQ;KAChB;IACD,OA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A,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,EAAlC,CAAkC;CACxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,IAAM,oBAAoB,GAAoB;IACjD,WAAW,EAAE;QACT,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,IAAI;QACd,KAAK,iBAAY;KACpB;IACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,EAAlC,CAAkC;CACxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAoB;IAC/C,WAAW,EAAE;QACT,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,IAAI;QACd,KAAK,qBAAiB;KACzB;IACD,OAAO,EAAE,UAAA,MAAM;QACX,6BAA6B,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;CACJ,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAoB;IAChD,WAAW,EAAE;QACT,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,IAAI;QACd,KAAK,oBAAgB;KACxB;IACD,OAAO,EAAE,UAAA,MAAM;QACX,6BAA6B,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrD,CAAC;CACJ,CAAC","sourcesContent":["import { redo, undo } from 'roosterjs-content-model-core';\nimport { setShortcutIndentationCommand } from './utils/setShortcutIndentationCommand';\nimport {\n changeFontSize,\n clearFormat,\n toggleBold,\n toggleBullet,\n toggleItalic,\n toggleNumbering,\n toggleUnderline,\n} from 'roosterjs-content-model-api';\nimport type { ShortcutCommand } from './ShortcutCommand';\n\nconst enum Keys {\n BACKSPACE = 8,\n SPACE = 32,\n B = 66,\n I = 73,\n U = 85,\n Y = 89,\n Z = 90,\n COMMA = 188,\n PERIOD = 190,\n FORWARD_SLASH = 191,\n ArrowRight = 39,\n ArrowLeft = 37,\n}\n\n/**\n * Shortcut command for Bold\n * Windows: Ctrl + B\n * MacOS: Meta + B\n */\nexport const ShortcutBold: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.B,\n },\n onClick: editor => toggleBold(editor),\n};\n\n/**\n * Shortcut command for Italic\n * Windows: Ctrl + I\n * MacOS: Meta + I\n */\nexport const ShortcutItalic: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.I,\n },\n onClick: editor => toggleItalic(editor),\n};\n\n/**\n * Shortcut command for Underline\n * Windows: Ctrl + U\n * MacOS: Meta + U\n */\nexport const ShortcutUnderline: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.U,\n },\n onClick: editor => toggleUnderline(editor),\n};\n\n/**\n * Shortcut command for Clear Format\n * Windows: Ctrl + Space\n * MacOS: Meta + Space\n */\nexport const ShortcutClearFormat: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.SPACE,\n },\n onClick: editor => clearFormat(editor),\n};\n\n/**\n * Shortcut command for Undo 1\n * Windows: Ctrl + Z\n * MacOS: Meta + Z\n */\nexport const ShortcutUndo: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.Z,\n },\n onClick: editor => undo(editor),\n};\n\n/**\n * Shortcut command for Undo 2\n * Windows: Alt + Backspace\n * MacOS: N/A\n */\nexport const ShortcutUndo2: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'alt',\n shiftKey: false,\n which: Keys.BACKSPACE,\n },\n onClick: editor => undo(editor),\n environment: 'nonMac',\n};\n\n/**\n * Shortcut command for Redo 1\n * Windows: Ctrl + Y\n * MacOS: N/A\n */\nexport const ShortcutRedo: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.Y,\n },\n onClick: editor => redo(editor),\n environment: 'nonMac',\n};\n\n/**\n * Shortcut command for Redo 2\n * Windows: N/A\n * MacOS: Meta + Shift + Z\n */\nexport const ShortcutRedoMacOS: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: true,\n which: Keys.Z,\n },\n onClick: editor => redo(editor),\n environment: 'mac',\n};\n\n/**\n * Shortcut command for Bullet List\n * Windows: Ctrl + . (Period)\n * MacOS: Meta + . (Period)\n */\nexport const ShortcutBullet: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.PERIOD,\n },\n onClick: editor => toggleBullet(editor),\n};\n\n/**\n * Shortcut command for Numbering List\n * Windows: Ctrl + / (Forward slash)\n * MacOS: Meta + / (Forward slash)\n */\nexport const ShortcutNumbering: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.FORWARD_SLASH,\n },\n onClick: editor => toggleNumbering(editor),\n};\n\n/**\n * Shortcut command for Increase Font\n * Windows: Ctrl + Shift + . (Period)\n * MacOS: Meta + Shift + . (Period)\n */\nexport const ShortcutIncreaseFont: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: true,\n which: Keys.PERIOD,\n },\n onClick: editor => changeFontSize(editor, 'increase'),\n};\n\n/**\n * Shortcut command for Decrease Font\n * Windows: Ctrl + Shift + , (Comma)\n * MacOS: Meta + Shift + , (Comma)\n */\nexport const ShortcutDecreaseFont: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: true,\n which: Keys.COMMA,\n },\n onClick: editor => changeFontSize(editor, 'decrease'),\n};\n\n/**\n * Shortcut command for Intent list\n * Windows: Alt + Shift + Arrow Right\n * MacOS: Option + Shift+ Arrow Right\n */\nexport const ShortcutIndentList: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'alt',\n shiftKey: true,\n which: Keys.ArrowRight,\n },\n onClick: editor => {\n setShortcutIndentationCommand(editor, 'indent');\n },\n};\n\n/**\n * Shortcut command for Outdent list\n * Windows: Alt + Shift + Arrow Left\n * MacOS: Option + Shift+ Arrow Left\n */\nexport const ShortcutOutdentList: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'alt',\n shiftKey: true,\n which: Keys.ArrowLeft,\n },\n onClick: editor => {\n setShortcutIndentationCommand(editor, 'outdent');\n },\n};\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getFirstSelectedListItem } from 'roosterjs-content-model-core';
|
|
2
|
+
import { setModelIndentation } from 'roosterjs-content-model-api';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export function setShortcutIndentationCommand(editor, operation) {
|
|
7
|
+
editor.formatContentModel(function (model) {
|
|
8
|
+
var listItem = getFirstSelectedListItem(model);
|
|
9
|
+
if (listItem &&
|
|
10
|
+
listItem.blocks[0].blockType == 'Paragraph' &&
|
|
11
|
+
listItem.blocks[0].segments[0].segmentType == 'SelectionMarker') {
|
|
12
|
+
setModelIndentation(model, operation);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=setShortcutIndentationCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setShortcutIndentationCommand.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/shortcut/utils/setShortcutIndentationCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,MAAe,EAAE,SAA+B;IAC1F,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK;QAC3B,IAAM,QAAQ,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAEjD,IACI,QAAQ;YACR,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,WAAW;YAC3C,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,EACjE;YACE,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { getFirstSelectedListItem } from 'roosterjs-content-model-core';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function setShortcutIndentationCommand(editor: IEditor, operation: 'indent' | 'outdent') {\n editor.formatContentModel(model => {\n const listItem = getFirstSelectedListItem(model);\n\n if (\n listItem &&\n listItem.blocks[0].blockType == 'Paragraph' &&\n listItem.blocks[0].segments[0].segmentType == 'SelectionMarker'\n ) {\n setModelIndentation(model, operation);\n return true;\n }\n return false;\n });\n}\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import normalizeRect from '
|
|
2
|
-
import TableEditor from './editors/TableEditor';
|
|
3
|
-
import { isNodeOfType } from 'roosterjs-content-model-dom';
|
|
1
|
+
import { isNodeOfType, normalizeRect } from 'roosterjs-content-model-dom';
|
|
2
|
+
import { TableEditor } from './editors/TableEditor';
|
|
4
3
|
var TABLE_RESIZER_LENGTH = 12;
|
|
5
4
|
/**
|
|
6
5
|
* TableEdit plugin, provides the ability to resize a table by drag-and-drop
|
|
@@ -118,8 +117,9 @@ var TableEditPlugin = /** @class */ (function () {
|
|
|
118
117
|
this.disposeTableEditor();
|
|
119
118
|
}
|
|
120
119
|
if (!this.tableEditor && table && this.editor && table.rows.length > 0) {
|
|
120
|
+
// anchorContainerSelector is used to specify the container to host the plugin, which can be outside of the editor's div
|
|
121
121
|
var container = this.anchorContainerSelector
|
|
122
|
-
? this.editor.
|
|
122
|
+
? this.editor.getDocument().querySelector(this.anchorContainerSelector)
|
|
123
123
|
: undefined;
|
|
124
124
|
this.tableEditor = new TableEditor(this.editor, table, this.invalidateTableRects, isNodeOfType(container, 'ELEMENT_NODE') ? container : undefined, event === null || event === void 0 ? void 0 : event.currentTarget);
|
|
125
125
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableEditPlugin.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/tableEdit/TableEditPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,mCAAmC,CAAC;AAC9D,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,IAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;;GAEG;AACH;IAMI;;;;;OAKG;IACH,yBAAoB,uBAAgC;QAApD,iBAAwD;QAApC,4BAAuB,GAAvB,uBAAuB,CAAS;QAX5C,WAAM,GAAmB,IAAI,CAAC;QAC9B,wBAAmB,GAAwB,IAAI,CAAC;QAChD,iBAAY,GAAqD,IAAI,CAAC;QACtE,gBAAW,GAAuB,IAAI,CAAC;QA8BvC,eAAU,GAAG,UAAC,EAA4C;gBAA1C,aAAa,mBAAA,EAAE,aAAa,mBAAA;YAChD,IAAM,iBAAiB,GAAG,aAAqB,CAAC;YAChD,IAAM,iBAAiB,GAAG,aAAqB,CAAC;YAChD,IACI,YAAY,CAAC,iBAAiB,EAAE,cAAc,CAAC;gBAC/C,YAAY,CAAC,iBAAiB,EAAE,cAAc,CAAC;gBAC/C,KAAI,CAAC,WAAW;gBAChB,CAAC,KAAI,CAAC,WAAW,CAAC,cAAc,CAAC,iBAAiB,CAAC;gBACnD,CAAC,iBAAiB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAChD;gBACE,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aAC7B;QACL,CAAC,CAAC;QA+BM,gBAAW,GAAG,UAAC,KAAY;;YAC/B,IAAM,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B,IAAI,KAAK,CAAC,iBAAiB,EAAE;oBACzB,IAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC;oBAC1D,IAAI,IAAI,IAAI,KAAI,CAAC,YAAY,EAAE;wBAC3B,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC;4BACnB,KAAK,OAAA;4BACL,IAAI,MAAA;yBACP,CAAC,CAAC;qBACN;iBACJ;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IACL,sBAAC;AAAD,CAAC,AApKD,IAoKC","sourcesContent":["import normalizeRect from '../pluginUtils/Rect/normalizeRect';\nimport TableEditor from './editors/TableEditor';\nimport { isNodeOfType } from 'roosterjs-content-model-dom';\nimport type { EditorPlugin, IEditor, PluginEvent, Rect } from 'roosterjs-content-model-types';\n\nconst TABLE_RESIZER_LENGTH = 12;\n\n/**\n * TableEdit plugin, provides the ability to resize a table by drag-and-drop\n */\nexport class TableEditPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private onMouseMoveDisposer: (() => void) | null = null;\n private tableRectMap: { table: HTMLTableElement; rect: Rect }[] | null = null;\n private tableEditor: TableEditor | null = null;\n\n /**\n * Construct a new instance of TableResize plugin\n * @param anchorContainerSelector An optional selector string to specify the container to host the plugin.\n * The container must not be affected by transform: scale(), otherwise the position calculation will be wrong.\n * If not specified, the plugin will be inserted in document.body\n */\n constructor(private anchorContainerSelector?: string) {}\n\n /**\n * Get a friendly name of this plugin\n */\n getName() {\n return 'TableEdit';\n }\n\n /**\n * Initialize this plugin. This should only be called from Editor\n * @param editor Editor instance\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n this.onMouseMoveDisposer = this.editor.attachDomEvent({\n mousemove: { beforeDispatch: this.onMouseMove },\n });\n const scrollContainer = this.editor.getScrollContainer();\n scrollContainer.addEventListener('mouseout', this.onMouseOut);\n }\n\n private onMouseOut = ({ relatedTarget, currentTarget }: MouseEvent) => {\n const relatedTargetNode = relatedTarget as Node;\n const currentTargetNode = currentTarget as Node;\n if (\n isNodeOfType(relatedTargetNode, 'ELEMENT_NODE') &&\n isNodeOfType(currentTargetNode, 'ELEMENT_NODE') &&\n this.tableEditor &&\n !this.tableEditor.isOwnedElement(relatedTargetNode) &&\n !currentTargetNode.contains(relatedTargetNode)\n ) {\n this.setTableEditor(null);\n }\n };\n\n /**\n * Dispose this plugin\n */\n dispose() {\n const scrollContainer = this.editor?.getScrollContainer();\n scrollContainer?.removeEventListener('mouseout', this.onMouseOut);\n this.onMouseMoveDisposer?.();\n this.invalidateTableRects();\n this.disposeTableEditor();\n this.editor = null;\n this.onMouseMoveDisposer = null;\n }\n\n /**\n * Handle events triggered from editor\n * @param event PluginEvent object\n */\n onPluginEvent(e: PluginEvent) {\n switch (e.eventType) {\n case 'input':\n case 'contentChanged':\n case 'scroll':\n case 'zoomChanged':\n this.setTableEditor(null);\n this.invalidateTableRects();\n break;\n }\n }\n\n private onMouseMove = (event: Event) => {\n const e = event as MouseEvent;\n\n if (e.buttons > 0 || !this.editor) {\n return;\n }\n\n this.ensureTableRects();\n\n const editorWindow = this.editor.getDocument().defaultView || window;\n const x = e.pageX - editorWindow.scrollX;\n const y = e.pageY - editorWindow.scrollY;\n let currentTable: HTMLTableElement | null = null;\n\n //Find table in range of mouse\n if (this.tableRectMap) {\n for (let i = this.tableRectMap.length - 1; i >= 0; i--) {\n const { table, rect } = this.tableRectMap[i];\n\n if (\n x >= rect.left - TABLE_RESIZER_LENGTH &&\n x <= rect.right + TABLE_RESIZER_LENGTH &&\n y >= rect.top - TABLE_RESIZER_LENGTH &&\n y <= rect.bottom + TABLE_RESIZER_LENGTH\n ) {\n currentTable = table;\n break;\n }\n }\n }\n\n this.setTableEditor(currentTable, e);\n this.tableEditor?.onMouseMove(x, y);\n };\n\n /**\n * @internal Public only for unit test\n * @param table Table to use when setting the Editors\n * @param event (Optional) Mouse event\n */\n public setTableEditor(table: HTMLTableElement | null, event?: MouseEvent) {\n if (this.tableEditor && !this.tableEditor.isEditing() && table != this.tableEditor.table) {\n this.disposeTableEditor();\n }\n\n if (!this.tableEditor && table && this.editor && table.rows.length > 0) {\n const container = this.anchorContainerSelector\n ? this.editor.getDOMHelper().queryElements(this.anchorContainerSelector)[0]\n : undefined;\n\n this.tableEditor = new TableEditor(\n this.editor,\n table,\n this.invalidateTableRects,\n isNodeOfType(container as Node, 'ELEMENT_NODE') ? container : undefined,\n event?.currentTarget\n );\n }\n }\n\n private invalidateTableRects = () => {\n this.tableRectMap = null;\n };\n\n private disposeTableEditor() {\n this.tableEditor?.dispose();\n this.tableEditor = null;\n }\n\n private ensureTableRects() {\n if (!this.tableRectMap && this.editor) {\n this.tableRectMap = [];\n\n const tables = this.editor.getDOMHelper().queryElements('table');\n tables.forEach(table => {\n if (table.isContentEditable) {\n const rect = normalizeRect(table.getBoundingClientRect());\n if (rect && this.tableRectMap) {\n this.tableRectMap.push({\n table,\n rect,\n });\n }\n }\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TableEditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/tableEdit/TableEditPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,IAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;;GAEG;AACH;IAMI;;;;;OAKG;IACH,yBAAoB,uBAAgC;QAApD,iBAAwD;QAApC,4BAAuB,GAAvB,uBAAuB,CAAS;QAX5C,WAAM,GAAmB,IAAI,CAAC;QAC9B,wBAAmB,GAAwB,IAAI,CAAC;QAChD,iBAAY,GAAqD,IAAI,CAAC;QACtE,gBAAW,GAAuB,IAAI,CAAC;QA8BvC,eAAU,GAAG,UAAC,EAA4C;gBAA1C,aAAa,mBAAA,EAAE,aAAa,mBAAA;YAChD,IAAM,iBAAiB,GAAG,aAAqB,CAAC;YAChD,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MAAA,IAAI,CAAC,WAAW,0CAAE,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC5B,CAAC;IAEO,0CAAgB,GAAxB;QAAA,iBAiBC;QAhBG,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,EAAE;YACnC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;YAEvB,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACjE,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;gBAChB,IAAI,KAAK,CAAC,iBAAiB,EAAE;oBACzB,IAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC;oBAC1D,IAAI,IAAI,IAAI,KAAI,CAAC,YAAY,EAAE;wBAC3B,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC;4BACnB,KAAK,OAAA;4BACL,IAAI,MAAA;yBACP,CAAC,CAAC;qBACN;iBACJ;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IACL,sBAAC;AAAD,CAAC,AArKD,IAqKC","sourcesContent":["import { isNodeOfType, normalizeRect } from 'roosterjs-content-model-dom';\nimport { TableEditor } from './editors/TableEditor';\nimport type { EditorPlugin, IEditor, PluginEvent, Rect } from 'roosterjs-content-model-types';\n\nconst TABLE_RESIZER_LENGTH = 12;\n\n/**\n * TableEdit plugin, provides the ability to resize a table by drag-and-drop\n */\nexport class TableEditPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private onMouseMoveDisposer: (() => void) | null = null;\n private tableRectMap: { table: HTMLTableElement; rect: Rect }[] | null = null;\n private tableEditor: TableEditor | null = null;\n\n /**\n * Construct a new instance of TableResize plugin\n * @param anchorContainerSelector An optional selector string to specify the container to host the plugin.\n * The container must not be affected by transform: scale(), otherwise the position calculation will be wrong.\n * If not specified, the plugin will be inserted in document.body\n */\n constructor(private anchorContainerSelector?: string) {}\n\n /**\n * Get a friendly name of this plugin\n */\n getName() {\n return 'TableEdit';\n }\n\n /**\n * Initialize this plugin. This should only be called from Editor\n * @param editor Editor instance\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n this.onMouseMoveDisposer = this.editor.attachDomEvent({\n mousemove: { beforeDispatch: this.onMouseMove },\n });\n const scrollContainer = this.editor.getScrollContainer();\n scrollContainer.addEventListener('mouseout', this.onMouseOut);\n }\n\n private onMouseOut = ({ relatedTarget, currentTarget }: MouseEvent) => {\n const relatedTargetNode = relatedTarget as Node;\n const currentTargetNode = currentTarget as Node;\n if (\n isNodeOfType(relatedTargetNode, 'ELEMENT_NODE') &&\n isNodeOfType(currentTargetNode, 'ELEMENT_NODE') &&\n this.tableEditor &&\n !this.tableEditor.isOwnedElement(relatedTargetNode) &&\n !currentTargetNode.contains(relatedTargetNode)\n ) {\n this.setTableEditor(null);\n }\n };\n\n /**\n * Dispose this plugin\n */\n dispose() {\n const scrollContainer = this.editor?.getScrollContainer();\n scrollContainer?.removeEventListener('mouseout', this.onMouseOut);\n this.onMouseMoveDisposer?.();\n this.invalidateTableRects();\n this.disposeTableEditor();\n this.editor = null;\n this.onMouseMoveDisposer = null;\n }\n\n /**\n * Handle events triggered from editor\n * @param event PluginEvent object\n */\n onPluginEvent(e: PluginEvent) {\n switch (e.eventType) {\n case 'input':\n case 'contentChanged':\n case 'scroll':\n case 'zoomChanged':\n this.setTableEditor(null);\n this.invalidateTableRects();\n break;\n }\n }\n\n private onMouseMove = (event: Event) => {\n const e = event as MouseEvent;\n\n if (e.buttons > 0 || !this.editor) {\n return;\n }\n\n this.ensureTableRects();\n\n const editorWindow = this.editor.getDocument().defaultView || window;\n const x = e.pageX - editorWindow.scrollX;\n const y = e.pageY - editorWindow.scrollY;\n let currentTable: HTMLTableElement | null = null;\n\n //Find table in range of mouse\n if (this.tableRectMap) {\n for (let i = this.tableRectMap.length - 1; i >= 0; i--) {\n const { table, rect } = this.tableRectMap[i];\n\n if (\n x >= rect.left - TABLE_RESIZER_LENGTH &&\n x <= rect.right + TABLE_RESIZER_LENGTH &&\n y >= rect.top - TABLE_RESIZER_LENGTH &&\n y <= rect.bottom + TABLE_RESIZER_LENGTH\n ) {\n currentTable = table;\n break;\n }\n }\n }\n\n this.setTableEditor(currentTable, e);\n this.tableEditor?.onMouseMove(x, y);\n };\n\n /**\n * @internal Public only for unit test\n * @param table Table to use when setting the Editors\n * @param event (Optional) Mouse event\n */\n public setTableEditor(table: HTMLTableElement | null, event?: MouseEvent) {\n if (this.tableEditor && !this.tableEditor.isEditing() && table != this.tableEditor.table) {\n this.disposeTableEditor();\n }\n\n if (!this.tableEditor && table && this.editor && table.rows.length > 0) {\n // anchorContainerSelector is used to specify the container to host the plugin, which can be outside of the editor's div\n const container = this.anchorContainerSelector\n ? this.editor.getDocument().querySelector(this.anchorContainerSelector)\n : undefined;\n\n this.tableEditor = new TableEditor(\n this.editor,\n table,\n this.invalidateTableRects,\n isNodeOfType(container, 'ELEMENT_NODE') ? container : undefined,\n event?.currentTarget\n );\n }\n }\n\n private invalidateTableRects = () => {\n this.tableRectMap = null;\n };\n\n private disposeTableEditor() {\n this.tableEditor?.dispose();\n this.tableEditor = null;\n }\n\n private ensureTableRects() {\n if (!this.tableRectMap && this.editor) {\n this.tableRectMap = [];\n\n const tables = this.editor.getDOMHelper().queryElements('table');\n tables.forEach(table => {\n if (table.isContentEditable) {\n const rect = normalizeRect(table.getBoundingClientRect());\n if (rect && this.tableRectMap) {\n this.tableRectMap.push({\n table,\n rect,\n });\n }\n }\n });\n }\n }\n}\n"]}
|
|
@@ -28,7 +28,7 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
28
28
|
*
|
|
29
29
|
* When set a different current table or change current TD, we need to update these areas
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export declare class TableEditor {
|
|
32
32
|
private editor;
|
|
33
33
|
readonly table: HTMLTableElement;
|
|
34
34
|
private onChanged;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import createCellResizer from './features/CellResizer';
|
|
2
|
-
import createTableInserter from './features/TableInserter';
|
|
3
|
-
import createTableMover from './features/TableMover';
|
|
4
|
-
import createTableResizer from './features/TableResizer';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { isNodeOfType } from 'roosterjs-content-model-dom';
|
|
1
|
+
import { createCellResizer } from './features/CellResizer';
|
|
2
|
+
import { createTableInserter } from './features/TableInserter';
|
|
3
|
+
import { createTableMover } from './features/TableMover';
|
|
4
|
+
import { createTableResizer } from './features/TableResizer';
|
|
5
|
+
import { disposeTableEditFeature } from './features/TableEditFeature';
|
|
6
|
+
import { isNodeOfType, normalizeRect } from 'roosterjs-content-model-dom';
|
|
8
7
|
var INSERTER_HOVER_OFFSET = 6;
|
|
9
8
|
var TOP_OR_SIDE;
|
|
10
9
|
(function (TOP_OR_SIDE) {
|
|
@@ -288,5 +287,5 @@ var TableEditor = /** @class */ (function () {
|
|
|
288
287
|
};
|
|
289
288
|
return TableEditor;
|
|
290
289
|
}());
|
|
291
|
-
export
|
|
290
|
+
export { TableEditor };
|
|
292
291
|
//# sourceMappingURL=TableEditor.js.map
|