MCPcopy Index your code
hub / github.com/resend/react-email / addKeyboardShortcuts

Function addKeyboardShortcuts

packages/editor/src/extensions/code-block.tsx:96–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94 },
95
96 addKeyboardShortcuts() {
97 return {
98 ...this.parent?.(),
99 'Mod-a': ({ editor }) => {
100 const { state } = editor;
101 const { selection } = state;
102 const { $from } = selection;
103
104 for (let depth = $from.depth; depth >= 1; depth--) {
105 if ($from.node(depth).type.name === this.name) {
106 const blockStart = $from.start(depth);
107 const blockEnd = $from.end(depth);
108
109 const alreadyFullySelected =
110 selection.from === blockStart && selection.to === blockEnd;
111 if (alreadyFullySelected) {
112 return false;
113 }
114
115 const tr = state.tr.setSelection(
116 TextSelection.create(state.doc, blockStart, blockEnd),
117 );
118 editor.view.dispatch(tr);
119 return true;
120 }
121 }
122
123 return false;
124 },
125 };
126 },
127
128 addProseMirrorPlugins() {
129 return [

Callers

nothing calls this directly

Calls 3

dispatchMethod · 0.80
startMethod · 0.65
createMethod · 0.45

Tested by

no test coverage detected