Skip to content

Commit

Permalink
feat(commands): initiate
Browse files Browse the repository at this point in the history
  • Loading branch information
luolonghao committed Jul 19, 2024
1 parent d2e61e1 commit f67d46d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import deleteKey from './plugins/delete-key';
import tabKey from './plugins/tab-key';
import arrowKeys from './plugins/arrow-keys';
import escapeKey from './plugins/escape-key';
import commands from './plugins/commands';

Editor.box.add(hrBox);
Editor.box.add(codeBlockBox);
Expand Down Expand Up @@ -130,6 +131,7 @@ Editor.plugin.add(deleteKey);
Editor.plugin.add(tabKey);
Editor.plugin.add(arrowKeys);
Editor.plugin.add(escapeKey);
Editor.plugin.add(commands);

export {
Editor,
Expand Down
17 changes: 17 additions & 0 deletions src/plugins/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Editor } from '..';

export default (editor: Editor) => {
if (editor.readonly) {
return;
}
editor.keystroke.setKeydown('/', () => {
/*
const range = editor.selection.range;
if (range.isInsideBox) {
return;
}
*/
// TODO
// console.log(1);
});
};
1 change: 1 addition & 0 deletions tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ import './plugins/delete-key.test';
import './plugins/tab-key.test';
import './plugins/arrow-keys.test';
import './plugins/escape-key.test';
import './plugins/commands.test';

// UI
import './ui/button.test';
Expand Down
Empty file added tests/plugins/commands.test.ts
Empty file.

0 comments on commit f67d46d

Please sign in to comment.