roosterjs-content-model-api 9.0.0 → 9.1.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 +2 -0
- package/lib/index.js +6 -2
- package/lib/index.js.map +1 -1
- package/lib/modelApi/table/clearSelectedCells.d.ts +0 -1
- package/lib/modelApi/table/clearSelectedCells.js +0 -1
- package/lib/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +7 -0
- package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +28 -0
- package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -0
- package/lib-amd/index.d.ts +2 -0
- package/lib-amd/index.js +4 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/table/clearSelectedCells.d.ts +0 -1
- package/lib-amd/modelApi/table/clearSelectedCells.js +0 -1
- package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +7 -0
- package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +29 -0
- package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -0
- package/lib-mjs/index.d.ts +2 -0
- package/lib-mjs/index.js +2 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.d.ts +0 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.js +0 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +7 -0
- package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +24 -0
- package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -0
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -42,10 +42,12 @@ export { toggleCode } from './publicApi/segment/toggleCode';
|
|
|
42
42
|
export { insertEntity } from './publicApi/entity/insertEntity';
|
|
43
43
|
export { insertTableRow } from './modelApi/table/insertTableRow';
|
|
44
44
|
export { insertTableColumn } from './modelApi/table/insertTableColumn';
|
|
45
|
+
export { clearSelectedCells } from './modelApi/table/clearSelectedCells';
|
|
45
46
|
export { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';
|
|
46
47
|
export { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';
|
|
47
48
|
export { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';
|
|
48
49
|
export { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';
|
|
50
|
+
export { formatTextSegmentBeforeSelectionMarker } from './publicApi/utils/formatTextSegmentBeforeSelectionMarker';
|
|
49
51
|
export { setListType } from './modelApi/list/setListType';
|
|
50
52
|
export { setModelListStyle } from './modelApi/list/setModelListStyle';
|
|
51
53
|
export { setModelListStartNumber } from './modelApi/list/setModelListStartNumber';
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = void 0;
|
|
3
|
+
exports.formatTextSegmentBeforeSelectionMarker = exports.formatSegmentWithContentModel = exports.formatParagraphWithContentModel = exports.formatImageWithContentModel = exports.formatTableWithContentModel = 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.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.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = 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");
|
|
@@ -90,6 +90,8 @@ var insertTableRow_1 = require("./modelApi/table/insertTableRow");
|
|
|
90
90
|
Object.defineProperty(exports, "insertTableRow", { enumerable: true, get: function () { return insertTableRow_1.insertTableRow; } });
|
|
91
91
|
var insertTableColumn_1 = require("./modelApi/table/insertTableColumn");
|
|
92
92
|
Object.defineProperty(exports, "insertTableColumn", { enumerable: true, get: function () { return insertTableColumn_1.insertTableColumn; } });
|
|
93
|
+
var clearSelectedCells_1 = require("./modelApi/table/clearSelectedCells");
|
|
94
|
+
Object.defineProperty(exports, "clearSelectedCells", { enumerable: true, get: function () { return clearSelectedCells_1.clearSelectedCells; } });
|
|
93
95
|
var formatTableWithContentModel_1 = require("./publicApi/utils/formatTableWithContentModel");
|
|
94
96
|
Object.defineProperty(exports, "formatTableWithContentModel", { enumerable: true, get: function () { return formatTableWithContentModel_1.formatTableWithContentModel; } });
|
|
95
97
|
var formatImageWithContentModel_1 = require("./publicApi/utils/formatImageWithContentModel");
|
|
@@ -98,6 +100,8 @@ var formatParagraphWithContentModel_1 = require("./publicApi/utils/formatParagra
|
|
|
98
100
|
Object.defineProperty(exports, "formatParagraphWithContentModel", { enumerable: true, get: function () { return formatParagraphWithContentModel_1.formatParagraphWithContentModel; } });
|
|
99
101
|
var formatSegmentWithContentModel_1 = require("./publicApi/utils/formatSegmentWithContentModel");
|
|
100
102
|
Object.defineProperty(exports, "formatSegmentWithContentModel", { enumerable: true, get: function () { return formatSegmentWithContentModel_1.formatSegmentWithContentModel; } });
|
|
103
|
+
var formatTextSegmentBeforeSelectionMarker_1 = require("./publicApi/utils/formatTextSegmentBeforeSelectionMarker");
|
|
104
|
+
Object.defineProperty(exports, "formatTextSegmentBeforeSelectionMarker", { enumerable: true, get: function () { return formatTextSegmentBeforeSelectionMarker_1.formatTextSegmentBeforeSelectionMarker; } });
|
|
101
105
|
var setListType_1 = require("./modelApi/list/setListType");
|
|
102
106
|
Object.defineProperty(exports, "setListType", { enumerable: true, get: function () { return setListType_1.setListType; } });
|
|
103
107
|
var setModelListStyle_1 = require("./modelApi/list/setModelListStyle");
|
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,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,sHAA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,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,wEAAuE;AAA9D,sHAAA,iBAAiB,OAAA;
|
|
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,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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AlE,0HAAA,mBAAmB,OAAA;AAC5B,uDAAsD;AAA7C,sGAAA,SAAS,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 { 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 { 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';\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';\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ContentModelTable, TableSelectionCoordinates } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Clear selection of a table.
|
|
4
|
-
* @internal
|
|
5
4
|
* @param table The table model where the selection is to be cleared
|
|
6
5
|
* @param sel The selection coordinates to be cleared
|
|
7
6
|
*/
|
|
@@ -4,7 +4,6 @@ exports.clearSelectedCells = void 0;
|
|
|
4
4
|
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
5
|
/**
|
|
6
6
|
* Clear selection of a table.
|
|
7
|
-
* @internal
|
|
8
7
|
* @param table The table model where the selection is to be cleared
|
|
9
8
|
* @param sel The selection coordinates to be cleared
|
|
10
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearSelectedCells.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/table/clearSelectedCells.ts"],"names":[],"mappings":";;;AAAA,2EAA2D;AAG3D
|
|
1
|
+
{"version":3,"file":"clearSelectedCells.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/table/clearSelectedCells.ts"],"names":[],"mappings":";;;AAAA,2EAA2D;AAG3D;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,KAAwB,EAAE,GAA8B;IACvF,IACI,GAAG,CAAC,WAAW,IAAI,CAAC;QACpB,GAAG,CAAC,QAAQ,IAAI,CAAC;QACjB,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;QACpC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EACjC;QACE,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;YAC9C,IAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE;gBACpD,IAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;gBACxB,IAAA,0CAAY,EAAC,IAAI,CAAC,CAAC;aACtB;SACJ;KACJ;AACL,CAAC;AAhBD,gDAgBC","sourcesContent":["import { setSelection } from 'roosterjs-content-model-dom';\nimport type { ContentModelTable, TableSelectionCoordinates } from 'roosterjs-content-model-types';\n\n/**\n * Clear selection of a table.\n * @param table The table model where the selection is to be cleared\n * @param sel The selection coordinates to be cleared\n */\nexport function clearSelectedCells(table: ContentModelTable, sel: TableSelectionCoordinates) {\n if (\n sel.firstColumn >= 0 &&\n sel.firstRow >= 0 &&\n sel.lastColumn < table.widths.length &&\n sel.lastRow < table.rows.length\n ) {\n for (let i = sel.firstRow; i <= sel.lastRow; i++) {\n const row = table.rows[i];\n for (let j = sel.firstColumn; j <= sel.lastColumn; j++) {\n const cell = row.cells[j];\n cell.isSelected = false;\n setSelection(cell);\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContentModelDocument, ContentModelParagraph, ContentModelSegmentFormat, ContentModelText, FormatContentModelContext, IEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Invoke a callback to format the text segment before the selection marker using Content Model
|
|
4
|
+
* @param editor The editor object
|
|
5
|
+
* @param callback The callback to format the text segment.
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatTextSegmentBeforeSelectionMarker(editor: IEditor, callback: (model: ContentModelDocument, previousSegment: ContentModelText, paragraph: ContentModelParagraph, markerFormat: ContentModelSegmentFormat, context: FormatContentModelContext) => boolean): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatTextSegmentBeforeSelectionMarker = void 0;
|
|
4
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
|
+
/**
|
|
6
|
+
* Invoke a callback to format the text segment before the selection marker using Content Model
|
|
7
|
+
* @param editor The editor object
|
|
8
|
+
* @param callback The callback to format the text segment.
|
|
9
|
+
*/
|
|
10
|
+
function formatTextSegmentBeforeSelectionMarker(editor, callback) {
|
|
11
|
+
editor.formatContentModel(function (model, context) {
|
|
12
|
+
var selectedSegmentsAndParagraphs = (0, roosterjs_content_model_dom_1.getSelectedSegmentsAndParagraphs)(model, false /*includeFormatHolder*/);
|
|
13
|
+
if (selectedSegmentsAndParagraphs.length > 0 && selectedSegmentsAndParagraphs[0][1]) {
|
|
14
|
+
var marker = selectedSegmentsAndParagraphs[0][0];
|
|
15
|
+
var paragraph = selectedSegmentsAndParagraphs[0][1];
|
|
16
|
+
var markerIndex = paragraph.segments.indexOf(marker);
|
|
17
|
+
if (marker.segmentType === 'SelectionMarker' && markerIndex > 0) {
|
|
18
|
+
var previousSegment = paragraph.segments[markerIndex - 1];
|
|
19
|
+
if (previousSegment && previousSegment.segmentType === 'Text') {
|
|
20
|
+
return callback(model, previousSegment, paragraph, marker.format, context);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.formatTextSegmentBeforeSelectionMarker = formatTextSegmentBeforeSelectionMarker;
|
|
28
|
+
//# sourceMappingURL=formatTextSegmentBeforeSelectionMarker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatTextSegmentBeforeSelectionMarker.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAU/E;;;;GAIG;AACH,SAAgB,sCAAsC,CAClD,MAAe,EACf,QAMY;IAEZ,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,OAAO;QACrC,IAAM,6BAA6B,GAAG,IAAA,8DAAgC,EAClE,KAAK,EACL,KAAK,CAAC,uBAAuB,CAChC,CAAC;QAEF,IAAI,6BAA6B,CAAC,MAAM,GAAG,CAAC,IAAI,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACjF,IAAM,MAAM,GAAG,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnD,IAAM,SAAS,GAAG,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACtD,IAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,MAAM,CAAC,WAAW,KAAK,iBAAiB,IAAI,WAAW,GAAG,CAAC,EAAE;gBAC7D,IAAM,eAAe,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;gBAC5D,IAAI,eAAe,IAAI,eAAe,CAAC,WAAW,KAAK,MAAM,EAAE;oBAC3D,OAAO,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;iBAC9E;aACJ;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AA7BD,wFA6BC","sourcesContent":["import { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-dom';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n ContentModelSegmentFormat,\n ContentModelText,\n FormatContentModelContext,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * Invoke a callback to format the text segment before the selection marker using Content Model\n * @param editor The editor object\n * @param callback The callback to format the text segment.\n */\nexport function formatTextSegmentBeforeSelectionMarker(\n editor: IEditor,\n callback: (\n model: ContentModelDocument,\n previousSegment: ContentModelText,\n paragraph: ContentModelParagraph,\n markerFormat: ContentModelSegmentFormat,\n context: FormatContentModelContext\n ) => boolean\n) {\n editor.formatContentModel((model, context) => {\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(\n model,\n false /*includeFormatHolder*/\n );\n\n if (selectedSegmentsAndParagraphs.length > 0 && selectedSegmentsAndParagraphs[0][1]) {\n const marker = selectedSegmentsAndParagraphs[0][0];\n const paragraph = selectedSegmentsAndParagraphs[0][1];\n const markerIndex = paragraph.segments.indexOf(marker);\n if (marker.segmentType === 'SelectionMarker' && markerIndex > 0) {\n const previousSegment = paragraph.segments[markerIndex - 1];\n if (previousSegment && previousSegment.segmentType === 'Text') {\n return callback(model, previousSegment, paragraph, marker.format, context);\n }\n }\n }\n return false;\n });\n}\n"]}
|
package/lib-amd/index.d.ts
CHANGED
|
@@ -42,10 +42,12 @@ export { toggleCode } from './publicApi/segment/toggleCode';
|
|
|
42
42
|
export { insertEntity } from './publicApi/entity/insertEntity';
|
|
43
43
|
export { insertTableRow } from './modelApi/table/insertTableRow';
|
|
44
44
|
export { insertTableColumn } from './modelApi/table/insertTableColumn';
|
|
45
|
+
export { clearSelectedCells } from './modelApi/table/clearSelectedCells';
|
|
45
46
|
export { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';
|
|
46
47
|
export { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';
|
|
47
48
|
export { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';
|
|
48
49
|
export { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';
|
|
50
|
+
export { formatTextSegmentBeforeSelectionMarker } from './publicApi/utils/formatTextSegmentBeforeSelectionMarker';
|
|
49
51
|
export { setListType } from './modelApi/list/setListType';
|
|
50
52
|
export { setModelListStyle } from './modelApi/list/setModelListStyle';
|
|
51
53
|
export { setModelListStartNumber } from './modelApi/list/setModelListStartNumber';
|
package/lib-amd/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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/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", "./publicApi/utils/formatTableWithContentModel", "./publicApi/utils/formatImageWithContentModel", "./publicApi/utils/formatParagraphWithContentModel", "./publicApi/utils/formatSegmentWithContentModel", "./modelApi/list/setListType", "./modelApi/list/setModelListStyle", "./modelApi/list/setModelListStartNumber", "./modelApi/list/findListItemsInSameThread", "./modelApi/block/setModelIndentation", "./modelApi/link/matchLink"], 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, 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, formatTableWithContentModel_1, formatImageWithContentModel_1, formatParagraphWithContentModel_1, formatSegmentWithContentModel_1, setListType_1, setModelListStyle_1, setModelListStartNumber_1, findListItemsInSameThread_1, setModelIndentation_1, matchLink_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/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/formatTableWithContentModel", "./publicApi/utils/formatImageWithContentModel", "./publicApi/utils/formatParagraphWithContentModel", "./publicApi/utils/formatSegmentWithContentModel", "./publicApi/utils/formatTextSegmentBeforeSelectionMarker", "./modelApi/list/setListType", "./modelApi/list/setModelListStyle", "./modelApi/list/setModelListStartNumber", "./modelApi/list/findListItemsInSameThread", "./modelApi/block/setModelIndentation", "./modelApi/link/matchLink"], 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, 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, formatTableWithContentModel_1, formatImageWithContentModel_1, formatParagraphWithContentModel_1, formatSegmentWithContentModel_1, formatTextSegmentBeforeSelectionMarker_1, setListType_1, setModelListStyle_1, setModelListStartNumber_1, findListItemsInSameThread_1, setModelIndentation_1, matchLink_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = exports.formatSegmentWithContentModel = exports.formatParagraphWithContentModel = exports.formatImageWithContentModel = exports.formatTableWithContentModel = 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.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.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = exports.formatTextSegmentBeforeSelectionMarker = exports.formatSegmentWithContentModel = exports.formatParagraphWithContentModel = exports.formatImageWithContentModel = exports.formatTableWithContentModel = 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.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; } });
|
|
@@ -46,10 +46,12 @@ define(["require", "exports", "./publicApi/table/insertTable", "./publicApi/tabl
|
|
|
46
46
|
Object.defineProperty(exports, "insertEntity", { enumerable: true, get: function () { return insertEntity_1.insertEntity; } });
|
|
47
47
|
Object.defineProperty(exports, "insertTableRow", { enumerable: true, get: function () { return insertTableRow_1.insertTableRow; } });
|
|
48
48
|
Object.defineProperty(exports, "insertTableColumn", { enumerable: true, get: function () { return insertTableColumn_1.insertTableColumn; } });
|
|
49
|
+
Object.defineProperty(exports, "clearSelectedCells", { enumerable: true, get: function () { return clearSelectedCells_1.clearSelectedCells; } });
|
|
49
50
|
Object.defineProperty(exports, "formatTableWithContentModel", { enumerable: true, get: function () { return formatTableWithContentModel_1.formatTableWithContentModel; } });
|
|
50
51
|
Object.defineProperty(exports, "formatImageWithContentModel", { enumerable: true, get: function () { return formatImageWithContentModel_1.formatImageWithContentModel; } });
|
|
51
52
|
Object.defineProperty(exports, "formatParagraphWithContentModel", { enumerable: true, get: function () { return formatParagraphWithContentModel_1.formatParagraphWithContentModel; } });
|
|
52
53
|
Object.defineProperty(exports, "formatSegmentWithContentModel", { enumerable: true, get: function () { return formatSegmentWithContentModel_1.formatSegmentWithContentModel; } });
|
|
54
|
+
Object.defineProperty(exports, "formatTextSegmentBeforeSelectionMarker", { enumerable: true, get: function () { return formatTextSegmentBeforeSelectionMarker_1.formatTextSegmentBeforeSelectionMarker; } });
|
|
53
55
|
Object.defineProperty(exports, "setListType", { enumerable: true, get: function () { return setListType_1.setListType; } });
|
|
54
56
|
Object.defineProperty(exports, "setModelListStyle", { enumerable: true, get: function () { return setModelListStyle_1.setModelListStyle; } });
|
|
55
57
|
Object.defineProperty(exports, "setModelListStartNumber", { enumerable: true, get: function () { return setModelListStartNumber_1.setModelListStartNumber; } });
|
package/lib-amd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-api/lib/index.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AAA,+BAA+B,OAAA;IAC/B,8IAAA,6BAA6B,OAAA;IAC7B,gKAAA,sCAAsC,OAAA;IAEtC,0GAAA,WAAW,OAAA;IACX,sHAAA,iBAAiB,OAAA;IACjB,kIAAA,uBAAuB,OAAA;IACvB,sIAAA,yBAAyB,OAAA;IACzB,0HAAA,mBAAmB,OAAA;IACnB,sGAAA,SAAS,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 { 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 { 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';\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';\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ContentModelTable, TableSelectionCoordinates } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Clear selection of a table.
|
|
4
|
-
* @internal
|
|
5
4
|
* @param table The table model where the selection is to be cleared
|
|
6
5
|
* @param sel The selection coordinates to be cleared
|
|
7
6
|
*/
|
|
@@ -4,7 +4,6 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require,
|
|
|
4
4
|
exports.clearSelectedCells = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* Clear selection of a table.
|
|
7
|
-
* @internal
|
|
8
7
|
* @param table The table model where the selection is to be cleared
|
|
9
8
|
* @param sel The selection coordinates to be cleared
|
|
10
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearSelectedCells.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/table/clearSelectedCells.ts"],"names":[],"mappings":";;;;IAGA
|
|
1
|
+
{"version":3,"file":"clearSelectedCells.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/table/clearSelectedCells.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IACH,SAAgB,kBAAkB,CAAC,KAAwB,EAAE,GAA8B;QACvF,IACI,GAAG,CAAC,WAAW,IAAI,CAAC;YACpB,GAAG,CAAC,QAAQ,IAAI,CAAC;YACjB,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;YACpC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EACjC;YACE,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;gBAC9C,IAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC1B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE;oBACpD,IAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBAC1B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;oBACxB,IAAA,0CAAY,EAAC,IAAI,CAAC,CAAC;iBACtB;aACJ;SACJ;IACL,CAAC;IAhBD,gDAgBC","sourcesContent":["import { setSelection } from 'roosterjs-content-model-dom';\nimport type { ContentModelTable, TableSelectionCoordinates } from 'roosterjs-content-model-types';\n\n/**\n * Clear selection of a table.\n * @param table The table model where the selection is to be cleared\n * @param sel The selection coordinates to be cleared\n */\nexport function clearSelectedCells(table: ContentModelTable, sel: TableSelectionCoordinates) {\n if (\n sel.firstColumn >= 0 &&\n sel.firstRow >= 0 &&\n sel.lastColumn < table.widths.length &&\n sel.lastRow < table.rows.length\n ) {\n for (let i = sel.firstRow; i <= sel.lastRow; i++) {\n const row = table.rows[i];\n for (let j = sel.firstColumn; j <= sel.lastColumn; j++) {\n const cell = row.cells[j];\n cell.isSelected = false;\n setSelection(cell);\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContentModelDocument, ContentModelParagraph, ContentModelSegmentFormat, ContentModelText, FormatContentModelContext, IEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Invoke a callback to format the text segment before the selection marker using Content Model
|
|
4
|
+
* @param editor The editor object
|
|
5
|
+
* @param callback The callback to format the text segment.
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatTextSegmentBeforeSelectionMarker(editor: IEditor, callback: (model: ContentModelDocument, previousSegment: ContentModelText, paragraph: ContentModelParagraph, markerFormat: ContentModelSegmentFormat, context: FormatContentModelContext) => boolean): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.formatTextSegmentBeforeSelectionMarker = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Invoke a callback to format the text segment before the selection marker using Content Model
|
|
7
|
+
* @param editor The editor object
|
|
8
|
+
* @param callback The callback to format the text segment.
|
|
9
|
+
*/
|
|
10
|
+
function formatTextSegmentBeforeSelectionMarker(editor, callback) {
|
|
11
|
+
editor.formatContentModel(function (model, context) {
|
|
12
|
+
var selectedSegmentsAndParagraphs = (0, roosterjs_content_model_dom_1.getSelectedSegmentsAndParagraphs)(model, false /*includeFormatHolder*/);
|
|
13
|
+
if (selectedSegmentsAndParagraphs.length > 0 && selectedSegmentsAndParagraphs[0][1]) {
|
|
14
|
+
var marker = selectedSegmentsAndParagraphs[0][0];
|
|
15
|
+
var paragraph = selectedSegmentsAndParagraphs[0][1];
|
|
16
|
+
var markerIndex = paragraph.segments.indexOf(marker);
|
|
17
|
+
if (marker.segmentType === 'SelectionMarker' && markerIndex > 0) {
|
|
18
|
+
var previousSegment = paragraph.segments[markerIndex - 1];
|
|
19
|
+
if (previousSegment && previousSegment.segmentType === 'Text') {
|
|
20
|
+
return callback(model, previousSegment, paragraph, marker.format, context);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.formatTextSegmentBeforeSelectionMarker = formatTextSegmentBeforeSelectionMarker;
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=formatTextSegmentBeforeSelectionMarker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatTextSegmentBeforeSelectionMarker.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.ts"],"names":[],"mappings":";;;;IAUA;;;;OAIG;IACH,SAAgB,sCAAsC,CAClD,MAAe,EACf,QAMY;QAEZ,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,OAAO;YACrC,IAAM,6BAA6B,GAAG,IAAA,8DAAgC,EAClE,KAAK,EACL,KAAK,CAAC,uBAAuB,CAChC,CAAC;YAEF,IAAI,6BAA6B,CAAC,MAAM,GAAG,CAAC,IAAI,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBACjF,IAAM,MAAM,GAAG,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnD,IAAM,SAAS,GAAG,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtD,IAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACvD,IAAI,MAAM,CAAC,WAAW,KAAK,iBAAiB,IAAI,WAAW,GAAG,CAAC,EAAE;oBAC7D,IAAM,eAAe,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;oBAC5D,IAAI,eAAe,IAAI,eAAe,CAAC,WAAW,KAAK,MAAM,EAAE;wBAC3D,OAAO,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;qBAC9E;iBACJ;aACJ;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC,CAAC;IACP,CAAC;IA7BD,wFA6BC","sourcesContent":["import { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-dom';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n ContentModelSegmentFormat,\n ContentModelText,\n FormatContentModelContext,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * Invoke a callback to format the text segment before the selection marker using Content Model\n * @param editor The editor object\n * @param callback The callback to format the text segment.\n */\nexport function formatTextSegmentBeforeSelectionMarker(\n editor: IEditor,\n callback: (\n model: ContentModelDocument,\n previousSegment: ContentModelText,\n paragraph: ContentModelParagraph,\n markerFormat: ContentModelSegmentFormat,\n context: FormatContentModelContext\n ) => boolean\n) {\n editor.formatContentModel((model, context) => {\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(\n model,\n false /*includeFormatHolder*/\n );\n\n if (selectedSegmentsAndParagraphs.length > 0 && selectedSegmentsAndParagraphs[0][1]) {\n const marker = selectedSegmentsAndParagraphs[0][0];\n const paragraph = selectedSegmentsAndParagraphs[0][1];\n const markerIndex = paragraph.segments.indexOf(marker);\n if (marker.segmentType === 'SelectionMarker' && markerIndex > 0) {\n const previousSegment = paragraph.segments[markerIndex - 1];\n if (previousSegment && previousSegment.segmentType === 'Text') {\n return callback(model, previousSegment, paragraph, marker.format, context);\n }\n }\n }\n return false;\n });\n}\n"]}
|
package/lib-mjs/index.d.ts
CHANGED
|
@@ -42,10 +42,12 @@ export { toggleCode } from './publicApi/segment/toggleCode';
|
|
|
42
42
|
export { insertEntity } from './publicApi/entity/insertEntity';
|
|
43
43
|
export { insertTableRow } from './modelApi/table/insertTableRow';
|
|
44
44
|
export { insertTableColumn } from './modelApi/table/insertTableColumn';
|
|
45
|
+
export { clearSelectedCells } from './modelApi/table/clearSelectedCells';
|
|
45
46
|
export { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';
|
|
46
47
|
export { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';
|
|
47
48
|
export { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';
|
|
48
49
|
export { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';
|
|
50
|
+
export { formatTextSegmentBeforeSelectionMarker } from './publicApi/utils/formatTextSegmentBeforeSelectionMarker';
|
|
49
51
|
export { setListType } from './modelApi/list/setListType';
|
|
50
52
|
export { setModelListStyle } from './modelApi/list/setModelListStyle';
|
|
51
53
|
export { setModelListStartNumber } from './modelApi/list/setModelListStartNumber';
|
package/lib-mjs/index.js
CHANGED
|
@@ -42,10 +42,12 @@ export { toggleCode } from './publicApi/segment/toggleCode';
|
|
|
42
42
|
export { insertEntity } from './publicApi/entity/insertEntity';
|
|
43
43
|
export { insertTableRow } from './modelApi/table/insertTableRow';
|
|
44
44
|
export { insertTableColumn } from './modelApi/table/insertTableColumn';
|
|
45
|
+
export { clearSelectedCells } from './modelApi/table/clearSelectedCells';
|
|
45
46
|
export { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';
|
|
46
47
|
export { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';
|
|
47
48
|
export { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';
|
|
48
49
|
export { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';
|
|
50
|
+
export { formatTextSegmentBeforeSelectionMarker } from './publicApi/utils/formatTextSegmentBeforeSelectionMarker';
|
|
49
51
|
export { setListType } from './modelApi/list/setListType';
|
|
50
52
|
export { setModelListStyle } from './modelApi/list/setModelListStyle';
|
|
51
53
|
export { setModelListStartNumber } from './modelApi/list/setModelListStartNumber';
|
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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O,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AACpG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,sCAAsC,EAAE,MAAM,0DAA0D,CAAC;AAElH,OAAO,EAAE,WAAW,EAAE,MAAM,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","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 { 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 { 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';\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';\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ContentModelTable, TableSelectionCoordinates } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Clear selection of a table.
|
|
4
|
-
* @internal
|
|
5
4
|
* @param table The table model where the selection is to be cleared
|
|
6
5
|
* @param sel The selection coordinates to be cleared
|
|
7
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearSelectedCells.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/table/clearSelectedCells.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D
|
|
1
|
+
{"version":3,"file":"clearSelectedCells.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/table/clearSelectedCells.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAwB,EAAE,GAA8B;IACvF,IACI,GAAG,CAAC,WAAW,IAAI,CAAC;QACpB,GAAG,CAAC,QAAQ,IAAI,CAAC;QACjB,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;QACpC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EACjC;QACE,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;YAC9C,IAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE;gBACpD,IAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;gBACxB,YAAY,CAAC,IAAI,CAAC,CAAC;aACtB;SACJ;KACJ;AACL,CAAC","sourcesContent":["import { setSelection } from 'roosterjs-content-model-dom';\nimport type { ContentModelTable, TableSelectionCoordinates } from 'roosterjs-content-model-types';\n\n/**\n * Clear selection of a table.\n * @param table The table model where the selection is to be cleared\n * @param sel The selection coordinates to be cleared\n */\nexport function clearSelectedCells(table: ContentModelTable, sel: TableSelectionCoordinates) {\n if (\n sel.firstColumn >= 0 &&\n sel.firstRow >= 0 &&\n sel.lastColumn < table.widths.length &&\n sel.lastRow < table.rows.length\n ) {\n for (let i = sel.firstRow; i <= sel.lastRow; i++) {\n const row = table.rows[i];\n for (let j = sel.firstColumn; j <= sel.lastColumn; j++) {\n const cell = row.cells[j];\n cell.isSelected = false;\n setSelection(cell);\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContentModelDocument, ContentModelParagraph, ContentModelSegmentFormat, ContentModelText, FormatContentModelContext, IEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Invoke a callback to format the text segment before the selection marker using Content Model
|
|
4
|
+
* @param editor The editor object
|
|
5
|
+
* @param callback The callback to format the text segment.
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatTextSegmentBeforeSelectionMarker(editor: IEditor, callback: (model: ContentModelDocument, previousSegment: ContentModelText, paragraph: ContentModelParagraph, markerFormat: ContentModelSegmentFormat, context: FormatContentModelContext) => boolean): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-dom';
|
|
2
|
+
/**
|
|
3
|
+
* Invoke a callback to format the text segment before the selection marker using Content Model
|
|
4
|
+
* @param editor The editor object
|
|
5
|
+
* @param callback The callback to format the text segment.
|
|
6
|
+
*/
|
|
7
|
+
export function formatTextSegmentBeforeSelectionMarker(editor, callback) {
|
|
8
|
+
editor.formatContentModel(function (model, context) {
|
|
9
|
+
var selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, false /*includeFormatHolder*/);
|
|
10
|
+
if (selectedSegmentsAndParagraphs.length > 0 && selectedSegmentsAndParagraphs[0][1]) {
|
|
11
|
+
var marker = selectedSegmentsAndParagraphs[0][0];
|
|
12
|
+
var paragraph = selectedSegmentsAndParagraphs[0][1];
|
|
13
|
+
var markerIndex = paragraph.segments.indexOf(marker);
|
|
14
|
+
if (marker.segmentType === 'SelectionMarker' && markerIndex > 0) {
|
|
15
|
+
var previousSegment = paragraph.segments[markerIndex - 1];
|
|
16
|
+
if (previousSegment && previousSegment.segmentType === 'Text') {
|
|
17
|
+
return callback(model, previousSegment, paragraph, marker.format, context);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=formatTextSegmentBeforeSelectionMarker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatTextSegmentBeforeSelectionMarker.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAU/E;;;;GAIG;AACH,MAAM,UAAU,sCAAsC,CAClD,MAAe,EACf,QAMY;IAEZ,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,OAAO;QACrC,IAAM,6BAA6B,GAAG,gCAAgC,CAClE,KAAK,EACL,KAAK,CAAC,uBAAuB,CAChC,CAAC;QAEF,IAAI,6BAA6B,CAAC,MAAM,GAAG,CAAC,IAAI,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACjF,IAAM,MAAM,GAAG,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnD,IAAM,SAAS,GAAG,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACtD,IAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,MAAM,CAAC,WAAW,KAAK,iBAAiB,IAAI,WAAW,GAAG,CAAC,EAAE;gBAC7D,IAAM,eAAe,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;gBAC5D,IAAI,eAAe,IAAI,eAAe,CAAC,WAAW,KAAK,MAAM,EAAE;oBAC3D,OAAO,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;iBAC9E;aACJ;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-dom';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n ContentModelSegmentFormat,\n ContentModelText,\n FormatContentModelContext,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * Invoke a callback to format the text segment before the selection marker using Content Model\n * @param editor The editor object\n * @param callback The callback to format the text segment.\n */\nexport function formatTextSegmentBeforeSelectionMarker(\n editor: IEditor,\n callback: (\n model: ContentModelDocument,\n previousSegment: ContentModelText,\n paragraph: ContentModelParagraph,\n markerFormat: ContentModelSegmentFormat,\n context: FormatContentModelContext\n ) => boolean\n) {\n editor.formatContentModel((model, context) => {\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(\n model,\n false /*includeFormatHolder*/\n );\n\n if (selectedSegmentsAndParagraphs.length > 0 && selectedSegmentsAndParagraphs[0][1]) {\n const marker = selectedSegmentsAndParagraphs[0][0];\n const paragraph = selectedSegmentsAndParagraphs[0][1];\n const markerIndex = paragraph.segments.indexOf(marker);\n if (marker.segmentType === 'SelectionMarker' && markerIndex > 0) {\n const previousSegment = paragraph.segments[markerIndex - 1];\n if (previousSegment && previousSegment.segmentType === 'Text') {\n return callback(model, previousSegment, paragraph, marker.format, context);\n }\n }\n }\n return false;\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.1.0",
|
|
7
|
+
"roosterjs-content-model-types": "^9.1.0"
|
|
8
8
|
},
|
|
9
|
-
"version": "9.
|
|
9
|
+
"version": "9.1.0",
|
|
10
10
|
"main": "./lib/index.js",
|
|
11
11
|
"typings": "./lib/index.d.ts",
|
|
12
12
|
"module": "./lib-mjs/index.js",
|