question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:35
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
neSpecccommented, Jul 3, 2019

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

1reaction
neSpecccommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why did my file open read-only? - Microsoft Support
You can check the file properties by right-clicking on the file and choosing Properties. If the Read-only attribute is checked, you can uncheck...
Read more >
Read only mode | Drupal.org
What is Read Only Mode? Read Only Mode provides an alternate to the built in Maintenance Mode in Drupal. Instead of displaying a...
Read more >
Using read-only mode for site maintenance | Confluence Data ...
Read -only mode limits the actions that an end user can perform. Some operations may still write to your database, but for the...
Read more >
How To Fix When Word Opens In Read Only Mode
Remove Read Only From Word By Disabling Edit Restrictions · Open your read-only document in the MS Word program. · When it opens,...
Read more >
Read-only mode - IBM
In read-only mode, the server can read, write, update, and delete data stored in data items, including those stored in internal data types....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found