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

Change icons in the editor toolbar based on mode (edit or preview) #7

Open
docelic opened this issue Aug 4, 2018 · 0 comments
Open

Comments

@docelic
Copy link
Owner

docelic commented Aug 4, 2018

We should change the toolbar icons depending on whether the page is in edit or preview mode.

Two things should be done here:

  1. Figure out if there is a way to immediately open the editor in preview mode. (Currently we do this by manually invoking togglePreview() after the editor has initialized itself in edit mode)

  2. Figure out if the editor can be configured to automatically change the icons based on mode.

If it can't be configured to automatically change, then we need to implement it ourselves:

First we should see whether Inscryb/inscryb-markdown-editor#17 is a bug or not. That is, whether we can easily test whether the editor is in preview mode or not.

Then, one option (possibly not very favorable) would be to destroy the toolbar and create it anew with different icons when mode is changed. We have a prototype of this working, but it currently does not properly create a toolbar when editor is in full screen mode (this is probably another bug in SimpleMDE/InscrybMDE).

Another option (not tested yet) would be to modify the toolbarComponents array to take out and bring back individual icons when mode is changed. Hopefully the editor.render() method would work correctly and we'd have no other work than just adding or removing toolbar objects from that array.

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

No branches or pull requests

1 participant