mirror of
https://github.com/marktext/marktext.git
synced 2025-05-04 14:22:38 +08:00
parent
8e32838b8a
commit
44228b2af6
@ -325,14 +325,10 @@ class Muya {
|
|||||||
}
|
}
|
||||||
|
|
||||||
selectAll () {
|
selectAll () {
|
||||||
this.contentState.selectAll()
|
|
||||||
|
|
||||||
if (!this.hasFocus()) {
|
if (!this.hasFocus()) {
|
||||||
const activeElement = document.activeElement
|
return
|
||||||
if (activeElement.nodeName === 'INPUT') {
|
|
||||||
activeElement.select()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.contentState.selectAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -817,8 +817,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleSelectAll () {
|
handleSelectAll () {
|
||||||
if (this.editor && !this.sourceCode) {
|
if (this.editor && !this.sourceCode && this.editor.hasFocus()) {
|
||||||
this.editor.selectAll()
|
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