feat(editor): Ability to select line in codeblocks (#3798)
* feat(editor): Ability to select line in codeblocks * fix: Check to make sure sel is indeed in codeblock
This commit is contained in:
committed by
GitHub
parent
11e1ef455f
commit
c00bad38e2
@@ -12,6 +12,8 @@ import {
|
||||
Selection,
|
||||
TextSelection,
|
||||
Transaction,
|
||||
Plugin,
|
||||
PluginKey,
|
||||
} from "prosemirror-state";
|
||||
import refractor from "refractor/core";
|
||||
import bash from "refractor/lang/bash";
|
||||
@@ -283,7 +285,26 @@ export default class CodeFence extends Node {
|
||||
};
|
||||
|
||||
get plugins() {
|
||||
return [Prism({ name: this.name }), Mermaid({ name: this.name })];
|
||||
return [
|
||||
Prism({ name: this.name }),
|
||||
Mermaid({ name: this.name }),
|
||||
new Plugin({
|
||||
key: new PluginKey("triple-click"),
|
||||
props: {
|
||||
handleDOMEvents: {
|
||||
mousedown(view, event) {
|
||||
const {
|
||||
selection: { $from, $to },
|
||||
} = view.state;
|
||||
if (!isInCode(view.state)) {
|
||||
return false;
|
||||
}
|
||||
return $from.sameParent($to) && event.detail === 3;
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
inputRules({ type }: { type: NodeType }) {
|
||||
|
||||
Reference in New Issue
Block a user