Skip to content

Commit faaedb6

Browse files
feat: initial support for multi-column; lists and media fixes(Copy/paste project) (#2528)
* feat: initial support for multi-column; lists and media fixes * fix: build error * fix: address codex review comments * fix: remove duplicated functions and improve html parsing * test: add behavior tests for SuperDoc-to-SuperDoc copy-paste (SD-148) - Copy-paste preserves inline formatting (bold) - Copy-paste preserves list structure - Cut removes content, paste restores it - Pasted block identities are stripped (no duplicate paraId/sdBlockId) - Copy-paste preserves images from multi-format document (PNG, JPG, BMP, GIF, TIFF) - Image path collision triggers rename to avoid overwriting existing media * test: add unit tests for clipboard embed/extract round-trip and slice paste guard (SD-148) - embedSliceInHtml/extractSliceFromHtml/stripSliceFromHtml round-trip - Unicode content round-trip (CJK, emoji) - bodySectPr embed + extract round-trip - extractSliceFromHtml returns null for plain HTML - bodySectPrShouldEmbed with multi/single column - shouldPreserveSlicePastedListRendering preserves freshly pasted list data - non-slice paragraphs still get recalculated --------- Co-authored-by: Caio Pizzol <caio@harbourshare.com> Co-authored-by: Caio Pizzol <97641911+caio-pizzol@users.noreply.github.com>
1 parent 48a74f9 commit faaedb6

22 files changed

Lines changed: 2408 additions & 70 deletions

packages/layout-engine/style-engine/src/ooxml/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ export function resolveRunProperties(
7575
if (!params.translatedLinkedStyles?.styles) {
7676
return inlineRpr ?? {};
7777
}
78-
if (!inlineRpr) {
79-
inlineRpr = {} as RunProperties;
80-
}
78+
inlineRpr = inlineRpr ? { ...inlineRpr } : ({} as RunProperties);
8179
// Getting properties from style
8280
const paragraphStyleId = resolvedPpr?.styleId as string | undefined;
8381
const paragraphStyleProps = resolveStyleChain('runProperties', params, paragraphStyleId) as RunProperties;
@@ -158,9 +156,7 @@ export function resolveParagraphProperties(
158156
inlineProps: ParagraphProperties | null | undefined,
159157
tableInfo: TableInfo | null | undefined,
160158
): ParagraphProperties {
161-
if (!inlineProps) {
162-
inlineProps = {} as ParagraphProperties;
163-
}
159+
inlineProps = inlineProps ? { ...inlineProps } : ({} as ParagraphProperties);
164160
if (!params.translatedLinkedStyles?.styles) {
165161
return inlineProps;
166162
}

packages/super-editor/src/editors/v1/core/InputRule.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ export function inputRulesPlugin(config: InputRulesPluginConfig): Plugin;
6363
*/
6464
export function isWordHtml(html: string): boolean;
6565

66+
export function isSuperdocOriginClipboardHtml(html: string | null | undefined): boolean;
67+
6668
/**
6769
* Handle HTML paste events
6870
*/

0 commit comments

Comments
 (0)