Skip to content

Commit

Permalink
πŸ’„ (#2345): add refocus
Browse files Browse the repository at this point in the history
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
  • Loading branch information
Vinicius Reis committed May 23, 2022
1 parent 5e8f077 commit 3903f44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Menu/ActionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<ActionSingle v-for="child in actionEntry.children"
:key="`child-${child._key}`"
is-item
:action-entry="child" />
:action-entry="child"
@trigged="refocus" />
</Actions>
</template>

Expand Down Expand Up @@ -77,7 +78,10 @@ export default {
},
methods: {
runAction() {

// nothing todo
},
refocus() {
this.$editor.chain().focus().run()
},
},
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Menu/ActionSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export default {
// Some actions run themselves.
// others still need to have .run() called upon them.
actionEntry.action(this.$editor.chain().focus())?.run()

this.$nextTick(() => {
this.$emit('trigged', { ...actionEntry })
})
},
},

Expand Down

0 comments on commit 3903f44

Please sign in to comment.