-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing HTML with Lexical editor selected results in loss of images. #18448
Comments
Hi @cathysarisky, to clarify this point do you mean importing with the beta flag on vs off or do you mean after importing the beta flag has some effect when toggled? Could you provide a short example of the HTML you are importing please? |
The beta flag seems to have an effect on import. If I turn it on, the import fails. |
I was able to import fine applying a link to the image as well as a link in the caption. Sample body for the API request:
@cathysarisky could you provide the html string you were using? |
@9larsons was this with the latest release containing parser improvements? @cathysarisky if you can, please try updating to the most recent release and try again to see if the issue has been fixed |
Sorry for the delay -- I didn't mean to open a report and abandon it. My
import content was not Ghost-generated, so it's possible I've found an edge
case in html to lexical conversion.
I haven't had a chance to reproduce on the latest Ghost - too much client
work pending. Will do ASAP! :)
…On Fri, Oct 6, 2023 at 12:51 PM Kevin Ansfield ***@***.***> wrote:
@9larsons <https://github.com/9larsons> was this with the latest release
containing parser improvements?
@cathysarisky <https://github.com/cathysarisky> if you can, please try
updating to the most recent release and try again to see if the issue has
been fixed
—
Reply to this email directly, view it on GitHub
<#18448 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKCXDVQIHXHYBJB4JSAVQJDX6AZKVAVCNFSM6AAAAAA5Q5CQPGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRGEYDGMJSGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yes, this was using the most recent release - it's possible this was fixed with the changes I just pushed with that. I can't say for certain without knowing the html string. I don't feel it's likely it was resolved by the changes I made. Please just give the new release a shot and we'll find out! |
@cathysarisky hey - did you get a chance to try this out again? |
OK, trying on Ghost Pro, so that's version: 5.68.0+moya The beta editor slider is gone, and the problem occurs. Here's a fairly minimalist repro case:
This API call happens correctly, but there's a problem somewhere. Here's the lexical returned as part of the post object created above:
Upon viewing, the image is not present. Here's the relevant HTML output upon visiting the post.
If I load the post in the Ghost post editor and republish it, then I get this:
... which is what I wanted in the first place! With the removal of the old editor, I don't have a workaround for this bug. |
Thanks @cathysarisky. Looks like this issue is related to the parsing generating an invalid tree state with an image card node nested inside a paragraph node. We've added transforms to rectify this state to the editor itself which is why opening the editor and re-publishing works but we're missing those transforms on the server-side html->lexical route. We were actually talking about this yesterday before seeing your reply and have a plan so it should be resolved in the next Ghost release. |
Short-term workaround would be not wrapping images in paragraphs in the source HTML if that's possible. |
…alid nesting refs TryGhost/Ghost#18448 - extracted our aligment stripping and denesting transforms to a new `kg-default-transforms` package - updated `kg-html-to-lexical` so it adds the transforms to the headless editor ensuring the output matches what we'd get if the same content was pasted directly into the editor
…alid nesting refs TryGhost/Ghost#18448 - extracted our aligment stripping and denesting transforms to a new `kg-default-transforms` package - updated `kg-html-to-lexical` so it adds the transforms to the headless editor ensuring the output matches what we'd get if the same content was pasted directly into the editor
…alid nesting refs TryGhost/Ghost#18448 - extracted our aligment stripping and denesting transforms to a new `kg-default-transforms` package - updated `kg-html-to-lexical` so it adds the transforms to the headless editor ensuring the output matches what we'd get if the same content was pasted directly into the editor
…alid nesting refs TryGhost/Ghost#18448 - extracted our aligment stripping and denesting transforms to a new `kg-default-transforms` package - updated `kg-html-to-lexical` so it adds the transforms to the headless editor ensuring the output matches what we'd get if the same content was pasted directly into the editor
…alid nesting (#1002) refs TryGhost/Ghost#18448 - extracted our aligment stripping, de-nesting, and list-merging transforms to a new `kg-default-transforms` package - generalised the de-nesting transform further to handle invalid nesting inside lists (allowed removal of image-specific denest transform in `koenig-lexical`) - updated `koenig-lexical` to use the new package in place of the extracted transform code - updated `kg-html-to-lexical` so it adds the transforms to the headless editor ensuring the output matches what we'd get if the same content was pasted directly into the editor
Issue Summary
Importing HTML that includes image links, using the Admin API. (Images previously imported with the API images endpoint.)
If I select the Lexical editor (in the admin interface), images get stripped out. (They're not broken links - the img tag is totally missing.)
If I turn off the Lexical editor, images appear correctly.
No error messages are thrown on import, and the rest of the post imports intact.
Steps to Reproduce
This is a regression for the new Lexical editor compared to the old Mobiledoc editor.
Please see comment below for full repro, demonstrated on Ghost Pro 5.68+moya.
Ghost Version
Ghost Pro, as of 10/2/23
Node.js Version
Ghost Pro, as of 10/2/23
How did you install Ghost?
Ghost Pro, as of 10/2/23
Database type
MySQL 8
Browser & OS version
not relevant
Relevant log / error output
Code of Conduct
The text was updated successfully, but these errors were encountered: