BUG: `setStyle` & `setComponents` options parameter not taken into account
Question
Version: 0.16.30
Are you able to reproduce the bug from the demo?
[x] Yes [ ] No
Steps to reproduce:
- Open the console
- Execute
editor.setComponents('', {avoidStore: true}); - Execute
editor.setStyle('', {avoidStore: true}); - The "Stored ..." log still appears (see attached screenshot)
What is the expected behavior?
The options parameter should be taken into account. Passing the avoidStore option to true to setStyle & setComponents should prevent the update event from triggering.
What is the current behavior?
The options parameter is not taken into account. Passing the avoidStore option has no effect and an update event is still triggered.
Proposed solution:
I'm sorry I missed on this with the previous PR (for this issue), but there still seems to be 2 problems:
- The
optobject is not passed down to theclear&removecalls forsetComponents, causing theavoidStoreproblem described above. - The CssComposer's
handleChangeshandler call signature does not match the one of theadd&removeevents: missing the 2ndcollectionparameter (which causes misreading of theoptsparameter).
As always, I'd be happy to take care of the PR if this looks good to you !
Are you able to attach screenshots, screencasts or a live demo?
[x] Yes (attach) [ ] No
<img width="1435" alt="Screenshot 2020-12-09 at 12 15 53 PM" src="https://user-images.githubusercontent.com/9916749/101623160-508d5d80-3a18-11eb-84a6-4953faf7d388.png">Answers (3)
Thanks @mcottret the fix is ready for the next release
Unfortunately, due to the bad initial naming, avoidStore is intended to skip the UndoManager and not the Storage 😁
The good news, I had to introduce the new noCount option, in order to fix #3189, this will skip triggering the editor changes counter so, it won't trigger the Storage either.
That fix brought me also to update properly the signature in handleChanges from CssComposer, but I still need to fix a few other methods to make the whole thing work properly (including those you've suggested).
So, in the next release, the thing should work as you expect with the new noCount option, and, probably, I'll start using a new noUndo option (leaving avoidStore to avoid any breaking change).
ps. as always, thanks for your help ❤️
Hello @artf !
I'm sorry to reopen this issue but the setStyle issue still seems to be present.
Redoing the steps above, the "Stored ..." log still appears while calling setStyle with the noCount option.
I'm seeing the fixed handleChanges handler still uses the avoidStore option, but the avoidStore option does not seem to work either.
I didn't look deeper into this so I couldn't identify why the issue persists, but let me know if you want me to :)
Everything works fine with setComponents on the other hand, thanks a lot for that :) !
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3175
BUG: Selection & active RTE not cleared when component is removed programatically
Version: 0.16.30 Are you able to reproduce the bug from the demo? [x] Yes [ ] No Steps to reproduce:Select a text component in the demo's c...
Issue #3152
BUG: the blue outline (gjs-hovered) is not following its parent during scrolling
Version: 16.27 Are you able to reproduce the bug from the demo? [x ] Yes [ ] No Describe the bug: I discovered an issue with gjs-hovered, t...
Issue #3209
BUG: When in preview mode, the toolbar is only being hidden but still clickable
Version: 0.16.22 Are you able to reproduce the bug from the demo? Yes What is the expected behavior? When the use presses the preview butto...
Issue #3679
BUG: Device width is invalid by default
Thanks for #3673 I have a new bug feedback. Version:. 0.17.22 Are you able to reproduce the bug from the demo?[ ] Yes[ ] No What is the exp...
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.