mirror of
https://github.com/purocean/yn.git
synced 2026-10-12 23:31:39 +08:00
增加插入文档链接快捷键
This commit is contained in:
@@ -27,12 +27,14 @@ export default {
|
||||
this.onGotAmdLoader()
|
||||
}
|
||||
window.addEventListener('resize', this.resize)
|
||||
this.$bus.on('editor-insert-value', this.insert)
|
||||
this.$bus.on('editor-replace-value', this.replaceValue)
|
||||
this.$bus.on('editor-toggle-wrap', this.toggleWrap)
|
||||
},
|
||||
beforeDestroy () {
|
||||
window.removeEventListener('paste', this.paste)
|
||||
window.removeEventListener('resize', this.resize)
|
||||
this.$bus.off('editor-insert-value', this.insert)
|
||||
this.$bus.off('editor-replace-value', this.replaceValue)
|
||||
this.$bus.off('editor-toggle-wrap', this.toggleWrap)
|
||||
},
|
||||
|
||||
@@ -168,7 +168,6 @@ export default {
|
||||
const file = item || this.selected
|
||||
if (file) {
|
||||
this.$emit('choose-file', file)
|
||||
this.$bus.emit('choose-file', file)
|
||||
}
|
||||
},
|
||||
switchTab (tab = null) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@delete="onDelete" />
|
||||
<transition name="fade">
|
||||
<div v-if="showFilter" class="filter-wrapper" @click="showFilter = false">
|
||||
<XFilter @choose-file="f => { showFilter = false }" :repo="repo" :files="files" />
|
||||
<XFilter @choose-file="showFilter" :repo="repo" :files="files" />
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
@@ -105,8 +105,21 @@ export default {
|
||||
this.init(null, path)
|
||||
},
|
||||
keydownHandler (e) {
|
||||
if (e.key === 'p' && e.ctrlKey) {
|
||||
this.showFilter = true
|
||||
if (e.key === 'i' && e.ctrlKey && e.altKey) {
|
||||
this.showFilter = f => {
|
||||
if (this.file) {
|
||||
const relativePath = f.path.replace(this.file.path.substr(0, this.file.path.lastIndexOf('/')), '.')
|
||||
this.$bus.emit('editor-insert-value', `[${f.name.replace(/\.[^.]$/, '')}](${encodeURI(relativePath)})`)
|
||||
}
|
||||
this.showFilter = false
|
||||
}
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
} else if (e.key === 'p' && e.ctrlKey) {
|
||||
this.showFilter = f => {
|
||||
this.$bus.emit('choose-file', f)
|
||||
this.showFilter = false
|
||||
}
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
} else if (e.key === 'Escape' && this.showFilter) {
|
||||
|
||||
Reference in New Issue
Block a user