@blocknote/core 0.39.1 → 0.39.2
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/{BlockNoteSchema-DmZ6UQfY.cjs → BlockNoteSchema-Bsa_tSAC.cjs} +8 -8
- package/dist/BlockNoteSchema-Bsa_tSAC.cjs.map +1 -0
- package/dist/{BlockNoteSchema-oR047ACf.js → BlockNoteSchema-CZez1nQf.js} +586 -617
- package/dist/BlockNoteSchema-CZez1nQf.js.map +1 -0
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +2 -2
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -2
- package/src/blocks/Code/block.ts +1 -5
- package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +2 -0
- package/types/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.d.ts +6 -0
- package/types/src/blocks/Divider/block.d.ts +3 -0
- package/types/src/editor/managers/BlockManager.d.ts +114 -0
- package/types/src/editor/managers/CollaborationManager.d.ts +115 -0
- package/types/src/editor/managers/EventManager.d.ts +58 -0
- package/types/src/editor/managers/ExportManager.d.ts +64 -0
- package/types/src/editor/managers/ExtensionManager.d.ts +68 -0
- package/types/src/editor/managers/SelectionManager.d.ts +54 -0
- package/types/src/editor/managers/StateManager.d.ts +115 -0
- package/types/src/editor/managers/StyleManager.d.ts +48 -0
- package/types/src/editor/managers/index.d.ts +8 -0
- package/dist/BlockNoteSchema-DmZ6UQfY.cjs.map +0 -1
- package/dist/BlockNoteSchema-oR047ACf.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/blocks/Code/shiki.ts +0 -73
package/src/blocks/Code/shiki.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { HighlighterGeneric } from "@shikijs/types";
|
|
2
|
-
import { Parser, createHighlightPlugin } from "prosemirror-highlight";
|
|
3
|
-
import { createParser } from "prosemirror-highlight/shiki";
|
|
4
|
-
import { CodeBlockOptions, getLanguageId } from "./block.js";
|
|
5
|
-
|
|
6
|
-
export const shikiParserSymbol = Symbol.for("blocknote.shikiParser");
|
|
7
|
-
export const shikiHighlighterPromiseSymbol = Symbol.for(
|
|
8
|
-
"blocknote.shikiHighlighterPromise",
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
export function lazyShikiPlugin(options: CodeBlockOptions) {
|
|
12
|
-
const globalThisForShiki = globalThis as {
|
|
13
|
-
[shikiHighlighterPromiseSymbol]?: Promise<HighlighterGeneric<any, any>>;
|
|
14
|
-
[shikiParserSymbol]?: Parser;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
let highlighter: HighlighterGeneric<any, any> | undefined;
|
|
18
|
-
let parser: Parser | undefined;
|
|
19
|
-
let hasWarned = false;
|
|
20
|
-
const lazyParser: Parser = (parserOptions) => {
|
|
21
|
-
if (!options.createHighlighter) {
|
|
22
|
-
if (process.env.NODE_ENV === "development" && !hasWarned) {
|
|
23
|
-
// eslint-disable-next-line no-console
|
|
24
|
-
console.log(
|
|
25
|
-
"For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function",
|
|
26
|
-
);
|
|
27
|
-
hasWarned = true;
|
|
28
|
-
}
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
if (!highlighter) {
|
|
32
|
-
globalThisForShiki[shikiHighlighterPromiseSymbol] =
|
|
33
|
-
globalThisForShiki[shikiHighlighterPromiseSymbol] ||
|
|
34
|
-
options.createHighlighter();
|
|
35
|
-
|
|
36
|
-
return globalThisForShiki[shikiHighlighterPromiseSymbol].then(
|
|
37
|
-
(createdHighlighter) => {
|
|
38
|
-
highlighter = createdHighlighter;
|
|
39
|
-
},
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
const language = getLanguageId(options, parserOptions.language!);
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
!language ||
|
|
46
|
-
language === "text" ||
|
|
47
|
-
language === "none" ||
|
|
48
|
-
language === "plaintext" ||
|
|
49
|
-
language === "txt"
|
|
50
|
-
) {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (!highlighter.getLoadedLanguages().includes(language)) {
|
|
55
|
-
return highlighter.loadLanguage(language);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!parser) {
|
|
59
|
-
parser =
|
|
60
|
-
globalThisForShiki[shikiParserSymbol] ||
|
|
61
|
-
createParser(highlighter as any);
|
|
62
|
-
globalThisForShiki[shikiParserSymbol] = parser;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return parser(parserOptions);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return createHighlightPlugin({
|
|
69
|
-
parser: lazyParser,
|
|
70
|
-
languageExtractor: (node) => node.attrs.language,
|
|
71
|
-
nodeTypes: ["codeBlock"],
|
|
72
|
-
});
|
|
73
|
-
}
|