tiptap: use prosemirror-codemark

see https://curvenote.github.io/prosemirror-codemark/
This commit is contained in:
fantasticit 2022-06-10 19:33:58 +08:00
parent d309d538f5
commit b05b6fe7ae
4 changed files with 27 additions and 1 deletions

View File

@ -73,6 +73,7 @@
"markdown-it-sup": "^1.0.0", "markdown-it-sup": "^1.0.0",
"next": "12.1.0", "next": "12.1.0",
"next-pwa": "^5.5.2", "next-pwa": "^5.5.2",
"prosemirror-codemark": "^0.3.6",
"prosemirror-commands": "^1.3.0", "prosemirror-commands": "^1.3.0",
"prosemirror-markdown": "^1.7.0", "prosemirror-markdown": "^1.7.0",
"prosemirror-model": "^1.16.1", "prosemirror-model": "^1.16.1",

View File

@ -1,4 +1,6 @@
import { Extension } from '@tiptap/core';
import BuiltInCode from '@tiptap/extension-code'; import BuiltInCode from '@tiptap/extension-code';
import codemark from 'prosemirror-codemark';
import { EXTENSION_PRIORITY_LOWER } from 'tiptap/core/constants'; import { EXTENSION_PRIORITY_LOWER } from 'tiptap/core/constants';
export const Code = BuiltInCode.extend({ export const Code = BuiltInCode.extend({
@ -10,3 +12,10 @@ export const Code = BuiltInCode.extend({
*/ */
priority: EXTENSION_PRIORITY_LOWER, priority: EXTENSION_PRIORITY_LOWER,
}); });
export const CodeMarkPlugin = Extension.create({
name: 'codemarkPlugin',
addProseMirrorPlugins() {
return codemark({ markType: this.editor.schema.marks.code });
},
});

View File

@ -6,7 +6,7 @@ import { Blockquote } from 'tiptap/core/extensions/blockquote';
import { Bold } from 'tiptap/core/extensions/bold'; import { Bold } from 'tiptap/core/extensions/bold';
import { BulletList } from 'tiptap/core/extensions/bullet-list'; import { BulletList } from 'tiptap/core/extensions/bullet-list';
import { Callout } from 'tiptap/core/extensions/callout'; import { Callout } from 'tiptap/core/extensions/callout';
import { Code } from 'tiptap/core/extensions/code'; import { Code, CodeMarkPlugin } from 'tiptap/core/extensions/code';
import { CodeBlock } from 'tiptap/core/extensions/code-block'; import { CodeBlock } from 'tiptap/core/extensions/code-block';
import { Color } from 'tiptap/core/extensions/color'; import { Color } from 'tiptap/core/extensions/color';
import { ColorHighlighter } from 'tiptap/core/extensions/color-highlighter'; import { ColorHighlighter } from 'tiptap/core/extensions/color-highlighter';
@ -89,6 +89,7 @@ export const CollaborationKit = [
Bold, Bold,
BulletList, BulletList,
Code, Code,
CodeMarkPlugin,
CodeBlock, CodeBlock,
Color, Color,
ColorHighlighter, ColorHighlighter,

View File

@ -118,6 +118,7 @@ importers:
markdown-it-sup: ^1.0.0 markdown-it-sup: ^1.0.0
next: 12.1.0 next: 12.1.0
next-pwa: ^5.5.2 next-pwa: ^5.5.2
prosemirror-codemark: ^0.3.6
prosemirror-commands: ^1.3.0 prosemirror-commands: ^1.3.0
prosemirror-markdown: ^1.7.0 prosemirror-markdown: ^1.7.0
prosemirror-model: ^1.16.1 prosemirror-model: ^1.16.1
@ -210,6 +211,7 @@ importers:
markdown-it-sup: 1.0.0 markdown-it-sup: 1.0.0
next: 12.1.0_react-dom@17.0.2+react@17.0.2 next: 12.1.0_react-dom@17.0.2+react@17.0.2
next-pwa: 5.5.2_next@12.1.0 next-pwa: 5.5.2_next@12.1.0
prosemirror-codemark: 0.3.6_4cf2d6daa1edf7cc132d3e7b74beaf4d
prosemirror-commands: 1.3.0 prosemirror-commands: 1.3.0
prosemirror-markdown: 1.7.0 prosemirror-markdown: 1.7.0
prosemirror-model: 1.16.1 prosemirror-model: 1.16.1
@ -9145,6 +9147,19 @@ packages:
object-assign: 4.1.1 object-assign: 4.1.1
react-is: 16.13.1 react-is: 16.13.1
/prosemirror-codemark/0.3.6_4cf2d6daa1edf7cc132d3e7b74beaf4d:
resolution: {integrity: sha512-uLUvIGfIEFdWEOR/wR2XgnccnyaUYNV/Degv/Dd5t8j1qKdbWbSkfqHgGi7sp5CcuBoZ/Q2hM6wbMc558T/Iag==}
peerDependencies:
prosemirror-inputrules: ^1.1.3
prosemirror-model: ^1.15.0
prosemirror-state: ^1.3.4
prosemirror-view: ^1.20.3
dependencies:
prosemirror-model: 1.16.1
prosemirror-state: 1.3.4
prosemirror-view: 1.23.6
dev: false
/prosemirror-commands/1.3.0: /prosemirror-commands/1.3.0:
resolution: {integrity: sha512-BwBbZ5OAScPcm0x7H8SPbqjuEJnCU2RJT9LDyOiiIl/3NbL1nJZI4SFNHwU2e/tRr2Xe7JsptpzseqvZvToLBQ==} resolution: {integrity: sha512-BwBbZ5OAScPcm0x7H8SPbqjuEJnCU2RJT9LDyOiiIl/3NbL1nJZI4SFNHwU2e/tRr2Xe7JsptpzseqvZvToLBQ==}
dependencies: dependencies: