@milkdown/crepe 7.15.5 → 7.17.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/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js +27 -22
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js +1 -1
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js +2 -2
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +30 -25
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js +27 -22
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js +2 -2
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js +2 -2
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +31 -26
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/feature/block-edit/handle/component.d.ts +2 -1
- package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/index.d.ts +0 -8
- package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/index.d.ts +2 -1
- package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -1
- package/lib/types/feature/code-mirror/index.d.ts +2 -15
- package/lib/types/feature/code-mirror/index.d.ts.map +1 -1
- package/lib/types/feature/toolbar/config.d.ts +5 -1
- package/lib/types/feature/toolbar/config.d.ts.map +1 -1
- package/lib/types/utils/group-builder.d.ts +1 -1
- package/lib/types/utils/group-builder.d.ts.map +1 -1
- package/package.json +3 -6
- package/src/feature/block-edit/handle/component.tsx +1 -1
- package/src/feature/block-edit/handle/index.ts +1 -1
- package/src/feature/block-edit/menu/index.ts +1 -1
- package/src/feature/code-mirror/index.ts +6 -23
- package/src/feature/cursor/index.ts +2 -2
- package/src/feature/latex/index.ts +2 -2
- package/src/utils/group-builder.ts +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
interface BlockHandleProps {
|
|
2
2
|
onAdd: () => void;
|
|
3
3
|
addIcon: string;
|
|
4
4
|
handleIcon: string;
|
|
5
5
|
}
|
|
6
6
|
export declare const BlockHandle: import("vue").DefineComponent<BlockHandleProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BlockHandleProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
export {};
|
|
7
8
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/handle/component.tsx"],"names":[],"mappings":"AAMA,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/handle/component.tsx"],"names":[],"mappings":"AAMA,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,4SA6CtB,CAAA"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import type { Ctx } from '@milkdown/kit/ctx';
|
|
2
|
-
import type { PluginView } from '@milkdown/kit/prose/state';
|
|
3
2
|
import type { BlockEditFeatureConfig } from '../index';
|
|
4
|
-
export declare class BlockHandleView implements PluginView {
|
|
5
|
-
#private;
|
|
6
|
-
constructor(ctx: Ctx, config?: BlockEditFeatureConfig);
|
|
7
|
-
update: () => void;
|
|
8
|
-
destroy: () => void;
|
|
9
|
-
onAdd: () => void;
|
|
10
|
-
}
|
|
11
3
|
export declare function configureBlockHandle(ctx: Ctx, config?: BlockEditFeatureConfig): void;
|
|
12
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/handle/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/handle/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAe5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAmFtD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,GAAG,EACR,MAAM,CAAC,EAAE,sBAAsB,QAehC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Ctx } from '@milkdown/kit/ctx';
|
|
2
2
|
import type { BlockEditFeatureConfig } from '../index';
|
|
3
3
|
export declare const menu: import("@milkdown/plugin-slash").SlashPlugin<"CREPE_MENU", any>;
|
|
4
|
-
|
|
4
|
+
interface MenuAPI {
|
|
5
5
|
show: (pos: number) => void;
|
|
6
6
|
hide: () => void;
|
|
7
7
|
}
|
|
8
8
|
export declare const menuAPI: import("@milkdown/utils").$Ctx<MenuAPI, "menuAPICtx">;
|
|
9
9
|
export declare function configureMenu(ctx: Ctx, config?: BlockEditFeatureConfig): void;
|
|
10
|
+
export {};
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAY5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAKtD,eAAO,MAAM,IAAI,iEAA6B,CAAA;AAE9C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAY5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAKtD,eAAO,MAAM,IAAI,iEAA6B,CAAA;AAE9C,UAAU,OAAO;IACf,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,IAAI,EAAE,MAAM,IAAI,CAAA;CACjB;AAED,eAAO,MAAM,OAAO,uDAMnB,CAAA;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,sBAAsB,QAItE"}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import type { LanguageDescription } from '@codemirror/language';
|
|
2
1
|
import type { Extension } from '@codemirror/state';
|
|
2
|
+
import { type CodeBlockConfig } from '@milkdown/kit/component/code-block';
|
|
3
3
|
import type { DefineFeature } from '../shared';
|
|
4
|
-
interface CodeMirrorConfig {
|
|
5
|
-
extensions: Extension[];
|
|
6
|
-
languages: LanguageDescription[];
|
|
4
|
+
interface CodeMirrorConfig extends CodeBlockConfig {
|
|
7
5
|
theme: Extension;
|
|
8
|
-
expandIcon: string;
|
|
9
|
-
searchIcon: string;
|
|
10
|
-
clearSearchIcon: string;
|
|
11
|
-
searchPlaceholder: string;
|
|
12
|
-
copyText: string;
|
|
13
|
-
copyIcon: string;
|
|
14
|
-
onCopy: (text: string) => void;
|
|
15
|
-
noResultText: string;
|
|
16
|
-
renderLanguage: (language: string, selected: boolean) => string;
|
|
17
|
-
renderPreview: (language: string, content: string) => string | HTMLElement | null;
|
|
18
6
|
previewToggleIcon: (previewOnlyMode: boolean) => string;
|
|
19
7
|
previewToggleText: (previewOnlyMode: boolean) => string;
|
|
20
|
-
previewLabel: string;
|
|
21
8
|
}
|
|
22
9
|
export type CodeMirrorFeatureConfig = Partial<CodeMirrorConfig>;
|
|
23
10
|
export declare const codeMirror: DefineFeature<CodeMirrorFeatureConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/code-mirror/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/code-mirror/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAIlD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,oCAAoC,CAAA;AAG3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAa9C,UAAU,gBAAiB,SAAQ,eAAe;IAChD,KAAK,EAAE,SAAS,CAAA;IAChB,iBAAiB,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,MAAM,CAAA;IACvD,iBAAiB,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,MAAM,CAAA;CACxD;AAED,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE/D,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,uBAAuB,CAiD7D,CAAA"}
|
|
@@ -7,6 +7,10 @@ export type ToolbarItem = {
|
|
|
7
7
|
export declare function getGroups(config?: ToolbarFeatureConfig, ctx?: Ctx): {
|
|
8
8
|
key: string;
|
|
9
9
|
label: string;
|
|
10
|
-
items: Omit<
|
|
10
|
+
items: Omit<{
|
|
11
|
+
index: number;
|
|
12
|
+
key: string;
|
|
13
|
+
onRun: (ctx: Ctx) => void;
|
|
14
|
+
} & ToolbarItem, "index">[];
|
|
11
15
|
}[];
|
|
12
16
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/feature/toolbar/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAoB5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAA;AAgB7C,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,CAAC,EAAE,GAAG
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/feature/toolbar/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAoB5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAA;AAgB7C,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,CAAC,EAAE,GAAG;;;;;;;;IA8FjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/group-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE5C,
|
|
1
|
+
{"version":3,"file":"group-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/group-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE5C,KAAK,QAAQ,CAAC,CAAC,IA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@milkdown/crepe",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.17.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -90,7 +90,6 @@
|
|
|
90
90
|
"src"
|
|
91
91
|
],
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@floating-ui/dom": "^1.5.1",
|
|
94
93
|
"@codemirror/commands": "^6.2.4",
|
|
95
94
|
"@codemirror/language": "^6.10.1",
|
|
96
95
|
"@codemirror/language-data": "^6.3.1",
|
|
@@ -102,13 +101,11 @@
|
|
|
102
101
|
"codemirror": "^6.0.1",
|
|
103
102
|
"katex": "^0.16.0",
|
|
104
103
|
"lodash-es": "^4.17.21",
|
|
105
|
-
"nanoid": "^5.0.9",
|
|
106
104
|
"prosemirror-virtual-cursor": "^0.4.2",
|
|
107
105
|
"remark-math": "^6.0.0",
|
|
108
|
-
"tslib": "^2.8.1",
|
|
109
106
|
"unist-util-visit": "^5.0.0",
|
|
110
|
-
"vue": "3.5.
|
|
111
|
-
"@milkdown/kit": "7.
|
|
107
|
+
"vue": "^3.5.20",
|
|
108
|
+
"@milkdown/kit": "7.17.0"
|
|
112
109
|
},
|
|
113
110
|
"scripts": {
|
|
114
111
|
"build": "pnpm run build:es && pnpm run build:theme && echo",
|
|
@@ -19,7 +19,7 @@ import { menuIcon, plusIcon } from '../../../icons'
|
|
|
19
19
|
import { menuAPI } from '../menu'
|
|
20
20
|
import { BlockHandle } from './component'
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
class BlockHandleView implements PluginView {
|
|
23
23
|
#content: HTMLElement
|
|
24
24
|
#provider: BlockProvider
|
|
25
25
|
#app: App
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LanguageDescription } from '@codemirror/language'
|
|
2
1
|
import type { Extension } from '@codemirror/state'
|
|
3
2
|
|
|
4
3
|
import { defaultKeymap, indentWithTab } from '@codemirror/commands'
|
|
@@ -6,6 +5,7 @@ import { keymap } from '@codemirror/view'
|
|
|
6
5
|
import {
|
|
7
6
|
codeBlockComponent,
|
|
8
7
|
codeBlockConfig,
|
|
8
|
+
type CodeBlockConfig,
|
|
9
9
|
} from '@milkdown/kit/component/code-block'
|
|
10
10
|
import { basicSetup } from 'codemirror'
|
|
11
11
|
|
|
@@ -22,32 +22,12 @@ import {
|
|
|
22
22
|
} from '../../icons'
|
|
23
23
|
import { CrepeFeature } from '../index'
|
|
24
24
|
|
|
25
|
-
interface CodeMirrorConfig {
|
|
26
|
-
extensions: Extension[]
|
|
27
|
-
languages: LanguageDescription[]
|
|
25
|
+
interface CodeMirrorConfig extends CodeBlockConfig {
|
|
28
26
|
theme: Extension
|
|
29
|
-
|
|
30
|
-
expandIcon: string
|
|
31
|
-
searchIcon: string
|
|
32
|
-
clearSearchIcon: string
|
|
33
|
-
|
|
34
|
-
searchPlaceholder: string
|
|
35
|
-
copyText: string
|
|
36
|
-
copyIcon: string
|
|
37
|
-
onCopy: (text: string) => void
|
|
38
|
-
noResultText: string
|
|
39
|
-
|
|
40
|
-
renderLanguage: (language: string, selected: boolean) => string
|
|
41
|
-
|
|
42
|
-
renderPreview: (
|
|
43
|
-
language: string,
|
|
44
|
-
content: string
|
|
45
|
-
) => string | HTMLElement | null
|
|
46
|
-
|
|
47
27
|
previewToggleIcon: (previewOnlyMode: boolean) => string
|
|
48
28
|
previewToggleText: (previewOnlyMode: boolean) => string
|
|
49
|
-
previewLabel: string
|
|
50
29
|
}
|
|
30
|
+
|
|
51
31
|
export type CodeMirrorFeatureConfig = Partial<CodeMirrorConfig>
|
|
52
32
|
|
|
53
33
|
export const codeMirror: DefineFeature<CodeMirrorFeatureConfig> = (
|
|
@@ -93,6 +73,9 @@ export const codeMirror: DefineFeature<CodeMirrorFeatureConfig> = (
|
|
|
93
73
|
return [icon, text].map((v) => v.trim()).join(' ')
|
|
94
74
|
},
|
|
95
75
|
previewLabel: config.previewLabel || defaultConfig.previewLabel,
|
|
76
|
+
previewLoading: config.previewLoading || defaultConfig.previewLoading,
|
|
77
|
+
previewOnlyByDefault:
|
|
78
|
+
config.previewOnlyByDefault ?? defaultConfig.previewOnlyByDefault,
|
|
96
79
|
}))
|
|
97
80
|
})
|
|
98
81
|
.use(codeBlockComponent)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cursor as cursorPlugin,
|
|
3
|
-
|
|
3
|
+
dropIndicatorConfig,
|
|
4
4
|
} from '@milkdown/kit/plugin/cursor'
|
|
5
5
|
import { $prose } from '@milkdown/kit/utils'
|
|
6
6
|
import { createVirtualCursor } from 'prosemirror-virtual-cursor'
|
|
@@ -21,7 +21,7 @@ export const cursor: DefineFeature<CursorFeatureConfig> = (editor, config) => {
|
|
|
21
21
|
editor
|
|
22
22
|
.config(crepeFeatureConfig(CrepeFeature.Cursor))
|
|
23
23
|
.config((ctx) => {
|
|
24
|
-
ctx.update(
|
|
24
|
+
ctx.update(dropIndicatorConfig.key, () => ({
|
|
25
25
|
class: 'crepe-drop-cursor',
|
|
26
26
|
width: config?.width ?? 4,
|
|
27
27
|
color: config?.color ?? false,
|
|
@@ -35,12 +35,12 @@ export const latex: DefineFeature<LatexFeatureConfig> = (editor, config) => {
|
|
|
35
35
|
|
|
36
36
|
ctx.update(codeBlockConfig.key, (prev) => ({
|
|
37
37
|
...prev,
|
|
38
|
-
renderPreview: (language, content) => {
|
|
38
|
+
renderPreview: (language, content, applyPreview) => {
|
|
39
39
|
if (language.toLowerCase() === 'latex' && content.length > 0) {
|
|
40
40
|
return renderLatex(content, config?.katexOptions)
|
|
41
41
|
}
|
|
42
42
|
const renderPreview = prev.renderPreview
|
|
43
|
-
return renderPreview(language, content)
|
|
43
|
+
return renderPreview(language, content, applyPreview)
|
|
44
44
|
},
|
|
45
45
|
}))
|
|
46
46
|
|