feat(dropdown): Add toggle button and remove force open in editor option (WW-3773)#12
feat(dropdown): Add toggle button and remove force open in editor option (WW-3773)#12
Conversation
1cc20bd to
e569f75
Compare
e569f75 to
4f6c84f
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a toggle button to control the dropdown state directly in the editor while removing the former “force display in editor” option. Key changes include the addition of new actions in the configuration file, modifications to the dropdown properties, and updates to the component logic in wwElement.vue to support the toggle functionality.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ww-config.js | Added new actions and properties for toggling dropdown state and force open behavior; however, there is a potential mismatch in action assignment. |
| src/wwElement.vue | Updated the component to include toggling functions for dropdown and force open states, but toggle functions are implemented as computed properties. |
| text: { en: 'Toggle' }, | ||
| action: 'toggleForceOpenInEditor', | ||
| }, |
There was a problem hiding this comment.
The 'toggleDropdown' property options incorrectly set the action to 'toggleForceOpenInEditor'; if the intended behavior is to toggle the dropdown state, update the action to 'toggleDropdown'.
| text: { en: 'Toggle' }, | |
| action: 'toggleForceOpenInEditor', | |
| }, | |
| text: { en: 'Toggle' }, | |
| action: 'toggleDropdown', | |
| }, |
| computed: { | ||
| toggleForceOpenInEditor() { | ||
| this.forceOpenInEditor = !this.forceOpenInEditor; | ||
| }, | ||
| isEditing() { |
There was a problem hiding this comment.
Using computed properties to perform state mutations is not recommended; converting toggleForceOpenInEditor (and toggleDropdown) to methods would better align with Vue best practices.
| computed: { | |
| toggleForceOpenInEditor() { | |
| this.forceOpenInEditor = !this.forceOpenInEditor; | |
| }, | |
| isEditing() { | |
| computed: { | |
| isEditing() { | |
| /* wwEditor:start */ | |
| return this.wwEditorState.editMode === wwLib.wwEditorHelper.EDIT_MODES.EDITION; | |
| /* wwEditor:end */ |
src/wwElement.vue
Outdated
| }, | ||
| computed: { | ||
| toggleForceOpenInEditor() { | ||
| this.forceOpenInEditor = !this.forceOpenInEditor; |
There was a problem hiding this comment.
je suis d'accord avec copilot ;)
There was a problem hiding this comment.
en vrai ça doit juste bouger dans methods, si j'en crois la config
There was a problem hiding this comment.
La computed au lieu de la methods c'était clairement un soucis.
Par contre je suis pas sure pour l'autre. Si on toggle dans l'éditeur, en cliquant quelque part ca risque de fermer le dropdown non ? C'est pas ce qu'on veut ?
Summary