roosterjs-content-model-api 0.21.2 → 0.22.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 +0 -3
- package/lib/index.js +1 -7
- package/lib/index.js.map +1 -1
- package/lib/modelApi/list/setListType.js +25 -0
- package/lib/modelApi/list/setListType.js.map +1 -1
- package/lib/modelApi/selection/collapseTableSelection.d.ts +1 -2
- package/lib/modelApi/selection/collapseTableSelection.js +2 -2
- package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib/modelApi/table/alignTableCell.js +2 -3
- package/lib/modelApi/table/alignTableCell.js.map +1 -1
- package/lib/modelApi/table/deleteTableColumn.js +6 -6
- package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib/modelApi/table/deleteTableRow.js +2 -2
- package/lib/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib/modelApi/table/insertTableColumn.js +6 -6
- package/lib/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib/modelApi/table/insertTableRow.js +3 -3
- package/lib/modelApi/table/insertTableRow.js.map +1 -1
- package/lib/modelApi/table/mergeTableCells.js +6 -5
- package/lib/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib/modelApi/table/mergeTableColumn.js +3 -3
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib/modelApi/table/mergeTableRow.js +3 -3
- package/lib/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib/modelApi/table/splitTableCellHorizontally.js +3 -3
- package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib/modelApi/table/splitTableCellVertically.js +7 -5
- package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib/publicApi/format/getFormatState.js +7 -1
- package/lib/publicApi/format/getFormatState.js.map +1 -1
- package/lib/publicApi/image/changeImage.js +1 -2
- package/lib/publicApi/image/changeImage.js.map +1 -1
- package/lib/publicApi/image/insertImage.js +1 -2
- package/lib/publicApi/image/insertImage.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.js +29 -30
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib/publicApi/table/editTable.js +1 -2
- package/lib/publicApi/table/editTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.js +1 -2
- package/lib/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-amd/index.d.ts +0 -3
- package/lib-amd/index.js +2 -5
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/list/setListType.js +25 -0
- package/lib-amd/modelApi/list/setListType.js.map +1 -1
- package/lib-amd/modelApi/selection/collapseTableSelection.d.ts +1 -2
- package/lib-amd/modelApi/selection/collapseTableSelection.js +2 -2
- package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-amd/modelApi/table/alignTableCell.js +3 -3
- package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableColumn.js +6 -6
- package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableRow.js +2 -2
- package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableColumn.js +6 -6
- package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableRow.js +3 -3
- package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableCells.js +6 -5
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableColumn.js +3 -3
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableRow.js +3 -3
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js +3 -3
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellVertically.js +7 -5
- package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-amd/publicApi/format/getFormatState.js +7 -1
- package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
- package/lib-amd/publicApi/image/changeImage.js +2 -2
- package/lib-amd/publicApi/image/changeImage.js.map +1 -1
- package/lib-amd/publicApi/image/insertImage.js +2 -2
- package/lib-amd/publicApi/image/insertImage.js.map +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +30 -30
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-amd/publicApi/table/editTable.js +2 -2
- package/lib-amd/publicApi/table/editTable.js.map +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.js +2 -2
- package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-mjs/index.d.ts +0 -3
- package/lib-mjs/index.js +0 -3
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/list/setListType.js +25 -0
- package/lib-mjs/modelApi/list/setListType.js.map +1 -1
- package/lib-mjs/modelApi/selection/collapseTableSelection.d.ts +1 -2
- package/lib-mjs/modelApi/selection/collapseTableSelection.js +2 -2
- package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTableCell.js +2 -3
- package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableColumn.js +5 -5
- package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableColumn.js +5 -5
- package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableRow.js +2 -2
- package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js +5 -4
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js +2 -2
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js +2 -2
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js +2 -2
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellVertically.js +6 -4
- package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-mjs/publicApi/format/getFormatState.js +8 -2
- package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
- package/lib-mjs/publicApi/image/changeImage.js +1 -2
- package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
- package/lib-mjs/publicApi/image/insertImage.js +1 -2
- package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +29 -30
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-mjs/publicApi/table/editTable.js +1 -2
- package/lib-mjs/publicApi/table/editTable.js.map +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.js +1 -2
- package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
- package/package.json +4 -4
- package/lib/modelApi/domUtils/readFile.d.ts +0 -8
- package/lib/modelApi/domUtils/readFile.js +0 -24
- package/lib/modelApi/domUtils/readFile.js.map +0 -1
- package/lib/modelApi/table/getSelectedCells.d.ts +0 -14
- package/lib/modelApi/table/getSelectedCells.js +0 -32
- package/lib/modelApi/table/getSelectedCells.js.map +0 -1
- package/lib/publicApi/selection/hasSelectionInBlock.d.ts +0 -6
- package/lib/publicApi/selection/hasSelectionInBlock.js +0 -25
- package/lib/publicApi/selection/hasSelectionInBlock.js.map +0 -1
- package/lib/publicApi/selection/hasSelectionInBlockGroup.d.ts +0 -6
- package/lib/publicApi/selection/hasSelectionInBlockGroup.js +0 -18
- package/lib/publicApi/selection/hasSelectionInBlockGroup.js.map +0 -1
- package/lib/publicApi/selection/hasSelectionInSegment.d.ts +0 -6
- package/lib/publicApi/selection/hasSelectionInSegment.js +0 -13
- package/lib/publicApi/selection/hasSelectionInSegment.js.map +0 -1
- package/lib-amd/modelApi/domUtils/readFile.d.ts +0 -8
- package/lib-amd/modelApi/domUtils/readFile.js +0 -26
- package/lib-amd/modelApi/domUtils/readFile.js.map +0 -1
- package/lib-amd/modelApi/table/getSelectedCells.d.ts +0 -14
- package/lib-amd/modelApi/table/getSelectedCells.js +0 -33
- package/lib-amd/modelApi/table/getSelectedCells.js.map +0 -1
- package/lib-amd/publicApi/selection/hasSelectionInBlock.d.ts +0 -6
- package/lib-amd/publicApi/selection/hasSelectionInBlock.js +0 -25
- package/lib-amd/publicApi/selection/hasSelectionInBlock.js.map +0 -1
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.d.ts +0 -6
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.js +0 -19
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.js.map +0 -1
- package/lib-amd/publicApi/selection/hasSelectionInSegment.d.ts +0 -6
- package/lib-amd/publicApi/selection/hasSelectionInSegment.js +0 -14
- package/lib-amd/publicApi/selection/hasSelectionInSegment.js.map +0 -1
- package/lib-mjs/modelApi/domUtils/readFile.d.ts +0 -8
- package/lib-mjs/modelApi/domUtils/readFile.js +0 -20
- package/lib-mjs/modelApi/domUtils/readFile.js.map +0 -1
- package/lib-mjs/modelApi/table/getSelectedCells.d.ts +0 -14
- package/lib-mjs/modelApi/table/getSelectedCells.js +0 -28
- package/lib-mjs/modelApi/table/getSelectedCells.js.map +0 -1
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.d.ts +0 -6
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.js +0 -22
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.js.map +0 -1
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.d.ts +0 -6
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.js +0 -15
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.js.map +0 -1
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.d.ts +0 -6
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.js +0 -10
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setTableCellShade.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/table/setTableCellShade.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"setTableCellShade.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/table/setTableCellShade.ts"],"names":[],"mappings":";;;AAAA,6EAKsC;AAGtC;;;;GAIG;AACH,SAAwB,iBAAiB,CAAC,MAAyB,EAAE,KAAoB;IACrF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,oBAAU,IAAA,oDAAqB,EAAC,KAAK,CAAC,IAAA,EAArC,KAAK,QAAgC,CAAC;QAE7C,IAAI,KAAK,EAAE;YACP,IAAA,6CAAc,EAAC,KAAK,CAAC,CAAC;YAEtB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;gBAClB,OAAA,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;oBAClB,IAAI,IAAA,uDAAwB,EAAC,IAAI,CAAC,EAAE;wBAChC,IAAA,0DAA2B,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;qBACtE;gBACL,CAAC,CAAC;YAJF,CAIE,CACL,CAAC;YAEF,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,EACD;QACI,OAAO,EAAE,mBAAmB;KAC/B,CACJ,CAAC;AACN,CAAC;AA3BD,oCA2BC","sourcesContent":["import {\n hasSelectionInBlockGroup,\n getFirstSelectedTable,\n normalizeTable,\n setTableCellBackgroundColor,\n} from 'roosterjs-content-model-core';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set table cell shade color\n * @param editor The editor instance\n * @param color The color to set. Pass null to remove existing shade color\n */\nexport default function setTableCellShade(editor: IStandaloneEditor, color: string | null) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const [table] = getFirstSelectedTable(model);\n\n if (table) {\n normalizeTable(table);\n\n table.rows.forEach(row =>\n row.cells.forEach(cell => {\n if (hasSelectionInBlockGroup(cell)) {\n setTableCellBackgroundColor(cell, color, true /*isColorOverride*/);\n }\n })\n );\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'setTableCellShade',\n }\n );\n}\n"]}
|
package/lib-amd/index.d.ts
CHANGED
|
@@ -21,9 +21,6 @@ export { default as changeCapitalization } from './publicApi/segment/changeCapit
|
|
|
21
21
|
export { default as insertImage } from './publicApi/image/insertImage';
|
|
22
22
|
export { default as setListStyle } from './publicApi/list/setListStyle';
|
|
23
23
|
export { default as setListStartNumber } from './publicApi/list/setListStartNumber';
|
|
24
|
-
export { default as hasSelectionInBlock } from './publicApi/selection/hasSelectionInBlock';
|
|
25
|
-
export { default as hasSelectionInSegment } from './publicApi/selection/hasSelectionInSegment';
|
|
26
|
-
export { default as hasSelectionInBlockGroup } from './publicApi/selection/hasSelectionInBlockGroup';
|
|
27
24
|
export { default as setIndentation } from './publicApi/block/setIndentation';
|
|
28
25
|
export { default as setAlignment } from './publicApi/block/setAlignment';
|
|
29
26
|
export { default as setDirection } from './publicApi/block/setDirection';
|
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/
|
|
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"], 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) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
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.
|
|
4
|
+
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.default; } });
|
|
6
6
|
Object.defineProperty(exports, "formatTable", { enumerable: true, get: function () { return formatTable_1.default; } });
|
|
7
7
|
Object.defineProperty(exports, "setTableCellShade", { enumerable: true, get: function () { return setTableCellShade_1.default; } });
|
|
@@ -25,9 +25,6 @@ define(["require", "exports", "./publicApi/table/insertTable", "./publicApi/tabl
|
|
|
25
25
|
Object.defineProperty(exports, "insertImage", { enumerable: true, get: function () { return insertImage_1.default; } });
|
|
26
26
|
Object.defineProperty(exports, "setListStyle", { enumerable: true, get: function () { return setListStyle_1.default; } });
|
|
27
27
|
Object.defineProperty(exports, "setListStartNumber", { enumerable: true, get: function () { return setListStartNumber_1.default; } });
|
|
28
|
-
Object.defineProperty(exports, "hasSelectionInBlock", { enumerable: true, get: function () { return hasSelectionInBlock_1.default; } });
|
|
29
|
-
Object.defineProperty(exports, "hasSelectionInSegment", { enumerable: true, get: function () { return hasSelectionInSegment_1.default; } });
|
|
30
|
-
Object.defineProperty(exports, "hasSelectionInBlockGroup", { enumerable: true, get: function () { return hasSelectionInBlockGroup_1.default; } });
|
|
31
28
|
Object.defineProperty(exports, "setIndentation", { enumerable: true, get: function () { return setIndentation_1.default; } });
|
|
32
29
|
Object.defineProperty(exports, "setAlignment", { enumerable: true, get: function () { return setAlignment_1.default; } });
|
|
33
30
|
Object.defineProperty(exports, "setDirection", { enumerable: true, get: function () { return setDirection_1.default; } });
|
package/lib-amd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages-content-model/roosterjs-content-model-api/lib/index.ts"],"names":[],"mappings":";;;;IAAS,0GAAA,OAAO,OAAe;IACtB,0GAAA,OAAO,OAAe;IACtB,sHAAA,OAAO,OAAqB;IAC5B,sGAAA,OAAO,OAAa;IACpB,gIAAA,OAAO,OAA0B;IACjC,4GAAA,OAAO,OAAgB;IACvB,kHAAA,OAAO,OAAmB;IAC1B,wGAAA,OAAO,OAAc;IACrB,4GAAA,OAAO,OAAgB;IACvB,kHAAA,OAAO,OAAmB;IAC1B,0HAAA,OAAO,OAAuB;IAC9B,kHAAA,OAAO,OAAmB;IAC1B,sHAAA,OAAO,OAAqB;IAC5B,wHAAA,OAAO,OAAsB;IAC7B,0GAAA,OAAO,OAAe;IACtB,0GAAA,OAAO,OAAe;IACtB,4GAAA,OAAO,OAAgB;IACvB,gHAAA,OAAO,OAAkB;IACzB,wHAAA,OAAO,OAAsB;IAC7B,4HAAA,OAAO,OAAwB;IAC/B,0GAAA,OAAO,OAAe;IACtB,4GAAA,OAAO,OAAgB;IACvB,wHAAA,OAAO,OAAsB;IAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages-content-model/roosterjs-content-model-api/lib/index.ts"],"names":[],"mappings":";;;;IAAS,0GAAA,OAAO,OAAe;IACtB,0GAAA,OAAO,OAAe;IACtB,sHAAA,OAAO,OAAqB;IAC5B,sGAAA,OAAO,OAAa;IACpB,gIAAA,OAAO,OAA0B;IACjC,4GAAA,OAAO,OAAgB;IACvB,kHAAA,OAAO,OAAmB;IAC1B,wGAAA,OAAO,OAAc;IACrB,4GAAA,OAAO,OAAgB;IACvB,kHAAA,OAAO,OAAmB;IAC1B,0HAAA,OAAO,OAAuB;IAC9B,kHAAA,OAAO,OAAmB;IAC1B,sHAAA,OAAO,OAAqB;IAC5B,wHAAA,OAAO,OAAsB;IAC7B,0GAAA,OAAO,OAAe;IACtB,0GAAA,OAAO,OAAe;IACtB,4GAAA,OAAO,OAAgB;IACvB,gHAAA,OAAO,OAAkB;IACzB,wHAAA,OAAO,OAAsB;IAC7B,4HAAA,OAAO,OAAwB;IAC/B,0GAAA,OAAO,OAAe;IACtB,4GAAA,OAAO,OAAgB;IACvB,wHAAA,OAAO,OAAsB;IAC7B,gHAAA,OAAO,OAAkB;IACzB,4GAAA,OAAO,OAAgB;IACvB,4GAAA,OAAO,OAAgB;IACvB,kHAAA,OAAO,OAAmB;IAC1B,oHAAA,OAAO,OAAoB;IAC3B,wGAAA,OAAO,OAAc;IACrB,gHAAA,OAAO,OAAkB;IACzB,sHAAA,OAAO,OAAqB;IAC5B,0GAAA,OAAO,OAAe;IACtB,gHAAA,OAAO,OAAkB;IACzB,0GAAA,OAAO,OAAe;IACtB,wGAAA,OAAO,OAAc;IACrB,wGAAA,OAAO,OAAc;IACrB,0HAAA,OAAO,OAAuB;IAC9B,kHAAA,OAAO,OAAmB;IAC1B,4HAAA,OAAO,OAAwB;IAC/B,wHAAA,OAAO,OAAsB;IAC7B,wGAAA,OAAO,OAAc;IACrB,4GAAA,OAAO,OAAgB","sourcesContent":["export { default as insertTable } from './publicApi/table/insertTable';\nexport { default as formatTable } from './publicApi/table/formatTable';\nexport { default as setTableCellShade } from './publicApi/table/setTableCellShade';\nexport { default as editTable } from './publicApi/table/editTable';\nexport { default as applyTableBorderFormat } from './publicApi/table/applyTableBorderFormat';\nexport { default as toggleBullet } from './publicApi/list/toggleBullet';\nexport { default as toggleNumbering } from './publicApi/list/toggleNumbering';\nexport { default as toggleBold } from './publicApi/segment/toggleBold';\nexport { default as toggleItalic } from './publicApi/segment/toggleItalic';\nexport { default as toggleUnderline } from './publicApi/segment/toggleUnderline';\nexport { default as toggleStrikethrough } from './publicApi/segment/toggleStrikethrough';\nexport { default as toggleSubscript } from './publicApi/segment/toggleSubscript';\nexport { default as toggleSuperscript } from './publicApi/segment/toggleSuperscript';\nexport { default as setBackgroundColor } from './publicApi/segment/setBackgroundColor';\nexport { default as setFontName } from './publicApi/segment/setFontName';\nexport { default as setFontSize } from './publicApi/segment/setFontSize';\nexport { default as setTextColor } from './publicApi/segment/setTextColor';\nexport { default as changeFontSize } from './publicApi/segment/changeFontSize';\nexport { default as applySegmentFormat } from './publicApi/segment/applySegmentFormat';\nexport { default as changeCapitalization } from './publicApi/segment/changeCapitalization';\nexport { default as insertImage } from './publicApi/image/insertImage';\nexport { default as setListStyle } from './publicApi/list/setListStyle';\nexport { default as setListStartNumber } from './publicApi/list/setListStartNumber';\nexport { default as setIndentation } from './publicApi/block/setIndentation';\nexport { default as setAlignment } from './publicApi/block/setAlignment';\nexport { default as setDirection } from './publicApi/block/setDirection';\nexport { default as setHeadingLevel } from './publicApi/block/setHeadingLevel';\nexport { default as toggleBlockQuote } from './publicApi/block/toggleBlockQuote';\nexport { default as setSpacing } from './publicApi/block/setSpacing';\nexport { default as setImageBorder } from './publicApi/image/setImageBorder';\nexport { default as setImageBoxShadow } from './publicApi/image/setImageBoxShadow';\nexport { default as changeImage } from './publicApi/image/changeImage';\nexport { default as getFormatState } from './publicApi/format/getFormatState';\nexport { default as clearFormat } from './publicApi/format/clearFormat';\nexport { default as insertLink } from './publicApi/link/insertLink';\nexport { default as removeLink } from './publicApi/link/removeLink';\nexport { default as adjustLinkSelection } from './publicApi/link/adjustLinkSelection';\nexport { default as setImageAltText } from './publicApi/image/setImageAltText';\nexport { default as adjustImageSelection } from './publicApi/image/adjustImageSelection';\nexport { default as setParagraphMargin } from './publicApi/block/setParagraphMargin';\nexport { default as toggleCode } from './publicApi/segment/toggleCode';\nexport { default as insertEntity } from './publicApi/entity/insertEntity';\n"]}
|
|
@@ -29,6 +29,20 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
|
|
|
29
29
|
else if (block.blocks.length == 1) {
|
|
30
30
|
(0, roosterjs_content_model_dom_1.setParagraphNotImplicit)(block.blocks[0]);
|
|
31
31
|
}
|
|
32
|
+
if (alreadyInExpectedType) {
|
|
33
|
+
//if the list item has margins or textAlign, we need to apply them to the block to preserve the indention and alignment
|
|
34
|
+
block.blocks.forEach(function (x) {
|
|
35
|
+
if (block.format.marginLeft) {
|
|
36
|
+
x.format.marginLeft = block.format.marginLeft;
|
|
37
|
+
}
|
|
38
|
+
if (block.format.marginRight) {
|
|
39
|
+
x.format.marginRight = block.format.marginRight;
|
|
40
|
+
}
|
|
41
|
+
if (block.format.textAlign) {
|
|
42
|
+
x.format.textAlign = block.format.textAlign;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
32
46
|
}
|
|
33
47
|
else {
|
|
34
48
|
var index = parent.blocks.indexOf(block);
|
|
@@ -63,6 +77,17 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
|
|
|
63
77
|
block.isImplicit = true;
|
|
64
78
|
}
|
|
65
79
|
newListItem.blocks.push(block);
|
|
80
|
+
if (block.format.marginRight) {
|
|
81
|
+
newListItem.format.marginRight = block.format.marginRight;
|
|
82
|
+
block.format.marginRight = undefined;
|
|
83
|
+
}
|
|
84
|
+
if (block.format.marginLeft) {
|
|
85
|
+
newListItem.format.marginLeft = block.format.marginLeft;
|
|
86
|
+
block.format.marginLeft = undefined;
|
|
87
|
+
}
|
|
88
|
+
if (block.format.textAlign) {
|
|
89
|
+
newListItem.format.textAlign = block.format.textAlign;
|
|
90
|
+
}
|
|
66
91
|
parent.blocks.splice(index, 1, newListItem);
|
|
67
92
|
existingListItems.push(newListItem);
|
|
68
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setListType.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/list/setListType.ts"],"names":[],"mappings":";;;;IAaA;;OAEG;IACH,SAAgB,WAAW,CAAC,KAA2B,EAAE,QAAqB;QAC1E,IAAM,oBAAoB,GAAG,IAAA,mDAAoB,EAC7C,KAAK,EACL,CAAC,UAAU,CAAC,EACZ,EAAE,CAAC,8IAA8I;SACpJ,CAAC;QACF,IAAM,qBAAqB,GAAG,oBAAoB,CAAC,KAAK,CAAC,UAAC,EAAS;;gBAAP,KAAK,WAAA;YAC7D,OAAA,IAAA,iDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC;gBACvD,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,MAAM,CAAC,KA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AAC,CAAC,MAAM,CAAC,YAAY,GAAG,GAAG,CAAC,EAAvC,CAAuC,CAAC,CAAC;wBACxE,iBAAiB,GAAG,EAAE,CAAC;qBAC1B;iBACJ;aACJ;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;QAE7B,OAAO,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3C,CAAC;
|
|
1
|
+
{"version":3,"file":"setListType.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/list/setListType.ts"],"names":[],"mappings":";;;;IAaA;;OAEG;IACH,SAAgB,WAAW,CAAC,KAA2B,EAAE,QAAqB;QAC1E,IAAM,oBAAoB,GAAG,IAAA,mDAAoB,EAC7C,KAAK,EACL,CAAC,UAAU,CAAC,EACZ,EAAE,CAAC,8IAA8I;SACpJ,CAAC;QACF,IAAM,qBAAqB,GAAG,oBAAoB,CAAC,KAAK,CAAC,UAAC,EAAS;;gBAAP,KAAK,WAAA;YAC7D,OAAA,IAAA,iDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC;gBACvD,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,QAAQ,KAAI,QAAQ;gBAC7D,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;SAAA,CACjC,CAAC;QACF,IAAI,iBAAiB,GAA2B,EAAE,CAAC;QACnD,IAAI,yBAAyB,GAAG,KAAK,CAAC;QAEtC,oBAAoB,CAAC,OAAO,CAAC,UAAC,EAAiB,EAAE,SAAS;;gBAA1B,KAAK,WAAA,EAAE,MAAM,YAAA;YACzC,IAAI,IAAA,iDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC,EAAE;gBAC7D,IAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;gBAEjC,IAAI,CAAC,qBAAq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Type } from 'roosterjs-content-model-core';\nimport {\n createListItem,\n createListLevel,\n normalizeContentModel,\n setParagraphNotImplicit,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlock,\n ContentModelDocument,\n ContentModelListItem,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function setListType(model: ContentModelDocument, listType: 'OL' | 'UL') {\n const paragraphOrListItems = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n [] // Set stop types to be empty so we can find list items even cross the boundary of table, then we can always operation on the list item if any\n );\n const alreadyInExpectedType = paragraphOrListItems.every(({ block }) =>\n isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')\n ? block.levels[block.levels.length - 1]?.listType == listType\n : shouldIgnoreBlock(block)\n );\n let existingListItems: ContentModelListItem[] = [];\n let hasIgnoredParagraphBefore = false;\n\n paragraphOrListItems.forEach(({ block, parent }, itemIndex) => {\n if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n const level = block.levels.pop();\n\n if (!alreadyInExpectedType && level) {\n level.listType = listType;\n block.levels.push(level);\n } else if (block.blocks.length == 1) {\n setParagraphNotImplicit(block.blocks[0]);\n }\n\n if (alreadyInExpectedType) {\n //if the list item has margins or textAlign, we need to apply them to the block to preserve the indention and alignment\n block.blocks.forEach(x => {\n if (block.format.marginLeft) {\n x.format.marginLeft = block.format.marginLeft;\n }\n\n if (block.format.marginRight) {\n x.format.marginRight = block.format.marginRight;\n }\n\n if (block.format.textAlign) {\n x.format.textAlign = block.format.textAlign;\n }\n });\n }\n } else {\n const index = parent.blocks.indexOf(block);\n\n if (index >= 0) {\n if (paragraphOrListItems.length == 1 || !shouldIgnoreBlock(block)) {\n const prevBlock = parent.blocks[index - 1];\n const segmentFormat =\n (block.blockType == 'Paragraph' && block.segments[0]?.format) || {};\n const newListItem = createListItem(\n [\n createListLevel(listType, {\n startNumberOverride:\n itemIndex > 0 ||\n (prevBlock?.blockType == 'BlockGroup' &&\n prevBlock.blockGroupType == 'ListItem' &&\n prevBlock.levels[0]?.listType == 'OL')\n ? undefined\n : 1,\n direction: block.format.direction,\n textAlign: block.format.textAlign,\n marginTop: hasIgnoredParagraphBefore ? '0' : undefined,\n marginBlockEnd: '0px',\n marginBlockStart: '0px',\n }),\n ],\n // For list bullet, we only want to carry over these formats from segments:\n {\n fontFamily: segmentFormat.fontFamily,\n fontSize: segmentFormat.fontSize,\n textColor: segmentFormat.textColor,\n }\n );\n\n // Since there is only one paragraph under the list item, no need to keep its paragraph element (DIV).\n // TODO: Do we need to keep the CSS styles applied to original DIV?\n if (block.blockType == 'Paragraph') {\n block.isImplicit = true;\n }\n\n newListItem.blocks.push(block);\n\n if (block.format.marginRight) {\n newListItem.format.marginRight = block.format.marginRight;\n block.format.marginRight = undefined;\n }\n if (block.format.marginLeft) {\n newListItem.format.marginLeft = block.format.marginLeft;\n block.format.marginLeft = undefined;\n }\n\n if (block.format.textAlign) {\n newListItem.format.textAlign = block.format.textAlign;\n }\n\n parent.blocks.splice(index, 1, newListItem);\n existingListItems.push(newListItem);\n } else {\n hasIgnoredParagraphBefore = true;\n\n existingListItems.forEach(x => (x.levels[0].format.marginBottom = '0'));\n existingListItems = [];\n }\n }\n }\n });\n\n normalizeContentModel(model);\n\n return paragraphOrListItems.length > 0;\n}\n\nfunction shouldIgnoreBlock(block: ContentModelBlock) {\n switch (block.blockType) {\n case 'Table':\n return false;\n case 'Paragraph':\n return block.segments.every(\n x => x.segmentType == 'Br' || x.segmentType == 'SelectionMarker'\n );\n default:\n return true;\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ContentModelTableRow } from 'roosterjs-content-model-types';
|
|
2
|
-
import type { TableSelectionCoordinates } from '../table/getSelectedCells';
|
|
1
|
+
import type { ContentModelTableRow, TableSelectionCoordinates } from 'roosterjs-content-model-types';
|
|
3
2
|
/**
|
|
4
3
|
* @internal
|
|
5
4
|
*/
|
|
@@ -7,8 +7,8 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require,
|
|
|
7
7
|
*/
|
|
8
8
|
function collapseTableSelection(rows, selection) {
|
|
9
9
|
var _a;
|
|
10
|
-
var
|
|
11
|
-
var cell = (_a = rows[firstRow]) === null || _a === void 0 ? void 0 : _a.cells[
|
|
10
|
+
var firstColumn = selection.firstColumn, firstRow = selection.firstRow;
|
|
11
|
+
var cell = (_a = rows[firstRow]) === null || _a === void 0 ? void 0 : _a.cells[firstColumn];
|
|
12
12
|
if (cell) {
|
|
13
13
|
(0, roosterjs_content_model_dom_1.addSegment)(cell, (0, roosterjs_content_model_dom_1.createSelectionMarker)());
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapseTableSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/selection/collapseTableSelection.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"collapseTableSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/selection/collapseTableSelection.ts"],"names":[],"mappings":";;;;IAMA;;OAEG;IACH,SAAgB,sBAAsB,CAClC,IAA4B,EAC5B,SAAoC;;QAE5B,IAAA,WAAW,GAAe,SAAS,YAAxB,EAAE,QAAQ,GAAK,SAAS,SAAd,CAAe;QAC5C,IAAM,IAAI,GAAG,MAAA,IAAI,CAAC,QAAQ,CAAC,0CAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,IAAI,EAAE;YACN,IAAA,wCAAU,EAAC,IAAI,EAAE,IAAA,mDAAqB,GAAE,CAAC,CAAC;SAC7C;IACL,CAAC;IATD,wDASC","sourcesContent":["import { addSegment, createSelectionMarker } from 'roosterjs-content-model-dom';\nimport type {\n ContentModelTableRow,\n TableSelectionCoordinates,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function collapseTableSelection(\n rows: ContentModelTableRow[],\n selection: TableSelectionCoordinates\n) {\n const { firstColumn, firstRow } = selection;\n const cell = rows[firstRow]?.cells[firstColumn];\n if (cell) {\n addSegment(cell, createSelectionMarker());\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-core"], function (require, exports, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.alignTableCellVertically = exports.alignTableCellHorizontally = void 0;
|
|
@@ -37,10 +37,10 @@ define(["require", "exports", "./getSelectedCells", "roosterjs-content-model-cor
|
|
|
37
37
|
exports.alignTableCellVertically = alignTableCellVertically;
|
|
38
38
|
function alignTableCellInternal(table, callback) {
|
|
39
39
|
var _a;
|
|
40
|
-
var sel = (0,
|
|
40
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
41
41
|
if (sel) {
|
|
42
42
|
for (var rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {
|
|
43
|
-
for (var colIndex = sel.
|
|
43
|
+
for (var colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {
|
|
44
44
|
var cell = (_a = table.rows[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells[colIndex];
|
|
45
45
|
var format = cell === null || cell === void 0 ? void 0 : cell.format;
|
|
46
46
|
if (format) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alignTableCell.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/alignTableCell.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"alignTableCell.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/alignTableCell.ts"],"names":[],"mappings":";;;;IAQA,IAAM,iBAAiB,GAGlB;QACD,aAAa,EAAE,OAAO;QACtB,eAAe,EAAE,QAAQ;QACzB,cAAc,EAAE,KAAK;KACxB,CAAC;IAEF,IA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nD,IAAM,MAAM,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC;oBAE5B,IAAI,MAAM,EAAE;wBACR,OAAO,IAAI,CAAC,aAAa,CAAC;wBAE1B,QAAQ,CAAC,IAAI,CAAC,CAAC;wBAEf,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;4BACrB,IAAI,KAAK,CAAC,SAAS,KAAK,WAAW,EAAE;gCACjC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;6BACjC;wBACL,CAAC,CAAC,CAAC;qBACN;iBACJ;aACJ;SACJ;IACL,CAAC","sourcesContent":["import { getSelectedCells, updateTableCellMetadata } from 'roosterjs-content-model-core';\nimport type {\n ContentModelTable,\n ContentModelTableCell,\n TableCellHorizontalAlignOperation,\n TableCellVerticalAlignOperation,\n} from 'roosterjs-content-model-types';\n\nconst TextAlignValueMap: Partial<Record<\n TableCellHorizontalAlignOperation,\n 'start' | 'center' | 'end'\n>> = {\n alignCellLeft: 'start',\n alignCellCenter: 'center',\n alignCellRight: 'end',\n};\n\nconst VerticalAlignValueMap: Partial<Record<\n TableCellVerticalAlignOperation,\n 'top' | 'middle' | 'bottom'\n>> = {\n alignCellTop: 'top',\n alignCellMiddle: 'middle',\n alignCellBottom: 'bottom',\n};\n\n/**\n * @internal\n */\nexport function alignTableCellHorizontally(\n table: ContentModelTable,\n operation: TableCellHorizontalAlignOperation\n) {\n alignTableCellInternal(table, cell => {\n cell.format.textAlign = TextAlignValueMap[operation];\n });\n}\n\n/**\n * @internal\n */\nexport function alignTableCellVertically(\n table: ContentModelTable,\n operation: TableCellVerticalAlignOperation\n) {\n alignTableCellInternal(table, cell => {\n cell.format.verticalAlign = VerticalAlignValueMap[operation];\n\n updateTableCellMetadata(cell, metadata => {\n metadata = metadata || {};\n metadata.vAlignOverride = true;\n return metadata;\n });\n });\n}\n\nfunction alignTableCellInternal(\n table: ContentModelTable,\n callback: (cell: ContentModelTableCell) => void\n) {\n const sel = getSelectedCells(table);\n\n if (sel) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = table.rows[rowIndex]?.cells[colIndex];\n const format = cell?.format;\n\n if (format) {\n delete cell.cachedElement;\n\n callback(cell);\n\n cell.blocks.forEach(block => {\n if (block.blockType === 'Paragraph') {\n delete block.format.textAlign;\n }\n });\n }\n }\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "../selection/collapseTableSelection", "
|
|
1
|
+
define(["require", "exports", "../selection/collapseTableSelection", "roosterjs-content-model-core"], function (require, exports, collapseTableSelection_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.deleteTableColumn = void 0;
|
|
@@ -6,17 +6,17 @@ define(["require", "exports", "../selection/collapseTableSelection", "./getSelec
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
function deleteTableColumn(table) {
|
|
9
|
-
var sel = (0,
|
|
9
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
10
10
|
if (sel) {
|
|
11
11
|
for (var rowIndex = 0; rowIndex < table.rows.length; rowIndex++) {
|
|
12
|
-
var cellInNextCol = table.rows[rowIndex].cells[sel.
|
|
12
|
+
var cellInNextCol = table.rows[rowIndex].cells[sel.lastColumn + 1];
|
|
13
13
|
if (cellInNextCol) {
|
|
14
14
|
cellInNextCol.spanLeft =
|
|
15
|
-
cellInNextCol.spanLeft && table.rows[rowIndex].cells[sel.
|
|
15
|
+
cellInNextCol.spanLeft && table.rows[rowIndex].cells[sel.firstColumn].spanLeft;
|
|
16
16
|
}
|
|
17
|
-
table.rows[rowIndex].cells.splice(sel.
|
|
17
|
+
table.rows[rowIndex].cells.splice(sel.firstColumn, sel.lastColumn - sel.firstColumn + 1);
|
|
18
18
|
}
|
|
19
|
-
table.widths.splice(sel.
|
|
19
|
+
table.widths.splice(sel.firstColumn, sel.lastColumn - sel.firstColumn + 1);
|
|
20
20
|
(0, collapseTableSelection_1.collapseTableSelection)(table.rows, sel);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteTableColumn.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/deleteTableColumn.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,iBAAiB,CAAC,KAAwB;QACtD,IAAM,GAAG,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"deleteTableColumn.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/deleteTableColumn.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,iBAAiB,CAAC,KAAwB;QACtD,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,KAAK,CAAC,CAAC;QAEpC,IAAI,GAAG,EAAE;YACL,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;gBAC7D,IAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;gBAErE,IAAI,aAAa,EAAE;oBACf,aAAa,CAAC,QAAQ;wBAClB,aAAa,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC;iBACtF;gBAED,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,MAAM,CAC7B,GAAG,CAAC,WAAW,EACf,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,WAAW,GAAG,CAAC,CACvC,CAAC;aACL;YAED,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;YAC3E,IAAA,+CAAsB,EAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC3C;IACL,CAAC;IArBD,8CAqBC","sourcesContent":["import { collapseTableSelection } from '../selection/collapseTableSelection';\nimport { getSelectedCells } from 'roosterjs-content-model-core';\nimport type { ContentModelTable } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function deleteTableColumn(table: ContentModelTable) {\n const sel = getSelectedCells(table);\n\n if (sel) {\n for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex++) {\n const cellInNextCol = table.rows[rowIndex].cells[sel.lastColumn + 1];\n\n if (cellInNextCol) {\n cellInNextCol.spanLeft =\n cellInNextCol.spanLeft && table.rows[rowIndex].cells[sel.firstColumn].spanLeft;\n }\n\n table.rows[rowIndex].cells.splice(\n sel.firstColumn,\n sel.lastColumn - sel.firstColumn + 1\n );\n }\n\n table.widths.splice(sel.firstColumn, sel.lastColumn - sel.firstColumn + 1);\n collapseTableSelection(table.rows, sel);\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "../selection/collapseTableSelection", "
|
|
1
|
+
define(["require", "exports", "../selection/collapseTableSelection", "roosterjs-content-model-core"], function (require, exports, collapseTableSelection_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.deleteTableRow = void 0;
|
|
@@ -6,7 +6,7 @@ define(["require", "exports", "../selection/collapseTableSelection", "./getSelec
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
function deleteTableRow(table) {
|
|
9
|
-
var sel = (0,
|
|
9
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
10
10
|
if (sel) {
|
|
11
11
|
table.rows[sel.firstRow].cells.forEach(function (cell, colIndex) {
|
|
12
12
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteTableRow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/deleteTableRow.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,cAAc,CAAC,KAAwB;QACnD,IAAM,GAAG,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"deleteTableRow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/deleteTableRow.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,cAAc,CAAC,KAAwB;QACnD,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,KAAK,CAAC,CAAC;QAEpC,IAAI,GAAG,EAAE;YACL,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,QAAQ;;gBAClD,IAAM,aAAa,GAAG,MAAA,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,0CAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAEnE,IAAI,aAAa,EAAE;oBACf,aAAa,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;iBACvE;YACL,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;YAEhE,IAAA,+CAAsB,EAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC3C;IACL,CAAC;IAhBD,wCAgBC","sourcesContent":["import { collapseTableSelection } from '../selection/collapseTableSelection';\nimport { getSelectedCells } from 'roosterjs-content-model-core';\nimport type { ContentModelTable } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function deleteTableRow(table: ContentModelTable) {\n const sel = getSelectedCells(table);\n\n if (sel) {\n table.rows[sel.firstRow].cells.forEach((cell, colIndex) => {\n const cellInNextRow = table.rows[sel.lastRow + 1]?.cells[colIndex];\n\n if (cellInNextRow) {\n cellInNextRow.spanAbove = cellInNextRow.spanAbove && cell.spanAbove;\n }\n });\n\n table.rows.splice(sel.firstRow, sel.lastRow - sel.firstRow + 1);\n\n collapseTableSelection(table.rows, sel);\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "roosterjs-content-model-dom", "
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-dom", "roosterjs-content-model-core"], function (require, exports, roosterjs_content_model_dom_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.insertTableColumn = void 0;
|
|
@@ -6,15 +6,15 @@ define(["require", "exports", "roosterjs-content-model-dom", "./getSelectedCells
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
function insertTableColumn(table, operation) {
|
|
9
|
-
var sel = (0,
|
|
9
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
10
10
|
var insertLeft = operation == 'insertLeft';
|
|
11
11
|
if (sel) {
|
|
12
|
-
for (var i = sel === null || sel === void 0 ? void 0 : sel.
|
|
12
|
+
for (var i = sel === null || sel === void 0 ? void 0 : sel.firstColumn; i <= sel.lastColumn; i++) {
|
|
13
13
|
table.rows.forEach(function (row) {
|
|
14
|
-
var cell = row.cells[insertLeft ? sel.
|
|
15
|
-
row.cells.splice(insertLeft ? sel.
|
|
14
|
+
var cell = row.cells[insertLeft ? sel.firstColumn : sel.lastColumn];
|
|
15
|
+
row.cells.splice(insertLeft ? sel.firstColumn : sel.lastColumn + 1, 0, (0, roosterjs_content_model_dom_1.createTableCell)(cell.spanLeft, cell.spanAbove, cell.isHeader, cell.format, cell.dataset));
|
|
16
16
|
});
|
|
17
|
-
table.widths.splice(insertLeft ? sel.
|
|
17
|
+
table.widths.splice(insertLeft ? sel.firstColumn : sel.lastColumn + 1, 0, table.widths[insertLeft ? sel.firstColumn : sel.lastColumn]);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertTableColumn.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/insertTableColumn.ts"],"names":[],"mappings":";;;;IAOA;;OAEG;IACH,SAAgB,iBAAiB,CAC7B,KAAwB,EACxB,SAAyC;QAEzC,IAAM,GAAG,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"insertTableColumn.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/insertTableColumn.ts"],"names":[],"mappings":";;;;IAOA;;OAEG;IACH,SAAgB,iBAAiB,CAC7B,KAAwB,EACxB,SAAyC;QAEzC,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,KAAK,CAAC,CAAC;QACpC,IAAM,UAAU,GAAG,SAAS,IAAI,YAAY,CAAC;QAE7C,IAAI,GAAG,EAAE;YACL,KAAK,IAAI,CAAC,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,WAAW,EAAE,CAAC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE;gBACrD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;oBAClB,IAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;oBAEtE,GAAG,CAAC,KAAK,CAAC,MAAM,CACZ,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,EACjD,CAAC,EACD,IAAA,6CAAe,EACX,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,OAAO,CACf,CACJ,CAAC;gBACN,CAAC,CAAC,CAAC;gBACH,KAAK,CAAC,MAAM,CAAC,MAAM,CACf,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,EACjD,CAAC,EACD,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAC9D,CAAC;aACL;SACJ;IACL,CAAC;IA/BD,8CA+BC","sourcesContent":["import { createTableCell } from 'roosterjs-content-model-dom';\nimport { getSelectedCells } from 'roosterjs-content-model-core';\nimport type {\n ContentModelTable,\n TableHorizontalInsertOperation,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function insertTableColumn(\n table: ContentModelTable,\n operation: TableHorizontalInsertOperation\n) {\n const sel = getSelectedCells(table);\n const insertLeft = operation == 'insertLeft';\n\n if (sel) {\n for (let i = sel?.firstColumn; i <= sel.lastColumn; i++) {\n table.rows.forEach(row => {\n const cell = row.cells[insertLeft ? sel.firstColumn : sel.lastColumn];\n\n row.cells.splice(\n insertLeft ? sel.firstColumn : sel.lastColumn + 1,\n 0,\n createTableCell(\n cell.spanLeft,\n cell.spanAbove,\n cell.isHeader,\n cell.format,\n cell.dataset\n )\n );\n });\n table.widths.splice(\n insertLeft ? sel.firstColumn : sel.lastColumn + 1,\n 0,\n table.widths[insertLeft ? sel.firstColumn : sel.lastColumn]\n );\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-dom", "
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom", "roosterjs-content-model-core"], function (require, exports, tslib_1, roosterjs_content_model_dom_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.insertTableRow = void 0;
|
|
@@ -6,7 +6,7 @@ define(["require", "exports", "tslib", "roosterjs-content-model-dom", "./getSele
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
function insertTableRow(table, operation) {
|
|
9
|
-
var sel = (0,
|
|
9
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
10
10
|
var insertAbove = operation == 'insertAbove';
|
|
11
11
|
if (sel) {
|
|
12
12
|
for (var i = sel.firstRow; i <= sel.lastRow; i++) {
|
|
@@ -14,7 +14,7 @@ define(["require", "exports", "tslib", "roosterjs-content-model-dom", "./getSele
|
|
|
14
14
|
table.rows.splice(insertAbove ? sel.firstRow : sel.lastRow + 1, 0, {
|
|
15
15
|
format: (0, tslib_1.__assign)({}, sourceRow.format),
|
|
16
16
|
cells: sourceRow.cells.map(function (cell) {
|
|
17
|
-
return (0, roosterjs_content_model_dom_1.createTableCell)(cell.spanLeft, cell.spanAbove, cell.isHeader, cell.format);
|
|
17
|
+
return (0, roosterjs_content_model_dom_1.createTableCell)(cell.spanLeft, cell.spanAbove, cell.isHeader, cell.format, cell.dataset);
|
|
18
18
|
}),
|
|
19
19
|
height: sourceRow.height,
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertTableRow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/insertTableRow.ts"],"names":[],"mappings":";;;;IAOA;;OAEG;IACH,SAAgB,cAAc,CAAC,KAAwB,EAAE,SAAuC;QAC5F,IAAM,GAAG,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"insertTableRow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/insertTableRow.ts"],"names":[],"mappings":";;;;IAOA;;OAEG;IACH,SAAgB,cAAc,CAAC,KAAwB,EAAE,SAAuC;QAC5F,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,KAAK,CAAC,CAAC;QACpC,IAAM,WAAW,GAAG,SAAS,IAAI,aAAa,CAAC;QAE/C,IAAI,GAAG,EAAE;YACL,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;gBAC9C,IAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAEvE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC,EAAE;oBAC/D,MAAM,4BAAO,SAAS,CAAC,MAAM,CAAE;oBAC/B,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,UAAA,IAAI;wBAC3B,OAAA,IAAA,6CAAe,EACX,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,OAAO,CACf;oBAND,CAMC,CACJ;oBACD,MAAM,EAAE,SAAS,CAAC,MAAM;iBAC3B,CAAC,CAAC;aACN;SACJ;IACL,CAAC;IAvBD,wCAuBC","sourcesContent":["import { createTableCell } from 'roosterjs-content-model-dom';\nimport { getSelectedCells } from 'roosterjs-content-model-core';\nimport type {\n ContentModelTable,\n TableVerticalInsertOperation,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function insertTableRow(table: ContentModelTable, operation: TableVerticalInsertOperation) {\n const sel = getSelectedCells(table);\n const insertAbove = operation == 'insertAbove';\n\n if (sel) {\n for (let i = sel.firstRow; i <= sel.lastRow; i++) {\n const sourceRow = table.rows[insertAbove ? sel.firstRow : sel.lastRow];\n\n table.rows.splice(insertAbove ? sel.firstRow : sel.lastRow + 1, 0, {\n format: { ...sourceRow.format },\n cells: sourceRow.cells.map(cell =>\n createTableCell(\n cell.spanLeft,\n cell.spanAbove,\n cell.isHeader,\n cell.format,\n cell.dataset\n )\n ),\n height: sourceRow.height,\n });\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "./canMergeCells", "
|
|
1
|
+
define(["require", "exports", "./canMergeCells", "roosterjs-content-model-core"], function (require, exports, canMergeCells_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.mergeTableCells = void 0;
|
|
@@ -6,13 +6,14 @@ define(["require", "exports", "./canMergeCells", "./getSelectedCells"], function
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
function mergeTableCells(table) {
|
|
9
|
-
var sel = (0,
|
|
10
|
-
if (sel &&
|
|
9
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
10
|
+
if (sel &&
|
|
11
|
+
(0, canMergeCells_1.canMergeCells)(table.rows, sel.firstRow, sel.firstColumn, sel.lastRow, sel.lastColumn)) {
|
|
11
12
|
for (var rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {
|
|
12
|
-
for (var colIndex = sel.
|
|
13
|
+
for (var colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {
|
|
13
14
|
var cell = table.rows[rowIndex].cells[colIndex];
|
|
14
15
|
if (cell) {
|
|
15
|
-
cell.spanLeft = colIndex > sel.
|
|
16
|
+
cell.spanLeft = colIndex > sel.firstColumn;
|
|
16
17
|
cell.spanAbove = rowIndex > sel.firstRow;
|
|
17
18
|
delete cell.cachedElement;
|
|
18
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTableCells.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/mergeTableCells.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,eAAe,CAAC,KAAwB;QACpD,IAAM,GAAG,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"mergeTableCells.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/mergeTableCells.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,eAAe,CAAC,KAAwB;QACpD,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,KAAK,CAAC,CAAC;QAEpC,IACI,GAAG;YACH,IAAA,6BAAa,EAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,EACvF;YACE,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;gBACnE,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,QAAQ,IAAI,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE;oBACzE,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBAElD,IAAI,IAAI,EAAE;wBACN,IAAI,CAAC,QAAQ,GAAG,QAAQ,GAAG,GAAG,CAAC,WAAW,CAAC;wBAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;wBAEzC,OAAO,IAAI,CAAC,aAAa,CAAC;qBAC7B;iBACJ;gBAED,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC;aAC7C;SACJ;IACL,CAAC;IAtBD,0CAsBC","sourcesContent":["import { canMergeCells } from './canMergeCells';\nimport { getSelectedCells } from 'roosterjs-content-model-core';\nimport type { ContentModelTable } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function mergeTableCells(table: ContentModelTable) {\n const sel = getSelectedCells(table);\n\n if (\n sel &&\n canMergeCells(table.rows, sel.firstRow, sel.firstColumn, sel.lastRow, sel.lastColumn)\n ) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = table.rows[rowIndex].cells[colIndex];\n\n if (cell) {\n cell.spanLeft = colIndex > sel.firstColumn;\n cell.spanAbove = rowIndex > sel.firstRow;\n\n delete cell.cachedElement;\n }\n }\n\n delete table.rows[rowIndex].cachedElement;\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "./canMergeCells", "
|
|
1
|
+
define(["require", "exports", "./canMergeCells", "roosterjs-content-model-core"], function (require, exports, canMergeCells_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.mergeTableColumn = void 0;
|
|
@@ -7,10 +7,10 @@ define(["require", "exports", "./canMergeCells", "./getSelectedCells"], function
|
|
|
7
7
|
*/
|
|
8
8
|
function mergeTableColumn(table, operation) {
|
|
9
9
|
var _a, _b, _c, _d;
|
|
10
|
-
var sel = (0,
|
|
10
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
11
11
|
var mergeLeft = operation == 'mergeLeft';
|
|
12
12
|
if (sel) {
|
|
13
|
-
var mergingColIndex = mergeLeft ? sel.
|
|
13
|
+
var mergingColIndex = mergeLeft ? sel.firstColumn : sel.lastColumn + 1;
|
|
14
14
|
if (mergingColIndex > 0 && mergingColIndex < table.rows[0].cells.length) {
|
|
15
15
|
for (var rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {
|
|
16
16
|
var cell = (_a = table.rows[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells[mergingColIndex];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTableColumn.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/mergeTableColumn.ts"],"names":[],"mappings":";;;;IAOA;;OAEG;IACH,SAAgB,gBAAgB,CAC5B,KAAwB,EACxB,SAAwC;;QAExC,IAAM,GAAG,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"mergeTableColumn.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/mergeTableColumn.ts"],"names":[],"mappings":";;;;IAOA;;OAEG;IACH,SAAgB,gBAAgB,CAC5B,KAAwB,EACxB,SAAwC;;QAExC,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,KAAK,CAAC,CAAC;QACpC,IAAM,SAAS,GAAG,SAAS,IAAI,WAAW,CAAC;QAE3C,IAAI,GAAG,EAAE;YACL,IAAM,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;YAEzE,IAAI,eAAe,GAAG,CAAC,IAAI,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;gBACrE,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;oBACnE,IAAM,IAAI,GAAG,MAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAE,KAAK,CAAC,eAAe,CAAC,CAAC;oBAE1D,IACI,IAAI;wBACJ,IAAA,6BAAa,EACT,KAAK,CAAC,IAAI,EACV,QAAQ,EACR,eAAe,GAAG,CAAC,EACnB,QAAQ,EACR,eAAe,CAClB,EACH;wBACE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;wBAErB,IAAI,cAAc,GAAG,eAAe,CAAC;wBAErC,OAAO,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAE,KAAK,CAAC,cAAc,CAAC,0CAAE,QAAQ,EAAE;4BAC1D,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC;4BAChE,cAAc,EAAE,CAAC;yBACpB;wBAED,IAAI,MAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAE,KAAK,CAAC,cAAc,CAAC,EAAE;4BAC7C,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;4BAE7D,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC;yBACnE;wBAED,OAAO,IAAI,CAAC,aAAa,CAAC;qBAC7B;oBAED,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC;iBAC7C;aACJ;SACJ;IACL,CAAC;IA9CD,4CA8CC","sourcesContent":["import { canMergeCells } from './canMergeCells';\nimport { getSelectedCells } from 'roosterjs-content-model-core';\nimport type {\n ContentModelTable,\n TableHorizontalMergeOperation,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function mergeTableColumn(\n table: ContentModelTable,\n operation: TableHorizontalMergeOperation\n) {\n const sel = getSelectedCells(table);\n const mergeLeft = operation == 'mergeLeft';\n\n if (sel) {\n const mergingColIndex = mergeLeft ? sel.firstColumn : sel.lastColumn + 1;\n\n if (mergingColIndex > 0 && mergingColIndex < table.rows[0].cells.length) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = table.rows[rowIndex]?.cells[mergingColIndex];\n\n if (\n cell &&\n canMergeCells(\n table.rows,\n rowIndex,\n mergingColIndex - 1,\n rowIndex,\n mergingColIndex\n )\n ) {\n cell.spanLeft = true;\n\n let newSelectedCol = mergingColIndex;\n\n while (table.rows[rowIndex]?.cells[newSelectedCol]?.spanLeft) {\n delete table.rows[rowIndex].cells[newSelectedCol].cachedElement;\n newSelectedCol--;\n }\n\n if (table.rows[rowIndex]?.cells[newSelectedCol]) {\n table.rows[rowIndex].cells[newSelectedCol].isSelected = true;\n\n delete table.rows[rowIndex].cells[newSelectedCol].cachedElement;\n }\n\n delete cell.cachedElement;\n }\n\n delete table.rows[rowIndex].cachedElement;\n }\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "./canMergeCells", "
|
|
1
|
+
define(["require", "exports", "./canMergeCells", "roosterjs-content-model-core"], function (require, exports, canMergeCells_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.mergeTableRow = void 0;
|
|
@@ -7,12 +7,12 @@ define(["require", "exports", "./canMergeCells", "./getSelectedCells"], function
|
|
|
7
7
|
*/
|
|
8
8
|
function mergeTableRow(table, operation) {
|
|
9
9
|
var _a, _b, _c;
|
|
10
|
-
var sel = (0,
|
|
10
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
11
11
|
var mergeAbove = operation == 'mergeAbove';
|
|
12
12
|
if (sel) {
|
|
13
13
|
var mergingRowIndex = mergeAbove ? sel.firstRow : sel.lastRow + 1;
|
|
14
14
|
if (mergingRowIndex > 0 && mergingRowIndex < table.rows.length) {
|
|
15
|
-
for (var colIndex = sel.
|
|
15
|
+
for (var colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {
|
|
16
16
|
var cell = table.rows[mergingRowIndex].cells[colIndex];
|
|
17
17
|
if (cell &&
|
|
18
18
|
(0, canMergeCells_1.canMergeCells)(table.rows, mergingRowIndex - 1, colIndex, mergingRowIndex, colIndex)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTableRow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/mergeTableRow.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,aAAa,CAAC,KAAwB,EAAE,SAAsC;;QAC1F,IAAM,GAAG,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"mergeTableRow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/mergeTableRow.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,aAAa,CAAC,KAAwB,EAAE,SAAsC;;QAC1F,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,KAAK,CAAC,CAAC;QACpC,IAAM,UAAU,GAAG,SAAS,IAAI,YAAY,CAAC;QAE7C,IAAI,GAAG,EAAE;YACL,IAAM,eAAe,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;YAEpE,IAAI,eAAe,GAAG,CAAC,IAAI,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC5D,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,QAAQ,IAAI,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE;oBACzE,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBAEzD,IACI,IAAI;wBACJ,IAAA,6BAAa,EACT,KAAK,CAAC,IAAI,EACV,eAAe,GAAG,CAAC,EACnB,QAAQ,EACR,eAAe,EACf,QAAQ,CACX,EACH;wBACE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;wBAEtB,IAAI,cAAc,GAAG,eAAe,CAAC;wBAErC,OAAO,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,0CAAE,KAAK,CAAC,QAAQ,CAAC,0CAAE,SAAS,EAAE;4BAC3D,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC;4BAChE,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC;4BAChD,cAAc,EAAE,CAAC;yBACpB;wBAED,IAAI,MAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,0CAAE,KAAK,CAAC,QAAQ,CAAC,EAAE;4BAC7C,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;4BAE7D,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC;4BAChE,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC;yBACnD;wBAED,OAAO,IAAI,CAAC,aAAa,CAAC;qBAC7B;iBACJ;aACJ;SACJ;IACL,CAAC;IA3CD,sCA2CC","sourcesContent":["import { canMergeCells } from './canMergeCells';\nimport { getSelectedCells } from 'roosterjs-content-model-core';\nimport type { ContentModelTable, TableVerticalMergeOperation } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function mergeTableRow(table: ContentModelTable, operation: TableVerticalMergeOperation) {\n const sel = getSelectedCells(table);\n const mergeAbove = operation == 'mergeAbove';\n\n if (sel) {\n const mergingRowIndex = mergeAbove ? sel.firstRow : sel.lastRow + 1;\n\n if (mergingRowIndex > 0 && mergingRowIndex < table.rows.length) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = table.rows[mergingRowIndex].cells[colIndex];\n\n if (\n cell &&\n canMergeCells(\n table.rows,\n mergingRowIndex - 1,\n colIndex,\n mergingRowIndex,\n colIndex\n )\n ) {\n cell.spanAbove = true;\n\n let newSelectedRow = mergingRowIndex;\n\n while (table.rows[newSelectedRow]?.cells[colIndex]?.spanAbove) {\n delete table.rows[newSelectedRow].cells[colIndex].cachedElement;\n delete table.rows[newSelectedRow].cachedElement;\n newSelectedRow--;\n }\n\n if (table.rows[newSelectedRow]?.cells[colIndex]) {\n table.rows[newSelectedRow].cells[colIndex].isSelected = true;\n\n delete table.rows[newSelectedRow].cells[colIndex].cachedElement;\n delete table.rows[newSelectedRow].cachedElement;\n }\n\n delete cell.cachedElement;\n }\n }\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-dom", "
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom", "roosterjs-content-model-core"], function (require, exports, tslib_1, roosterjs_content_model_dom_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.splitTableCellHorizontally = void 0;
|
|
@@ -7,7 +7,7 @@ define(["require", "exports", "tslib", "roosterjs-content-model-dom", "./getSele
|
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
function splitTableCellHorizontally(table) {
|
|
10
|
-
var sel = (0,
|
|
10
|
+
var sel = (0, roosterjs_content_model_core_1.getSelectedCells)(table);
|
|
11
11
|
if (sel) {
|
|
12
12
|
var _loop_1 = function (colIndex) {
|
|
13
13
|
if (table.rows.every(function (row, rowIndex) {
|
|
@@ -44,7 +44,7 @@ define(["require", "exports", "tslib", "roosterjs-content-model-dom", "./getSele
|
|
|
44
44
|
table.widths.splice(colIndex, 1, newWidth, newWidth);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
for (var colIndex = sel.
|
|
47
|
+
for (var colIndex = sel.lastColumn; colIndex >= sel.firstColumn; colIndex--) {
|
|
48
48
|
_loop_1(colIndex);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitTableCellHorizontally.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/splitTableCellHorizontally.ts"],"names":[],"mappings":";;;;IAIA,IAAM,SAAS,GAAG,EAAE,CAAC;IAErB;;OAEG;IACH,SAAgB,0BAA0B,CAAC,KAAwB;QAC/D,IAAM,GAAG,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"splitTableCellHorizontally.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/splitTableCellHorizontally.ts"],"names":[],"mappings":";;;;IAIA,IAAM,SAAS,GAAG,EAAE,CAAC;IAErB;;OAEG;IACH,SAAgB,0BAA0B,CAAC,KAAwB;QAC/D,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,KAAK,CAAC,CAAC;QAEpC,IAAI,GAAG,EAAE;oCACI,QAAQ;gBACb,IACI,KAAK,CAAC,IAAI,CAAC,KAAK,CACZ,UAAC,GAAG,EAAE,QAAQ;;oBACV,OAAA,QAAQ,GAAG,GAAG,CAAC,QAAQ;wBACvB,QAAQ,GAAG,GAAG,CAAC,OAAO;yBACtB,MAAA,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,0CAAE,QAAQ,CAAA,CAAA;iBAAA,CACxC,EACH;oBACE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,QAAQ;wBAC7B,OAAO,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC;wBAEzC,IAAI,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,QAAQ,IAAI,GAAG,CAA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AC;iBACxD;;YA5CL,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,QAAQ,IAAI,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE;wBAAlE,QAAQ;aA6ChB;SACJ;IACL,CAAC;IAnDD,gEAmDC","sourcesContent":["import { createTableCell } from 'roosterjs-content-model-dom';\nimport { getSelectedCells } from 'roosterjs-content-model-core';\nimport type { ContentModelTable } from 'roosterjs-content-model-types';\n\nconst MIN_WIDTH = 30;\n\n/**\n * @internal\n */\nexport function splitTableCellHorizontally(table: ContentModelTable) {\n const sel = getSelectedCells(table);\n\n if (sel) {\n for (let colIndex = sel.lastColumn; colIndex >= sel.firstColumn; colIndex--) {\n if (\n table.rows.every(\n (row, rowIndex) =>\n rowIndex < sel.firstRow ||\n rowIndex > sel.lastRow ||\n row.cells[colIndex + 1]?.spanLeft\n )\n ) {\n table.rows.forEach((row, rowIndex) => {\n delete row.cells[colIndex].cachedElement;\n\n if (rowIndex >= sel.firstRow && rowIndex <= sel.lastRow) {\n row.cells[colIndex + 1].spanLeft = false;\n delete row.cells[colIndex + 1].cachedElement;\n }\n });\n } else {\n table.rows.forEach((row, rowIndex) => {\n const cell = row.cells[colIndex];\n if (cell) {\n const newCell = createTableCell(\n cell.spanLeft,\n cell.spanAbove,\n cell.isHeader,\n cell.format\n );\n\n newCell.dataset = { ...cell.dataset };\n\n if (rowIndex < sel.firstRow || rowIndex > sel.lastRow) {\n newCell.spanLeft = true;\n } else {\n newCell.isSelected = cell.isSelected;\n }\n row.cells.splice(colIndex + 1, 0, newCell);\n\n delete row.cells[colIndex].cachedElement;\n }\n });\n\n const newWidth = Math.max(table.widths[colIndex] / 2, MIN_WIDTH);\n\n table.widths.splice(colIndex, 1, newWidth, newWidth);\n }\n }\n }\n}\n"]}
|