roosterjs-content-model-plugins 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/autoFormat/ContentModelAutoFormatPlugin.d.ts +53 -0
- package/lib/autoFormat/ContentModelAutoFormatPlugin.js +81 -0
- package/lib/autoFormat/ContentModelAutoFormatPlugin.js.map +1 -0
- package/lib/autoFormat/keyboardListTrigger.d.ts +5 -0
- package/lib/autoFormat/keyboardListTrigger.js +46 -0
- package/lib/autoFormat/keyboardListTrigger.js.map +1 -0
- package/lib/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
- package/lib/autoFormat/utils/convertAlphaToDecimals.js +23 -0
- package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
- package/lib/autoFormat/utils/getIndex.d.ts +4 -0
- package/lib/autoFormat/utils/getIndex.js +14 -0
- package/lib/autoFormat/utils/getIndex.js.map +1 -0
- package/lib/autoFormat/utils/getListTypeStyle.d.ts +14 -0
- package/lib/autoFormat/utils/getListTypeStyle.js +80 -0
- package/lib/autoFormat/utils/getListTypeStyle.js.map +1 -0
- package/lib/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
- package/lib/autoFormat/utils/getNumberingListStyle.js +153 -0
- package/lib/autoFormat/utils/getNumberingListStyle.js.map +1 -0
- package/lib/edit/ContentModelEditPlugin.d.ts +2 -2
- package/lib/edit/ContentModelEditPlugin.js +1 -3
- package/lib/edit/ContentModelEditPlugin.js.map +1 -1
- package/lib/edit/deleteSteps/deleteList.d.ts +5 -0
- package/lib/edit/deleteSteps/deleteList.js +24 -0
- package/lib/edit/deleteSteps/deleteList.js.map +1 -0
- package/lib/edit/handleKeyboardEventCommon.d.ts +2 -3
- package/lib/edit/handleKeyboardEventCommon.js +1 -1
- package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib/edit/keyboardDelete.d.ts +2 -2
- package/lib/edit/keyboardDelete.js +8 -1
- package/lib/edit/keyboardDelete.js.map +1 -1
- package/lib/edit/keyboardInput.d.ts +2 -2
- package/lib/edit/keyboardInput.js +1 -1
- package/lib/edit/keyboardInput.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/paste/ContentModelPastePlugin.d.ts +2 -2
- package/lib/paste/ContentModelPastePlugin.js +16 -26
- package/lib/paste/ContentModelPastePlugin.js.map +1 -1
- package/lib/paste/Excel/processPastedContentFromExcel.d.ts +2 -3
- package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +1 -1
- package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib/paste/WacComponents/processPastedContentWacComponents.d.ts +2 -2
- package/lib/paste/WacComponents/processPastedContentWacComponents.js +59 -61
- package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib/paste/WordDesktop/getStyleMetadata.d.ts +2 -2
- package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +2 -2
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +2 -0
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib/paste/WordDesktop/processWordLists.js +2 -0
- package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -0
- package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js +14 -0
- package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -0
- package/lib/paste/pasteSourceValidations/constants.d.ts +5 -5
- package/lib/paste/pasteSourceValidations/constants.js +5 -6
- package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib/paste/pasteSourceValidations/getPasteSource.d.ts +1 -2
- package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js +2 -1
- package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js +3 -2
- package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js +2 -1
- package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +2 -1
- package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js +2 -1
- package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib/paste/utils/addParser.d.ts +2 -2
- package/lib/paste/utils/addParser.js.map +1 -1
- package/lib-amd/autoFormat/ContentModelAutoFormatPlugin.d.ts +53 -0
- package/lib-amd/autoFormat/ContentModelAutoFormatPlugin.js +82 -0
- package/lib-amd/autoFormat/ContentModelAutoFormatPlugin.js.map +1 -0
- package/lib-amd/autoFormat/keyboardListTrigger.d.ts +5 -0
- package/lib-amd/autoFormat/keyboardListTrigger.js +44 -0
- package/lib-amd/autoFormat/keyboardListTrigger.js.map +1 -0
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js +25 -0
- package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
- package/lib-amd/autoFormat/utils/getIndex.d.ts +4 -0
- package/lib-amd/autoFormat/utils/getIndex.js +15 -0
- package/lib-amd/autoFormat/utils/getIndex.js.map +1 -0
- package/lib-amd/autoFormat/utils/getListTypeStyle.d.ts +14 -0
- package/lib-amd/autoFormat/utils/getListTypeStyle.js +79 -0
- package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +1 -0
- package/lib-amd/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js +153 -0
- package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +1 -0
- package/lib-amd/edit/ContentModelEditPlugin.d.ts +2 -2
- package/lib-amd/edit/ContentModelEditPlugin.js +1 -3
- package/lib-amd/edit/ContentModelEditPlugin.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteList.d.ts +5 -0
- package/lib-amd/edit/deleteSteps/deleteList.js +25 -0
- package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -0
- package/lib-amd/edit/handleKeyboardEventCommon.d.ts +2 -3
- package/lib-amd/edit/handleKeyboardEventCommon.js +1 -1
- package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-amd/edit/keyboardDelete.d.ts +2 -2
- package/lib-amd/edit/keyboardDelete.js +8 -2
- package/lib-amd/edit/keyboardDelete.js.map +1 -1
- package/lib-amd/edit/keyboardInput.d.ts +2 -2
- package/lib-amd/edit/keyboardInput.js +1 -1
- package/lib-amd/edit/keyboardInput.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js +3 -3
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/paste/ContentModelPastePlugin.d.ts +2 -2
- package/lib-amd/paste/ContentModelPastePlugin.js +16 -27
- package/lib-amd/paste/ContentModelPastePlugin.js.map +1 -1
- package/lib-amd/paste/Excel/processPastedContentFromExcel.d.ts +2 -3
- package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +1 -1
- package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.d.ts +2 -2
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +58 -62
- package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +2 -2
- package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +2 -2
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +2 -1
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processWordLists.js +2 -1
- package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -0
- package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js +16 -0
- package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -0
- package/lib-amd/paste/pasteSourceValidations/constants.d.ts +5 -5
- package/lib-amd/paste/pasteSourceValidations/constants.js +5 -6
- package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.d.ts +1 -2
- package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js +2 -2
- package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js +3 -3
- package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js +2 -2
- package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +2 -2
- package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js +2 -2
- package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-amd/paste/utils/addParser.d.ts +2 -2
- package/lib-amd/paste/utils/addParser.js.map +1 -1
- package/lib-mjs/autoFormat/ContentModelAutoFormatPlugin.d.ts +53 -0
- package/lib-mjs/autoFormat/ContentModelAutoFormatPlugin.js +78 -0
- package/lib-mjs/autoFormat/ContentModelAutoFormatPlugin.js.map +1 -0
- package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +5 -0
- package/lib-mjs/autoFormat/keyboardListTrigger.js +42 -0
- package/lib-mjs/autoFormat/keyboardListTrigger.js.map +1 -0
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js +19 -0
- package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
- package/lib-mjs/autoFormat/utils/getIndex.d.ts +4 -0
- package/lib-mjs/autoFormat/utils/getIndex.js +10 -0
- package/lib-mjs/autoFormat/utils/getIndex.js.map +1 -0
- package/lib-mjs/autoFormat/utils/getListTypeStyle.d.ts +14 -0
- package/lib-mjs/autoFormat/utils/getListTypeStyle.js +76 -0
- package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +1 -0
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js +149 -0
- package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +1 -0
- package/lib-mjs/edit/ContentModelEditPlugin.d.ts +2 -2
- package/lib-mjs/edit/ContentModelEditPlugin.js +1 -3
- package/lib-mjs/edit/ContentModelEditPlugin.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteList.d.ts +5 -0
- package/lib-mjs/edit/deleteSteps/deleteList.js +20 -0
- package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -0
- package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +2 -3
- package/lib-mjs/edit/handleKeyboardEventCommon.js +1 -1
- package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
- package/lib-mjs/edit/keyboardDelete.d.ts +2 -2
- package/lib-mjs/edit/keyboardDelete.js +8 -1
- package/lib-mjs/edit/keyboardDelete.js.map +1 -1
- package/lib-mjs/edit/keyboardInput.d.ts +2 -2
- package/lib-mjs/edit/keyboardInput.js +1 -1
- package/lib-mjs/edit/keyboardInput.js.map +1 -1
- package/lib-mjs/index.d.ts +1 -1
- package/lib-mjs/index.js +1 -1
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/paste/ContentModelPastePlugin.d.ts +2 -2
- package/lib-mjs/paste/ContentModelPastePlugin.js +16 -26
- package/lib-mjs/paste/ContentModelPastePlugin.js.map +1 -1
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.d.ts +2 -3
- package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +1 -1
- package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.d.ts +2 -2
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +59 -61
- package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +2 -2
- package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +2 -2
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +2 -0
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processWordLists.js +2 -0
- package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -0
- package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js +10 -0
- package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -0
- package/lib-mjs/paste/pasteSourceValidations/constants.d.ts +5 -5
- package/lib-mjs/paste/pasteSourceValidations/constants.js +5 -6
- package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.d.ts +1 -2
- package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js +2 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js +3 -2
- package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js +2 -1
- package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +2 -1
- package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js +2 -1
- package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
- package/lib-mjs/paste/utils/addParser.d.ts +2 -2
- package/lib-mjs/paste/utils/addParser.js.map +1 -1
- package/package.json +5 -7
- package/lib/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
- package/lib/entityDelimiter/EntityDelimiterPlugin.js +0 -257
- package/lib/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js +0 -256
- package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js +0 -253
- package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isExcelOnlineDocument.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isExcelOnlineDocument.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"isExcelOnlineDocument.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isExcelOnlineDocument.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAGjD,wCAAwC;AACxC,IAAM,4BAA4B,GAAG,aAAa,CAAC;AAEnD;;;;;GAKG;AACI,IAAM,qBAAqB,GAAsB,UAAA,KAAK;IACjD,IAAA,cAAc,GAAK,KAAK,eAAV,CAAW;IACjC,iJAAiJ;IACjJ,OAAO,CACH,cAAc,CAAC,8BAAkB,CAAC,YAAY,CAAC,IAAI,4BAA4B;QAC/E,cAAc,CAAC,8BAAkB,CAAC,4BAA4B,CAAC,IAAI,SAAS,CAC/E,CAAC;AACN,CAAC,CAAC;AAPW,QAAA,qBAAqB,yBAOhC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\n// Excel Desktop also has this attribute\nconst EXCEL_ONLINE_ATTRIBUTE_VALUE = 'Excel.Sheet';\n\n/**\n * @internal\n * Checks whether the Array provided contains strings that identify Excel Online documents\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isExcelOnlineDocument: GetSourceFunction = props => {\n const { htmlAttributes } = props;\n // The presence of Excel.Sheet confirms its origin from Excel, the absence of EXCEL_DESKTOP_ATTRIBUTE_NAME confirms it is from the Online version\n return (\n htmlAttributes[PastePropertyNames.PROG_ID_NAME] == EXCEL_ONLINE_ATTRIBUTE_VALUE &&\n htmlAttributes[PastePropertyNames.EXCEL_DESKTOP_ATTRIBUTE_NAME] == undefined\n );\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isGoogleSheetDocument = void 0;
|
|
4
|
+
var constants_1 = require("./constants");
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
* Checks whether the fragment provided contain elements from Google sheets
|
|
@@ -9,7 +10,7 @@ exports.isGoogleSheetDocument = void 0;
|
|
|
9
10
|
*/
|
|
10
11
|
var isGoogleSheetDocument = function (props) {
|
|
11
12
|
var fragment = props.fragment;
|
|
12
|
-
return !!fragment.querySelector(
|
|
13
|
+
return !!fragment.querySelector(constants_1.PastePropertyNames.GOOGLE_SHEET_NODE_NAME);
|
|
13
14
|
};
|
|
14
15
|
exports.isGoogleSheetDocument = isGoogleSheetDocument;
|
|
15
16
|
//# sourceMappingURL=isGoogleSheetDocument.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isGoogleSheetDocument.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isGoogleSheetDocument.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"isGoogleSheetDocument.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isGoogleSheetDocument.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAGjD;;;;;GAKG;AACI,IAAM,qBAAqB,GAAsB,UAAA,KAAK;IACjD,IAAA,QAAQ,GAAK,KAAK,SAAV,CAAW;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,8BAAkB,CAAC,sBAAsB,CAAC,CAAC;AAC/E,CAAC,CAAC;AAHW,QAAA,qBAAqB,yBAGhC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\n/**\n * @internal\n * Checks whether the fragment provided contain elements from Google sheets\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isGoogleSheetDocument: GetSourceFunction = props => {\n const { fragment } = props;\n return !!fragment.querySelector(PastePropertyNames.GOOGLE_SHEET_NODE_NAME);\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPowerPointDesktopDocument = void 0;
|
|
4
|
+
var constants_1 = require("./constants");
|
|
4
5
|
var POWERPOINT_ATTRIBUTE_VALUE = 'PowerPoint.Slide';
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
@@ -9,7 +10,7 @@ var POWERPOINT_ATTRIBUTE_VALUE = 'PowerPoint.Slide';
|
|
|
9
10
|
* @returns
|
|
10
11
|
*/
|
|
11
12
|
var isPowerPointDesktopDocument = function (props) {
|
|
12
|
-
return props.htmlAttributes[
|
|
13
|
+
return props.htmlAttributes[constants_1.PastePropertyNames.PROG_ID_NAME] == POWERPOINT_ATTRIBUTE_VALUE;
|
|
13
14
|
};
|
|
14
15
|
exports.isPowerPointDesktopDocument = isPowerPointDesktopDocument;
|
|
15
16
|
//# sourceMappingURL=isPowerPointDesktopDocument.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPowerPointDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"isPowerPointDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAGjD,IAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAEtD;;;;;GAKG;AACI,IAAM,2BAA2B,GAAsB,UAAA,KAAK;IAC/D,OAAO,KAAK,CAAC,cAAc,CAAC,8BAAkB,CAAC,YAAY,CAAC,IAAI,0BAA0B,CAAC;AAC/F,CAAC,CAAC;AAFW,QAAA,2BAA2B,+BAEtC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\nconst POWERPOINT_ATTRIBUTE_VALUE = 'PowerPoint.Slide';\n\n/**\n * @internal\n * Checks whether the Array provided contains strings that identify Power Point Desktop documents\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isPowerPointDesktopDocument: GetSourceFunction = props => {\n return props.htmlAttributes[PastePropertyNames.PROG_ID_NAME] == POWERPOINT_ATTRIBUTE_VALUE;\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isWordDesktopDocument = void 0;
|
|
4
|
+
var constants_1 = require("./constants");
|
|
4
5
|
var WORD_ATTRIBUTE_NAME = 'xmlns:w';
|
|
5
6
|
var WORD_ATTRIBUTE_VALUE = 'urn:schemas-microsoft-com:office:word';
|
|
6
7
|
var WORD_PROG_ID = 'Word.Document';
|
|
@@ -13,7 +14,7 @@ var WORD_PROG_ID = 'Word.Document';
|
|
|
13
14
|
var isWordDesktopDocument = function (props) {
|
|
14
15
|
var htmlAttributes = props.htmlAttributes;
|
|
15
16
|
return (htmlAttributes[WORD_ATTRIBUTE_NAME] == WORD_ATTRIBUTE_VALUE ||
|
|
16
|
-
htmlAttributes[
|
|
17
|
+
htmlAttributes[constants_1.PastePropertyNames.PROG_ID_NAME] == WORD_PROG_ID);
|
|
17
18
|
};
|
|
18
19
|
exports.isWordDesktopDocument = isWordDesktopDocument;
|
|
19
20
|
//# sourceMappingURL=isWordDesktopDocument.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isWordDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isWordDesktopDocument.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"isWordDesktopDocument.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isWordDesktopDocument.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAGjD,IAAM,mBAAmB,GAAG,SAAS,CAAC;AACtC,IAAM,oBAAoB,GAAG,uCAAuC,CAAC;AACrE,IAAM,YAAY,GAAG,eAAe,CAAC;AAErC;;;;;GAKG;AACI,IAAM,qBAAqB,GAAsB,UAAA,KAAK;IACjD,IAAA,cAAc,GAAK,KAAK,eAAV,CAAW;IACjC,OAAO,CACH,cAAc,CAAC,mBAAmB,CAAC,IAAI,oBAAoB;QAC3D,cAAc,CAAC,8BAAkB,CAAC,YAAY,CAAC,IAAI,YAAY,CAClE,CAAC;AACN,CAAC,CAAC;AANW,QAAA,qBAAqB,yBAMhC","sourcesContent":["import { PastePropertyNames } from './constants';\nimport type { GetSourceFunction } from './getPasteSource';\n\nconst WORD_ATTRIBUTE_NAME = 'xmlns:w';\nconst WORD_ATTRIBUTE_VALUE = 'urn:schemas-microsoft-com:office:word';\nconst WORD_PROG_ID = 'Word.Document';\n\n/**\n * @internal\n * Checks whether the Array provided contains strings that identify Word Desktop documents\n * @param props Properties related to the PasteEvent\n * @returns\n */\nexport const isWordDesktopDocument: GetSourceFunction = props => {\n const { htmlAttributes } = props;\n return (\n htmlAttributes[WORD_ATTRIBUTE_NAME] == WORD_ATTRIBUTE_VALUE ||\n htmlAttributes[PastePropertyNames.PROG_ID_NAME] == WORD_PROG_ID\n );\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ContentModelFormatMap, DomToModelOption, FormatParser,
|
|
1
|
+
import type { ContentModelFormatMap, DomToModelOption, FormatParser, ElementFormatParserPerCategory } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export default function addParser<TKey extends keyof
|
|
5
|
+
export default function addParser<TKey extends keyof ElementFormatParserPerCategory>(domToModelOption: DomToModelOption, entry: TKey, additionalFormatParsers: FormatParser<ContentModelFormatMap[TKey]>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addParser.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/addParser.ts"],"names":[],"mappings":";;AAOA;;GAEG;AACH,SAAwB,SAAS,CAC7B,gBAAkC,EAClC,KAAW,EACX,uBAAkE;;IAElE,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE;QAC3C,gBAAgB,CAAC,uBAAuB,GAAG,EAAE,CAAC;KACjD;IACD,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE;QAClD,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;KACxD;IAED,MAAA,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,0CAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnF,CAAC;AAbD,4BAaC","sourcesContent":["import type {\n ContentModelFormatMap,\n DomToModelOption,\n FormatParser,\n
|
|
1
|
+
{"version":3,"file":"addParser.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/addParser.ts"],"names":[],"mappings":";;AAOA;;GAEG;AACH,SAAwB,SAAS,CAC7B,gBAAkC,EAClC,KAAW,EACX,uBAAkE;;IAElE,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE;QAC3C,gBAAgB,CAAC,uBAAuB,GAAG,EAAE,CAAC;KACjD;IACD,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE;QAClD,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;KACxD;IAED,MAAA,gBAAgB,CAAC,uBAAuB,CAAC,KAAK,CAAC,0CAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnF,CAAC;AAbD,4BAaC","sourcesContent":["import type {\n ContentModelFormatMap,\n DomToModelOption,\n FormatParser,\n ElementFormatParserPerCategory,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport default function addParser<TKey extends keyof ElementFormatParserPerCategory>(\n domToModelOption: DomToModelOption,\n entry: TKey,\n additionalFormatParsers: FormatParser<ContentModelFormatMap[TKey]>\n) {\n if (!domToModelOption.additionalFormatParsers) {\n domToModelOption.additionalFormatParsers = {};\n }\n if (!domToModelOption.additionalFormatParsers[entry]) {\n domToModelOption.additionalFormatParsers[entry] = [];\n }\n\n domToModelOption.additionalFormatParsers[entry]?.push(additionalFormatParsers);\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { EditorPlugin, IStandaloneEditor, PluginEvent } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Options to customize the Content Model Auto Format Plugin
|
|
4
|
+
*/
|
|
5
|
+
export declare type AutoFormatOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* When true, after type *, ->, -, --, => , —, > and space key a type of bullet list will be triggered. @default true
|
|
8
|
+
*/
|
|
9
|
+
autoBullet: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When true, after type 1, A, a, i, I followed by ., ), - or between () and space key a type of numbering list will be triggered. @default true
|
|
12
|
+
*/
|
|
13
|
+
autoNumbering: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
|
|
17
|
+
* It can be customized with options to enable or disable auto list features.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ContentModelAutoFormatPlugin implements EditorPlugin {
|
|
20
|
+
private options;
|
|
21
|
+
private editor;
|
|
22
|
+
/**
|
|
23
|
+
* @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
|
|
24
|
+
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to true.
|
|
25
|
+
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to true.
|
|
26
|
+
*/
|
|
27
|
+
constructor(options?: AutoFormatOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Get name of this plugin
|
|
30
|
+
*/
|
|
31
|
+
getName(): string;
|
|
32
|
+
/**
|
|
33
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
34
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
35
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
36
|
+
* @param editor The editor object
|
|
37
|
+
*/
|
|
38
|
+
initialize(editor: IStandaloneEditor): void;
|
|
39
|
+
/**
|
|
40
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
41
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
42
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
43
|
+
*/
|
|
44
|
+
dispose(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
47
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
48
|
+
* exclusively by another plugin.
|
|
49
|
+
* @param event The event to handle:
|
|
50
|
+
*/
|
|
51
|
+
onPluginEvent(event: PluginEvent): void;
|
|
52
|
+
private handleKeyDownEvent;
|
|
53
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
define(["require", "exports", "./keyboardListTrigger"], function (require, exports, keyboardListTrigger_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ContentModelAutoFormatPlugin = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
var DefaultOptions = {
|
|
9
|
+
autoBullet: true,
|
|
10
|
+
autoNumbering: true,
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
|
|
14
|
+
* It can be customized with options to enable or disable auto list features.
|
|
15
|
+
*/
|
|
16
|
+
var ContentModelAutoFormatPlugin = /** @class */ (function () {
|
|
17
|
+
/**
|
|
18
|
+
* @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
|
|
19
|
+
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to true.
|
|
20
|
+
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to true.
|
|
21
|
+
*/
|
|
22
|
+
function ContentModelAutoFormatPlugin(options) {
|
|
23
|
+
if (options === void 0) { options = DefaultOptions; }
|
|
24
|
+
this.options = options;
|
|
25
|
+
this.editor = null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get name of this plugin
|
|
29
|
+
*/
|
|
30
|
+
ContentModelAutoFormatPlugin.prototype.getName = function () {
|
|
31
|
+
return 'ContentModelAutoFormat';
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
35
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
36
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
37
|
+
* @param editor The editor object
|
|
38
|
+
*/
|
|
39
|
+
ContentModelAutoFormatPlugin.prototype.initialize = function (editor) {
|
|
40
|
+
this.editor = editor;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
44
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
45
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
46
|
+
*/
|
|
47
|
+
ContentModelAutoFormatPlugin.prototype.dispose = function () {
|
|
48
|
+
this.editor = null;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
52
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
53
|
+
* exclusively by another plugin.
|
|
54
|
+
* @param event The event to handle:
|
|
55
|
+
*/
|
|
56
|
+
ContentModelAutoFormatPlugin.prototype.onPluginEvent = function (event) {
|
|
57
|
+
if (this.editor) {
|
|
58
|
+
switch (event.eventType) {
|
|
59
|
+
case 'keyDown':
|
|
60
|
+
this.handleKeyDownEvent(this.editor, event);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
ContentModelAutoFormatPlugin.prototype.handleKeyDownEvent = function (editor, event) {
|
|
66
|
+
var rawEvent = event.rawEvent;
|
|
67
|
+
if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {
|
|
68
|
+
switch (rawEvent.key) {
|
|
69
|
+
case ' ':
|
|
70
|
+
var _a = this.options, autoBullet = _a.autoBullet, autoNumbering = _a.autoNumbering;
|
|
71
|
+
if (autoBullet || autoNumbering) {
|
|
72
|
+
(0, keyboardListTrigger_1.keyboardListTrigger)(editor, rawEvent, autoBullet, autoNumbering);
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return ContentModelAutoFormatPlugin;
|
|
79
|
+
}());
|
|
80
|
+
exports.ContentModelAutoFormatPlugin = ContentModelAutoFormatPlugin;
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=ContentModelAutoFormatPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentModelAutoFormatPlugin.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/ContentModelAutoFormatPlugin.ts"],"names":[],"mappings":";;;;IAuBA;;OAEG;IACH,IAAM,cAAc,GAAgC;QAChD,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACtB,CAAC;IAEF;;;OAGG;IACH;QAGI;;;;WAIG;QACH,sCAAoB,OAA2C;YAA3C,wBAAA,EAAA,wBAA2C;YAA3C,YAAO,GAAP,OAAO,CAAoC;YAPvD,WAAM,GAA6B,IAAI,CAAC;QAOkB,CAAC;QAEnE;;WAEG;QACH,8CAAO,GAAP;YACI,OAAO,wBAAwB,CAAC;QACpC,CAAC;QAED;;;;;WAKG;QACH,iDAAU,GAAV,UAAW,MAAyB;YAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;QAED;;;;WAIG;QACH,8CAAO,GAAP;YACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACvB,CAAC;QAED;;;;;WAKG;QACH,oDAAa,GAAb,UAAc,KAAkB;YAC5B,IAAI,IAAI,CAAC,MAAM,EAAE;gBACb,QAAQ,KAAK,CAAC,SAAS,EAAE;oBACrB,KAAK,SAAS;wBACV,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;wBAC5C,MAAM;iBACb;aACJ;QACL,CAAC;QAEO,yDAAkB,GAA1B,UAA2B,MAAyB,EAAE,KAAmB;YACrE,IAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE;gBAC3D,QAAQ,QAAQ,CAAC,GAAG,EAAE;oBAClB,KAAK,GAAG;wBACE,IAAA,KAAgC,IAAI,CAAC,OAAO,EAA1C,UAAU,gBAAA,EAAE,aAAa,mBAAiB,CAAC;wBACnD,IAAI,UAAU,IAAI,aAAa,EAAE;4BAC7B,IAAA,yCAAmB,EAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;yBACpE;wBACD,MAAM;iBACb;aACJ;QACL,CAAC;QACL,mCAAC;IAAD,CAAC,AAjED,IAiEC;IAjEY,oEAA4B","sourcesContent":["import { keyboardListTrigger } from './keyboardListTrigger';\nimport type {\n EditorPlugin,\n IStandaloneEditor,\n KeyDownEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\n/**\n * Options to customize the Content Model Auto Format Plugin\n */\nexport type AutoFormatOptions = {\n /**\n * When true, after type *, ->, -, --, => , —, > and space key a type of bullet list will be triggered. @default true\n */\n autoBullet: boolean;\n\n /**\n * When true, after type 1, A, a, i, I followed by ., ), - or between () and space key a type of numbering list will be triggered. @default true\n */\n autoNumbering: boolean;\n};\n\n/**\n * @internal\n */\nconst DefaultOptions: Required<AutoFormatOptions> = {\n autoBullet: true,\n autoNumbering: true,\n};\n\n/**\n * Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.\n * It can be customized with options to enable or disable auto list features.\n */\nexport class ContentModelAutoFormatPlugin implements EditorPlugin {\n private editor: IStandaloneEditor | null = null;\n\n /**\n * @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:\n * - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to true.\n * - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to true.\n */\n constructor(private options: AutoFormatOptions = DefaultOptions) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'ContentModelAutoFormat';\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: IStandaloneEditor) {\n this.editor = editor;\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 * 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) {\n switch (event.eventType) {\n case 'keyDown':\n this.handleKeyDownEvent(this.editor, event);\n break;\n }\n }\n }\n\n private handleKeyDownEvent(editor: IStandaloneEditor, event: KeyDownEvent) {\n const rawEvent = event.rawEvent;\n if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {\n switch (rawEvent.key) {\n case ' ':\n const { autoBullet, autoNumbering } = this.options;\n if (autoBullet || autoNumbering) {\n keyboardListTrigger(editor, rawEvent, autoBullet, autoNumbering);\n }\n break;\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
define(["require", "exports", "./utils/getListTypeStyle", "roosterjs-content-model-core", "roosterjs-content-model-dom", "roosterjs-content-model-api"], function (require, exports, getListTypeStyle_1, roosterjs_content_model_core_1, roosterjs_content_model_dom_1, roosterjs_content_model_api_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.keyboardListTrigger = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function keyboardListTrigger(editor, rawEvent, shouldSearchForBullet, shouldSearchForNumbering) {
|
|
9
|
+
if (shouldSearchForBullet === void 0) { shouldSearchForBullet = true; }
|
|
10
|
+
if (shouldSearchForNumbering === void 0) { shouldSearchForNumbering = true; }
|
|
11
|
+
editor.formatContentModel(function (model, _context) {
|
|
12
|
+
var listStyleType = (0, getListTypeStyle_1.getListTypeStyle)(model, shouldSearchForBullet, shouldSearchForNumbering);
|
|
13
|
+
if (listStyleType) {
|
|
14
|
+
var segmentsAndParagraphs = (0, roosterjs_content_model_core_1.getSelectedSegmentsAndParagraphs)(model, false);
|
|
15
|
+
if (segmentsAndParagraphs[0] && segmentsAndParagraphs[0][1]) {
|
|
16
|
+
segmentsAndParagraphs[0][1].segments.splice(0, 1);
|
|
17
|
+
}
|
|
18
|
+
var listType = listStyleType.listType, styleType = listStyleType.styleType, index = listStyleType.index;
|
|
19
|
+
triggerList(editor, model, listType, styleType, index);
|
|
20
|
+
rawEvent.preventDefault();
|
|
21
|
+
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.keyboardListTrigger = keyboardListTrigger;
|
|
28
|
+
var triggerList = function (editor, model, listType, styleType, index) {
|
|
29
|
+
(0, roosterjs_content_model_api_1.setListType)(model, listType);
|
|
30
|
+
var isOrderedList = listType == 'OL';
|
|
31
|
+
// If the index < 1, it is a new list, so it will be starting by 1, then no need to set startNumber
|
|
32
|
+
if (index && index > 1 && isOrderedList) {
|
|
33
|
+
(0, roosterjs_content_model_api_1.setListStartNumber)(editor, index);
|
|
34
|
+
}
|
|
35
|
+
(0, roosterjs_content_model_api_1.setListStyle)(editor, isOrderedList
|
|
36
|
+
? {
|
|
37
|
+
orderedStyleType: styleType,
|
|
38
|
+
}
|
|
39
|
+
: {
|
|
40
|
+
unorderedStyleType: styleType,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=keyboardListTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/keyboardListTrigger.ts"],"names":[],"mappings":";;;;IAMA;;OAEG;IACH,SAAgB,mBAAmB,CAC/B,MAAyB,EACzB,QAAuB,EACvB,qBAAqC,EACrC,wBAAwC;QADxC,sCAAA,EAAA,4BAAqC;QACrC,yCAAA,EAAA,+BAAwC;QAExC,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,QAAQ;YACtC,IAAM,aAAa,GAAG,IAAA,mCAAgB,EAClC,KAAK,EACL,qBAAqB,EACrB,wBAAwB,CAC3B,CAAC;YACF,IAAI,aAAa,EAAE;gBACf,IAAM,qBAAqB,GAAG,IAAA,+DAAgC,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAC7E,IAAI,qBAAqB,CAAC,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;oBACzD,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBACrD;gBACO,IAAA,QAAQ,GAAuB,aAAa,SAApC,EAAE,SAAS,GAAY,aAAa,UAAzB,EAAE,KAAK,GAAK,aAAa,MAAlB,CAAmB;gBACrD,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;gBACvD,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAC1B,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;gBAC7B,OAAO,IAAI,CAAC;aACf;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC,CAAC;IACP,CAAC;IAzBD,kDAyBC;IAED,IAAM,WAAW,GAAG,UAChB,MAAyB,EACzB,KAA2B,EAC3B,QAAqB,EACrB,SAAiB,EACjB,KAAc;QAEd,IAAA,yCAAW,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7B,IAAM,aAAa,GAAG,QAAQ,IAAI,IAAI,CAAC;QACvC,mGAAmG;QACnG,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,IAAI,aAAa,EAAE;YACrC,IAAA,gDAAkB,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACrC;QACD,IAAA,0CAAY,EACR,MAAM,EACN,aAAa;YACT,CAAC,CAAC;gBACI,gBAAgB,EAAE,SAAS;aAC9B;YACH,CAAC,CAAC;gBACI,kBAAkB,EAAE,SAAS;aAChC,CACV,CAAC;IACN,CAAC,CAAC","sourcesContent":["import { getListTypeStyle } from './utils/getListTypeStyle';\nimport { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-core';\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport { setListStartNumber, setListStyle, setListType } from 'roosterjs-content-model-api';\nimport type { ContentModelDocument, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardListTrigger(\n editor: IStandaloneEditor,\n rawEvent: KeyboardEvent,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n) {\n editor.formatContentModel((model, _context) => {\n const listStyleType = getListTypeStyle(\n model,\n shouldSearchForBullet,\n shouldSearchForNumbering\n );\n if (listStyleType) {\n const segmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, false);\n if (segmentsAndParagraphs[0] && segmentsAndParagraphs[0][1]) {\n segmentsAndParagraphs[0][1].segments.splice(0, 1);\n }\n const { listType, styleType, index } = listStyleType;\n triggerList(editor, model, listType, styleType, index);\n rawEvent.preventDefault();\n normalizeContentModel(model);\n return true;\n }\n return false;\n });\n}\n\nconst triggerList = (\n editor: IStandaloneEditor,\n model: ContentModelDocument,\n listType: 'OL' | 'UL',\n styleType: number,\n index?: number\n) => {\n setListType(model, listType);\n const isOrderedList = listType == 'OL';\n // If the index < 1, it is a new list, so it will be starting by 1, then no need to set startNumber\n if (index && index > 1 && isOrderedList) {\n setListStartNumber(editor, index);\n }\n setListStyle(\n editor,\n isOrderedList\n ? {\n orderedStyleType: styleType,\n }\n : {\n unorderedStyleType: styleType,\n }\n );\n};\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
define(["require", "exports"], function (require, exports) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.convertAlphaToDecimals = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* Convert english alphabet numbers into decimal numbers
|
|
8
|
+
* @param letter The letter that needs to be converted
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function convertAlphaToDecimals(letter) {
|
|
12
|
+
var alpha = letter.toUpperCase();
|
|
13
|
+
if (alpha) {
|
|
14
|
+
var result = 0;
|
|
15
|
+
for (var i = 0; i < alpha.length; i++) {
|
|
16
|
+
var charCode = alpha.charCodeAt(i) - 65 + 1;
|
|
17
|
+
result = result * 26 + charCode;
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
exports.convertAlphaToDecimals = convertAlphaToDecimals;
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=convertAlphaToDecimals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertAlphaToDecimals.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/convertAlphaToDecimals.ts"],"names":[],"mappings":";;;;IAAA;;;;;OAKG;IACH,SAAgB,sBAAsB,CAAC,MAAc;QACjD,IAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACnC,IAAI,KAAK,EAAE;YACP,IAAI,MAAM,GAAG,CAAC,CAAC;YACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACnC,IAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBAC9C,MAAM,GAAG,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC;aACnC;YAED,OAAO,MAAM,CAAC;SACjB;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAZD,wDAYC","sourcesContent":["/**\n * @internal\n * Convert english alphabet numbers into decimal numbers\n * @param letter The letter that needs to be converted\n * @returns\n */\nexport function convertAlphaToDecimals(letter: string): number | undefined {\n const alpha = letter.toUpperCase();\n if (alpha) {\n let result = 0;\n for (let i = 0; i < alpha.length; i++) {\n const charCode = alpha.charCodeAt(i) - 65 + 1;\n result = result * 26 + charCode;\n }\n\n return result;\n }\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
define(["require", "exports", "./convertAlphaToDecimals"], function (require, exports, convertAlphaToDecimals_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getIndex = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function getIndex(listIndex) {
|
|
9
|
+
var index = listIndex.replace(/[^a-zA-Z0-9 ]/g, '');
|
|
10
|
+
var indexNumber = parseInt(index);
|
|
11
|
+
return !isNaN(indexNumber) ? indexNumber : (0, convertAlphaToDecimals_1.convertAlphaToDecimals)(index);
|
|
12
|
+
}
|
|
13
|
+
exports.getIndex = getIndex;
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=getIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getIndex.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/getIndex.ts"],"names":[],"mappings":";;;;IAEA;;OAEG;IACH,SAAgB,QAAQ,CAAC,SAAiB;QACtC,IAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QACtD,IAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,+CAAsB,EAAC,KAAK,CAAC,CAAC;IAC7E,CAAC;IAJD,4BAIC","sourcesContent":["import { convertAlphaToDecimals } from './convertAlphaToDecimals';\n\n/**\n * @internal\n */\nexport function getIndex(listIndex: string) {\n const index = listIndex.replace(/[^a-zA-Z0-9 ]/g, '');\n const indexNumber = parseInt(index);\n return !isNaN(indexNumber) ? indexNumber : convertAlphaToDecimals(index);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ContentModelDocument } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
interface ListTypeStyle {
|
|
6
|
+
listType: 'UL' | 'OL';
|
|
7
|
+
styleType: number;
|
|
8
|
+
index?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function getListTypeStyle(model: ContentModelDocument, shouldSearchForBullet?: boolean, shouldSearchForNumbering?: boolean): ListTypeStyle | undefined;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
define(["require", "exports", "./getIndex", "./getNumberingListStyle", "roosterjs-content-model-core"], function (require, exports, getIndex_1, getNumberingListStyle_1, roosterjs_content_model_core_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getListTypeStyle = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function getListTypeStyle(model, shouldSearchForBullet, shouldSearchForNumbering) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
if (shouldSearchForBullet === void 0) { shouldSearchForBullet = true; }
|
|
11
|
+
if (shouldSearchForNumbering === void 0) { shouldSearchForNumbering = true; }
|
|
12
|
+
var selectedSegmentsAndParagraphs = (0, roosterjs_content_model_core_1.getSelectedSegmentsAndParagraphs)(model, true);
|
|
13
|
+
var marker = selectedSegmentsAndParagraphs[0][0];
|
|
14
|
+
var paragraph = selectedSegmentsAndParagraphs[0][1];
|
|
15
|
+
var listMarkerSegment = paragraph === null || paragraph === void 0 ? void 0 : paragraph.segments[0];
|
|
16
|
+
if (marker &&
|
|
17
|
+
marker.segmentType == 'SelectionMarker' &&
|
|
18
|
+
listMarkerSegment &&
|
|
19
|
+
listMarkerSegment.segmentType == 'Text') {
|
|
20
|
+
var listMarker = listMarkerSegment.text;
|
|
21
|
+
var bulletType = bulletListType[listMarker];
|
|
22
|
+
if (bulletType && shouldSearchForBullet) {
|
|
23
|
+
return { listType: 'UL', styleType: bulletType };
|
|
24
|
+
}
|
|
25
|
+
else if (shouldSearchForNumbering) {
|
|
26
|
+
var previousList = getPreviousListLevel(model, paragraph);
|
|
27
|
+
var previousListStyle = getPreviousListStyle(previousList);
|
|
28
|
+
var numberingType = (0, getNumberingListStyle_1.getNumberingListStyle)(listMarker, ((_a = previousList === null || previousList === void 0 ? void 0 : previousList.format) === null || _a === void 0 ? void 0 : _a.listStyleType)
|
|
29
|
+
? (0, getIndex_1.getIndex)(previousList.format.listStyleType)
|
|
30
|
+
: undefined, previousListStyle);
|
|
31
|
+
if (numberingType) {
|
|
32
|
+
return {
|
|
33
|
+
listType: 'OL',
|
|
34
|
+
styleType: numberingType,
|
|
35
|
+
index: ((_b = previousList === null || previousList === void 0 ? void 0 : previousList.format) === null || _b === void 0 ? void 0 : _b.listStyleType) ? (0, getIndex_1.getIndex)(listMarker) : undefined,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
exports.getListTypeStyle = getListTypeStyle;
|
|
43
|
+
var getPreviousListLevel = function (model, paragraph) {
|
|
44
|
+
var blocks = (0, roosterjs_content_model_core_1.getOperationalBlocks)(model, ['ListItem'], ['TableCell']);
|
|
45
|
+
var listItem = undefined;
|
|
46
|
+
var listBlock = blocks.filter(function (_a) {
|
|
47
|
+
var block = _a.block, parent = _a.parent;
|
|
48
|
+
return parent.blocks.indexOf(paragraph) > -1;
|
|
49
|
+
})[0];
|
|
50
|
+
if (listBlock) {
|
|
51
|
+
var length_1 = listBlock.parent.blocks.length;
|
|
52
|
+
for (var i = length_1 - 1; i > -1; i--) {
|
|
53
|
+
var item = listBlock.parent.blocks[i];
|
|
54
|
+
if ((0, roosterjs_content_model_core_1.isBlockGroupOfType)(item, 'ListItem')) {
|
|
55
|
+
listItem = item;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return listItem;
|
|
61
|
+
};
|
|
62
|
+
var getPreviousListStyle = function (list) {
|
|
63
|
+
var _a;
|
|
64
|
+
if (list === null || list === void 0 ? void 0 : list.levels[0].dataset) {
|
|
65
|
+
return (_a = (0, roosterjs_content_model_core_1.updateListMetadata)(list.levels[0])) === null || _a === void 0 ? void 0 : _a.orderedStyleType;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var bulletListType = {
|
|
69
|
+
'*': roosterjs_content_model_core_1.BulletListType.Disc,
|
|
70
|
+
'-': roosterjs_content_model_core_1.BulletListType.Dash,
|
|
71
|
+
'--': roosterjs_content_model_core_1.BulletListType.Square,
|
|
72
|
+
'->': roosterjs_content_model_core_1.BulletListType.LongArrow,
|
|
73
|
+
'-->': roosterjs_content_model_core_1.BulletListType.DoubleLongArrow,
|
|
74
|
+
'=>': roosterjs_content_model_core_1.BulletListType.UnfilledArrow,
|
|
75
|
+
'>': roosterjs_content_model_core_1.BulletListType.ShortArrow,
|
|
76
|
+
'—': roosterjs_content_model_core_1.BulletListType.Hyphen,
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=getListTypeStyle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getListTypeStyle.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/getListTypeStyle.ts"],"names":[],"mappings":"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","sourcesContent":["import { getIndex } from './getIndex';\nimport { getNumberingListStyle } from './getNumberingListStyle';\n\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n ContentModelParagraph,\n} from 'roosterjs-content-model-types';\nimport {\n BulletListType,\n isBlockGroupOfType,\n updateListMetadata,\n getOperationalBlocks,\n getSelectedSegmentsAndParagraphs,\n} from 'roosterjs-content-model-core';\n\n/**\n * @internal\n */\ninterface ListTypeStyle {\n listType: 'UL' | 'OL';\n styleType: number;\n index?: number;\n}\n\n/**\n * @internal\n */\nexport function getListTypeStyle(\n model: ContentModelDocument,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n): ListTypeStyle | undefined {\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, true);\n const marker = selectedSegmentsAndParagraphs[0][0];\n const paragraph = selectedSegmentsAndParagraphs[0][1];\n const listMarkerSegment = paragraph?.segments[0];\n\n if (\n marker &&\n marker.segmentType == 'SelectionMarker' &&\n listMarkerSegment &&\n listMarkerSegment.segmentType == 'Text'\n ) {\n const listMarker = listMarkerSegment.text;\n const bulletType = bulletListType[listMarker];\n\n if (bulletType && shouldSearchForBullet) {\n return { listType: 'UL', styleType: bulletType };\n } else if (shouldSearchForNumbering) {\n const previousList = getPreviousListLevel(model, paragraph);\n const previousListStyle = getPreviousListStyle(previousList);\n const numberingType = getNumberingListStyle(\n listMarker,\n previousList?.format?.listStyleType\n ? getIndex(previousList.format.listStyleType)\n : undefined,\n previousListStyle\n );\n if (numberingType) {\n return {\n listType: 'OL',\n styleType: numberingType,\n index: previousList?.format?.listStyleType ? getIndex(listMarker) : undefined,\n };\n }\n }\n }\n return undefined;\n}\n\nconst getPreviousListLevel = (model: ContentModelDocument, paragraph: ContentModelParagraph) => {\n const blocks = getOperationalBlocks(model, ['ListItem'], ['TableCell']);\n let listItem: ContentModelListItem | undefined = undefined;\n const listBlock = blocks.filter(({ block, parent }) => {\n return parent.blocks.indexOf(paragraph) > -1;\n })[0];\n if (listBlock) {\n const length = listBlock.parent.blocks.length;\n for (let i = length - 1; i > -1; i--) {\n const item = listBlock.parent.blocks[i];\n if (isBlockGroupOfType<ContentModelListItem>(item, 'ListItem')) {\n listItem = item;\n break;\n }\n }\n }\n return listItem;\n};\n\nconst getPreviousListStyle = (list?: ContentModelListItem) => {\n if (list?.levels[0].dataset) {\n return updateListMetadata(list.levels[0])?.orderedStyleType;\n }\n};\n\nconst bulletListType: Record<string, number> = {\n '*': BulletListType.Disc,\n '-': BulletListType.Dash,\n '--': BulletListType.Square,\n '->': BulletListType.LongArrow,\n '-->': BulletListType.DoubleLongArrow,\n '=>': BulletListType.UnfilledArrow,\n '>': BulletListType.ShortArrow,\n '—': BulletListType.Hyphen,\n};\n"]}
|