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

activeButtonsInReadOnly: ['source', 'preview'] is not working. #878

Closed
patiencendiligence opened this issue Aug 16, 2022 Discussed in #877 · 4 comments
Closed

activeButtonsInReadOnly: ['source', 'preview'] is not working. #878

patiencendiligence opened this issue Aug 16, 2022 Discussed in #877 · 4 comments

Comments

@patiencendiligence
Copy link

Discussed in #877

Originally posted by patiencendiligence August 16, 2022
Hello, Somebody help me. plz.
(My jodit is the latest version. - free)

I want to the buttons such as 'source', 'preview' are working in readonly state.
So, I set like this my jodit editor config.

config: {
  readonly: true,
  activeButtonsInReadOnly: ['source', 'preview'],
  ...,
}

Then, The 'source' button works.
But.. The preview button looks like working - is active - . Actually, It is not working.
When I click the preview button, it is nothing happens. (not visible preview dialog..)

How can I make that preview button work in readonly state?
Thank you in advance.

@xdan
Copy link
Owner

xdan commented Aug 16, 2022

In readonly mode, any commands other than select-all are prohibited. The preview button works by registering the preview command and essentially just calls editor.execCommand('preview')
I will add in the new version a white list of commands that can be called in readonly

@xdan
Copy link
Owner

xdan commented Aug 16, 2022

Now, you can repeat all preview's functionality in the button
https://codesandbox.io/s/jodit-vanila-6dxexm?file=/src/index.js

@patiencendiligence
Copy link
Author

@xdan Thank you! 👍

xdan added a commit that referenced this issue Aug 21, 2022
Allow execute commands in readonly mode.
Issue: #878
@xdan
Copy link
Owner

xdan commented Aug 21, 2022

Added options

@xdan xdan added the fixed label Aug 21, 2022
@xdan xdan closed this as completed Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants