roosterjs-content-model-api 9.41.0 → 9.43.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/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/modelApi/link/getLinkUrl.js +4 -1
- package/lib/modelApi/link/getLinkUrl.js.map +1 -1
- package/lib/modelApi/link/promoteLink.d.ts +8 -1
- package/lib/modelApi/link/promoteLink.js +24 -7
- package/lib/modelApi/link/promoteLink.js.map +1 -1
- package/lib/publicApi/table/insertTable.d.ts +4 -4
- package/lib/publicApi/table/insertTable.js +9 -5
- package/lib/publicApi/table/insertTable.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js +2 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/link/getLinkUrl.js +4 -1
- package/lib-amd/modelApi/link/getLinkUrl.js.map +1 -1
- package/lib-amd/modelApi/link/promoteLink.d.ts +8 -1
- package/lib-amd/modelApi/link/promoteLink.js +24 -7
- package/lib-amd/modelApi/link/promoteLink.js.map +1 -1
- package/lib-amd/publicApi/table/insertTable.d.ts +4 -4
- package/lib-amd/publicApi/table/insertTable.js +9 -6
- package/lib-amd/publicApi/table/insertTable.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/modelApi/link/getLinkUrl.js +4 -1
- package/lib-mjs/modelApi/link/getLinkUrl.js.map +1 -1
- package/lib-mjs/modelApi/link/promoteLink.d.ts +8 -1
- package/lib-mjs/modelApi/link/promoteLink.js +22 -6
- package/lib-mjs/modelApi/link/promoteLink.js.map +1 -1
- package/lib-mjs/publicApi/table/insertTable.d.ts +4 -4
- package/lib-mjs/publicApi/table/insertTable.js +9 -5
- package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export { setModelListStartNumber } from './modelApi/list/setModelListStartNumber
|
|
|
57
57
|
export { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';
|
|
58
58
|
export { setModelIndentation } from './modelApi/block/setModelIndentation';
|
|
59
59
|
export { matchLink } from './modelApi/link/matchLink';
|
|
60
|
-
export { promoteLink } from './modelApi/link/promoteLink';
|
|
60
|
+
export { promoteLink, getPromoteLink } from './modelApi/link/promoteLink';
|
|
61
61
|
export { getListAnnounceData } from './modelApi/list/getListAnnounceData';
|
|
62
62
|
export { queryContentModelBlocks } from './modelApi/common/queryContentModelBlocks';
|
|
63
63
|
export { adjustWordSelection } from './modelApi/selection/adjustWordSelection';
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatParagraphWithContentModel = exports.formatImageWithContentModel = exports.formatTableWithContentModel = exports.createEditorContextForEntity = exports.clearSelectedCells = exports.insertTableColumn = exports.insertTableRow = exports.insertEntity = exports.toggleCode = exports.setParagraphMargin = exports.adjustImageSelection = exports.setImageAltText = exports.adjustLinkSelection = exports.removeLink = exports.insertLink = exports.clearFormat = exports.getFormatState = exports.changeImage = exports.setImageBoxShadow = exports.setImageBorder = exports.setSpacing = exports.toggleBlockQuote = exports.setHeadingLevel = exports.setDirection = exports.setAlignment = exports.setIndentation = exports.setListStartNumber = exports.setListStyle = exports.insertImage = exports.splitTextSegment = exports.changeCapitalization = exports.applySegmentFormat = exports.changeFontSize = exports.setTextColor = exports.setFontSize = exports.setFontName = exports.setBackgroundColor = exports.toggleSuperscript = exports.toggleSubscript = exports.toggleStrikethrough = exports.toggleUnderline = exports.toggleItalic = exports.toggleBold = exports.toggleNumbering = exports.toggleBullet = exports.applyTableBorderFormat = exports.editTable = exports.setTableCellShade = exports.formatTable = exports.insertTable = void 0;
|
|
4
|
-
exports.adjustWordSelection = exports.queryContentModelBlocks = exports.getListAnnounceData = exports.promoteLink = exports.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = exports.formatInsertPointWithContentModel = exports.formatTextSegmentBeforeSelectionMarker = exports.formatSegmentWithContentModel = void 0;
|
|
4
|
+
exports.adjustWordSelection = exports.queryContentModelBlocks = exports.getListAnnounceData = exports.getPromoteLink = exports.promoteLink = exports.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = exports.formatInsertPointWithContentModel = exports.formatTextSegmentBeforeSelectionMarker = exports.formatSegmentWithContentModel = void 0;
|
|
5
5
|
var insertTable_1 = require("./publicApi/table/insertTable");
|
|
6
6
|
Object.defineProperty(exports, "insertTable", { enumerable: true, get: function () { return insertTable_1.insertTable; } });
|
|
7
7
|
var formatTable_1 = require("./publicApi/table/formatTable");
|
|
@@ -122,6 +122,7 @@ var matchLink_1 = require("./modelApi/link/matchLink");
|
|
|
122
122
|
Object.defineProperty(exports, "matchLink", { enumerable: true, get: function () { return matchLink_1.matchLink; } });
|
|
123
123
|
var promoteLink_1 = require("./modelApi/link/promoteLink");
|
|
124
124
|
Object.defineProperty(exports, "promoteLink", { enumerable: true, get: function () { return promoteLink_1.promoteLink; } });
|
|
125
|
+
Object.defineProperty(exports, "getPromoteLink", { enumerable: true, get: function () { return promoteLink_1.getPromoteLink; } });
|
|
125
126
|
var getListAnnounceData_1 = require("./modelApi/list/getListAnnounceData");
|
|
126
127
|
Object.defineProperty(exports, "getListAnnounceData", { enumerable: true, get: function () { return getListAnnounceData_1.getListAnnounceData; } });
|
|
127
128
|
var queryContentModelBlocks_1 = require("./modelApi/common/queryContentModelBlocks");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-api/lib/index.ts"],"names":[],"mappings":";;;;AAAA,6DAA4D;AAAnD,0GAAA,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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-api/lib/index.ts"],"names":[],"mappings":";;;;AAAA,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AACpB,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AACpB,yEAAwE;AAA/D,sHAAA,iBAAiB,OAAA;AAC1B,yDAAwD;AAA/C,sGAAA,SAAS,OAAA;AAClB,mFAAkF;AAAzE,gIAAA,sBAAsB,OAAA;AAC/B,8DAA6D;AAApD,4GAAA,YAAY,OAAA;AACrB,oEAAmE;AAA1D,kHAAA,eAAe,OAAA;AACxB,6DAA4D;AAAnD,wGAAA,UAAU,OAAA;AACnB,iEAAgE;AAAvD,4GAAA,YAAY,OAAA;AACrB,uEAAsE;AAA7D,kHAAA,eAAe,OAAA;AACxB,+EAA8E;AAArE,0HAAA,mBAAmB,OAAA;AAC5B,uEAAsE;AAA7D,kHAAA,eAAe,OAAA;AACxB,2EAA0E;AAAjE,sHAAA,iBAAiB,OAAA;AAC1B,6EAA4E;AAAnE,wHAAA,kBAAkB,OAAA;AAC3B,+DAA8D;AAArD,0GAAA,WAAW,OAAA;AACpB,+DAA8D;AAArD,0GAAA,WAAW,OAAA;AACpB,iEAAgE;AAAvD,4GAAA,YAAY,OAAA;AACrB,qEAAoE;AAA3D,gHAAA,cAAc,OAAA;AACvB,6EAA4E;AAAnE,wHAAA,kBAAkB,OAAA;AAC3B,iFAAgF;AAAvE,4HAAA,oBAAoB,OAAA;AAC7B,yEAAwE;AAA/D,oHAAA,gBAAgB,OAAA;AACzB,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AACpB,8DAA6D;AAApD,4GAAA,YAAY,OAAA;AACrB,0EAAyE;AAAhE,wHAAA,kBAAkB,OAAA;AAC3B,mEAAkE;AAAzD,gHAAA,cAAc,OAAA;AACvB,+DAA8D;AAArD,4GAAA,YAAY,OAAA;AACrB,+DAA8D;AAArD,4GAAA,YAAY,OAAA;AACrB,qE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AAsF;AAA7E,sIAAA,yBAAyB,OAAA;AAClC,4EAA2E;AAAlE,0HAAA,mBAAmB,OAAA;AAC5B,uDAAsD;AAA7C,sGAAA,SAAS,OAAA;AAClB,2DAA0E;AAAjE,0GAAA,WAAW,OAAA;AAAE,6GAAA,cAAc,OAAA;AACpC,2EAA0E;AAAjE,0HAAA,mBAAmB,OAAA;AAC5B,qFAAoF;AAA3E,kIAAA,uBAAuB,OAAA;AAChC,gFAA+E;AAAtE,0HAAA,mBAAmB,OAAA","sourcesContent":["export { insertTable } from './publicApi/table/insertTable';\nexport { formatTable } from './publicApi/table/formatTable';\nexport { setTableCellShade } from './publicApi/table/setTableCellShade';\nexport { editTable } from './publicApi/table/editTable';\nexport { applyTableBorderFormat } from './publicApi/table/applyTableBorderFormat';\nexport { toggleBullet } from './publicApi/list/toggleBullet';\nexport { toggleNumbering } from './publicApi/list/toggleNumbering';\nexport { toggleBold } from './publicApi/segment/toggleBold';\nexport { toggleItalic } from './publicApi/segment/toggleItalic';\nexport { toggleUnderline } from './publicApi/segment/toggleUnderline';\nexport { toggleStrikethrough } from './publicApi/segment/toggleStrikethrough';\nexport { toggleSubscript } from './publicApi/segment/toggleSubscript';\nexport { toggleSuperscript } from './publicApi/segment/toggleSuperscript';\nexport { setBackgroundColor } from './publicApi/segment/setBackgroundColor';\nexport { setFontName } from './publicApi/segment/setFontName';\nexport { setFontSize } from './publicApi/segment/setFontSize';\nexport { setTextColor } from './publicApi/segment/setTextColor';\nexport { changeFontSize } from './publicApi/segment/changeFontSize';\nexport { applySegmentFormat } from './publicApi/segment/applySegmentFormat';\nexport { changeCapitalization } from './publicApi/segment/changeCapitalization';\nexport { splitTextSegment } from './publicApi/segment/splitTextSegment';\nexport { insertImage } from './publicApi/image/insertImage';\nexport { setListStyle } from './publicApi/list/setListStyle';\nexport { setListStartNumber } from './publicApi/list/setListStartNumber';\nexport { setIndentation } from './publicApi/block/setIndentation';\nexport { setAlignment } from './publicApi/block/setAlignment';\nexport { setDirection } from './publicApi/block/setDirection';\nexport { setHeadingLevel } from './publicApi/block/setHeadingLevel';\nexport { toggleBlockQuote } from './publicApi/block/toggleBlockQuote';\nexport { setSpacing } from './publicApi/block/setSpacing';\nexport { setImageBorder } from './publicApi/image/setImageBorder';\nexport { setImageBoxShadow } from './publicApi/image/setImageBoxShadow';\nexport { changeImage } from './publicApi/image/changeImage';\nexport { getFormatState } from './publicApi/format/getFormatState';\nexport { clearFormat } from './publicApi/format/clearFormat';\nexport { insertLink } from './publicApi/link/insertLink';\nexport { removeLink } from './publicApi/link/removeLink';\nexport { adjustLinkSelection } from './publicApi/link/adjustLinkSelection';\nexport { setImageAltText } from './publicApi/image/setImageAltText';\nexport { adjustImageSelection } from './publicApi/image/adjustImageSelection';\nexport { setParagraphMargin } from './publicApi/block/setParagraphMargin';\nexport { toggleCode } from './publicApi/segment/toggleCode';\nexport { insertEntity } from './publicApi/entity/insertEntity';\nexport { insertTableRow } from './modelApi/table/insertTableRow';\nexport { insertTableColumn } from './modelApi/table/insertTableColumn';\nexport { clearSelectedCells } from './modelApi/table/clearSelectedCells';\n\nexport { createEditorContextForEntity } from './publicApi/utils/createEditorContextForEntity';\nexport { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';\nexport { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';\nexport { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';\nexport { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';\nexport { formatTextSegmentBeforeSelectionMarker } from './publicApi/utils/formatTextSegmentBeforeSelectionMarker';\nexport { formatInsertPointWithContentModel } from './publicApi/utils/formatInsertPointWithContentModel';\n\nexport { setListType } from './modelApi/list/setListType';\nexport { setModelListStyle } from './modelApi/list/setModelListStyle';\nexport { setModelListStartNumber } from './modelApi/list/setModelListStartNumber';\nexport { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';\nexport { setModelIndentation } from './modelApi/block/setModelIndentation';\nexport { matchLink } from './modelApi/link/matchLink';\nexport { promoteLink, getPromoteLink } from './modelApi/link/promoteLink';\nexport { getListAnnounceData } from './modelApi/list/getListAnnounceData';\nexport { queryContentModelBlocks } from './modelApi/common/queryContentModelBlocks';\nexport { adjustWordSelection } from './modelApi/selection/adjustWordSelection';\n"]}
|
|
@@ -11,9 +11,12 @@ var MAILTO_REGEX = "(M|m)ailto:" + COMMON_REGEX;
|
|
|
11
11
|
function getLinkUrl(text, autoLinkOptions) {
|
|
12
12
|
var _a;
|
|
13
13
|
var _b = autoLinkOptions !== null && autoLinkOptions !== void 0 ? autoLinkOptions : {}, autoLink = _b.autoLink, autoMailto = _b.autoMailto, autoTel = _b.autoTel;
|
|
14
|
+
var mailtoMatch = matchMailTo(text);
|
|
15
|
+
if (mailtoMatch && !autoMailto) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
14
18
|
var linkMatch = autoLink ? (_a = (0, matchLink_1.matchLink)(text)) === null || _a === void 0 ? void 0 : _a.normalizedUrl : undefined;
|
|
15
19
|
var telMatch = autoTel ? matchTel(text) : undefined;
|
|
16
|
-
var mailtoMatch = autoMailto ? matchMailTo(text) : undefined;
|
|
17
20
|
return linkMatch || telMatch || mailtoMatch;
|
|
18
21
|
}
|
|
19
22
|
exports.getLinkUrl = getLinkUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkUrl.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/getLinkUrl.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAGxC,IAAM,YAAY,GAAG,sBAAwB,CAAC;AAC9C,IAAM,eAAe,GAAG,aAAW,YAAc,CAAC;AAClD,IAAM,YAAY,GAAG,gBAAc,YAAc,CAAC;AAElD;;GAEG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,eAAiC;;IAChE,IAAA,KAAoC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,EAAvD,QAAQ,cAAA,EAAE,UAA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AC,SAAS,CAAC;AAC3E,CAAC","sourcesContent":["import { matchLink } from './matchLink';\nimport type { AutoLinkOptions } from 'roosterjs-content-model-types';\n\nconst COMMON_REGEX = `[\\s]*[a-zA-Z0-9+][\\s]*`;\nconst TELEPHONE_REGEX = `(T|t)el:${COMMON_REGEX}`;\nconst MAILTO_REGEX = `(M|m)ailto:${COMMON_REGEX}`;\n\n/**\n * @internal\n */\nexport function getLinkUrl(text: string, autoLinkOptions?: AutoLinkOptions): string | undefined {\n const { autoLink, autoMailto, autoTel } = autoLinkOptions ?? {};\n const mailtoMatch = matchMailTo(text);\n if (mailtoMatch && !autoMailto) {\n return undefined;\n }\n const linkMatch = autoLink ? matchLink(text)?.normalizedUrl : undefined;\n const telMatch = autoTel ? matchTel(text) : undefined;\n\n return linkMatch || telMatch || mailtoMatch;\n}\n\nfunction matchTel(text: string) {\n return text.match(TELEPHONE_REGEX) ? text.toLocaleLowerCase() : undefined;\n}\n\nfunction matchMailTo(text: string) {\n return text.match(MAILTO_REGEX) ? text.toLocaleLowerCase() : undefined;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AutoLinkOptions, ContentModelText, ShallowMutableContentModelParagraph } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { AutoLinkOptions, ContentModelText, PromotedLink, ShallowMutableContentModelParagraph } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Promote the given text segment to a hyper link when the segment text is ending with a valid link format.
|
|
4
4
|
* When the whole text segment if of a link, promote the whole segment.
|
|
@@ -11,3 +11,10 @@ import type { AutoLinkOptions, ContentModelText, ShallowMutableContentModelParag
|
|
|
11
11
|
* @returns If a link is promoted, return this segment. Otherwise return null
|
|
12
12
|
*/
|
|
13
13
|
export declare function promoteLink(segment: ContentModelText, paragraph: ShallowMutableContentModelParagraph, autoLinkOptions: AutoLinkOptions): ContentModelText | null;
|
|
14
|
+
/**
|
|
15
|
+
* Verify if the link can be promoted
|
|
16
|
+
* @param segment The text segment to search link text from
|
|
17
|
+
* @param options Options of auto link
|
|
18
|
+
* @returns if a link can be promoted
|
|
19
|
+
*/
|
|
20
|
+
export declare function getPromoteLink(segment: ContentModelText, autoLinkOptions: AutoLinkOptions): PromotedLink | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promoteLink = void 0;
|
|
3
|
+
exports.getPromoteLink = exports.promoteLink = void 0;
|
|
4
4
|
var getLinkUrl_1 = require("./getLinkUrl");
|
|
5
5
|
var splitTextSegment_1 = require("../../publicApi/segment/splitTextSegment");
|
|
6
6
|
/**
|
|
@@ -18,14 +18,12 @@ function promoteLink(segment, paragraph, autoLinkOptions) {
|
|
|
18
18
|
if (segment.link) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (url && link && (linkUrl = (0, getLinkUrl_1.getLinkUrl)(url, autoLinkOptions))) {
|
|
25
|
-
var linkSegment = (0, splitTextSegment_1.splitTextSegment)(segment, paragraph, segment.text.length - link.trimLeft().length, segment.text.trimRight().length);
|
|
21
|
+
var promotedLink = getPromoteLink(segment, autoLinkOptions);
|
|
22
|
+
if (promotedLink) {
|
|
23
|
+
var linkSegment = (0, splitTextSegment_1.splitTextSegment)(segment, paragraph, segment.text.length - promotedLink.label.trimLeft().length, segment.text.trimRight().length);
|
|
26
24
|
linkSegment.link = {
|
|
27
25
|
format: {
|
|
28
|
-
href:
|
|
26
|
+
href: promotedLink.href,
|
|
29
27
|
underline: true,
|
|
30
28
|
},
|
|
31
29
|
dataset: {},
|
|
@@ -35,4 +33,23 @@ function promoteLink(segment, paragraph, autoLinkOptions) {
|
|
|
35
33
|
return null;
|
|
36
34
|
}
|
|
37
35
|
exports.promoteLink = promoteLink;
|
|
36
|
+
/**
|
|
37
|
+
* Verify if the link can be promoted
|
|
38
|
+
* @param segment The text segment to search link text from
|
|
39
|
+
* @param options Options of auto link
|
|
40
|
+
* @returns if a link can be promoted
|
|
41
|
+
*/
|
|
42
|
+
function getPromoteLink(segment, autoLinkOptions) {
|
|
43
|
+
var link = segment.text.split(' ').pop();
|
|
44
|
+
var url = link === null || link === void 0 ? void 0 : link.trim();
|
|
45
|
+
var linkUrl = undefined;
|
|
46
|
+
if (url && link && (linkUrl = (0, getLinkUrl_1.getLinkUrl)(url, autoLinkOptions))) {
|
|
47
|
+
return {
|
|
48
|
+
label: link,
|
|
49
|
+
href: linkUrl,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
exports.getPromoteLink = getPromoteLink;
|
|
38
55
|
//# sourceMappingURL=promoteLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promoteLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/promoteLink.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,6EAA4E;
|
|
1
|
+
{"version":3,"file":"promoteLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/promoteLink.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,6EAA4E;AAQ5E;;;;;;;;;;GAUG;AACH,SAAgB,WAAW,CACvB,OAAyB,EACzB,SAA8C,EAC9C,eAAgC;IAEhC,IAAI,OAAO,CAAC,IAAI,EAAE;QACd,OAAO,IAAI,CAAC;KACf;IAED,IAAM,YAAY,GAAG,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAE9D,IAAI,YAAY,EAAE;QACd,IAAM,WAAW,GAAG,IAAA,mCAAgB,EAChC,OAAO,EACP,SAAS,EACT,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,EAC1D,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,CAClC,CAAC;QACF,WAAW,CAAC,IAAI,GAAG;YACf,MAAM,EAAE;gBACJ,IAAI,EAAE,YAAY,CAAC,IAAI;gBACvB,SAAS,EAAE,IAAI;aAClB;YACD,OAAO,EAAE,EAAE;SACd,CAAC;QAEF,OAAO,WAAW,CAAC;KACtB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AA9BD,kCA8BC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAC1B,OAAyB,EACzB,eAAgC;IAEhC,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC3C,IAAM,GAAG,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,EAAE,CAAC;IACzB,IAAI,OAAO,GAAuB,SAAS,CAAC;IAC5C,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,OAAO,GAAG,IAAA,uBAAU,EAAC,GAAG,EAAE,eAAe,CAAC,CAAC,EAAE;QAC7D,OAAO;YACH,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,OAAO;SAChB,CAAC;KACL;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAdD,wCAcC","sourcesContent":["import { getLinkUrl } from './getLinkUrl';\nimport { splitTextSegment } from '../../publicApi/segment/splitTextSegment';\nimport type {\n AutoLinkOptions,\n ContentModelText,\n PromotedLink,\n ShallowMutableContentModelParagraph,\n} from 'roosterjs-content-model-types';\n\n/**\n * Promote the given text segment to a hyper link when the segment text is ending with a valid link format.\n * When the whole text segment if of a link, promote the whole segment.\n * When the text segment ends with a link format, split the segment and promote the second part\n * When link is in middle of the text segment, no action.\n * This is mainly used for doing auto link when there is a link before cursor\n * @param segment The text segment to search link text from\n * @param paragraph Parent paragraph of the segment\n * @param options Options of auto link\n * @returns If a link is promoted, return this segment. Otherwise return null\n */\nexport function promoteLink(\n segment: ContentModelText,\n paragraph: ShallowMutableContentModelParagraph,\n autoLinkOptions: AutoLinkOptions\n): ContentModelText | null {\n if (segment.link) {\n return null;\n }\n\n const promotedLink = getPromoteLink(segment, autoLinkOptions);\n\n if (promotedLink) {\n const linkSegment = splitTextSegment(\n segment,\n paragraph,\n segment.text.length - promotedLink.label.trimLeft().length,\n segment.text.trimRight().length\n );\n linkSegment.link = {\n format: {\n href: promotedLink.href,\n underline: true,\n },\n dataset: {},\n };\n\n return linkSegment;\n }\n\n return null;\n}\n\n/**\n * Verify if the link can be promoted\n * @param segment The text segment to search link text from\n * @param options Options of auto link\n * @returns if a link can be promoted\n */\nexport function getPromoteLink(\n segment: ContentModelText,\n autoLinkOptions: AutoLinkOptions\n): PromotedLink | undefined {\n const link = segment.text.split(' ').pop();\n const url = link?.trim();\n let linkUrl: string | undefined = undefined;\n if (url && link && (linkUrl = getLinkUrl(url, autoLinkOptions))) {\n return {\n label: link,\n href: linkUrl,\n };\n }\n return undefined;\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { ContentModelTableFormat, IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Insert table into editor at current selection
|
|
4
4
|
* @param editor The editor instance
|
|
5
5
|
* @param columns Number of columns in table, it also controls the default table cell width:
|
|
6
6
|
* if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px
|
|
7
7
|
* @param rows Number of rows in table
|
|
8
|
-
* @param
|
|
9
|
-
*
|
|
8
|
+
* @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB
|
|
9
|
+
* @param format (Optional) The table format used for style attributes
|
|
10
10
|
*/
|
|
11
|
-
export declare function insertTable(editor: IEditor, columns: number, rows: number,
|
|
11
|
+
export declare function insertTable(editor: IEditor, columns: number, rows: number, tableMetadataFormat?: Partial<TableMetadataFormat>, format?: ContentModelTableFormat): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.insertTable = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
4
5
|
var adjustIndentation_1 = require("../../modelApi/common/adjustIndentation");
|
|
5
6
|
var createTableStructure_1 = require("../../modelApi/table/createTableStructure");
|
|
6
7
|
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
@@ -10,10 +11,10 @@ var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
|
10
11
|
* @param columns Number of columns in table, it also controls the default table cell width:
|
|
11
12
|
* if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px
|
|
12
13
|
* @param rows Number of rows in table
|
|
13
|
-
* @param
|
|
14
|
-
*
|
|
14
|
+
* @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB
|
|
15
|
+
* @param format (Optional) The table format used for style attributes
|
|
15
16
|
*/
|
|
16
|
-
function insertTable(editor, columns, rows, format) {
|
|
17
|
+
function insertTable(editor, columns, rows, tableMetadataFormat, format) {
|
|
17
18
|
editor.focus();
|
|
18
19
|
editor.formatContentModel(function (model, context) {
|
|
19
20
|
var _a, _b, _c;
|
|
@@ -21,11 +22,14 @@ function insertTable(editor, columns, rows, format) {
|
|
|
21
22
|
if (insertPosition) {
|
|
22
23
|
var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
|
|
23
24
|
var table = (0, createTableStructure_1.createTableStructure)(doc, columns, rows);
|
|
25
|
+
if (format) {
|
|
26
|
+
table.format = (0, tslib_1.__assign)({}, format);
|
|
27
|
+
}
|
|
24
28
|
(0, roosterjs_content_model_dom_1.normalizeTable)(table, editor.getPendingFormat() || insertPosition.marker.format);
|
|
25
29
|
(0, adjustIndentation_1.adjustTableIndentation)(insertPosition, table);
|
|
26
30
|
// Assign default vertical align
|
|
27
|
-
|
|
28
|
-
(0, roosterjs_content_model_dom_1.applyTableFormat)(table,
|
|
31
|
+
tableMetadataFormat = tableMetadataFormat || { verticalAlign: 'top' };
|
|
32
|
+
(0, roosterjs_content_model_dom_1.applyTableFormat)(table, tableMetadataFormat);
|
|
29
33
|
(0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context, {
|
|
30
34
|
insertPosition: insertPosition,
|
|
31
35
|
mergeFormat: 'mergeAll',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/insertTable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"insertTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/insertTable.ts"],"names":[],"mappings":";;;;AAAA,6EAAiF;AACjF,kFAAiF;AACjF,2EAQqC;AAOrC;;;;;;;;GAQG;AACH,SAAgB,WAAW,CACvB,MAAe,EACf,OAAe,EACf,IAAY,EACZ,mBAAkD,EAClD,MAAgC;IAEhC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;;QACX,IAAM,cAAc,GAAG,IAAA,6CAAe,EAAC,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC;QAEvE,IAAI,cAAc,EAAE;YAChB,IAAM,GAAG,GAAG,IAAA,wDAA0B,GAAE,CAAC;YACzC,IAAM,KAAK,GAAG,IAAA,2CAAoB,EAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YACvD,IAAI,MAAM,EAAE;gBACR,KAAK,CAAC,MAAM,6BAAQ,MAAM,CAAE,CAAC;aAChC;YAED,IAAA,4CAAc,EAAC,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEjF,IAAA,0CAAsB,EAAC,cAAc,EAAE,KAAK,CAAC,CAAC;YAE9C,gCAAgC;YAChC,mBAAmB,GAAG,mBAAmB,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;YACtE,IAAA,8CAAgB,EAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;YAC7C,IAAA,wCAAU,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE;gBAC5B,cAAc,gBAAA;gBACd,WAAW,EAAE,UAAU;aAC1B,CAAC,CAAC;YAEH,IAAM,UAAU,GAAG,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YAEtD,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,KAAI,WAAW,EAAE;gBACtC,IAAM,MAAM,GAAG,IAAA,mDAAqB,EAAC,MAAA,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,CAAC;gBACrE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACpC,IAAA,0CAAY,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;aAC/B;YAED,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC;AAjDD,kCAiDC","sourcesContent":["import { adjustTableIndentation } from '../../modelApi/common/adjustIndentation';\nimport { createTableStructure } from '../../modelApi/table/createTableStructure';\nimport {\n createContentModelDocument,\n createSelectionMarker,\n applyTableFormat,\n deleteSelection,\n mergeModel,\n normalizeTable,\n setSelection,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelTableFormat,\n IEditor,\n TableMetadataFormat,\n} from 'roosterjs-content-model-types';\n\n/**\n * Insert table into editor at current selection\n * @param editor The editor instance\n * @param columns Number of columns in table, it also controls the default table cell width:\n * if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px\n * @param rows Number of rows in table\n * @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB\n * @param format (Optional) The table format used for style attributes\n */\nexport function insertTable(\n editor: IEditor,\n columns: number,\n rows: number,\n tableMetadataFormat?: Partial<TableMetadataFormat>,\n format?: ContentModelTableFormat\n) {\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n const insertPosition = deleteSelection(model, [], context).insertPoint;\n\n if (insertPosition) {\n const doc = createContentModelDocument();\n const table = createTableStructure(doc, columns, rows);\n if (format) {\n table.format = { ...format };\n }\n\n normalizeTable(table, editor.getPendingFormat() || insertPosition.marker.format);\n\n adjustTableIndentation(insertPosition, table);\n\n // Assign default vertical align\n tableMetadataFormat = tableMetadataFormat || { verticalAlign: 'top' };\n applyTableFormat(table, tableMetadataFormat);\n mergeModel(model, doc, context, {\n insertPosition,\n mergeFormat: 'mergeAll',\n });\n\n const firstBlock = table.rows[0]?.cells[0]?.blocks[0];\n\n if (firstBlock?.blockType == 'Paragraph') {\n const marker = createSelectionMarker(firstBlock.segments[0]?.format);\n firstBlock.segments.unshift(marker);\n setSelection(model, marker);\n }\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'insertTable',\n }\n );\n}\n"]}
|
package/lib-amd/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export { setModelListStartNumber } from './modelApi/list/setModelListStartNumber
|
|
|
57
57
|
export { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';
|
|
58
58
|
export { setModelIndentation } from './modelApi/block/setModelIndentation';
|
|
59
59
|
export { matchLink } from './modelApi/link/matchLink';
|
|
60
|
-
export { promoteLink } from './modelApi/link/promoteLink';
|
|
60
|
+
export { promoteLink, getPromoteLink } from './modelApi/link/promoteLink';
|
|
61
61
|
export { getListAnnounceData } from './modelApi/list/getListAnnounceData';
|
|
62
62
|
export { queryContentModelBlocks } from './modelApi/common/queryContentModelBlocks';
|
|
63
63
|
export { adjustWordSelection } from './modelApi/selection/adjustWordSelection';
|
package/lib-amd/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "./publicApi/table/insertTable", "./publicApi/table/formatTable", "./publicApi/table/setTableCellShade", "./publicApi/table/editTable", "./publicApi/table/applyTableBorderFormat", "./publicApi/list/toggleBullet", "./publicApi/list/toggleNumbering", "./publicApi/segment/toggleBold", "./publicApi/segment/toggleItalic", "./publicApi/segment/toggleUnderline", "./publicApi/segment/toggleStrikethrough", "./publicApi/segment/toggleSubscript", "./publicApi/segment/toggleSuperscript", "./publicApi/segment/setBackgroundColor", "./publicApi/segment/setFontName", "./publicApi/segment/setFontSize", "./publicApi/segment/setTextColor", "./publicApi/segment/changeFontSize", "./publicApi/segment/applySegmentFormat", "./publicApi/segment/changeCapitalization", "./publicApi/segment/splitTextSegment", "./publicApi/image/insertImage", "./publicApi/list/setListStyle", "./publicApi/list/setListStartNumber", "./publicApi/block/setIndentation", "./publicApi/block/setAlignment", "./publicApi/block/setDirection", "./publicApi/block/setHeadingLevel", "./publicApi/block/toggleBlockQuote", "./publicApi/block/setSpacing", "./publicApi/image/setImageBorder", "./publicApi/image/setImageBoxShadow", "./publicApi/image/changeImage", "./publicApi/format/getFormatState", "./publicApi/format/clearFormat", "./publicApi/link/insertLink", "./publicApi/link/removeLink", "./publicApi/link/adjustLinkSelection", "./publicApi/image/setImageAltText", "./publicApi/image/adjustImageSelection", "./publicApi/block/setParagraphMargin", "./publicApi/segment/toggleCode", "./publicApi/entity/insertEntity", "./modelApi/table/insertTableRow", "./modelApi/table/insertTableColumn", "./modelApi/table/clearSelectedCells", "./publicApi/utils/createEditorContextForEntity", "./publicApi/utils/formatTableWithContentModel", "./publicApi/utils/formatImageWithContentModel", "./publicApi/utils/formatParagraphWithContentModel", "./publicApi/utils/formatSegmentWithContentModel", "./publicApi/utils/formatTextSegmentBeforeSelectionMarker", "./publicApi/utils/formatInsertPointWithContentModel", "./modelApi/list/setListType", "./modelApi/list/setModelListStyle", "./modelApi/list/setModelListStartNumber", "./modelApi/list/findListItemsInSameThread", "./modelApi/block/setModelIndentation", "./modelApi/link/matchLink", "./modelApi/link/promoteLink", "./modelApi/list/getListAnnounceData", "./modelApi/common/queryContentModelBlocks", "./modelApi/selection/adjustWordSelection"], function (require, exports, insertTable_1, formatTable_1, setTableCellShade_1, editTable_1, applyTableBorderFormat_1, toggleBullet_1, toggleNumbering_1, toggleBold_1, toggleItalic_1, toggleUnderline_1, toggleStrikethrough_1, toggleSubscript_1, toggleSuperscript_1, setBackgroundColor_1, setFontName_1, setFontSize_1, setTextColor_1, changeFontSize_1, applySegmentFormat_1, changeCapitalization_1, splitTextSegment_1, insertImage_1, setListStyle_1, setListStartNumber_1, setIndentation_1, setAlignment_1, setDirection_1, setHeadingLevel_1, toggleBlockQuote_1, setSpacing_1, setImageBorder_1, setImageBoxShadow_1, changeImage_1, getFormatState_1, clearFormat_1, insertLink_1, removeLink_1, adjustLinkSelection_1, setImageAltText_1, adjustImageSelection_1, setParagraphMargin_1, toggleCode_1, insertEntity_1, insertTableRow_1, insertTableColumn_1, clearSelectedCells_1, createEditorContextForEntity_1, formatTableWithContentModel_1, formatImageWithContentModel_1, formatParagraphWithContentModel_1, formatSegmentWithContentModel_1, formatTextSegmentBeforeSelectionMarker_1, formatInsertPointWithContentModel_1, setListType_1, setModelListStyle_1, setModelListStartNumber_1, findListItemsInSameThread_1, setModelIndentation_1, matchLink_1, promoteLink_1, getListAnnounceData_1, queryContentModelBlocks_1, adjustWordSelection_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.adjustWordSelection = exports.queryContentModelBlocks = exports.getListAnnounceData = exports.promoteLink = exports.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = exports.formatInsertPointWithContentModel = exports.formatTextSegmentBeforeSelectionMarker = exports.formatSegmentWithContentModel = exports.formatParagraphWithContentModel = exports.formatImageWithContentModel = exports.formatTableWithContentModel = exports.createEditorContextForEntity = exports.clearSelectedCells = exports.insertTableColumn = exports.insertTableRow = exports.insertEntity = exports.toggleCode = exports.setParagraphMargin = exports.adjustImageSelection = exports.setImageAltText = exports.adjustLinkSelection = exports.removeLink = exports.insertLink = exports.clearFormat = exports.getFormatState = exports.changeImage = exports.setImageBoxShadow = exports.setImageBorder = exports.setSpacing = exports.toggleBlockQuote = exports.setHeadingLevel = exports.setDirection = exports.setAlignment = exports.setIndentation = exports.setListStartNumber = exports.setListStyle = exports.insertImage = exports.splitTextSegment = exports.changeCapitalization = exports.applySegmentFormat = exports.changeFontSize = exports.setTextColor = exports.setFontSize = exports.setFontName = exports.setBackgroundColor = exports.toggleSuperscript = exports.toggleSubscript = exports.toggleStrikethrough = exports.toggleUnderline = exports.toggleItalic = exports.toggleBold = exports.toggleNumbering = exports.toggleBullet = exports.applyTableBorderFormat = exports.editTable = exports.setTableCellShade = exports.formatTable = exports.insertTable = void 0;
|
|
4
|
+
exports.adjustWordSelection = exports.queryContentModelBlocks = exports.getListAnnounceData = exports.getPromoteLink = exports.promoteLink = exports.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = exports.formatInsertPointWithContentModel = exports.formatTextSegmentBeforeSelectionMarker = exports.formatSegmentWithContentModel = exports.formatParagraphWithContentModel = exports.formatImageWithContentModel = exports.formatTableWithContentModel = exports.createEditorContextForEntity = exports.clearSelectedCells = exports.insertTableColumn = exports.insertTableRow = exports.insertEntity = exports.toggleCode = exports.setParagraphMargin = exports.adjustImageSelection = exports.setImageAltText = exports.adjustLinkSelection = exports.removeLink = exports.insertLink = exports.clearFormat = exports.getFormatState = exports.changeImage = exports.setImageBoxShadow = exports.setImageBorder = exports.setSpacing = exports.toggleBlockQuote = exports.setHeadingLevel = exports.setDirection = exports.setAlignment = exports.setIndentation = exports.setListStartNumber = exports.setListStyle = exports.insertImage = exports.splitTextSegment = exports.changeCapitalization = exports.applySegmentFormat = exports.changeFontSize = exports.setTextColor = exports.setFontSize = exports.setFontName = exports.setBackgroundColor = exports.toggleSuperscript = exports.toggleSubscript = exports.toggleStrikethrough = exports.toggleUnderline = exports.toggleItalic = exports.toggleBold = exports.toggleNumbering = exports.toggleBullet = exports.applyTableBorderFormat = exports.editTable = exports.setTableCellShade = exports.formatTable = exports.insertTable = void 0;
|
|
5
5
|
Object.defineProperty(exports, "insertTable", { enumerable: true, get: function () { return insertTable_1.insertTable; } });
|
|
6
6
|
Object.defineProperty(exports, "formatTable", { enumerable: true, get: function () { return formatTable_1.formatTable; } });
|
|
7
7
|
Object.defineProperty(exports, "setTableCellShade", { enumerable: true, get: function () { return setTableCellShade_1.setTableCellShade; } });
|
|
@@ -62,6 +62,7 @@ define(["require", "exports", "./publicApi/table/insertTable", "./publicApi/tabl
|
|
|
62
62
|
Object.defineProperty(exports, "setModelIndentation", { enumerable: true, get: function () { return setModelIndentation_1.setModelIndentation; } });
|
|
63
63
|
Object.defineProperty(exports, "matchLink", { enumerable: true, get: function () { return matchLink_1.matchLink; } });
|
|
64
64
|
Object.defineProperty(exports, "promoteLink", { enumerable: true, get: function () { return promoteLink_1.promoteLink; } });
|
|
65
|
+
Object.defineProperty(exports, "getPromoteLink", { enumerable: true, get: function () { return promoteLink_1.getPromoteLink; } });
|
|
65
66
|
Object.defineProperty(exports, "getListAnnounceData", { enumerable: true, get: function () { return getListAnnounceData_1.getListAnnounceData; } });
|
|
66
67
|
Object.defineProperty(exports, "queryContentModelBlocks", { enumerable: true, get: function () { return queryContentModelBlocks_1.queryContentModelBlocks; } });
|
|
67
68
|
Object.defineProperty(exports, "adjustWordSelection", { enumerable: true, get: function () { return adjustWordSelection_1.adjustWordSelection; } });
|
package/lib-amd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../pack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BAA4B,OAAA;IAC5B,0IAAA,2BAA2B,OAAA;IAC3B,0IAAA,2BAA2B,OAAA;IAC3B,kJAAA,+BAA+B,OAAA;IAC/B,8IAAA,6BAA6B,OAAA;IAC7B,gKAAA,sCAAsC,OAAA;IACtC,sJAAA,iCAAiC,OAAA;IAEjC,0GAAA,WAAW,OAAA;IACX,sHAAA,iBAAiB,OAAA;IACjB,kIAAA,uBAAuB,OAAA;IACvB,sIAAA,yBAAyB,OAAA;IACzB,0HAAA,mBAAmB,OAAA;IACnB,sGAAA,SAAS,OAAA;IACT,0GAAA,WAAW,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-api/lib/index.ts"],"names":[],"mappings":";;;;IAAS,0GAAA,WAAW,OAAA;IACX,0GAAA,WAAW,OAAA;IACX,sHAAA,iBAAiB,OAAA;IACjB,sGAAA,SAAS,OAAA;IACT,gIAAA,sBAAsB,OAAA;IACtB,4GAAA,YAAY,OAAA;IACZ,kHAAA,eAAe,OAAA;IACf,wGAAA,UAAU,OAAA;IACV,4GAAA,YAAY,OAAA;IACZ,kHAAA,eAAe,OAAA;IACf,0HAAA,mBAAmB,OAAA;IACnB,kHAAA,eAAe,OAAA;IACf,sHAAA,iBAAiB,OAAA;IACjB,wHAAA,kBAAkB,OAAA;IAClB,0GAAA,WAAW,OAAA;IACX,0GAAA,WAAW,OAAA;IACX,4GAAA,YAAY,OAAA;IACZ,gHAAA,cAAc,OAAA;IACd,wHAAA,kBAAkB,OAAA;IAClB,4HAAA,oBAAoB,OAAA;IACpB,oHAAA,gBAAgB,OAAA;IAChB,0GAAA,WAAW,OAAA;IACX,4GAAA,YAAY,OAAA;IACZ,wHAAA,kBAAkB,OAAA;IAClB,gHAAA,cAAc,OAAA;IACd,4GAAA,YAAY,OAAA;IACZ,4GAAA,YAAY,OAAA;IACZ,kHAAA,eAAe,OAAA;IACf,oHAAA,gBAAgB,OAAA;IAChB,wGAAA,UAAU,OAAA;IACV,gHAAA,cAAc,OAAA;IACd,sHAAA,iBAAiB,OAAA;IACjB,0GAAA,WAAW,OAAA;IACX,gHAAA,cAAc,OAAA;IACd,0GAAA,WAAW,OAAA;IACX,wGAAA,UAAU,OAAA;IACV,wGAAA,UAAU,OAAA;IACV,0HAAA,mBAAmB,OAAA;IACnB,kHAAA,eAAe,OAAA;IACf,4HAAA,oBAAoB,OAAA;IACpB,wHAAA,kBAAkB,OAAA;IAClB,wGAAA,UAAU,OAAA;IACV,4GAAA,YAAY,OAAA;IACZ,gHAAA,cAAc,OAAA;IACd,sHAAA,iBAAiB,OAAA;IACjB,wHAAA,kBAAkB,OAAA;IAElB,4IAAA,4BAA4B,OAAA;IAC5B,0IAAA,2BAA2B,OAAA;IAC3B,0IAAA,2BAA2B,OAAA;IAC3B,kJAAA,+BAA+B,OAAA;IAC/B,8IAAA,6BAA6B,OAAA;IAC7B,gKAAA,sCAAsC,OAAA;IACtC,sJAAA,iCAAiC,OAAA;IAEjC,0GAAA,WAAW,OAAA;IACX,sHAAA,iBAAiB,OAAA;IACjB,kIAAA,uBAAuB,OAAA;IACvB,sIAAA,yBAAyB,OAAA;IACzB,0HAAA,mBAAmB,OAAA;IACnB,sGAAA,SAAS,OAAA;IACT,0GAAA,WAAW,OAAA;IAAE,6GAAA,cAAc,OAAA;IAC3B,0HAAA,mBAAmB,OAAA;IACnB,kIAAA,uBAAuB,OAAA;IACvB,0HAAA,mBAAmB,OAAA","sourcesContent":["export { insertTable } from './publicApi/table/insertTable';\nexport { formatTable } from './publicApi/table/formatTable';\nexport { setTableCellShade } from './publicApi/table/setTableCellShade';\nexport { editTable } from './publicApi/table/editTable';\nexport { applyTableBorderFormat } from './publicApi/table/applyTableBorderFormat';\nexport { toggleBullet } from './publicApi/list/toggleBullet';\nexport { toggleNumbering } from './publicApi/list/toggleNumbering';\nexport { toggleBold } from './publicApi/segment/toggleBold';\nexport { toggleItalic } from './publicApi/segment/toggleItalic';\nexport { toggleUnderline } from './publicApi/segment/toggleUnderline';\nexport { toggleStrikethrough } from './publicApi/segment/toggleStrikethrough';\nexport { toggleSubscript } from './publicApi/segment/toggleSubscript';\nexport { toggleSuperscript } from './publicApi/segment/toggleSuperscript';\nexport { setBackgroundColor } from './publicApi/segment/setBackgroundColor';\nexport { setFontName } from './publicApi/segment/setFontName';\nexport { setFontSize } from './publicApi/segment/setFontSize';\nexport { setTextColor } from './publicApi/segment/setTextColor';\nexport { changeFontSize } from './publicApi/segment/changeFontSize';\nexport { applySegmentFormat } from './publicApi/segment/applySegmentFormat';\nexport { changeCapitalization } from './publicApi/segment/changeCapitalization';\nexport { splitTextSegment } from './publicApi/segment/splitTextSegment';\nexport { insertImage } from './publicApi/image/insertImage';\nexport { setListStyle } from './publicApi/list/setListStyle';\nexport { setListStartNumber } from './publicApi/list/setListStartNumber';\nexport { setIndentation } from './publicApi/block/setIndentation';\nexport { setAlignment } from './publicApi/block/setAlignment';\nexport { setDirection } from './publicApi/block/setDirection';\nexport { setHeadingLevel } from './publicApi/block/setHeadingLevel';\nexport { toggleBlockQuote } from './publicApi/block/toggleBlockQuote';\nexport { setSpacing } from './publicApi/block/setSpacing';\nexport { setImageBorder } from './publicApi/image/setImageBorder';\nexport { setImageBoxShadow } from './publicApi/image/setImageBoxShadow';\nexport { changeImage } from './publicApi/image/changeImage';\nexport { getFormatState } from './publicApi/format/getFormatState';\nexport { clearFormat } from './publicApi/format/clearFormat';\nexport { insertLink } from './publicApi/link/insertLink';\nexport { removeLink } from './publicApi/link/removeLink';\nexport { adjustLinkSelection } from './publicApi/link/adjustLinkSelection';\nexport { setImageAltText } from './publicApi/image/setImageAltText';\nexport { adjustImageSelection } from './publicApi/image/adjustImageSelection';\nexport { setParagraphMargin } from './publicApi/block/setParagraphMargin';\nexport { toggleCode } from './publicApi/segment/toggleCode';\nexport { insertEntity } from './publicApi/entity/insertEntity';\nexport { insertTableRow } from './modelApi/table/insertTableRow';\nexport { insertTableColumn } from './modelApi/table/insertTableColumn';\nexport { clearSelectedCells } from './modelApi/table/clearSelectedCells';\n\nexport { createEditorContextForEntity } from './publicApi/utils/createEditorContextForEntity';\nexport { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';\nexport { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';\nexport { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';\nexport { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';\nexport { formatTextSegmentBeforeSelectionMarker } from './publicApi/utils/formatTextSegmentBeforeSelectionMarker';\nexport { formatInsertPointWithContentModel } from './publicApi/utils/formatInsertPointWithContentModel';\n\nexport { setListType } from './modelApi/list/setListType';\nexport { setModelListStyle } from './modelApi/list/setModelListStyle';\nexport { setModelListStartNumber } from './modelApi/list/setModelListStartNumber';\nexport { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';\nexport { setModelIndentation } from './modelApi/block/setModelIndentation';\nexport { matchLink } from './modelApi/link/matchLink';\nexport { promoteLink, getPromoteLink } from './modelApi/link/promoteLink';\nexport { getListAnnounceData } from './modelApi/list/getListAnnounceData';\nexport { queryContentModelBlocks } from './modelApi/common/queryContentModelBlocks';\nexport { adjustWordSelection } from './modelApi/selection/adjustWordSelection';\n"]}
|
|
@@ -11,9 +11,12 @@ define(["require", "exports", "./matchLink"], function (require, exports, matchL
|
|
|
11
11
|
function getLinkUrl(text, autoLinkOptions) {
|
|
12
12
|
var _a;
|
|
13
13
|
var _b = autoLinkOptions !== null && autoLinkOptions !== void 0 ? autoLinkOptions : {}, autoLink = _b.autoLink, autoMailto = _b.autoMailto, autoTel = _b.autoTel;
|
|
14
|
+
var mailtoMatch = matchMailTo(text);
|
|
15
|
+
if (mailtoMatch && !autoMailto) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
14
18
|
var linkMatch = autoLink ? (_a = (0, matchLink_1.matchLink)(text)) === null || _a === void 0 ? void 0 : _a.normalizedUrl : undefined;
|
|
15
19
|
var telMatch = autoTel ? matchTel(text) : undefined;
|
|
16
|
-
var mailtoMatch = autoMailto ? matchMailTo(text) : undefined;
|
|
17
20
|
return linkMatch || telMatch || mailtoMatch;
|
|
18
21
|
}
|
|
19
22
|
exports.getLinkUrl = getLinkUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkUrl.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/getLinkUrl.ts"],"names":[],"mappings":";;;;IAGA,IAAM,YAAY,GAAG,sBAAwB,CAAC;IAC9C,IAAM,eAAe,GAAG,aAAW,YAAc,CAAC;IAClD,IAAM,YAAY,GAAG,gBAAc,YAAc,CAAC;IAElD;;OAEG;IACH,SAAgB,UAAU,CAAC,IAAY,EAAE,eAAiC;;QAChE,IAAA,KAAoC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,EAAvD,QAAQ,cAAA,EAAE,UAAU,gBAAA,EAAE,OAAO,aAA0B,CAAC;QAChE,IAAM,
|
|
1
|
+
{"version":3,"file":"getLinkUrl.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/getLinkUrl.ts"],"names":[],"mappings":";;;;IAGA,IAAM,YAAY,GAAG,sBAAwB,CAAC;IAC9C,IAAM,eAAe,GAAG,aAAW,YAAc,CAAC;IAClD,IAAM,YAAY,GAAG,gBAAc,YAAc,CAAC;IAElD;;OAEG;IACH,SAAgB,UAAU,CAAC,IAAY,EAAE,eAAiC;;QAChE,IAAA,KAAoC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,EAAvD,QAAQ,cAAA,EAAE,UAAU,gBAAA,EAAE,OAAO,aAA0B,CAAC;QAChE,IAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,WAAW,IAAI,CAAC,UAAU,EAAE;YAC5B,OAAO,SAAS,CAAC;SACpB;QACD,IAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAA,IAAA,qBAAS,EAAC,IAAI,CAAC,0CAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;QACxE,IAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEtD,OAAO,SAAS,IAAI,QAAQ,IAAI,WAAW,CAAC;IAChD,CAAC;IAVD,gCAUC;IAED,SAAS,QAAQ,CAAC,IAAY;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,CAAC;IAED,SAAS,WAAW,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,CAAC","sourcesContent":["import { matchLink } from './matchLink';\nimport type { AutoLinkOptions } from 'roosterjs-content-model-types';\n\nconst COMMON_REGEX = `[\\s]*[a-zA-Z0-9+][\\s]*`;\nconst TELEPHONE_REGEX = `(T|t)el:${COMMON_REGEX}`;\nconst MAILTO_REGEX = `(M|m)ailto:${COMMON_REGEX}`;\n\n/**\n * @internal\n */\nexport function getLinkUrl(text: string, autoLinkOptions?: AutoLinkOptions): string | undefined {\n const { autoLink, autoMailto, autoTel } = autoLinkOptions ?? {};\n const mailtoMatch = matchMailTo(text);\n if (mailtoMatch && !autoMailto) {\n return undefined;\n }\n const linkMatch = autoLink ? matchLink(text)?.normalizedUrl : undefined;\n const telMatch = autoTel ? matchTel(text) : undefined;\n\n return linkMatch || telMatch || mailtoMatch;\n}\n\nfunction matchTel(text: string) {\n return text.match(TELEPHONE_REGEX) ? text.toLocaleLowerCase() : undefined;\n}\n\nfunction matchMailTo(text: string) {\n return text.match(MAILTO_REGEX) ? text.toLocaleLowerCase() : undefined;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AutoLinkOptions, ContentModelText, ShallowMutableContentModelParagraph } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { AutoLinkOptions, ContentModelText, PromotedLink, ShallowMutableContentModelParagraph } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Promote the given text segment to a hyper link when the segment text is ending with a valid link format.
|
|
4
4
|
* When the whole text segment if of a link, promote the whole segment.
|
|
@@ -11,3 +11,10 @@ import type { AutoLinkOptions, ContentModelText, ShallowMutableContentModelParag
|
|
|
11
11
|
* @returns If a link is promoted, return this segment. Otherwise return null
|
|
12
12
|
*/
|
|
13
13
|
export declare function promoteLink(segment: ContentModelText, paragraph: ShallowMutableContentModelParagraph, autoLinkOptions: AutoLinkOptions): ContentModelText | null;
|
|
14
|
+
/**
|
|
15
|
+
* Verify if the link can be promoted
|
|
16
|
+
* @param segment The text segment to search link text from
|
|
17
|
+
* @param options Options of auto link
|
|
18
|
+
* @returns if a link can be promoted
|
|
19
|
+
*/
|
|
20
|
+
export declare function getPromoteLink(segment: ContentModelText, autoLinkOptions: AutoLinkOptions): PromotedLink | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "./getLinkUrl", "../../publicApi/segment/splitTextSegment"], function (require, exports, getLinkUrl_1, splitTextSegment_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.promoteLink = void 0;
|
|
4
|
+
exports.getPromoteLink = exports.promoteLink = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* Promote the given text segment to a hyper link when the segment text is ending with a valid link format.
|
|
7
7
|
* When the whole text segment if of a link, promote the whole segment.
|
|
@@ -17,14 +17,12 @@ define(["require", "exports", "./getLinkUrl", "../../publicApi/segment/splitText
|
|
|
17
17
|
if (segment.link) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (url && link && (linkUrl = (0, getLinkUrl_1.getLinkUrl)(url, autoLinkOptions))) {
|
|
24
|
-
var linkSegment = (0, splitTextSegment_1.splitTextSegment)(segment, paragraph, segment.text.length - link.trimLeft().length, segment.text.trimRight().length);
|
|
20
|
+
var promotedLink = getPromoteLink(segment, autoLinkOptions);
|
|
21
|
+
if (promotedLink) {
|
|
22
|
+
var linkSegment = (0, splitTextSegment_1.splitTextSegment)(segment, paragraph, segment.text.length - promotedLink.label.trimLeft().length, segment.text.trimRight().length);
|
|
25
23
|
linkSegment.link = {
|
|
26
24
|
format: {
|
|
27
|
-
href:
|
|
25
|
+
href: promotedLink.href,
|
|
28
26
|
underline: true,
|
|
29
27
|
},
|
|
30
28
|
dataset: {},
|
|
@@ -34,5 +32,24 @@ define(["require", "exports", "./getLinkUrl", "../../publicApi/segment/splitText
|
|
|
34
32
|
return null;
|
|
35
33
|
}
|
|
36
34
|
exports.promoteLink = promoteLink;
|
|
35
|
+
/**
|
|
36
|
+
* Verify if the link can be promoted
|
|
37
|
+
* @param segment The text segment to search link text from
|
|
38
|
+
* @param options Options of auto link
|
|
39
|
+
* @returns if a link can be promoted
|
|
40
|
+
*/
|
|
41
|
+
function getPromoteLink(segment, autoLinkOptions) {
|
|
42
|
+
var link = segment.text.split(' ').pop();
|
|
43
|
+
var url = link === null || link === void 0 ? void 0 : link.trim();
|
|
44
|
+
var linkUrl = undefined;
|
|
45
|
+
if (url && link && (linkUrl = (0, getLinkUrl_1.getLinkUrl)(url, autoLinkOptions))) {
|
|
46
|
+
return {
|
|
47
|
+
label: link,
|
|
48
|
+
href: linkUrl,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
exports.getPromoteLink = getPromoteLink;
|
|
37
54
|
});
|
|
38
55
|
//# sourceMappingURL=promoteLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promoteLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/promoteLink.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"promoteLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/promoteLink.ts"],"names":[],"mappings":";;;;IASA;;;;;;;;;;OAUG;IACH,SAAgB,WAAW,CACvB,OAAyB,EACzB,SAA8C,EAC9C,eAAgC;QAEhC,IAAI,OAAO,CAAC,IAAI,EAAE;YACd,OAAO,IAAI,CAAC;SACf;QAED,IAAM,YAAY,GAAG,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAE9D,IAAI,YAAY,EAAE;YACd,IAAM,WAAW,GAAG,IAAA,mCAAgB,EAChC,OAAO,EACP,SAAS,EACT,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,EAC1D,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,CAClC,CAAC;YACF,WAAW,CAAC,IAAI,GAAG;gBACf,MAAM,EAAE;oBACJ,IAAI,EAAE,YAAY,CAAC,IAAI;oBACvB,SAAS,EAAE,IAAI;iBAClB;gBACD,OAAO,EAAE,EAAE;aACd,CAAC;YAEF,OAAO,WAAW,CAAC;SACtB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IA9BD,kCA8BC;IAED;;;;;OAKG;IACH,SAAgB,cAAc,CAC1B,OAAyB,EACzB,eAAgC;QAEhC,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAC3C,IAAM,GAAG,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,EAAE,CAAC;QACzB,IAAI,OAAO,GAAuB,SAAS,CAAC;QAC5C,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,OAAO,GAAG,IAAA,uBAAU,EAAC,GAAG,EAAE,eAAe,CAAC,CAAC,EAAE;YAC7D,OAAO;gBACH,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,OAAO;aAChB,CAAC;SACL;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAdD,wCAcC","sourcesContent":["import { getLinkUrl } from './getLinkUrl';\nimport { splitTextSegment } from '../../publicApi/segment/splitTextSegment';\nimport type {\n AutoLinkOptions,\n ContentModelText,\n PromotedLink,\n ShallowMutableContentModelParagraph,\n} from 'roosterjs-content-model-types';\n\n/**\n * Promote the given text segment to a hyper link when the segment text is ending with a valid link format.\n * When the whole text segment if of a link, promote the whole segment.\n * When the text segment ends with a link format, split the segment and promote the second part\n * When link is in middle of the text segment, no action.\n * This is mainly used for doing auto link when there is a link before cursor\n * @param segment The text segment to search link text from\n * @param paragraph Parent paragraph of the segment\n * @param options Options of auto link\n * @returns If a link is promoted, return this segment. Otherwise return null\n */\nexport function promoteLink(\n segment: ContentModelText,\n paragraph: ShallowMutableContentModelParagraph,\n autoLinkOptions: AutoLinkOptions\n): ContentModelText | null {\n if (segment.link) {\n return null;\n }\n\n const promotedLink = getPromoteLink(segment, autoLinkOptions);\n\n if (promotedLink) {\n const linkSegment = splitTextSegment(\n segment,\n paragraph,\n segment.text.length - promotedLink.label.trimLeft().length,\n segment.text.trimRight().length\n );\n linkSegment.link = {\n format: {\n href: promotedLink.href,\n underline: true,\n },\n dataset: {},\n };\n\n return linkSegment;\n }\n\n return null;\n}\n\n/**\n * Verify if the link can be promoted\n * @param segment The text segment to search link text from\n * @param options Options of auto link\n * @returns if a link can be promoted\n */\nexport function getPromoteLink(\n segment: ContentModelText,\n autoLinkOptions: AutoLinkOptions\n): PromotedLink | undefined {\n const link = segment.text.split(' ').pop();\n const url = link?.trim();\n let linkUrl: string | undefined = undefined;\n if (url && link && (linkUrl = getLinkUrl(url, autoLinkOptions))) {\n return {\n label: link,\n href: linkUrl,\n };\n }\n return undefined;\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { ContentModelTableFormat, IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Insert table into editor at current selection
|
|
4
4
|
* @param editor The editor instance
|
|
5
5
|
* @param columns Number of columns in table, it also controls the default table cell width:
|
|
6
6
|
* if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px
|
|
7
7
|
* @param rows Number of rows in table
|
|
8
|
-
* @param
|
|
9
|
-
*
|
|
8
|
+
* @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB
|
|
9
|
+
* @param format (Optional) The table format used for style attributes
|
|
10
10
|
*/
|
|
11
|
-
export declare function insertTable(editor: IEditor, columns: number, rows: number,
|
|
11
|
+
export declare function insertTable(editor: IEditor, columns: number, rows: number, tableMetadataFormat?: Partial<TableMetadataFormat>, format?: ContentModelTableFormat): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "../../modelApi/common/adjustIndentation", "../../modelApi/table/createTableStructure", "roosterjs-content-model-dom"], function (require, exports, adjustIndentation_1, createTableStructure_1, roosterjs_content_model_dom_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "../../modelApi/common/adjustIndentation", "../../modelApi/table/createTableStructure", "roosterjs-content-model-dom"], function (require, exports, tslib_1, adjustIndentation_1, createTableStructure_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.insertTable = void 0;
|
|
@@ -8,10 +8,10 @@ define(["require", "exports", "../../modelApi/common/adjustIndentation", "../../
|
|
|
8
8
|
* @param columns Number of columns in table, it also controls the default table cell width:
|
|
9
9
|
* if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px
|
|
10
10
|
* @param rows Number of rows in table
|
|
11
|
-
* @param
|
|
12
|
-
*
|
|
11
|
+
* @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB
|
|
12
|
+
* @param format (Optional) The table format used for style attributes
|
|
13
13
|
*/
|
|
14
|
-
function insertTable(editor, columns, rows, format) {
|
|
14
|
+
function insertTable(editor, columns, rows, tableMetadataFormat, format) {
|
|
15
15
|
editor.focus();
|
|
16
16
|
editor.formatContentModel(function (model, context) {
|
|
17
17
|
var _a, _b, _c;
|
|
@@ -19,11 +19,14 @@ define(["require", "exports", "../../modelApi/common/adjustIndentation", "../../
|
|
|
19
19
|
if (insertPosition) {
|
|
20
20
|
var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
|
|
21
21
|
var table = (0, createTableStructure_1.createTableStructure)(doc, columns, rows);
|
|
22
|
+
if (format) {
|
|
23
|
+
table.format = (0, tslib_1.__assign)({}, format);
|
|
24
|
+
}
|
|
22
25
|
(0, roosterjs_content_model_dom_1.normalizeTable)(table, editor.getPendingFormat() || insertPosition.marker.format);
|
|
23
26
|
(0, adjustIndentation_1.adjustTableIndentation)(insertPosition, table);
|
|
24
27
|
// Assign default vertical align
|
|
25
|
-
|
|
26
|
-
(0, roosterjs_content_model_dom_1.applyTableFormat)(table,
|
|
28
|
+
tableMetadataFormat = tableMetadataFormat || { verticalAlign: 'top' };
|
|
29
|
+
(0, roosterjs_content_model_dom_1.applyTableFormat)(table, tableMetadataFormat);
|
|
27
30
|
(0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context, {
|
|
28
31
|
insertPosition: insertPosition,
|
|
29
32
|
mergeFormat: 'mergeAll',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/insertTable.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"insertTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/insertTable.ts"],"names":[],"mappings":";;;;I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GAAG,IAAA,mDAAqB,EAAC,MAAA,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,CAAC;oBACrE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;oBACpC,IAAA,0CAAY,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;iBAC/B;gBAED,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD;YACI,OAAO,EAAE,aAAa;SACzB,CACJ,CAAC;IACN,CAAC;IAjDD,kCAiDC","sourcesContent":["import { adjustTableIndentation } from '../../modelApi/common/adjustIndentation';\nimport { createTableStructure } from '../../modelApi/table/createTableStructure';\nimport {\n createContentModelDocument,\n createSelectionMarker,\n applyTableFormat,\n deleteSelection,\n mergeModel,\n normalizeTable,\n setSelection,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelTableFormat,\n IEditor,\n TableMetadataFormat,\n} from 'roosterjs-content-model-types';\n\n/**\n * Insert table into editor at current selection\n * @param editor The editor instance\n * @param columns Number of columns in table, it also controls the default table cell width:\n * if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px\n * @param rows Number of rows in table\n * @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB\n * @param format (Optional) The table format used for style attributes\n */\nexport function insertTable(\n editor: IEditor,\n columns: number,\n rows: number,\n tableMetadataFormat?: Partial<TableMetadataFormat>,\n format?: ContentModelTableFormat\n) {\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n const insertPosition = deleteSelection(model, [], context).insertPoint;\n\n if (insertPosition) {\n const doc = createContentModelDocument();\n const table = createTableStructure(doc, columns, rows);\n if (format) {\n table.format = { ...format };\n }\n\n normalizeTable(table, editor.getPendingFormat() || insertPosition.marker.format);\n\n adjustTableIndentation(insertPosition, table);\n\n // Assign default vertical align\n tableMetadataFormat = tableMetadataFormat || { verticalAlign: 'top' };\n applyTableFormat(table, tableMetadataFormat);\n mergeModel(model, doc, context, {\n insertPosition,\n mergeFormat: 'mergeAll',\n });\n\n const firstBlock = table.rows[0]?.cells[0]?.blocks[0];\n\n if (firstBlock?.blockType == 'Paragraph') {\n const marker = createSelectionMarker(firstBlock.segments[0]?.format);\n firstBlock.segments.unshift(marker);\n setSelection(model, marker);\n }\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'insertTable',\n }\n );\n}\n"]}
|
package/lib-mjs/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export { setModelListStartNumber } from './modelApi/list/setModelListStartNumber
|
|
|
57
57
|
export { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';
|
|
58
58
|
export { setModelIndentation } from './modelApi/block/setModelIndentation';
|
|
59
59
|
export { matchLink } from './modelApi/link/matchLink';
|
|
60
|
-
export { promoteLink } from './modelApi/link/promoteLink';
|
|
60
|
+
export { promoteLink, getPromoteLink } from './modelApi/link/promoteLink';
|
|
61
61
|
export { getListAnnounceData } from './modelApi/list/getListAnnounceData';
|
|
62
62
|
export { queryContentModelBlocks } from './modelApi/common/queryContentModelBlocks';
|
|
63
63
|
export { adjustWordSelection } from './modelApi/selection/adjustWordSelection';
|
package/lib-mjs/index.js
CHANGED
|
@@ -57,7 +57,7 @@ export { setModelListStartNumber } from './modelApi/list/setModelListStartNumber
|
|
|
57
57
|
export { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';
|
|
58
58
|
export { setModelIndentation } from './modelApi/block/setModelIndentation';
|
|
59
59
|
export { matchLink } from './modelApi/link/matchLink';
|
|
60
|
-
export { promoteLink } from './modelApi/link/promoteLink';
|
|
60
|
+
export { promoteLink, getPromoteLink } from './modelApi/link/promoteLink';
|
|
61
61
|
export { getListAnnounceData } from './modelApi/list/getListAnnounceData';
|
|
62
62
|
export { queryContentModelBlocks } from './modelApi/common/queryContentModelBlocks';
|
|
63
63
|
export { adjustWordSelection } from './modelApi/selection/adjustWordSelection';
|
package/lib-mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-api/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC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AM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC","sourcesContent":["export { insertTable } from './publicApi/table/insertTable';\nexport { formatTable } from './publicApi/table/formatTable';\nexport { setTableCellShade } from './publicApi/table/setTableCellShade';\nexport { editTable } from './publicApi/table/editTable';\nexport { applyTableBorderFormat } from './publicApi/table/applyTableBorderFormat';\nexport { toggleBullet } from './publicApi/list/toggleBullet';\nexport { toggleNumbering } from './publicApi/list/toggleNumbering';\nexport { toggleBold } from './publicApi/segment/toggleBold';\nexport { toggleItalic } from './publicApi/segment/toggleItalic';\nexport { toggleUnderline } from './publicApi/segment/toggleUnderline';\nexport { toggleStrikethrough } from './publicApi/segment/toggleStrikethrough';\nexport { toggleSubscript } from './publicApi/segment/toggleSubscript';\nexport { toggleSuperscript } from './publicApi/segment/toggleSuperscript';\nexport { setBackgroundColor } from './publicApi/segment/setBackgroundColor';\nexport { setFontName } from './publicApi/segment/setFontName';\nexport { setFontSize } from './publicApi/segment/setFontSize';\nexport { setTextColor } from './publicApi/segment/setTextColor';\nexport { changeFontSize } from './publicApi/segment/changeFontSize';\nexport { applySegmentFormat } from './publicApi/segment/applySegmentFormat';\nexport { changeCapitalization } from './publicApi/segment/changeCapitalization';\nexport { splitTextSegment } from './publicApi/segment/splitTextSegment';\nexport { insertImage } from './publicApi/image/insertImage';\nexport { setListStyle } from './publicApi/list/setListStyle';\nexport { setListStartNumber } from './publicApi/list/setListStartNumber';\nexport { setIndentation } from './publicApi/block/setIndentation';\nexport { setAlignment } from './publicApi/block/setAlignment';\nexport { setDirection } from './publicApi/block/setDirection';\nexport { setHeadingLevel } from './publicApi/block/setHeadingLevel';\nexport { toggleBlockQuote } from './publicApi/block/toggleBlockQuote';\nexport { setSpacing } from './publicApi/block/setSpacing';\nexport { setImageBorder } from './publicApi/image/setImageBorder';\nexport { setImageBoxShadow } from './publicApi/image/setImageBoxShadow';\nexport { changeImage } from './publicApi/image/changeImage';\nexport { getFormatState } from './publicApi/format/getFormatState';\nexport { clearFormat } from './publicApi/format/clearFormat';\nexport { insertLink } from './publicApi/link/insertLink';\nexport { removeLink } from './publicApi/link/removeLink';\nexport { adjustLinkSelection } from './publicApi/link/adjustLinkSelection';\nexport { setImageAltText } from './publicApi/image/setImageAltText';\nexport { adjustImageSelection } from './publicApi/image/adjustImageSelection';\nexport { setParagraphMargin } from './publicApi/block/setParagraphMargin';\nexport { toggleCode } from './publicApi/segment/toggleCode';\nexport { insertEntity } from './publicApi/entity/insertEntity';\nexport { insertTableRow } from './modelApi/table/insertTableRow';\nexport { insertTableColumn } from './modelApi/table/insertTableColumn';\nexport { clearSelectedCells } from './modelApi/table/clearSelectedCells';\n\nexport { createEditorContextForEntity } from './publicApi/utils/createEditorContextForEntity';\nexport { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';\nexport { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';\nexport { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';\nexport { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';\nexport { formatTextSegmentBeforeSelectionMarker } from './publicApi/utils/formatTextSegmentBeforeSelectionMarker';\nexport { formatInsertPointWithContentModel } from './publicApi/utils/formatInsertPointWithContentModel';\n\nexport { setListType } from './modelApi/list/setListType';\nexport { setModelListStyle } from './modelApi/list/setModelListStyle';\nexport { setModelListStartNumber } from './modelApi/list/setModelListStartNumber';\nexport { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';\nexport { setModelIndentation } from './modelApi/block/setModelIndentation';\nexport { matchLink } from './modelApi/link/matchLink';\nexport { promoteLink, getPromoteLink } from './modelApi/link/promoteLink';\nexport { getListAnnounceData } from './modelApi/list/getListAnnounceData';\nexport { queryContentModelBlocks } from './modelApi/common/queryContentModelBlocks';\nexport { adjustWordSelection } from './modelApi/selection/adjustWordSelection';\n"]}
|
|
@@ -8,9 +8,12 @@ var MAILTO_REGEX = "(M|m)ailto:" + COMMON_REGEX;
|
|
|
8
8
|
export function getLinkUrl(text, autoLinkOptions) {
|
|
9
9
|
var _a;
|
|
10
10
|
var _b = autoLinkOptions !== null && autoLinkOptions !== void 0 ? autoLinkOptions : {}, autoLink = _b.autoLink, autoMailto = _b.autoMailto, autoTel = _b.autoTel;
|
|
11
|
+
var mailtoMatch = matchMailTo(text);
|
|
12
|
+
if (mailtoMatch && !autoMailto) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
11
15
|
var linkMatch = autoLink ? (_a = matchLink(text)) === null || _a === void 0 ? void 0 : _a.normalizedUrl : undefined;
|
|
12
16
|
var telMatch = autoTel ? matchTel(text) : undefined;
|
|
13
|
-
var mailtoMatch = autoMailto ? matchMailTo(text) : undefined;
|
|
14
17
|
return linkMatch || telMatch || mailtoMatch;
|
|
15
18
|
}
|
|
16
19
|
function matchTel(text) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkUrl.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/getLinkUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,IAAM,YAAY,GAAG,sBAAwB,CAAC;AAC9C,IAAM,eAAe,GAAG,aAAW,YAAc,CA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AC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC","sourcesContent":["import { matchLink } from './matchLink';\nimport type { AutoLinkOptions } from 'roosterjs-content-model-types';\n\nconst COMMON_REGEX = `[\\s]*[a-zA-Z0-9+][\\s]*`;\nconst TELEPHONE_REGEX = `(T|t)el:${COMMON_REGEX}`;\nconst MAILTO_REGEX = `(M|m)ailto:${COMMON_REGEX}`;\n\n/**\n * @internal\n */\nexport function getLinkUrl(text: string, autoLinkOptions?: AutoLinkOptions): string | undefined {\n const { autoLink, autoMailto, autoTel } = autoLinkOptions ?? {};\n const mailtoMatch = matchMailTo(text);\n if (mailtoMatch && !autoMailto) {\n return undefined;\n }\n const linkMatch = autoLink ? matchLink(text)?.normalizedUrl : undefined;\n const telMatch = autoTel ? matchTel(text) : undefined;\n\n return linkMatch || telMatch || mailtoMatch;\n}\n\nfunction matchTel(text: string) {\n return text.match(TELEPHONE_REGEX) ? text.toLocaleLowerCase() : undefined;\n}\n\nfunction matchMailTo(text: string) {\n return text.match(MAILTO_REGEX) ? text.toLocaleLowerCase() : undefined;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AutoLinkOptions, ContentModelText, ShallowMutableContentModelParagraph } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { AutoLinkOptions, ContentModelText, PromotedLink, ShallowMutableContentModelParagraph } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Promote the given text segment to a hyper link when the segment text is ending with a valid link format.
|
|
4
4
|
* When the whole text segment if of a link, promote the whole segment.
|
|
@@ -11,3 +11,10 @@ import type { AutoLinkOptions, ContentModelText, ShallowMutableContentModelParag
|
|
|
11
11
|
* @returns If a link is promoted, return this segment. Otherwise return null
|
|
12
12
|
*/
|
|
13
13
|
export declare function promoteLink(segment: ContentModelText, paragraph: ShallowMutableContentModelParagraph, autoLinkOptions: AutoLinkOptions): ContentModelText | null;
|
|
14
|
+
/**
|
|
15
|
+
* Verify if the link can be promoted
|
|
16
|
+
* @param segment The text segment to search link text from
|
|
17
|
+
* @param options Options of auto link
|
|
18
|
+
* @returns if a link can be promoted
|
|
19
|
+
*/
|
|
20
|
+
export declare function getPromoteLink(segment: ContentModelText, autoLinkOptions: AutoLinkOptions): PromotedLink | undefined;
|
|
@@ -15,14 +15,12 @@ export function promoteLink(segment, paragraph, autoLinkOptions) {
|
|
|
15
15
|
if (segment.link) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (url && link && (linkUrl = getLinkUrl(url, autoLinkOptions))) {
|
|
22
|
-
var linkSegment = splitTextSegment(segment, paragraph, segment.text.length - link.trimLeft().length, segment.text.trimRight().length);
|
|
18
|
+
var promotedLink = getPromoteLink(segment, autoLinkOptions);
|
|
19
|
+
if (promotedLink) {
|
|
20
|
+
var linkSegment = splitTextSegment(segment, paragraph, segment.text.length - promotedLink.label.trimLeft().length, segment.text.trimRight().length);
|
|
23
21
|
linkSegment.link = {
|
|
24
22
|
format: {
|
|
25
|
-
href:
|
|
23
|
+
href: promotedLink.href,
|
|
26
24
|
underline: true,
|
|
27
25
|
},
|
|
28
26
|
dataset: {},
|
|
@@ -31,4 +29,22 @@ export function promoteLink(segment, paragraph, autoLinkOptions) {
|
|
|
31
29
|
}
|
|
32
30
|
return null;
|
|
33
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Verify if the link can be promoted
|
|
34
|
+
* @param segment The text segment to search link text from
|
|
35
|
+
* @param options Options of auto link
|
|
36
|
+
* @returns if a link can be promoted
|
|
37
|
+
*/
|
|
38
|
+
export function getPromoteLink(segment, autoLinkOptions) {
|
|
39
|
+
var link = segment.text.split(' ').pop();
|
|
40
|
+
var url = link === null || link === void 0 ? void 0 : link.trim();
|
|
41
|
+
var linkUrl = undefined;
|
|
42
|
+
if (url && link && (linkUrl = getLinkUrl(url, autoLinkOptions))) {
|
|
43
|
+
return {
|
|
44
|
+
label: link,
|
|
45
|
+
href: linkUrl,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
34
50
|
//# sourceMappingURL=promoteLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promoteLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/promoteLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"promoteLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/link/promoteLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAQ5E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CACvB,OAAyB,EACzB,SAA8C,EAC9C,eAAgC;IAEhC,IAAI,OAAO,CAAC,IAAI,EAAE;QACd,OAAO,IAAI,CAAC;KACf;IAED,IAAM,YAAY,GAAG,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAE9D,IAAI,YAAY,EAAE;QACd,IAAM,WAAW,GAAG,gBAAgB,CAChC,OAAO,EACP,SAAS,EACT,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,EAC1D,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,CAClC,CAAC;QACF,WAAW,CAAC,IAAI,GAAG;YACf,MAAM,EAAE;gBACJ,IAAI,EAAE,YAAY,CAAC,IAAI;gBACvB,SAAS,EAAE,IAAI;aAClB;YACD,OAAO,EAAE,EAAE;SACd,CAAC;QAEF,OAAO,WAAW,CAAC;KACtB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC1B,OAAyB,EACzB,eAAgC;IAEhC,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC3C,IAAM,GAAG,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,EAAE,CAAC;IACzB,IAAI,OAAO,GAAuB,SAAS,CAAC;IAC5C,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,EAAE;QAC7D,OAAO;YACH,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,OAAO;SAChB,CAAC;KACL;IACD,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import { getLinkUrl } from './getLinkUrl';\nimport { splitTextSegment } from '../../publicApi/segment/splitTextSegment';\nimport type {\n AutoLinkOptions,\n ContentModelText,\n PromotedLink,\n ShallowMutableContentModelParagraph,\n} from 'roosterjs-content-model-types';\n\n/**\n * Promote the given text segment to a hyper link when the segment text is ending with a valid link format.\n * When the whole text segment if of a link, promote the whole segment.\n * When the text segment ends with a link format, split the segment and promote the second part\n * When link is in middle of the text segment, no action.\n * This is mainly used for doing auto link when there is a link before cursor\n * @param segment The text segment to search link text from\n * @param paragraph Parent paragraph of the segment\n * @param options Options of auto link\n * @returns If a link is promoted, return this segment. Otherwise return null\n */\nexport function promoteLink(\n segment: ContentModelText,\n paragraph: ShallowMutableContentModelParagraph,\n autoLinkOptions: AutoLinkOptions\n): ContentModelText | null {\n if (segment.link) {\n return null;\n }\n\n const promotedLink = getPromoteLink(segment, autoLinkOptions);\n\n if (promotedLink) {\n const linkSegment = splitTextSegment(\n segment,\n paragraph,\n segment.text.length - promotedLink.label.trimLeft().length,\n segment.text.trimRight().length\n );\n linkSegment.link = {\n format: {\n href: promotedLink.href,\n underline: true,\n },\n dataset: {},\n };\n\n return linkSegment;\n }\n\n return null;\n}\n\n/**\n * Verify if the link can be promoted\n * @param segment The text segment to search link text from\n * @param options Options of auto link\n * @returns if a link can be promoted\n */\nexport function getPromoteLink(\n segment: ContentModelText,\n autoLinkOptions: AutoLinkOptions\n): PromotedLink | undefined {\n const link = segment.text.split(' ').pop();\n const url = link?.trim();\n let linkUrl: string | undefined = undefined;\n if (url && link && (linkUrl = getLinkUrl(url, autoLinkOptions))) {\n return {\n label: link,\n href: linkUrl,\n };\n }\n return undefined;\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { ContentModelTableFormat, IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Insert table into editor at current selection
|
|
4
4
|
* @param editor The editor instance
|
|
5
5
|
* @param columns Number of columns in table, it also controls the default table cell width:
|
|
6
6
|
* if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px
|
|
7
7
|
* @param rows Number of rows in table
|
|
8
|
-
* @param
|
|
9
|
-
*
|
|
8
|
+
* @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB
|
|
9
|
+
* @param format (Optional) The table format used for style attributes
|
|
10
10
|
*/
|
|
11
|
-
export declare function insertTable(editor: IEditor, columns: number, rows: number,
|
|
11
|
+
export declare function insertTable(editor: IEditor, columns: number, rows: number, tableMetadataFormat?: Partial<TableMetadataFormat>, format?: ContentModelTableFormat): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
1
2
|
import { adjustTableIndentation } from '../../modelApi/common/adjustIndentation';
|
|
2
3
|
import { createTableStructure } from '../../modelApi/table/createTableStructure';
|
|
3
4
|
import { createContentModelDocument, createSelectionMarker, applyTableFormat, deleteSelection, mergeModel, normalizeTable, setSelection, } from 'roosterjs-content-model-dom';
|
|
@@ -7,10 +8,10 @@ import { createContentModelDocument, createSelectionMarker, applyTableFormat, de
|
|
|
7
8
|
* @param columns Number of columns in table, it also controls the default table cell width:
|
|
8
9
|
* if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px
|
|
9
10
|
* @param rows Number of rows in table
|
|
10
|
-
* @param
|
|
11
|
-
*
|
|
11
|
+
* @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB
|
|
12
|
+
* @param format (Optional) The table format used for style attributes
|
|
12
13
|
*/
|
|
13
|
-
export function insertTable(editor, columns, rows, format) {
|
|
14
|
+
export function insertTable(editor, columns, rows, tableMetadataFormat, format) {
|
|
14
15
|
editor.focus();
|
|
15
16
|
editor.formatContentModel(function (model, context) {
|
|
16
17
|
var _a, _b, _c;
|
|
@@ -18,11 +19,14 @@ export function insertTable(editor, columns, rows, format) {
|
|
|
18
19
|
if (insertPosition) {
|
|
19
20
|
var doc = createContentModelDocument();
|
|
20
21
|
var table = createTableStructure(doc, columns, rows);
|
|
22
|
+
if (format) {
|
|
23
|
+
table.format = __assign({}, format);
|
|
24
|
+
}
|
|
21
25
|
normalizeTable(table, editor.getPendingFormat() || insertPosition.marker.format);
|
|
22
26
|
adjustTableIndentation(insertPosition, table);
|
|
23
27
|
// Assign default vertical align
|
|
24
|
-
|
|
25
|
-
applyTableFormat(table,
|
|
28
|
+
tableMetadataFormat = tableMetadataFormat || { verticalAlign: 'top' };
|
|
29
|
+
applyTableFormat(table, tableMetadataFormat);
|
|
26
30
|
mergeModel(model, doc, context, {
|
|
27
31
|
insertPosition: insertPosition,
|
|
28
32
|
mergeFormat: 'mergeAll',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/insertTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACH,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,cAAc,EACd,YAAY,GACf,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"insertTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/insertTable.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACH,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,cAAc,EACd,YAAY,GACf,MAAM,6BAA6B,CAAC;AAOrC;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CACvB,MAAe,EACf,OAAe,EACf,IAAY,EACZ,mBAAkD,EAClD,MAAgC;IAEhC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;;QACX,IAAM,cAAc,GAAG,eAAe,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC;QAEvE,IAAI,cAAc,EAAE;YAChB,IAAM,GAAG,GAAG,0BAA0B,EAAE,CAAC;YACzC,IAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YACvD,IAAI,MAAM,EAAE;gBACR,KAAK,CAAC,MAAM,gBAAQ,MAAM,CAAE,CAAC;aAChC;YAED,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEjF,sBAAsB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;YAE9C,gCAAgC;YAChC,mBAAmB,GAAG,mBAAmB,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;YACtE,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;YAC7C,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE;gBAC5B,cAAc,gBAAA;gBACd,WAAW,EAAE,UAAU;aAC1B,CAAC,CAAC;YAEH,IAAM,UAAU,GAAG,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YAEtD,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,KAAI,WAAW,EAAE;gBACtC,IAAM,MAAM,GAAG,qBAAqB,CAAC,MAAA,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,CAAC;gBACrE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACpC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;aAC/B;YAED,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC","sourcesContent":["import { adjustTableIndentation } from '../../modelApi/common/adjustIndentation';\nimport { createTableStructure } from '../../modelApi/table/createTableStructure';\nimport {\n createContentModelDocument,\n createSelectionMarker,\n applyTableFormat,\n deleteSelection,\n mergeModel,\n normalizeTable,\n setSelection,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelTableFormat,\n IEditor,\n TableMetadataFormat,\n} from 'roosterjs-content-model-types';\n\n/**\n * Insert table into editor at current selection\n * @param editor The editor instance\n * @param columns Number of columns in table, it also controls the default table cell width:\n * if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px\n * @param rows Number of rows in table\n * @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB\n * @param format (Optional) The table format used for style attributes\n */\nexport function insertTable(\n editor: IEditor,\n columns: number,\n rows: number,\n tableMetadataFormat?: Partial<TableMetadataFormat>,\n format?: ContentModelTableFormat\n) {\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n const insertPosition = deleteSelection(model, [], context).insertPoint;\n\n if (insertPosition) {\n const doc = createContentModelDocument();\n const table = createTableStructure(doc, columns, rows);\n if (format) {\n table.format = { ...format };\n }\n\n normalizeTable(table, editor.getPendingFormat() || insertPosition.marker.format);\n\n adjustTableIndentation(insertPosition, table);\n\n // Assign default vertical align\n tableMetadataFormat = tableMetadataFormat || { verticalAlign: 'top' };\n applyTableFormat(table, tableMetadataFormat);\n mergeModel(model, doc, context, {\n insertPosition,\n mergeFormat: 'mergeAll',\n });\n\n const firstBlock = table.rows[0]?.cells[0]?.blocks[0];\n\n if (firstBlock?.blockType == 'Paragraph') {\n const marker = createSelectionMarker(firstBlock.segments[0]?.format);\n firstBlock.segments.unshift(marker);\n setSelection(model, marker);\n }\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'insertTable',\n }\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"description": "Format API for roosterjs",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.1",
|
|
6
|
-
"roosterjs-content-model-dom": "^9.
|
|
7
|
-
"roosterjs-content-model-types": "^9.
|
|
6
|
+
"roosterjs-content-model-dom": "^9.42.0",
|
|
7
|
+
"roosterjs-content-model-types": "^9.43.0"
|
|
8
8
|
},
|
|
9
|
-
"version": "9.
|
|
9
|
+
"version": "9.43.0",
|
|
10
10
|
"main": "./lib/index.js",
|
|
11
11
|
"typings": "./lib/index.d.ts",
|
|
12
12
|
"module": "./lib-mjs/index.js",
|