mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 21:52:47 +08:00
parent
8e32838b8a
commit
44228b2af6
@ -325,14 +325,10 @@ class Muya {
|
||||
}
|
||||
|
||||
selectAll () {
|
||||
this.contentState.selectAll()
|
||||
|
||||
if (!this.hasFocus()) {
|
||||
const activeElement = document.activeElement
|
||||
if (activeElement.nodeName === 'INPUT') {
|
||||
activeElement.select()
|
||||
}
|
||||
return
|
||||
}
|
||||
this.contentState.selectAll()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -817,8 +817,14 @@ export default {
|
||||
},
|
||||
|
||||
handleSelectAll () {
|
||||
if (this.editor && !this.sourceCode) {
|
||||
if (this.editor && !this.sourceCode && this.editor.hasFocus()) {
|
||||
this.editor.selectAll()
|
||||
} else {
|
||||
const activeElement = document.activeElement
|
||||
const nodeName = activeElement.nodeName
|
||||
if (nodeName === 'INPUT' || nodeName === 'TEXTAREA') {
|
||||
activeElement.select()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user