You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into a similar, if not the same issue as this one: #1327
While editing a text block, I click on an external button to get the contents of the canvas, without leaving the cursor from the canvas.
At this point, if I call getHtml() or runCommand("gjs-get-inlined-html") (my grapesjs being loaded with the Newsletter plugin), both commands return the contents of the canvas in its previous state (= before I started editing my block) and not in its "current" state (i.e. with the text I was currently typing).
I guess this is by-design; It can easily be reproduced on the online demo:
To ensure that grapesjs validates the content I was typing before calling getHtml() / runCommand("gjs-get-inlined-html"), just like when you click elsewhere on the canvas to trigger the component's blur event and update, I had to call disableEditing() explicitely, like this:
if (editor.getModel().isEditing()) editor.getSelected().view.disableEditing();
Just to be sure, you could simply confirm that it's the right way to do so?
And, if so, could you add this point on the getHtml() function documentation?
It could avoid many misunderstandings, IMO.
FYI, I was already aware of such issues with CKEditor, on which you have to call myCkEditorInstance.updateElement() right before myCkEditorInstance.getData().
That's why I supposed it wasn't a bug ;)
The text was updated successfully, but these errors were encountered:
arachnosoft
changed the title
Ensure that getHtml() / runCommand("gjs-get-inlined-html") return the very latest contents of the canvas
Ensure that getHtml() / runCommand("gjs-get-inlined-html") returns the very latest contents of the canvas
Jan 30, 2019
Hi @artf ,
I ran into a similar, if not the same issue as this one: #1327
While editing a text block, I click on an external button to get the contents of the canvas, without leaving the cursor from the canvas.
At this point, if I call getHtml() or runCommand("gjs-get-inlined-html") (my grapesjs being loaded with the Newsletter plugin), both commands return the contents of the canvas in its previous state (= before I started editing my block) and not in its "current" state (i.e. with the text I was currently typing).
I guess this is by-design; It can easily be reproduced on the online demo:
To ensure that grapesjs validates the content I was typing before calling getHtml() / runCommand("gjs-get-inlined-html"), just like when you click elsewhere on the canvas to trigger the component's blur event and update, I had to call disableEditing() explicitely, like this:
if (editor.getModel().isEditing()) editor.getSelected().view.disableEditing();
Based on #319 (comment)
Just to be sure, you could simply confirm that it's the right way to do so?
And, if so, could you add this point on the getHtml() function documentation?
It could avoid many misunderstandings, IMO.
FYI, I was already aware of such issues with CKEditor, on which you have to call myCkEditorInstance.updateElement() right before myCkEditorInstance.getData().
That's why I supposed it wasn't a bug ;)
The text was updated successfully, but these errors were encountered: