Skip to content

Commit

Permalink
bug: support pasting google doc checklist
Browse files Browse the repository at this point in the history
  • Loading branch information
umaranis committed Aug 31, 2024
1 parent 7718308 commit b35a8e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/svelte-lexical/src/lib/core/plugins/Image/ImageNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ export interface ImagePayload {
captionsEnabled?: boolean;
}

function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean {
return (
img.parentElement != null &&
img.parentElement.tagName === 'LI' &&
img.previousSibling === null &&
img.getAttribute('aria-roledescription') === 'checkbox'
);
}

function convertImageElement(domNode: Node): null | DOMConversionOutput {
const img = domNode as HTMLImageElement;
if (img.src.startsWith('file:///')) {
if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {
return null;
}
const {alt: altText, src, width, height} = img;
Expand Down

0 comments on commit b35a8e6

Please sign in to comment.