chore: Cleanup editor menu handlers (#5174

* wip

* wip

* refactor
This commit is contained in:
Tom Moor
2023-04-10 18:50:21 -04:00
committed by GitHub
parent 70f3a998a4
commit 60dbad765a
15 changed files with 502 additions and 572 deletions

View File

@@ -25,17 +25,17 @@ export default class DateTime extends Extension {
// in places other than the start of a line
new InputRule(/\/date\s$/, ({ tr }, _match, start, end) => {
tr.delete(start, end).insertText(getCurrentDateAsString() + " ");
this.editor.events.emit(EventType.blockMenuClose);
this.editor.events.emit(EventType.SuggestionsMenuClose);
return tr;
}),
new InputRule(/\/time\s$/, ({ tr }, _match, start, end) => {
tr.delete(start, end).insertText(getCurrentTimeAsString() + " ");
this.editor.events.emit(EventType.blockMenuClose);
this.editor.events.emit(EventType.SuggestionsMenuClose);
return tr;
}),
new InputRule(/\/datetime\s$/, ({ tr }, _match, start, end) => {
tr.delete(start, end).insertText(`${getCurrentDateTimeAsString()} `);
this.editor.events.emit(EventType.blockMenuClose);
this.editor.events.emit(EventType.SuggestionsMenuClose);
return tr;
}),
];