Skip to content

Commit 7e547e7

Browse files
committed
✨ Expand collapse section from context menu (#660)
1 parent 0ed084c commit 7e547e7

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed
Lines changed: 1 addition & 0 deletions
Loading

src/assets/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
"section": {
196196
"open-section": "Open Section",
197197
"edit-section": "Edit",
198+
"expand-collapse": "Expand / Collapse",
198199
"move-section": "Move To",
199200
"remove-section": "Remove"
200201
}

src/components/LinkItems/Section.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
v-click-outside="closeContextMenu"
9595
@openEditSection="openEditSection"
9696
@navigateToSection="navigateToSection"
97+
@expandCollapseSection="expandCollapseSection"
9798
@removeSection="removeSection"
9899
/>
99100
</Collapsable>
@@ -250,6 +251,12 @@ export default {
250251
router.push({ path: `/home/${sectionIdentifier}` });
251252
this.closeContextMenu();
252253
},
254+
/* Toggle sections collapse state */
255+
expandCollapseSection() {
256+
const secElem = this.$refs[this.sectionRef];
257+
if (secElem) secElem.toggle();
258+
this.closeContextMenu();
259+
},
253260
/* Open the Section Edit Menu */
254261
openEditSection() {
255262
this.editMenuOpen = true;

src/components/LinkItems/SectionContextMenu.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
<EditIcon />
1313
<span>{{ $t('context-menus.section.edit-section') }}</span>
1414
</li>
15+
<li @click="expandCollapseSection">
16+
<ExpandCollapseIcon />
17+
<span>{{ $t('context-menus.section.expand-collapse') }}</span>
18+
</li>
1519
<li v-if="isEditMode" @click="removeSection">
1620
<BinIcon />
1721
<span>{{ $t('context-menus.section.remove-section') }}</span>
@@ -26,13 +30,15 @@
2630
import EditIcon from '@/assets/interface-icons/config-edit-json.svg';
2731
import BinIcon from '@/assets/interface-icons/interactive-editor-remove.svg';
2832
import SameTabOpenIcon from '@/assets/interface-icons/open-current-tab.svg';
33+
import ExpandCollapseIcon from '@/assets/interface-icons/section-expand-collapse.svg';
2934
3035
export default {
3136
name: 'ContextMenu',
3237
components: {
3338
EditIcon,
3439
BinIcon,
3540
SameTabOpenIcon,
41+
ExpandCollapseIcon,
3642
},
3743
props: {
3844
posX: Number, // The X coordinate for positioning
@@ -56,6 +62,9 @@ export default {
5662
openEditSectionMenu() {
5763
this.$emit('openEditSection');
5864
},
65+
expandCollapseSection() {
66+
this.$emit('expandCollapseSection');
67+
},
5968
removeSection() {
6069
this.$emit('removeSection');
6170
},

0 commit comments

Comments
 (0)