roosterjs-content-model-dom 9.60.0 → 9.62.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.
Files changed (55) hide show
  1. package/lib/constants/EmptySegmentFormat.js +1 -0
  2. package/lib/constants/EmptySegmentFormat.js.map +1 -1
  3. package/lib/domUtils/isUnsafeUrl.d.ts +10 -0
  4. package/lib/domUtils/isUnsafeUrl.js +32 -0
  5. package/lib/domUtils/isUnsafeUrl.js.map +1 -0
  6. package/lib/formatHandlers/segment/boldFormatHandler.js +2 -1
  7. package/lib/formatHandlers/segment/boldFormatHandler.js.map +1 -1
  8. package/lib/formatHandlers/segment/linkFormatHandler.js +3 -2
  9. package/lib/formatHandlers/segment/linkFormatHandler.js.map +1 -1
  10. package/lib/formatHandlers/segment/superOrSubScriptFormatHandler.js +10 -2
  11. package/lib/formatHandlers/segment/superOrSubScriptFormatHandler.js.map +1 -1
  12. package/lib/index.d.ts +1 -0
  13. package/lib/index.js +6 -4
  14. package/lib/index.js.map +1 -1
  15. package/lib/modelApi/common/stripInvisibleUnicode.js +2 -2
  16. package/lib/modelApi/common/stripInvisibleUnicode.js.map +1 -1
  17. package/lib/modelApi/editing/mergeModel.js +20 -12
  18. package/lib/modelApi/editing/mergeModel.js.map +1 -1
  19. package/lib-amd/constants/EmptySegmentFormat.js +1 -0
  20. package/lib-amd/constants/EmptySegmentFormat.js.map +1 -1
  21. package/lib-amd/domUtils/isUnsafeUrl.d.ts +10 -0
  22. package/lib-amd/domUtils/isUnsafeUrl.js +34 -0
  23. package/lib-amd/domUtils/isUnsafeUrl.js.map +1 -0
  24. package/lib-amd/formatHandlers/segment/boldFormatHandler.js +2 -2
  25. package/lib-amd/formatHandlers/segment/boldFormatHandler.js.map +1 -1
  26. package/lib-amd/formatHandlers/segment/linkFormatHandler.js +3 -3
  27. package/lib-amd/formatHandlers/segment/linkFormatHandler.js.map +1 -1
  28. package/lib-amd/formatHandlers/segment/superOrSubScriptFormatHandler.js +10 -2
  29. package/lib-amd/formatHandlers/segment/superOrSubScriptFormatHandler.js.map +1 -1
  30. package/lib-amd/index.d.ts +1 -0
  31. package/lib-amd/index.js +3 -2
  32. package/lib-amd/index.js.map +1 -1
  33. package/lib-amd/modelApi/common/stripInvisibleUnicode.js +2 -2
  34. package/lib-amd/modelApi/common/stripInvisibleUnicode.js.map +1 -1
  35. package/lib-amd/modelApi/editing/mergeModel.js +20 -12
  36. package/lib-amd/modelApi/editing/mergeModel.js.map +1 -1
  37. package/lib-mjs/constants/EmptySegmentFormat.js +1 -0
  38. package/lib-mjs/constants/EmptySegmentFormat.js.map +1 -1
  39. package/lib-mjs/domUtils/isUnsafeUrl.d.ts +10 -0
  40. package/lib-mjs/domUtils/isUnsafeUrl.js +28 -0
  41. package/lib-mjs/domUtils/isUnsafeUrl.js.map +1 -0
  42. package/lib-mjs/formatHandlers/segment/boldFormatHandler.js +2 -1
  43. package/lib-mjs/formatHandlers/segment/boldFormatHandler.js.map +1 -1
  44. package/lib-mjs/formatHandlers/segment/linkFormatHandler.js +3 -2
  45. package/lib-mjs/formatHandlers/segment/linkFormatHandler.js.map +1 -1
  46. package/lib-mjs/formatHandlers/segment/superOrSubScriptFormatHandler.js +10 -2
  47. package/lib-mjs/formatHandlers/segment/superOrSubScriptFormatHandler.js.map +1 -1
  48. package/lib-mjs/index.d.ts +1 -0
  49. package/lib-mjs/index.js +1 -0
  50. package/lib-mjs/index.js.map +1 -1
  51. package/lib-mjs/modelApi/common/stripInvisibleUnicode.js +2 -2
  52. package/lib-mjs/modelApi/common/stripInvisibleUnicode.js.map +1 -1
  53. package/lib-mjs/modelApi/editing/mergeModel.js +20 -12
  54. package/lib-mjs/modelApi/editing/mergeModel.js.map +1 -1
  55. 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":";;;;AAAA,+CAA8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;YAC5C,kBAAkB,EAAE,CAAC;SACxB;KACJ;IAED,OAAO,cAAc,CAAC;AAC1B,CAAC;AAED,SAAS,iBAAiB,CACtB,KAAgC,EAChC,aAAqB,EACrB,MAAc,EACd,QAAgB;;IAEhB,IAAI,MAAM,KAAK,CAAC,EAAE;QACd,OAAO,aAAa,CAAC;KACxB;IAED,IAAI,cAAc,GAAG,aAAa,CAAC;IACnC,IAAI,iBAAiB,GAAG,MAAM,CAAC;IAE/B,OAAO,iBAAiB,GAAG,CAAC,EAAE;QAC1B,cAAc,EAAE,CAAC;QAEjB,IAAI,cAAc,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;YACrC,iBAAiB,EAAE,CAAC;SACvB;aAAM,IAAI,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,0CAAE,KAAK,CAAC,QAAQ,CAAC,0CAAE,SAAS,CAAA,EAAE;YAChE,iBAAiB,EAAE,CAAC;SACvB;KACJ;IAED,OAAO,cAAc,CAAC;AAC1B,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
+ {"version":3,"file":"mergeModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/mergeModel.ts"],"names":[],"mappings":";;;;AAAA,+CAA8C;AAC9C,mDAAkD;AAClD,uDAAsD;AACtD,iDAAgD;AAChD,6DAA4D;AAC5D,+DAA8D;AAC9D,2EAA0E;AAC1E,+DAA8D;AAC9D,qDAAoD;AACpD,yEAAwE;AACxE,yFAAwF;AACxF,+DAA8D;AAC9D,2CAA+C;AAC/C,yEA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C;IAED,IAAI,MAAM,KAAK,CAAC,EAAE;QACd,OAAO,aAAa,CAAC;KACxB;IAED,IAAI,cAAc,GAAG,aAAa,CAAC;IACnC,IAAI,kBAAkB,GAAG,MAAM,CAAC;IAEhC,OAAO,kBAAkB,GAAG,CAAC,EAAE;QAC3B,cAAc,EAAE,CAAC;QAEjB,IAAI,cAAc,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE;YACpC,kBAAkB,EAAE,CAAC;SACxB;aAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;YAC5C,kBAAkB,EAAE,CAAC;SACxB;KACJ;IAED,OAAO,cAAc,CAAC;AAC1B,CAAC;AAED,SAAS,iBAAiB,CACtB,KAAgC,EAChC,aAAqB,EACrB,MAAc,EACd,QAAgB;;IAEhB,IAAI,MAAM,KAAK,CAAC,EAAE;QACd,OAAO,aAAa,CAAC;KACxB;IAED,IAAI,cAAc,GAAG,aAAa,CAAC;IACnC,IAAI,iBAAiB,GAAG,MAAM,CAAC;IAE/B,OAAO,iBAAiB,GAAG,CAAC,EAAE;QAC1B,cAAc,EAAE,CAAC;QAEjB,IAAI,cAAc,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;YACrC,iBAAiB,EAAE,CAAC;SACvB;aAAM,IAAI,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,0CAAE,KAAK,CAAC,QAAQ,CAAC,0CAAE,SAAS,CAAA,EAAE;YAChE,iBAAiB,EAAE,CAAC;SACvB;KACJ;IAED,OAAO,cAAc,CAAC;AAC1B,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 ...(options?.preserveParagraphDecorator\n ? {\n ...insertPosition.paragraph.decorator?.format,\n ...insertPosition.paragraph.segmentFormat,\n }\n : undefined),\n ...insertPosition.marker.format,\n };\n\n applyDefaultFormat(source, newFormat, mergeFormat, options?.preserveParagraphDecorator);\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 preserveParagraphDecorator?: boolean\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(\n block,\n format,\n applyDefaultFormatOption,\n preserveParagraphDecorator\n );\n break;\n\n case 'Table':\n block.rows.forEach(row =>\n row.cells.forEach(cell => {\n applyDefaultFormat(\n cell,\n format,\n applyDefaultFormatOption,\n preserveParagraphDecorator\n );\n })\n );\n break;\n\n case 'Paragraph':\n const paragraphFormat = block.decorator?.format || {};\n const paragraph = mutateBlock(block);\n const paragraphTargetFormat =\n applyDefaultFormatOption === 'keepSourceEmphasisFormat' &&\n preserveParagraphDecorator\n ? { ...format, ...paragraphFormat }\n : format;\n\n paragraph.segments.forEach(segment => {\n if (segment.segmentType == 'General') {\n applyDefaultFormat(\n segment,\n format,\n applyDefaultFormatOption,\n preserveParagraphDecorator\n );\n }\n\n segment.format = mergeSegmentFormat(\n applyDefaultFormatOption,\n paragraphTargetFormat,\n {\n ...paragraphFormat,\n ...segment.format,\n }\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 (\n applyDefaultFormatOption === 'keepSourceEmphasisFormat' &&\n !preserveParagraphDecorator\n ) {\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, strikethrough } = 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 if (strikethrough) {\n result.strikethrough = strikethrough;\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"]}
@@ -14,6 +14,7 @@ define(["require", "exports"], function (require, exports) {
14
14
  letterSpacing: '',
15
15
  lineHeight: '',
16
16
  strikethrough: false,
17
+ superOrSubScriptFontSize: '',
17
18
  superOrSubScriptSequence: '',
18
19
  textColor: '',
19
20
  underline: false,
@@ -1 +1 @@
1
- {"version":3,"file":"EmptySegmentFormat.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-dom/lib/constants/EmptySegmentFormat.ts"],"names":[],"mappings":";;;;IAEA;;OAEG;IACU,QAAA,kBAAkB,GAAkD;QAC7E,eAAe,EAAE,EAAE;QACnB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,KAAK;QACpB,wBAAwB,EAAE,EAAE;QAC5B,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,KAAK;KACnB,CAAC","sourcesContent":["import type { ContentModelSegmentFormat } from 'roosterjs-content-model-types';\n\n/**\n * Provide a default empty instance of segment format with all its properties\n */\nexport const EmptySegmentFormat: Readonly<Required<ContentModelSegmentFormat>> = {\n backgroundColor: '',\n fontFamily: '',\n fontSize: '',\n fontWeight: '',\n italic: false,\n letterSpacing: '',\n lineHeight: '',\n strikethrough: false,\n superOrSubScriptSequence: '',\n textColor: '',\n underline: false,\n};\n"]}
1
+ {"version":3,"file":"EmptySegmentFormat.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-dom/lib/constants/EmptySegmentFormat.ts"],"names":[],"mappings":";;;;IAEA;;OAEG;IACU,QAAA,kBAAkB,GAAkD;QAC7E,eAAe,EAAE,EAAE;QACnB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,KAAK;QACpB,wBAAwB,EAAE,EAAE;QAC5B,wBAAwB,EAAE,EAAE;QAC5B,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,KAAK;KACnB,CAAC","sourcesContent":["import type { ContentModelSegmentFormat } from 'roosterjs-content-model-types';\n\n/**\n * Provide a default empty instance of segment format with all its properties\n */\nexport const EmptySegmentFormat: Readonly<Required<ContentModelSegmentFormat>> = {\n backgroundColor: '',\n fontFamily: '',\n fontSize: '',\n fontWeight: '',\n italic: false,\n letterSpacing: '',\n lineHeight: '',\n strikethrough: false,\n superOrSubScriptFontSize: '',\n superOrSubScriptSequence: '',\n textColor: '',\n underline: false,\n};\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Check whether the given URL uses a protocol that can execute script, such as "javascript:"
3
+ * @param url The URL to check
4
+ * @returns True if the URL can execute script when navigated to, otherwise false
5
+ * @remarks Browsers remove every TAB, LF and CR character from a URL and ignore any leading control
6
+ * character or space before they resolve its protocol. Those characters must be removed before the
7
+ * protocol is checked here, otherwise a value such as "java&#9;script:" or "javascr&#13;ipt:" would
8
+ * be treated as safe but still executed by the browser.
9
+ */
10
+ export declare function isUnsafeUrl(url: string | null | undefined): boolean;
@@ -0,0 +1,34 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isUnsafeUrl = void 0;
5
+ var UnsafeProtocols = ['javascript', 'vbscript', 'livescript', 'jscript', 'mocha', 'script'];
6
+ var IgnoredCharacters = /[\t\n\r]/g;
7
+ var MaxControlCharCode = 0x20;
8
+ /**
9
+ * Check whether the given URL uses a protocol that can execute script, such as "javascript:"
10
+ * @param url The URL to check
11
+ * @returns True if the URL can execute script when navigated to, otherwise false
12
+ * @remarks Browsers remove every TAB, LF and CR character from a URL and ignore any leading control
13
+ * character or space before they resolve its protocol. Those characters must be removed before the
14
+ * protocol is checked here, otherwise a value such as "java&#9;script:" or "javascr&#13;ipt:" would
15
+ * be treated as safe but still executed by the browser.
16
+ */
17
+ function isUnsafeUrl(url) {
18
+ if (!url) {
19
+ return false;
20
+ }
21
+ var normalizedUrl = trimControlCharacters(url.replace(IgnoredCharacters, '')).toLowerCase();
22
+ var colonIndex = normalizedUrl.indexOf(':');
23
+ return colonIndex >= 0 && UnsafeProtocols.indexOf(normalizedUrl.substring(0, colonIndex)) >= 0;
24
+ }
25
+ exports.isUnsafeUrl = isUnsafeUrl;
26
+ function trimControlCharacters(url) {
27
+ var start = 0;
28
+ while (start < url.length && url.charCodeAt(start) <= MaxControlCharCode) {
29
+ start++;
30
+ }
31
+ return url.substring(start);
32
+ }
33
+ });
34
+ //# sourceMappingURL=isUnsafeUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isUnsafeUrl.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-dom/lib/domUtils/isUnsafeUrl.ts"],"names":[],"mappings":";;;;IAAA,IAAM,eAAe,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC/F,IAAM,iBAAiB,GAAG,WAAW,CAAC;IACtC,IAAM,kBAAkB,GAAG,IAAI,CAAC;IAEhC;;;;;;;;OAQG;IACH,SAAgB,WAAW,CAAC,GAA8B;QACtD,IAAI,CAAC,GAAG,EAAE;YACN,OAAO,KAAK,CAAC;SAChB;QAED,IAAM,aAAa,GAAG,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9F,IAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAE9C,OAAO,UAAU,IAAI,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IACnG,CAAC;IATD,kCASC;IAED,SAAS,qBAAqB,CAAC,GAAW;QACtC,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,OAAO,KAAK,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,kBAAkB,EAAE;YACtE,KAAK,EAAE,CAAC;SACX;QAED,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC","sourcesContent":["const UnsafeProtocols = ['javascript', 'vbscript', 'livescript', 'jscript', 'mocha', 'script'];\nconst IgnoredCharacters = /[\\t\\n\\r]/g;\nconst MaxControlCharCode = 0x20;\n\n/**\n * Check whether the given URL uses a protocol that can execute script, such as \"javascript:\"\n * @param url The URL to check\n * @returns True if the URL can execute script when navigated to, otherwise false\n * @remarks Browsers remove every TAB, LF and CR character from a URL and ignore any leading control\n * character or space before they resolve its protocol. Those characters must be removed before the\n * protocol is checked here, otherwise a value such as \"java&#9;script:\" or \"javascr&#13;ipt:\" would\n * be treated as safe but still executed by the browser.\n */\nexport function isUnsafeUrl(url: string | null | undefined): boolean {\n if (!url) {\n return false;\n }\n\n const normalizedUrl = trimControlCharacters(url.replace(IgnoredCharacters, '')).toLowerCase();\n const colonIndex = normalizedUrl.indexOf(':');\n\n return colonIndex >= 0 && UnsafeProtocols.indexOf(normalizedUrl.substring(0, colonIndex)) >= 0;\n}\n\nfunction trimControlCharacters(url: string): string {\n let start = 0;\n\n while (start < url.length && url.charCodeAt(start) <= MaxControlCharCode) {\n start++;\n }\n\n return url.substring(start);\n}\n"]}
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "../utils/shouldSetValue", "../../domUtils/moveChildNodes"], function (require, exports, shouldSetValue_1, moveChildNodes_1) {
1
+ define(["require", "exports", "../../domToModel/utils/isBlockElement", "../utils/shouldSetValue", "../../domUtils/moveChildNodes"], function (require, exports, isBlockElement_1, shouldSetValue_1, moveChildNodes_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.boldFormatHandler = void 0;
@@ -19,7 +19,7 @@ define(["require", "exports", "../utils/shouldSetValue", "../../domUtils/moveChi
19
19
  var blockFontWeight = context.implicitFormat.fontWeight;
20
20
  if ((blockFontWeight && blockFontWeight != format.fontWeight) ||
21
21
  (!blockFontWeight && format.fontWeight && format.fontWeight != 'normal')) {
22
- if (format.fontWeight == 'bold') {
22
+ if (format.fontWeight == 'bold' && !(0, isBlockElement_1.isBlockElement)(element)) {
23
23
  (0, moveChildNodes_1.wrapAllChildNodes)(element, 'b');
24
24
  }
25
25
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"boldFormatHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/formatHandlers/segment/boldFormatHandler.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACU,QAAA,iBAAiB,GAA8B;QACxD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY;YAC1C,IAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,YAAY,CAAC,UAAU,CAAC;YAEvE,IAAI,IAAA,+BAAc,EAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,UAAU,CAAC,EAAE;gBAC/E,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;aAClC;QACL,CAAC;QACD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO,EAAE,OAAO;YAC5B,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,WAAW,EAAE;gBAC1C,OAAO;aACV;YAED,IAAM,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC;YAE1D,IACI,CAAC,eAAe,IAAI,eAAe,IAAI,MAAM,CAAC,UAAU,CAAC;gBACzD,CAAC,CAAC,eAAe,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,EAC1E;gBACE,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,EAAE;oBAC7B,IAAA,kCAAiB,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;iBACnC;qBAAM;oBACH,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC;iBAC5D;aACJ;QACL,CAAC;KACJ,CAAC","sourcesContent":["import { shouldSetValue } from '../utils/shouldSetValue';\nimport { wrapAllChildNodes } from '../../domUtils/moveChildNodes';\nimport type { BoldFormat } from 'roosterjs-content-model-types';\nimport type { FormatHandler } from '../FormatHandler';\n\n/**\n * @internal\n */\nexport const boldFormatHandler: FormatHandler<BoldFormat> = {\n parse: (format, element, context, defaultStyle) => {\n const fontWeight = element.style.fontWeight || defaultStyle.fontWeight;\n\n if (shouldSetValue(fontWeight, '400', format.fontWeight, defaultStyle.fontWeight)) {\n format.fontWeight = fontWeight;\n }\n },\n apply: (format, element, context) => {\n if (typeof format.fontWeight === 'undefined') {\n return;\n }\n\n const blockFontWeight = context.implicitFormat.fontWeight;\n\n if (\n (blockFontWeight && blockFontWeight != format.fontWeight) ||\n (!blockFontWeight && format.fontWeight && format.fontWeight != 'normal')\n ) {\n if (format.fontWeight == 'bold') {\n wrapAllChildNodes(element, 'b');\n } else {\n element.style.fontWeight = format.fontWeight || 'normal';\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"boldFormatHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/formatHandlers/segment/boldFormatHandler.ts"],"names":[],"mappings":";;;;IAMA;;OAEG;IACU,QAAA,iBAAiB,GAA8B;QACxD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY;YAC1C,IAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,YAAY,CAAC,UAAU,CAAC;YAEvE,IAAI,IAAA,+BAAc,EAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,UAAU,CAAC,EAAE;gBAC/E,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;aAClC;QACL,CAAC;QACD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO,EAAE,OAAO;YAC5B,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,WAAW,EAAE;gBAC1C,OAAO;aACV;YAED,IAAM,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC;YAE1D,IACI,CAAC,eAAe,IAAI,eAAe,IAAI,MAAM,CAAC,UAAU,CAAC;gBACzD,CAAC,CAAC,eAAe,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,EAC1E;gBACE,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,IAAI,CAAC,IAAA,+BAAc,EAAC,OAAO,CAAC,EAAE;oBACzD,IAAA,kCAAiB,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;iBACnC;qBAAM;oBACH,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC;iBAC5D;aACJ;QACL,CAAC;KACJ,CAAC","sourcesContent":["import { isBlockElement } from '../../domToModel/utils/isBlockElement';\nimport { shouldSetValue } from '../utils/shouldSetValue';\nimport { wrapAllChildNodes } from '../../domUtils/moveChildNodes';\nimport type { BoldFormat } from 'roosterjs-content-model-types';\nimport type { FormatHandler } from '../FormatHandler';\n\n/**\n * @internal\n */\nexport const boldFormatHandler: FormatHandler<BoldFormat> = {\n parse: (format, element, context, defaultStyle) => {\n const fontWeight = element.style.fontWeight || defaultStyle.fontWeight;\n\n if (shouldSetValue(fontWeight, '400', format.fontWeight, defaultStyle.fontWeight)) {\n format.fontWeight = fontWeight;\n }\n },\n apply: (format, element, context) => {\n if (typeof format.fontWeight === 'undefined') {\n return;\n }\n\n const blockFontWeight = context.implicitFormat.fontWeight;\n\n if (\n (blockFontWeight && blockFontWeight != format.fontWeight) ||\n (!blockFontWeight && format.fontWeight && format.fontWeight != 'normal')\n ) {\n if (format.fontWeight == 'bold' && !isBlockElement(element)) {\n wrapAllChildNodes(element, 'b');\n } else {\n element.style.fontWeight = format.fontWeight || 'normal';\n }\n }\n },\n};\n"]}
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "../../domUtils/isElementOfType"], function (require, exports, isElementOfType_1) {
1
+ define(["require", "exports", "../../domUtils/isElementOfType", "../../domUtils/isUnsafeUrl"], function (require, exports, isElementOfType_1, isUnsafeUrl_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.linkFormatHandler = void 0;
@@ -18,7 +18,7 @@ define(["require", "exports", "../../domUtils/isElementOfType"], function (requi
18
18
  if (name_1) {
19
19
  format.name = name_1;
20
20
  }
21
- if (href) {
21
+ if (href && !(0, isUnsafeUrl_1.isUnsafeUrl)(href)) {
22
22
  format.href = href;
23
23
  }
24
24
  if (target) {
@@ -40,7 +40,7 @@ define(["require", "exports", "../../domUtils/isElementOfType"], function (requi
40
40
  },
41
41
  apply: function (format, element) {
42
42
  if ((0, isElementOfType_1.isElementOfType)(element, 'a') && (format.href || format.name)) {
43
- if (format.href) {
43
+ if (format.href && !(0, isUnsafeUrl_1.isUnsafeUrl)(format.href)) {
44
44
  element.href = format.href;
45
45
  }
46
46
  if (format.name) {
@@ -1 +1 @@
1
- {"version":3,"file":"linkFormatHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/formatHandlers/segment/linkFormatHandler.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACU,QAAA,iBAAiB,GAA8B;QACxD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO;YACnB,IAAI,IAAA,iCAAe,EAAC,OAAO,EAAE,GAAG,CAAC,EAAE;gBAC/B,IAAM,MAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBAC1B,IAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,0EAA0E;gBACrH,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;gBAC9B,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;gBACxB,IAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;gBACtB,IAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;gBACpC,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;gBAE5B,IAAI,MAAI,EAAE;oBACN,MAAM,CAAC,IAAI,GAAG,MAAI,CAAC;iBACtB;gBAED,IAAI,IAAI,EAAE;oBACN,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;iBACtB;gBAED,IAAI,MAAM,EAAE;oBACR,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;iBAC1B;gBAED,IAAI,EAAE,EAAE;oBACJ,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;iBACxB;gBAED,IAAI,GAAG,EAAE;oBACL,MAAM,CAAC,YAAY,GAAG,GAAG,CAAC;iBAC7B;gBAED,IAAI,KAAK,EAAE;oBACP,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;iBAC9B;gBAED,IAAI,SAAS,EAAE;oBACX,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC;iBAClC;aACJ;QACL,CAAC;QACD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO;YACnB,IAAI,IAAA,iCAAe,EAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE;gBAC/D,IAAI,MAAM,CAAC,IAAI,EAAE;oBACb,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;iBAC9B;gBAED,IAAI,MAAM,CAAC,IAAI,EAAE;oBACb,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;iBAC9B;gBAED,IAAI,MAAM,CAAC,MAAM,EAAE;oBACf,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;iBAClC;gBAED,IAAI,MAAM,CAAC,QAAQ,EAAE;oBACjB,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC;iBAChC;gBAED,IAAI,MAAM,CAAC,WAAW,EAAE;oBACpB,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC;iBAC1C;gBAED,IAAI,MAAM,CAAC,WAAW,EAAE;oBACpB,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;iBACtC;gBAED,IAAI,MAAM,CAAC,YAAY,EAAE;oBACrB,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;iBACrC;aACJ;QACL,CAAC;KACJ,CAAC","sourcesContent":["import { isElementOfType } from '../../domUtils/isElementOfType';\nimport type { FormatHandler } from '../FormatHandler';\nimport type { LinkFormat } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const linkFormatHandler: FormatHandler<LinkFormat> = {\n parse: (format, element) => {\n if (isElementOfType(element, 'a')) {\n const name = element.name;\n const href = element.getAttribute('href'); // Use getAttribute to get original HREF but not the resolved absolute url\n const target = element.target;\n const rel = element.rel;\n const id = element.id;\n const className = element.className;\n const title = element.title;\n\n if (name) {\n format.name = name;\n }\n\n if (href) {\n format.href = href;\n }\n\n if (target) {\n format.target = target;\n }\n\n if (id) {\n format.anchorId = id;\n }\n\n if (rel) {\n format.relationship = rel;\n }\n\n if (title) {\n format.anchorTitle = title;\n }\n\n if (className) {\n format.anchorClass = className;\n }\n }\n },\n apply: (format, element) => {\n if (isElementOfType(element, 'a') && (format.href || format.name)) {\n if (format.href) {\n element.href = format.href;\n }\n\n if (format.name) {\n element.name = format.name;\n }\n\n if (format.target) {\n element.target = format.target;\n }\n\n if (format.anchorId) {\n element.id = format.anchorId;\n }\n\n if (format.anchorClass) {\n element.className = format.anchorClass;\n }\n\n if (format.anchorTitle) {\n element.title = format.anchorTitle;\n }\n\n if (format.relationship) {\n element.rel = format.relationship;\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"linkFormatHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/formatHandlers/segment/linkFormatHandler.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACU,QAAA,iBAAiB,GAA8B;QACxD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO;YACnB,IAAI,IAAA,iCAAe,EAAC,OAAO,EAAE,GAAG,CAAC,EAAE;gBAC/B,IAAM,MAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBAC1B,IAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,0EAA0E;gBACrH,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;gBAC9B,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;gBACxB,IAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;gBACtB,IAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;gBACpC,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;gBAE5B,IAAI,MAAI,EAAE;oBACN,MAAM,CAAC,IAAI,GAAG,MAAI,CAAC;iBACtB;gBAED,IAAI,IAAI,IAAI,CAAC,IAAA,yBAAW,EAAC,IAAI,CAAC,EAAE;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,CAAC,WAAW,CAAC;iBACtC;gBAED,IAAI,MAAM,CAAC,YAAY,EAAE;oBACrB,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;iBACrC;aACJ;QACL,CAAC;KACJ,CAAC","sourcesContent":["import { isElementOfType } from '../../domUtils/isElementOfType';\nimport { isUnsafeUrl } from '../../domUtils/isUnsafeUrl';\nimport type { FormatHandler } from '../FormatHandler';\nimport type { LinkFormat } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const linkFormatHandler: FormatHandler<LinkFormat> = {\n parse: (format, element) => {\n if (isElementOfType(element, 'a')) {\n const name = element.name;\n const href = element.getAttribute('href'); // Use getAttribute to get original HREF but not the resolved absolute url\n const target = element.target;\n const rel = element.rel;\n const id = element.id;\n const className = element.className;\n const title = element.title;\n\n if (name) {\n format.name = name;\n }\n\n if (href && !isUnsafeUrl(href)) {\n format.href = href;\n }\n\n if (target) {\n format.target = target;\n }\n\n if (id) {\n format.anchorId = id;\n }\n\n if (rel) {\n format.relationship = rel;\n }\n\n if (title) {\n format.anchorTitle = title;\n }\n\n if (className) {\n format.anchorClass = className;\n }\n }\n },\n apply: (format, element) => {\n if (isElementOfType(element, 'a') && (format.href || format.name)) {\n if (format.href && !isUnsafeUrl(format.href)) {\n element.href = format.href;\n }\n\n if (format.name) {\n element.name = format.name;\n }\n\n if (format.target) {\n element.target = format.target;\n }\n\n if (format.anchorId) {\n element.id = format.anchorId;\n }\n\n if (format.anchorClass) {\n element.className = format.anchorClass;\n }\n\n if (format.anchorTitle) {\n element.title = format.anchorTitle;\n }\n\n if (format.relationship) {\n element.rel = format.relationship;\n }\n }\n },\n};\n"]}
@@ -9,12 +9,17 @@ define(["require", "exports", "../../domUtils/moveChildNodes"], function (requir
9
9
  parse: function (format, element, context, defaultStyle) {
10
10
  var verticalAlign = element.style.verticalAlign || defaultStyle.verticalAlign;
11
11
  var fontSize = element.style.fontSize || defaultStyle.fontSize;
12
- if (isSuperOrSubScript(fontSize, verticalAlign)) {
12
+ var inheritFontSize = (element.tagName == 'SUP' || element.tagName == 'SUB') && fontSize == 'inherit';
13
+ if (isSuperOrSubScript(fontSize, verticalAlign) ||
14
+ (inheritFontSize && (verticalAlign == 'super' || verticalAlign == 'sub'))) {
13
15
  format.superOrSubScriptSequence = (format.superOrSubScriptSequence || '')
14
16
  .split(' ')
15
17
  .concat(verticalAlign)
16
18
  .join(' ')
17
19
  .trim();
20
+ if (inheritFontSize) {
21
+ format.superOrSubScriptFontSize = 'inherit';
22
+ }
18
23
  }
19
24
  },
20
25
  apply: function (format, element) {
@@ -25,7 +30,10 @@ define(["require", "exports", "../../domUtils/moveChildNodes"], function (requir
25
30
  .forEach(function (value) {
26
31
  var tagName = value == 'super' ? 'sup' : value == 'sub' ? 'sub' : null;
27
32
  if (tagName) {
28
- (0, moveChildNodes_1.wrapAllChildNodes)(element, tagName);
33
+ var wrapper = (0, moveChildNodes_1.wrapAllChildNodes)(element, tagName);
34
+ if (format.superOrSubScriptFontSize) {
35
+ wrapper.style.fontSize = format.superOrSubScriptFontSize;
36
+ }
29
37
  }
30
38
  });
31
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"superOrSubScriptFormatHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/formatHandlers/segment/superOrSubScriptFormatHandler.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACU,QAAA,6BAA6B,GAA0C;QAChF,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY;YAC1C,IAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,YAAY,CAAC,aAAa,CAAC;YAChF,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC;YAEjE,IAAI,kBAAkB,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE;gBAC7C,MAAM,CAAC,wBAAwB,GAAG,CAAC,MAAM,CAAC,wBAAwB,IAAI,EAAE,CAAC;qBACpE,KAAK,CAAC,GAAG,CAAC;qBACV,MAAM,CAAC,aAAa,CAAC;qBACrB,IAAI,CAAC,GAAG,CAAC;qBACT,IAAI,EAAE,CAAC;aACf;QACL,CAAC;QACD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO;YACnB,IAAI,MAAM,CAAC,wBAAwB,EAAE;gBACjC,MAAM,CAAC,wBAAwB;qBAC1B,KAAK,CAAC,GAAG,CAAC;qBACV,OAAO,EAAE;qBACT,OAAO,CAAC,UAAA,KAAK;oBACV,IAAM,OAAO,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;oBAEzE,IAAI,OAAO,EAAE;wBACT,IAAA,kCAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;qBACvC;gBACL,CAAC,CAAC,CAAC;aACV;QACL,CAAC;KACJ,CAAC;IAEF;;OAEG;IACH,SAAgB,kBAAkB,CAC9B,QAA4B,EAC5B,aAAiC;QAEjC,OAAO,QAAQ,IAAI,SAAS,IAAI,CAAC,aAAa,IAAI,KAAK,IAAI,aAAa,IAAI,OAAO,CAAC,CAAC;IACzF,CAAC;IALD,gDAKC","sourcesContent":["import { wrapAllChildNodes } from '../../domUtils/moveChildNodes';\nimport type { FormatHandler } from '../FormatHandler';\nimport type { SuperOrSubScriptFormat } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const superOrSubScriptFormatHandler: FormatHandler<SuperOrSubScriptFormat> = {\n parse: (format, element, context, defaultStyle) => {\n const verticalAlign = element.style.verticalAlign || defaultStyle.verticalAlign;\n const fontSize = element.style.fontSize || defaultStyle.fontSize;\n\n if (isSuperOrSubScript(fontSize, verticalAlign)) {\n format.superOrSubScriptSequence = (format.superOrSubScriptSequence || '')\n .split(' ')\n .concat(verticalAlign)\n .join(' ')\n .trim();\n }\n },\n apply: (format, element) => {\n if (format.superOrSubScriptSequence) {\n format.superOrSubScriptSequence\n .split(' ')\n .reverse()\n .forEach(value => {\n const tagName = value == 'super' ? 'sup' : value == 'sub' ? 'sub' : null;\n\n if (tagName) {\n wrapAllChildNodes(element, tagName);\n }\n });\n }\n },\n};\n\n/**\n * @internal\n */\nexport function isSuperOrSubScript(\n fontSize: string | undefined,\n verticalAlign: string | undefined\n): verticalAlign is 'sub' | 'super' {\n return fontSize == 'smaller' && (verticalAlign == 'sub' || verticalAlign == 'super');\n}\n"]}
1
+ {"version":3,"file":"superOrSubScriptFormatHandler.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/formatHandlers/segment/superOrSubScriptFormatHandler.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACU,QAAA,6BAA6B,GAA0C;QAChF,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY;YAC1C,IAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,YAAY,CAAC,aAAa,CAAC;YAChF,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC;YAEjE,IAAM,eAAe,GACjB,CAAC,OAAO,CAAC,OAAO,IAAI,KAAK,IAAI,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,QAAQ,IAAI,SAAS,CAAC;YAEpF,IACI,kBAAkB,CAAC,QAAQ,EAAE,aAAa,CAAC;gBAC3C,CAAC,eAAe,IAAI,CAAC,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,KAAK,CAAC,CAAC,EAC3E;gBACE,MAAM,CAAC,wBAAwB,GAAG,CAAC,MAAM,CAAC,wBAAwB,IAAI,EAAE,CAAC;qBACpE,KAAK,CAAC,GAAG,CAAC;qBACV,MAAM,CAAC,aAAa,CAAC;qBACrB,IAAI,CAAC,GAAG,CAAC;qBACT,IAAI,EAAE,CAAC;gBACZ,IAAI,eAAe,EAAE;oBACjB,MAAM,CAAC,wBAAwB,GAAG,SAAS,CAAC;iBAC/C;aACJ;QACL,CAAC;QACD,KAAK,EAAE,UAAC,MAAM,EAAE,OAAO;YACnB,IAAI,MAAM,CAAC,wBAAwB,EAAE;gBACjC,MAAM,CAAC,wBAAwB;qBAC1B,KAAK,CAAC,GAAG,CAAC;qBACV,OAAO,EAAE;qBACT,OAAO,CAAC,UAAA,KAAK;oBACV,IAAM,OAAO,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;oBAEzE,IAAI,OAAO,EAAE;wBACT,IAAM,OAAO,GAAG,IAAA,kCAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;wBACpD,IAAI,MAAM,CAAC,wBAAwB,EAAE;4BACjC,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,wBAAwB,CAAC;yBAC5D;qBACJ;gBACL,CAAC,CAAC,CAAC;aACV;QACL,CAAC;KACJ,CAAC;IAEF;;OAEG;IACH,SAAgB,kBAAkB,CAC9B,QAA4B,EAC5B,aAAiC;QAEjC,OAAO,QAAQ,IAAI,SAAS,IAAI,CAAC,aAAa,IAAI,KAAK,IAAI,aAAa,IAAI,OAAO,CAAC,CAAC;IACzF,CAAC;IALD,gDAKC","sourcesContent":["import { wrapAllChildNodes } from '../../domUtils/moveChildNodes';\nimport type { FormatHandler } from '../FormatHandler';\nimport type { SuperOrSubScriptFormat } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const superOrSubScriptFormatHandler: FormatHandler<SuperOrSubScriptFormat> = {\n parse: (format, element, context, defaultStyle) => {\n const verticalAlign = element.style.verticalAlign || defaultStyle.verticalAlign;\n const fontSize = element.style.fontSize || defaultStyle.fontSize;\n\n const inheritFontSize =\n (element.tagName == 'SUP' || element.tagName == 'SUB') && fontSize == 'inherit';\n\n if (\n isSuperOrSubScript(fontSize, verticalAlign) ||\n (inheritFontSize && (verticalAlign == 'super' || verticalAlign == 'sub'))\n ) {\n format.superOrSubScriptSequence = (format.superOrSubScriptSequence || '')\n .split(' ')\n .concat(verticalAlign)\n .join(' ')\n .trim();\n if (inheritFontSize) {\n format.superOrSubScriptFontSize = 'inherit';\n }\n }\n },\n apply: (format, element) => {\n if (format.superOrSubScriptSequence) {\n format.superOrSubScriptSequence\n .split(' ')\n .reverse()\n .forEach(value => {\n const tagName = value == 'super' ? 'sup' : value == 'sub' ? 'sub' : null;\n\n if (tagName) {\n const wrapper = wrapAllChildNodes(element, tagName);\n if (format.superOrSubScriptFontSize) {\n wrapper.style.fontSize = format.superOrSubScriptFontSize;\n }\n }\n });\n }\n },\n};\n\n/**\n * @internal\n */\nexport function isSuperOrSubScript(\n fontSize: string | undefined,\n verticalAlign: string | undefined\n): verticalAlign is 'sub' | 'super' {\n return fontSize == 'smaller' && (verticalAlign == 'sub' || verticalAlign == 'super');\n}\n"]}
@@ -13,6 +13,7 @@ export { buildSelectionMarker } from './domToModel/utils/buildSelectionMarker';
13
13
  export { updateMetadata, getMetadata, hasMetadata } from './modelApi/metadata/updateMetadata';
14
14
  export { isNodeOfType } from './domUtils/isNodeOfType';
15
15
  export { isElementOfType } from './domUtils/isElementOfType';
16
+ export { isUnsafeUrl } from './domUtils/isUnsafeUrl';
16
17
  export { getObjectKeys } from './domUtils/getObjectKeys';
17
18
  export { getSafeIdSelector } from './domUtils/getSafeIdSelector';
18
19
  export { toArray } from './domUtils/toArray';
package/lib-amd/index.js CHANGED
@@ -1,7 +1,7 @@
1
- define(["require", "exports", "./domToModel/domToContentModel", "./modelToDom/contentModelToDom", "./modelToText/contentModelToText", "./domToModel/processors/childProcessor", "./domToModel/processors/entityProcessor", "./domToModel/processors/tableProcessor", "./domToModel/processors/formatContainerProcessor", "./domToModel/utils/getRegularSelectionOffsets", "./domToModel/utils/parseFormat", "./domToModel/utils/areSameFormats", "./domToModel/utils/isBlockElement", "./domToModel/utils/buildSelectionMarker", "./modelApi/metadata/updateMetadata", "./domUtils/isNodeOfType", "./domUtils/isElementOfType", "./domUtils/getObjectKeys", "./domUtils/getSafeIdSelector", "./domUtils/toArray", "./domUtils/moveChildNodes", "./domUtils/wrap", "./domUtils/unwrap", "./domUtils/entityUtils", "./domUtils/reuseCachedElement", "./domUtils/isWhiteSpacePreserved", "./domUtils/normalizeRect", "./domUtils/scrollRectIntoView", "./domUtils/hiddenProperties/undeletableLink", "./modelApi/creators/createBr", "./modelApi/creators/createListItem", "./modelApi/creators/createFormatContainer", "./modelApi/creators/createParagraph", "./modelApi/creators/createSelectionMarker", "./modelApi/creators/createTable", "./modelApi/creators/createTableCell", "./modelApi/creators/createText", "./modelApi/creators/createImage", "./modelApi/creators/createContentModelDocument", "./modelApi/creators/createParagraphDecorator", "./modelApi/creators/createGeneralSegment", "./modelApi/creators/createGeneralBlock", "./modelApi/creators/createEntity", "./modelApi/creators/createDivider", "./modelApi/creators/createListLevel", "./modelApi/creators/createEmptyModel", "./modelApi/creators/createTableRow", "./modelApi/common/mutate", "./modelApi/common/addBlock", "./modelApi/common/addDecorators", "./modelApi/common/addDecorators", "./modelApi/common/addDecorators", "./modelApi/common/addTextSegment", "./modelApi/common/normalizeParagraph", "./modelApi/common/normalizeContentModel", "./modelApi/typeCheck/isGeneralSegment", "./modelApi/common/unwrapBlock", "./modelApi/common/addSegment", "./modelApi/common/isEmpty", "./modelApi/common/normalizeSegment", "./modelApi/common/mergeTextSegments", "./modelApi/common/normalizeSegmentFormat", "./modelApi/block/setParagraphNotImplicit", "./modelApi/block/copyFormat", "./modelApi/list/getOrderedListNumberStr", "./modelApi/list/getAutoListStyleType", "./formatHandlers/utils/parseValueWithUnit", "./formatHandlers/utils/borderKeys", "./formatHandlers/utils/color", "./domToModel/context/createDomToModelContext", "./modelToDom/context/createModelToDomContext", "./domUtils/style/isBold", "./domUtils/selection/getSelectionRootNode", "./domUtils/selection/getDOMInsertPointRect", "./domUtils/selection/trimModelForSelection", "./domUtils/event/eventUtils", "./domUtils/event/getNodePositionFromEvent", "./domUtils/style/borderValues", "./domUtils/stringUtil", "./domUtils/table/parseTableCells", "./domUtils/readFile", "./domUtils/retrieveDocumentMetadata", "./domUtils/style/transformColor", "./domUtils/style/normalizeFontFamily", "./domUtils/event/extractClipboardItems", "./domUtils/event/createPasteFragment", "./domUtils/event/cacheGetEventData", "./domUtils/hiddenProperties/paragraphMarker", "./domUtils/hiddenProperties/imageState", "./domUtils/getRangesByText", "./modelApi/typeCheck/isBlockGroupOfType", "./modelApi/selection/iterateSelections", "./modelApi/selection/collectSelections", "./modelApi/selection/getSelectedCells", "./modelApi/selection/hasSelectionInBlock", "./modelApi/selection/hasSelectionInSegment", "./modelApi/selection/hasSelectionInBlockGroup", "./modelApi/selection/setSelection", "./modelApi/editing/cloneModel", "./modelApi/editing/canMergeCells", "./modelApi/editing/mergeModel", "./modelApi/editing/deleteSelection", "./modelApi/editing/deleteSegment", "./modelApi/editing/deleteBlock", "./modelApi/editing/applyTableFormat", "./modelApi/editing/normalizeTable", "./modelApi/editing/setTableCellBackgroundColor", "./modelApi/editing/retrieveModelFormatState", "./modelApi/editing/getListStyleTypeFromString", "./modelApi/editing/getSegmentTextFormat", "./modelApi/editing/getClosestAncestorBlockGroupIndex", "./modelApi/editing/runEditSteps", "./modelApi/metadata/updateImageMetadata", "./modelApi/metadata/updateTableCellMetadata", "./modelApi/metadata/updateTableMetadata", "./modelApi/metadata/updateListMetadata", "./constants/ChangeSource", "./constants/BulletListType", "./constants/NumberingListType", "./constants/TableBorderFormat", "./constants/OrderedListStyleMap", "./constants/UnorderedListStyleMap", "./constants/EmptySegmentFormat"], function (require, exports, domToContentModel_1, contentModelToDom_1, contentModelToText_1, childProcessor_1, entityProcessor_1, tableProcessor_1, formatContainerProcessor_1, getRegularSelectionOffsets_1, parseFormat_1, areSameFormats_1, isBlockElement_1, buildSelectionMarker_1, updateMetadata_1, isNodeOfType_1, isElementOfType_1, getObjectKeys_1, getSafeIdSelector_1, toArray_1, moveChildNodes_1, wrap_1, unwrap_1, entityUtils_1, reuseCachedElement_1, isWhiteSpacePreserved_1, normalizeRect_1, scrollRectIntoView_1, undeletableLink_1, createBr_1, createListItem_1, createFormatContainer_1, createParagraph_1, createSelectionMarker_1, createTable_1, createTableCell_1, createText_1, createImage_1, createContentModelDocument_1, createParagraphDecorator_1, createGeneralSegment_1, createGeneralBlock_1, createEntity_1, createDivider_1, createListLevel_1, createEmptyModel_1, createTableRow_1, mutate_1, addBlock_1, addDecorators_1, addDecorators_2, addDecorators_3, addTextSegment_1, normalizeParagraph_1, normalizeContentModel_1, isGeneralSegment_1, unwrapBlock_1, addSegment_1, isEmpty_1, normalizeSegment_1, mergeTextSegments_1, normalizeSegmentFormat_1, setParagraphNotImplicit_1, copyFormat_1, getOrderedListNumberStr_1, getAutoListStyleType_1, parseValueWithUnit_1, borderKeys_1, color_1, createDomToModelContext_1, createModelToDomContext_1, isBold_1, getSelectionRootNode_1, getDOMInsertPointRect_1, trimModelForSelection_1, eventUtils_1, getNodePositionFromEvent_1, borderValues_1, stringUtil_1, parseTableCells_1, readFile_1, retrieveDocumentMetadata_1, transformColor_1, normalizeFontFamily_1, extractClipboardItems_1, createPasteFragment_1, cacheGetEventData_1, paragraphMarker_1, imageState_1, getRangesByText_1, isBlockGroupOfType_1, iterateSelections_1, collectSelections_1, getSelectedCells_1, hasSelectionInBlock_1, hasSelectionInSegment_1, hasSelectionInBlockGroup_1, setSelection_1, cloneModel_1, canMergeCells_1, mergeModel_1, deleteSelection_1, deleteSegment_1, deleteBlock_1, applyTableFormat_1, normalizeTable_1, setTableCellBackgroundColor_1, retrieveModelFormatState_1, getListStyleTypeFromString_1, getSegmentTextFormat_1, getClosestAncestorBlockGroupIndex_1, runEditSteps_1, updateImageMetadata_1, updateTableCellMetadata_1, updateTableMetadata_1, updateListMetadata_1, ChangeSource_1, BulletListType_1, NumberingListType_1, TableBorderFormat_1, OrderedListStyleMap_1, UnorderedListStyleMap_1, EmptySegmentFormat_1) {
1
+ define(["require", "exports", "./domToModel/domToContentModel", "./modelToDom/contentModelToDom", "./modelToText/contentModelToText", "./domToModel/processors/childProcessor", "./domToModel/processors/entityProcessor", "./domToModel/processors/tableProcessor", "./domToModel/processors/formatContainerProcessor", "./domToModel/utils/getRegularSelectionOffsets", "./domToModel/utils/parseFormat", "./domToModel/utils/areSameFormats", "./domToModel/utils/isBlockElement", "./domToModel/utils/buildSelectionMarker", "./modelApi/metadata/updateMetadata", "./domUtils/isNodeOfType", "./domUtils/isElementOfType", "./domUtils/isUnsafeUrl", "./domUtils/getObjectKeys", "./domUtils/getSafeIdSelector", "./domUtils/toArray", "./domUtils/moveChildNodes", "./domUtils/wrap", "./domUtils/unwrap", "./domUtils/entityUtils", "./domUtils/reuseCachedElement", "./domUtils/isWhiteSpacePreserved", "./domUtils/normalizeRect", "./domUtils/scrollRectIntoView", "./domUtils/hiddenProperties/undeletableLink", "./modelApi/creators/createBr", "./modelApi/creators/createListItem", "./modelApi/creators/createFormatContainer", "./modelApi/creators/createParagraph", "./modelApi/creators/createSelectionMarker", "./modelApi/creators/createTable", "./modelApi/creators/createTableCell", "./modelApi/creators/createText", "./modelApi/creators/createImage", "./modelApi/creators/createContentModelDocument", "./modelApi/creators/createParagraphDecorator", "./modelApi/creators/createGeneralSegment", "./modelApi/creators/createGeneralBlock", "./modelApi/creators/createEntity", "./modelApi/creators/createDivider", "./modelApi/creators/createListLevel", "./modelApi/creators/createEmptyModel", "./modelApi/creators/createTableRow", "./modelApi/common/mutate", "./modelApi/common/addBlock", "./modelApi/common/addDecorators", "./modelApi/common/addDecorators", "./modelApi/common/addDecorators", "./modelApi/common/addTextSegment", "./modelApi/common/normalizeParagraph", "./modelApi/common/normalizeContentModel", "./modelApi/typeCheck/isGeneralSegment", "./modelApi/common/unwrapBlock", "./modelApi/common/addSegment", "./modelApi/common/isEmpty", "./modelApi/common/normalizeSegment", "./modelApi/common/mergeTextSegments", "./modelApi/common/normalizeSegmentFormat", "./modelApi/block/setParagraphNotImplicit", "./modelApi/block/copyFormat", "./modelApi/list/getOrderedListNumberStr", "./modelApi/list/getAutoListStyleType", "./formatHandlers/utils/parseValueWithUnit", "./formatHandlers/utils/borderKeys", "./formatHandlers/utils/color", "./domToModel/context/createDomToModelContext", "./modelToDom/context/createModelToDomContext", "./domUtils/style/isBold", "./domUtils/selection/getSelectionRootNode", "./domUtils/selection/getDOMInsertPointRect", "./domUtils/selection/trimModelForSelection", "./domUtils/event/eventUtils", "./domUtils/event/getNodePositionFromEvent", "./domUtils/style/borderValues", "./domUtils/stringUtil", "./domUtils/table/parseTableCells", "./domUtils/readFile", "./domUtils/retrieveDocumentMetadata", "./domUtils/style/transformColor", "./domUtils/style/normalizeFontFamily", "./domUtils/event/extractClipboardItems", "./domUtils/event/createPasteFragment", "./domUtils/event/cacheGetEventData", "./domUtils/hiddenProperties/paragraphMarker", "./domUtils/hiddenProperties/imageState", "./domUtils/getRangesByText", "./modelApi/typeCheck/isBlockGroupOfType", "./modelApi/selection/iterateSelections", "./modelApi/selection/collectSelections", "./modelApi/selection/getSelectedCells", "./modelApi/selection/hasSelectionInBlock", "./modelApi/selection/hasSelectionInSegment", "./modelApi/selection/hasSelectionInBlockGroup", "./modelApi/selection/setSelection", "./modelApi/editing/cloneModel", "./modelApi/editing/canMergeCells", "./modelApi/editing/mergeModel", "./modelApi/editing/deleteSelection", "./modelApi/editing/deleteSegment", "./modelApi/editing/deleteBlock", "./modelApi/editing/applyTableFormat", "./modelApi/editing/normalizeTable", "./modelApi/editing/setTableCellBackgroundColor", "./modelApi/editing/retrieveModelFormatState", "./modelApi/editing/getListStyleTypeFromString", "./modelApi/editing/getSegmentTextFormat", "./modelApi/editing/getClosestAncestorBlockGroupIndex", "./modelApi/editing/runEditSteps", "./modelApi/metadata/updateImageMetadata", "./modelApi/metadata/updateTableCellMetadata", "./modelApi/metadata/updateTableMetadata", "./modelApi/metadata/updateListMetadata", "./constants/ChangeSource", "./constants/BulletListType", "./constants/NumberingListType", "./constants/TableBorderFormat", "./constants/OrderedListStyleMap", "./constants/UnorderedListStyleMap", "./constants/EmptySegmentFormat"], function (require, exports, domToContentModel_1, contentModelToDom_1, contentModelToText_1, childProcessor_1, entityProcessor_1, tableProcessor_1, formatContainerProcessor_1, getRegularSelectionOffsets_1, parseFormat_1, areSameFormats_1, isBlockElement_1, buildSelectionMarker_1, updateMetadata_1, isNodeOfType_1, isElementOfType_1, isUnsafeUrl_1, getObjectKeys_1, getSafeIdSelector_1, toArray_1, moveChildNodes_1, wrap_1, unwrap_1, entityUtils_1, reuseCachedElement_1, isWhiteSpacePreserved_1, normalizeRect_1, scrollRectIntoView_1, undeletableLink_1, createBr_1, createListItem_1, createFormatContainer_1, createParagraph_1, createSelectionMarker_1, createTable_1, createTableCell_1, createText_1, createImage_1, createContentModelDocument_1, createParagraphDecorator_1, createGeneralSegment_1, createGeneralBlock_1, createEntity_1, createDivider_1, createListLevel_1, createEmptyModel_1, createTableRow_1, mutate_1, addBlock_1, addDecorators_1, addDecorators_2, addDecorators_3, addTextSegment_1, normalizeParagraph_1, normalizeContentModel_1, isGeneralSegment_1, unwrapBlock_1, addSegment_1, isEmpty_1, normalizeSegment_1, mergeTextSegments_1, normalizeSegmentFormat_1, setParagraphNotImplicit_1, copyFormat_1, getOrderedListNumberStr_1, getAutoListStyleType_1, parseValueWithUnit_1, borderKeys_1, color_1, createDomToModelContext_1, createModelToDomContext_1, isBold_1, getSelectionRootNode_1, getDOMInsertPointRect_1, trimModelForSelection_1, eventUtils_1, getNodePositionFromEvent_1, borderValues_1, stringUtil_1, parseTableCells_1, readFile_1, retrieveDocumentMetadata_1, transformColor_1, normalizeFontFamily_1, extractClipboardItems_1, createPasteFragment_1, cacheGetEventData_1, paragraphMarker_1, imageState_1, getRangesByText_1, isBlockGroupOfType_1, iterateSelections_1, collectSelections_1, getSelectedCells_1, hasSelectionInBlock_1, hasSelectionInSegment_1, hasSelectionInBlockGroup_1, setSelection_1, cloneModel_1, canMergeCells_1, mergeModel_1, deleteSelection_1, deleteSegment_1, deleteBlock_1, applyTableFormat_1, normalizeTable_1, setTableCellBackgroundColor_1, retrieveModelFormatState_1, getListStyleTypeFromString_1, getSegmentTextFormat_1, getClosestAncestorBlockGroupIndex_1, runEditSteps_1, updateImageMetadata_1, updateTableCellMetadata_1, updateTableMetadata_1, updateListMetadata_1, ChangeSource_1, BulletListType_1, NumberingListType_1, TableBorderFormat_1, OrderedListStyleMap_1, UnorderedListStyleMap_1, EmptySegmentFormat_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.EmptySegmentFormat = exports.UnorderedListStyleMap = exports.OrderedListStyleMap = exports.TableBorderFormat = exports.NumberingListType = exports.BulletListType = exports.ChangeSource = exports.ListMetadataDefinition = exports.getListMetadata = exports.updateListMetadata = exports.getTableMetadata = exports.updateTableMetadata = exports.getTableCellMetadata = exports.updateTableCellMetadata = exports.getImageMetadata = exports.updateImageMetadata = exports.runEditSteps = exports.getClosestAncestorBlockGroupIndex = exports.getSegmentTextFormat = exports.getListStyleTypeFromString = exports.retrieveModelFormatState = exports.setTableCellBackgroundColor = exports.MIN_ALLOWED_TABLE_CELL_HEIGHT = exports.MIN_ALLOWED_TABLE_CELL_WIDTH = exports.normalizeTable = exports.setFirstColumnFormatBorders = exports.applyTableFormat = exports.deleteBlock = exports.deleteSegment = exports.deleteSelection = exports.mergeModel = exports.canMergeCells = exports.cloneModelForPaste = exports.cloneModel = exports.setSelection = exports.hasSelectionInBlockGroup = exports.hasSelectionInSegment = exports.hasSelectionInBlock = exports.getSelectedCells = exports.getSelectedSegmentsAndParagraphs = exports.getSelectedSegments = exports.getSelectedParagraphs = exports.getOperationalBlocks = exports.getFirstSelectedTable = exports.getFirstSelectedListItem = exports.iterateSelections = exports.isBlockGroupOfType = exports.getRangesByText = exports.getImageState = exports.setImageState = exports.getParagraphMarker = exports.setParagraphMarker = exports.cacheGetEventData = exports.createPasteFragment = exports.extractClipboardItems = exports.normalizeFontFamily = exports.transformColor = exports.retrieveDocumentMetadata = exports.readFile = exports.parseTableCells = exports.normalizeText = exports.isSpace = exports.isPunctuation = exports.extractBorderValues = exports.combineBorderValue = exports.getNodePositionFromEvent = exports.isCursorMovingKey = exports.isModifierKey = exports.isCharacterValue = exports.trimModelForSelection = exports.getDOMInsertPointRect = exports.getSelectionRootNode = exports.isBold = exports.createModelToDomConfig = exports.createModelToDomContextWithConfig = exports.createModelToDomContext = exports.createDomToModelConfig = exports.createDomToModelContextWithConfig = exports.createDomToModelContext = exports.defaultGenerateColorKey = exports.parseColor = exports.setColor = exports.getColor = exports.DeprecatedColors = exports.BorderKeys = exports.parseValueWithUnit = exports.getAutoListStyleType = exports.getOrderedListNumberStr = exports.ParagraphFormats = exports.ListFormatsToMove = exports.ListFormatsToKeep = exports.ListFormats = exports.copyFormat = exports.setParagraphNotImplicit = exports.normalizeSegmentFormat = exports.mergeTextSegments = exports.normalizeSingleSegment = exports.isEmpty = exports.addSegment = exports.unwrapBlock = exports.isGeneralSegment = exports.normalizeContentModel = exports.normalizeParagraph = exports.addTextSegment = exports.addLink = exports.addData = exports.addCode = exports.addBlock = exports.mutateSegment = exports.mutateSegments = exports.mutateBlock = exports.createTableRow = exports.createEmptyModel = exports.createListLevel = exports.createDivider = exports.createEntity = exports.createGeneralBlock = exports.createGeneralSegment = exports.createParagraphDecorator = exports.createContentModelDocument = exports.createImage = exports.createText = exports.createTableCell = exports.createTable = exports.createSelectionMarker = exports.createParagraph = exports.createFormatContainer = exports.createListItem = exports.createBr = exports.isLinkUndeletable = exports.setLinkUndeletable = exports.scrollRectIntoView = exports.normalizeRect = exports.isWhiteSpacePreserved = exports.reuseCachedElement = exports.findClosestBlockEntityContainer = exports.isBlockEntityContainer = exports.isEntityDelimiter = exports.addDelimiters = exports.generateEntityClassNames = exports.parseEntityFormat = exports.getAllEntityWrappers = exports.findClosestEntityWrapper = exports.isEntityElement = exports.unwrap = exports.wrap = exports.wrapAllChildNodes = exports.moveChildNodes = exports.toArray = exports.getSafeIdSelector = exports.getObjectKeys = exports.isElementOfType = exports.isNodeOfType = exports.hasMetadata = exports.getMetadata = exports.updateMetadata = exports.buildSelectionMarker = exports.isBlockElement = exports.areSameFormats = exports.parseFormat = exports.getRegularSelectionOffsets = exports.formatContainerProcessor = exports.tableProcessor = exports.entityProcessor = exports.processChildNode = exports.handleRegularSelection = exports.childProcessor = exports.contentModelToText = exports.contentModelToDom = exports.domToContentModel = void 0;
4
+ exports.EmptySegmentFormat = exports.UnorderedListStyleMap = exports.OrderedListStyleMap = exports.TableBorderFormat = exports.NumberingListType = exports.BulletListType = exports.ChangeSource = exports.ListMetadataDefinition = exports.getListMetadata = exports.updateListMetadata = exports.getTableMetadata = exports.updateTableMetadata = exports.getTableCellMetadata = exports.updateTableCellMetadata = exports.getImageMetadata = exports.updateImageMetadata = exports.runEditSteps = exports.getClosestAncestorBlockGroupIndex = exports.getSegmentTextFormat = exports.getListStyleTypeFromString = exports.retrieveModelFormatState = exports.setTableCellBackgroundColor = exports.MIN_ALLOWED_TABLE_CELL_HEIGHT = exports.MIN_ALLOWED_TABLE_CELL_WIDTH = exports.normalizeTable = exports.setFirstColumnFormatBorders = exports.applyTableFormat = exports.deleteBlock = exports.deleteSegment = exports.deleteSelection = exports.mergeModel = exports.canMergeCells = exports.cloneModelForPaste = exports.cloneModel = exports.setSelection = exports.hasSelectionInBlockGroup = exports.hasSelectionInSegment = exports.hasSelectionInBlock = exports.getSelectedCells = exports.getSelectedSegmentsAndParagraphs = exports.getSelectedSegments = exports.getSelectedParagraphs = exports.getOperationalBlocks = exports.getFirstSelectedTable = exports.getFirstSelectedListItem = exports.iterateSelections = exports.isBlockGroupOfType = exports.getRangesByText = exports.getImageState = exports.setImageState = exports.getParagraphMarker = exports.setParagraphMarker = exports.cacheGetEventData = exports.createPasteFragment = exports.extractClipboardItems = exports.normalizeFontFamily = exports.transformColor = exports.retrieveDocumentMetadata = exports.readFile = exports.parseTableCells = exports.normalizeText = exports.isSpace = exports.isPunctuation = exports.extractBorderValues = exports.combineBorderValue = exports.getNodePositionFromEvent = exports.isCursorMovingKey = exports.isModifierKey = exports.isCharacterValue = exports.trimModelForSelection = exports.getDOMInsertPointRect = exports.getSelectionRootNode = exports.isBold = exports.createModelToDomConfig = exports.createModelToDomContextWithConfig = exports.createModelToDomContext = exports.createDomToModelConfig = exports.createDomToModelContextWithConfig = exports.createDomToModelContext = exports.defaultGenerateColorKey = exports.parseColor = exports.setColor = exports.getColor = exports.DeprecatedColors = exports.BorderKeys = exports.parseValueWithUnit = exports.getAutoListStyleType = exports.getOrderedListNumberStr = exports.ParagraphFormats = exports.ListFormatsToMove = exports.ListFormatsToKeep = exports.ListFormats = exports.copyFormat = exports.setParagraphNotImplicit = exports.normalizeSegmentFormat = exports.mergeTextSegments = exports.normalizeSingleSegment = exports.isEmpty = exports.addSegment = exports.unwrapBlock = exports.isGeneralSegment = exports.normalizeContentModel = exports.normalizeParagraph = exports.addTextSegment = exports.addLink = exports.addData = exports.addCode = exports.addBlock = exports.mutateSegment = exports.mutateSegments = exports.mutateBlock = exports.createTableRow = exports.createEmptyModel = exports.createListLevel = exports.createDivider = exports.createEntity = exports.createGeneralBlock = exports.createGeneralSegment = exports.createParagraphDecorator = exports.createContentModelDocument = exports.createImage = exports.createText = exports.createTableCell = exports.createTable = exports.createSelectionMarker = exports.createParagraph = exports.createFormatContainer = exports.createListItem = exports.createBr = exports.isLinkUndeletable = exports.setLinkUndeletable = exports.scrollRectIntoView = exports.normalizeRect = exports.isWhiteSpacePreserved = exports.reuseCachedElement = exports.findClosestBlockEntityContainer = exports.isBlockEntityContainer = exports.isEntityDelimiter = exports.addDelimiters = exports.generateEntityClassNames = exports.parseEntityFormat = exports.getAllEntityWrappers = exports.findClosestEntityWrapper = exports.isEntityElement = exports.unwrap = exports.wrap = exports.wrapAllChildNodes = exports.moveChildNodes = exports.toArray = exports.getSafeIdSelector = exports.getObjectKeys = exports.isUnsafeUrl = exports.isElementOfType = exports.isNodeOfType = exports.hasMetadata = exports.getMetadata = exports.updateMetadata = exports.buildSelectionMarker = exports.isBlockElement = exports.areSameFormats = exports.parseFormat = exports.getRegularSelectionOffsets = exports.formatContainerProcessor = exports.tableProcessor = exports.entityProcessor = exports.processChildNode = exports.handleRegularSelection = exports.childProcessor = exports.contentModelToText = exports.contentModelToDom = exports.domToContentModel = void 0;
5
5
  Object.defineProperty(exports, "domToContentModel", { enumerable: true, get: function () { return domToContentModel_1.domToContentModel; } });
6
6
  Object.defineProperty(exports, "contentModelToDom", { enumerable: true, get: function () { return contentModelToDom_1.contentModelToDom; } });
7
7
  Object.defineProperty(exports, "contentModelToText", { enumerable: true, get: function () { return contentModelToText_1.contentModelToText; } });
@@ -21,6 +21,7 @@ define(["require", "exports", "./domToModel/domToContentModel", "./modelToDom/co
21
21
  Object.defineProperty(exports, "hasMetadata", { enumerable: true, get: function () { return updateMetadata_1.hasMetadata; } });
22
22
  Object.defineProperty(exports, "isNodeOfType", { enumerable: true, get: function () { return isNodeOfType_1.isNodeOfType; } });
23
23
  Object.defineProperty(exports, "isElementOfType", { enumerable: true, get: function () { return isElementOfType_1.isElementOfType; } });
24
+ Object.defineProperty(exports, "isUnsafeUrl", { enumerable: true, get: function () { return isUnsafeUrl_1.isUnsafeUrl; } });
24
25
  Object.defineProperty(exports, "getObjectKeys", { enumerable: true, get: function () { return getObjectKeys_1.getObjectKeys; } });
25
26
  Object.defineProperty(exports, "getSafeIdSelector", { enumerable: true, get: function () { return getSafeIdSelector_1.getSafeIdSelector; } });
26
27
  Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return toArray_1.toArray; } });