roosterjs-content-model-dom 9.58.0 → 9.60.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/config/defaultHTMLStyleMap.js +3 -0
- package/lib/config/defaultHTMLStyleMap.js.map +1 -1
- package/lib/formatHandlers/common/borderColorFormatHandler.js +25 -31
- package/lib/formatHandlers/common/borderColorFormatHandler.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/modelApi/editing/applyTableFormat.js +152 -52
- package/lib/modelApi/editing/applyTableFormat.js.map +1 -1
- package/lib/modelApi/editing/canMergeCells.d.ts +10 -0
- package/lib/modelApi/editing/canMergeCells.js +62 -0
- package/lib/modelApi/editing/canMergeCells.js.map +1 -0
- package/lib/modelApi/editing/mergeModel.js +36 -3
- package/lib/modelApi/editing/mergeModel.js.map +1 -1
- package/lib/modelApi/editing/retrieveModelFormatState.js +6 -1
- package/lib/modelApi/editing/retrieveModelFormatState.js.map +1 -1
- package/lib-amd/config/defaultHTMLStyleMap.js +3 -0
- package/lib-amd/config/defaultHTMLStyleMap.js.map +1 -1
- package/lib-amd/formatHandlers/common/borderColorFormatHandler.js +25 -31
- package/lib-amd/formatHandlers/common/borderColorFormatHandler.js.map +1 -1
- package/lib-amd/index.d.ts +1 -0
- package/lib-amd/index.js +3 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/editing/applyTableFormat.js +152 -52
- package/lib-amd/modelApi/editing/applyTableFormat.js.map +1 -1
- package/lib-amd/modelApi/editing/canMergeCells.d.ts +10 -0
- package/lib-amd/modelApi/editing/canMergeCells.js +64 -0
- package/lib-amd/modelApi/editing/canMergeCells.js.map +1 -0
- package/lib-amd/modelApi/editing/mergeModel.js +36 -3
- package/lib-amd/modelApi/editing/mergeModel.js.map +1 -1
- package/lib-amd/modelApi/editing/retrieveModelFormatState.js +6 -2
- package/lib-amd/modelApi/editing/retrieveModelFormatState.js.map +1 -1
- package/lib-mjs/config/defaultHTMLStyleMap.js +3 -0
- package/lib-mjs/config/defaultHTMLStyleMap.js.map +1 -1
- package/lib-mjs/formatHandlers/common/borderColorFormatHandler.js +25 -31
- package/lib-mjs/formatHandlers/common/borderColorFormatHandler.js.map +1 -1
- package/lib-mjs/index.d.ts +1 -0
- package/lib-mjs/index.js +1 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/editing/applyTableFormat.js +153 -53
- package/lib-mjs/modelApi/editing/applyTableFormat.js.map +1 -1
- package/lib-mjs/modelApi/editing/canMergeCells.d.ts +10 -0
- package/lib-mjs/modelApi/editing/canMergeCells.js +58 -0
- package/lib-mjs/modelApi/editing/canMergeCells.js.map +1 -0
- package/lib-mjs/modelApi/editing/mergeModel.js +37 -4
- package/lib-mjs/modelApi/editing/mergeModel.js.map +1 -1
- package/lib-mjs/modelApi/editing/retrieveModelFormatState.js +6 -1
- package/lib-mjs/modelApi/editing/retrieveModelFormatState.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/mergeModel.ts"],"names":[],"mappings":";;;;IAkCA,IAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzD,IAAM,mBAAmB,GAAG,IAAA,6BAAa,EAAC,uCAAkB,CAAC,CAAC;IAI9D;;;;;;;OAOG;IACH,SAAgB,UAAU,CACtB,MAAoC,EACpC,MAA4B,EAC5B,OAAmC,EACnC,OAA0B;;QAE1B,IAAM,cAAc,GAChB,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,mCAAI,IAAA,iCAAe,EAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC;QAE1E,IAAA,KACF,OAAO,I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cAAc,GAAG,aAAa,CAAC;QACnC,IAAI,iBAAiB,GAAG,MAAM,CAAC;QAE/B,OAAO,iBAAiB,GAAG,CAAC,EAAE;YAC1B,cAAc,EAAE,CAAC;YAEjB,IAAI,cAAc,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;gBACrC,iBAAiB,EAAE,CAAC;aACvB;iBAAM,IAAI,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,0CAAE,KAAK,CAAC,QAAQ,CAAC,0CAAE,SAAS,CAAA,EAAE;gBAChE,iBAAiB,EAAE,CAAC;aACvB;SACJ;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC","sourcesContent":["import { addBlock } from '../common/addBlock';\nimport { addSegment } from '../common/addSegment';\nimport { applyTableFormat } from './applyTableFormat';\nimport { createBr } from '../creators/createBr';\nimport { createListItem } from '../creators/createListItem';\nimport { createParagraph } from '../creators/createParagraph';\nimport { createSelectionMarker } from '../creators/createSelectionMarker';\nimport { createTableCell } from '../creators/createTableCell';\nimport { deleteSelection } from './deleteSelection';\nimport { EmptySegmentFormat } from '../../constants/EmptySegmentFormat';\nimport { getClosestAncestorBlockGroupIndex } from './getClosestAncestorBlockGroupIndex';\nimport { getObjectKeys } from '../..//domUtils/getObjectKeys';\nimport { mutateBlock } from '../common/mutate';\nimport { normalizeContentModel } from '../common/normalizeContentModel';\nimport { normalizeTable } from './normalizeTable';\nimport type {\n ContentModelBlock,\n ContentModelBlockFormat,\n ContentModelDocument,\n ContentModelHyperLinkFormat,\n ContentModelListItem,\n ContentModelParagraph,\n ContentModelSegmentFormat,\n ContentModelTable,\n FormatContentModelContext,\n InsertPoint,\n MergeModelOption,\n ReadonlyContentModelBlock,\n ReadonlyContentModelBlockGroup,\n ReadonlyContentModelDocument,\n ReadonlyContentModelTable,\n ShallowMutableContentModelParagraph,\n} from 'roosterjs-content-model-types';\n\nconst HeadingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\nconst KeysOfSegmentFormat = getObjectKeys(EmptySegmentFormat);\n\ntype MergeFormatTypes = 'mergeAll' | 'keepSourceEmphasisFormat' | 'preferSource' | 'preferTarget';\n\n/**\n * Merge source model into target mode\n * @param target Target Content Model that will merge content into\n * @param source Source Content Model will be merged to target model\n * @param context Format context. When call this function inside formatContentModel, provide this context so that formatContentModel will do extra handling to the result\n * @param options More options, see MergeModelOption\n * @returns Insert point after merge, or null if there is no insert point\n */\nexport function mergeModel(\n target: ReadonlyContentModelDocument,\n source: ContentModelDocument,\n context?: FormatContentModelContext,\n options?: MergeModelOption\n): InsertPoint | null {\n const insertPosition =\n options?.insertPosition ?? deleteSelection(target, [], context).insertPoint;\n\n const { addParagraphAfterMergedContent, mergeFormat, mergeParagraphAfterList, mergeTable } =\n options || {};\n\n if (mergeParagraphAfterList && insertPosition && source.blocks[0]?.blockType == 'Paragraph') {\n moveParagraphAfterListIntoList(insertPosition);\n }\n\n if (addParagraphAfterMergedContent && !mergeTable) {\n const { paragraph, marker } = insertPosition || {};\n const newPara = createParagraph(false /* isImplicit */, paragraph?.format, marker?.format);\n addBlock(source, newPara);\n }\n\n if (insertPosition) {\n if (mergeFormat && mergeFormat != 'none') {\n const newFormat: ContentModelSegmentFormat = {\n ...(target.format || {}),\n ...insertPosition.marker.format,\n };\n\n applyDefaultFormat(source, newFormat, mergeFormat);\n }\n\n for (let i = 0; i < source.blocks.length; i++) {\n const block = source.blocks[i];\n\n switch (block.blockType) {\n case 'Paragraph':\n mergeParagraph(insertPosition, block, i == 0, context, options);\n break;\n\n case 'Divider':\n insertBlock(insertPosition, block);\n break;\n\n case 'Entity':\n insertBlock(insertPosition, block);\n context?.newEntities.push(block);\n break;\n\n case 'Table':\n if (source.blocks.length == 1 && mergeTable) {\n mergeTables(insertPosition, block, source);\n } else {\n insertBlock(insertPosition, block);\n }\n break;\n\n case 'BlockGroup':\n switch (block.blockGroupType) {\n case 'General':\n case 'FormatContainer':\n insertBlock(insertPosition, block);\n break;\n case 'ListItem':\n mergeList(insertPosition, block);\n break;\n }\n break;\n }\n }\n }\n\n normalizeContentModel(target);\n\n return insertPosition;\n}\n\nfunction moveParagraphAfterListIntoList(insertPosition: InsertPoint) {\n const { paragraph, path } = insertPosition;\n const parent = path[0];\n const paragraphIndex = parent.blocks.indexOf(paragraph);\n const previousBlock = parent.blocks[paragraphIndex - 1];\n\n if (\n paragraph.segments.every(\n segment => segment.segmentType == 'SelectionMarker' || segment.segmentType == 'Br'\n ) &&\n previousBlock?.blockType == 'BlockGroup' &&\n previousBlock.blockGroupType == 'ListItem'\n ) {\n const newListItem = createListItem(previousBlock.levels, previousBlock.formatHolder.format);\n const paragraphAfterList = createParagraph(false, paragraph.format);\n\n addBlock(newListItem, paragraph);\n paragraphAfterList.segments.push(createBr());\n mutateBlock(parent).blocks.splice(paragraphIndex, 1, newListItem, paragraphAfterList);\n path.unshift(newListItem);\n }\n}\n\nfunction mergeParagraph(\n markerPosition: InsertPoint,\n newPara: ContentModelParagraph,\n mergeToCurrentParagraph: boolean,\n context?: FormatContentModelContext,\n option?: MergeModelOption\n) {\n const { paragraph, marker } = markerPosition;\n const newParagraph = mergeToCurrentParagraph\n ? paragraph\n : splitParagraph(markerPosition, newPara.format);\n const segmentIndex = newParagraph.segments.indexOf(marker);\n\n if (option?.mergeFormat == 'none' && mergeToCurrentParagraph) {\n newParagraph.segments.forEach(segment => {\n segment.format = { ...(newParagraph.segmentFormat || {}), ...segment.format };\n });\n delete newParagraph.segmentFormat;\n }\n if (segmentIndex >= 0) {\n for (let i = 0; i < newPara.segments.length; i++) {\n const segment = newPara.segments[i];\n\n newParagraph.segments.splice(segmentIndex + i, 0, segment);\n\n if (context) {\n if (segment.segmentType == 'Entity') {\n context.newEntities.push(segment);\n }\n\n if (segment.segmentType == 'Image') {\n context.newImages.push(segment);\n }\n }\n }\n }\n\n if (newPara.decorator) {\n newParagraph.decorator = { ...newPara.decorator };\n if (HeadingTags.indexOf(newParagraph.decorator.tagName) > -1) {\n const sourceKeys: (keyof ContentModelSegmentFormat)[] = getObjectKeys(\n newParagraph.decorator.format\n );\n const segmentDecoratorKeys: (keyof ContentModelSegmentFormat)[] = getObjectKeys(\n newParagraph.segmentFormat || {}\n );\n\n sourceKeys.forEach(key => {\n if (segmentDecoratorKeys.indexOf(key) > -1) {\n delete newParagraph.segmentFormat?.[key];\n }\n });\n }\n }\n\n if (!mergeToCurrentParagraph) {\n newParagraph.format = newPara.format;\n } else {\n newParagraph.format = {\n ...newParagraph.format,\n ...newPara.format,\n };\n }\n}\n\nfunction mergeTables(\n markerPosition: InsertPoint,\n newTable: ContentModelTable,\n source: ContentModelDocument\n) {\n const { tableContext, marker } = markerPosition;\n\n if (tableContext && source.blocks.length == 1 && source.blocks[0] == newTable) {\n const { table: readonlyTable, colIndex, rowIndex } = tableContext;\n const table = mutateBlock(readonlyTable);\n\n const newTableColCount = newTable.rows[0]?.cells.length || 0;\n const newTableRowCount = newTable.rows.length;\n\n const lastTargetColIndex = getTargetColIndex(table, rowIndex, colIndex, newTableColCount);\n const extraColsNeeded = lastTargetColIndex - table.rows[0].cells.length;\n\n newTable.rows.forEach(row => {\n row.cells.forEach(cell => {\n cell.spanAbove = false;\n });\n });\n\n if (extraColsNeeded > 0) {\n const currentColCount = table.rows[0].cells.length;\n for (let col = 0; col < extraColsNeeded; col++) {\n const newColIndex = currentColCount + col;\n for (let k = 0; k < table.rows.length; k++) {\n const leftCell = table.rows[k]?.cells[newColIndex - 1];\n table.rows[k].cells[newColIndex] = createTableCell(\n false /*spanLeft*/,\n false /*spanAbove*/,\n leftCell?.isHeader,\n leftCell?.format\n );\n }\n }\n }\n\n const lastTargetRowIndex = getTargetRowIndex(table, rowIndex, newTableRowCount, colIndex);\n const extraRowsNeeded = lastTargetRowIndex - table.rows.length;\n\n if (extraRowsNeeded > 0) {\n const currentRowCount = table.rows.length;\n const colCount = table.rows[0]?.cells.length || 0;\n for (let row = 0; row < extraRowsNeeded; row++) {\n const newRowIndex = currentRowCount + row;\n table.rows[newRowIndex] = {\n cells: [],\n format: {},\n height: 0,\n };\n for (let k = 0; k < colCount; k++) {\n const aboveCell = table.rows[newRowIndex - 1]?.cells[k];\n table.rows[newRowIndex].cells[k] = createTableCell(\n false /*spanLeft*/,\n false /*spanAbove*/,\n false /*isHeader*/,\n aboveCell?.format\n );\n }\n }\n }\n\n const logicalRowOffsets: number[] = [];\n let logicalRowCount = 0;\n for (let i = 0; i < newTableRowCount; i++) {\n logicalRowOffsets[i] = logicalRowCount;\n const row = newTable.rows[i];\n if (row && row.cells.some(cell => !cell.spanAbove)) {\n logicalRowCount++;\n }\n }\n\n for (let i = 0; i < newTable.rows.length; i++) {\n const sourceRow = newTable.rows[i];\n const targetRowIndex = getTargetRowIndex(\n table,\n rowIndex,\n logicalRowOffsets[i],\n colIndex\n );\n\n const logicalColOffsets: number[] = [];\n let logicalColCount = 0;\n for (let j = 0; j < sourceRow.cells.length; j++) {\n logicalColOffsets[j] = logicalColCount;\n if (!sourceRow.cells[j]?.spanLeft) {\n logicalColCount++;\n }\n }\n\n for (let j = 0; j < newTable.rows[i].cells.length; j++) {\n const newCell = sourceRow.cells[j];\n\n const targetColIndex = getTargetColIndex(\n table,\n targetRowIndex,\n colIndex,\n logicalColOffsets[j]\n );\n\n const oldCell = table.rows[targetRowIndex]?.cells[targetColIndex];\n\n table.rows[targetRowIndex].cells[targetColIndex] = newCell;\n\n if (i == 0 && j == 0) {\n const newMarker = createSelectionMarker(marker.format);\n const newPara = addSegment(newCell, newMarker);\n\n if (markerPosition.path[0] == oldCell) {\n // Update insert point to match the change result\n markerPosition.path[0] = newCell;\n markerPosition.marker = newMarker;\n markerPosition.paragraph = newPara;\n }\n }\n }\n }\n\n normalizeTable(table, markerPosition.marker.format);\n applyTableFormat(table, undefined /*newFormat*/, true /*keepCellShade*/);\n } else {\n insertBlock(markerPosition, newTable);\n }\n}\n\nfunction mergeList(markerPosition: InsertPoint, newList: ContentModelListItem) {\n splitParagraph(markerPosition, newList.format);\n\n const { path, paragraph } = markerPosition;\n\n const listItemIndex = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n const listItem = path[listItemIndex] as ContentModelListItem;\n const listParent = path[listItemIndex + 1]; // It is ok here when index is -1, that means there is no list and we just insert a new paragraph and use path[0] as its parent\n const blockIndex = listParent.blocks.indexOf(listItem || paragraph);\n\n if (blockIndex >= 0) {\n mutateBlock(listParent).blocks.splice(blockIndex, 0, newList);\n }\n\n if (listItem) {\n listItem?.levels.forEach((level, i) => {\n newList.levels[i] = { ...level };\n });\n }\n}\n\nfunction splitParagraph(markerPosition: InsertPoint, newParaFormat: ContentModelBlockFormat) {\n const { paragraph, marker, path } = markerPosition;\n const segmentIndex = paragraph.segments.indexOf(marker);\n const paraIndex = path[0].blocks.indexOf(paragraph);\n const newParagraph: ShallowMutableContentModelParagraph = createParagraph(\n false /*isImplicit*/,\n { ...paragraph.format, ...newParaFormat },\n paragraph.segmentFormat\n );\n\n if (segmentIndex >= 0) {\n newParagraph.segments = paragraph.segments.splice(segmentIndex);\n }\n\n if (paraIndex >= 0) {\n mutateBlock(path[0]).blocks.splice(paraIndex + 1, 0, newParagraph);\n }\n\n const listItemIndex = getClosestAncestorBlockGroupIndex(\n path,\n ['ListItem'],\n ['FormatContainer', 'TableCell']\n );\n const listItem = path[listItemIndex] as ContentModelListItem;\n\n if (listItem) {\n const listParent = listItemIndex >= 0 ? path[listItemIndex + 1] : null;\n const blockIndex = listParent ? listParent.blocks.indexOf(listItem) : -1;\n\n if (blockIndex >= 0 && listParent) {\n const newListItem = createListItem(listItem.levels, listItem.formatHolder.format);\n\n if (paraIndex >= 0) {\n newListItem.blocks = listItem.blocks.splice(paraIndex + 1);\n }\n\n if (blockIndex >= 0) {\n mutateBlock(listParent).blocks.splice(blockIndex + 1, 0, newListItem);\n }\n\n path[listItemIndex] = newListItem;\n }\n }\n\n markerPosition.paragraph = newParagraph;\n\n return newParagraph;\n}\n\nfunction insertBlock(markerPosition: InsertPoint, block: ContentModelBlock) {\n const { path } = markerPosition;\n const newParaFormat = block.blockType !== 'Paragraph' ? {} : block.format;\n const newPara = splitParagraph(markerPosition, newParaFormat);\n const blockIndex = path[0].blocks.indexOf(newPara);\n\n if (blockIndex >= 0) {\n mutateBlock(path[0]).blocks.splice(blockIndex, 0, block);\n }\n}\n\nfunction applyDefaultFormat(\n group: ReadonlyContentModelBlockGroup,\n format: ContentModelSegmentFormat,\n applyDefaultFormatOption: MergeFormatTypes\n) {\n group.blocks.forEach(block => {\n mergeBlockFormat(applyDefaultFormatOption, block);\n\n switch (block.blockType) {\n case 'BlockGroup':\n if (block.blockGroupType == 'ListItem') {\n mutateBlock(block).formatHolder.format = mergeSegmentFormat(\n applyDefaultFormatOption,\n format,\n block.formatHolder.format\n );\n }\n applyDefaultFormat(block, format, applyDefaultFormatOption);\n break;\n\n case 'Table':\n block.rows.forEach(row =>\n row.cells.forEach(cell => {\n applyDefaultFormat(cell, format, applyDefaultFormatOption);\n })\n );\n break;\n\n case 'Paragraph':\n const paragraphFormat = block.decorator?.format || {};\n const paragraph = mutateBlock(block);\n\n paragraph.segments.forEach(segment => {\n if (segment.segmentType == 'General') {\n applyDefaultFormat(segment, format, applyDefaultFormatOption);\n }\n\n segment.format = mergeSegmentFormat(applyDefaultFormatOption, format, {\n ...paragraphFormat,\n ...segment.format,\n });\n\n if (segment.link) {\n segment.link.format = mergeLinkFormat(\n applyDefaultFormatOption,\n format,\n segment.link.format\n );\n }\n });\n\n if (applyDefaultFormatOption === 'keepSourceEmphasisFormat') {\n delete paragraph.decorator;\n }\n break;\n }\n });\n}\n\nfunction mergeBlockFormat(applyDefaultFormatOption: string, block: ReadonlyContentModelBlock) {\n if (applyDefaultFormatOption == 'keepSourceEmphasisFormat' && block.format.backgroundColor) {\n delete mutateBlock(block).format.backgroundColor;\n }\n}\n\n/**\n * Hyperlink format type definition only contains backgroundColor and underline.\n * So create a minimum object with the styles supported in Hyperlink to be used in merge.\n */\nfunction getSegmentFormatInLinkFormat(\n targetFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n const result: ContentModelHyperLinkFormat = {};\n if (targetFormat.backgroundColor) {\n result.backgroundColor = targetFormat.backgroundColor;\n }\n if (targetFormat.underline) {\n result.underline = targetFormat.underline;\n }\n\n return result;\n}\n\nfunction mergeLinkFormat(\n applyDefaultFormatOption: MergeFormatTypes,\n targetFormat: ContentModelSegmentFormat,\n sourceFormat: ContentModelHyperLinkFormat\n) {\n switch (applyDefaultFormatOption) {\n case 'mergeAll':\n case 'preferSource':\n return { ...getSegmentFormatInLinkFormat(targetFormat), ...sourceFormat };\n case 'keepSourceEmphasisFormat':\n return {\n // Hyperlink segment format contains other attributes such as LinkFormat\n // so we have to retain them\n ...getFormatWithoutSegmentFormat(sourceFormat),\n // Link format only have Text color, background color, Underline, but only\n // text color + background color should be merged from the target\n ...getSegmentFormatInLinkFormat(targetFormat),\n // Get the semantic format of the source\n ...getSemanticFormat(sourceFormat),\n // The text color of the hyperlink should not be merged and\n // we should always retain the source text color\n ...getHyperlinkTextColor(sourceFormat),\n };\n case 'preferTarget':\n return { ...sourceFormat, ...getSegmentFormatInLinkFormat(targetFormat) };\n }\n}\n\nfunction mergeSegmentFormat(\n applyDefaultFormatOption: MergeFormatTypes,\n targetFormat: ContentModelSegmentFormat,\n sourceFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n switch (applyDefaultFormatOption) {\n case 'mergeAll':\n case 'preferSource':\n return { ...targetFormat, ...sourceFormat };\n case 'preferTarget':\n return { ...sourceFormat, ...targetFormat };\n case 'keepSourceEmphasisFormat':\n return {\n ...getFormatWithoutSegmentFormat(sourceFormat),\n ...targetFormat,\n ...getSemanticFormat(sourceFormat),\n };\n }\n}\n\nfunction getSemanticFormat(segmentFormat: ContentModelSegmentFormat): ContentModelSegmentFormat {\n const result: ContentModelSegmentFormat = {};\n\n const { fontWeight, italic, underline } = segmentFormat;\n\n if (fontWeight && fontWeight != 'normal') {\n result.fontWeight = fontWeight;\n }\n if (italic) {\n result.italic = italic;\n }\n if (underline) {\n result.underline = underline;\n }\n\n return result;\n}\n\n/**\n * Segment format can also contain other type of metadata, for example in Images/Hyperlink,\n * we want to preserve these properties when merging format\n */\nfunction getFormatWithoutSegmentFormat(\n sourceFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n const resultFormat = {\n ...sourceFormat,\n };\n KeysOfSegmentFormat.forEach(key => delete resultFormat[key]);\n return resultFormat;\n}\n\nfunction getHyperlinkTextColor(sourceFormat: ContentModelHyperLinkFormat) {\n const result: ContentModelHyperLinkFormat = {};\n if (sourceFormat.textColor) {\n result.textColor = sourceFormat.textColor;\n }\n\n return result;\n}\n\nfunction getTargetColIndex(\n table: ReadonlyContentModelTable,\n rowIndex: number,\n startColIndex: number,\n offset: number\n): number {\n const row = table.rows[rowIndex];\n if (!row) {\n return startColIndex + offset;\n }\n\n if (offset === 0) {\n return startColIndex;\n }\n\n let targetColIndex = startColIndex;\n let logicalCellsToSkip = offset;\n\n while (logicalCellsToSkip > 0) {\n targetColIndex++;\n\n if (targetColIndex >= row.cells.length) {\n logicalCellsToSkip--;\n } else if (!row.cells[targetColIndex].spanLeft) {\n logicalCellsToSkip--;\n }\n }\n\n return targetColIndex;\n}\n\nfunction getTargetRowIndex(\n table: ReadonlyContentModelTable,\n startRowIndex: number,\n offset: number,\n colIndex: number\n): number {\n if (offset === 0) {\n return startRowIndex;\n }\n\n let targetRowIndex = startRowIndex;\n let logicalRowsToSkip = offset;\n\n while (logicalRowsToSkip > 0) {\n targetRowIndex++;\n\n if (targetRowIndex >= table.rows.length) {\n logicalRowsToSkip--;\n } else if (!table.rows[targetRowIndex]?.cells[colIndex]?.spanAbove) {\n logicalRowsToSkip--;\n }\n }\n\n return targetRowIndex;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mergeModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/mergeModel.ts"],"names":[],"mappings":";;;;IAmCA,IAAM,WAA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AM,KAAK,CAAC,EAAE;YACd,OAAO,aAAa,CAAC;SACxB;QAED,IAAI,cAAc,GAAG,aAAa,CAAC;QACnC,IAAI,iBAAiB,GAAG,MAAM,CAAC;QAE/B,OAAO,iBAAiB,GAAG,CAAC,EAAE;YAC1B,cAAc,EAAE,CAAC;YAEjB,IAAI,cAAc,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;gBACrC,iBAAiB,EAAE,CAAC;aACvB;iBAAM,IAAI,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,0CAAE,KAAK,CAAC,QAAQ,CAAC,0CAAE,SAAS,CAAA,EAAE;gBAChE,iBAAiB,EAAE,CAAC;aACvB;SACJ;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC","sourcesContent":["import { addBlock } from '../common/addBlock';\nimport { addSegment } from '../common/addSegment';\nimport { applyTableFormat } from './applyTableFormat';\nimport { createBr } from '../creators/createBr';\nimport { createListItem } from '../creators/createListItem';\nimport { createParagraph } from '../creators/createParagraph';\nimport { createSelectionMarker } from '../creators/createSelectionMarker';\nimport { createTableCell } from '../creators/createTableCell';\nimport { deleteSelection } from './deleteSelection';\nimport { EmptySegmentFormat } from '../../constants/EmptySegmentFormat';\nimport { getClosestAncestorBlockGroupIndex } from './getClosestAncestorBlockGroupIndex';\nimport { getObjectKeys } from '../..//domUtils/getObjectKeys';\nimport { mutateBlock } from '../common/mutate';\nimport { normalizeContentModel } from '../common/normalizeContentModel';\nimport { normalizeTable } from './normalizeTable';\nimport type {\n ContentModelBlock,\n ContentModelBlockFormat,\n ContentModelDocument,\n ContentModelHyperLinkFormat,\n ContentModelListItem,\n ContentModelParagraph,\n ContentModelSegmentFormat,\n ContentModelTable,\n FormatContentModelContext,\n InsertPoint,\n MergeModelOption,\n ReadonlyContentModelBlock,\n ReadonlyContentModelBlockGroup,\n ReadonlyContentModelDocument,\n ReadonlyContentModelTable,\n ShallowMutableContentModelParagraph,\n ShallowMutableContentModelTable,\n} from 'roosterjs-content-model-types';\n\nconst HeadingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\nconst KeysOfSegmentFormat = getObjectKeys(EmptySegmentFormat);\n\ntype MergeFormatTypes = 'mergeAll' | 'keepSourceEmphasisFormat' | 'preferSource' | 'preferTarget';\n\n/**\n * Merge source model into target mode\n * @param target Target Content Model that will merge content into\n * @param source Source Content Model will be merged to target model\n * @param context Format context. When call this function inside formatContentModel, provide this context so that formatContentModel will do extra handling to the result\n * @param options More options, see MergeModelOption\n * @returns Insert point after merge, or null if there is no insert point\n */\nexport function mergeModel(\n target: ReadonlyContentModelDocument,\n source: ContentModelDocument,\n context?: FormatContentModelContext,\n options?: MergeModelOption\n): InsertPoint | null {\n const insertPosition =\n options?.insertPosition ?? deleteSelection(target, [], context).insertPoint;\n\n const { addParagraphAfterMergedContent, mergeFormat, mergeParagraphAfterList, mergeTable } =\n options || {};\n\n if (mergeParagraphAfterList && insertPosition && source.blocks[0]?.blockType == 'Paragraph') {\n moveParagraphAfterListIntoList(insertPosition);\n }\n\n if (addParagraphAfterMergedContent && !mergeTable) {\n const { paragraph, marker } = insertPosition || {};\n const newPara = createParagraph(false /* isImplicit */, paragraph?.format, marker?.format);\n addBlock(source, newPara);\n }\n\n if (insertPosition) {\n if (mergeFormat && mergeFormat != 'none') {\n const newFormat: ContentModelSegmentFormat = {\n ...(target.format || {}),\n ...insertPosition.marker.format,\n };\n\n applyDefaultFormat(source, newFormat, mergeFormat);\n }\n\n for (let i = 0; i < source.blocks.length; i++) {\n const block = source.blocks[i];\n\n switch (block.blockType) {\n case 'Paragraph':\n mergeParagraph(insertPosition, block, i == 0, context, options);\n break;\n\n case 'Divider':\n insertBlock(insertPosition, block);\n break;\n\n case 'Entity':\n insertBlock(insertPosition, block);\n context?.newEntities.push(block);\n break;\n\n case 'Table':\n if (source.blocks.length == 1 && mergeTable) {\n mergeTables(insertPosition, block, source);\n } else {\n insertBlock(insertPosition, block);\n }\n break;\n\n case 'BlockGroup':\n switch (block.blockGroupType) {\n case 'General':\n case 'FormatContainer':\n insertBlock(insertPosition, block);\n break;\n case 'ListItem':\n mergeList(insertPosition, block);\n break;\n }\n break;\n }\n }\n }\n\n normalizeContentModel(target);\n\n return insertPosition;\n}\n\nfunction moveParagraphAfterListIntoList(insertPosition: InsertPoint) {\n const { paragraph, path } = insertPosition;\n const parent = path[0];\n const paragraphIndex = parent.blocks.indexOf(paragraph);\n const previousBlock = parent.blocks[paragraphIndex - 1];\n\n if (\n paragraph.segments.every(\n segment => segment.segmentType == 'SelectionMarker' || segment.segmentType == 'Br'\n ) &&\n previousBlock?.blockType == 'BlockGroup' &&\n previousBlock.blockGroupType == 'ListItem'\n ) {\n const newListItem = createListItem(previousBlock.levels, previousBlock.formatHolder.format);\n const paragraphAfterList = createParagraph(false, paragraph.format);\n\n addBlock(newListItem, paragraph);\n paragraphAfterList.segments.push(createBr());\n mutateBlock(parent).blocks.splice(paragraphIndex, 1, newListItem, paragraphAfterList);\n path.unshift(newListItem);\n }\n}\n\nfunction mergeParagraph(\n markerPosition: InsertPoint,\n newPara: ContentModelParagraph,\n mergeToCurrentParagraph: boolean,\n context?: FormatContentModelContext,\n option?: MergeModelOption\n) {\n const { paragraph, marker } = markerPosition;\n const newParagraph = mergeToCurrentParagraph\n ? paragraph\n : splitParagraph(markerPosition, newPara.format);\n const segmentIndex = newParagraph.segments.indexOf(marker);\n\n if (option?.mergeFormat == 'none' && mergeToCurrentParagraph) {\n newParagraph.segments.forEach(segment => {\n segment.format = { ...(newParagraph.segmentFormat || {}), ...segment.format };\n });\n delete newParagraph.segmentFormat;\n }\n if (segmentIndex >= 0) {\n for (let i = 0; i < newPara.segments.length; i++) {\n const segment = newPara.segments[i];\n\n newParagraph.segments.splice(segmentIndex + i, 0, segment);\n\n if (context) {\n if (segment.segmentType == 'Entity') {\n context.newEntities.push(segment);\n }\n\n if (segment.segmentType == 'Image') {\n context.newImages.push(segment);\n }\n }\n }\n }\n\n if (newPara.decorator) {\n newParagraph.decorator = { ...newPara.decorator };\n if (HeadingTags.indexOf(newParagraph.decorator.tagName) > -1) {\n const sourceKeys: (keyof ContentModelSegmentFormat)[] = getObjectKeys(\n newParagraph.decorator.format\n );\n const segmentDecoratorKeys: (keyof ContentModelSegmentFormat)[] = getObjectKeys(\n newParagraph.segmentFormat || {}\n );\n\n sourceKeys.forEach(key => {\n if (segmentDecoratorKeys.indexOf(key) > -1) {\n delete newParagraph.segmentFormat?.[key];\n }\n });\n }\n }\n\n if (!mergeToCurrentParagraph) {\n newParagraph.format = newPara.format;\n } else {\n newParagraph.format = {\n ...newParagraph.format,\n ...newPara.format,\n };\n }\n}\n\nfunction mergeTables(\n markerPosition: InsertPoint,\n newTable: ContentModelTable,\n source: ContentModelDocument\n) {\n const { tableContext, marker } = markerPosition;\n\n if (tableContext && source.blocks.length == 1 && source.blocks[0] == newTable) {\n const { table: readonlyTable, colIndex, rowIndex } = tableContext;\n const table = mutateBlock(readonlyTable);\n\n const newTableColCount = newTable.rows[0]?.cells.length || 0;\n const newTableRowCount = newTable.rows.length;\n\n const lastTargetColIndex = getTargetColIndex(table, rowIndex, colIndex, newTableColCount);\n const extraColsNeeded = lastTargetColIndex - table.rows[0].cells.length;\n\n newTable.rows.forEach(row => {\n row.cells.forEach(cell => {\n cell.spanAbove = false;\n });\n });\n\n if (extraColsNeeded > 0) {\n const currentColCount = table.rows[0].cells.length;\n for (let col = 0; col < extraColsNeeded; col++) {\n const newColIndex = currentColCount + col;\n for (let k = 0; k < table.rows.length; k++) {\n const leftCell = table.rows[k]?.cells[newColIndex - 1];\n table.rows[k].cells[newColIndex] = createTableCell(\n false /*spanLeft*/,\n leftCell?.spanAbove,\n leftCell?.isHeader,\n leftCell?.format\n );\n }\n }\n }\n\n const lastTargetRowIndex = getTargetRowIndex(table, rowIndex, newTableRowCount, colIndex);\n const extraRowsNeeded = lastTargetRowIndex - table.rows.length;\n\n if (extraRowsNeeded > 0) {\n const currentRowCount = table.rows.length;\n const colCount = table.rows[0]?.cells.length || 0;\n for (let row = 0; row < extraRowsNeeded; row++) {\n const newRowIndex = currentRowCount + row;\n table.rows[newRowIndex] = {\n cells: [],\n format: {},\n height: 0,\n };\n for (let k = 0; k < colCount; k++) {\n const aboveCell = table.rows[newRowIndex - 1]?.cells[k];\n table.rows[newRowIndex].cells[k] = createTableCell(\n aboveCell?.spanLeft,\n false /*spanAbove*/,\n false /*isHeader*/,\n aboveCell?.format\n );\n }\n }\n }\n\n const logicalRowOffsets: number[] = [];\n let logicalRowCount = 0;\n for (let i = 0; i < newTableRowCount; i++) {\n logicalRowOffsets[i] = logicalRowCount;\n const row = newTable.rows[i];\n if (row && row.cells.some(cell => !cell.spanAbove)) {\n logicalRowCount++;\n }\n }\n\n for (let i = 0; i < newTable.rows.length; i++) {\n const sourceRow = newTable.rows[i];\n const targetRowIndex = getTargetRowIndex(\n table,\n rowIndex,\n logicalRowOffsets[i],\n colIndex\n );\n\n const logicalColOffsets: number[] = [];\n let logicalColCount = 0;\n for (let j = 0; j < sourceRow.cells.length; j++) {\n logicalColOffsets[j] = logicalColCount;\n if (!sourceRow.cells[j]?.spanLeft) {\n logicalColCount++;\n }\n }\n\n for (let j = 0; j < newTable.rows[i].cells.length; j++) {\n const newCell = sourceRow.cells[j];\n\n const targetColIndex = getTargetColIndex(\n table,\n targetRowIndex,\n colIndex,\n logicalColOffsets[j]\n );\n\n const oldCell = table.rows[targetRowIndex]?.cells[targetColIndex];\n\n table.rows[targetRowIndex].cells[targetColIndex] = newCell;\n\n if (i == 0 && j == 0) {\n const newMarker = createSelectionMarker(marker.format);\n const newPara = addSegment(newCell, newMarker);\n\n if (markerPosition.path[0] == oldCell) {\n // Update insert point to match the change result\n markerPosition.path[0] = newCell;\n markerPosition.marker = newMarker;\n markerPosition.paragraph = newPara;\n }\n }\n }\n }\n\n normalizeTable(table, markerPosition.marker.format);\n applyTableFormat(table, undefined /*newFormat*/, true /*keepCellShade*/);\n } else if (!mergeTableAfterPreviousTable(markerPosition, newTable)) {\n insertBlock(markerPosition, newTable);\n }\n}\n\nfunction mergeTableAfterPreviousTable(\n markerPosition: InsertPoint,\n newTable: ContentModelTable\n): boolean {\n const { marker, paragraph, path } = markerPosition;\n const parent = path[0];\n const paragraphIndex = parent.blocks.indexOf(paragraph);\n const previousBlock = parent.blocks[paragraphIndex - 1];\n\n if (\n paragraphIndex > 0 &&\n paragraph.segments.indexOf(marker) == 0 &&\n previousBlock?.blockType == 'Table' &&\n previousBlock.rows[0]?.cells.length > 0 &&\n newTable.rows[0]?.cells.length > 0\n ) {\n const table = mutateBlock(previousBlock);\n const columnCount = Math.max(\n ...table.rows.map(row => row.cells.length),\n ...newTable.rows.map(row => row.cells.length)\n );\n\n extendTableRows(table, columnCount);\n extendTableRows(newTable, columnCount);\n\n table.rows.push(...newTable.rows);\n\n return true;\n }\n\n return false;\n}\n\nfunction extendTableRows(table: ShallowMutableContentModelTable, columnCount: number) {\n table.rows.forEach(row => {\n const currentColumnCount = row.cells.length;\n const lastCell = row.cells[currentColumnCount - 1];\n\n if (lastCell) {\n for (let col = currentColumnCount; col < columnCount; col++) {\n const spanCell = createTableCell(\n true /* spanLeft */,\n false /* spanAbove */,\n lastCell.isHeader,\n lastCell.format,\n lastCell.dataset\n );\n\n row.cells.push(spanCell);\n }\n }\n });\n}\n\nfunction mergeList(markerPosition: InsertPoint, newList: ContentModelListItem) {\n splitParagraph(markerPosition, newList.format);\n\n const { path, paragraph } = markerPosition;\n\n const listItemIndex = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n const listItem = path[listItemIndex] as ContentModelListItem;\n const listParent = path[listItemIndex + 1]; // It is ok here when index is -1, that means there is no list and we just insert a new paragraph and use path[0] as its parent\n const blockIndex = listParent.blocks.indexOf(listItem || paragraph);\n\n if (blockIndex >= 0) {\n mutateBlock(listParent).blocks.splice(blockIndex, 0, newList);\n }\n\n if (listItem) {\n listItem?.levels.forEach((level, i) => {\n newList.levels[i] = { ...level };\n });\n }\n}\n\nfunction splitParagraph(markerPosition: InsertPoint, newParaFormat: ContentModelBlockFormat) {\n const { paragraph, marker, path } = markerPosition;\n const segmentIndex = paragraph.segments.indexOf(marker);\n const paraIndex = path[0].blocks.indexOf(paragraph);\n const newParagraph: ShallowMutableContentModelParagraph = createParagraph(\n false /*isImplicit*/,\n { ...paragraph.format, ...newParaFormat },\n paragraph.segmentFormat\n );\n\n if (segmentIndex >= 0) {\n newParagraph.segments = paragraph.segments.splice(segmentIndex);\n }\n\n if (paraIndex >= 0) {\n mutateBlock(path[0]).blocks.splice(paraIndex + 1, 0, newParagraph);\n }\n\n const listItemIndex = getClosestAncestorBlockGroupIndex(\n path,\n ['ListItem'],\n ['FormatContainer', 'TableCell']\n );\n const listItem = path[listItemIndex] as ContentModelListItem;\n\n if (listItem) {\n const listParent = listItemIndex >= 0 ? path[listItemIndex + 1] : null;\n const blockIndex = listParent ? listParent.blocks.indexOf(listItem) : -1;\n\n if (blockIndex >= 0 && listParent) {\n const newListItem = createListItem(listItem.levels, listItem.formatHolder.format);\n\n if (paraIndex >= 0) {\n newListItem.blocks = listItem.blocks.splice(paraIndex + 1);\n }\n\n if (blockIndex >= 0) {\n mutateBlock(listParent).blocks.splice(blockIndex + 1, 0, newListItem);\n }\n\n path[listItemIndex] = newListItem;\n }\n }\n\n markerPosition.paragraph = newParagraph;\n\n return newParagraph;\n}\n\nfunction insertBlock(markerPosition: InsertPoint, block: ContentModelBlock) {\n const { path } = markerPosition;\n const newParaFormat = block.blockType !== 'Paragraph' ? {} : block.format;\n const newPara = splitParagraph(markerPosition, newParaFormat);\n const blockIndex = path[0].blocks.indexOf(newPara);\n\n if (blockIndex >= 0) {\n mutateBlock(path[0]).blocks.splice(blockIndex, 0, block);\n }\n}\n\nfunction applyDefaultFormat(\n group: ReadonlyContentModelBlockGroup,\n format: ContentModelSegmentFormat,\n applyDefaultFormatOption: MergeFormatTypes\n) {\n group.blocks.forEach(block => {\n mergeBlockFormat(applyDefaultFormatOption, block);\n\n switch (block.blockType) {\n case 'BlockGroup':\n if (block.blockGroupType == 'ListItem') {\n mutateBlock(block).formatHolder.format = mergeSegmentFormat(\n applyDefaultFormatOption,\n format,\n block.formatHolder.format\n );\n }\n applyDefaultFormat(block, format, applyDefaultFormatOption);\n break;\n\n case 'Table':\n block.rows.forEach(row =>\n row.cells.forEach(cell => {\n applyDefaultFormat(cell, format, applyDefaultFormatOption);\n })\n );\n break;\n\n case 'Paragraph':\n const paragraphFormat = block.decorator?.format || {};\n const paragraph = mutateBlock(block);\n\n paragraph.segments.forEach(segment => {\n if (segment.segmentType == 'General') {\n applyDefaultFormat(segment, format, applyDefaultFormatOption);\n }\n\n segment.format = mergeSegmentFormat(applyDefaultFormatOption, format, {\n ...paragraphFormat,\n ...segment.format,\n });\n\n if (segment.link) {\n segment.link.format = mergeLinkFormat(\n applyDefaultFormatOption,\n format,\n segment.link.format\n );\n }\n });\n\n if (applyDefaultFormatOption === 'keepSourceEmphasisFormat') {\n delete paragraph.decorator;\n }\n break;\n }\n });\n}\n\nfunction mergeBlockFormat(applyDefaultFormatOption: string, block: ReadonlyContentModelBlock) {\n if (applyDefaultFormatOption == 'keepSourceEmphasisFormat' && block.format.backgroundColor) {\n delete mutateBlock(block).format.backgroundColor;\n }\n}\n\n/**\n * Hyperlink format type definition only contains backgroundColor and underline.\n * So create a minimum object with the styles supported in Hyperlink to be used in merge.\n */\nfunction getSegmentFormatInLinkFormat(\n targetFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n const result: ContentModelHyperLinkFormat = {};\n if (targetFormat.backgroundColor) {\n result.backgroundColor = targetFormat.backgroundColor;\n }\n if (targetFormat.underline) {\n result.underline = targetFormat.underline;\n }\n\n return result;\n}\n\nfunction mergeLinkFormat(\n applyDefaultFormatOption: MergeFormatTypes,\n targetFormat: ContentModelSegmentFormat,\n sourceFormat: ContentModelHyperLinkFormat\n) {\n switch (applyDefaultFormatOption) {\n case 'mergeAll':\n case 'preferSource':\n return { ...getSegmentFormatInLinkFormat(targetFormat), ...sourceFormat };\n case 'keepSourceEmphasisFormat':\n return {\n // Hyperlink segment format contains other attributes such as LinkFormat\n // so we have to retain them\n ...getFormatWithoutSegmentFormat(sourceFormat),\n // Link format only have Text color, background color, Underline, but only\n // text color + background color should be merged from the target\n ...getSegmentFormatInLinkFormat(targetFormat),\n // Get the semantic format of the source\n ...getSemanticFormat(sourceFormat),\n // The text color of the hyperlink should not be merged and\n // we should always retain the source text color\n ...getHyperlinkTextColor(sourceFormat),\n };\n case 'preferTarget':\n return { ...sourceFormat, ...getSegmentFormatInLinkFormat(targetFormat) };\n }\n}\n\nfunction mergeSegmentFormat(\n applyDefaultFormatOption: MergeFormatTypes,\n targetFormat: ContentModelSegmentFormat,\n sourceFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n switch (applyDefaultFormatOption) {\n case 'mergeAll':\n case 'preferSource':\n return { ...targetFormat, ...sourceFormat };\n case 'preferTarget':\n return { ...sourceFormat, ...targetFormat };\n case 'keepSourceEmphasisFormat':\n return {\n ...getFormatWithoutSegmentFormat(sourceFormat),\n ...targetFormat,\n ...getSemanticFormat(sourceFormat),\n };\n }\n}\n\nfunction getSemanticFormat(segmentFormat: ContentModelSegmentFormat): ContentModelSegmentFormat {\n const result: ContentModelSegmentFormat = {};\n\n const { fontWeight, italic, underline } = segmentFormat;\n\n if (fontWeight && fontWeight != 'normal') {\n result.fontWeight = fontWeight;\n }\n if (italic) {\n result.italic = italic;\n }\n if (underline) {\n result.underline = underline;\n }\n\n return result;\n}\n\n/**\n * Segment format can also contain other type of metadata, for example in Images/Hyperlink,\n * we want to preserve these properties when merging format\n */\nfunction getFormatWithoutSegmentFormat(\n sourceFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n const resultFormat = {\n ...sourceFormat,\n };\n KeysOfSegmentFormat.forEach(key => delete resultFormat[key]);\n return resultFormat;\n}\n\nfunction getHyperlinkTextColor(sourceFormat: ContentModelHyperLinkFormat) {\n const result: ContentModelHyperLinkFormat = {};\n if (sourceFormat.textColor) {\n result.textColor = sourceFormat.textColor;\n }\n\n return result;\n}\n\nfunction getTargetColIndex(\n table: ReadonlyContentModelTable,\n rowIndex: number,\n startColIndex: number,\n offset: number\n): number {\n const row = table.rows[rowIndex];\n if (!row) {\n return startColIndex + offset;\n }\n\n if (offset === 0) {\n return startColIndex;\n }\n\n let targetColIndex = startColIndex;\n let logicalCellsToSkip = offset;\n\n while (logicalCellsToSkip > 0) {\n targetColIndex++;\n\n if (targetColIndex >= row.cells.length) {\n logicalCellsToSkip--;\n } else if (!row.cells[targetColIndex].spanLeft) {\n logicalCellsToSkip--;\n }\n }\n\n return targetColIndex;\n}\n\nfunction getTargetRowIndex(\n table: ReadonlyContentModelTable,\n startRowIndex: number,\n offset: number,\n colIndex: number\n): number {\n if (offset === 0) {\n return startRowIndex;\n }\n\n let targetRowIndex = startRowIndex;\n let logicalRowsToSkip = offset;\n\n while (logicalRowsToSkip > 0) {\n targetRowIndex++;\n\n if (targetRowIndex >= table.rows.length) {\n logicalRowsToSkip--;\n } else if (!table.rows[targetRowIndex]?.cells[colIndex]?.spanAbove) {\n logicalRowsToSkip--;\n }\n }\n\n return targetRowIndex;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "../../domUtils/style/borderValues", "./getClosestAncestorBlockGroupIndex", "../metadata/updateImageMetadata", "../metadata/updateTableMetadata", "../../domUtils/style/isBold", "../selection/iterateSelections", "../../formatHandlers/utils/parseValueWithUnit"], function (require, exports, tslib_1, borderValues_1, getClosestAncestorBlockGroupIndex_1, updateImageMetadata_1, updateTableMetadata_1, isBold_1, iterateSelections_1, parseValueWithUnit_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "../../domUtils/style/borderValues", "./canMergeCells", "./getClosestAncestorBlockGroupIndex", "../metadata/updateImageMetadata", "../metadata/updateTableMetadata", "../../domUtils/style/isBold", "../selection/iterateSelections", "../../formatHandlers/utils/parseValueWithUnit"], function (require, exports, tslib_1, borderValues_1, canMergeCells_1, getClosestAncestorBlockGroupIndex_1, updateImageMetadata_1, updateTableMetadata_1, isBold_1, iterateSelections_1, parseValueWithUnit_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.retrieveModelFormatState = void 0;
|
|
@@ -16,6 +16,7 @@ define(["require", "exports", "tslib", "../../domUtils/style/borderValues", "./g
|
|
|
16
16
|
function retrieveModelFormatState(model, pendingFormat, formatState, conflictSolution, domHelper, isInDarkMode, colorHandler) {
|
|
17
17
|
if (conflictSolution === void 0) { conflictSolution = 'remove'; }
|
|
18
18
|
var firstTableContext;
|
|
19
|
+
var lastTableContext;
|
|
19
20
|
var firstBlock;
|
|
20
21
|
var isFirst = true;
|
|
21
22
|
var isFirstImage = true;
|
|
@@ -87,7 +88,7 @@ define(["require", "exports", "tslib", "../../domUtils/style/borderValues", "./g
|
|
|
87
88
|
// Merge table format
|
|
88
89
|
if (tableContext.table == table &&
|
|
89
90
|
(tableContext.colIndex != colIndex || tableContext.rowIndex != rowIndex)) {
|
|
90
|
-
|
|
91
|
+
lastTableContext = tableContext;
|
|
91
92
|
formatState.isMultilineSelection = true;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
@@ -100,6 +101,9 @@ define(["require", "exports", "tslib", "../../domUtils/style/borderValues", "./g
|
|
|
100
101
|
}, {
|
|
101
102
|
includeListFormatHolder: 'never',
|
|
102
103
|
});
|
|
104
|
+
if (firstTableContext && lastTableContext) {
|
|
105
|
+
formatState.canMergeTableCell = (0, canMergeCells_1.canMergeCells)(firstTableContext.table.rows, firstTableContext.rowIndex, firstTableContext.colIndex, lastTableContext.rowIndex, lastTableContext.colIndex);
|
|
106
|
+
}
|
|
103
107
|
if (formatState.fontSize) {
|
|
104
108
|
formatState.fontSize = px2Pt(formatState.fontSize);
|
|
105
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieveModelFormatState.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/retrieveModelFormatState.ts"],"names":[],"mappings":";;;;IAuBA;;;;;;;;;;OAUG;IACH,SAAgB,wBAAwB,CACpC,KAAmC,EACnC,aAA+C,EAC/C,WAAoC,EACpC,gBAAmD,EACnD,SAAqB,EACrB,YAAsB,EACtB,YAA+B;QAH/B,iCAAA,EAAA,2BAAmD;QAKnD,IAAI,iBAA4D,CAAC;QACjE,IAAI,UAAiD,CAAC;QACtD,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,IAAI,YAAY,GAAG,IAAI,CAAC;QACxB,IAAI,cAAc,GAAG,IAAI,CAAC;QAC1B,IAAI,eAAe,GAA0C,SAAS,CAAC;QAEvE,IAAM,WAAW,6BAAQ,KAAK,CAAC,MAAM,CAAE,CAAC;QAExC,OAAO,WAAW,CAAC,MAAM,CAAC;QAC1B,OAAO,WAAW,CAAC,SAAS,CAAC;QAC7B,OAAO,WAAW,CAAC,UAAU,CAAC;QAE9B,IAAA,qCAAiB,EACb,KAAK,EACL,UAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ;YAChC,oBAAoB;YACpB,uBAAuB,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;YAEtE,uBAAuB;YACvB,IAAI,KAAK,EAAE;gBACP,IAAI,UAAU,EAAE;oBACZ,WAAW,CAAC,oBAAoB,GAAG,IAAI,CAAC;iBAC3C;qBAAM;oBACH,UAAU,GAAG,KAAK,CAAC;iBACtB;aACJ;YAED,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,KAAI,WAAW,EAAE;gBACjC,oBAAoB;gBACpB,uBAAuB,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;gBAEvE,kBAAkB;gBAClB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC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ACnD,QAAQ,gBAAgB,EAAE;gBACtB,KAAK,QAAQ;oBACT,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;oBACnB,MAAM;gBACV,KAAK,WAAW;oBACZ,MAAM;gBACV,KAAK,gBAAgB;oBACjB,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;wBAChC,MAAM,CAAC,GAAG,CAAY,GAAG,UAAU,CAAC;qBACxC;yBAAM;wBACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;qBACtB;oBACD,MAAM;aACb;SACJ;IACL,CAAC;IAED,SAAS,KAAK,CAAC,EAAU;QACrB,IAAI,EAAE,EAAE;YACJ,IAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;gBACzC,8HAA8H;gBAC9H,wBAAwB;gBACxB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;aAC9D;SACJ;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAED,SAAS,oBAAoB,CAAC,MAAiC;QAC3D,OAAO,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;IAC1E,CAAC","sourcesContent":["import { extractBorderValues } from '../../domUtils/style/borderValues';\nimport { getClosestAncestorBlockGroupIndex } from './getClosestAncestorBlockGroupIndex';\nimport { getImageMetadata } from '../metadata/updateImageMetadata';\nimport { getTableMetadata } from '../metadata/updateTableMetadata';\nimport { isBold } from '../../domUtils/style/isBold';\nimport { iterateSelections } from '../selection/iterateSelections';\nimport { parseValueWithUnit } from '../../formatHandlers/utils/parseValueWithUnit';\nimport type {\n ConflictFormatSolution,\n ContentModelFormatState,\n ContentModelSegmentFormat,\n ReadonlyContentModelBlockGroup,\n ReadonlyContentModelBlock,\n ReadonlyContentModelImage,\n ReadonlyTableSelectionContext,\n ReadonlyContentModelParagraph,\n ReadonlyContentModelFormatContainer,\n ReadonlyContentModelListItem,\n ReadonlyContentModelDocument,\n DOMHelper,\n DarkColorHandler,\n} from 'roosterjs-content-model-types';\n\n/**\n * Retrieve format state from the given Content Model\n * @param model The Content Model to retrieve format state from\n * @param pendingFormat Existing pending format, if any\n * @param formatState Existing format state object, used for receiving the result\n * @param conflictSolution The strategy for handling format conflicts\n * @param domHelper Optional DOMHelper to retrieve container format\n * @param isInDarkMode Optional flag to indicate if the environment is in dark mode\n * @param colorHandler Optional DarkColorHandler to handle dark mode colors\n *\n */\nexport function retrieveModelFormatState(\n model: ReadonlyContentModelDocument,\n pendingFormat: ContentModelSegmentFormat | null,\n formatState: ContentModelFormatState,\n conflictSolution: ConflictFormatSolution = 'remove',\n domHelper?: DOMHelper,\n isInDarkMode?: boolean,\n colorHandler?: DarkColorHandler\n) {\n let firstTableContext: ReadonlyTableSelectionContext | undefined;\n let firstBlock: ReadonlyContentModelBlock | undefined;\n let isFirst = true;\n let isFirstImage = true;\n let isFirstSegment = true;\n let containerFormat: ContentModelSegmentFormat | undefined = undefined;\n\n const modelFormat = { ...model.format };\n\n delete modelFormat.italic;\n delete modelFormat.underline;\n delete modelFormat.fontWeight;\n\n iterateSelections(\n model,\n (path, tableContext, block, segments) => {\n // Structure formats\n retrieveStructureFormat(formatState, path, isFirst, conflictSolution);\n\n // Multiple line format\n if (block) {\n if (firstBlock) {\n formatState.isMultilineSelection = true;\n } else {\n firstBlock = block;\n }\n }\n\n if (block?.blockType == 'Paragraph') {\n // Paragraph formats\n retrieveParagraphFormat(formatState, block, isFirst, conflictSolution);\n\n // Segment formats\n segments?.forEach(segment => {\n if (isFirstSegment || segment.segmentType != 'SelectionMarker') {\n let currentFormat = Object.assign(\n {},\n block.format,\n block.decorator?.format,\n segment.format,\n segment.code?.format,\n segment.link?.format,\n pendingFormat\n );\n\n // Sometimes the content may not specify all required format but just leverage the container format to do so.\n // In this case, we need to merge the container format into the current format\n // to make sure the current format contains all required format.\n if (!hasAllRequiredFormat(currentFormat)) {\n if (!containerFormat) {\n containerFormat =\n domHelper?.getContainerFormat(isInDarkMode, colorHandler) ??\n modelFormat;\n }\n\n currentFormat = Object.assign({}, containerFormat, currentFormat);\n }\n\n retrieveSegmentFormat(\n formatState,\n isFirst,\n currentFormat,\n conflictSolution\n );\n\n mergeValue(\n formatState,\n 'isCodeInline',\n !!segment?.code,\n isFirst,\n conflictSolution\n );\n }\n\n // We only care the format of selection marker when it is the first selected segment. This is because when selection marker\n // is after some other selected segments, it mostly like appears at the beginning of a seconde line when the whole first line\n // is selected (e.g. triple-click on a line) then the second selection marker doesn't contain a correct format, so we need to\n // ignore it\n isFirstSegment = false;\n\n formatState.canUnlink = formatState.canUnlink || !!segment.link;\n formatState.canAddImageAltText =\n formatState.canAddImageAltText ||\n segments.some(segment => segment.segmentType == 'Image');\n\n isFirst = false;\n\n if (segment.segmentType === 'Image') {\n if (isFirstImage) {\n retrieveImageFormat(segment, formatState);\n isFirstImage = false;\n } else {\n formatState.imageFormat = undefined;\n formatState.imageEditingMetadata = undefined;\n }\n }\n });\n\n isFirst = false;\n }\n\n if (tableContext) {\n if (firstTableContext) {\n const { table, colIndex, rowIndex } = firstTableContext;\n\n // Merge table format\n if (\n tableContext.table == table &&\n (tableContext.colIndex != colIndex || tableContext.rowIndex != rowIndex)\n ) {\n formatState.canMergeTableCell = true;\n formatState.isMultilineSelection = true;\n }\n } else {\n // Table formats\n retrieveTableFormat(tableContext, formatState);\n firstTableContext = tableContext;\n }\n }\n },\n {\n includeListFormatHolder: 'never',\n }\n );\n\n if (formatState.fontSize) {\n formatState.fontSize = px2Pt(formatState.fontSize);\n }\n}\n\nfunction retrieveSegmentFormat(\n result: ContentModelFormatState,\n isFirst: boolean,\n mergedFormat: ContentModelSegmentFormat,\n conflictSolution: ConflictFormatSolution = 'remove'\n) {\n const superOrSubscript = mergedFormat.superOrSubScriptSequence?.split(' ')?.pop();\n\n mergeValue(result, 'isBold', isBold(mergedFormat.fontWeight), isFirst, conflictSolution);\n mergeValue(result, 'isItalic', mergedFormat.italic, isFirst, conflictSolution);\n mergeValue(result, 'isUnderline', mergedFormat.underline, isFirst, conflictSolution);\n mergeValue(result, 'isStrikeThrough', mergedFormat.strikethrough, isFirst, conflictSolution);\n mergeValue(result, 'isSuperscript', superOrSubscript == 'super', isFirst, conflictSolution);\n mergeValue(result, 'isSubscript', superOrSubscript == 'sub', isFirst, conflictSolution);\n mergeValue(result, 'letterSpacing', mergedFormat.letterSpacing, isFirst, conflictSolution);\n\n mergeValue(result, 'fontName', mergedFormat.fontFamily, isFirst, conflictSolution);\n mergeValue(\n result,\n 'fontSize',\n mergedFormat.fontSize,\n isFirst,\n conflictSolution,\n val => parseValueWithUnit(val, undefined, 'pt') + 'pt'\n );\n mergeValue(result, 'backgroundColor', mergedFormat.backgroundColor, isFirst, conflictSolution);\n mergeValue(result, 'textColor', mergedFormat.textColor, isFirst, conflictSolution);\n mergeValue(result, 'fontWeight', mergedFormat.fontWeight, isFirst, conflictSolution);\n mergeValue(result, 'lineHeight', mergedFormat.lineHeight, isFirst, conflictSolution);\n}\n\nfunction retrieveParagraphFormat(\n result: ContentModelFormatState,\n paragraph: ReadonlyContentModelParagraph,\n isFirst: boolean,\n conflictSolution: ConflictFormatSolution = 'remove'\n) {\n const headingLevel = parseInt((paragraph.decorator?.tagName || '').substring(1));\n const validHeadingLevel = headingLevel >= 1 && headingLevel <= 6 ? headingLevel : undefined;\n\n mergeValue(result, 'marginBottom', paragraph.format.marginBottom, isFirst, conflictSolution);\n mergeValue(result, 'marginTop', paragraph.format.marginTop, isFirst, conflictSolution);\n mergeValue(result, 'headingLevel', validHeadingLevel, isFirst, conflictSolution);\n mergeValue(result, 'textAlign', paragraph.format.textAlign, isFirst, conflictSolution);\n mergeValue(result, 'direction', paragraph.format.direction, isFirst, conflictSolution);\n}\n\nfunction retrieveStructureFormat(\n result: ContentModelFormatState,\n path: ReadonlyContentModelBlockGroup[],\n isFirst: boolean,\n conflictSolution: ConflictFormatSolution = 'remove'\n) {\n const listItemIndex = getClosestAncestorBlockGroupIndex(path, ['ListItem'], []);\n const containerIndex = getClosestAncestorBlockGroupIndex(path, ['FormatContainer'], []);\n\n if (listItemIndex >= 0) {\n const listItem = path[listItemIndex] as ReadonlyContentModelListItem;\n const listType = listItem?.levels[listItem.levels.length - 1]?.listType;\n\n mergeValue(result, 'isBullet', listType == 'UL', isFirst, conflictSolution);\n mergeValue(result, 'isNumbering', listType == 'OL', isFirst, conflictSolution);\n }\n\n mergeValue(\n result,\n 'isBlockQuote',\n containerIndex >= 0 &&\n (path[containerIndex] as ReadonlyContentModelFormatContainer)?.tagName == 'blockquote',\n isFirst,\n conflictSolution\n );\n}\n\nfunction retrieveTableFormat(\n tableContext: ReadonlyTableSelectionContext,\n result: ContentModelFormatState\n) {\n const tableFormat = getTableMetadata(tableContext.table);\n\n result.isInTable = true;\n result.tableHasHeader = tableContext.table.rows.some(row =>\n row.cells.some(cell => cell.isHeader)\n );\n\n if (tableFormat) {\n result.tableFormat = tableFormat;\n }\n}\n\nfunction retrieveImageFormat(image: ReadonlyContentModelImage, result: ContentModelFormatState) {\n const { format } = image;\n const borderKey = 'borderTop';\n const extractedBorder = extractBorderValues(format[borderKey]);\n const borderColor = extractedBorder.color;\n const borderWidth = extractedBorder.width;\n const borderStyle = extractedBorder.style;\n\n result.imageFormat = {\n borderColor,\n borderWidth,\n borderStyle,\n boxShadow: format.boxShadow,\n borderRadius: format.borderRadius,\n };\n result.imageEditingMetadata = getImageMetadata(image);\n}\n\nfunction mergeValue<K extends keyof ContentModelFormatState>(\n format: ContentModelFormatState,\n key: K,\n newValue: ContentModelFormatState[K] | undefined,\n isFirst: boolean,\n conflictSolution: ConflictFormatSolution = 'remove',\n parseFn: (val: ContentModelFormatState[K]) => ContentModelFormatState[K] = val => val\n) {\n if (isFirst) {\n if (newValue !== undefined) {\n format[key] = newValue;\n }\n } else if (parseFn(newValue) !== parseFn(format[key])) {\n switch (conflictSolution) {\n case 'remove':\n delete format[key];\n break;\n case 'keepFirst':\n break;\n case 'returnMultiple':\n if (typeof format[key] === 'string') {\n (format[key] as string) = 'Multiple';\n } else {\n delete format[key];\n }\n break;\n }\n }\n}\n\nfunction px2Pt(px: string) {\n if (px) {\n const index = px.indexOf('px');\n if (index !== -1 && index === px.length - 2) {\n // Edge may not handle the floating computing well which causes the calculated value to be a little less than the actual value\n // So add 0.05 to fix it\n return Math.round(parseFloat(px) * 75 + 0.05) / 100 + 'pt';\n }\n }\n return px;\n}\n\nfunction hasAllRequiredFormat(format: ContentModelSegmentFormat) {\n return !!format.fontFamily && !!format.fontSize && !!format.textColor;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"retrieveModelFormatState.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/retrieveModelFormatState.ts"],"names":[],"mappings":";;;;IAwBA;;;;;;;;;;OAUG;IACH,SAAgB,wBAAwB,CACpC,KAAmC,EACnC,aAA+C,EAC/C,WAAoC,EACpC,gBAAmD,EACnD,SAAqB,EACrB,YAAsB,EACtB,YAA+B;QAH/B,iCAAA,EAAA,2BAAmD;QAKnD,IAAI,iBAA4D,CAAC;QACjE,IAAI,gBAA2D,CAAC;QAChE,IAAI,UAAiD,CAAC;QACtD,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,IAAI,YAAY,GAAG,IAAI,CAAC;QACxB,IAAI,cAAc,GAAG,IAAI,CAAC;QAC1B,IAAI,eAAe,GAA0C,SAAS,CAAC;QAEvE,IAAM,WAAW,6BAAQ,KAAK,CAAC,MAAM,CAAE,CAAC;QAExC,OAAO,WAAW,CAAC,MAAM,CAAC;QAC1B,OAAO,WAAW,CAAC,SAAS,CAAC;QAC7B,OAAO,WAAW,CAAC,UAAU,CA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U;QACrB,IAAI,EAAE,EAAE;YACJ,IAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;gBACzC,8HAA8H;gBAC9H,wBAAwB;gBACxB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;aAC9D;SACJ;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAED,SAAS,oBAAoB,CAAC,MAAiC;QAC3D,OAAO,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;IAC1E,CAAC","sourcesContent":["import { extractBorderValues } from '../../domUtils/style/borderValues';\nimport { canMergeCells } from './canMergeCells';\nimport { getClosestAncestorBlockGroupIndex } from './getClosestAncestorBlockGroupIndex';\nimport { getImageMetadata } from '../metadata/updateImageMetadata';\nimport { getTableMetadata } from '../metadata/updateTableMetadata';\nimport { isBold } from '../../domUtils/style/isBold';\nimport { iterateSelections } from '../selection/iterateSelections';\nimport { parseValueWithUnit } from '../../formatHandlers/utils/parseValueWithUnit';\nimport type {\n ConflictFormatSolution,\n ContentModelFormatState,\n ContentModelSegmentFormat,\n ReadonlyContentModelBlockGroup,\n ReadonlyContentModelBlock,\n ReadonlyContentModelImage,\n ReadonlyTableSelectionContext,\n ReadonlyContentModelParagraph,\n ReadonlyContentModelFormatContainer,\n ReadonlyContentModelListItem,\n ReadonlyContentModelDocument,\n DOMHelper,\n DarkColorHandler,\n} from 'roosterjs-content-model-types';\n\n/**\n * Retrieve format state from the given Content Model\n * @param model The Content Model to retrieve format state from\n * @param pendingFormat Existing pending format, if any\n * @param formatState Existing format state object, used for receiving the result\n * @param conflictSolution The strategy for handling format conflicts\n * @param domHelper Optional DOMHelper to retrieve container format\n * @param isInDarkMode Optional flag to indicate if the environment is in dark mode\n * @param colorHandler Optional DarkColorHandler to handle dark mode colors\n *\n */\nexport function retrieveModelFormatState(\n model: ReadonlyContentModelDocument,\n pendingFormat: ContentModelSegmentFormat | null,\n formatState: ContentModelFormatState,\n conflictSolution: ConflictFormatSolution = 'remove',\n domHelper?: DOMHelper,\n isInDarkMode?: boolean,\n colorHandler?: DarkColorHandler\n) {\n let firstTableContext: ReadonlyTableSelectionContext | undefined;\n let lastTableContext: ReadonlyTableSelectionContext | undefined;\n let firstBlock: ReadonlyContentModelBlock | undefined;\n let isFirst = true;\n let isFirstImage = true;\n let isFirstSegment = true;\n let containerFormat: ContentModelSegmentFormat | undefined = undefined;\n\n const modelFormat = { ...model.format };\n\n delete modelFormat.italic;\n delete modelFormat.underline;\n delete modelFormat.fontWeight;\n\n iterateSelections(\n model,\n (path, tableContext, block, segments) => {\n // Structure formats\n retrieveStructureFormat(formatState, path, isFirst, conflictSolution);\n\n // Multiple line format\n if (block) {\n if (firstBlock) {\n formatState.isMultilineSelection = true;\n } else {\n firstBlock = block;\n }\n }\n\n if (block?.blockType == 'Paragraph') {\n // Paragraph formats\n retrieveParagraphFormat(formatState, block, isFirst, conflictSolution);\n\n // Segment formats\n segments?.forEach(segment => {\n if (isFirstSegment || segment.segmentType != 'SelectionMarker') {\n let currentFormat = Object.assign(\n {},\n block.format,\n block.decorator?.format,\n segment.format,\n segment.code?.format,\n segment.link?.format,\n pendingFormat\n );\n\n // Sometimes the content may not specify all required format but just leverage the container format to do so.\n // In this case, we need to merge the container format into the current format\n // to make sure the current format contains all required format.\n if (!hasAllRequiredFormat(currentFormat)) {\n if (!containerFormat) {\n containerFormat =\n domHelper?.getContainerFormat(isInDarkMode, colorHandler) ??\n modelFormat;\n }\n\n currentFormat = Object.assign({}, containerFormat, currentFormat);\n }\n\n retrieveSegmentFormat(\n formatState,\n isFirst,\n currentFormat,\n conflictSolution\n );\n\n mergeValue(\n formatState,\n 'isCodeInline',\n !!segment?.code,\n isFirst,\n conflictSolution\n );\n }\n\n // We only care the format of selection marker when it is the first selected segment. This is because when selection marker\n // is after some other selected segments, it mostly like appears at the beginning of a seconde line when the whole first line\n // is selected (e.g. triple-click on a line) then the second selection marker doesn't contain a correct format, so we need to\n // ignore it\n isFirstSegment = false;\n\n formatState.canUnlink = formatState.canUnlink || !!segment.link;\n formatState.canAddImageAltText =\n formatState.canAddImageAltText ||\n segments.some(segment => segment.segmentType == 'Image');\n\n isFirst = false;\n\n if (segment.segmentType === 'Image') {\n if (isFirstImage) {\n retrieveImageFormat(segment, formatState);\n isFirstImage = false;\n } else {\n formatState.imageFormat = undefined;\n formatState.imageEditingMetadata = undefined;\n }\n }\n });\n\n isFirst = false;\n }\n\n if (tableContext) {\n if (firstTableContext) {\n const { table, colIndex, rowIndex } = firstTableContext;\n\n // Merge table format\n if (\n tableContext.table == table &&\n (tableContext.colIndex != colIndex || tableContext.rowIndex != rowIndex)\n ) {\n lastTableContext = tableContext;\n formatState.isMultilineSelection = true;\n }\n } else {\n // Table formats\n retrieveTableFormat(tableContext, formatState);\n firstTableContext = tableContext;\n }\n }\n },\n {\n includeListFormatHolder: 'never',\n }\n );\n\n if (firstTableContext && lastTableContext) {\n formatState.canMergeTableCell = canMergeCells(\n firstTableContext.table.rows,\n firstTableContext.rowIndex,\n firstTableContext.colIndex,\n lastTableContext.rowIndex,\n lastTableContext.colIndex\n );\n }\n\n if (formatState.fontSize) {\n formatState.fontSize = px2Pt(formatState.fontSize);\n }\n}\n\nfunction retrieveSegmentFormat(\n result: ContentModelFormatState,\n isFirst: boolean,\n mergedFormat: ContentModelSegmentFormat,\n conflictSolution: ConflictFormatSolution = 'remove'\n) {\n const superOrSubscript = mergedFormat.superOrSubScriptSequence?.split(' ')?.pop();\n\n mergeValue(result, 'isBold', isBold(mergedFormat.fontWeight), isFirst, conflictSolution);\n mergeValue(result, 'isItalic', mergedFormat.italic, isFirst, conflictSolution);\n mergeValue(result, 'isUnderline', mergedFormat.underline, isFirst, conflictSolution);\n mergeValue(result, 'isStrikeThrough', mergedFormat.strikethrough, isFirst, conflictSolution);\n mergeValue(result, 'isSuperscript', superOrSubscript == 'super', isFirst, conflictSolution);\n mergeValue(result, 'isSubscript', superOrSubscript == 'sub', isFirst, conflictSolution);\n mergeValue(result, 'letterSpacing', mergedFormat.letterSpacing, isFirst, conflictSolution);\n\n mergeValue(result, 'fontName', mergedFormat.fontFamily, isFirst, conflictSolution);\n mergeValue(\n result,\n 'fontSize',\n mergedFormat.fontSize,\n isFirst,\n conflictSolution,\n val => parseValueWithUnit(val, undefined, 'pt') + 'pt'\n );\n mergeValue(result, 'backgroundColor', mergedFormat.backgroundColor, isFirst, conflictSolution);\n mergeValue(result, 'textColor', mergedFormat.textColor, isFirst, conflictSolution);\n mergeValue(result, 'fontWeight', mergedFormat.fontWeight, isFirst, conflictSolution);\n mergeValue(result, 'lineHeight', mergedFormat.lineHeight, isFirst, conflictSolution);\n}\n\nfunction retrieveParagraphFormat(\n result: ContentModelFormatState,\n paragraph: ReadonlyContentModelParagraph,\n isFirst: boolean,\n conflictSolution: ConflictFormatSolution = 'remove'\n) {\n const headingLevel = parseInt((paragraph.decorator?.tagName || '').substring(1));\n const validHeadingLevel = headingLevel >= 1 && headingLevel <= 6 ? headingLevel : undefined;\n\n mergeValue(result, 'marginBottom', paragraph.format.marginBottom, isFirst, conflictSolution);\n mergeValue(result, 'marginTop', paragraph.format.marginTop, isFirst, conflictSolution);\n mergeValue(result, 'headingLevel', validHeadingLevel, isFirst, conflictSolution);\n mergeValue(result, 'textAlign', paragraph.format.textAlign, isFirst, conflictSolution);\n mergeValue(result, 'direction', paragraph.format.direction, isFirst, conflictSolution);\n}\n\nfunction retrieveStructureFormat(\n result: ContentModelFormatState,\n path: ReadonlyContentModelBlockGroup[],\n isFirst: boolean,\n conflictSolution: ConflictFormatSolution = 'remove'\n) {\n const listItemIndex = getClosestAncestorBlockGroupIndex(path, ['ListItem'], []);\n const containerIndex = getClosestAncestorBlockGroupIndex(path, ['FormatContainer'], []);\n\n if (listItemIndex >= 0) {\n const listItem = path[listItemIndex] as ReadonlyContentModelListItem;\n const listType = listItem?.levels[listItem.levels.length - 1]?.listType;\n\n mergeValue(result, 'isBullet', listType == 'UL', isFirst, conflictSolution);\n mergeValue(result, 'isNumbering', listType == 'OL', isFirst, conflictSolution);\n }\n\n mergeValue(\n result,\n 'isBlockQuote',\n containerIndex >= 0 &&\n (path[containerIndex] as ReadonlyContentModelFormatContainer)?.tagName == 'blockquote',\n isFirst,\n conflictSolution\n );\n}\n\nfunction retrieveTableFormat(\n tableContext: ReadonlyTableSelectionContext,\n result: ContentModelFormatState\n) {\n const tableFormat = getTableMetadata(tableContext.table);\n\n result.isInTable = true;\n result.tableHasHeader = tableContext.table.rows.some(row =>\n row.cells.some(cell => cell.isHeader)\n );\n\n if (tableFormat) {\n result.tableFormat = tableFormat;\n }\n}\n\nfunction retrieveImageFormat(image: ReadonlyContentModelImage, result: ContentModelFormatState) {\n const { format } = image;\n const borderKey = 'borderTop';\n const extractedBorder = extractBorderValues(format[borderKey]);\n const borderColor = extractedBorder.color;\n const borderWidth = extractedBorder.width;\n const borderStyle = extractedBorder.style;\n\n result.imageFormat = {\n borderColor,\n borderWidth,\n borderStyle,\n boxShadow: format.boxShadow,\n borderRadius: format.borderRadius,\n };\n result.imageEditingMetadata = getImageMetadata(image);\n}\n\nfunction mergeValue<K extends keyof ContentModelFormatState>(\n format: ContentModelFormatState,\n key: K,\n newValue: ContentModelFormatState[K] | undefined,\n isFirst: boolean,\n conflictSolution: ConflictFormatSolution = 'remove',\n parseFn: (val: ContentModelFormatState[K]) => ContentModelFormatState[K] = val => val\n) {\n if (isFirst) {\n if (newValue !== undefined) {\n format[key] = newValue;\n }\n } else if (parseFn(newValue) !== parseFn(format[key])) {\n switch (conflictSolution) {\n case 'remove':\n delete format[key];\n break;\n case 'keepFirst':\n break;\n case 'returnMultiple':\n if (typeof format[key] === 'string') {\n (format[key] as string) = 'Multiple';\n } else {\n delete format[key];\n }\n break;\n }\n }\n}\n\nfunction px2Pt(px: string) {\n if (px) {\n const index = px.indexOf('px');\n if (index !== -1 && index === px.length - 2) {\n // Edge may not handle the floating computing well which causes the calculated value to be a little less than the actual value\n // So add 0.05 to fix it\n return Math.round(parseFloat(px) * 75 + 0.05) / 100 + 'pt';\n }\n }\n return px;\n}\n\nfunction hasAllRequiredFormat(format: ContentModelSegmentFormat) {\n return !!format.fontFamily && !!format.fontSize && !!format.textColor;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultHTMLStyleMap.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-dom/lib/config/defaultHTMLStyleMap.ts"],"names":[],"mappings":";AAEA,IAAM,YAAY,GAAiC;IAC/C,OAAO,EAAE,OAAO;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAoB;IAChD,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,YAAY;IACnB,CAAC,EAAE;QACC,UAAU,EAAE,MAAM;KACrB;IACD,UAAU,EAAE;QACR,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,MAAM;KACtB;IACD,EAAE,EAAE,YAAY;IAChB,MAAM,EAAE;QACJ,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,QAAQ;KACtB;IACD,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE;IACnD,GAAG,EAAE,YAAY;IACjB,EAAE,EAAE;QACA,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;KACtB;IACD,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE;QACA,SAAS,EAAE,QAAQ;KACtB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M,EAAE;QACJ,cAAc,EAAE,cAAc;KACjC;IACD,MAAM,EAAE;QACJ,UAAU,EAAE,MAAM;KACrB;IACD,GAAG,EAAE;QACD,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,SAAS;KACtB;IACD,GAAG,EAAE;QACD,aAAa,EAAE,OAAO;QACtB,QAAQ,EAAE,SAAS;KACtB;IACD,KAAK,EAAE;QACH,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,YAAY;KAC1B;IACD,EAAE,EAAE;QACA,OAAO,EAAE,YAAY;KACxB;IACD,EAAE,EAAE;QACA,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,MAAM;KACrB;IACD,CAAC,EAAE;QACC,cAAc,EAAE,WAAW;KAC9B;IACD,EAAE,wBAAO,YAAY,KAAE,kBAAkB,EAAE,MAAM,GAAE;CACtD,CAAC","sourcesContent":["import type { DefaultStyleMap } from 'roosterjs-content-model-types';\n\nconst blockElement: Partial<CSSStyleDeclaration> = {\n display: 'block',\n};\n\n/**\n * @internal\n */\nexport const defaultHTMLStyleMap: DefaultStyleMap = {\n address: blockElement,\n article: blockElement,\n aside: blockElement,\n b: {\n fontWeight: 'bold',\n },\n blockquote: {\n display: 'block',\n marginTop: '1em',\n marginBottom: '1em',\n marginLeft: '40px',\n marginRight: '40px',\n },\n br: blockElement,\n center: {\n display: 'block',\n textAlign: 'center',\n },\n dd: { display: 'block', marginInlineStart: '40px' },\n div: blockElement,\n dl: {\n display: 'block',\n marginTop: '1em',\n marginBottom: '1em',\n },\n dt: blockElement,\n em: {\n fontStyle: 'italic',\n },\n fieldset: blockElement,\n figcaption: blockElement,\n figure: blockElement,\n footer: blockElement,\n form: blockElement,\n h1: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '2em',\n },\n h2: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '1.5em',\n },\n h3: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '1.17em',\n },\n h4: {\n display: 'block',\n fontWeight: 'bold',\n },\n h5: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '0.83em',\n },\n h6: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '0.67em',\n },\n header: blockElement,\n hr: blockElement,\n i: {\n fontStyle: 'italic',\n },\n li: {\n display: 'list-item',\n },\n main: blockElement,\n nav: blockElement,\n ol: { ...blockElement, paddingInlineStart: '40px' },\n p: {\n display: 'block',\n marginTop: '1em',\n marginBottom: '1em',\n },\n pre: {\n display: 'block',\n fontFamily: 'monospace',\n whiteSpace: 'pre',\n marginTop: '1em',\n marginBottom: '1em',\n },\n s: {\n textDecoration: 'line-through',\n },\n section: blockElement,\n strike: {\n textDecoration: 'line-through',\n },\n strong: {\n fontWeight: 'bold',\n },\n sub: {\n verticalAlign: 'sub',\n fontSize: 'smaller',\n },\n sup: {\n verticalAlign: 'super',\n fontSize: 'smaller',\n },\n table: {\n display: 'table',\n boxSizing: 'border-box',\n },\n td: {\n display: 'table-cell',\n },\n th: {\n display: 'table-cell',\n fontWeight: 'bold',\n },\n u: {\n textDecoration: 'underline',\n },\n ul: { ...blockElement, paddingInlineStart: '40px' },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"defaultHTMLStyleMap.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-dom/lib/config/defaultHTMLStyleMap.ts"],"names":[],"mappings":";AAEA,IAAM,YAAY,GAAiC;IAC/C,OAAO,EAAE,OAAO;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAoB;IAChD,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,YAAY;IACnB,CAAC,EAAE;QACC,UAAU,EAAE,MAAM;KACrB;IACD,UAAU,EAAE;QACR,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,MAAM;KACtB;IACD,EAAE,EAAE,YAAY;IAChB,MAAM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jB,EAAE,wBAAO,YAAY,KAAE,kBAAkB,EAAE,MAAM,GAAE;IACnD,CAAC,EAAE;QACC,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;KACtB;IACD,GAAG,EAAE;QACD,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;KACtB;IACD,CAAC,EAAE;QACC,cAAc,EAAE,cAAc;KACjC;IACD,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE;QACJ,cAAc,EAAE,cAAc;KACjC;IACD,MAAM,EAAE;QACJ,UAAU,EAAE,MAAM;KACrB;IACD,GAAG,EAAE;QACD,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,SAAS;KACtB;IACD,GAAG,EAAE;QACD,aAAa,EAAE,OAAO;QACtB,QAAQ,EAAE,SAAS;KACtB;IACD,KAAK,EAAE;QACH,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,YAAY;KAC1B;IACD,EAAE,EAAE;QACA,OAAO,EAAE,YAAY;KACxB;IACD,EAAE,EAAE;QACA,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,MAAM;KACrB;IACD,CAAC,EAAE;QACC,cAAc,EAAE,WAAW;KAC9B;IACD,EAAE,wBAAO,YAAY,KAAE,kBAAkB,EAAE,MAAM,GAAE;CACtD,CAAC","sourcesContent":["import type { DefaultStyleMap } from 'roosterjs-content-model-types';\n\nconst blockElement: Partial<CSSStyleDeclaration> = {\n display: 'block',\n};\n\n/**\n * @internal\n */\nexport const defaultHTMLStyleMap: DefaultStyleMap = {\n address: blockElement,\n article: blockElement,\n aside: blockElement,\n b: {\n fontWeight: 'bold',\n },\n blockquote: {\n display: 'block',\n marginTop: '1em',\n marginBottom: '1em',\n marginLeft: '40px',\n marginRight: '40px',\n },\n br: blockElement,\n center: {\n display: 'block',\n textAlign: 'center',\n },\n dd: { display: 'block', marginInlineStart: '40px' },\n div: blockElement,\n dl: {\n display: 'block',\n marginTop: '1em',\n marginBottom: '1em',\n },\n dt: blockElement,\n del: {\n textDecoration: 'line-through',\n },\n em: {\n fontStyle: 'italic',\n },\n fieldset: blockElement,\n figcaption: blockElement,\n figure: blockElement,\n footer: blockElement,\n form: blockElement,\n h1: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '2em',\n },\n h2: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '1.5em',\n },\n h3: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '1.17em',\n },\n h4: {\n display: 'block',\n fontWeight: 'bold',\n },\n h5: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '0.83em',\n },\n h6: {\n display: 'block',\n fontWeight: 'bold',\n fontSize: '0.67em',\n },\n header: blockElement,\n hr: blockElement,\n i: {\n fontStyle: 'italic',\n },\n li: {\n display: 'list-item',\n },\n main: blockElement,\n nav: blockElement,\n ol: { ...blockElement, paddingInlineStart: '40px' },\n p: {\n display: 'block',\n marginTop: '1em',\n marginBottom: '1em',\n },\n pre: {\n display: 'block',\n fontFamily: 'monospace',\n whiteSpace: 'pre',\n marginTop: '1em',\n marginBottom: '1em',\n },\n s: {\n textDecoration: 'line-through',\n },\n section: blockElement,\n strike: {\n textDecoration: 'line-through',\n },\n strong: {\n fontWeight: 'bold',\n },\n sub: {\n verticalAlign: 'sub',\n fontSize: 'smaller',\n },\n sup: {\n verticalAlign: 'super',\n fontSize: 'smaller',\n },\n table: {\n display: 'table',\n boxSizing: 'border-box',\n },\n td: {\n display: 'table-cell',\n },\n th: {\n display: 'table-cell',\n fontWeight: 'bold',\n },\n u: {\n textDecoration: 'underline',\n },\n ul: { ...blockElement, paddingInlineStart: '40px' },\n};\n"]}
|
|
@@ -25,41 +25,35 @@ var DEFAULT_COLOR = '#000000';
|
|
|
25
25
|
*/
|
|
26
26
|
export var borderColorFormatHandler = {
|
|
27
27
|
parse: function (format, element, context) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
28
|
+
BorderKeys.forEach(function (key) {
|
|
29
|
+
var width = element.style.getPropertyValue(BorderWidthKeyMap[key]);
|
|
30
|
+
var style = element.style.getPropertyValue(BorderStyleKeyMap[key]);
|
|
31
|
+
var color = retrieveElementColor(element, key);
|
|
32
|
+
var borderColor = color == 'initial' ? DEFAULT_COLOR : color;
|
|
33
|
+
if (borderColor) {
|
|
34
|
+
var lightModeColor = getLightModeColor(borderColor, !!context.isDarkMode, context.darkColorHandler);
|
|
35
|
+
format[key] = combineBorderValue({
|
|
36
|
+
width: width,
|
|
37
|
+
style: style,
|
|
38
|
+
color: lightModeColor,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
45
42
|
},
|
|
46
43
|
apply: function (format, element, context) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
if (transformedColor) {
|
|
57
|
-
element.style.setProperty(borderColorProperty, transformedColor);
|
|
58
|
-
}
|
|
44
|
+
BorderKeys.forEach(function (key) {
|
|
45
|
+
var value = format[key];
|
|
46
|
+
if (value) {
|
|
47
|
+
var borderValues = extractBorderValues(value);
|
|
48
|
+
var borderColorProperty = BorderColorKeyMap[key];
|
|
49
|
+
if (borderValues.color) {
|
|
50
|
+
var transformedColor = adaptColor(element, borderValues.color, 'border', !!context.isDarkMode, context.darkColorHandler);
|
|
51
|
+
if (transformedColor) {
|
|
52
|
+
element.style.setProperty(borderColorProperty, transformedColor);
|
|
59
53
|
}
|
|
60
54
|
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
63
57
|
},
|
|
64
58
|
};
|
|
65
59
|
//# sourceMappingURL=borderColorFormatHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borderColorFormatHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/formatHandlers/common/borderColorFormatHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAI5F;;GAEG;AACH,IAAM,iBAAiB,GAEnB;IACA,SAAS,EAAE,kBAAkB;IAC7B,WAAW,EAAE,oBAAoB;IACjC,YAAY,EAAE,qBAAqB;IACnC,UAAU,EAAE,mBAAmB;CAClC,CAAC;AAEF;;GAEG;AACH,IAAM,iBAAiB,GAEnB;IACA,SAAS,EAAE,kBAAkB;IAC7B,WAAW,EAAE,oBAAoB;IACjC,YAAY,EAAE,qBAAqB;IACnC,UAAU,EAAE,mBAAmB;CAClC,CAAC;AAEF,IAAM,aAAa,GAAG,SAAS,CAAC;AAEhC;;GAEG;AACH,MAAM,CAAC,IAAM,wBAAwB,GAAgC;IACjE,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO,EAAE,OAAO;QAC5B,
|
|
1
|
+
{"version":3,"file":"borderColorFormatHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/formatHandlers/common/borderColorFormatHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EA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AK,EAAE,UAAC,MAAM,EAAE,OAAO,EAAE,OAAO;QAC5B,UAAU,CAAC,OAAO,CAAC,UAAA,GAAG;YAClB,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1B,IAAI,KAAK,EAAE;gBACP,IAAM,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBAChD,IAAM,mBAAmB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;gBACnD,IAAI,YAAY,CAAC,KAAK,EAAE;oBACpB,IAAM,gBAAgB,GAAG,UAAU,CAC/B,OAAO,EACP,YAAY,CAAC,KAAK,EAClB,QAAQ,EACR,CAAC,CAAC,OAAO,CAAC,UAAU,EACpB,OAAO,CAAC,gBAAgB,CAC3B,CAAC;oBACF,IAAI,gBAAgB,EAAE;wBAClB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;qBACpE;iBACJ;aACJ;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC","sourcesContent":["import { adaptColor, getLightModeColor, retrieveElementColor } from '../utils/color';\nimport { BorderColorKeyMap, BorderKeys } from '../utils/borderKeys';\nimport { combineBorderValue, extractBorderValues } from '../../domUtils/style/borderValues';\nimport type { BorderFormat, BorderKey } from 'roosterjs-content-model-types';\nimport type { FormatHandler } from '../FormatHandler';\n\n/**\n * Keys of border width\n */\nconst BorderWidthKeyMap: {\n [key in BorderKey]: string;\n} = {\n borderTop: 'border-top-width',\n borderRight: 'border-right-width',\n borderBottom: 'border-bottom-width',\n borderLeft: 'border-left-width',\n};\n\n/**\n * Keys of border styles\n */\nconst BorderStyleKeyMap: {\n [key in BorderKey]: string;\n} = {\n borderTop: 'border-top-style',\n borderRight: 'border-right-style',\n borderBottom: 'border-bottom-style',\n borderLeft: 'border-left-style',\n};\n\nconst DEFAULT_COLOR = '#000000';\n\n/**\n * @internal\n */\nexport const borderColorFormatHandler: FormatHandler<BorderFormat> = {\n parse: (format, element, context) => {\n BorderKeys.forEach(key => {\n const width = element.style.getPropertyValue(BorderWidthKeyMap[key]);\n const style = element.style.getPropertyValue(BorderStyleKeyMap[key]);\n const color = retrieveElementColor(element, key);\n const borderColor = color == 'initial' ? DEFAULT_COLOR : color;\n\n if (borderColor) {\n const lightModeColor = getLightModeColor(\n borderColor,\n !!context.isDarkMode,\n context.darkColorHandler\n );\n\n format[key] = combineBorderValue({\n width,\n style,\n color: lightModeColor,\n });\n }\n });\n },\n apply: (format, element, context) => {\n BorderKeys.forEach(key => {\n const value = format[key];\n if (value) {\n const borderValues = extractBorderValues(value);\n const borderColorProperty = BorderColorKeyMap[key];\n if (borderValues.color) {\n const transformedColor = adaptColor(\n element,\n borderValues.color,\n 'border',\n !!context.isDarkMode,\n context.darkColorHandler\n );\n if (transformedColor) {\n element.style.setProperty(borderColorProperty, transformedColor);\n }\n }\n }\n });\n },\n};\n"]}
|
package/lib-mjs/index.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ export { hasSelectionInSegment } from './modelApi/selection/hasSelectionInSegmen
|
|
|
95
95
|
export { hasSelectionInBlockGroup } from './modelApi/selection/hasSelectionInBlockGroup';
|
|
96
96
|
export { setSelection } from './modelApi/selection/setSelection';
|
|
97
97
|
export { cloneModel, cloneModelForPaste } from './modelApi/editing/cloneModel';
|
|
98
|
+
export { canMergeCells } from './modelApi/editing/canMergeCells';
|
|
98
99
|
export { mergeModel } from './modelApi/editing/mergeModel';
|
|
99
100
|
export { deleteSelection } from './modelApi/editing/deleteSelection';
|
|
100
101
|
export { deleteSegment } from './modelApi/editing/deleteSegment';
|
package/lib-mjs/index.js
CHANGED
|
@@ -95,6 +95,7 @@ export { hasSelectionInSegment } from './modelApi/selection/hasSelectionInSegmen
|
|
|
95
95
|
export { hasSelectionInBlockGroup } from './modelApi/selection/hasSelectionInBlockGroup';
|
|
96
96
|
export { setSelection } from './modelApi/selection/setSelection';
|
|
97
97
|
export { cloneModel, cloneModelForPaste } from './modelApi/editing/cloneModel';
|
|
98
|
+
export { canMergeCells } from './modelApi/editing/canMergeCells';
|
|
98
99
|
export { mergeModel } from './modelApi/editing/mergeModel';
|
|
99
100
|
export { deleteSelection } from './modelApi/editing/deleteSelection';
|
|
100
101
|
export { deleteSegment } from './modelApi/editing/deleteSegment';
|
package/lib-mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-dom/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EACH,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACnB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBA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,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AACpG,OAAO,EACH,cAAc,EACd,4BAA4B,EAC5B,6BAA6B,GAChC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EACH,uBAAuB,EACvB,oBAAoB,GACvB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EACH,kBAAkB,EAClB,eAAe,EACf,sBAAsB,GACzB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["export { domToContentModel } from './domToModel/domToContentModel';\nexport { contentModelToDom } from './modelToDom/contentModelToDom';\nexport { contentModelToText } from './modelToText/contentModelToText';\n\nexport {\n childProcessor,\n handleRegularSelection,\n processChildNode,\n} from './domToModel/processors/childProcessor';\nexport { entityProcessor } from './domToModel/processors/entityProcessor';\nexport { tableProcessor } from './domToModel/processors/tableProcessor';\nexport { formatContainerProcessor } from './domToModel/processors/formatContainerProcessor';\nexport { getRegularSelectionOffsets } from './domToModel/utils/getRegularSelectionOffsets';\nexport { parseFormat } from './domToModel/utils/parseFormat';\nexport { areSameFormats } from './domToModel/utils/areSameFormats';\nexport { isBlockElement } from './domToModel/utils/isBlockElement';\nexport { buildSelectionMarker } from './domToModel/utils/buildSelectionMarker';\n\nexport { updateMetadata, getMetadata, hasMetadata } from './modelApi/metadata/updateMetadata';\nexport { isNodeOfType } from './domUtils/isNodeOfType';\nexport { isElementOfType } from './domUtils/isElementOfType';\nexport { getObjectKeys } from './domUtils/getObjectKeys';\nexport { getSafeIdSelector } from './domUtils/getSafeIdSelector';\nexport { toArray } from './domUtils/toArray';\nexport { moveChildNodes, wrapAllChildNodes } from './domUtils/moveChildNodes';\nexport { wrap } from './domUtils/wrap';\nexport { unwrap } from './domUtils/unwrap';\nexport {\n isEntityElement,\n findClosestEntityWrapper,\n getAllEntityWrappers,\n parseEntityFormat,\n generateEntityClassNames,\n addDelimiters,\n isEntityDelimiter,\n isBlockEntityContainer,\n findClosestBlockEntityContainer,\n} from './domUtils/entityUtils';\nexport { reuseCachedElement } from './domUtils/reuseCachedElement';\nexport { isWhiteSpacePreserved } from './domUtils/isWhiteSpacePreserved';\nexport { normalizeRect } from './domUtils/normalizeRect';\nexport { scrollRectIntoView } from './domUtils/scrollRectIntoView';\n\nexport { setLinkUndeletable, isLinkUndeletable } from './domUtils/hiddenProperties/undeletableLink';\n\nexport { createBr } from './modelApi/creators/createBr';\nexport { createListItem } from './modelApi/creators/createListItem';\nexport { createFormatContainer } from './modelApi/creators/createFormatContainer';\nexport { createParagraph } from './modelApi/creators/createParagraph';\nexport { createSelectionMarker } from './modelApi/creators/createSelectionMarker';\nexport { createTable } from './modelApi/creators/createTable';\nexport { createTableCell } from './modelApi/creators/createTableCell';\nexport { createText } from './modelApi/creators/createText';\nexport { createImage } from './modelApi/creators/createImage';\nexport { createContentModelDocument } from './modelApi/creators/createContentModelDocument';\nexport { createParagraphDecorator } from './modelApi/creators/createParagraphDecorator';\nexport { createGeneralSegment } from './modelApi/creators/createGeneralSegment';\nexport { createGeneralBlock } from './modelApi/creators/createGeneralBlock';\nexport { createEntity } from './modelApi/creators/createEntity';\nexport { createDivider } from './modelApi/creators/createDivider';\nexport { createListLevel } from './modelApi/creators/createListLevel';\nexport { createEmptyModel } from './modelApi/creators/createEmptyModel';\nexport { createTableRow } from './modelApi/creators/createTableRow';\n\nexport { mutateBlock, mutateSegments, mutateSegment } from './modelApi/common/mutate';\nexport { addBlock } from './modelApi/common/addBlock';\nexport { addCode } from './modelApi/common/addDecorators';\nexport { addData } from './modelApi/common/addDecorators';\nexport { addLink } from './modelApi/common/addDecorators';\nexport { addTextSegment } from './modelApi/common/addTextSegment';\nexport { normalizeParagraph } from './modelApi/common/normalizeParagraph';\n\nexport { normalizeContentModel } from './modelApi/common/normalizeContentModel';\nexport { isGeneralSegment } from './modelApi/typeCheck/isGeneralSegment';\nexport { unwrapBlock } from './modelApi/common/unwrapBlock';\nexport { addSegment } from './modelApi/common/addSegment';\nexport { isEmpty } from './modelApi/common/isEmpty';\nexport { normalizeSingleSegment } from './modelApi/common/normalizeSegment';\nexport { mergeTextSegments } from './modelApi/common/mergeTextSegments';\nexport { normalizeSegmentFormat } from './modelApi/common/normalizeSegmentFormat';\n\nexport { setParagraphNotImplicit } from './modelApi/block/setParagraphNotImplicit';\nexport {\n copyFormat,\n ListFormats,\n ListFormatsToKeep,\n ListFormatsToMove,\n ParagraphFormats,\n} from './modelApi/block/copyFormat';\nexport { getOrderedListNumberStr } from './modelApi/list/getOrderedListNumberStr';\nexport { getAutoListStyleType } from './modelApi/list/getAutoListStyleType';\n\nexport { parseValueWithUnit } from './formatHandlers/utils/parseValueWithUnit';\nexport { BorderKeys } from './formatHandlers/utils/borderKeys';\nexport {\n DeprecatedColors,\n getColor,\n setColor,\n parseColor,\n defaultGenerateColorKey,\n} from './formatHandlers/utils/color';\n\nexport {\n createDomToModelContext,\n createDomToModelContextWithConfig,\n createDomToModelConfig,\n} from './domToModel/context/createDomToModelContext';\nexport {\n createModelToDomContext,\n createModelToDomContextWithConfig,\n createModelToDomConfig,\n} from './modelToDom/context/createModelToDomContext';\n\nexport { isBold } from './domUtils/style/isBold';\nexport { getSelectionRootNode } from './domUtils/selection/getSelectionRootNode';\nexport { getDOMInsertPointRect } from './domUtils/selection/getDOMInsertPointRect';\nexport { trimModelForSelection } from './domUtils/selection/trimModelForSelection';\nexport { isCharacterValue, isModifierKey, isCursorMovingKey } from './domUtils/event/eventUtils';\nexport { getNodePositionFromEvent } from './domUtils/event/getNodePositionFromEvent';\nexport { combineBorderValue, extractBorderValues } from './domUtils/style/borderValues';\nexport { isPunctuation, isSpace, normalizeText } from './domUtils/stringUtil';\nexport { parseTableCells } from './domUtils/table/parseTableCells';\nexport { readFile } from './domUtils/readFile';\nexport { retrieveDocumentMetadata } from './domUtils/retrieveDocumentMetadata';\nexport { transformColor, TransformColorOptions } from './domUtils/style/transformColor';\nexport { normalizeFontFamily } from './domUtils/style/normalizeFontFamily';\nexport { extractClipboardItems } from './domUtils/event/extractClipboardItems';\nexport { createPasteFragment } from './domUtils/event/createPasteFragment';\nexport { cacheGetEventData } from './domUtils/event/cacheGetEventData';\nexport {\n setParagraphMarker,\n getParagraphMarker,\n} from './domUtils/hiddenProperties/paragraphMarker';\nexport { setImageState, getImageState } from './domUtils/hiddenProperties/imageState';\nexport { getRangesByText } from './domUtils/getRangesByText';\n\nexport { isBlockGroupOfType } from './modelApi/typeCheck/isBlockGroupOfType';\n\nexport { iterateSelections } from './modelApi/selection/iterateSelections';\nexport {\n getFirstSelectedListItem,\n getFirstSelectedTable,\n getOperationalBlocks,\n getSelectedParagraphs,\n getSelectedSegments,\n getSelectedSegmentsAndParagraphs,\n} from './modelApi/selection/collectSelections';\nexport { getSelectedCells } from './modelApi/selection/getSelectedCells';\nexport { hasSelectionInBlock } from './modelApi/selection/hasSelectionInBlock';\nexport { hasSelectionInSegment } from './modelApi/selection/hasSelectionInSegment';\nexport { hasSelectionInBlockGroup } from './modelApi/selection/hasSelectionInBlockGroup';\nexport { setSelection } from './modelApi/selection/setSelection';\n\nexport { cloneModel, cloneModelForPaste } from './modelApi/editing/cloneModel';\nexport { mergeModel } from './modelApi/editing/mergeModel';\nexport { deleteSelection } from './modelApi/editing/deleteSelection';\nexport { deleteSegment } from './modelApi/editing/deleteSegment';\nexport { deleteBlock } from './modelApi/editing/deleteBlock';\nexport { applyTableFormat, setFirstColumnFormatBorders } from './modelApi/editing/applyTableFormat';\nexport {\n normalizeTable,\n MIN_ALLOWED_TABLE_CELL_WIDTH,\n MIN_ALLOWED_TABLE_CELL_HEIGHT,\n} from './modelApi/editing/normalizeTable';\nexport { setTableCellBackgroundColor } from './modelApi/editing/setTableCellBackgroundColor';\nexport { retrieveModelFormatState } from './modelApi/editing/retrieveModelFormatState';\nexport { getListStyleTypeFromString } from './modelApi/editing/getListStyleTypeFromString';\nexport { getSegmentTextFormat } from './modelApi/editing/getSegmentTextFormat';\nexport { getClosestAncestorBlockGroupIndex } from './modelApi/editing/getClosestAncestorBlockGroupIndex';\nexport { runEditSteps } from './modelApi/editing/runEditSteps';\n\nexport { updateImageMetadata, getImageMetadata } from './modelApi/metadata/updateImageMetadata';\nexport {\n updateTableCellMetadata,\n getTableCellMetadata,\n} from './modelApi/metadata/updateTableCellMetadata';\nexport { updateTableMetadata, getTableMetadata } from './modelApi/metadata/updateTableMetadata';\nexport {\n updateListMetadata,\n getListMetadata,\n ListMetadataDefinition,\n} from './modelApi/metadata/updateListMetadata';\n\nexport { ChangeSource } from './constants/ChangeSource';\nexport { BulletListType } from './constants/BulletListType';\nexport { NumberingListType } from './constants/NumberingListType';\nexport { TableBorderFormat } from './constants/TableBorderFormat';\nexport { OrderedListStyleMap } from './constants/OrderedListStyleMap';\nexport { UnorderedListStyleMap } from './constants/UnorderedListStyleMap';\nexport { EmptySegmentFormat } from './constants/EmptySegmentFormat';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-dom/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EACH,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACnB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EA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,EACH,cAAc,EACd,4BAA4B,EAC5B,6BAA6B,GAChC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EACH,uBAAuB,EACvB,oBAAoB,GACvB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EACH,kBAAkB,EAClB,eAAe,EACf,sBAAsB,GACzB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["export { domToContentModel } from './domToModel/domToContentModel';\nexport { contentModelToDom } from './modelToDom/contentModelToDom';\nexport { contentModelToText } from './modelToText/contentModelToText';\n\nexport {\n childProcessor,\n handleRegularSelection,\n processChildNode,\n} from './domToModel/processors/childProcessor';\nexport { entityProcessor } from './domToModel/processors/entityProcessor';\nexport { tableProcessor } from './domToModel/processors/tableProcessor';\nexport { formatContainerProcessor } from './domToModel/processors/formatContainerProcessor';\nexport { getRegularSelectionOffsets } from './domToModel/utils/getRegularSelectionOffsets';\nexport { parseFormat } from './domToModel/utils/parseFormat';\nexport { areSameFormats } from './domToModel/utils/areSameFormats';\nexport { isBlockElement } from './domToModel/utils/isBlockElement';\nexport { buildSelectionMarker } from './domToModel/utils/buildSelectionMarker';\n\nexport { updateMetadata, getMetadata, hasMetadata } from './modelApi/metadata/updateMetadata';\nexport { isNodeOfType } from './domUtils/isNodeOfType';\nexport { isElementOfType } from './domUtils/isElementOfType';\nexport { getObjectKeys } from './domUtils/getObjectKeys';\nexport { getSafeIdSelector } from './domUtils/getSafeIdSelector';\nexport { toArray } from './domUtils/toArray';\nexport { moveChildNodes, wrapAllChildNodes } from './domUtils/moveChildNodes';\nexport { wrap } from './domUtils/wrap';\nexport { unwrap } from './domUtils/unwrap';\nexport {\n isEntityElement,\n findClosestEntityWrapper,\n getAllEntityWrappers,\n parseEntityFormat,\n generateEntityClassNames,\n addDelimiters,\n isEntityDelimiter,\n isBlockEntityContainer,\n findClosestBlockEntityContainer,\n} from './domUtils/entityUtils';\nexport { reuseCachedElement } from './domUtils/reuseCachedElement';\nexport { isWhiteSpacePreserved } from './domUtils/isWhiteSpacePreserved';\nexport { normalizeRect } from './domUtils/normalizeRect';\nexport { scrollRectIntoView } from './domUtils/scrollRectIntoView';\n\nexport { setLinkUndeletable, isLinkUndeletable } from './domUtils/hiddenProperties/undeletableLink';\n\nexport { createBr } from './modelApi/creators/createBr';\nexport { createListItem } from './modelApi/creators/createListItem';\nexport { createFormatContainer } from './modelApi/creators/createFormatContainer';\nexport { createParagraph } from './modelApi/creators/createParagraph';\nexport { createSelectionMarker } from './modelApi/creators/createSelectionMarker';\nexport { createTable } from './modelApi/creators/createTable';\nexport { createTableCell } from './modelApi/creators/createTableCell';\nexport { createText } from './modelApi/creators/createText';\nexport { createImage } from './modelApi/creators/createImage';\nexport { createContentModelDocument } from './modelApi/creators/createContentModelDocument';\nexport { createParagraphDecorator } from './modelApi/creators/createParagraphDecorator';\nexport { createGeneralSegment } from './modelApi/creators/createGeneralSegment';\nexport { createGeneralBlock } from './modelApi/creators/createGeneralBlock';\nexport { createEntity } from './modelApi/creators/createEntity';\nexport { createDivider } from './modelApi/creators/createDivider';\nexport { createListLevel } from './modelApi/creators/createListLevel';\nexport { createEmptyModel } from './modelApi/creators/createEmptyModel';\nexport { createTableRow } from './modelApi/creators/createTableRow';\n\nexport { mutateBlock, mutateSegments, mutateSegment } from './modelApi/common/mutate';\nexport { addBlock } from './modelApi/common/addBlock';\nexport { addCode } from './modelApi/common/addDecorators';\nexport { addData } from './modelApi/common/addDecorators';\nexport { addLink } from './modelApi/common/addDecorators';\nexport { addTextSegment } from './modelApi/common/addTextSegment';\nexport { normalizeParagraph } from './modelApi/common/normalizeParagraph';\n\nexport { normalizeContentModel } from './modelApi/common/normalizeContentModel';\nexport { isGeneralSegment } from './modelApi/typeCheck/isGeneralSegment';\nexport { unwrapBlock } from './modelApi/common/unwrapBlock';\nexport { addSegment } from './modelApi/common/addSegment';\nexport { isEmpty } from './modelApi/common/isEmpty';\nexport { normalizeSingleSegment } from './modelApi/common/normalizeSegment';\nexport { mergeTextSegments } from './modelApi/common/mergeTextSegments';\nexport { normalizeSegmentFormat } from './modelApi/common/normalizeSegmentFormat';\n\nexport { setParagraphNotImplicit } from './modelApi/block/setParagraphNotImplicit';\nexport {\n copyFormat,\n ListFormats,\n ListFormatsToKeep,\n ListFormatsToMove,\n ParagraphFormats,\n} from './modelApi/block/copyFormat';\nexport { getOrderedListNumberStr } from './modelApi/list/getOrderedListNumberStr';\nexport { getAutoListStyleType } from './modelApi/list/getAutoListStyleType';\n\nexport { parseValueWithUnit } from './formatHandlers/utils/parseValueWithUnit';\nexport { BorderKeys } from './formatHandlers/utils/borderKeys';\nexport {\n DeprecatedColors,\n getColor,\n setColor,\n parseColor,\n defaultGenerateColorKey,\n} from './formatHandlers/utils/color';\n\nexport {\n createDomToModelContext,\n createDomToModelContextWithConfig,\n createDomToModelConfig,\n} from './domToModel/context/createDomToModelContext';\nexport {\n createModelToDomContext,\n createModelToDomContextWithConfig,\n createModelToDomConfig,\n} from './modelToDom/context/createModelToDomContext';\n\nexport { isBold } from './domUtils/style/isBold';\nexport { getSelectionRootNode } from './domUtils/selection/getSelectionRootNode';\nexport { getDOMInsertPointRect } from './domUtils/selection/getDOMInsertPointRect';\nexport { trimModelForSelection } from './domUtils/selection/trimModelForSelection';\nexport { isCharacterValue, isModifierKey, isCursorMovingKey } from './domUtils/event/eventUtils';\nexport { getNodePositionFromEvent } from './domUtils/event/getNodePositionFromEvent';\nexport { combineBorderValue, extractBorderValues } from './domUtils/style/borderValues';\nexport { isPunctuation, isSpace, normalizeText } from './domUtils/stringUtil';\nexport { parseTableCells } from './domUtils/table/parseTableCells';\nexport { readFile } from './domUtils/readFile';\nexport { retrieveDocumentMetadata } from './domUtils/retrieveDocumentMetadata';\nexport { transformColor, TransformColorOptions } from './domUtils/style/transformColor';\nexport { normalizeFontFamily } from './domUtils/style/normalizeFontFamily';\nexport { extractClipboardItems } from './domUtils/event/extractClipboardItems';\nexport { createPasteFragment } from './domUtils/event/createPasteFragment';\nexport { cacheGetEventData } from './domUtils/event/cacheGetEventData';\nexport {\n setParagraphMarker,\n getParagraphMarker,\n} from './domUtils/hiddenProperties/paragraphMarker';\nexport { setImageState, getImageState } from './domUtils/hiddenProperties/imageState';\nexport { getRangesByText } from './domUtils/getRangesByText';\n\nexport { isBlockGroupOfType } from './modelApi/typeCheck/isBlockGroupOfType';\n\nexport { iterateSelections } from './modelApi/selection/iterateSelections';\nexport {\n getFirstSelectedListItem,\n getFirstSelectedTable,\n getOperationalBlocks,\n getSelectedParagraphs,\n getSelectedSegments,\n getSelectedSegmentsAndParagraphs,\n} from './modelApi/selection/collectSelections';\nexport { getSelectedCells } from './modelApi/selection/getSelectedCells';\nexport { hasSelectionInBlock } from './modelApi/selection/hasSelectionInBlock';\nexport { hasSelectionInSegment } from './modelApi/selection/hasSelectionInSegment';\nexport { hasSelectionInBlockGroup } from './modelApi/selection/hasSelectionInBlockGroup';\nexport { setSelection } from './modelApi/selection/setSelection';\n\nexport { cloneModel, cloneModelForPaste } from './modelApi/editing/cloneModel';\nexport { canMergeCells } from './modelApi/editing/canMergeCells';\nexport { mergeModel } from './modelApi/editing/mergeModel';\nexport { deleteSelection } from './modelApi/editing/deleteSelection';\nexport { deleteSegment } from './modelApi/editing/deleteSegment';\nexport { deleteBlock } from './modelApi/editing/deleteBlock';\nexport { applyTableFormat, setFirstColumnFormatBorders } from './modelApi/editing/applyTableFormat';\nexport {\n normalizeTable,\n MIN_ALLOWED_TABLE_CELL_WIDTH,\n MIN_ALLOWED_TABLE_CELL_HEIGHT,\n} from './modelApi/editing/normalizeTable';\nexport { setTableCellBackgroundColor } from './modelApi/editing/setTableCellBackgroundColor';\nexport { retrieveModelFormatState } from './modelApi/editing/retrieveModelFormatState';\nexport { getListStyleTypeFromString } from './modelApi/editing/getListStyleTypeFromString';\nexport { getSegmentTextFormat } from './modelApi/editing/getSegmentTextFormat';\nexport { getClosestAncestorBlockGroupIndex } from './modelApi/editing/getClosestAncestorBlockGroupIndex';\nexport { runEditSteps } from './modelApi/editing/runEditSteps';\n\nexport { updateImageMetadata, getImageMetadata } from './modelApi/metadata/updateImageMetadata';\nexport {\n updateTableCellMetadata,\n getTableCellMetadata,\n} from './modelApi/metadata/updateTableCellMetadata';\nexport { updateTableMetadata, getTableMetadata } from './modelApi/metadata/updateTableMetadata';\nexport {\n updateListMetadata,\n getListMetadata,\n ListMetadataDefinition,\n} from './modelApi/metadata/updateListMetadata';\n\nexport { ChangeSource } from './constants/ChangeSource';\nexport { BulletListType } from './constants/BulletListType';\nexport { NumberingListType } from './constants/NumberingListType';\nexport { TableBorderFormat } from './constants/TableBorderFormat';\nexport { OrderedListStyleMap } from './constants/OrderedListStyleMap';\nexport { UnorderedListStyleMap } from './constants/UnorderedListStyleMap';\nexport { EmptySegmentFormat } from './constants/EmptySegmentFormat';\n"]}
|