Revert "Fix #5720 update the resolvedOffset correctly on image selection and drag" (#5952)

This commit is contained in:
John Flockton
2024-04-24 14:34:55 +01:00
committed by GitHub
parent b380127dee
commit a7b7c72ec7
2 changed files with 0 additions and 51 deletions

View File

@ -740,51 +740,4 @@ test.describe('Images', () => {
`, `,
); );
}); });
test('Can resolve selection correctly when the image is clicked and dragged right', async ({
page,
isPlainText,
browserName,
isCollab,
}) => {
test.skip(isPlainText);
let leftFrame = page;
if (isCollab) {
leftFrame = await page.frame('left');
}
await focusEditor(page);
await page.keyboard.type('HelloWorld');
await insertSampleImage(page);
await click(page, '.editor-image img');
await leftFrame.locator('.editor-image img').hover();
await page.mouse.down();
await leftFrame.locator('.PlaygroundEditorTheme__paragraph').hover();
await page.mouse.up();
await waitForSelector(page, '.editor-image img');
await assertHTML(
page,
html`
<p
class="PlaygroundEditorTheme__paragraph PlaygroundEditorTheme__ltr"
dir="ltr">
<span data-lexical-text="true">HelloWorld</span>
<span
class="editor-image"
contenteditable="false"
data-lexical-decorator="true">
<div draggable="false">
<img
alt="Yellow flower in tilt shift lens"
draggable="false"
src="${SAMPLE_IMAGE_URL}"
style="height: inherit; max-width: 500px; width: inherit" />
</div>
</span>
<br />
</p>
`,
);
});
}); });

View File

@ -1926,10 +1926,6 @@ function internalResolveSelectionPoint(
return null; return null;
} }
if ($isElementNode(resolvedElement)) { if ($isElementNode(resolvedElement)) {
resolvedOffset = Math.min(
resolvedElement.getChildrenSize(),
resolvedOffset,
);
let child = resolvedElement.getChildAtIndex(resolvedOffset); let child = resolvedElement.getChildAtIndex(resolvedOffset);
if ( if (
$isElementNode(child) && $isElementNode(child) &&