froala / wysiwyg-editor

The next generation Javascript WYSIWYG HTML Editor.
https://www.froala.com/wysiwyg-editor
Other
5.28k stars 673 forks source link

Question. It is possible to have partial readonly blocks? #3907

Closed iamandrewluca closed 4 years ago

iamandrewluca commented 4 years ago

I'm doing some tests with froala-pages and design-blocks to see if it fits my requirements. As I saw it uses wysiwyg-editor for inline editing.

Is there any way to mark some blocks as readonly, so the editor could not edit them?

iamandrewluca commented 4 years ago

Conversation by email:

Froala

We don't have that feature by default but you can try to set contenteditable attribute to false. Please take a look at this example: https://jsfiddle.net/dejan_m/v0cLs9pf/100/.

Me

This it seems to work but only for each element in particular. Even if attribute is added editor toolbar is still appears with disabled buttons. Looking at the spec of contenteditable it says

If this attribute is missing or its value is invalid, its value is inherited from its parent element: so the element is editable if its parent is editable. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable

I would suggest 2 improvements.

Froala

The user should be able to set non-editable attribute to the parent element. I have submitted this issue to development, but a timeline has not yet been established for a fix.

Please subscribe to https://www.froala.com/pages/download#updates to see the latest updates on new releases.

Regarding your second suggestion, in case of the non-editable element, a disabled toolbar is the default behavior in the Froala Editor.

Please take a look at this example: https://jsfiddle.net/dejan_m/og0hxf2t/3782/. In future releases, the user will be able to use the editor events in Pages and for example, calls the toolbar.hide() method in case of the disabled toolbar.

bhenilaB commented 2 years ago

Is it possible to make the Froala Editor scrollable while the controll/screen is disabled/readonly?