update(codeblock): empty code block arrow keys are invalid

This commit is contained in:
yanmao 2021-12-31 01:51:47 +08:00
parent d557fdd43e
commit d1eb675e81
2 changed files with 6 additions and 2 deletions

View File

@ -143,6 +143,7 @@ class CodeBlockEditor implements CodeBlockEditorInterface {
// 按下下键 // 按下下键
if (isHotkey('down', event) || isHotkey('ctrl+n', event)) { if (isHotkey('down', event) || isHotkey('ctrl+n', event)) {
if (onDownFocus) onDownFocus(event); if (onDownFocus) onDownFocus(event);
return;
} }
// 按下右键 // 按下右键
else if ( else if (
@ -152,10 +153,11 @@ class CodeBlockEditor implements CodeBlockEditorInterface {
isHotkey('ctrl+f', event) isHotkey('ctrl+f', event)
) { ) {
if (onRightFocus) onRightFocus(event); if (onRightFocus) onRightFocus(event);
return;
} }
} }
// 在第一行按下上键 // 在第一行按下上键
else if (line === 0 && ch === 0) { if (line === 0 && ch === 0) {
// 按下上键 // 按下上键
if (isHotkey('up', event) || isHotkey('ctrl+p', event)) { if (isHotkey('up', event) || isHotkey('ctrl+p', event)) {
if (onUpFocus) onUpFocus(event); if (onUpFocus) onUpFocus(event);

View File

@ -107,6 +107,7 @@ class CodeBlockEditor implements CodeBlockEditorInterface {
// 按下下键 // 按下下键
if (isHotkey('down', event) || isHotkey('ctrl+n', event)) { if (isHotkey('down', event) || isHotkey('ctrl+n', event)) {
if (onDownFocus) onDownFocus(event); if (onDownFocus) onDownFocus(event);
return;
} }
// 按下右键 // 按下右键
else if ( else if (
@ -116,10 +117,11 @@ class CodeBlockEditor implements CodeBlockEditorInterface {
isHotkey('ctrl+f', event) isHotkey('ctrl+f', event)
) { ) {
if (onRightFocus) onRightFocus(event); if (onRightFocus) onRightFocus(event);
return;
} }
} }
// 在第一行按下上键 // 在第一行按下上键
else if (line === 0 && ch === 0) { if (line === 0 && ch === 0) {
// 按下上键 // 按下上键
if (isHotkey('up', event) || isHotkey('ctrl+p', event)) { if (isHotkey('up', event) || isHotkey('ctrl+p', event)) {
if (onUpFocus) onUpFocus(event); if (onUpFocus) onUpFocus(event);