@onereach/ui-components 2.70.0-beta.2159.0 → 2.70.0-beta.2164.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled/v2/{OrRichTextEditor-5843ecda.js → OrRichTextEditor-9e2535da.js} +6 -12
- package/dist/bundled/v2/{codemirrorView-14f6685c.js → codemirrorView-77ce9187.js} +2 -2
- package/dist/bundled/v2/components/index.js +2 -2
- package/dist/bundled/v2/components/or-rich-text-editor-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -18
- package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +1 -1
- package/dist/bundled/v2/index.js +2 -2
- package/dist/bundled/v3/{OrRichTextEditor.vue_vue_type_script_lang-e0dfd695.js → OrRichTextEditor.vue_vue_type_script_lang-1aa9ad53.js} +4 -10
- package/dist/bundled/v3/{codemirrorView-14f6685c.js → codemirrorView-77ce9187.js} +2 -2
- package/dist/bundled/v3/components/index.js +2 -2
- package/dist/bundled/v3/components/or-rich-text-editor-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -18
- package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +1 -1
- package/dist/bundled/v3/index.js +4 -4
- package/dist/esm/v2/{OrRichTextEditor-2d152db0.js → OrRichTextEditor-ed356c5b.js} +6 -12
- package/dist/esm/v2/{codemirrorView-8ea431d2.js → codemirrorView-2e87c938.js} +2 -2
- package/dist/esm/v2/components/index.js +2 -2
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +2 -2
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -18
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +1 -1
- package/dist/esm/v2/index.js +2 -2
- package/dist/esm/v3/{OrRichTextEditor-f1271eb6.js → OrRichTextEditor-f710fc9d.js} +5 -11
- package/dist/esm/v3/{codemirrorView-8ea431d2.js → codemirrorView-2e87c938.js} +2 -2
- package/dist/esm/v3/components/index.js +2 -2
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +2 -2
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -18
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +1 -1
- package/dist/esm/v3/index.js +2 -2
- package/package.json +1 -1
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +2 -2
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +17 -13
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +1 -1
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +11 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TextSelection, Selection } from 'prosemirror-state';
|
|
2
2
|
import { exitCode } from 'prosemirror-commands';
|
|
3
3
|
import { EditorState } from '@codemirror/state';
|
|
4
|
-
import { EditorView, keymap } from '@codemirror/view';
|
|
4
|
+
import { EditorView, highlightActiveLine, highlightActiveLineGutter, lineNumbers, keymap } from '@codemirror/view';
|
|
5
5
|
|
|
6
6
|
const computeChange = (oldVal, newVal) => {
|
|
7
7
|
if (oldVal === newVal) {
|
|
@@ -46,7 +46,7 @@ class CodeMirrorView {
|
|
|
46
46
|
this.dom = this.cm.dom;
|
|
47
47
|
const cmState = EditorState.create({
|
|
48
48
|
doc: this.node.textContent,
|
|
49
|
-
extensions: [changeFilter, keymap.of([{
|
|
49
|
+
extensions: [changeFilter, highlightActiveLine(), highlightActiveLineGutter(), lineNumbers(), keymap.of([{
|
|
50
50
|
key: 'ArrowUp',
|
|
51
51
|
run: this.mayBeEscape('line', -1)
|
|
52
52
|
}, {
|
|
@@ -96,7 +96,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-0665
|
|
|
96
96
|
export { _ as OrTooltip } from '../OrTooltip-614b016d.js';
|
|
97
97
|
export { _ as OrTooltipContent } from '../OrTooltip.vue_rollup-plugin-vue_script-63559536.js';
|
|
98
98
|
export { _ as OrTooltipV3 } from '../OrTooltip-513bee30.js';
|
|
99
|
-
export { _ as OrRichTextEditorV3 } from '../OrRichTextEditor-
|
|
99
|
+
export { _ as OrRichTextEditorV3 } from '../OrRichTextEditor-ed356c5b.js';
|
|
100
100
|
import 'vue-demi';
|
|
101
101
|
import 'lodash';
|
|
102
102
|
import '../normalize-component-6e8e3d80.js';
|
|
@@ -148,6 +148,6 @@ import '@tiptap/starter-kit';
|
|
|
148
148
|
import '@tiptap/extension-underline';
|
|
149
149
|
import '@tiptap/extension-heading';
|
|
150
150
|
import '@tiptap/extension-placeholder';
|
|
151
|
-
import '../codemirrorView-
|
|
151
|
+
import '../codemirrorView-2e87c938.js';
|
|
152
152
|
import 'prosemirror-state';
|
|
153
153
|
import 'prosemirror-commands';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { _ as OrRichTextEditorV3 } from '../../OrRichTextEditor-
|
|
1
|
+
export { _ as OrRichTextEditorV3 } from '../../OrRichTextEditor-ed356c5b.js';
|
|
2
2
|
import 'vue-demi';
|
|
3
3
|
import '../../useClassAttribute-47fdb016.js';
|
|
4
4
|
import '@vueuse/core';
|
|
@@ -37,7 +37,7 @@ import '@tiptap/starter-kit';
|
|
|
37
37
|
import '@tiptap/extension-underline';
|
|
38
38
|
import '@tiptap/extension-heading';
|
|
39
39
|
import '@tiptap/extension-placeholder';
|
|
40
|
-
import '../../codemirrorView-
|
|
40
|
+
import '../../codemirrorView-2e87c938.js';
|
|
41
41
|
import 'prosemirror-state';
|
|
42
42
|
import 'prosemirror-commands';
|
|
43
43
|
import '@codemirror/state';
|
|
@@ -4,24 +4,6 @@ import { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
|
4
4
|
import { Transaction as CMTransaction } from '@codemirror/state';
|
|
5
5
|
import { Command, EditorView as CMView } from '@codemirror/view';
|
|
6
6
|
import { CodeMirrorViewOptions } from './types';
|
|
7
|
-
declare module '@tiptap/core' {
|
|
8
|
-
interface Commands<ReturnType> {
|
|
9
|
-
codeBlock: {
|
|
10
|
-
/**
|
|
11
|
-
* Set a code block
|
|
12
|
-
*/
|
|
13
|
-
setCodeBlock: (attributes?: {
|
|
14
|
-
language: string;
|
|
15
|
-
}) => ReturnType;
|
|
16
|
-
/**
|
|
17
|
-
* Toggle a code block
|
|
18
|
-
*/
|
|
19
|
-
toggleCodeBlock: (attributes?: {
|
|
20
|
-
language: string;
|
|
21
|
-
}) => ReturnType;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
7
|
declare class CodeMirrorView implements NodeView {
|
|
26
8
|
name: string;
|
|
27
9
|
node: ProsemirrorNode;
|
package/dist/esm/v2/index.js
CHANGED
|
@@ -96,7 +96,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-06654
|
|
|
96
96
|
export { _ as OrTooltip } from './OrTooltip-614b016d.js';
|
|
97
97
|
export { _ as OrTooltipContent } from './OrTooltip.vue_rollup-plugin-vue_script-63559536.js';
|
|
98
98
|
export { _ as OrTooltipV3 } from './OrTooltip-513bee30.js';
|
|
99
|
-
export { _ as OrRichTextEditorV3 } from './OrRichTextEditor-
|
|
99
|
+
export { _ as OrRichTextEditorV3 } from './OrRichTextEditor-ed356c5b.js';
|
|
100
100
|
export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
|
|
101
101
|
export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
|
|
102
102
|
export { u as useElevation } from './useElevation-31bfe1f6.js';
|
|
@@ -148,7 +148,7 @@ import '@tiptap/starter-kit';
|
|
|
148
148
|
import '@tiptap/extension-underline';
|
|
149
149
|
import '@tiptap/extension-heading';
|
|
150
150
|
import '@tiptap/extension-placeholder';
|
|
151
|
-
import './codemirrorView-
|
|
151
|
+
import './codemirrorView-2e87c938.js';
|
|
152
152
|
import 'prosemirror-state';
|
|
153
153
|
import 'prosemirror-commands';
|
|
154
154
|
|
|
@@ -26,7 +26,7 @@ import StarterKit from '@tiptap/starter-kit';
|
|
|
26
26
|
import Underline from '@tiptap/extension-underline';
|
|
27
27
|
import Heading from '@tiptap/extension-heading';
|
|
28
28
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
29
|
-
import { C as CodeMirrorView } from './codemirrorView-
|
|
29
|
+
import { C as CodeMirrorView } from './codemirrorView-2e87c938.js';
|
|
30
30
|
import { minimalSetup } from 'codemirror';
|
|
31
31
|
import { javascript } from '@codemirror/lang-javascript';
|
|
32
32
|
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, createTextVNode, toDisplayString, createElementVNode, Fragment, renderList, createBlock, createCommentVNode } from 'vue';
|
|
@@ -140,7 +140,7 @@ const EditorInput = [
|
|
|
140
140
|
'min-h-[88px]'];
|
|
141
141
|
|
|
142
142
|
var codemirrorNode = Node.create({
|
|
143
|
-
name: '
|
|
143
|
+
name: 'codeBlock',
|
|
144
144
|
content: 'text*',
|
|
145
145
|
marks: '',
|
|
146
146
|
group: 'block',
|
|
@@ -367,12 +367,10 @@ var script = defineComponent({
|
|
|
367
367
|
editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleBlockquote().run();
|
|
368
368
|
} else if (item === 'codeBlock') {
|
|
369
369
|
if (!isActive.value['codeBlock']) {
|
|
370
|
-
|
|
371
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.setNode('code_block', {
|
|
370
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.setNode(item, {
|
|
372
371
|
language: 'javascript'
|
|
373
372
|
});
|
|
374
373
|
} else {
|
|
375
|
-
// isActive.value['codeBlock'] = false;
|
|
376
374
|
editor === null || editor === void 0 ? void 0 : editor.commands.setNode('paragraph');
|
|
377
375
|
}
|
|
378
376
|
} else if (item === 'heading') {
|
|
@@ -415,11 +413,7 @@ var script = defineComponent({
|
|
|
415
413
|
const setActiveFormats = () => {
|
|
416
414
|
const toolbarList = props.toolbar.flat();
|
|
417
415
|
toolbarList.forEach(item => {
|
|
418
|
-
|
|
419
|
-
isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive('code_block')) || false;
|
|
420
|
-
} else {
|
|
421
|
-
isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
|
|
422
|
-
}
|
|
416
|
+
isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
|
|
423
417
|
});
|
|
424
418
|
};
|
|
425
419
|
// Styles
|
|
@@ -564,7 +558,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
564
558
|
}, 8 /* PROPS */, ["trigger"])) : createCommentVNode("v-if", true)], 2 /* CLASS */);
|
|
565
559
|
}
|
|
566
560
|
|
|
567
|
-
var css_248z = ".tiptap-editor ol {\n margin: 0 24px;\n list-style: decimal;\n}\n.tiptap-editor ul {\n margin: 0 24px;\n list-style: initial;\n}\n.tiptap-editor pre {\n background-color: rgba(186, 209, 236, 0.3);\n padding: 4px 8px;\n margin: 4px 0;\n width: 100%;\n border-radius: 4px;\n}\n.tiptap-editor blockquote {\n margin: 8px 24px;\n padding: 0 24px;\n border-left: 4px solid #bad1ec;\n}\n.tiptap-editor .is-editor-empty::before {\n content: attr(data-placeholder);\n height: 0;\n pointer-events: none;\n float: left;\n}\n.tiptap-editor .cm-editor {\n border:
|
|
561
|
+
var css_248z = ".tiptap-editor ol {\n margin: 0 24px;\n list-style: decimal;\n}\n.tiptap-editor ul {\n margin: 0 24px;\n list-style: initial;\n}\n.tiptap-editor pre {\n background-color: rgba(186, 209, 236, 0.3);\n padding: 4px 8px;\n margin: 4px 0;\n width: 100%;\n border-radius: 4px;\n}\n.tiptap-editor blockquote {\n margin: 8px 24px;\n padding: 0 24px;\n border-left: 4px solid #bad1ec;\n}\n.tiptap-editor .is-editor-empty::before {\n content: attr(data-placeholder);\n height: 0;\n pointer-events: none;\n float: left;\n}\n.tiptap-editor .cm-editor {\n border: none;\n border-radius: 4px;\n}\n.tiptap-editor .cm-editor .cm-scroller {\n border-radius: 4px;\n}\n.tiptap-editor .cm-editor.cm-focused {\n outline: none;\n}\n.tiptap-editor .cm-editor .cm-gutters {\n background-color: rgba(0, 95, 177, 0.08);\n border: none;\n}\n.tiptap-editor .cm-editor .cm-gutters .cm-gutterElement {\n padding: 0 10px;\n}\n.tiptap-editor .cm-editor .cm-gutters .cm-gutterElement.cm-activeLineGutter {\n background-color: rgba(0, 95, 177, 0.07);\n}";
|
|
568
562
|
styleInject(css_248z);
|
|
569
563
|
|
|
570
564
|
script.render = render;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TextSelection, Selection } from 'prosemirror-state';
|
|
2
2
|
import { exitCode } from 'prosemirror-commands';
|
|
3
3
|
import { EditorState } from '@codemirror/state';
|
|
4
|
-
import { EditorView, keymap } from '@codemirror/view';
|
|
4
|
+
import { EditorView, highlightActiveLine, highlightActiveLineGutter, lineNumbers, keymap } from '@codemirror/view';
|
|
5
5
|
|
|
6
6
|
const computeChange = (oldVal, newVal) => {
|
|
7
7
|
if (oldVal === newVal) {
|
|
@@ -46,7 +46,7 @@ class CodeMirrorView {
|
|
|
46
46
|
this.dom = this.cm.dom;
|
|
47
47
|
const cmState = EditorState.create({
|
|
48
48
|
doc: this.node.textContent,
|
|
49
|
-
extensions: [changeFilter, keymap.of([{
|
|
49
|
+
extensions: [changeFilter, highlightActiveLine(), highlightActiveLineGutter(), lineNumbers(), keymap.of([{
|
|
50
50
|
key: 'ArrowUp',
|
|
51
51
|
run: this.mayBeEscape('line', -1)
|
|
52
52
|
}, {
|
|
@@ -90,7 +90,7 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from '../types-
|
|
|
90
90
|
export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-0665462d.js';
|
|
91
91
|
export { s as OrTooltip, a as OrTooltipContent } from '../OrTooltip-78cd7f6b.js';
|
|
92
92
|
export { s as OrTooltipV3 } from '../OrTooltip-50d27b4f.js';
|
|
93
|
-
export { s as OrRichTextEditorV3 } from '../OrRichTextEditor-
|
|
93
|
+
export { s as OrRichTextEditorV3 } from '../OrRichTextEditor-f710fc9d.js';
|
|
94
94
|
import 'vue-demi';
|
|
95
95
|
import 'lodash';
|
|
96
96
|
import 'vue';
|
|
@@ -140,6 +140,6 @@ import '@tiptap/starter-kit';
|
|
|
140
140
|
import '@tiptap/extension-underline';
|
|
141
141
|
import '@tiptap/extension-heading';
|
|
142
142
|
import '@tiptap/extension-placeholder';
|
|
143
|
-
import '../codemirrorView-
|
|
143
|
+
import '../codemirrorView-2e87c938.js';
|
|
144
144
|
import 'prosemirror-state';
|
|
145
145
|
import 'prosemirror-commands';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor-
|
|
1
|
+
export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor-f710fc9d.js';
|
|
2
2
|
import 'vue-demi';
|
|
3
3
|
import '../../useClassAttribute-47fdb016.js';
|
|
4
4
|
import '@vueuse/core';
|
|
@@ -36,7 +36,7 @@ import '@tiptap/starter-kit';
|
|
|
36
36
|
import '@tiptap/extension-underline';
|
|
37
37
|
import '@tiptap/extension-heading';
|
|
38
38
|
import '@tiptap/extension-placeholder';
|
|
39
|
-
import '../../codemirrorView-
|
|
39
|
+
import '../../codemirrorView-2e87c938.js';
|
|
40
40
|
import 'prosemirror-state';
|
|
41
41
|
import 'prosemirror-commands';
|
|
42
42
|
import '@codemirror/state';
|
|
@@ -4,24 +4,6 @@ import { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
|
4
4
|
import { Transaction as CMTransaction } from '@codemirror/state';
|
|
5
5
|
import { Command, EditorView as CMView } from '@codemirror/view';
|
|
6
6
|
import { CodeMirrorViewOptions } from './types';
|
|
7
|
-
declare module '@tiptap/core' {
|
|
8
|
-
interface Commands<ReturnType> {
|
|
9
|
-
codeBlock: {
|
|
10
|
-
/**
|
|
11
|
-
* Set a code block
|
|
12
|
-
*/
|
|
13
|
-
setCodeBlock: (attributes?: {
|
|
14
|
-
language: string;
|
|
15
|
-
}) => ReturnType;
|
|
16
|
-
/**
|
|
17
|
-
* Toggle a code block
|
|
18
|
-
*/
|
|
19
|
-
toggleCodeBlock: (attributes?: {
|
|
20
|
-
language: string;
|
|
21
|
-
}) => ReturnType;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
7
|
declare class CodeMirrorView implements NodeView {
|
|
26
8
|
name: string;
|
|
27
9
|
node: ProsemirrorNode;
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -90,7 +90,7 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from './types-8
|
|
|
90
90
|
export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-0665462d.js';
|
|
91
91
|
export { s as OrTooltip, a as OrTooltipContent } from './OrTooltip-78cd7f6b.js';
|
|
92
92
|
export { s as OrTooltipV3 } from './OrTooltip-50d27b4f.js';
|
|
93
|
-
export { s as OrRichTextEditorV3 } from './OrRichTextEditor-
|
|
93
|
+
export { s as OrRichTextEditorV3 } from './OrRichTextEditor-f710fc9d.js';
|
|
94
94
|
export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
|
|
95
95
|
export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
|
|
96
96
|
export { u as useElevation } from './useElevation-31bfe1f6.js';
|
|
@@ -140,7 +140,7 @@ import '@tiptap/starter-kit';
|
|
|
140
140
|
import '@tiptap/extension-underline';
|
|
141
141
|
import '@tiptap/extension-heading';
|
|
142
142
|
import '@tiptap/extension-placeholder';
|
|
143
|
-
import './codemirrorView-
|
|
143
|
+
import './codemirrorView-2e87c938.js';
|
|
144
144
|
import 'prosemirror-state';
|
|
145
145
|
import 'prosemirror-commands';
|
|
146
146
|
|
package/package.json
CHANGED
|
@@ -315,10 +315,8 @@ export default defineComponent({
|
|
|
315
315
|
}
|
|
316
316
|
else if (item === 'codeBlock') {
|
|
317
317
|
if (!isActive.value['codeBlock']) {
|
|
318
|
-
|
|
319
|
-
editor?.commands.setNode('code_block', { language: 'javascript' });
|
|
318
|
+
editor?.commands.setNode(item, { language: 'javascript' });
|
|
320
319
|
} else {
|
|
321
|
-
// isActive.value['codeBlock'] = false;
|
|
322
320
|
editor?.commands.setNode('paragraph');
|
|
323
321
|
}
|
|
324
322
|
}
|
|
@@ -367,11 +365,7 @@ export default defineComponent({
|
|
|
367
365
|
const setActiveFormats = () => {
|
|
368
366
|
const toolbarList = props.toolbar.flat() as string[];
|
|
369
367
|
toolbarList.forEach((item) => {
|
|
370
|
-
|
|
371
|
-
isActive.value[item] = editor?.isActive('code_block') || false;
|
|
372
|
-
} else {
|
|
373
|
-
isActive.value[item] = editor?.isActive(item) || false;
|
|
374
|
-
}
|
|
368
|
+
isActive.value[item] = editor?.isActive(item) || false;
|
|
375
369
|
});
|
|
376
370
|
};
|
|
377
371
|
|
|
@@ -494,19 +488,29 @@ export default defineComponent({
|
|
|
494
488
|
}
|
|
495
489
|
|
|
496
490
|
.cm-editor {
|
|
497
|
-
border:
|
|
491
|
+
border: none;
|
|
498
492
|
border-radius: 4px;
|
|
499
493
|
|
|
494
|
+
.cm-scroller {
|
|
495
|
+
border-radius: 4px;
|
|
496
|
+
}
|
|
497
|
+
|
|
500
498
|
&.cm-focused {
|
|
501
499
|
outline: none;
|
|
502
500
|
}
|
|
503
501
|
|
|
504
|
-
.cm-
|
|
505
|
-
|
|
506
|
-
|
|
502
|
+
.cm-gutters {
|
|
503
|
+
background-color: rgba(0, 95, 177, 0.08);
|
|
504
|
+
border: none;
|
|
505
|
+
|
|
506
|
+
.cm-gutterElement {
|
|
507
|
+
padding: 0 10px;
|
|
508
|
+
|
|
509
|
+
&.cm-activeLineGutter {
|
|
510
|
+
background-color: rgba(0, 95, 177, 0.07)
|
|
511
|
+
}
|
|
507
512
|
}
|
|
508
513
|
}
|
|
509
|
-
|
|
510
514
|
}
|
|
511
515
|
}
|
|
512
516
|
</style>
|
|
@@ -3,25 +3,17 @@ import { EditorView, NodeView } from 'prosemirror-view';
|
|
|
3
3
|
import { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
4
4
|
import { exitCode } from 'prosemirror-commands';
|
|
5
5
|
import { EditorState as CMState, Transaction as CMTransaction } from '@codemirror/state';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Command,
|
|
8
|
+
EditorView as CMView,
|
|
9
|
+
keymap,
|
|
10
|
+
highlightActiveLine,
|
|
11
|
+
highlightActiveLineGutter,
|
|
12
|
+
lineNumbers,
|
|
13
|
+
} from '@codemirror/view';
|
|
7
14
|
|
|
8
15
|
import { ComputeChange, CodeMirrorViewOptions } from './types';
|
|
9
16
|
|
|
10
|
-
declare module '@tiptap/core' {
|
|
11
|
-
interface Commands<ReturnType> {
|
|
12
|
-
codeBlock: {
|
|
13
|
-
/**
|
|
14
|
-
* Set a code block
|
|
15
|
-
*/
|
|
16
|
-
setCodeBlock: (attributes?: { language: string; }) => ReturnType;
|
|
17
|
-
/**
|
|
18
|
-
* Toggle a code block
|
|
19
|
-
*/
|
|
20
|
-
toggleCodeBlock: (attributes?: { language: string; }) => ReturnType;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
17
|
const computeChange = (oldVal: string, newVal: string): ComputeChange | null => {
|
|
26
18
|
if (oldVal === newVal) {
|
|
27
19
|
return null;
|
|
@@ -90,6 +82,9 @@ class CodeMirrorView implements NodeView {
|
|
|
90
82
|
doc: this.node.textContent,
|
|
91
83
|
extensions: [
|
|
92
84
|
changeFilter,
|
|
85
|
+
highlightActiveLine(),
|
|
86
|
+
highlightActiveLineGutter(),
|
|
87
|
+
lineNumbers(),
|
|
93
88
|
keymap.of([
|
|
94
89
|
{
|
|
95
90
|
key: 'ArrowUp',
|