Merge branch 'main' of github.com:ueberdosis/tiptap into main
This commit is contained in:
@@ -16,7 +16,7 @@ import Text from '@tiptap/extension-text'
|
|||||||
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'
|
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'
|
||||||
|
|
||||||
// load all highlight.js languages
|
// load all highlight.js languages
|
||||||
import { lowlight } from 'lowlight'
|
import { lowlight } from 'lowlight/lib/all'
|
||||||
|
|
||||||
// load specific languages only
|
// load specific languages only
|
||||||
// import { lowlight } from 'lowlight/lib/core'
|
// import { lowlight } from 'lowlight/lib/core'
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Plugin, PluginKey } from 'prosemirror-state'
|
|||||||
import { Decoration, DecorationSet } from 'prosemirror-view'
|
import { Decoration, DecorationSet } from 'prosemirror-view'
|
||||||
import { Node as ProsemirrorNode } from 'prosemirror-model'
|
import { Node as ProsemirrorNode } from 'prosemirror-model'
|
||||||
import { findChildren } from '@tiptap/core'
|
import { findChildren } from '@tiptap/core'
|
||||||
|
import { lowlight as lowlightAll } from 'lowlight'
|
||||||
|
|
||||||
function parseNodes(nodes: any[], className: string[] = []): { text: string, classes: string[] }[] {
|
function parseNodes(nodes: any[], className: string[] = []): { text: string, classes: string[] }[] {
|
||||||
return nodes
|
return nodes
|
||||||
@@ -43,6 +44,11 @@ function getDecorations({ doc, name, lowlight }: { doc: ProsemirrorNode, name: s
|
|||||||
nodes,
|
nodes,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log({
|
||||||
|
lowlightAll,
|
||||||
|
languages: lowlightAll.listLanguages(),
|
||||||
|
})
|
||||||
|
|
||||||
parseNodes(nodes).forEach(node => {
|
parseNodes(nodes).forEach(node => {
|
||||||
const to = from + node.text.length
|
const to = from + node.text.length
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user