From c831ce5f7b5ccd95e3070e36a97ae4eab4647ef7 Mon Sep 17 00:00:00 2001 From: Julia Roldi <87443959+juliaroldi@users.noreply.github.com> Date: Fri, 29 Nov 2024 16:31:37 -0300 Subject: [PATCH 1/2] Merge pull request #2895 from microsoft/u/julairoldi/investigate-image Do not remove image shadow root --- .../lib/imageEdit/utils/createImageWrapper.ts | 3 +++ .../imageEdit/utils/createImageWrapperTest.ts | 18 +++++------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/roosterjs-content-model-plugins/lib/imageEdit/utils/createImageWrapper.ts b/packages/roosterjs-content-model-plugins/lib/imageEdit/utils/createImageWrapper.ts index 7c2aaaedf44..d8eaaf0f623 100644 --- a/packages/roosterjs-content-model-plugins/lib/imageEdit/utils/createImageWrapper.ts +++ b/packages/roosterjs-content-model-plugins/lib/imageEdit/utils/createImageWrapper.ts @@ -11,6 +11,8 @@ import type { import type { ImageEditOptions } from '../types/ImageEditOptions'; import type { ImageHtmlOptions } from '../types/ImageHtmlOptions'; +const IMAGE_EDIT_SHADOW_ROOT = 'ImageEditShadowRoot'; + /** * @internal */ @@ -69,6 +71,7 @@ const createShadowSpan = (wrapper: HTMLElement, imageSpan: HTMLSpanElement) => { const shadowRoot = imageSpan.attachShadow({ mode: 'open', }); + imageSpan.id = IMAGE_EDIT_SHADOW_ROOT; wrapper.style.verticalAlign = 'bottom'; shadowRoot.appendChild(wrapper); return imageSpan; diff --git a/packages/roosterjs-content-model-plugins/test/imageEdit/utils/createImageWrapperTest.ts b/packages/roosterjs-content-model-plugins/test/imageEdit/utils/createImageWrapperTest.ts index cc92c26b0f1..3528e6b4915 100644 --- a/packages/roosterjs-content-model-plugins/test/imageEdit/utils/createImageWrapperTest.ts +++ b/packages/roosterjs-content-model-plugins/test/imageEdit/utils/createImageWrapperTest.ts @@ -14,22 +14,13 @@ describe('createImageWrapper', () => { const editor = initEditor('editor_test'); function runTest( image: HTMLImageElement, - imageSpan: HTMLSpanElement, options: ImageEditOptions, editInfo: ImageMetadataFormat, htmlOptions: ImageHtmlOptions, operation: ImageEditOperation[], expectResult: WrapperElements ) { - const result = createImageWrapper( - editor, - image, - - options, - editInfo, - htmlOptions, - operation - ); + const result = createImageWrapper(editor, image, options, editInfo, htmlOptions, operation); expect(JSON.stringify(result)).toEqual(JSON.stringify(expectResult)); } @@ -69,7 +60,7 @@ describe('createImageWrapper', () => { const shadowSpan = createShadowSpan(wrapper); const imageClone = cloneImage(image, editInfo); - runTest(image, imageSpan, options, editInfo, htmlOptions, ['resize'], { + runTest(image, options, editInfo, htmlOptions, ['resize'], { wrapper, shadowSpan, imageClone, @@ -116,7 +107,7 @@ describe('createImageWrapper', () => { const shadowSpan = createShadowSpan(wrapper); const imageClone = cloneImage(image, editInfo); - runTest(image, imageSpan, options, editInfo, htmlOptions, ['rotate'], { + runTest(image, options, editInfo, htmlOptions, ['rotate'], { wrapper: wrapper, shadowSpan: shadowSpan, imageClone: imageClone, @@ -171,7 +162,7 @@ describe('createImageWrapper', () => { const shadowSpan = createShadowSpan(wrapper); const imageClone = cloneImage(image, editInfo); - runTest(image, imageSpan, options, editInfo, htmlOptions, ['crop'], { + runTest(image, options, editInfo, htmlOptions, ['crop'], { wrapper, shadowSpan, imageClone, @@ -202,6 +193,7 @@ const createShadowSpan = (wrapper: HTMLSpanElement) => { const shadowRoot = span.attachShadow({ mode: 'open', }); + span.id = 'IMAGE_EDIT_SHADOW_ROOT'; wrapper.style.verticalAlign = 'bottom'; shadowRoot.append(wrapper); return span; From e5d0af775828a422473c65473463a46635741464 Mon Sep 17 00:00:00 2001 From: "Julia Roldi (from Dev Box)" Date: Mon, 2 Dec 2024 14:02:36 -0300 Subject: [PATCH 2/2] version update --- versions.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versions.json b/versions.json index aaa80a62435..b5d00408c6f 100644 --- a/versions.json +++ b/versions.json @@ -2,5 +2,7 @@ "react": "9.0.0", "main": "9.15.0", "legacyAdapter": "8.62.3", - "overrides": {} + "overrides": { + "roosterjs-content-model-plugins": "9.15.1" + } }