mirror of
https://github.com/beekeeper-studio/beekeeper-studio.git
synced 2026-03-13 10:12:54 +08:00
Merge pull request #2994 from beekeeper-studio/fix/vim-clipboard
fix vim system clipboard
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
:columns-getter="columnsGetter"
|
||||
:default-schema="defaultSchema"
|
||||
:mode="dialectData.textEditorMode"
|
||||
:clipboard="$native.clipboard"
|
||||
@bks-initialized="handleEditorInitialized"
|
||||
@bks-value-change="unsavedText = $event.value"
|
||||
@bks-blur="onTextEditorBlur?.()"
|
||||
|
||||
@@ -96,6 +96,7 @@ export default {
|
||||
* In vim, that would be `:map ; :`.
|
||||
*/
|
||||
vimKeymaps: Array,
|
||||
clipboard: Object as PropType<Clipboard>
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -157,7 +158,7 @@ export default {
|
||||
|
||||
if (this.keymap === "vim") {
|
||||
const cmEl = this.$refs.editor.parentNode.querySelector(".CodeMirror");
|
||||
extendVimOnCodeMirror(cmEl, this.vimConfig, this.vimKeymaps);
|
||||
extendVimOnCodeMirror(cmEl, this.vimConfig, this.vimKeymaps, this.clipboard);
|
||||
}
|
||||
},
|
||||
vimKeymaps() {
|
||||
@@ -380,7 +381,7 @@ export default {
|
||||
cmEl.addEventListener("contextmenu", this.showContextMenu);
|
||||
|
||||
if (this.keymap === "vim") {
|
||||
extendVimOnCodeMirror(cmEl, this.vimConfig, this.vimKeymaps);
|
||||
extendVimOnCodeMirror(cmEl, this.vimConfig, this.vimKeymaps, this.clipboard);
|
||||
}
|
||||
|
||||
if (this.plugins) {
|
||||
|
||||
@@ -104,7 +104,7 @@ export class Register {
|
||||
}
|
||||
}
|
||||
|
||||
export function extendVimOnCodeMirror(cmEl: any, vimConfig?: Config, vimKeymaps: IMapping[] = []) {
|
||||
export function extendVimOnCodeMirror(cmEl: any, vimConfig?: Config, vimKeymaps: IMapping[] = [], clipboard: Clipboard) {
|
||||
const codeMirrorVimInstance = cmEl.CodeMirror.constructor.Vim;
|
||||
|
||||
if (!codeMirrorVimInstance) {
|
||||
@@ -124,7 +124,7 @@ export function extendVimOnCodeMirror(cmEl: any, vimConfig?: Config, vimKeymaps:
|
||||
try {
|
||||
codeMirrorVimInstance.defineRegister(
|
||||
"*",
|
||||
new Register(navigator)
|
||||
new Register(clipboard)
|
||||
);
|
||||
} catch (e) {
|
||||
// nothing
|
||||
|
||||
Reference in New Issue
Block a user