roosterjs-content-model-dom 9.57.0 → 9.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/lib/constants/ChangeSource.d.ts +4 -0
- package/lib/constants/ChangeSource.js +4 -0
- package/lib/constants/ChangeSource.js.map +1 -1
- package/lib/domToModel/context/defaultProcessors.js +1 -0
- package/lib/domToModel/context/defaultProcessors.js.map +1 -1
- package/lib/domUtils/event/createPasteFragment.d.ts +10 -0
- package/lib/domUtils/event/createPasteFragment.js +37 -0
- package/lib/domUtils/event/createPasteFragment.js.map +1 -0
- package/lib/domUtils/event/getNodePositionFromEvent.js +10 -2
- package/lib/domUtils/event/getNodePositionFromEvent.js.map +1 -1
- package/lib/domUtils/textToFragment.d.ts +4 -0
- package/lib/domUtils/textToFragment.js +62 -0
- package/lib/domUtils/textToFragment.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/modelApi/editing/mergeModel.js +23 -3
- package/lib/modelApi/editing/mergeModel.js.map +1 -1
- package/lib-amd/constants/ChangeSource.d.ts +4 -0
- package/lib-amd/constants/ChangeSource.js +4 -0
- package/lib-amd/constants/ChangeSource.js.map +1 -1
- package/lib-amd/domToModel/context/defaultProcessors.js +1 -0
- package/lib-amd/domToModel/context/defaultProcessors.js.map +1 -1
- package/lib-amd/domUtils/event/createPasteFragment.d.ts +10 -0
- package/lib-amd/domUtils/event/createPasteFragment.js +37 -0
- package/lib-amd/domUtils/event/createPasteFragment.js.map +1 -0
- package/lib-amd/domUtils/event/getNodePositionFromEvent.js +10 -2
- package/lib-amd/domUtils/event/getNodePositionFromEvent.js.map +1 -1
- package/lib-amd/domUtils/textToFragment.d.ts +4 -0
- package/lib-amd/domUtils/textToFragment.js +63 -0
- package/lib-amd/domUtils/textToFragment.js.map +1 -0
- package/lib-amd/index.d.ts +1 -0
- package/lib-amd/index.js +3 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/editing/mergeModel.js +23 -4
- package/lib-amd/modelApi/editing/mergeModel.js.map +1 -1
- package/lib-mjs/constants/ChangeSource.d.ts +4 -0
- package/lib-mjs/constants/ChangeSource.js +4 -0
- package/lib-mjs/constants/ChangeSource.js.map +1 -1
- package/lib-mjs/domToModel/context/defaultProcessors.js +1 -0
- package/lib-mjs/domToModel/context/defaultProcessors.js.map +1 -1
- package/lib-mjs/domUtils/event/createPasteFragment.d.ts +10 -0
- package/lib-mjs/domUtils/event/createPasteFragment.js +33 -0
- package/lib-mjs/domUtils/event/createPasteFragment.js.map +1 -0
- package/lib-mjs/domUtils/event/getNodePositionFromEvent.js +10 -2
- package/lib-mjs/domUtils/event/getNodePositionFromEvent.js.map +1 -1
- package/lib-mjs/domUtils/textToFragment.d.ts +4 -0
- package/lib-mjs/domUtils/textToFragment.js +58 -0
- package/lib-mjs/domUtils/textToFragment.js.map +1 -0
- package/lib-mjs/index.d.ts +1 -0
- package/lib-mjs/index.js +1 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/editing/mergeModel.js +23 -3
- package/lib-mjs/modelApi/editing/mergeModel.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/mergeModel.ts"],"names":[],"mappings":";;;;AAAA,+CAA8C;AAC9C,mDAAkD;AAClD,uDAAsD;AACtD,6DAA4D;AAC5D,+DAA8D;AAC9D,2EAA0E;AAC1E,+DAA8D;AAC9D,qDAAoD;AACpD,yEAAwE;AACxE,yFAAwF;AACxF,+DAA8D;AAC9D,2CAA+C;AAC/C,yEAAwE;AACxE,mDAAkD;AAoBlD,IAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzD,IAAM,mB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AC;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 { createListItem } from '../creators/createListItem';\nimport { createParagraph } from '../creators/createParagraph';\nimport { createSelectionMarker } from '../creators/createSelectionMarker';\nimport { createTableCell } from '../creators/createTableCell';\nimport { deleteSelection } from './deleteSelection';\nimport { EmptySegmentFormat } from '../../constants/EmptySegmentFormat';\nimport { getClosestAncestorBlockGroupIndex } from './getClosestAncestorBlockGroupIndex';\nimport { getObjectKeys } from '../..//domUtils/getObjectKeys';\nimport { mutateBlock } from '../common/mutate';\nimport { normalizeContentModel } from '../common/normalizeContentModel';\nimport { normalizeTable } from './normalizeTable';\nimport type {\n ContentModelBlock,\n ContentModelBlockFormat,\n ContentModelDocument,\n ContentModelHyperLinkFormat,\n ContentModelListItem,\n ContentModelParagraph,\n ContentModelSegmentFormat,\n ContentModelTable,\n FormatContentModelContext,\n InsertPoint,\n MergeModelOption,\n ReadonlyContentModelBlock,\n ReadonlyContentModelBlockGroup,\n ReadonlyContentModelDocument,\n ReadonlyContentModelTable,\n ShallowMutableContentModelParagraph,\n} from 'roosterjs-content-model-types';\n\nconst HeadingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\nconst KeysOfSegmentFormat = getObjectKeys(EmptySegmentFormat);\n\ntype MergeFormatTypes = 'mergeAll' | 'keepSourceEmphasisFormat' | 'preferSource' | 'preferTarget';\n\n/**\n * Merge source model into target mode\n * @param target Target Content Model that will merge content into\n * @param source Source Content Model will be merged to target model\n * @param context Format context. When call this function inside formatContentModel, provide this context so that formatContentModel will do extra handling to the result\n * @param options More options, see MergeModelOption\n * @returns Insert point after merge, or null if there is no insert point\n */\nexport function mergeModel(\n target: ReadonlyContentModelDocument,\n source: ContentModelDocument,\n context?: FormatContentModelContext,\n options?: MergeModelOption\n): InsertPoint | null {\n const insertPosition =\n options?.insertPosition ?? deleteSelection(target, [], context).insertPoint;\n\n const { addParagraphAfterMergedContent, mergeFormat, mergeTable } = options || {};\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 mergeParagraph(\n markerPosition: InsertPoint,\n newPara: ContentModelParagraph,\n mergeToCurrentParagraph: boolean,\n context?: FormatContentModelContext,\n option?: MergeModelOption\n) {\n const { paragraph, marker } = markerPosition;\n const newParagraph = mergeToCurrentParagraph\n ? paragraph\n : splitParagraph(markerPosition, newPara.format);\n const segmentIndex = newParagraph.segments.indexOf(marker);\n\n if (option?.mergeFormat == 'none' && mergeToCurrentParagraph) {\n newParagraph.segments.forEach(segment => {\n segment.format = { ...(newParagraph.segmentFormat || {}), ...segment.format };\n });\n delete newParagraph.segmentFormat;\n }\n if (segmentIndex >= 0) {\n for (let i = 0; i < newPara.segments.length; i++) {\n const segment = newPara.segments[i];\n\n newParagraph.segments.splice(segmentIndex + i, 0, segment);\n\n if (context) {\n if (segment.segmentType == 'Entity') {\n context.newEntities.push(segment);\n }\n\n if (segment.segmentType == 'Image') {\n context.newImages.push(segment);\n }\n }\n }\n }\n\n if (newPara.decorator) {\n newParagraph.decorator = { ...newPara.decorator };\n if (HeadingTags.indexOf(newParagraph.decorator.tagName) > -1) {\n const sourceKeys: (keyof ContentModelSegmentFormat)[] = getObjectKeys(\n newParagraph.decorator.format\n );\n const segmentDecoratorKeys: (keyof ContentModelSegmentFormat)[] = getObjectKeys(\n newParagraph.segmentFormat || {}\n );\n\n sourceKeys.forEach(key => {\n if (segmentDecoratorKeys.indexOf(key) > -1) {\n delete newParagraph.segmentFormat?.[key];\n }\n });\n }\n }\n\n if (!mergeToCurrentParagraph) {\n newParagraph.format = newPara.format;\n } else {\n newParagraph.format = {\n ...newParagraph.format,\n ...newPara.format,\n };\n }\n}\n\nfunction mergeTables(\n markerPosition: InsertPoint,\n newTable: ContentModelTable,\n source: ContentModelDocument\n) {\n const { tableContext, marker } = markerPosition;\n\n if (tableContext && source.blocks.length == 1 && source.blocks[0] == newTable) {\n const { table: readonlyTable, colIndex, rowIndex } = tableContext;\n const table = mutateBlock(readonlyTable);\n\n const newTableColCount = newTable.rows[0]?.cells.length || 0;\n const newTableRowCount = newTable.rows.length;\n\n const lastTargetColIndex = getTargetColIndex(table, rowIndex, colIndex, newTableColCount);\n const extraColsNeeded = lastTargetColIndex - table.rows[0].cells.length;\n\n newTable.rows.forEach(row => {\n row.cells.forEach(cell => {\n cell.spanAbove = false;\n });\n });\n\n if (extraColsNeeded > 0) {\n const currentColCount = table.rows[0].cells.length;\n for (let col = 0; col < extraColsNeeded; col++) {\n const newColIndex = currentColCount + col;\n for (let k = 0; k < table.rows.length; k++) {\n const leftCell = table.rows[k]?.cells[newColIndex - 1];\n table.rows[k].cells[newColIndex] = createTableCell(\n false /*spanLeft*/,\n false /*spanAbove*/,\n leftCell?.isHeader,\n leftCell?.format\n );\n }\n }\n }\n\n const lastTargetRowIndex = getTargetRowIndex(table, rowIndex, newTableRowCount, colIndex);\n const extraRowsNeeded = lastTargetRowIndex - table.rows.length;\n\n if (extraRowsNeeded > 0) {\n const currentRowCount = table.rows.length;\n const colCount = table.rows[0]?.cells.length || 0;\n for (let row = 0; row < extraRowsNeeded; row++) {\n const newRowIndex = currentRowCount + row;\n table.rows[newRowIndex] = {\n cells: [],\n format: {},\n height: 0,\n };\n for (let k = 0; k < colCount; k++) {\n const aboveCell = table.rows[newRowIndex - 1]?.cells[k];\n table.rows[newRowIndex].cells[k] = createTableCell(\n false /*spanLeft*/,\n false /*spanAbove*/,\n false /*isHeader*/,\n aboveCell?.format\n );\n }\n }\n }\n\n const logicalRowOffsets: number[] = [];\n let logicalRowCount = 0;\n for (let i = 0; i < newTableRowCount; i++) {\n logicalRowOffsets[i] = logicalRowCount;\n const row = newTable.rows[i];\n if (row && row.cells.some(cell => !cell.spanAbove)) {\n logicalRowCount++;\n }\n }\n\n for (let i = 0; i < newTable.rows.length; i++) {\n const sourceRow = newTable.rows[i];\n const targetRowIndex = getTargetRowIndex(\n table,\n rowIndex,\n logicalRowOffsets[i],\n colIndex\n );\n\n const logicalColOffsets: number[] = [];\n let logicalColCount = 0;\n for (let j = 0; j < sourceRow.cells.length; j++) {\n logicalColOffsets[j] = logicalColCount;\n if (!sourceRow.cells[j]?.spanLeft) {\n logicalColCount++;\n }\n }\n\n for (let j = 0; j < newTable.rows[i].cells.length; j++) {\n const newCell = sourceRow.cells[j];\n\n const targetColIndex = getTargetColIndex(\n table,\n targetRowIndex,\n colIndex,\n logicalColOffsets[j]\n );\n\n const oldCell = table.rows[targetRowIndex]?.cells[targetColIndex];\n\n table.rows[targetRowIndex].cells[targetColIndex] = newCell;\n\n if (i == 0 && j == 0) {\n const newMarker = createSelectionMarker(marker.format);\n const newPara = addSegment(newCell, newMarker);\n\n if (markerPosition.path[0] == oldCell) {\n // Update insert point to match the change result\n markerPosition.path[0] = newCell;\n markerPosition.marker = newMarker;\n markerPosition.paragraph = newPara;\n }\n }\n }\n }\n\n normalizeTable(table, markerPosition.marker.format);\n applyTableFormat(table, undefined /*newFormat*/, true /*keepCellShade*/);\n } else {\n insertBlock(markerPosition, newTable);\n }\n}\n\nfunction mergeList(markerPosition: InsertPoint, newList: ContentModelListItem) {\n splitParagraph(markerPosition, newList.format);\n\n const { path, paragraph } = markerPosition;\n\n const listItemIndex = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n const listItem = path[listItemIndex] as ContentModelListItem;\n const listParent = path[listItemIndex + 1]; // It is ok here when index is -1, that means there is no list and we just insert a new paragraph and use path[0] as its parent\n const blockIndex = listParent.blocks.indexOf(listItem || paragraph);\n\n if (blockIndex >= 0) {\n mutateBlock(listParent).blocks.splice(blockIndex, 0, newList);\n }\n\n if (listItem) {\n listItem?.levels.forEach((level, i) => {\n newList.levels[i] = { ...level };\n });\n }\n}\n\nfunction splitParagraph(markerPosition: InsertPoint, newParaFormat: ContentModelBlockFormat) {\n const { paragraph, marker, path } = markerPosition;\n const segmentIndex = paragraph.segments.indexOf(marker);\n const paraIndex = path[0].blocks.indexOf(paragraph);\n const newParagraph: ShallowMutableContentModelParagraph = createParagraph(\n false /*isImplicit*/,\n { ...paragraph.format, ...newParaFormat },\n paragraph.segmentFormat\n );\n\n if (segmentIndex >= 0) {\n newParagraph.segments = paragraph.segments.splice(segmentIndex);\n }\n\n if (paraIndex >= 0) {\n mutateBlock(path[0]).blocks.splice(paraIndex + 1, 0, newParagraph);\n }\n\n const listItemIndex = getClosestAncestorBlockGroupIndex(\n path,\n ['ListItem'],\n ['FormatContainer', 'TableCell']\n );\n const listItem = path[listItemIndex] as ContentModelListItem;\n\n if (listItem) {\n const listParent = listItemIndex >= 0 ? path[listItemIndex + 1] : null;\n const blockIndex = listParent ? listParent.blocks.indexOf(listItem) : -1;\n\n if (blockIndex >= 0 && listParent) {\n const newListItem = createListItem(listItem.levels, listItem.formatHolder.format);\n\n if (paraIndex >= 0) {\n newListItem.blocks = listItem.blocks.splice(paraIndex + 1);\n }\n\n if (blockIndex >= 0) {\n mutateBlock(listParent).blocks.splice(blockIndex + 1, 0, newListItem);\n }\n\n path[listItemIndex] = newListItem;\n }\n }\n\n markerPosition.paragraph = newParagraph;\n\n return newParagraph;\n}\n\nfunction insertBlock(markerPosition: InsertPoint, block: ContentModelBlock) {\n const { path } = markerPosition;\n const newParaFormat = block.blockType !== 'Paragraph' ? {} : block.format;\n const newPara = splitParagraph(markerPosition, newParaFormat);\n const blockIndex = path[0].blocks.indexOf(newPara);\n\n if (blockIndex >= 0) {\n mutateBlock(path[0]).blocks.splice(blockIndex, 0, block);\n }\n}\n\nfunction applyDefaultFormat(\n group: ReadonlyContentModelBlockGroup,\n format: ContentModelSegmentFormat,\n applyDefaultFormatOption: MergeFormatTypes\n) {\n group.blocks.forEach(block => {\n mergeBlockFormat(applyDefaultFormatOption, block);\n\n switch (block.blockType) {\n case 'BlockGroup':\n if (block.blockGroupType == 'ListItem') {\n mutateBlock(block).formatHolder.format = mergeSegmentFormat(\n applyDefaultFormatOption,\n format,\n block.formatHolder.format\n );\n }\n applyDefaultFormat(block, format, applyDefaultFormatOption);\n break;\n\n case 'Table':\n block.rows.forEach(row =>\n row.cells.forEach(cell => {\n applyDefaultFormat(cell, format, applyDefaultFormatOption);\n })\n );\n break;\n\n case 'Paragraph':\n const paragraphFormat = block.decorator?.format || {};\n const paragraph = mutateBlock(block);\n\n paragraph.segments.forEach(segment => {\n if (segment.segmentType == 'General') {\n applyDefaultFormat(segment, format, applyDefaultFormatOption);\n }\n\n segment.format = mergeSegmentFormat(applyDefaultFormatOption, format, {\n ...paragraphFormat,\n ...segment.format,\n });\n\n if (segment.link) {\n segment.link.format = mergeLinkFormat(\n applyDefaultFormatOption,\n format,\n segment.link.format\n );\n }\n });\n\n if (applyDefaultFormatOption === 'keepSourceEmphasisFormat') {\n delete paragraph.decorator;\n }\n break;\n }\n });\n}\n\nfunction mergeBlockFormat(applyDefaultFormatOption: string, block: ReadonlyContentModelBlock) {\n if (applyDefaultFormatOption == 'keepSourceEmphasisFormat' && block.format.backgroundColor) {\n delete mutateBlock(block).format.backgroundColor;\n }\n}\n\n/**\n * Hyperlink format type definition only contains backgroundColor and underline.\n * So create a minimum object with the styles supported in Hyperlink to be used in merge.\n */\nfunction getSegmentFormatInLinkFormat(\n targetFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n const result: ContentModelHyperLinkFormat = {};\n if (targetFormat.backgroundColor) {\n result.backgroundColor = targetFormat.backgroundColor;\n }\n if (targetFormat.underline) {\n result.underline = targetFormat.underline;\n }\n\n return result;\n}\n\nfunction mergeLinkFormat(\n applyDefaultFormatOption: MergeFormatTypes,\n targetFormat: ContentModelSegmentFormat,\n sourceFormat: ContentModelHyperLinkFormat\n) {\n switch (applyDefaultFormatOption) {\n case 'mergeAll':\n case 'preferSource':\n return { ...getSegmentFormatInLinkFormat(targetFormat), ...sourceFormat };\n case 'keepSourceEmphasisFormat':\n return {\n // Hyperlink segment format contains other attributes such as LinkFormat\n // so we have to retain them\n ...getFormatWithoutSegmentFormat(sourceFormat),\n // Link format only have Text color, background color, Underline, but only\n // text color + background color should be merged from the target\n ...getSegmentFormatInLinkFormat(targetFormat),\n // Get the semantic format of the source\n ...getSemanticFormat(sourceFormat),\n // The text color of the hyperlink should not be merged and\n // we should always retain the source text color\n ...getHyperlinkTextColor(sourceFormat),\n };\n case 'preferTarget':\n return { ...sourceFormat, ...getSegmentFormatInLinkFormat(targetFormat) };\n }\n}\n\nfunction mergeSegmentFormat(\n applyDefaultFormatOption: MergeFormatTypes,\n targetFormat: ContentModelSegmentFormat,\n sourceFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n switch (applyDefaultFormatOption) {\n case 'mergeAll':\n case 'preferSource':\n return { ...targetFormat, ...sourceFormat };\n case 'preferTarget':\n return { ...sourceFormat, ...targetFormat };\n case 'keepSourceEmphasisFormat':\n return {\n ...getFormatWithoutSegmentFormat(sourceFormat),\n ...targetFormat,\n ...getSemanticFormat(sourceFormat),\n };\n }\n}\n\nfunction getSemanticFormat(segmentFormat: ContentModelSegmentFormat): ContentModelSegmentFormat {\n const result: ContentModelSegmentFormat = {};\n\n const { fontWeight, italic, underline } = segmentFormat;\n\n if (fontWeight && fontWeight != 'normal') {\n result.fontWeight = fontWeight;\n }\n if (italic) {\n result.italic = italic;\n }\n if (underline) {\n result.underline = underline;\n }\n\n return result;\n}\n\n/**\n * Segment format can also contain other type of metadata, for example in Images/Hyperlink,\n * we want to preserve these properties when merging format\n */\nfunction getFormatWithoutSegmentFormat(\n sourceFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n const resultFormat = {\n ...sourceFormat,\n };\n KeysOfSegmentFormat.forEach(key => delete resultFormat[key]);\n return resultFormat;\n}\n\nfunction getHyperlinkTextColor(sourceFormat: ContentModelHyperLinkFormat) {\n const result: ContentModelHyperLinkFormat = {};\n if (sourceFormat.textColor) {\n result.textColor = sourceFormat.textColor;\n }\n\n return result;\n}\n\nfunction getTargetColIndex(\n table: ReadonlyContentModelTable,\n rowIndex: number,\n startColIndex: number,\n offset: number\n): number {\n const row = table.rows[rowIndex];\n if (!row) {\n return startColIndex + offset;\n }\n\n if (offset === 0) {\n return startColIndex;\n }\n\n let targetColIndex = startColIndex;\n let logicalCellsToSkip = offset;\n\n while (logicalCellsToSkip > 0) {\n targetColIndex++;\n\n if (targetColIndex >= row.cells.length) {\n logicalCellsToSkip--;\n } else if (!row.cells[targetColIndex].spanLeft) {\n logicalCellsToSkip--;\n }\n }\n\n return targetColIndex;\n}\n\nfunction getTargetRowIndex(\n table: ReadonlyContentModelTable,\n startRowIndex: number,\n offset: number,\n colIndex: number\n): number {\n if (offset === 0) {\n return startRowIndex;\n }\n\n let targetRowIndex = startRowIndex;\n let logicalRowsToSkip = offset;\n\n while (logicalRowsToSkip > 0) {\n targetRowIndex++;\n\n if (targetRowIndex >= table.rows.length) {\n logicalRowsToSkip--;\n } else if (!table.rows[targetRowIndex]?.cells[colIndex]?.spanAbove) {\n logicalRowsToSkip--;\n }\n }\n\n return targetRowIndex;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mergeModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/mergeModel.ts"],"names":[],"mappings":";;;;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,yEAAwE;AACxE,mDAAkD;AAoBlD,IAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzD,IAAM,mBAAmB,GAAG,IAAA,6BAAa,EAAC,uCAAkB,CAAC,CAAC;AAI9D;;;;;;;GAOG;AAC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;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} from 'roosterjs-content-model-types';\n\nconst HeadingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\nconst KeysOfSegmentFormat = getObjectKeys(EmptySegmentFormat);\n\ntype MergeFormatTypes = 'mergeAll' | 'keepSourceEmphasisFormat' | 'preferSource' | 'preferTarget';\n\n/**\n * Merge source model into target mode\n * @param target Target Content Model that will merge content into\n * @param source Source Content Model will be merged to target model\n * @param context Format context. When call this function inside formatContentModel, provide this context so that formatContentModel will do extra handling to the result\n * @param options More options, see MergeModelOption\n * @returns Insert point after merge, or null if there is no insert point\n */\nexport function mergeModel(\n target: ReadonlyContentModelDocument,\n source: ContentModelDocument,\n context?: FormatContentModelContext,\n options?: MergeModelOption\n): InsertPoint | null {\n const insertPosition =\n options?.insertPosition ?? deleteSelection(target, [], context).insertPoint;\n\n const { addParagraphAfterMergedContent, mergeFormat, mergeParagraphAfterList, mergeTable } =\n options || {};\n\n if (mergeParagraphAfterList && insertPosition && source.blocks[0]?.blockType == 'Paragraph') {\n moveParagraphAfterListIntoList(insertPosition);\n }\n\n if (addParagraphAfterMergedContent && !mergeTable) {\n const { paragraph, marker } = insertPosition || {};\n const newPara = createParagraph(false /* isImplicit */, paragraph?.format, marker?.format);\n addBlock(source, newPara);\n }\n\n if (insertPosition) {\n if (mergeFormat && mergeFormat != 'none') {\n const newFormat: ContentModelSegmentFormat = {\n ...(target.format || {}),\n ...insertPosition.marker.format,\n };\n\n applyDefaultFormat(source, newFormat, mergeFormat);\n }\n\n for (let i = 0; i < source.blocks.length; i++) {\n const block = source.blocks[i];\n\n switch (block.blockType) {\n case 'Paragraph':\n mergeParagraph(insertPosition, block, i == 0, context, options);\n break;\n\n case 'Divider':\n insertBlock(insertPosition, block);\n break;\n\n case 'Entity':\n insertBlock(insertPosition, block);\n context?.newEntities.push(block);\n break;\n\n case 'Table':\n if (source.blocks.length == 1 && mergeTable) {\n mergeTables(insertPosition, block, source);\n } else {\n insertBlock(insertPosition, block);\n }\n break;\n\n case 'BlockGroup':\n switch (block.blockGroupType) {\n case 'General':\n case 'FormatContainer':\n insertBlock(insertPosition, block);\n break;\n case 'ListItem':\n mergeList(insertPosition, block);\n break;\n }\n break;\n }\n }\n }\n\n normalizeContentModel(target);\n\n return insertPosition;\n}\n\nfunction moveParagraphAfterListIntoList(insertPosition: InsertPoint) {\n const { paragraph, path } = insertPosition;\n const parent = path[0];\n const paragraphIndex = parent.blocks.indexOf(paragraph);\n const previousBlock = parent.blocks[paragraphIndex - 1];\n\n if (\n paragraph.segments.every(\n segment => segment.segmentType == 'SelectionMarker' || segment.segmentType == 'Br'\n ) &&\n previousBlock?.blockType == 'BlockGroup' &&\n previousBlock.blockGroupType == 'ListItem'\n ) {\n const newListItem = createListItem(previousBlock.levels, previousBlock.formatHolder.format);\n const paragraphAfterList = createParagraph(false, paragraph.format);\n\n addBlock(newListItem, paragraph);\n paragraphAfterList.segments.push(createBr());\n mutateBlock(parent).blocks.splice(paragraphIndex, 1, newListItem, paragraphAfterList);\n path.unshift(newListItem);\n }\n}\n\nfunction mergeParagraph(\n markerPosition: InsertPoint,\n newPara: ContentModelParagraph,\n mergeToCurrentParagraph: boolean,\n context?: FormatContentModelContext,\n option?: MergeModelOption\n) {\n const { paragraph, marker } = markerPosition;\n const newParagraph = mergeToCurrentParagraph\n ? paragraph\n : splitParagraph(markerPosition, newPara.format);\n const segmentIndex = newParagraph.segments.indexOf(marker);\n\n if (option?.mergeFormat == 'none' && mergeToCurrentParagraph) {\n newParagraph.segments.forEach(segment => {\n segment.format = { ...(newParagraph.segmentFormat || {}), ...segment.format };\n });\n delete newParagraph.segmentFormat;\n }\n if (segmentIndex >= 0) {\n for (let i = 0; i < newPara.segments.length; i++) {\n const segment = newPara.segments[i];\n\n newParagraph.segments.splice(segmentIndex + i, 0, segment);\n\n if (context) {\n if (segment.segmentType == 'Entity') {\n context.newEntities.push(segment);\n }\n\n if (segment.segmentType == 'Image') {\n context.newImages.push(segment);\n }\n }\n }\n }\n\n if (newPara.decorator) {\n newParagraph.decorator = { ...newPara.decorator };\n if (HeadingTags.indexOf(newParagraph.decorator.tagName) > -1) {\n const sourceKeys: (keyof ContentModelSegmentFormat)[] = getObjectKeys(\n newParagraph.decorator.format\n );\n const segmentDecoratorKeys: (keyof ContentModelSegmentFormat)[] = getObjectKeys(\n newParagraph.segmentFormat || {}\n );\n\n sourceKeys.forEach(key => {\n if (segmentDecoratorKeys.indexOf(key) > -1) {\n delete newParagraph.segmentFormat?.[key];\n }\n });\n }\n }\n\n if (!mergeToCurrentParagraph) {\n newParagraph.format = newPara.format;\n } else {\n newParagraph.format = {\n ...newParagraph.format,\n ...newPara.format,\n };\n }\n}\n\nfunction mergeTables(\n markerPosition: InsertPoint,\n newTable: ContentModelTable,\n source: ContentModelDocument\n) {\n const { tableContext, marker } = markerPosition;\n\n if (tableContext && source.blocks.length == 1 && source.blocks[0] == newTable) {\n const { table: readonlyTable, colIndex, rowIndex } = tableContext;\n const table = mutateBlock(readonlyTable);\n\n const newTableColCount = newTable.rows[0]?.cells.length || 0;\n const newTableRowCount = newTable.rows.length;\n\n const lastTargetColIndex = getTargetColIndex(table, rowIndex, colIndex, newTableColCount);\n const extraColsNeeded = lastTargetColIndex - table.rows[0].cells.length;\n\n newTable.rows.forEach(row => {\n row.cells.forEach(cell => {\n cell.spanAbove = false;\n });\n });\n\n if (extraColsNeeded > 0) {\n const currentColCount = table.rows[0].cells.length;\n for (let col = 0; col < extraColsNeeded; col++) {\n const newColIndex = currentColCount + col;\n for (let k = 0; k < table.rows.length; k++) {\n const leftCell = table.rows[k]?.cells[newColIndex - 1];\n table.rows[k].cells[newColIndex] = createTableCell(\n false /*spanLeft*/,\n false /*spanAbove*/,\n leftCell?.isHeader,\n leftCell?.format\n );\n }\n }\n }\n\n const lastTargetRowIndex = getTargetRowIndex(table, rowIndex, newTableRowCount, colIndex);\n const extraRowsNeeded = lastTargetRowIndex - table.rows.length;\n\n if (extraRowsNeeded > 0) {\n const currentRowCount = table.rows.length;\n const colCount = table.rows[0]?.cells.length || 0;\n for (let row = 0; row < extraRowsNeeded; row++) {\n const newRowIndex = currentRowCount + row;\n table.rows[newRowIndex] = {\n cells: [],\n format: {},\n height: 0,\n };\n for (let k = 0; k < colCount; k++) {\n const aboveCell = table.rows[newRowIndex - 1]?.cells[k];\n table.rows[newRowIndex].cells[k] = createTableCell(\n false /*spanLeft*/,\n false /*spanAbove*/,\n false /*isHeader*/,\n aboveCell?.format\n );\n }\n }\n }\n\n const logicalRowOffsets: number[] = [];\n let logicalRowCount = 0;\n for (let i = 0; i < newTableRowCount; i++) {\n logicalRowOffsets[i] = logicalRowCount;\n const row = newTable.rows[i];\n if (row && row.cells.some(cell => !cell.spanAbove)) {\n logicalRowCount++;\n }\n }\n\n for (let i = 0; i < newTable.rows.length; i++) {\n const sourceRow = newTable.rows[i];\n const targetRowIndex = getTargetRowIndex(\n table,\n rowIndex,\n logicalRowOffsets[i],\n colIndex\n );\n\n const logicalColOffsets: number[] = [];\n let logicalColCount = 0;\n for (let j = 0; j < sourceRow.cells.length; j++) {\n logicalColOffsets[j] = logicalColCount;\n if (!sourceRow.cells[j]?.spanLeft) {\n logicalColCount++;\n }\n }\n\n for (let j = 0; j < newTable.rows[i].cells.length; j++) {\n const newCell = sourceRow.cells[j];\n\n const targetColIndex = getTargetColIndex(\n table,\n targetRowIndex,\n colIndex,\n logicalColOffsets[j]\n );\n\n const oldCell = table.rows[targetRowIndex]?.cells[targetColIndex];\n\n table.rows[targetRowIndex].cells[targetColIndex] = newCell;\n\n if (i == 0 && j == 0) {\n const newMarker = createSelectionMarker(marker.format);\n const newPara = addSegment(newCell, newMarker);\n\n if (markerPosition.path[0] == oldCell) {\n // Update insert point to match the change result\n markerPosition.path[0] = newCell;\n markerPosition.marker = newMarker;\n markerPosition.paragraph = newPara;\n }\n }\n }\n }\n\n normalizeTable(table, markerPosition.marker.format);\n applyTableFormat(table, undefined /*newFormat*/, true /*keepCellShade*/);\n } else {\n insertBlock(markerPosition, newTable);\n }\n}\n\nfunction mergeList(markerPosition: InsertPoint, newList: ContentModelListItem) {\n splitParagraph(markerPosition, newList.format);\n\n const { path, paragraph } = markerPosition;\n\n const listItemIndex = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n const listItem = path[listItemIndex] as ContentModelListItem;\n const listParent = path[listItemIndex + 1]; // It is ok here when index is -1, that means there is no list and we just insert a new paragraph and use path[0] as its parent\n const blockIndex = listParent.blocks.indexOf(listItem || paragraph);\n\n if (blockIndex >= 0) {\n mutateBlock(listParent).blocks.splice(blockIndex, 0, newList);\n }\n\n if (listItem) {\n listItem?.levels.forEach((level, i) => {\n newList.levels[i] = { ...level };\n });\n }\n}\n\nfunction splitParagraph(markerPosition: InsertPoint, newParaFormat: ContentModelBlockFormat) {\n const { paragraph, marker, path } = markerPosition;\n const segmentIndex = paragraph.segments.indexOf(marker);\n const paraIndex = path[0].blocks.indexOf(paragraph);\n const newParagraph: ShallowMutableContentModelParagraph = createParagraph(\n false /*isImplicit*/,\n { ...paragraph.format, ...newParaFormat },\n paragraph.segmentFormat\n );\n\n if (segmentIndex >= 0) {\n newParagraph.segments = paragraph.segments.splice(segmentIndex);\n }\n\n if (paraIndex >= 0) {\n mutateBlock(path[0]).blocks.splice(paraIndex + 1, 0, newParagraph);\n }\n\n const listItemIndex = getClosestAncestorBlockGroupIndex(\n path,\n ['ListItem'],\n ['FormatContainer', 'TableCell']\n );\n const listItem = path[listItemIndex] as ContentModelListItem;\n\n if (listItem) {\n const listParent = listItemIndex >= 0 ? path[listItemIndex + 1] : null;\n const blockIndex = listParent ? listParent.blocks.indexOf(listItem) : -1;\n\n if (blockIndex >= 0 && listParent) {\n const newListItem = createListItem(listItem.levels, listItem.formatHolder.format);\n\n if (paraIndex >= 0) {\n newListItem.blocks = listItem.blocks.splice(paraIndex + 1);\n }\n\n if (blockIndex >= 0) {\n mutateBlock(listParent).blocks.splice(blockIndex + 1, 0, newListItem);\n }\n\n path[listItemIndex] = newListItem;\n }\n }\n\n markerPosition.paragraph = newParagraph;\n\n return newParagraph;\n}\n\nfunction insertBlock(markerPosition: InsertPoint, block: ContentModelBlock) {\n const { path } = markerPosition;\n const newParaFormat = block.blockType !== 'Paragraph' ? {} : block.format;\n const newPara = splitParagraph(markerPosition, newParaFormat);\n const blockIndex = path[0].blocks.indexOf(newPara);\n\n if (blockIndex >= 0) {\n mutateBlock(path[0]).blocks.splice(blockIndex, 0, block);\n }\n}\n\nfunction applyDefaultFormat(\n group: ReadonlyContentModelBlockGroup,\n format: ContentModelSegmentFormat,\n applyDefaultFormatOption: MergeFormatTypes\n) {\n group.blocks.forEach(block => {\n mergeBlockFormat(applyDefaultFormatOption, block);\n\n switch (block.blockType) {\n case 'BlockGroup':\n if (block.blockGroupType == 'ListItem') {\n mutateBlock(block).formatHolder.format = mergeSegmentFormat(\n applyDefaultFormatOption,\n format,\n block.formatHolder.format\n );\n }\n applyDefaultFormat(block, format, applyDefaultFormatOption);\n break;\n\n case 'Table':\n block.rows.forEach(row =>\n row.cells.forEach(cell => {\n applyDefaultFormat(cell, format, applyDefaultFormatOption);\n })\n );\n break;\n\n case 'Paragraph':\n const paragraphFormat = block.decorator?.format || {};\n const paragraph = mutateBlock(block);\n\n paragraph.segments.forEach(segment => {\n if (segment.segmentType == 'General') {\n applyDefaultFormat(segment, format, applyDefaultFormatOption);\n }\n\n segment.format = mergeSegmentFormat(applyDefaultFormatOption, format, {\n ...paragraphFormat,\n ...segment.format,\n });\n\n if (segment.link) {\n segment.link.format = mergeLinkFormat(\n applyDefaultFormatOption,\n format,\n segment.link.format\n );\n }\n });\n\n if (applyDefaultFormatOption === 'keepSourceEmphasisFormat') {\n delete paragraph.decorator;\n }\n break;\n }\n });\n}\n\nfunction mergeBlockFormat(applyDefaultFormatOption: string, block: ReadonlyContentModelBlock) {\n if (applyDefaultFormatOption == 'keepSourceEmphasisFormat' && block.format.backgroundColor) {\n delete mutateBlock(block).format.backgroundColor;\n }\n}\n\n/**\n * Hyperlink format type definition only contains backgroundColor and underline.\n * So create a minimum object with the styles supported in Hyperlink to be used in merge.\n */\nfunction getSegmentFormatInLinkFormat(\n targetFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n const result: ContentModelHyperLinkFormat = {};\n if (targetFormat.backgroundColor) {\n result.backgroundColor = targetFormat.backgroundColor;\n }\n if (targetFormat.underline) {\n result.underline = targetFormat.underline;\n }\n\n return result;\n}\n\nfunction mergeLinkFormat(\n applyDefaultFormatOption: MergeFormatTypes,\n targetFormat: ContentModelSegmentFormat,\n sourceFormat: ContentModelHyperLinkFormat\n) {\n switch (applyDefaultFormatOption) {\n case 'mergeAll':\n case 'preferSource':\n return { ...getSegmentFormatInLinkFormat(targetFormat), ...sourceFormat };\n case 'keepSourceEmphasisFormat':\n return {\n // Hyperlink segment format contains other attributes such as LinkFormat\n // so we have to retain them\n ...getFormatWithoutSegmentFormat(sourceFormat),\n // Link format only have Text color, background color, Underline, but only\n // text color + background color should be merged from the target\n ...getSegmentFormatInLinkFormat(targetFormat),\n // Get the semantic format of the source\n ...getSemanticFormat(sourceFormat),\n // The text color of the hyperlink should not be merged and\n // we should always retain the source text color\n ...getHyperlinkTextColor(sourceFormat),\n };\n case 'preferTarget':\n return { ...sourceFormat, ...getSegmentFormatInLinkFormat(targetFormat) };\n }\n}\n\nfunction mergeSegmentFormat(\n applyDefaultFormatOption: MergeFormatTypes,\n targetFormat: ContentModelSegmentFormat,\n sourceFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n switch (applyDefaultFormatOption) {\n case 'mergeAll':\n case 'preferSource':\n return { ...targetFormat, ...sourceFormat };\n case 'preferTarget':\n return { ...sourceFormat, ...targetFormat };\n case 'keepSourceEmphasisFormat':\n return {\n ...getFormatWithoutSegmentFormat(sourceFormat),\n ...targetFormat,\n ...getSemanticFormat(sourceFormat),\n };\n }\n}\n\nfunction getSemanticFormat(segmentFormat: ContentModelSegmentFormat): ContentModelSegmentFormat {\n const result: ContentModelSegmentFormat = {};\n\n const { fontWeight, italic, underline } = segmentFormat;\n\n if (fontWeight && fontWeight != 'normal') {\n result.fontWeight = fontWeight;\n }\n if (italic) {\n result.italic = italic;\n }\n if (underline) {\n result.underline = underline;\n }\n\n return result;\n}\n\n/**\n * Segment format can also contain other type of metadata, for example in Images/Hyperlink,\n * we want to preserve these properties when merging format\n */\nfunction getFormatWithoutSegmentFormat(\n sourceFormat: ContentModelSegmentFormat\n): ContentModelSegmentFormat {\n const resultFormat = {\n ...sourceFormat,\n };\n KeysOfSegmentFormat.forEach(key => delete resultFormat[key]);\n return resultFormat;\n}\n\nfunction getHyperlinkTextColor(sourceFormat: ContentModelHyperLinkFormat) {\n const result: ContentModelHyperLinkFormat = {};\n if (sourceFormat.textColor) {\n result.textColor = sourceFormat.textColor;\n }\n\n return result;\n}\n\nfunction getTargetColIndex(\n table: ReadonlyContentModelTable,\n rowIndex: number,\n startColIndex: number,\n offset: number\n): number {\n const row = table.rows[rowIndex];\n if (!row) {\n return startColIndex + offset;\n }\n\n if (offset === 0) {\n return startColIndex;\n }\n\n let targetColIndex = startColIndex;\n let logicalCellsToSkip = offset;\n\n while (logicalCellsToSkip > 0) {\n targetColIndex++;\n\n if (targetColIndex >= row.cells.length) {\n logicalCellsToSkip--;\n } else if (!row.cells[targetColIndex].spanLeft) {\n logicalCellsToSkip--;\n }\n }\n\n return targetColIndex;\n}\n\nfunction getTargetRowIndex(\n table: ReadonlyContentModelTable,\n startRowIndex: number,\n offset: number,\n colIndex: number\n): number {\n if (offset === 0) {\n return startRowIndex;\n }\n\n let targetRowIndex = startRowIndex;\n let logicalRowsToSkip = offset;\n\n while (logicalRowsToSkip > 0) {\n targetRowIndex++;\n\n if (targetRowIndex >= table.rows.length) {\n logicalRowsToSkip--;\n } else if (!table.rows[targetRowIndex]?.cells[colIndex]?.spanAbove) {\n logicalRowsToSkip--;\n }\n }\n\n return targetRowIndex;\n}\n"]}
|
|
@@ -72,6 +72,10 @@ define(["require", "exports"], function (require, exports) {
|
|
|
72
72
|
* Content changed by replace
|
|
73
73
|
*/
|
|
74
74
|
Replace: 'Replace',
|
|
75
|
+
/**
|
|
76
|
+
* Content changed by dragging content out the editor
|
|
77
|
+
*/
|
|
78
|
+
DragOutOfEditor: 'DragOutOfEditor',
|
|
75
79
|
};
|
|
76
80
|
});
|
|
77
81
|
//# sourceMappingURL=ChangeSource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeSource.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-dom/lib/constants/ChangeSource.ts"],"names":[],"mappings":";;;;IAAA;;;OAGG;IACU,QAAA,YAAY,GAAG;QACxB;;WAEG;QACH,QAAQ,EAAE,UAAU;QACpB;;WAEG;QACH,UAAU,EAAE,YAAY;QACxB;;WAEG;QACH,MAAM,EAAE,QAAQ;QAChB;;WAEG;QACH,WAAW,EAAE,aAAa;QAC1B;;WAEG;QACH,KAAK,EAAE,OAAO;QACd;;WAEG;QACH,sBAAsB,EAAE,wBAAwB;QAChD;;WAEG;QACH,UAAU,EAAE,YAAY;QACxB;;WAEG;QACH,GAAG,EAAE,KAAK;QACV;;WAEG;QACH,IAAI,EAAE,MAAM;QACZ;;WAEG;QACH,YAAY,EAAE,cAAc;QAC5B;;WAEG;QACH,gBAAgB,EAAE,kBAAkB;QACpC;;WAEG;QACH,iBAAiB,EAAE,mBAAmB;QACtC;;WAEG;QACH,SAAS,EAAE,WAAW;QACtB;;;WAGG;QACH,QAAQ,EAAE,UAAU;QAEpB;;WAEG;QACH,UAAU,EAAE,YAAY;QAExB;;WAEG;QACH,OAAO,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"ChangeSource.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-dom/lib/constants/ChangeSource.ts"],"names":[],"mappings":";;;;IAAA;;;OAGG;IACU,QAAA,YAAY,GAAG;QACxB;;WAEG;QACH,QAAQ,EAAE,UAAU;QACpB;;WAEG;QACH,UAAU,EAAE,YAAY;QACxB;;WAEG;QACH,MAAM,EAAE,QAAQ;QAChB;;WAEG;QACH,WAAW,EAAE,aAAa;QAC1B;;WAEG;QACH,KAAK,EAAE,OAAO;QACd;;WAEG;QACH,sBAAsB,EAAE,wBAAwB;QAChD;;WAEG;QACH,UAAU,EAAE,YAAY;QACxB;;WAEG;QACH,GAAG,EAAE,KAAK;QACV;;WAEG;QACH,IAAI,EAAE,MAAM;QACZ;;WAEG;QACH,YAAY,EAAE,cAAc;QAC5B;;WAEG;QACH,gBAAgB,EAAE,kBAAkB;QACpC;;WAEG;QACH,iBAAiB,EAAE,mBAAmB;QACtC;;WAEG;QACH,SAAS,EAAE,WAAW;QACtB;;;WAGG;QACH,QAAQ,EAAE,UAAU;QAEpB;;WAEG;QACH,UAAU,EAAE,YAAY;QAExB;;WAEG;QACH,OAAO,EAAE,SAAS;QAElB;;WAEG;QACH,eAAe,EAAE,iBAAiB;KACrC,CAAC","sourcesContent":["/**\n * Possible change sources. Here are the predefined sources.\n * It can also be other string if the change source can't fall into these sources.\n */\nexport const ChangeSource = {\n /**\n * Content changed by auto link\n */\n AutoLink: 'AutoLink',\n /**\n * Content changed by create link\n */\n CreateLink: 'CreateLink',\n /**\n * Content changed by format\n */\n Format: 'Format',\n /**\n * Content changed by image resize\n */\n ImageResize: 'ImageResize',\n /**\n * Content changed by paste\n */\n Paste: 'Paste',\n /**\n * Content changed by auto markdown conversion\n */\n AutoMarkdownConversion: 'AutoMarkdownConversion',\n /**\n * Content changed by setContent API\n */\n SetContent: 'SetContent',\n /**\n * Content changed by cut operation\n */\n Cut: 'Cut',\n /**\n * Content changed by drag & drop operation\n */\n Drop: 'Drop',\n /**\n * Insert a new entity into editor\n */\n InsertEntity: 'InsertEntity',\n /**\n * Editor is switched to dark mode, content color is changed\n */\n SwitchToDarkMode: 'SwitchToDarkMode',\n /**\n * Editor is switched to light mode, content color is changed\n */\n SwitchToLightMode: 'SwitchToLightMode',\n /**\n * List chain reorganized numbers of lists\n */\n ListChain: 'ListChain',\n /**\n * Keyboard event, used by Content Model.\n * Data of this event will be the key code number\n */\n Keyboard: 'Keyboard',\n\n /**\n * Content changed by auto format\n */\n AutoFormat: 'AutoFormat',\n\n /**\n * Content changed by replace\n */\n Replace: 'Replace',\n\n /**\n * Content changed by dragging content out the editor\n */\n DragOutOfEditor: 'DragOutOfEditor',\n};\n"]}
|
|
@@ -28,6 +28,7 @@ define(["require", "exports", "../processors/brProcessor", "../processors/childP
|
|
|
28
28
|
h5: headingProcessor_1.headingProcessor,
|
|
29
29
|
h6: headingProcessor_1.headingProcessor,
|
|
30
30
|
hr: hrProcessor_1.hrProcessor,
|
|
31
|
+
label: knownElementProcessor_1.knownElementProcessor,
|
|
31
32
|
li: listItemProcessor_1.listItemProcessor,
|
|
32
33
|
ol: listProcessor_1.listProcessor,
|
|
33
34
|
p: pProcessor_1.pProcessor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultProcessors.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/context/defaultProcessors.ts"],"names":[],"mappings":";;;;IAuBA;;OAEG;IACU,QAAA,mBAAmB,GAAwB;QACpD,CAAC,EAAE,6BAAa;QAChB,CAAC,EAAE,6CAAqB;QACxB,UAAU,EAAE,6CAAqB;QACjC,EAAE,EAAE,yBAAW;QACf,IAAI,EAAE,6BAAa;QACnB,IAAI,EAAE,6BAAa;QACnB,EAAE,EAAE,mDAAwB;QAC5B,GAAG,EAAE,6CAAqB;QAC1B,GAAG,EAAE,6CAAqB;QAC1B,EAAE,EAAE,mDAAwB;QAC5B,EAAE,EAAE,mDAAwB;QAC5B,EAAE,EAAE,6CAAqB;QACzB,IAAI,EAAE,6BAAa;QACnB,CAAC,EAAE,6CAAqB;QACxB,GAAG,EAAE,+BAAc;QACnB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,yBAAW;QACf,EAAE,EAAE,qCAAiB;QACrB,EAAE,EAAE,6BAAa;QACjB,CAAC,EAAE,uBAAU;QACb,GAAG,EAAE,mDAAwB;QAC7B,CAAC,EAAE,6CAAqB;QACxB,OAAO,EAAE,6CAAqB;QAC9B,IAAI,EAAE,6CAAqB;QAC3B,MAAM,EAAE,6CAAqB;QAC7B,MAAM,EAAE,6CAAqB;QAC7B,GAAG,EAAE,6CAAqB;QAC1B,GAAG,EAAE,6CAAqB;QAC1B,KAAK,EAAE,+BAAc;QACrB,CAAC,EAAE,6CAAqB;QACxB,EAAE,EAAE,6BAAa;QAEjB,GAAG,EAAE,mCAAgB;QACrB,OAAO,EAAE,6BAAa;QACtB,iBAAiB,EAAE,uDAA0B;QAC7C,OAAO,EAAE,mCAAgB;QACzB,MAAM,EAAE,iCAAe;QACvB,KAAK,EAAE,+BAAc;QACrB,SAAS,EAAE,uCAAkB;KAChC,CAAC","sourcesContent":["import { brProcessor } from '../processors/brProcessor';\nimport { childProcessor } from '../processors/childProcessor';\nimport { codeProcessor } from '../processors/codeProcessor';\nimport { dataProcessor } from '../processors/dataProcessor';\nimport { delimiterProcessor } from '../processors/delimiterProcessor';\nimport { elementProcessor } from '../processors/elementProcessor';\nimport { entityProcessor } from '../processors/entityProcessor';\nimport { fontProcessor } from '../processors/fontProcessor';\nimport { formatContainerProcessor } from '../processors/formatContainerProcessor';\nimport { generalProcessor } from '../processors/generalProcessor';\nimport { headingProcessor } from '../processors/headingProcessor';\nimport { hrProcessor } from '../processors/hrProcessor';\nimport { imageProcessor } from '../processors/imageProcessor';\nimport { knownElementProcessor } from '../processors/knownElementProcessor';\nimport { linkProcessor } from '../processors/linkProcessor';\nimport { listItemProcessor } from '../processors/listItemProcessor';\nimport { listProcessor } from '../processors/listProcessor';\nimport { pProcessor } from '../processors/pProcessor';\nimport { tableProcessor } from '../processors/tableProcessor';\nimport { textProcessor } from '../processors/textProcessor';\nimport { textWithSelectionProcessor } from '../processors/textWithSelectionProcessor';\nimport type { ElementProcessorMap } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const defaultProcessorMap: ElementProcessorMap = {\n a: linkProcessor,\n b: knownElementProcessor,\n blockquote: knownElementProcessor,\n br: brProcessor,\n code: codeProcessor,\n data: dataProcessor,\n dd: formatContainerProcessor,\n del: knownElementProcessor,\n div: knownElementProcessor,\n dl: formatContainerProcessor,\n dt: formatContainerProcessor,\n em: knownElementProcessor,\n font: fontProcessor,\n i: knownElementProcessor,\n img: imageProcessor,\n h1: headingProcessor,\n h2: headingProcessor,\n h3: headingProcessor,\n h4: headingProcessor,\n h5: headingProcessor,\n h6: headingProcessor,\n hr: hrProcessor,\n li: listItemProcessor,\n ol: listProcessor,\n p: pProcessor,\n pre: formatContainerProcessor,\n s: knownElementProcessor,\n section: knownElementProcessor,\n span: knownElementProcessor,\n strike: knownElementProcessor,\n strong: knownElementProcessor,\n sub: knownElementProcessor,\n sup: knownElementProcessor,\n table: tableProcessor,\n u: knownElementProcessor,\n ul: listProcessor,\n\n '*': generalProcessor,\n '#text': textProcessor,\n textWithSelection: textWithSelectionProcessor,\n element: elementProcessor,\n entity: entityProcessor,\n child: childProcessor,\n delimiter: delimiterProcessor,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"defaultProcessors.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/context/defaultProcessors.ts"],"names":[],"mappings":";;;;IAuBA;;OAEG;IACU,QAAA,mBAAmB,GAAwB;QACpD,CAAC,EAAE,6BAAa;QAChB,CAAC,EAAE,6CAAqB;QACxB,UAAU,EAAE,6CAAqB;QACjC,EAAE,EAAE,yBAAW;QACf,IAAI,EAAE,6BAAa;QACnB,IAAI,EAAE,6BAAa;QACnB,EAAE,EAAE,mDAAwB;QAC5B,GAAG,EAAE,6CAAqB;QAC1B,GAAG,EAAE,6CAAqB;QAC1B,EAAE,EAAE,mDAAwB;QAC5B,EAAE,EAAE,mDAAwB;QAC5B,EAAE,EAAE,6CAAqB;QACzB,IAAI,EAAE,6BAAa;QACnB,CAAC,EAAE,6CAAqB;QACxB,GAAG,EAAE,+BAAc;QACnB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,yBAAW;QACf,KAAK,EAAE,6CAAqB;QAC5B,EAAE,EAAE,qCAAiB;QACrB,EAAE,EAAE,6BAAa;QACjB,CAAC,EAAE,uBAAU;QACb,GAAG,EAAE,mDAAwB;QAC7B,CAAC,EAAE,6CAAqB;QACxB,OAAO,EAAE,6CAAqB;QAC9B,IAAI,EAAE,6CAAqB;QAC3B,MAAM,EAAE,6CAAqB;QAC7B,MAAM,EAAE,6CAAqB;QAC7B,GAAG,EAAE,6CAAqB;QAC1B,GAAG,EAAE,6CAAqB;QAC1B,KAAK,EAAE,+BAAc;QACrB,CAAC,EAAE,6CAAqB;QACxB,EAAE,EAAE,6BAAa;QAEjB,GAAG,EAAE,mCAAgB;QACrB,OAAO,EAAE,6BAAa;QACtB,iBAAiB,EAAE,uDAA0B;QAC7C,OAAO,EAAE,mCAAgB;QACzB,MAAM,EAAE,iCAAe;QACvB,KAAK,EAAE,+BAAc;QACrB,SAAS,EAAE,uCAAkB;KAChC,CAAC","sourcesContent":["import { brProcessor } from '../processors/brProcessor';\nimport { childProcessor } from '../processors/childProcessor';\nimport { codeProcessor } from '../processors/codeProcessor';\nimport { dataProcessor } from '../processors/dataProcessor';\nimport { delimiterProcessor } from '../processors/delimiterProcessor';\nimport { elementProcessor } from '../processors/elementProcessor';\nimport { entityProcessor } from '../processors/entityProcessor';\nimport { fontProcessor } from '../processors/fontProcessor';\nimport { formatContainerProcessor } from '../processors/formatContainerProcessor';\nimport { generalProcessor } from '../processors/generalProcessor';\nimport { headingProcessor } from '../processors/headingProcessor';\nimport { hrProcessor } from '../processors/hrProcessor';\nimport { imageProcessor } from '../processors/imageProcessor';\nimport { knownElementProcessor } from '../processors/knownElementProcessor';\nimport { linkProcessor } from '../processors/linkProcessor';\nimport { listItemProcessor } from '../processors/listItemProcessor';\nimport { listProcessor } from '../processors/listProcessor';\nimport { pProcessor } from '../processors/pProcessor';\nimport { tableProcessor } from '../processors/tableProcessor';\nimport { textProcessor } from '../processors/textProcessor';\nimport { textWithSelectionProcessor } from '../processors/textWithSelectionProcessor';\nimport type { ElementProcessorMap } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const defaultProcessorMap: ElementProcessorMap = {\n a: linkProcessor,\n b: knownElementProcessor,\n blockquote: knownElementProcessor,\n br: brProcessor,\n code: codeProcessor,\n data: dataProcessor,\n dd: formatContainerProcessor,\n del: knownElementProcessor,\n div: knownElementProcessor,\n dl: formatContainerProcessor,\n dt: formatContainerProcessor,\n em: knownElementProcessor,\n font: fontProcessor,\n i: knownElementProcessor,\n img: imageProcessor,\n h1: headingProcessor,\n h2: headingProcessor,\n h3: headingProcessor,\n h4: headingProcessor,\n h5: headingProcessor,\n h6: headingProcessor,\n hr: hrProcessor,\n label: knownElementProcessor,\n li: listItemProcessor,\n ol: listProcessor,\n p: pProcessor,\n pre: formatContainerProcessor,\n s: knownElementProcessor,\n section: knownElementProcessor,\n span: knownElementProcessor,\n strike: knownElementProcessor,\n strong: knownElementProcessor,\n sub: knownElementProcessor,\n sup: knownElementProcessor,\n table: tableProcessor,\n u: knownElementProcessor,\n ul: listProcessor,\n\n '*': generalProcessor,\n '#text': textProcessor,\n textWithSelection: textWithSelectionProcessor,\n element: elementProcessor,\n entity: entityProcessor,\n child: childProcessor,\n delimiter: delimiterProcessor,\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClipboardData, PasteType } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a document fragment from clipboard content using the specified paste type
|
|
4
|
+
* @param document The document used to create the fragment
|
|
5
|
+
* @param clipboardData The clipboard data to convert
|
|
6
|
+
* @param pasteType The paste type that determines which clipboard content to use
|
|
7
|
+
* @param root The optional root element containing the parsed HTML content
|
|
8
|
+
* @returns A document fragment containing the content to paste
|
|
9
|
+
*/
|
|
10
|
+
export declare function createPasteFragment(document: Document, clipboardData: ClipboardData, pasteType: PasteType, root: HTMLElement | undefined): DocumentFragment;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
define(["require", "exports", "../moveChildNodes", "../textToFragment"], function (require, exports, moveChildNodes_1, textToFragment_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createPasteFragment = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Create a document fragment from clipboard content using the specified paste type
|
|
7
|
+
* @param document The document used to create the fragment
|
|
8
|
+
* @param clipboardData The clipboard data to convert
|
|
9
|
+
* @param pasteType The paste type that determines which clipboard content to use
|
|
10
|
+
* @param root The optional root element containing the parsed HTML content
|
|
11
|
+
* @returns A document fragment containing the content to paste
|
|
12
|
+
*/
|
|
13
|
+
function createPasteFragment(document, clipboardData, pasteType, root) {
|
|
14
|
+
if (!clipboardData.text && pasteType === 'asPlainText' && root) {
|
|
15
|
+
clipboardData.text = root.textContent || clipboardData.text;
|
|
16
|
+
}
|
|
17
|
+
var imageDataUri = clipboardData.imageDataUri, text = clipboardData.text;
|
|
18
|
+
var fragment = document.createDocumentFragment();
|
|
19
|
+
if ((pasteType == 'asImage' && imageDataUri) ||
|
|
20
|
+
(pasteType != 'asPlainText' && !text && imageDataUri)) {
|
|
21
|
+
// Paste image
|
|
22
|
+
var img = document.createElement('img');
|
|
23
|
+
img.style.maxWidth = '100%';
|
|
24
|
+
img.src = imageDataUri;
|
|
25
|
+
fragment.appendChild(img);
|
|
26
|
+
}
|
|
27
|
+
else if (pasteType != 'asPlainText' && root) {
|
|
28
|
+
(0, moveChildNodes_1.moveChildNodes)(fragment, root);
|
|
29
|
+
}
|
|
30
|
+
else if (text) {
|
|
31
|
+
return (0, textToFragment_1.textToFragment)(text, document);
|
|
32
|
+
}
|
|
33
|
+
return fragment;
|
|
34
|
+
}
|
|
35
|
+
exports.createPasteFragment = createPasteFragment;
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=createPasteFragment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPasteFragment.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domUtils/event/createPasteFragment.ts"],"names":[],"mappings":";;;;IAIA;;;;;;;OAOG;IACH,SAAgB,mBAAmB,CAC/B,QAAkB,EAClB,aAA4B,EAC5B,SAAoB,EACpB,IAA6B;QAE7B,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,SAAS,KAAK,aAAa,IAAI,IAAI,EAAE;YAC5D,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,IAAI,aAAa,CAAC,IAAI,CAAC;SAC/D;QAEO,IAAA,YAAY,GAAW,aAAa,aAAxB,EAAE,IAAI,GAAK,aAAa,KAAlB,CAAmB;QAC7C,IAAM,QAAQ,GAAG,QAAQ,CAAC,sBAAsB,EAAE,CAAC;QAEnD,IACI,CAAC,SAAS,IAAI,SAAS,IAAI,YAAY,CAAC;YACxC,CAAC,SAAS,IAAI,aAAa,IAAI,CAAC,IAAI,IAAI,YAAY,CAAC,EACvD;YACE,cAAc;YACd,IAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC1C,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;YAC5B,GAAG,CAAC,GAAG,GAAG,YAAY,CAAC;YACvB,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;SAC7B;aAAM,IAAI,SAAS,IAAI,aAAa,IAAI,IAAI,EAAE;YAC3C,IAAA,+BAAc,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;SAClC;aAAM,IAAI,IAAI,EAAE;YACb,OAAO,IAAA,+BAAc,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SACzC;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IA7BD,kDA6BC","sourcesContent":["import type { ClipboardData, PasteType } from 'roosterjs-content-model-types';\nimport { moveChildNodes } from '../moveChildNodes';\nimport { textToFragment } from '../textToFragment';\n\n/**\n * Create a document fragment from clipboard content using the specified paste type\n * @param document The document used to create the fragment\n * @param clipboardData The clipboard data to convert\n * @param pasteType The paste type that determines which clipboard content to use\n * @param root The optional root element containing the parsed HTML content\n * @returns A document fragment containing the content to paste\n */\nexport function createPasteFragment(\n document: Document,\n clipboardData: ClipboardData,\n pasteType: PasteType,\n root: HTMLElement | undefined\n): DocumentFragment {\n if (!clipboardData.text && pasteType === 'asPlainText' && root) {\n clipboardData.text = root.textContent || clipboardData.text;\n }\n\n const { imageDataUri, text } = clipboardData;\n const fragment = document.createDocumentFragment();\n\n if (\n (pasteType == 'asImage' && imageDataUri) ||\n (pasteType != 'asPlainText' && !text && imageDataUri)\n ) {\n // Paste image\n const img = document.createElement('img');\n img.style.maxWidth = '100%';\n img.src = imageDataUri;\n fragment.appendChild(img);\n } else if (pasteType != 'asPlainText' && root) {\n moveChildNodes(fragment, root);\n } else if (text) {\n return textToFragment(text, document);\n }\n\n return fragment;\n}\n"]}
|
|
@@ -14,14 +14,14 @@ define(["require", "exports"], function (require, exports) {
|
|
|
14
14
|
// Firefox, Chrome, Edge, Safari, Opera
|
|
15
15
|
var pos = doc.caretPositionFromPoint(x, y);
|
|
16
16
|
if (pos && domHelper.isNodeInEditor(pos.offsetNode)) {
|
|
17
|
-
return
|
|
17
|
+
return normalizePosition(pos.offsetNode, pos.offset);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
if (doc.caretRangeFromPoint) {
|
|
21
21
|
// Safari
|
|
22
22
|
var range = doc.caretRangeFromPoint(x, y);
|
|
23
23
|
if (range && domHelper.isNodeInEditor(range.startContainer)) {
|
|
24
|
-
return
|
|
24
|
+
return normalizePosition(range.startContainer, range.startOffset);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
if (doc.elementFromPoint) {
|
|
@@ -34,5 +34,13 @@ define(["require", "exports"], function (require, exports) {
|
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
exports.getNodePositionFromEvent = getNodePositionFromEvent;
|
|
37
|
+
function normalizePosition(node, offset) {
|
|
38
|
+
var _a;
|
|
39
|
+
// Safari hit-testing in tableMoverTest returns offset 1 after the lone BR of an empty block.
|
|
40
|
+
var normalizedOffset = offset == 1 && node.childNodes.length == 1 && ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.nodeName) == 'BR'
|
|
41
|
+
? 0
|
|
42
|
+
: offset;
|
|
43
|
+
return { node: node, offset: normalizedOffset };
|
|
44
|
+
}
|
|
37
45
|
});
|
|
38
46
|
//# sourceMappingURL=getNodePositionFromEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNodePositionFromEvent.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domUtils/event/getNodePositionFromEvent.ts"],"names":[],"mappings":";;;;IAEA;;;;;;OAMG;IACH,SAAgB,wBAAwB,CACpC,GAAa,EACb,SAAoB,EACpB,CAAS,EACT,CAAS;QAET,IAAI,wBAAwB,IAAI,GAAG,EAAE;YACjC,uCAAuC;YACvC,IAAM,GAAG,GAAI,GAAW,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACtD,IAAI,GAAG,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;gBACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"getNodePositionFromEvent.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domUtils/event/getNodePositionFromEvent.ts"],"names":[],"mappings":";;;;IAEA;;;;;;OAMG;IACH,SAAgB,wBAAwB,CACpC,GAAa,EACb,SAAoB,EACpB,CAAS,EACT,CAAS;QAET,IAAI,wBAAwB,IAAI,GAAG,EAAE;YACjC,uCAAuC;YACvC,IAAM,GAAG,GAAI,GAAW,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACtD,IAAI,GAAG,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;gBACjD,OAAO,iBAAiB,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;aACxD;SACJ;QAED,IAAI,GAAG,CAAC,mBAAmB,EAAE;YACzB,SAAS;YACT,IAAM,KAAK,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5C,IAAI,KAAK,IAAI,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;gBACzD,OAAO,iBAAiB,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;aACrE;SACJ;QAED,IAAI,GAAG,CAAC,gBAAgB,EAAE;YACtB,WAAW;YACX,IAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3C,IAAI,OAAO,IAAI,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;gBAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;aACvC;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IA/BD,4DA+BC;IAED,SAAS,iBAAiB,CAAC,IAAU,EAAE,MAAc;;QACjD,6FAA6F;QAC7F,IAAM,gBAAgB,GAClB,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,IAAI,CAAA,MAAA,IAAI,CAAC,UAAU,0CAAE,QAAQ,KAAI,IAAI;YAC3E,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,MAAM,CAAC;QAEjB,OAAO,EAAE,IAAI,MAAA,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC9C,CAAC","sourcesContent":["import type { DOMHelper, DOMInsertPoint } from 'roosterjs-content-model-types';\n\n/**\n * Get insertion point from coordinate.\n * @param doc Parent document object\n * @param domHelper The DOM helper of the editor\n * @param x The cursor coordinate for the x-axis\n * @param y The cursor coordinate for the y-axis\n */\nexport function getNodePositionFromEvent(\n doc: Document,\n domHelper: DOMHelper,\n x: number,\n y: number\n): DOMInsertPoint | null {\n if ('caretPositionFromPoint' in doc) {\n // Firefox, Chrome, Edge, Safari, Opera\n const pos = (doc as any).caretPositionFromPoint(x, y);\n if (pos && domHelper.isNodeInEditor(pos.offsetNode)) {\n return normalizePosition(pos.offsetNode, pos.offset);\n }\n }\n\n if (doc.caretRangeFromPoint) {\n // Safari\n const range = doc.caretRangeFromPoint(x, y);\n if (range && domHelper.isNodeInEditor(range.startContainer)) {\n return normalizePosition(range.startContainer, range.startOffset);\n }\n }\n\n if (doc.elementFromPoint) {\n // Fallback\n const element = doc.elementFromPoint(x, y);\n if (element && domHelper.isNodeInEditor(element)) {\n return { node: element, offset: 0 };\n }\n }\n\n return null;\n}\n\nfunction normalizePosition(node: Node, offset: number): DOMInsertPoint {\n // Safari hit-testing in tableMoverTest returns offset 1 after the lone BR of an empty block.\n const normalizedOffset =\n offset == 1 && node.childNodes.length == 1 && node.firstChild?.nodeName == 'BR'\n ? 0\n : offset;\n\n return { node, offset: normalizedOffset };\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
define(["require", "exports", "./wrap"], function (require, exports, wrap_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.textToFragment = void 0;
|
|
5
|
+
var NBSP_HTML = '\u00A0';
|
|
6
|
+
var ENSP_HTML = '\u2002';
|
|
7
|
+
var TAB_SPACES = 6;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
function textToFragment(text, doc) {
|
|
12
|
+
var fragment = doc.createDocumentFragment();
|
|
13
|
+
text.split('\n').forEach(function (line, index, lines) {
|
|
14
|
+
line = line
|
|
15
|
+
.replace(/^ /g, NBSP_HTML)
|
|
16
|
+
.replace(/ $/g, NBSP_HTML)
|
|
17
|
+
.replace(/\r/g, '')
|
|
18
|
+
.replace(/ {2}/g, ' ' + NBSP_HTML);
|
|
19
|
+
if (line.includes('\t')) {
|
|
20
|
+
line = transformTabCharacters(line);
|
|
21
|
+
}
|
|
22
|
+
var textNode = doc.createTextNode(line);
|
|
23
|
+
// There are 3 scenarios:
|
|
24
|
+
// 1. Single line: Paste as it is
|
|
25
|
+
// 2. Two lines: Add <br> between the lines
|
|
26
|
+
// 3. 3 or More lines, For first and last line, paste as it is. For middle lines, wrap with DIV, and add BR if it is empty line
|
|
27
|
+
if (lines.length == 2 && index == 0) {
|
|
28
|
+
// 1 of 2 lines scenario, add BR
|
|
29
|
+
fragment.appendChild(textNode);
|
|
30
|
+
fragment.appendChild(doc.createElement('br'));
|
|
31
|
+
}
|
|
32
|
+
else if (index > 0 && index < lines.length - 1) {
|
|
33
|
+
// Middle line of >=3 lines scenario, wrap with DIV
|
|
34
|
+
fragment.appendChild((0, wrap_1.wrap)(doc, line == '' ? doc.createElement('br') : textNode, 'div'));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// All others, paste as it is
|
|
38
|
+
fragment.appendChild(textNode);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return fragment;
|
|
42
|
+
}
|
|
43
|
+
exports.textToFragment = textToFragment;
|
|
44
|
+
/**
|
|
45
|
+
* Transform \t characters into EN SPACE characters
|
|
46
|
+
* @param input string NOT containing \n characters
|
|
47
|
+
* @example t("\thello", 2) => "    hello"
|
|
48
|
+
*/
|
|
49
|
+
function transformTabCharacters(input, initialOffset) {
|
|
50
|
+
if (initialOffset === void 0) { initialOffset = 0; }
|
|
51
|
+
var line = input;
|
|
52
|
+
var tIndex;
|
|
53
|
+
while ((tIndex = line.indexOf('\t')) != -1) {
|
|
54
|
+
var lineBefore = line.slice(0, tIndex);
|
|
55
|
+
var lineAfter = line.slice(tIndex + 1);
|
|
56
|
+
var tabCount = TAB_SPACES - ((lineBefore.length + initialOffset) % TAB_SPACES);
|
|
57
|
+
var tabStr = Array(tabCount).fill(ENSP_HTML).join('');
|
|
58
|
+
line = lineBefore + tabStr + lineAfter;
|
|
59
|
+
}
|
|
60
|
+
return line;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=textToFragment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textToFragment.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-dom/lib/domUtils/textToFragment.ts"],"names":[],"mappings":";;;;IAEA,IAAM,SAAS,GAAG,QAAQ,CAAC;IAC3B,IAAM,SAAS,GAAG,QAAQ,CAAC;IAC3B,IAAM,UAAU,GAAG,CAAC,CAAC;IAErB;;OAEG;IACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAa;QACtD,IAAM,QAAQ,GAAG,GAAG,CAAC,sBAAsB,EAAE,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,KAAK,EAAE,KAAK;YACxC,IAAI,GAAG,IAAI;iBACN,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;iBACzB,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;iBACzB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;iBAClB,OAAO,CAAC,OAAO,EAAE,GAAG,GAAG,SAAS,CAAC,CAAC;YAEvC,IAAI,IA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ACzC,IAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACzC,IAAM,QAAQ,GAAG,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,UAAU,CAAC,CAAC;YACjF,IAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACxD,IAAI,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;SAC1C;QACD,OAAO,IAAI,CAAC;IAChB,CAAC","sourcesContent":["import { wrap } from './wrap';\n\nconst NBSP_HTML = '\\u00A0';\nconst ENSP_HTML = '\\u2002';\nconst TAB_SPACES = 6;\n\n/**\n * @internal\n */\nexport function textToFragment(text: string, doc: Document): DocumentFragment {\n const fragment = doc.createDocumentFragment();\n text.split('\\n').forEach((line, index, lines) => {\n line = line\n .replace(/^ /g, NBSP_HTML)\n .replace(/ $/g, NBSP_HTML)\n .replace(/\\r/g, '')\n .replace(/ {2}/g, ' ' + NBSP_HTML);\n\n if (line.includes('\\t')) {\n line = transformTabCharacters(line);\n }\n\n const textNode = doc.createTextNode(line);\n\n // There are 3 scenarios:\n // 1. Single line: Paste as it is\n // 2. Two lines: Add <br> between the lines\n // 3. 3 or More lines, For first and last line, paste as it is. For middle lines, wrap with DIV, and add BR if it is empty line\n if (lines.length == 2 && index == 0) {\n // 1 of 2 lines scenario, add BR\n fragment.appendChild(textNode);\n fragment.appendChild(doc.createElement('br'));\n } else if (index > 0 && index < lines.length - 1) {\n // Middle line of >=3 lines scenario, wrap with DIV\n fragment.appendChild(wrap(doc, line == '' ? doc.createElement('br') : textNode, 'div'));\n } else {\n // All others, paste as it is\n fragment.appendChild(textNode);\n }\n });\n return fragment;\n}\n\n/**\n * Transform \\t characters into EN SPACE characters\n * @param input string NOT containing \\n characters\n * @example t(\"\\thello\", 2) => \"    hello\"\n */\nfunction transformTabCharacters(input: string, initialOffset: number = 0) {\n let line = input;\n let tIndex: number;\n while ((tIndex = line.indexOf('\\t')) != -1) {\n const lineBefore = line.slice(0, tIndex);\n const lineAfter = line.slice(tIndex + 1);\n const tabCount = TAB_SPACES - ((lineBefore.length + initialOffset) % TAB_SPACES);\n const tabStr = Array(tabCount).fill(ENSP_HTML).join('');\n line = lineBefore + tabStr + lineAfter;\n }\n return line;\n}\n"]}
|
package/lib-amd/index.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export { retrieveDocumentMetadata } from './domUtils/retrieveDocumentMetadata';
|
|
|
81
81
|
export { transformColor, TransformColorOptions } from './domUtils/style/transformColor';
|
|
82
82
|
export { normalizeFontFamily } from './domUtils/style/normalizeFontFamily';
|
|
83
83
|
export { extractClipboardItems } from './domUtils/event/extractClipboardItems';
|
|
84
|
+
export { createPasteFragment } from './domUtils/event/createPasteFragment';
|
|
84
85
|
export { cacheGetEventData } from './domUtils/event/cacheGetEventData';
|
|
85
86
|
export { setParagraphMarker, getParagraphMarker, } from './domUtils/hiddenProperties/paragraphMarker';
|
|
86
87
|
export { setImageState, getImageState } from './domUtils/hiddenProperties/imageState';
|
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/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/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, 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, 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/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/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, 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.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.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.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;
|
|
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; } });
|
|
@@ -118,6 +118,7 @@ define(["require", "exports", "./domToModel/domToContentModel", "./modelToDom/co
|
|
|
118
118
|
Object.defineProperty(exports, "transformColor", { enumerable: true, get: function () { return transformColor_1.transformColor; } });
|
|
119
119
|
Object.defineProperty(exports, "normalizeFontFamily", { enumerable: true, get: function () { return normalizeFontFamily_1.normalizeFontFamily; } });
|
|
120
120
|
Object.defineProperty(exports, "extractClipboardItems", { enumerable: true, get: function () { return extractClipboardItems_1.extractClipboardItems; } });
|
|
121
|
+
Object.defineProperty(exports, "createPasteFragment", { enumerable: true, get: function () { return createPasteFragment_1.createPasteFragment; } });
|
|
121
122
|
Object.defineProperty(exports, "cacheGetEventData", { enumerable: true, get: function () { return cacheGetEventData_1.cacheGetEventData; } });
|
|
122
123
|
Object.defineProperty(exports, "setParagraphMarker", { enumerable: true, get: function () { return paragraphMarker_1.setParagraphMarker; } });
|
|
123
124
|
Object.defineProperty(exports, "getParagraphMarker", { enumerable: true, get: function () { return paragraphMarker_1.getParagraphMarker; } });
|