mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-23 18:53:36 +02:00
This commit is contained in:
parent
6e0ec05d17
commit
fd390dff6b
@ -141,7 +141,11 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
reg.logger().warn('CodeMirror: unsupported drop item: ', cmd);
|
||||
}
|
||||
} else if (cmd.name === 'editor.focus') {
|
||||
editorRef.current.focus();
|
||||
if (props.visiblePanes.indexOf('editor') >= 0) {
|
||||
editorRef.current.focus();
|
||||
} else {
|
||||
webviewRef.current.wrappedInstance.focus();
|
||||
}
|
||||
} else {
|
||||
commandProcessed = false;
|
||||
}
|
||||
@ -242,7 +246,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
return commandOutput;
|
||||
},
|
||||
};
|
||||
}, [props.content, addListItem, wrapSelectionWithStrings, setEditorPercentScroll, setViewerPercentScroll, resetScroll, renderedBody]);
|
||||
}, [props.content, props.visiblePanes, addListItem, wrapSelectionWithStrings, setEditorPercentScroll, setViewerPercentScroll, resetScroll, renderedBody]);
|
||||
|
||||
const onEditorPaste = useCallback(async (event: any = null) => {
|
||||
const resourceMds = await handlePasteEvent(event);
|
||||
|
@ -114,6 +114,12 @@ class NoteTextViewerComponent extends React.Component<Props, any> {
|
||||
this.domReady_ = false;
|
||||
}
|
||||
|
||||
focus() {
|
||||
if (this.webviewRef_.current) {
|
||||
this.webviewRef_.current.focus();
|
||||
}
|
||||
}
|
||||
|
||||
tryInit() {
|
||||
if (!this.initialized_ && this.webviewRef_.current) {
|
||||
this.initWebview();
|
||||
|
Loading…
x
Reference in New Issue
Block a user