Images wrapped in spans won't get parsed #1829
Answered
by
philippkuehn
iamursky
asked this question in
Questions & Help
-
We've moved to tiptap from another editor that had spans added around images and these images are not get parsed by tiptap. I've tried to add another parser to parseHTML but it is not get called: parseHTML() {
return [
{
tag: "span.fr-fic",
getAttrs(wrapperElement: HTMLElement) {
const imageElement = wrapperElement.querySelector("img");
const titleElement = wrapperElement.querySelector("span.fr-inner");
const alt = imageElement ? imageElement.getAttribute("alt") : null;
const src = imageElement ? imageElement.getAttribute("src") : null;
const title = titleElement ? titleElement.textContent : null;
return { alt, src, title };
},
},
{ tag: "img[src]" },
];
} What could be the problem? Does |
Beta Was this translation helpful? Give feedback.
Answered by
philippkuehn
Sep 2, 2021
Replies: 1 comment 1 reply
-
By default only top level images are getting parsed. To use inline images you have so set inline to true. Image.configure({
inline: true,
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
iamursky
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By default only top level images are getting parsed. To use inline images you have so set inline to true.