feat(): disable shift-keydown

This commit is contained in:
yanmao 2021-11-17 15:46:17 +08:00
parent f869c63f26
commit 38de981c70
2 changed files with 19 additions and 11 deletions

View File

@ -50,7 +50,7 @@ import Parser from '../parser';
import Language from '../language';
import Mark from '../mark';
import List from '../list';
import { EditorInterface, TypingInterface } from '../types';
import { TypingInterface } from '../types';
import Typing from '../typing';
import Container from './container';
import Inline from '../inline';

View File

@ -34,6 +34,12 @@ class ShitEnter implements TypingHandleInterface {
event.preventDefault();
change.cacheRangeBeforeCommand();
const range = change.range.get();
if (range.startNode.closest('li').length === 0) {
this.engine.typing
.getHandleListener('enter', 'keydown')
?.trigger(event);
return;
} else {
const br = $('<br />');
inline.insert(br, range);
if (block.isLastOffset(range, 'end')) {
@ -46,6 +52,8 @@ class ShitEnter implements TypingHandleInterface {
range.select(cloneBr).collapse(false);
}
}
}
for (let i = 0; i < this.listeners.length; i++) {
const listener = this.listeners[i];
const result = listener(event);