-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Using Editable component when rendering serverside #4489
Comments
👍 I'd also like to use RichText component and have the field's value saved to the comment attributes. I'm rendering the block server-side and see the same behavior as above. |
My comment above can be ignored, just saw that the RichText component now supports a This allows the content to be saved as a string and it is stored as a comment attribute 🎉 |
As mentioned above you can use the |
Is there a way to prevent re-rendering on every keystroke using this method? It's causing a lot of flashing for me while typing. |
@8bit-echo you should try to debounce the onChange calls on the REST API and see if that helps. |
@youknowriad I’m currently debouncing the onChange for a PlainText component, but since SetAttributes runs asynchronously, it doesn’t seem to be making much of a difference. When you say debounce the api call I’m assuming you mean to gutenberg/block-renderer/{{...}}. Does the ServerSideRender component expose access to that method? I didn’t see anything in the docs that mention it. |
No, I'm thinking debouncing |
Also, note this
|
Issue Overview
When setting up a dynamic block for server side rendering and using one or mulitple Editable components, the data stored in html comments cannot be used directly.
Steps to Reproduce (for bugs)
attributes: { contenteditable: { type: 'array' }, },
The content
![image](https://user-images.githubusercontent.com/25308802/34952672-ca28bffe-fa1a-11e7-9e14-a56bd52d8d66.png)
is stored as this (a react internal representation?):
{"content":[{"type":"strong","key":"_domReact5","ref":null,"props":{"children":"Donec rutrum"},"_owner":null}," congue leo eget ",{"type":"a","key":"_domReact8","ref":null,"props":{"href":"https://wordpress.org","children":"malesuada"},"_owner":null},". ",{"type":"br","key":"_domReact2","ref":null,"props":{},"_owner":null},{"type":"br","key":"_domReact3","ref":null,"props":{},"_owner":null},"Vestibulum ac diam sit amet quam vehicula elementum sed sit amet dui."]}
and that is what the server side rendering function gets to see.
Expected Behavior
There should be a server side function to convert this array to valid html.
The text was updated successfully, but these errors were encountered: