@jvs-milkdown/crepe 1.2.17 → 1.2.20
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/builder.js +4 -0
- package/lib/cjs/builder.js.map +1 -1
- package/lib/cjs/feature/block-edit/index.js +4 -0
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js +4 -0
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js +4 -0
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/image-block/index.js +4 -0
- package/lib/cjs/feature/image-block/index.js.map +1 -1
- package/lib/cjs/feature/inline-diff/index.js +4 -0
- package/lib/cjs/feature/inline-diff/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js +4 -0
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/link-tooltip/index.js +4 -0
- package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
- package/lib/cjs/feature/list-item/index.js +4 -0
- package/lib/cjs/feature/list-item/index.js.map +1 -1
- package/lib/cjs/feature/placeholder/index.js +4 -0
- package/lib/cjs/feature/placeholder/index.js.map +1 -1
- package/lib/cjs/feature/table/index.js +4 -0
- package/lib/cjs/feature/table/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +56 -22
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +533 -151
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/builder.js +4 -0
- package/lib/esm/builder.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +4 -0
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js +4 -0
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js +4 -0
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/image-block/index.js +4 -0
- package/lib/esm/feature/image-block/index.js.map +1 -1
- package/lib/esm/feature/inline-diff/index.js +4 -0
- package/lib/esm/feature/inline-diff/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js +4 -0
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/link-tooltip/index.js +4 -0
- package/lib/esm/feature/link-tooltip/index.js.map +1 -1
- package/lib/esm/feature/list-item/index.js +4 -0
- package/lib/esm/feature/list-item/index.js.map +1 -1
- package/lib/esm/feature/placeholder/index.js +4 -0
- package/lib/esm/feature/placeholder/index.js.map +1 -1
- package/lib/esm/feature/table/index.js +4 -0
- package/lib/esm/feature/table/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +56 -22
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +700 -318
- package/lib/esm/index.js.map +1 -1
- package/lib/theme/common/toolbar.css +9 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/crepe.d.ts +2 -1
- package/lib/types/core/crepe.d.ts.map +1 -1
- package/lib/types/core/locale.d.ts +4 -0
- package/lib/types/core/locale.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/component.d.ts +2 -0
- package/lib/types/feature/fixed-toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/config.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/index.d.ts +16 -0
- package/lib/types/feature/fixed-toolbar/index.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/menu-bar.d.ts.map +1 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/lib/types/icons/export.d.ts +2 -0
- package/lib/types/icons/export.d.ts.map +1 -0
- package/lib/types/icons/import.d.ts +2 -0
- package/lib/types/icons/import.d.ts.map +1 -0
- package/lib/types/icons/index.d.ts +4 -0
- package/lib/types/icons/index.d.ts.map +1 -1
- package/lib/types/icons/redo.d.ts +2 -0
- package/lib/types/icons/redo.d.ts.map +1 -0
- package/lib/types/icons/undo.d.ts +2 -0
- package/lib/types/icons/undo.d.ts.map +1 -0
- package/lib/types/utils/fixed-toolbar-popup-state.d.ts +1 -0
- package/lib/types/utils/fixed-toolbar-popup-state.d.ts.map +1 -1
- package/package.json +116 -62
- package/src/core/crepe.ts +122 -7
- package/src/core/locale.ts +4 -0
- package/src/feature/fixed-toolbar/component.tsx +154 -53
- package/src/feature/fixed-toolbar/config.ts +70 -2
- package/src/feature/fixed-toolbar/index.ts +85 -0
- package/src/feature/fixed-toolbar/menu-bar.tsx +17 -3
- package/src/feature/toolbar/component.tsx +61 -23
- package/src/icons/export.ts +5 -0
- package/src/icons/import.ts +6 -0
- package/src/icons/index.ts +4 -0
- package/src/icons/redo.ts +5 -0
- package/src/icons/undo.ts +5 -0
- package/src/theme/common/toolbar.css +19 -0
- package/src/utils/fixed-toolbar-popup-state.ts +5 -0
- package/LICENSE +0 -21
|
@@ -7,6 +7,7 @@ export interface CrepeConfig extends CrepeBuilderConfig {
|
|
|
7
7
|
}
|
|
8
8
|
export declare class Crepe extends CrepeBuilder {
|
|
9
9
|
static Feature: typeof CrepeFeature;
|
|
10
|
-
constructor(
|
|
10
|
+
constructor(config?: CrepeConfig);
|
|
11
|
+
destroy: () => Promise<import("@jvs-milkdown/core").Editor>;
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=crepe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crepe.d.ts","sourceRoot":"","sources":["../../../src/core/crepe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"crepe.d.ts","sourceRoot":"","sources":["../../../src/core/crepe.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAGpD,OAAO,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAA;AAG1D,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAGjE,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IAErD,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAA;IAGjD,cAAc,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAGD,qBAAa,KAAM,SAAQ,YAAY;IAErC,MAAM,CAAC,OAAO,sBAAe;gBAKjB,MAAM,GAAE,WAAgB;IA0G3B,OAAO,qDAGf;CACF"}
|
|
@@ -106,6 +106,8 @@ export declare const zhCN: {
|
|
|
106
106
|
'customMenu.colorPurple': string;
|
|
107
107
|
'customMenu.colorGray': string;
|
|
108
108
|
'customMenu.insertTable': string;
|
|
109
|
+
'customMenu.export': string;
|
|
110
|
+
'customMenu.import': string;
|
|
109
111
|
'customMenu.fontDefault': string;
|
|
110
112
|
'font.fangSong': string;
|
|
111
113
|
'font.stFangsong': string;
|
|
@@ -252,6 +254,8 @@ export declare const translationsCtx: import("@jvs-milkdown/ctx").SliceType<Reco
|
|
|
252
254
|
'customMenu.colorPurple': string;
|
|
253
255
|
'customMenu.colorGray': string;
|
|
254
256
|
'customMenu.insertTable': string;
|
|
257
|
+
'customMenu.export': string;
|
|
258
|
+
'customMenu.import': string;
|
|
255
259
|
'customMenu.fontDefault': string;
|
|
256
260
|
'font.fangSong': string;
|
|
257
261
|
'font.stFangsong': string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../src/core/locale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAIhD,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../src/core/locale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAIhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiLhB,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,OAAO,IAiKzB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,IAAI,CAAA;AAE3C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAQ3B,CAAA;AAED,eAAO,MAAM,SAAS,4DAAoC,CAAA;AAE1D,wBAAgB,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,iBAAiB,GAAG,MAAM,CASnE"}
|
|
@@ -8,6 +8,8 @@ type FixedToolbarProps = {
|
|
|
8
8
|
show: Ref<boolean>;
|
|
9
9
|
selection: ShallowRef<Selection>;
|
|
10
10
|
config?: FixedToolbarFeatureConfig;
|
|
11
|
+
canUndo: Ref<boolean>;
|
|
12
|
+
canRedo: Ref<boolean>;
|
|
11
13
|
};
|
|
12
14
|
export declare const FixedToolbarComponent: import("@vue/runtime-core").DefineComponent<FixedToolbarProps, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<FixedToolbarProps> & Readonly<{}>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
13
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAI9D,OAAO,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAI9D,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,GAAG,EAIT,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,GAAG,CAAA;AAOlD,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,yBAAyB,CAAA;IAClC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,qBAAqB,oXA8JhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAkChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAqDxD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC,EAClC,OAAO,CAAC,EAAE,yBAAyB,EACnC,GAAG,CAAC,EAAE,GAAG;;;;;;;;IAmhBV"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Ctx } from '@jvs-milkdown/kit/ctx';
|
|
1
2
|
import { PluginKey } from '@jvs-milkdown/kit/prose/state';
|
|
2
3
|
import type { GroupBuilder } from '../../utils';
|
|
3
4
|
import type { DefineFeature } from '../shared';
|
|
@@ -16,6 +17,21 @@ export interface FixedToolbarConfig {
|
|
|
16
17
|
outlinePosition?: 'left' | 'right';
|
|
17
18
|
onUploadCover?: (file: File) => Promise<string>;
|
|
18
19
|
defaultCoverImages?: string[];
|
|
20
|
+
showMenuBar?: boolean;
|
|
21
|
+
menuBarItems?: {
|
|
22
|
+
file?: boolean;
|
|
23
|
+
edit?: boolean;
|
|
24
|
+
view?: boolean;
|
|
25
|
+
insert?: boolean;
|
|
26
|
+
format?: boolean;
|
|
27
|
+
};
|
|
28
|
+
showHistory?: boolean;
|
|
29
|
+
showExport?: boolean;
|
|
30
|
+
onExport?: (markdown: string, ctx: Ctx) => void;
|
|
31
|
+
showImport?: boolean;
|
|
32
|
+
onImport?: (replaceContent: (markdown: string) => void, ctx: Ctx) => void;
|
|
33
|
+
useLocalStorage?: boolean;
|
|
34
|
+
id?: string;
|
|
19
35
|
}
|
|
20
36
|
export type FixedToolbarFeatureConfig = Partial<FixedToolbarConfig>;
|
|
21
37
|
export declare const fixedToolbarConfig: import("@jvs-milkdown/utils").$Ctx<Partial<FixedToolbarConfig>, "fixedToolbarConfigCtx">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAIhD,OAAO,EAAU,SAAS,EAAiB,MAAM,+BAA+B,CAAA;AAehF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAYpD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC,KAAK,IAAI,CAAA;IAC3D,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAClC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/C,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE;QACb,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,MAAM,CAAC,EAAE,OAAO,CAAA;KACjB,CAAA;IACD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IACzE,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAEnE,eAAO,MAAM,kBAAkB,0FAG9B,CAAA;AAED,eAAO,MAAM,eAAe,gBAA0C,CAAA;AAsWtE,eAAO,MAAM,kBAAkB,sCAK7B,CAAA;AAEF,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,yBAAyB,CA6BjE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-bar.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/menu-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"menu-bar.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/menu-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAahD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAsDjD,eAAO,MAAM,OAAO;;cAEO,MAAM,GAAG;;;;cACN,MAAM,kBAAkB;;;;;cAD3B,MAAM,GAAG;;;;cACN,MAAM,kBAAkB;;;+GAkgBpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/feature/toolbar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAgBhD,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,+BAA+B,CAAA;AAUtC,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,UAAU,EAQhB,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAA;AAmG7C,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAeD,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/feature/toolbar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAgBhD,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,+BAA+B,CAAA;AAUtC,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,UAAU,EAQhB,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAA;AAmG7C,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAeD,eAAO,MAAM,OAAO,0WAihFlB,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const exportIcon = "\n<svg viewBox=\"0 0 1024 1024\" version=\"1.1\" width=\"20\" height=\"20\">\n <path d=\"M452.288 725.12L246.016 537.6c-4.928-4.48-10.432-8.832-14.72-13.696-20.8-23.232-21.312-42.944-2.304-59.52 17.664-15.36 43.392-14.976 65.536 4.48 49.088 43.328 32.256 27.712 80.512 71.744l69.376 63.36 11.968 10.688v-173.44c0-33.92-0.128-80.96-0.32-128.448-0.192-51.52-0.32-103.616-0.32-140.16L455.68 163.84a183.04 183.04 0 0 1 0.704-24.896c3.52-29.248 19.328-43.712 45.248-42.88 25.344 0.768 41.088 15.872 42.688 45.504 1.28 22.848 1.024 45.888 0.768 68.864l-0.128 27.136c0 50.048 0.128 112.832 0.256 176.384 0.192 71.552 0.384 144.192 0.32 200.704 74.432-68.224 131.968-119.68 162.688-147.584 7.424-6.72 14.912-14.272 24-18.304 18.688-8.448 37.76-7.808 52.8 7.36 14.72 14.72 16.384 31.36 3.968 48.192-3.84 5.248-8.64 10.112-13.44 14.656-45.76 41.92-189.76 173.248-236.16 214.464a62.336 62.336 0 0 1-8.064 6.016 43.712 43.712 0 0 1-15.872 9.792c-20.544 7.104-37.504-0.512-51.968-13.952l-11.2-10.24z m430.784-37.248c24-0.576 42.176 13.44 43.328 39.04 1.728 38.208 2.944 76.992-1.088 115.136-5.312 50.752-51.52 84.16-114.752 85.312-50.112 0.832-100.224 0.64-150.4 0.512l-64.832-0.128H422.272a26252.8 26252.8 0 0 1-194.432-0.192c-90.624-0.512-130.752-37.696-131.392-120.64l-0.192-17.408c-0.32-19.84-0.576-39.68 0.768-59.392 1.92-27.904 20.48-43.648 45.76-42.368 23.488 1.152 37.312 15.296 40.064 42.368 0.896 9.152 0.832 18.432 0.704 27.648l-0.064 10.816c0.384 71.744 7.36 78.208 88.128 78.272 117.248 0.128 234.432 0.128 351.68 0l43.968 0.192c36.096 0.064 72.192 0.192 108.288-0.448 52.672-0.96 64-12.096 65.152-60.288a494.464 494.464 0 0 0 0-21.76 365.632 365.632 0 0 1 0.704-35.84c2.24-26.048 17.92-40.32 41.664-40.832z\" fill=\"currentColor\"></path>\n</svg>\n";
|
|
2
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/icons/export.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,2tDAItB,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const importIcon = "\n<svg viewBox=\"0 0 1024 1024\" version=\"1.1\" width=\"20\" height=\"20\">\n <path d=\"M838.656 594.432a41.152 41.152 0 0 0-40.768 41.472v176.128c0 0.384-0.384 0.96-1.216 0.96H210.688c-0.768 0-1.216-0.576-1.216-0.96V275.968c0-0.384 0.448-0.96 1.216-0.96h143.616a41.088 41.088 0 0 0 41.28-41.472A41.088 41.088 0 0 0 354.304 192H210.688C165.12 192 128 229.76 128 275.968v536.064C128 858.368 165.12 896 210.688 896h585.984c45.632 0 82.688-37.632 82.688-83.968V635.904a41.152 41.152 0 0 0-40.704-41.472z\" fill=\"currentColor\"></path>\n <path d=\"M895.744 229.056a40.896 40.896 0 0 0-44.864-36.8c-4.032 0.448-99.456 11.52-200.576 68.352-106.24 59.776-179.2 147.648-214.656 257.28l-44.672-131.584a40.576 40.576 0 0 0-51.84-25.792 41.664 41.664 0 0 0-25.152 52.928l80.064 235.968a40.576 40.576 0 0 0 51.84 25.6l0.512-0.128 232.192-85.312a41.728 41.728 0 0 0 24-52.928 40.576 40.576 0 0 0-51.648-25.152l-144 52.928c26.048-99.2 86.464-176.256 180.416-229.76a508.672 508.672 0 0 1 172.416-59.904c22.336-2.56 38.4-22.976 35.968-45.696z\" fill=\"currentColor\"></path>\n</svg>\n";
|
|
2
|
+
//# sourceMappingURL=import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../src/icons/import.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,qjCAKtB,CAAA"}
|
|
@@ -53,4 +53,8 @@ export * from './word-wrap';
|
|
|
53
53
|
export * from './crop';
|
|
54
54
|
export * from './border';
|
|
55
55
|
export * from './format-painter';
|
|
56
|
+
export * from './undo';
|
|
57
|
+
export * from './redo';
|
|
58
|
+
export * from './export';
|
|
59
|
+
export * from './import';
|
|
56
60
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,MAAM,CAAA;AACpB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const redoIcon = "\n<svg viewBox=\"0 0 1024 1024\" version=\"1.1\" width=\"20\" height=\"20\">\n <path d=\"M755.584 183.168a42.688 42.688 0 0 0-60.352 60.352l97.856 97.792H341.44a256 256 0 0 0 0 512h213.312a42.688 42.688 0 0 0 0-85.312H341.44a170.688 170.688 0 0 1 0-341.312h451.648l-97.856 97.856a42.688 42.688 0 0 0 60.352 60.288l170.048-170.048a42.56 42.56 0 0 0 0-61.568l-170.048-170.048z\" fill=\"currentColor\"></path>\n</svg>\n";
|
|
2
|
+
//# sourceMappingURL=redo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redo.d.ts","sourceRoot":"","sources":["../../../src/icons/redo.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,saAIpB,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const undoIcon = "\n<svg viewBox=\"0 0 1024 1024\" version=\"1.1\" width=\"20\" height=\"20\">\n <path d=\"M328.768 243.52a42.688 42.688 0 0 0-60.352-60.352L97.92 353.664A43.008 43.008 0 0 0 85.248 384a42.56 42.56 0 0 0 12.48 30.208l170.688 170.624a42.688 42.688 0 1 0 60.352-60.288l-97.92-97.92h451.712a170.688 170.688 0 1 1 0 341.376H469.248a42.688 42.688 0 1 0 0 85.312h213.312a256 256 0 1 0 0-512H230.912l97.856-97.792z\" fill=\"currentColor\"></path>\n</svg>\n";
|
|
2
|
+
//# sourceMappingURL=undo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undo.d.ts","sourceRoot":"","sources":["../../../src/icons/undo.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,qcAIpB,CAAA"}
|
|
@@ -3,5 +3,6 @@ export declare function getIsAnyPopupOpen(): boolean;
|
|
|
3
3
|
export declare function addPopupChangeListener(fn: Listener): () => void;
|
|
4
4
|
export declare function incrementPopupCount(): void;
|
|
5
5
|
export declare function decrementPopupCount(): void;
|
|
6
|
+
export declare function resetPopupCount(): void;
|
|
6
7
|
export {};
|
|
7
8
|
//# sourceMappingURL=fixed-toolbar-popup-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixed-toolbar-popup-state.d.ts","sourceRoot":"","sources":["../../../src/utils/fixed-toolbar-popup-state.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAA;AAI1B,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,IAAI,CAG/D;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAM1C;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAK1C"}
|
|
1
|
+
{"version":3,"file":"fixed-toolbar-popup-state.d.ts","sourceRoot":"","sources":["../../../src/utils/fixed-toolbar-popup-state.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAA;AAI1B,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,IAAI,CAG/D;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAM1C;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAK1C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAGtC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jvs-milkdown/crepe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.20",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"crepe",
|
|
6
6
|
"editor",
|
|
@@ -19,85 +19,145 @@
|
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
21
|
"sideEffects": false,
|
|
22
|
-
"main": "./
|
|
22
|
+
"main": "./src/index.ts",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"import": "./
|
|
26
|
-
"require": "./lib/cjs/index.js",
|
|
27
|
-
"types": "./lib/types/index.d.ts"
|
|
25
|
+
"import": "./src/index.ts"
|
|
28
26
|
},
|
|
29
27
|
"./builder": {
|
|
30
|
-
"import": "./
|
|
31
|
-
"require": "./lib/cjs/builder.js",
|
|
32
|
-
"types": "./lib/types/builder.d.ts"
|
|
28
|
+
"import": "./src/builder.ts"
|
|
33
29
|
},
|
|
34
30
|
"./feature/block-edit": {
|
|
35
|
-
"import": "./
|
|
36
|
-
"require": "./lib/cjs/feature/block-edit/index.js",
|
|
37
|
-
"types": "./lib/types/feature/block-edit/index.d.ts"
|
|
31
|
+
"import": "./src/feature/block-edit/index.ts"
|
|
38
32
|
},
|
|
39
33
|
"./feature/code-mirror": {
|
|
40
|
-
"import": "./
|
|
41
|
-
"require": "./lib/cjs/feature/code-mirror/index.js",
|
|
42
|
-
"types": "./lib/types/feature/code-mirror/index.d.ts"
|
|
34
|
+
"import": "./src/feature/code-mirror/index.ts"
|
|
43
35
|
},
|
|
44
36
|
"./feature/cursor": {
|
|
45
|
-
"import": "./
|
|
46
|
-
"require": "./lib/cjs/feature/cursor/index.js",
|
|
47
|
-
"types": "./lib/types/feature/cursor/index.d.ts"
|
|
37
|
+
"import": "./src/feature/cursor/index.ts"
|
|
48
38
|
},
|
|
49
39
|
"./feature/image-block": {
|
|
50
|
-
"import": "./
|
|
51
|
-
"require": "./lib/cjs/feature/image-block/index.js",
|
|
52
|
-
"types": "./lib/types/feature/image-block/index.d.ts"
|
|
40
|
+
"import": "./src/feature/image-block/index.ts"
|
|
53
41
|
},
|
|
54
42
|
"./feature/latex": {
|
|
55
|
-
"import": "./
|
|
56
|
-
"require": "./lib/cjs/feature/latex/index.js",
|
|
57
|
-
"types": "./lib/types/feature/latex/index.d.ts"
|
|
43
|
+
"import": "./src/feature/latex/index.ts"
|
|
58
44
|
},
|
|
59
45
|
"./feature/link-tooltip": {
|
|
60
|
-
"import": "./
|
|
61
|
-
"require": "./lib/cjs/feature/link-tooltip/index.js",
|
|
62
|
-
"types": "./lib/types/feature/link-tooltip/index.d.ts"
|
|
46
|
+
"import": "./src/feature/link-tooltip/index.ts"
|
|
63
47
|
},
|
|
64
48
|
"./feature/list-item": {
|
|
65
|
-
"import": "./
|
|
66
|
-
"require": "./lib/cjs/feature/list-item/index.js",
|
|
67
|
-
"types": "./lib/types/feature/list-item/index.d.ts"
|
|
49
|
+
"import": "./src/feature/list-item/index.ts"
|
|
68
50
|
},
|
|
69
51
|
"./feature/placeholder": {
|
|
70
|
-
"import": "./
|
|
71
|
-
"require": "./lib/cjs/feature/placeholder/index.js",
|
|
72
|
-
"types": "./lib/types/feature/placeholder/index.d.ts"
|
|
52
|
+
"import": "./src/feature/placeholder/index.ts"
|
|
73
53
|
},
|
|
74
54
|
"./feature/table": {
|
|
75
|
-
"import": "./
|
|
76
|
-
"require": "./lib/cjs/feature/table/index.js",
|
|
77
|
-
"types": "./lib/types/feature/table/index.d.ts"
|
|
55
|
+
"import": "./src/feature/table/index.ts"
|
|
78
56
|
},
|
|
79
57
|
"./feature/toolbar": {
|
|
80
|
-
"import": "./
|
|
81
|
-
"require": "./lib/cjs/feature/toolbar/index.js",
|
|
82
|
-
"types": "./lib/types/feature/toolbar/index.d.ts"
|
|
58
|
+
"import": "./src/feature/toolbar/index.ts"
|
|
83
59
|
},
|
|
84
60
|
"./feature/inline-diff": {
|
|
85
|
-
"import": "./
|
|
86
|
-
"require": "./lib/cjs/feature/inline-diff/index.js",
|
|
87
|
-
"types": "./lib/types/feature/inline-diff/index.d.ts"
|
|
61
|
+
"import": "./src/feature/inline-diff/index.ts"
|
|
88
62
|
},
|
|
89
63
|
"./feature/diff-block": {
|
|
90
|
-
"import": "./
|
|
91
|
-
"require": "./lib/cjs/feature/diff-block/index.js",
|
|
92
|
-
"types": "./lib/types/feature/diff-block/index.d.ts"
|
|
64
|
+
"import": "./src/feature/diff-block/index.ts"
|
|
93
65
|
},
|
|
94
|
-
"./theme/common/*": "./
|
|
95
|
-
"./theme/classic.css": "./
|
|
96
|
-
"./theme/classic-dark.css": "./
|
|
97
|
-
"./theme/nord.css": "./
|
|
98
|
-
"./theme/nord-dark.css": "./
|
|
99
|
-
"./theme/frame.css": "./
|
|
100
|
-
"./theme/frame-dark.css": "./
|
|
66
|
+
"./theme/common/*": "./src/theme/common/*",
|
|
67
|
+
"./theme/classic.css": "./src/theme/crepe/style.css",
|
|
68
|
+
"./theme/classic-dark.css": "./src/theme/crepe-dark/style.css",
|
|
69
|
+
"./theme/nord.css": "./src/theme/nord/style.css",
|
|
70
|
+
"./theme/nord-dark.css": "./src/theme/nord-dark/style.css",
|
|
71
|
+
"./theme/frame.css": "./src/theme/frame/style.css",
|
|
72
|
+
"./theme/frame-dark.css": "./src/theme/frame-dark/style.css"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"exports": {
|
|
76
|
+
".": {
|
|
77
|
+
"import": "./lib/esm/index.js",
|
|
78
|
+
"require": "./lib/cjs/index.js",
|
|
79
|
+
"types": "./lib/types/index.d.ts"
|
|
80
|
+
},
|
|
81
|
+
"./builder": {
|
|
82
|
+
"import": "./lib/esm/builder.js",
|
|
83
|
+
"require": "./lib/cjs/builder.js",
|
|
84
|
+
"types": "./lib/types/builder.d.ts"
|
|
85
|
+
},
|
|
86
|
+
"./feature/block-edit": {
|
|
87
|
+
"import": "./lib/esm/feature/block-edit/index.js",
|
|
88
|
+
"require": "./lib/cjs/feature/block-edit/index.js",
|
|
89
|
+
"types": "./lib/types/feature/block-edit/index.d.ts"
|
|
90
|
+
},
|
|
91
|
+
"./feature/code-mirror": {
|
|
92
|
+
"import": "./lib/esm/feature/code-mirror/index.js",
|
|
93
|
+
"require": "./lib/cjs/feature/code-mirror/index.js",
|
|
94
|
+
"types": "./lib/types/feature/code-mirror/index.d.ts"
|
|
95
|
+
},
|
|
96
|
+
"./feature/cursor": {
|
|
97
|
+
"import": "./lib/esm/feature/cursor/index.js",
|
|
98
|
+
"require": "./lib/cjs/feature/cursor/index.js",
|
|
99
|
+
"types": "./lib/types/feature/cursor/index.d.ts"
|
|
100
|
+
},
|
|
101
|
+
"./feature/image-block": {
|
|
102
|
+
"import": "./lib/esm/feature/image-block/index.js",
|
|
103
|
+
"require": "./lib/cjs/feature/image-block/index.js",
|
|
104
|
+
"types": "./lib/types/feature/image-block/index.d.ts"
|
|
105
|
+
},
|
|
106
|
+
"./feature/latex": {
|
|
107
|
+
"import": "./lib/esm/feature/latex/index.js",
|
|
108
|
+
"require": "./lib/cjs/feature/latex/index.js",
|
|
109
|
+
"types": "./lib/types/feature/latex/index.d.ts"
|
|
110
|
+
},
|
|
111
|
+
"./feature/link-tooltip": {
|
|
112
|
+
"import": "./lib/esm/feature/link-tooltip/index.js",
|
|
113
|
+
"require": "./lib/cjs/feature/link-tooltip/index.js",
|
|
114
|
+
"types": "./lib/types/feature/link-tooltip/index.d.ts"
|
|
115
|
+
},
|
|
116
|
+
"./feature/list-item": {
|
|
117
|
+
"import": "./lib/esm/feature/list-item/index.js",
|
|
118
|
+
"require": "./lib/cjs/feature/list-item/index.js",
|
|
119
|
+
"types": "./lib/types/feature/list-item/index.d.ts"
|
|
120
|
+
},
|
|
121
|
+
"./feature/placeholder": {
|
|
122
|
+
"import": "./lib/esm/feature/placeholder/index.js",
|
|
123
|
+
"require": "./lib/cjs/feature/placeholder/index.js",
|
|
124
|
+
"types": "./lib/types/feature/placeholder/index.d.ts"
|
|
125
|
+
},
|
|
126
|
+
"./feature/table": {
|
|
127
|
+
"import": "./lib/esm/feature/table/index.js",
|
|
128
|
+
"require": "./lib/cjs/feature/table/index.js",
|
|
129
|
+
"types": "./lib/types/feature/table/index.d.ts"
|
|
130
|
+
},
|
|
131
|
+
"./feature/toolbar": {
|
|
132
|
+
"import": "./lib/esm/feature/toolbar/index.js",
|
|
133
|
+
"require": "./lib/cjs/feature/toolbar/index.js",
|
|
134
|
+
"types": "./lib/types/feature/toolbar/index.d.ts"
|
|
135
|
+
},
|
|
136
|
+
"./feature/inline-diff": {
|
|
137
|
+
"import": "./lib/esm/feature/inline-diff/index.js",
|
|
138
|
+
"require": "./lib/cjs/feature/inline-diff/index.js",
|
|
139
|
+
"types": "./lib/types/feature/inline-diff/index.d.ts"
|
|
140
|
+
},
|
|
141
|
+
"./feature/diff-block": {
|
|
142
|
+
"import": "./lib/esm/feature/diff-block/index.js",
|
|
143
|
+
"require": "./lib/cjs/feature/diff-block/index.js",
|
|
144
|
+
"types": "./lib/types/feature/diff-block/index.d.ts"
|
|
145
|
+
},
|
|
146
|
+
"./theme/common/*": "./lib/theme/common/*",
|
|
147
|
+
"./theme/classic.css": "./lib/theme/crepe/style.css",
|
|
148
|
+
"./theme/classic-dark.css": "./lib/theme/crepe-dark/style.css",
|
|
149
|
+
"./theme/nord.css": "./lib/theme/nord/style.css",
|
|
150
|
+
"./theme/nord-dark.css": "./lib/theme/nord-dark/style.css",
|
|
151
|
+
"./theme/frame.css": "./lib/theme/frame/style.css",
|
|
152
|
+
"./theme/frame-dark.css": "./lib/theme/frame-dark/style.css"
|
|
153
|
+
},
|
|
154
|
+
"main": "./lib/esm/index.js",
|
|
155
|
+
"types": "./lib/types/index.d.ts"
|
|
156
|
+
},
|
|
157
|
+
"scripts": {
|
|
158
|
+
"build": "pnpm run build:es && pnpm run build:theme && echo",
|
|
159
|
+
"build:es": "rollup -c",
|
|
160
|
+
"build:theme": "postcss src/theme/**/*.css --base src/theme --dir lib/theme && xcopy /E /I /Y src\\theme\\fonts lib\\theme\\fonts"
|
|
101
161
|
},
|
|
102
162
|
"dependencies": {
|
|
103
163
|
"@codemirror/commands": "^6.3.3",
|
|
@@ -107,9 +167,9 @@
|
|
|
107
167
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
108
168
|
"@codemirror/view": "^6.26.0",
|
|
109
169
|
"@floating-ui/dom": "^1.7.6",
|
|
110
|
-
"@jvs-milkdown/kit": "^1.2.
|
|
111
|
-
"@jvs-milkdown/prose": "^1.2.
|
|
112
|
-
"@jvs-milkdown/utils": "^1.2.
|
|
170
|
+
"@jvs-milkdown/kit": "^1.2.20",
|
|
171
|
+
"@jvs-milkdown/prose": "^1.2.20",
|
|
172
|
+
"@jvs-milkdown/utils": "^1.2.20",
|
|
113
173
|
"@types/lodash-es": "^4.17.12",
|
|
114
174
|
"clsx": "^2.0.0",
|
|
115
175
|
"codemirror": "^6.0.1",
|
|
@@ -127,11 +187,5 @@
|
|
|
127
187
|
"@vue/reactivity": "^3.5.34",
|
|
128
188
|
"@vue/runtime-core": "^3.5.34",
|
|
129
189
|
"@vue/runtime-dom": "^3.5.34"
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
"build": "pnpm run build:es && pnpm run build:theme && echo",
|
|
133
|
-
"build:es": "rollup -c",
|
|
134
|
-
"build:theme": "postcss src/theme/**/*.css --base src/theme --dir lib/theme && xcopy /E /I /Y src\\theme\\fonts lib\\theme\\fonts"
|
|
135
|
-
},
|
|
136
|
-
"types": "./lib/types/index.d.ts"
|
|
137
|
-
}
|
|
190
|
+
}
|
|
191
|
+
}
|
package/src/core/crepe.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getHTML } from '@jvs-milkdown/utils'
|
|
1
2
|
import { defaultsDeep } from 'lodash-es'
|
|
2
3
|
|
|
3
4
|
import type { CrepeFeatureConfig } from '../feature'
|
|
@@ -5,6 +6,7 @@ import type { CrepeFeatureConfig } from '../feature'
|
|
|
5
6
|
import { defaultConfig } from '../default-config'
|
|
6
7
|
import { CrepeFeature, defaultFeatures } from '../feature'
|
|
7
8
|
import { loadFeature } from '../feature/loader'
|
|
9
|
+
import { resetPopupCount } from '../utils/fixed-toolbar-popup-state'
|
|
8
10
|
import { CrepeBuilder, type CrepeBuilderConfig } from './builder'
|
|
9
11
|
|
|
10
12
|
/// The crepe editor configuration.
|
|
@@ -24,14 +26,30 @@ export class Crepe extends CrepeBuilder {
|
|
|
24
26
|
/// The constructor of the crepe editor.
|
|
25
27
|
/// You can pass configs to the editor to configure the editor.
|
|
26
28
|
/// Calling the constructor will not create the editor, you need to call `create` to create the editor.
|
|
27
|
-
constructor({
|
|
28
|
-
|
|
29
|
-
featureConfigs = {},
|
|
30
|
-
...crepeBuilderConfig
|
|
31
|
-
}: CrepeConfig = {}) {
|
|
32
|
-
super(crepeBuilderConfig)
|
|
33
|
-
|
|
29
|
+
constructor(config: CrepeConfig = {}) {
|
|
30
|
+
resetPopupCount()
|
|
31
|
+
const { features = {}, featureConfigs = {}, ...crepeBuilderConfig } = config
|
|
34
32
|
const finalConfigs = defaultsDeep(featureConfigs, defaultConfig)
|
|
33
|
+
const fixedToolbarConfig = finalConfigs[CrepeFeature.FixedToolbar]
|
|
34
|
+
if (fixedToolbarConfig?.useLocalStorage) {
|
|
35
|
+
try {
|
|
36
|
+
const stored = localStorage.getItem('jvs-milkdown-data')
|
|
37
|
+
if (stored) {
|
|
38
|
+
const parsed = JSON.parse(stored)
|
|
39
|
+
const docId = fixedToolbarConfig.id || 'default'
|
|
40
|
+
if (parsed.content && parsed.content[docId] !== undefined) {
|
|
41
|
+
const entry = parsed.content[docId]
|
|
42
|
+
const defaultValue =
|
|
43
|
+
typeof entry === 'string' ? entry : (entry?.markdown ?? '')
|
|
44
|
+
crepeBuilderConfig.defaultValue = defaultValue
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.error('Error loading content from localStorage:', e)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
super(crepeBuilderConfig)
|
|
35
53
|
|
|
36
54
|
const enabledFeatures = Object.entries({
|
|
37
55
|
...defaultFeatures,
|
|
@@ -46,5 +64,102 @@ export class Crepe extends CrepeBuilder {
|
|
|
46
64
|
]
|
|
47
65
|
loadFeature(feature, this.editor, config)
|
|
48
66
|
})
|
|
67
|
+
|
|
68
|
+
if (fixedToolbarConfig?.useLocalStorage) {
|
|
69
|
+
this.on((listener) => {
|
|
70
|
+
listener.markdownUpdated((_, markdown) => {
|
|
71
|
+
try {
|
|
72
|
+
const html = this.editor.action(getHTML())
|
|
73
|
+
const docId = fixedToolbarConfig.id || 'default'
|
|
74
|
+
|
|
75
|
+
const saveToLocalStorage = (mdVal: string, htmlVal: string) => {
|
|
76
|
+
try {
|
|
77
|
+
const stored = localStorage.getItem('jvs-milkdown-data')
|
|
78
|
+
let parsed: any = {}
|
|
79
|
+
if (stored) {
|
|
80
|
+
parsed = JSON.parse(stored)
|
|
81
|
+
}
|
|
82
|
+
if (!parsed.content) {
|
|
83
|
+
parsed.content = {}
|
|
84
|
+
}
|
|
85
|
+
const currentEntry = parsed.content[docId]
|
|
86
|
+
const hasChanged =
|
|
87
|
+
!currentEntry ||
|
|
88
|
+
(typeof currentEntry === 'string' &&
|
|
89
|
+
currentEntry !== mdVal) ||
|
|
90
|
+
(typeof currentEntry === 'object' &&
|
|
91
|
+
(currentEntry.markdown !== mdVal ||
|
|
92
|
+
currentEntry.html !== htmlVal))
|
|
93
|
+
|
|
94
|
+
if (hasChanged) {
|
|
95
|
+
parsed.content[docId] = {
|
|
96
|
+
markdown: mdVal,
|
|
97
|
+
html: htmlVal,
|
|
98
|
+
}
|
|
99
|
+
localStorage.setItem(
|
|
100
|
+
'jvs-milkdown-data',
|
|
101
|
+
JSON.stringify(parsed)
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
} catch (e) {
|
|
105
|
+
console.error('Error saving content to localStorage:', e)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const hasBlobUrl =
|
|
110
|
+
/blob:https?:\/\//.test(markdown) || /blob:https?:\/\//.test(html)
|
|
111
|
+
|
|
112
|
+
if (hasBlobUrl) {
|
|
113
|
+
Promise.all([
|
|
114
|
+
replaceBlobUrlsWithBase64(markdown),
|
|
115
|
+
replaceBlobUrlsWithBase64(html),
|
|
116
|
+
])
|
|
117
|
+
.then(([base64Markdown, base64Html]) => {
|
|
118
|
+
saveToLocalStorage(base64Markdown, base64Html)
|
|
119
|
+
})
|
|
120
|
+
.catch((e) => {
|
|
121
|
+
console.error('Error converting blob URLs:', e)
|
|
122
|
+
saveToLocalStorage(markdown, html)
|
|
123
|
+
})
|
|
124
|
+
} else {
|
|
125
|
+
saveToLocalStorage(markdown, html)
|
|
126
|
+
}
|
|
127
|
+
} catch (e) {
|
|
128
|
+
console.error('Error saving content to localStorage:', e)
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
override destroy = () => {
|
|
136
|
+
resetPopupCount()
|
|
137
|
+
return this.editor.destroy()
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function replaceBlobUrlsWithBase64(content: string): Promise<string> {
|
|
142
|
+
const blobRegex = /blob:https?:\/\/[^\s'")>]+/g
|
|
143
|
+
const matches = content.match(blobRegex)
|
|
144
|
+
if (!matches) return content
|
|
145
|
+
|
|
146
|
+
let result = content
|
|
147
|
+
const uniqueBlobs = Array.from(new Set(matches))
|
|
148
|
+
|
|
149
|
+
for (const blobUrl of uniqueBlobs) {
|
|
150
|
+
try {
|
|
151
|
+
const response = await fetch(blobUrl)
|
|
152
|
+
const blob = await response.blob()
|
|
153
|
+
const base64 = await new Promise<string>((resolve, reject) => {
|
|
154
|
+
const reader = new FileReader()
|
|
155
|
+
reader.onloadend = () => resolve(reader.result as string)
|
|
156
|
+
reader.onerror = reject
|
|
157
|
+
reader.readAsDataURL(blob)
|
|
158
|
+
})
|
|
159
|
+
result = result.replaceAll(blobUrl, base64)
|
|
160
|
+
} catch (e) {
|
|
161
|
+
console.error('Failed to convert blob URL to base64:', blobUrl, e)
|
|
162
|
+
}
|
|
49
163
|
}
|
|
164
|
+
return result
|
|
50
165
|
}
|
package/src/core/locale.ts
CHANGED
|
@@ -134,6 +134,8 @@ export const zhCN = {
|
|
|
134
134
|
'customMenu.colorPurple': '紫色',
|
|
135
135
|
'customMenu.colorGray': '灰色',
|
|
136
136
|
'customMenu.insertTable': '插入支持富文本的表格',
|
|
137
|
+
'customMenu.export': '导出',
|
|
138
|
+
'customMenu.import': '导入',
|
|
137
139
|
|
|
138
140
|
'customMenu.fontDefault': '默认',
|
|
139
141
|
'font.fangSong': '仿宋',
|
|
@@ -298,6 +300,8 @@ export const enUS: typeof zhCN = {
|
|
|
298
300
|
'customMenu.colorPurple': 'Purple',
|
|
299
301
|
'customMenu.colorGray': 'Gray',
|
|
300
302
|
'customMenu.insertTable': 'Insert Table',
|
|
303
|
+
'customMenu.export': 'Export',
|
|
304
|
+
'customMenu.import': 'Import',
|
|
301
305
|
|
|
302
306
|
'customMenu.fontDefault': 'Default',
|
|
303
307
|
'font.fangSong': 'FangSong',
|