diff --git a/src/components/Menu/MenuBar.vue b/src/components/Menu/MenuBar.vue index c2052735839..a510a935747 100644 --- a/src/components/Menu/MenuBar.vue +++ b/src/components/Menu/MenuBar.vue @@ -247,7 +247,13 @@ export default { }, showTranslate() { const { from, to } = this.$editor.view.state.selection - const selectedText = this.$editor.view.state.doc.textBetween(from, to, ' ') + let selectedText = this.$editor.view.state.doc.textBetween(from, to, ' ') + + if (!selectedText.trim().length) { + this.$editor.commands.selectAll() + selectedText = this.$editor.view.state.doc.textContent + } + console.debug('translation click', this.$editor.view.state.selection, selectedText) this.displayTranslate = selectedText ?? '' }, diff --git a/src/components/Modal/Translate.vue b/src/components/Modal/Translate.vue index 47c11c9be08..a2018dc3eca 100644 --- a/src/components/Modal/Translate.vue +++ b/src/components/Modal/Translate.vue @@ -20,26 +20,44 @@ -->