roosterjs-content-model-plugins 0.21.2 → 0.21.4
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/edit/ContentModelEditPlugin.d.ts +35 -35
- package/lib/edit/ContentModelEditPlugin.js +75 -75
- package/lib/edit/ContentModelEditPlugin.js.map +1 -1
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js +19 -19
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js +90 -90
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
- package/lib/edit/deleteSteps/deleteWordSelection.js +170 -170
- package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib/edit/handleKeyboardEventCommon.d.ts +15 -15
- package/lib/edit/handleKeyboardEventCommon.js +54 -54
- package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib/edit/keyboardDelete.d.ts +8 -8
- package/lib/edit/keyboardDelete.js +67 -67
- package/lib/edit/keyboardDelete.js.map +1 -1
- package/lib/edit/keyboardInput.d.ts +5 -5
- package/lib/edit/keyboardInput.js +50 -49
- package/lib/edit/keyboardInput.js.map +1 -1
- package/lib/edit/utils/getLeafSiblingBlock.d.ts +23 -23
- package/lib/edit/utils/getLeafSiblingBlock.js +75 -75
- package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib/entityDelimiter/EntityDelimiterPlugin.d.ts +35 -35
- package/lib/entityDelimiter/EntityDelimiterPlugin.js +256 -254
- package/lib/entityDelimiter/EntityDelimiterPlugin.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/paste/ContentModelPastePlugin.d.ts +42 -42
- package/lib/paste/ContentModelPastePlugin.js +148 -148
- package/lib/paste/ContentModelPastePlugin.js.map +1 -1
- package/lib/paste/Excel/processPastedContentFromExcel.d.ts +13 -13
- package/lib/paste/Excel/processPastedContentFromExcel.js +82 -82
- package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js +19 -19
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
- package/lib/paste/WacComponents/processPastedContentWacComponents.js +207 -207
- package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +12 -12
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +69 -69
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib/paste/WordDesktop/processWordComments.d.ts +7 -7
- package/lib/paste/WordDesktop/processWordComments.js +21 -21
- package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib/paste/WordDesktop/processWordLists.d.ts +10 -10
- package/lib/paste/WordDesktop/processWordLists.js +154 -154
- package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib/paste/pasteSourceValidations/constants.d.ts +17 -17
- package/lib/paste/pasteSourceValidations/constants.js +21 -21
- package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/documentContainWacElements.js +24 -24
- package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
- package/lib/paste/pasteSourceValidations/getPasteSource.js +43 -43
- package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js +16 -16
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js +18 -18
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js +14 -14
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +14 -14
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js +18 -18
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
- package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js +18 -18
- package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib/paste/utils/addParser.d.ts +5 -5
- package/lib/paste/utils/addParser.js +16 -16
- package/lib/paste/utils/addParser.js.map +1 -1
- package/lib/paste/utils/deprecatedColorParser.d.ts +5 -5
- package/lib/paste/utils/deprecatedColorParser.js +19 -19
- package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib/paste/utils/getStyles.d.ts +6 -6
- package/lib/paste/utils/getStyles.js +22 -22
- package/lib/paste/utils/getStyles.js.map +1 -1
- package/lib/paste/utils/linkParser.d.ts +5 -5
- package/lib/paste/utils/linkParser.js +27 -27
- package/lib/paste/utils/linkParser.js.map +1 -1
- package/lib/paste/utils/setProcessor.d.ts +5 -5
- package/lib/paste/utils/setProcessor.js +13 -13
- package/lib/paste/utils/setProcessor.js.map +1 -1
- package/lib-amd/edit/ContentModelEditPlugin.d.ts +35 -35
- package/lib-amd/edit/ContentModelEditPlugin.js +75 -75
- package/lib-amd/edit/ContentModelEditPlugin.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js +20 -20
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +89 -89
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
- package/lib-amd/edit/deleteSteps/deleteWordSelection.js +169 -169
- package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-amd/edit/handleKeyboardEventCommon.d.ts +15 -15
- package/lib-amd/edit/handleKeyboardEventCommon.js +55 -55
- package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-amd/edit/keyboardDelete.d.ts +8 -8
- package/lib-amd/edit/keyboardDelete.js +63 -63
- package/lib-amd/edit/keyboardDelete.js.map +1 -1
- package/lib-amd/edit/keyboardInput.d.ts +5 -5
- package/lib-amd/edit/keyboardInput.js +50 -49
- package/lib-amd/edit/keyboardInput.js.map +1 -1
- package/lib-amd/edit/utils/getLeafSiblingBlock.d.ts +23 -23
- package/lib-amd/edit/utils/getLeafSiblingBlock.js +75 -75
- package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.d.ts +35 -35
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js +255 -253
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js.map +1 -1
- package/lib-amd/index.d.ts +3 -3
- package/lib-amd/index.js +8 -8
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/paste/ContentModelPastePlugin.d.ts +42 -42
- package/lib-amd/paste/ContentModelPastePlugin.js +140 -140
- package/lib-amd/paste/ContentModelPastePlugin.js.map +1 -1
- package/lib-amd/paste/Excel/processPastedContentFromExcel.d.ts +13 -13
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js +80 -80
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js +20 -20
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +206 -206
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +12 -12
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +64 -64
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordComments.d.ts +7 -7
- package/lib-amd/paste/WordDesktop/processWordComments.js +22 -22
- package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordLists.d.ts +10 -10
- package/lib-amd/paste/WordDesktop/processWordLists.js +153 -153
- package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/constants.d.ts +17 -17
- package/lib-amd/paste/pasteSourceValidations/constants.js +23 -23
- package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js +26 -26
- package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.js +38 -38
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js +18 -18
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js +20 -20
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js +16 -16
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +16 -16
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js +20 -20
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
- package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js +20 -20
- package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib-amd/paste/utils/addParser.d.ts +5 -5
- package/lib-amd/paste/utils/addParser.js +18 -18
- package/lib-amd/paste/utils/addParser.js.map +1 -1
- package/lib-amd/paste/utils/deprecatedColorParser.d.ts +5 -5
- package/lib-amd/paste/utils/deprecatedColorParser.js +20 -20
- package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib-amd/paste/utils/getStyles.d.ts +6 -6
- package/lib-amd/paste/utils/getStyles.js +24 -24
- package/lib-amd/paste/utils/getStyles.js.map +1 -1
- package/lib-amd/paste/utils/linkParser.d.ts +5 -5
- package/lib-amd/paste/utils/linkParser.js +28 -28
- package/lib-amd/paste/utils/linkParser.js.map +1 -1
- package/lib-amd/paste/utils/setProcessor.d.ts +5 -5
- package/lib-amd/paste/utils/setProcessor.js +15 -15
- package/lib-amd/paste/utils/setProcessor.js.map +1 -1
- package/lib-mjs/edit/ContentModelEditPlugin.d.ts +35 -35
- package/lib-mjs/edit/ContentModelEditPlugin.js +72 -72
- package/lib-mjs/edit/ContentModelEditPlugin.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js +15 -15
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +87 -87
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.js +167 -167
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +15 -15
- package/lib-mjs/edit/handleKeyboardEventCommon.js +48 -48
- package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-mjs/edit/keyboardDelete.d.ts +8 -8
- package/lib-mjs/edit/keyboardDelete.js +63 -63
- package/lib-mjs/edit/keyboardDelete.js.map +1 -1
- package/lib-mjs/edit/keyboardInput.d.ts +5 -5
- package/lib-mjs/edit/keyboardInput.js +46 -45
- package/lib-mjs/edit/keyboardInput.js.map +1 -1
- package/lib-mjs/edit/utils/getLeafSiblingBlock.d.ts +23 -23
- package/lib-mjs/edit/utils/getLeafSiblingBlock.js +71 -71
- package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.d.ts +35 -35
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js +252 -250
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js.map +1 -1
- package/lib-mjs/index.d.ts +3 -3
- package/lib-mjs/index.js +3 -3
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/paste/ContentModelPastePlugin.d.ts +42 -42
- package/lib-mjs/paste/ContentModelPastePlugin.js +145 -145
- package/lib-mjs/paste/ContentModelPastePlugin.js.map +1 -1
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.d.ts +13 -13
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +77 -77
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js +15 -15
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +203 -203
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +12 -12
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +64 -64
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordComments.d.ts +7 -7
- package/lib-mjs/paste/WordDesktop/processWordComments.js +17 -17
- package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordLists.d.ts +10 -10
- package/lib-mjs/paste/WordDesktop/processWordLists.js +150 -150
- package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/constants.d.ts +17 -17
- package/lib-mjs/paste/pasteSourceValidations/constants.js +18 -18
- package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js +20 -20
- package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js +39 -39
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js +12 -12
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js +14 -14
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js +10 -10
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +10 -10
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js +14 -14
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
- package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js +14 -14
- package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
- package/lib-mjs/paste/utils/addParser.d.ts +5 -5
- package/lib-mjs/paste/utils/addParser.js +13 -13
- package/lib-mjs/paste/utils/addParser.js.map +1 -1
- package/lib-mjs/paste/utils/deprecatedColorParser.d.ts +5 -5
- package/lib-mjs/paste/utils/deprecatedColorParser.js +15 -15
- package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
- package/lib-mjs/paste/utils/getStyles.d.ts +6 -6
- package/lib-mjs/paste/utils/getStyles.js +18 -18
- package/lib-mjs/paste/utils/getStyles.js.map +1 -1
- package/lib-mjs/paste/utils/linkParser.d.ts +5 -5
- package/lib-mjs/paste/utils/linkParser.js +23 -23
- package/lib-mjs/paste/utils/linkParser.js.map +1 -1
- package/lib-mjs/paste/utils/setProcessor.d.ts +5 -5
- package/lib-mjs/paste/utils/setProcessor.js +9 -9
- package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "../utils/addParser", "roosterjs-content-model-dom", "../utils/setProcessor"], function (require, exports, tslib_1, addParser_1, roosterjs_content_model_dom_1, setProcessor_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.excelHandler = exports.processPastedContentFromExcel = void 0;
|
|
5
|
-
var LAST_TD_END_REGEX = /<\/\s*td\s*>((?!<\/\s*tr\s*>)[\s\S])*$/i;
|
|
6
|
-
var LAST_TR_END_REGEX = /<\/\s*tr\s*>((?!<\/\s*table\s*>)[\s\S])*$/i;
|
|
7
|
-
var LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;
|
|
8
|
-
var LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;
|
|
9
|
-
var DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
* Convert pasted content from Excel, add borders when source doc doesn't have a border
|
|
13
|
-
* @param event The BeforePaste event
|
|
14
|
-
*/
|
|
15
|
-
function processPastedContentFromExcel(event, trustedHTMLHandler) {
|
|
16
|
-
var fragment = event.fragment, htmlBefore = event.htmlBefore, clipboardData = event.clipboardData;
|
|
17
|
-
var html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;
|
|
18
|
-
if (html && clipboardData.html != html) {
|
|
19
|
-
var doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');
|
|
20
|
-
(0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
|
|
21
|
-
}
|
|
22
|
-
// For Excel Online
|
|
23
|
-
var firstChild = fragment.firstChild;
|
|
24
|
-
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(firstChild, 'ELEMENT_NODE') &&
|
|
25
|
-
firstChild.tagName == 'div' &&
|
|
26
|
-
firstChild.firstChild) {
|
|
27
|
-
var tableFound = Array.from(firstChild.childNodes).every(function (child) {
|
|
28
|
-
// Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag
|
|
29
|
-
var tagName = (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'ELEMENT_NODE') && child.tagName;
|
|
30
|
-
return tagName == 'META'
|
|
31
|
-
? true
|
|
32
|
-
: tagName == 'TABLE'
|
|
33
|
-
? child == firstChild.lastChild
|
|
34
|
-
: false;
|
|
35
|
-
});
|
|
36
|
-
// Extract Table from Div
|
|
37
|
-
if (tableFound && firstChild.lastChild) {
|
|
38
|
-
event.fragment.replaceChildren(firstChild.lastChild);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
(0, addParser_1.default)(event.domToModelOption, 'tableCell', function (format, element) {
|
|
42
|
-
if (element.style.borderStyle === 'none') {
|
|
43
|
-
format.borderBottom = DEFAULT_BORDER_STYLE;
|
|
44
|
-
format.borderLeft = DEFAULT_BORDER_STYLE;
|
|
45
|
-
format.borderRight = DEFAULT_BORDER_STYLE;
|
|
46
|
-
format.borderTop = DEFAULT_BORDER_STYLE;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
(0, setProcessor_1.setProcessor)(event.domToModelOption, 'child', function (group, element, context) {
|
|
50
|
-
var segmentFormat = (0, tslib_1.__assign)({}, context.segmentFormat);
|
|
51
|
-
if (group.blockGroupType === 'TableCell' && group.format.textColor) {
|
|
52
|
-
context.segmentFormat.textColor = group.format.textColor;
|
|
53
|
-
}
|
|
54
|
-
context.defaultElementProcessors.child(group, element, context);
|
|
55
|
-
if (group.blockGroupType === 'TableCell' && group.format.textColor) {
|
|
56
|
-
context.segmentFormat = segmentFormat;
|
|
57
|
-
delete group.format.textColor;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
exports.processPastedContentFromExcel = processPastedContentFromExcel;
|
|
62
|
-
/**
|
|
63
|
-
* @internal Export for test only
|
|
64
|
-
* @param html Source html
|
|
65
|
-
*/
|
|
66
|
-
function excelHandler(html, htmlBefore) {
|
|
67
|
-
if (html.match(LAST_TD_END_REGEX)) {
|
|
68
|
-
var trMatch = htmlBefore.match(LAST_TR_REGEX);
|
|
69
|
-
var tr = trMatch ? trMatch[0] : '<TR>';
|
|
70
|
-
html = tr + html + '</TR>';
|
|
71
|
-
}
|
|
72
|
-
if (html.match(LAST_TR_END_REGEX)) {
|
|
73
|
-
var tableMatch = htmlBefore.match(LAST_TABLE_REGEX);
|
|
74
|
-
var table = tableMatch ? tableMatch[0] : '<TABLE>';
|
|
75
|
-
html = table + html + '</TABLE>';
|
|
76
|
-
}
|
|
77
|
-
return html;
|
|
78
|
-
}
|
|
79
|
-
exports.excelHandler = excelHandler;
|
|
80
|
-
});
|
|
1
|
+
define(["require", "exports", "tslib", "../utils/addParser", "roosterjs-content-model-dom", "../utils/setProcessor"], function (require, exports, tslib_1, addParser_1, roosterjs_content_model_dom_1, setProcessor_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.excelHandler = exports.processPastedContentFromExcel = void 0;
|
|
5
|
+
var LAST_TD_END_REGEX = /<\/\s*td\s*>((?!<\/\s*tr\s*>)[\s\S])*$/i;
|
|
6
|
+
var LAST_TR_END_REGEX = /<\/\s*tr\s*>((?!<\/\s*table\s*>)[\s\S])*$/i;
|
|
7
|
+
var LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;
|
|
8
|
+
var LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;
|
|
9
|
+
var DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
* Convert pasted content from Excel, add borders when source doc doesn't have a border
|
|
13
|
+
* @param event The BeforePaste event
|
|
14
|
+
*/
|
|
15
|
+
function processPastedContentFromExcel(event, trustedHTMLHandler) {
|
|
16
|
+
var fragment = event.fragment, htmlBefore = event.htmlBefore, clipboardData = event.clipboardData;
|
|
17
|
+
var html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;
|
|
18
|
+
if (html && clipboardData.html != html) {
|
|
19
|
+
var doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');
|
|
20
|
+
(0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
|
|
21
|
+
}
|
|
22
|
+
// For Excel Online
|
|
23
|
+
var firstChild = fragment.firstChild;
|
|
24
|
+
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(firstChild, 'ELEMENT_NODE') &&
|
|
25
|
+
firstChild.tagName == 'div' &&
|
|
26
|
+
firstChild.firstChild) {
|
|
27
|
+
var tableFound = Array.from(firstChild.childNodes).every(function (child) {
|
|
28
|
+
// Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag
|
|
29
|
+
var tagName = (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'ELEMENT_NODE') && child.tagName;
|
|
30
|
+
return tagName == 'META'
|
|
31
|
+
? true
|
|
32
|
+
: tagName == 'TABLE'
|
|
33
|
+
? child == firstChild.lastChild
|
|
34
|
+
: false;
|
|
35
|
+
});
|
|
36
|
+
// Extract Table from Div
|
|
37
|
+
if (tableFound && firstChild.lastChild) {
|
|
38
|
+
event.fragment.replaceChildren(firstChild.lastChild);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
(0, addParser_1.default)(event.domToModelOption, 'tableCell', function (format, element) {
|
|
42
|
+
if (element.style.borderStyle === 'none') {
|
|
43
|
+
format.borderBottom = DEFAULT_BORDER_STYLE;
|
|
44
|
+
format.borderLeft = DEFAULT_BORDER_STYLE;
|
|
45
|
+
format.borderRight = DEFAULT_BORDER_STYLE;
|
|
46
|
+
format.borderTop = DEFAULT_BORDER_STYLE;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
(0, setProcessor_1.setProcessor)(event.domToModelOption, 'child', function (group, element, context) {
|
|
50
|
+
var segmentFormat = (0, tslib_1.__assign)({}, context.segmentFormat);
|
|
51
|
+
if (group.blockGroupType === 'TableCell' && group.format.textColor) {
|
|
52
|
+
context.segmentFormat.textColor = group.format.textColor;
|
|
53
|
+
}
|
|
54
|
+
context.defaultElementProcessors.child(group, element, context);
|
|
55
|
+
if (group.blockGroupType === 'TableCell' && group.format.textColor) {
|
|
56
|
+
context.segmentFormat = segmentFormat;
|
|
57
|
+
delete group.format.textColor;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.processPastedContentFromExcel = processPastedContentFromExcel;
|
|
62
|
+
/**
|
|
63
|
+
* @internal Export for test only
|
|
64
|
+
* @param html Source html
|
|
65
|
+
*/
|
|
66
|
+
function excelHandler(html, htmlBefore) {
|
|
67
|
+
if (html.match(LAST_TD_END_REGEX)) {
|
|
68
|
+
var trMatch = htmlBefore.match(LAST_TR_REGEX);
|
|
69
|
+
var tr = trMatch ? trMatch[0] : '<TR>';
|
|
70
|
+
html = tr + html + '</TR>';
|
|
71
|
+
}
|
|
72
|
+
if (html.match(LAST_TR_END_REGEX)) {
|
|
73
|
+
var tableMatch = htmlBefore.match(LAST_TABLE_REGEX);
|
|
74
|
+
var table = tableMatch ? tableMatch[0] : '<TABLE>';
|
|
75
|
+
html = table + html + '</TABLE>';
|
|
76
|
+
}
|
|
77
|
+
return html;
|
|
78
|
+
}
|
|
79
|
+
exports.excelHandler = excelHandler;
|
|
80
|
+
});
|
|
81
81
|
//# sourceMappingURL=processPastedContentFromExcel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPastedContentFromExcel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts"],"names":[],"mappings":";;;;IAMA,IAAM,iBAAiB,GAAG,yCAAyC,CAAC;IACpE,IAAM,iBAAiB,GAAG,4CAA4C,CAAC;IACvE,IAAM,aAAa,GAAG,iBAAiB,CAAC;IACxC,IAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC9C,IAAM,oBAAoB,GAAG,mBAAmB,CAAC;IAEjD;;;;OAIG;IAEH,SAAgB,6BAA6B,CACzC,KAAmC,EACnC,kBAAsC;QAE9B,IAAA,QAAQ,GAAgC,KAAK,SAArC,EAAE,UAAU,GAAoB,KAAK,WAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QACtD,IAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAA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UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtD,IAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACrD,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;SACpC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAbD,oCAaC","sourcesContent":["import addParser from '../utils/addParser';\nimport { isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom';\nimport { setProcessor } from '../utils/setProcessor';\nimport type { TrustedHTMLHandler } from 'roosterjs-editor-types';\nimport type { ContentModelBeforePasteEvent } 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: ContentModelBeforePasteEvent,\n trustedHTMLHandler: TrustedHTMLHandler\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 (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
|
+
{"version":3,"file":"processPastedContentFromExcel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts"],"names":[],"mappings":";;;;IAMA,IAAM,iBAAiB,GAAG,yCAAyC,CAAC;IACpE,IAAM,iBAAiB,GAAG,4CAA4C,CAAC;IACvE,IAAM,aAAa,GAAG,iBAAiB,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CAAC,IAAY,EAAE,UAAkB;QACzD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;YAC/B,IAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAChD,IAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACzC,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC;SAC9B;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;YAC/B,IAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtD,IAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACrD,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;SACpC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAbD,oCAaC","sourcesContent":["import addParser from '../utils/addParser';\r\nimport { isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom';\r\nimport { setProcessor } from '../utils/setProcessor';\r\nimport type { TrustedHTMLHandler } from 'roosterjs-editor-types';\r\nimport type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-types';\r\n\r\nconst LAST_TD_END_REGEX = /<\\/\\s*td\\s*>((?!<\\/\\s*tr\\s*>)[\\s\\S])*$/i;\r\nconst LAST_TR_END_REGEX = /<\\/\\s*tr\\s*>((?!<\\/\\s*table\\s*>)[\\s\\S])*$/i;\r\nconst LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;\r\nconst LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;\r\nconst DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';\r\n\r\n/**\r\n * @internal\r\n * Convert pasted content from Excel, add borders when source doc doesn't have a border\r\n * @param event The BeforePaste event\r\n */\r\n\r\nexport function processPastedContentFromExcel(\r\n event: ContentModelBeforePasteEvent,\r\n trustedHTMLHandler: TrustedHTMLHandler\r\n) {\r\n const { fragment, htmlBefore, clipboardData } = event;\r\n const html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;\r\n\r\n if (html && clipboardData.html != html) {\r\n const doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');\r\n moveChildNodes(fragment, doc?.body);\r\n }\r\n\r\n // For Excel Online\r\n const firstChild = fragment.firstChild;\r\n if (\r\n isNodeOfType(firstChild, 'ELEMENT_NODE') &&\r\n firstChild.tagName == 'div' &&\r\n firstChild.firstChild\r\n ) {\r\n const tableFound = Array.from(firstChild.childNodes).every((child: Node) => {\r\n // Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag\r\n const tagName = isNodeOfType(child, 'ELEMENT_NODE') && child.tagName;\r\n\r\n return tagName == 'META'\r\n ? true\r\n : tagName == 'TABLE'\r\n ? child == firstChild.lastChild\r\n : false;\r\n });\r\n\r\n // Extract Table from Div\r\n if (tableFound && firstChild.lastChild) {\r\n event.fragment.replaceChildren(firstChild.lastChild);\r\n }\r\n }\r\n\r\n addParser(event.domToModelOption, 'tableCell', (format, element) => {\r\n if (element.style.borderStyle === 'none') {\r\n format.borderBottom = DEFAULT_BORDER_STYLE;\r\n format.borderLeft = DEFAULT_BORDER_STYLE;\r\n format.borderRight = DEFAULT_BORDER_STYLE;\r\n format.borderTop = DEFAULT_BORDER_STYLE;\r\n }\r\n });\r\n\r\n setProcessor(event.domToModelOption, 'child', (group, element, context) => {\r\n const segmentFormat = { ...context.segmentFormat };\r\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\r\n context.segmentFormat.textColor = group.format.textColor;\r\n }\r\n\r\n context.defaultElementProcessors.child(group, element, context);\r\n\r\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\r\n context.segmentFormat = segmentFormat;\r\n delete group.format.textColor;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * @internal Export for test only\r\n * @param html Source html\r\n */\r\n\r\nexport function excelHandler(html: string, htmlBefore: string): string {\r\n if (html.match(LAST_TD_END_REGEX)) {\r\n const trMatch = htmlBefore.match(LAST_TR_REGEX);\r\n const tr = trMatch ? trMatch[0] : '<TR>';\r\n html = tr + html + '</TR>';\r\n }\r\n if (html.match(LAST_TR_END_REGEX)) {\r\n const tableMatch = htmlBefore.match(LAST_TABLE_REGEX);\r\n const table = tableMatch ? tableMatch[0] : '<TABLE>';\r\n html = table + html + '</TABLE>';\r\n }\r\n\r\n return html;\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-editor-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* Convert pasted content from PowerPoint
|
|
5
|
-
* @param event The BeforePaste event
|
|
6
|
-
*/
|
|
7
|
-
export declare function processPastedContentFromPowerPoint(event: BeforePasteEvent, trustedHTMLHandler: TrustedHTMLHandler): void;
|
|
1
|
+
import type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-editor-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Convert pasted content from PowerPoint
|
|
5
|
+
* @param event The BeforePaste event
|
|
6
|
+
*/
|
|
7
|
+
export declare function processPastedContentFromPowerPoint(event: BeforePasteEvent, trustedHTMLHandler: TrustedHTMLHandler): void;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.processPastedContentFromPowerPoint = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* Convert pasted content from PowerPoint
|
|
8
|
-
* @param event The BeforePaste event
|
|
9
|
-
*/
|
|
10
|
-
function processPastedContentFromPowerPoint(event, trustedHTMLHandler) {
|
|
11
|
-
var fragment = event.fragment, clipboardData = event.clipboardData;
|
|
12
|
-
if (clipboardData.html && !clipboardData.text && clipboardData.image) {
|
|
13
|
-
// It is possible that PowerPoint copied both image and HTML but not plain text.
|
|
14
|
-
// We always prefer HTML if any.
|
|
15
|
-
var doc = new DOMParser().parseFromString(trustedHTMLHandler(clipboardData.html), 'text/html');
|
|
16
|
-
(0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.processPastedContentFromPowerPoint = processPastedContentFromPowerPoint;
|
|
20
|
-
});
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.processPastedContentFromPowerPoint = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* Convert pasted content from PowerPoint
|
|
8
|
+
* @param event The BeforePaste event
|
|
9
|
+
*/
|
|
10
|
+
function processPastedContentFromPowerPoint(event, trustedHTMLHandler) {
|
|
11
|
+
var fragment = event.fragment, clipboardData = event.clipboardData;
|
|
12
|
+
if (clipboardData.html && !clipboardData.text && clipboardData.image) {
|
|
13
|
+
// It is possible that PowerPoint copied both image and HTML but not plain text.
|
|
14
|
+
// We always prefer HTML if any.
|
|
15
|
+
var doc = new DOMParser().parseFromString(trustedHTMLHandler(clipboardData.html), 'text/html');
|
|
16
|
+
(0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.processPastedContentFromPowerPoint = processPastedContentFromPowerPoint;
|
|
20
|
+
});
|
|
21
21
|
//# sourceMappingURL=processPastedContentFromPowerPoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPastedContentFromPowerPoint.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/PowerPoint/processPastedContentFromPowerPoint.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IAEH,SAAgB,kCAAkC,CAC9C,KAAuB,EACvB,kBAAsC;QAE9B,IAAA,QAAQ,GAAoB,KAAK,SAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QAE1C,IAAI,aAAa,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,aAAa,CAAC,KAAK,EAAE;YAClE,gFAAgF;YAChF,gCAAgC;YAChC,IAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CACvC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,EACtC,WAAW,CACd,CAAC;YAEF,IAAA,4CAAc,EAAC,QAAQ,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,CAAC;SACvC;IACL,CAAC;IAhBD,gFAgBC","sourcesContent":["import { moveChildNodes } from 'roosterjs-content-model-dom';\nimport type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-editor-types';\n\n/**\n * @internal\n * Convert pasted content from PowerPoint\n * @param event The BeforePaste event\n */\n\nexport function processPastedContentFromPowerPoint(\n event: BeforePasteEvent,\n trustedHTMLHandler: TrustedHTMLHandler\n) {\n const { fragment, clipboardData } = event;\n\n if (clipboardData.html && !clipboardData.text && clipboardData.image) {\n // It is possible that PowerPoint copied both image and HTML but not plain text.\n // We always prefer HTML if any.\n const doc = new DOMParser().parseFromString(\n trustedHTMLHandler(clipboardData.html),\n 'text/html'\n );\n\n moveChildNodes(fragment, doc?.body);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"processPastedContentFromPowerPoint.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/PowerPoint/processPastedContentFromPowerPoint.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IAEH,SAAgB,kCAAkC,CAC9C,KAAuB,EACvB,kBAAsC;QAE9B,IAAA,QAAQ,GAAoB,KAAK,SAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QAE1C,IAAI,aAAa,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,aAAa,CAAC,KAAK,EAAE;YAClE,gFAAgF;YAChF,gCAAgC;YAChC,IAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CACvC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,EACtC,WAAW,CACd,CAAC;YAEF,IAAA,4CAAc,EAAC,QAAQ,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,CAAC;SACvC;IACL,CAAC;IAhBD,gFAgBC","sourcesContent":["import { moveChildNodes } from 'roosterjs-content-model-dom';\r\nimport type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-editor-types';\r\n\r\n/**\r\n * @internal\r\n * Convert pasted content from PowerPoint\r\n * @param event The BeforePaste event\r\n */\r\n\r\nexport function processPastedContentFromPowerPoint(\r\n event: BeforePasteEvent,\r\n trustedHTMLHandler: TrustedHTMLHandler\r\n) {\r\n const { fragment, clipboardData } = event;\r\n\r\n if (clipboardData.html && !clipboardData.text && clipboardData.image) {\r\n // It is possible that PowerPoint copied both image and HTML but not plain text.\r\n // We always prefer HTML if any.\r\n const doc = new DOMParser().parseFromString(\r\n trustedHTMLHandler(clipboardData.html),\r\n 'text/html'\r\n );\r\n\r\n moveChildNodes(fragment, doc?.body);\r\n }\r\n}\r\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* Convert pasted content from Office Online
|
|
5
|
-
* Once it is known that the document is from WAC
|
|
6
|
-
* We need to remove the display property and margin from all the list item
|
|
7
|
-
* @param ev ContentModelBeforePasteEvent
|
|
8
|
-
*/
|
|
9
|
-
export declare function processPastedContentWacComponents(ev: ContentModelBeforePasteEvent): void;
|
|
1
|
+
import type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Convert pasted content from Office Online
|
|
5
|
+
* Once it is known that the document is from WAC
|
|
6
|
+
* We need to remove the display property and margin from all the list item
|
|
7
|
+
* @param ev ContentModelBeforePasteEvent
|
|
8
|
+
*/
|
|
9
|
+
export declare function processPastedContentWacComponents(ev: ContentModelBeforePasteEvent): void;
|