Skip to content
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

Read only mode #837

Closed
11 tasks
neSpecc opened this issue Jul 2, 2019 · 8 comments · Fixed by #1035
Closed
11 tasks

Read only mode #837

neSpecc opened this issue Jul 2, 2019 · 8 comments · Fixed by #1035

Comments

@neSpecc
Copy link
Member

neSpecc commented Jul 2, 2019

Add the ability to enable read-only mode. We need to support initialization in read-only mode and toggling read-only mode on the fly.

For each plugin in list:

  • Improve Tools design that can be represented as WYSIWYG

  • Accept readOnly boolean flag in tools constructor and save it to the class's property.

  • Separate event bindings and contenteditable attributes activating to the toggleReadonly(status) method. Call this method with true status on the render in read-only mode. Also, this method can be called with true/false statuses by editorjs core — it should bind/unbind events corresponded by status.

Working with editor.js core:

  • Add readOnly option to the Editor Config

  • Make readonly.ts module that will store readOnlyEnabled property and have toggleReadonly(status) public method.

  • toggleReadonly(status) method of readonly.ts module will call toggleReadonly(status) methods of each editor module implemented this method.

  • Implement toggleReadonly(status) method in modules that requires some readonly toggling logic: UI, Toolbar, InlineToolbar, Paste, Saver, Shortcuts (for disabling cmd+x), BlockSettings, BlockEvents, BlockManager, DragNdrop, ModificationObserver, API. This method will do two things: bind/unbind events and make/remove dom elements.

  • If some module makes own ui and bind events in prepare method (for example, UI, Toolbar): move events binding and ui making in toggleReadonly() method of this module. Then call toggleReadonly() in prepare.

  • Pass readOnly option to Tools constructor on render

  • If some of Tools does not provide read-only functionality (can be detected by toggleReadonly () implemented or not), throw an error on trying to enable read-only mode.

  • add toggleReadonly() method to the public API. This method will call toggleReadonly(status) method of readonly.ts module internally.

@no-1ne
Copy link

no-1ne commented Jul 3, 2019

Hi folks, don't mean to be pushy, Any chances of this being looked at earlier. Read-only is a very nice feature to have

@neSpecc
Copy link
Member Author

neSpecc commented Jul 3, 2019

@startupgurukul you can boost development by donation to maintainers https://opencollective.com/editorjs

@moharnadreza
Copy link

Hi, I'm interested for maintaining this project. Could we talk about this?

@neSpecc
Copy link
Member Author

neSpecc commented Oct 1, 2019

@themzed cool, join Telegram chat for core contributors: https://t.me/editorjsdev

Then, we will discuss the first steps.

@no-1ne
Copy link

no-1ne commented Nov 4, 2019

@neSpecc thank you for the open collective link, regarding financial donations, soon we will be in a position to do that as the product we built using editor is just making some strides.
Until then we will be happy to contribute in form of code.

In the mean time I am sure you must have seen this https://github.com/sponsors

@andersan
Copy link

Hello,

Any news on this feature?

Considering using this for a project, but I'm hesitant due to the additional work involved with finding or writing a JSON parser. I'd be fine with the Read Only mode only supporting the Core parts of Editor.js.

@neSpecc
Copy link
Member Author

neSpecc commented Feb 8, 2020

I've updated the description of the issue with more details. We are looking for contributors who can implement some of the subtasks with our help.

@marcovc
Copy link

marcovc commented Mar 5, 2021

Hi, it seems one cannot query the readOnly.isEnabled property. Is this how it is supposed to be? It is hard to know when to call toogleReadOnly if we don't know the current readOnly value of the component. And maintaining an external bool with this seems odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants