-
Notifications
You must be signed in to change notification settings - Fork 43
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
Lexical does not render images when setting editorState #57
Comments
I mostly want to clarify if my expectation of loading the state should render images is correct or not. |
It looks like the url is not being decoded from the EditorState we pass. Is this intentional? Treating the ImageNode different than other nodes? |
Almost certainly not intentional. Happy to accept a PR :)
(Sorry I've been a bit lax on replying here, I’ve been off sick for a bit.)
Amy
… On 21 Feb 2024, at 02:38, bluebonneville ***@***.***> wrote:
It looks like the url is not being decoded from the EditorState we pass. url (which is a different key than what the JS version uses, src) is not one of the CodingKeys for ImageNode and it is not accounted for in the decode method.
Is this intentional? Treating the ImageNode different than other nodes?
—
Reply to this email directly, view it on GitHub <#57 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAEUB6T22GL4PQ7KKAYYX3LYUVM3PAVCNFSM6AAAAABDLIJ542VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJVG43DMOJTGA>.
You are receiving this because you were mentioned.
|
Thanks Amy! I'll work on the PR :) |
I currently have this code to render the LexicalView:
the value for
jsonString
used above is:"{\"root\":{\"children\":[{\"children\":[{\"src\":\"https://t4.ftcdn.net/jpg/01/43/42/83/360_F_143428338_gcxw3Jcd0tJpkvvb53pfEztwtU9sxsgT.jpg\",\"maxWidth\":\"100%\",\"maxHeight\":800,\"width\":10,\"height\":20,\"type\":\"image\",\"version\":1}],\"direction\":null,\"format\":\"\",\"indent\":0,\"type\":\"paragraph\",\"version\":1}],\"direction\":null,\"format\":\"\",\"indent\":0,\"type\":\"root\",\"version\":1}}"
I expect the image to render in the lexical view, but it just shows empty.
In order to render any image in LexicalView I have to run this:
The problem with this approach is that it renders the inline image functionality worthless when I have to manually insert images.
Is this expected behavior? Or am I using it wrong?
For reference this is the entire class (it's a SwiftUI project so it is in a
UIViewRepresentable
):The text was updated successfully, but these errors were encountered: