mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
Desktop: Fixes #4243: Prevent double paste when using Shift+Ctrl+V
This commit is contained in:
parent
bb2855bd80
commit
17edebb6b1
@ -19,7 +19,7 @@ const taboverride = require('taboverride');
|
|||||||
const { reg } = require('@joplin/lib/registry.js');
|
const { reg } = require('@joplin/lib/registry.js');
|
||||||
const BaseItem = require('@joplin/lib/models/BaseItem');
|
const BaseItem = require('@joplin/lib/models/BaseItem');
|
||||||
const { themeStyle } = require('@joplin/lib/theme');
|
const { themeStyle } = require('@joplin/lib/theme');
|
||||||
const { clipboard } = require('electron');
|
// const { clipboard } = require('electron');
|
||||||
const supportedLocales = require('./supportedLocales');
|
const supportedLocales = require('./supportedLocales');
|
||||||
|
|
||||||
function markupRenderOptions(override: any = null) {
|
function markupRenderOptions(override: any = null) {
|
||||||
@ -1015,14 +1015,19 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onKeyDown(event: any) {
|
function onKeyDown(_event: any) {
|
||||||
|
// It seems "paste as text" is now handled automatically by
|
||||||
|
// either Chrome, Electron and/or TinyMCE so the code below
|
||||||
|
// should not longer be necessary. Also fixes
|
||||||
|
// https://github.com/laurent22/joplin/issues/4243
|
||||||
|
|
||||||
// Handle "paste as text". Note that when pressing CtrlOrCmd+Shift+V it's going
|
// Handle "paste as text". Note that when pressing CtrlOrCmd+Shift+V it's going
|
||||||
// to trigger the "keydown" event but not the "paste" event, so it's ok to process
|
// to trigger the "keydown" event but not the "paste" event, so it's ok to process
|
||||||
// it here and we don't need to do anything special in onPaste
|
// it here and we don't need to do anything special in onPaste
|
||||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey && event.code === 'KeyV') {
|
// if ((event.metaKey || event.ctrlKey) && event.shiftKey && event.code === 'KeyV') {
|
||||||
const pastedText = clipboard.readText();
|
// const pastedText = clipboard.readText();
|
||||||
if (pastedText) editor.insertContent(pastedText);
|
// if (pastedText) editor.insertContent(pastedText);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.on('keyup', onKeyUp);
|
editor.on('keyup', onKeyUp);
|
||||||
|
Loading…
Reference in New Issue
Block a user