BUG: editor.Panels.removeButton('options', 'preview') breaks View code
Question
Version: 0.16.18
Are you able to reproduce the bug from the demo? No
What is the expected behavior? I want to hide the default preview button while keeping the default "View code" button.
What is the current behavior? "View code" no longer works if the preview button is removed via
editor.Panels.removeButton('options', 'preview')
Are you able to attach screenshots, screencasts or a live demo?
Yes: JS Fiddle
Answers (2)
Hi @rudym87 !
The problem seems to be caused by the deactivation of the button clicked to run the command (cf below), which causes the modal to instantly close.
I have no idea why it only happens when the preview button has been removed, still it seems wierd to me to deactivate it while the code modal is still opened. I think it should rather be stored & disabled once the modal is closed (on stop), that way the button would stay active while the modal is open as shown in the following screenshot:
<img width="703" alt="Screenshot 2020-08-27 at 3 16 24 PM" src="https://user-images.githubusercontent.com/9916749/91451010-3e2e5000-e87d-11ea-8afa-62ca0bf99cdc.png">This fixes the aforementioned problem, & is also visually more coherent in my opinion. @artf what do you think ? As always, I'd be happy to open a PR for this :) !
Cheers !
correct @mcottret, honestly, I don't even see the reason anymore to keep this command stateful.
So, I'd remove that useless sender.set('active', 0) and the stop function from it. Let me know if you have a better idea
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3352
BUG: Default Content is getting Inserted while using setComponents if Tag Body is empty
Version: Latest You can get the version by typing grapesjs.version into the console Are you able to reproduce the bug from the demo?[X] Yes...
Issue #3316
BUG: The editor does not remove the dead script blocks
Version: 0.16.34 Are you able to reproduce the bug from the demo? [ ] Yes [x ] No As I understand the code import dialog skips all the HTML...
Issue #3441
BUG: Parser breaks `mj-style` as of 16.30
Version: All Grapesjs version from 16.30 to now have this issues. Are you able to reproduce the bug from the demo?[x] Yes[ ] No What is the...
Issue #3655
BUG: The form button name changes are not getting captured in generated html code
Version: Version 0.17.19(grapesjs) Version 0.1.11(grapesjs-preset-webpage) Are you able to reproduce the bug from the demo?[ ] No What is t...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.