@jvs-milkdown/crepe 1.2.12 → 1.2.14
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 +41 -2
- package/lib/cjs/builder.js.map +1 -1
- package/lib/cjs/feature/block-edit/index.js +10 -2
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js +9 -2
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js +9 -2
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/image-block/index.js +10 -3
- package/lib/cjs/feature/image-block/index.js.map +1 -1
- package/lib/cjs/feature/inline-diff/index.js +1298 -0
- package/lib/cjs/feature/inline-diff/index.js.map +1 -0
- package/lib/cjs/feature/latex/index.js +9 -2
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/link-tooltip/index.js +10 -2
- package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
- package/lib/cjs/feature/list-item/index.js +9 -2
- package/lib/cjs/feature/list-item/index.js.map +1 -1
- package/lib/cjs/feature/placeholder/index.js +9 -2
- package/lib/cjs/feature/placeholder/index.js.map +1 -1
- package/lib/cjs/feature/table/index.js +10 -2
- package/lib/cjs/feature/table/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +134 -12
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +1410 -241
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/builder.js +41 -2
- package/lib/esm/builder.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +10 -2
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js +9 -2
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js +9 -2
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/image-block/index.js +10 -3
- package/lib/esm/feature/image-block/index.js.map +1 -1
- package/lib/esm/feature/inline-diff/index.js +1274 -0
- package/lib/esm/feature/inline-diff/index.js.map +1 -0
- package/lib/esm/feature/latex/index.js +9 -2
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/link-tooltip/index.js +10 -2
- package/lib/esm/feature/link-tooltip/index.js.map +1 -1
- package/lib/esm/feature/list-item/index.js +9 -2
- package/lib/esm/feature/list-item/index.js.map +1 -1
- package/lib/esm/feature/placeholder/index.js +9 -2
- package/lib/esm/feature/placeholder/index.js.map +1 -1
- package/lib/esm/feature/table/index.js +10 -2
- package/lib/esm/feature/table/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +134 -12
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +1392 -242
- package/lib/esm/index.js.map +1 -1
- package/lib/theme/common/diff-block.css +41 -0
- package/lib/theme/common/inline-diff.css +142 -0
- package/lib/theme/common/style.css +2 -0
- package/lib/theme/common/table.css +4 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/builder.d.ts +2 -0
- package/lib/types/core/builder.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/diff-block/index.d.ts +10 -0
- package/lib/types/feature/diff-block/index.d.ts.map +1 -0
- package/lib/types/feature/fixed-toolbar/document-header.d.ts.map +1 -1
- 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/fixed-toolbar/outline-panel.d.ts.map +1 -1
- package/lib/types/feature/index.d.ts +7 -1
- package/lib/types/feature/index.d.ts.map +1 -1
- package/lib/types/feature/inline-diff/change-panel.d.ts +4 -0
- package/lib/types/feature/inline-diff/change-panel.d.ts.map +1 -0
- package/lib/types/feature/inline-diff/config.d.ts +12 -0
- package/lib/types/feature/inline-diff/config.d.ts.map +1 -0
- package/lib/types/feature/inline-diff/diff-engine.d.ts +20 -0
- package/lib/types/feature/inline-diff/diff-engine.d.ts.map +1 -0
- package/lib/types/feature/inline-diff/diff-view.d.ts +2 -0
- package/lib/types/feature/inline-diff/diff-view.d.ts.map +1 -0
- package/lib/types/feature/inline-diff/doc-builder.d.ts +21 -0
- package/lib/types/feature/inline-diff/doc-builder.d.ts.map +1 -0
- package/lib/types/feature/inline-diff/index.d.ts +9 -0
- package/lib/types/feature/inline-diff/index.d.ts.map +1 -0
- package/lib/types/feature/loader.d.ts.map +1 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/toolbar/index.d.ts.map +1 -1
- package/lib/types/icons/remove.d.ts +1 -1
- package/lib/types/icons/remove.d.ts.map +1 -1
- package/lib/types/utils/fixed-toolbar-popup-state.d.ts +7 -0
- package/lib/types/utils/fixed-toolbar-popup-state.d.ts.map +1 -0
- package/package.json +15 -4
- package/src/core/builder.ts +19 -0
- package/src/core/locale.ts +7 -0
- package/src/feature/diff-block/index.ts +48 -0
- package/src/feature/fixed-toolbar/index.ts +97 -25
- package/src/feature/fixed-toolbar/menu-bar.tsx +13 -2
- package/src/feature/fixed-toolbar/outline-panel.tsx +3 -2
- package/src/feature/fixed-toolbar/shortcut-help-modal.tsx +1 -1
- package/src/feature/fixed-toolbar/view-menu-state.ts +1 -1
- package/src/feature/image-block/index.ts +1 -1
- package/src/feature/index.ts +12 -0
- package/src/feature/inline-diff/change-panel.ts +280 -0
- package/src/feature/inline-diff/config.ts +28 -0
- package/src/feature/inline-diff/diff-engine.ts +181 -0
- package/src/feature/inline-diff/diff-view.ts +2 -0
- package/src/feature/inline-diff/doc-builder.ts +139 -0
- package/src/feature/inline-diff/index.ts +514 -0
- package/src/feature/loader.ts +8 -0
- package/src/feature/toolbar/component.tsx +97 -9
- package/src/feature/toolbar/index.ts +33 -0
- package/src/icons/remove.ts +1 -0
- package/src/theme/common/diff-block.css +43 -0
- package/src/theme/common/inline-diff.css +148 -0
- package/src/theme/common/style.css +2 -0
- package/src/theme/common/table.css +4 -4
- package/src/utils/fixed-toolbar-popup-state.ts +27 -0
|
@@ -23,6 +23,8 @@ export declare class CrepeBuilder {
|
|
|
23
23
|
get readonly(): boolean;
|
|
24
24
|
setReadonly: (value: boolean) => this;
|
|
25
25
|
getMarkdown: () => string;
|
|
26
|
+
showDiff: (oldMarkdown: string, newMarkdown: string) => this;
|
|
27
|
+
hideDiff: () => this;
|
|
26
28
|
on: (fn: (api: ListenerManager) => void) => this;
|
|
27
29
|
}
|
|
28
30
|
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/core/builder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EAEjB,MAAM,EAKP,MAAM,wBAAwB,CAAA;AAI/B,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAA;AAO1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/core/builder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EAEjB,MAAM,EAKP,MAAM,wBAAwB,CAAA;AAI/B,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAA;AAO1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAGzC,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAU7D,MAAM,WAAW,kBAAkB;IAIjC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAG3B,YAAY,CAAC,EAAE,YAAY,CAAA;IAG3B,MAAM,CAAC,EAAE,MAAM,CAAA;IAGf,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAA;CAC1D;AAID,qBAAa,YAAY;;gBAYX,EACV,IAAI,EACJ,YAAiB,EACjB,MAAgB,EAChB,YAAY,GACb,GAAE,kBAAuB;IA0H1B,UAAU,EAAE;QACV,CAAC,CAAC,SAAS,YAAY,EACrB,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAC7C,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B,YAAY,CAAA;QACf,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,YAAY,CAAA;KACzD,CAGA;IAGD,MAAM,wBAEL;IAGD,OAAO,wBAEN;IAGD,IAAI,MAAM,IAAI,MAAM,CAEnB;IAGD,IAAI,QAAQ,YAEX;IAGD,WAAW,GAAI,OAAO,OAAO,UAW5B;IAGD,WAAW,eAEV;IAGD,QAAQ,GAAI,aAAa,MAAM,EAAE,aAAa,MAAM,UAMnD;IAGD,QAAQ,aAMP;IAGD,EAAE,GAAI,IAAI,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,UAavC;CACF"}
|
|
@@ -140,6 +140,8 @@ export declare const zhCN: {
|
|
|
140
140
|
'shortcuts.history': string;
|
|
141
141
|
'shortcuts.undo': string;
|
|
142
142
|
'shortcuts.redo': string;
|
|
143
|
+
'inlineDiff.accept': string;
|
|
144
|
+
'inlineDiff.reject': string;
|
|
143
145
|
};
|
|
144
146
|
export declare const enUS: typeof zhCN;
|
|
145
147
|
export type CrepeTranslations = typeof zhCN;
|
|
@@ -284,6 +286,8 @@ export declare const translationsCtx: import("@jvs-milkdown/ctx").SliceType<Reco
|
|
|
284
286
|
'shortcuts.history': string;
|
|
285
287
|
'shortcuts.undo': string;
|
|
286
288
|
'shortcuts.redo': string;
|
|
289
|
+
'inlineDiff.accept': string;
|
|
290
|
+
'inlineDiff.reject': string;
|
|
287
291
|
}>>, string>;
|
|
288
292
|
export declare const localeCtx: import("@jvs-milkdown/ctx").SliceType<string, "localeCtx">;
|
|
289
293
|
export declare function i18n(ctx: Ctx, key: keyof CrepeTranslations): 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+KhB,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,OAAO,IA+JzB,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
import { type DiffBlockConfig } from '@jvs-milkdown/kit/component/diff-block';
|
|
3
|
+
import type { DefineFeature } from '../shared';
|
|
4
|
+
interface DiffBlockConfigCustom extends Omit<DiffBlockConfig, 'theme'> {
|
|
5
|
+
theme: Extension;
|
|
6
|
+
}
|
|
7
|
+
export type DiffBlockFeatureConfig = Partial<DiffBlockConfigCustom>;
|
|
8
|
+
export declare const diffBlockFeature: DefineFeature<DiffBlockFeatureConfig>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/diff-block/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGlD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,wCAAwC,CAAA;AAG/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAK9C,UAAU,qBAAsB,SAAQ,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC;IACpE,KAAK,EAAE,SAAS,CAAA;CACjB;AAED,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,sBAAsB,CA0BlE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-header.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/document-header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"document-header.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/document-header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAkBhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAKjD,eAAO,MAAM,cAAc;;cAEA,MAAM,GAAG;;;;cACN,MAAM,kBAAkB;;;;;cAD3B,MAAM,GAAG;;;;cACN,MAAM,kBAAkB;;;+GAoTpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,SAAS,EAAiB,MAAM,+BAA+B,CAAA;AAchF,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;AAUpD,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;CAC9B;AAED,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAEnE,eAAO,MAAM,kBAAkB,0FAG9B,CAAA;AAED,eAAO,MAAM,eAAe,gBAA0C,CAAA;AAiStE,eAAO,MAAM,kBAAkB,sCAK7B,CAAA;AAEF,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,yBAAyB,CA2BjE,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;AAMhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,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;AAMhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAsDjD,eAAO,MAAM,OAAO;;cAEO,MAAM,GAAG;;;;cACN,MAAM,kBAAkB;;;;;cAD3B,MAAM,GAAG;;;;cACN,MAAM,kBAAkB;;;+GA2fpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outline-panel.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/outline-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAgBhD,eAAO,MAAM,YAAY;;cAEE,MAAM,GAAG;;;;;cAAT,MAAM,GAAG;;;+
|
|
1
|
+
{"version":3,"file":"outline-panel.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/outline-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAgBhD,eAAO,MAAM,YAAY;;cAEE,MAAM,GAAG;;;;;cAAT,MAAM,GAAG;;;+GA8clC,CAAA"}
|
|
@@ -2,8 +2,10 @@ import type { AttachmentFeatureConfig } from './attachment/config';
|
|
|
2
2
|
import type { BlockEditFeatureConfig } from './block-edit';
|
|
3
3
|
import type { CodeMirrorFeatureConfig } from './code-mirror';
|
|
4
4
|
import type { CursorFeatureConfig } from './cursor';
|
|
5
|
+
import type { DiffBlockFeatureConfig } from './diff-block';
|
|
5
6
|
import type { FixedToolbarFeatureConfig } from './fixed-toolbar';
|
|
6
7
|
import type { ImageBlockFeatureConfig } from './image-block';
|
|
8
|
+
import type { InlineDiffFeatureConfig } from './inline-diff';
|
|
7
9
|
import type { LatexFeatureConfig } from './latex';
|
|
8
10
|
import type { LinkTooltipFeatureConfig } from './link-tooltip';
|
|
9
11
|
import type { ListItemFeatureConfig } from './list-item';
|
|
@@ -22,7 +24,9 @@ export declare enum CrepeFeature {
|
|
|
22
24
|
Placeholder = "placeholder",
|
|
23
25
|
Table = "table",
|
|
24
26
|
Latex = "latex",
|
|
25
|
-
Attachment = "attachment"
|
|
27
|
+
Attachment = "attachment",
|
|
28
|
+
InlineDiff = "inline-diff",
|
|
29
|
+
DiffBlock = "diff-block"
|
|
26
30
|
}
|
|
27
31
|
export interface CrepeFeatureConfig {
|
|
28
32
|
[CrepeFeature.Cursor]?: CursorFeatureConfig;
|
|
@@ -37,6 +41,8 @@ export interface CrepeFeatureConfig {
|
|
|
37
41
|
[CrepeFeature.Table]?: TableFeatureConfig;
|
|
38
42
|
[CrepeFeature.Latex]?: LatexFeatureConfig;
|
|
39
43
|
[CrepeFeature.Attachment]?: AttachmentFeatureConfig;
|
|
44
|
+
[CrepeFeature.InlineDiff]?: InlineDiffFeatureConfig;
|
|
45
|
+
[CrepeFeature.DiffBlock]?: DiffBlockFeatureConfig;
|
|
40
46
|
}
|
|
41
47
|
export declare const defaultFeatures: Record<CrepeFeature, boolean>;
|
|
42
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAKrD,oBAAY,YAAY;IAEtB,UAAU,gBAAgB;IAG1B,QAAQ,cAAc;IAGtB,WAAW,iBAAiB;IAG5B,MAAM,WAAW;IAGjB,UAAU,gBAAgB;IAG1B,SAAS,eAAe;IAGxB,OAAO,YAAY;IAGnB,YAAY,kBAAkB;IAG9B,WAAW,gBAAgB;IAG3B,KAAK,UAAU;IAGf,KAAK,UAAU;IAGf,UAAU,eAAe;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAKrD,oBAAY,YAAY;IAEtB,UAAU,gBAAgB;IAG1B,QAAQ,cAAc;IAGtB,WAAW,iBAAiB;IAG5B,MAAM,WAAW;IAGjB,UAAU,gBAAgB;IAG1B,SAAS,eAAe;IAGxB,OAAO,YAAY;IAGnB,YAAY,kBAAkB;IAG9B,WAAW,gBAAgB;IAG3B,KAAK,UAAU;IAGf,KAAK,UAAU;IAGf,UAAU,eAAe;IAGzB,UAAU,gBAAgB;IAG1B,SAAS,eAAe;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAA;IAC3C,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,qBAAqB,CAAA;IAC/C,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,EAAE,wBAAwB,CAAA;IACrD,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,EAAE,uBAAuB,CAAA;IACnD,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,sBAAsB,CAAA;IACjD,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,EAAE,wBAAwB,CAAA;IACrD,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,oBAAoB,CAAA;IAC7C,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,EAAE,yBAAyB,CAAA;IACvD,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,EAAE,uBAAuB,CAAA;IACnD,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAA;IACzC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAA;IACzC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,EAAE,uBAAuB,CAAA;IACnD,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,EAAE,uBAAuB,CAAA;IACnD,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,sBAAsB,CAAA;CAClD;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,CAezD,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type App as VueApp } from 'vue';
|
|
2
|
+
import type { ChangeInfo } from './doc-builder';
|
|
3
|
+
export declare function mountChangePanel(container: HTMLElement, changes: ChangeInfo[], onNavigate: (from: number) => void, onClose?: () => void): VueApp;
|
|
4
|
+
//# sourceMappingURL=change-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-panel.d.ts","sourceRoot":"","sources":["../../../../src/feature/inline-diff/change-panel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,GAAG,IAAI,MAAM,EAAE,MAAM,KAAK,CAAA;AAErE,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,eAAe,CAAA;AAa3D,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,UAAU,EAAE,EACrB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAClC,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,MAAM,CAmQR"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface InlineDiffConfig {
|
|
2
|
+
addedClass: string;
|
|
3
|
+
deletedClass: string;
|
|
4
|
+
}
|
|
5
|
+
export interface InlineDiffApi {
|
|
6
|
+
showDiff: (oldMarkdown: string, newMarkdown?: string) => void;
|
|
7
|
+
hideDiff: () => void;
|
|
8
|
+
isShowing: () => boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const inlineDiffConfig: import("@jvs-milkdown/utils").$Ctx<InlineDiffConfig, "inlineDiffConfigCtx">;
|
|
11
|
+
export declare const inlineDiffApiCtx: import("@jvs-milkdown/utils").$Ctx<InlineDiffApi, "inlineDiffApiCtx">;
|
|
12
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/feature/inline-diff/config.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7D,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,EAAE,MAAM,OAAO,CAAA;CACzB;AAED,eAAO,MAAM,gBAAgB,6EAM5B,CAAA;AAQD,eAAO,MAAM,gBAAgB,uEAAoC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@jvs-milkdown/kit/prose/model';
|
|
2
|
+
export type DiffType = 'unchanged' | 'added' | 'removed';
|
|
3
|
+
export interface CharPart {
|
|
4
|
+
type: 'equal' | 'insert' | 'delete';
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BlockDiff {
|
|
8
|
+
type: DiffType;
|
|
9
|
+
oldNode?: PMNode;
|
|
10
|
+
newNode?: PMNode;
|
|
11
|
+
parts?: CharPart[];
|
|
12
|
+
}
|
|
13
|
+
export type ChunkStatus = 'pending' | 'accepted' | 'rejected';
|
|
14
|
+
export interface DiffChunk {
|
|
15
|
+
id: string;
|
|
16
|
+
diffs: BlockDiff[];
|
|
17
|
+
status: ChunkStatus;
|
|
18
|
+
}
|
|
19
|
+
export declare function computeDiff(oldBlocks: PMNode[], newBlocks: PMNode[]): DiffChunk[];
|
|
20
|
+
//# sourceMappingURL=diff-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-engine.d.ts","sourceRoot":"","sources":["../../../../src/feature/inline-diff/diff-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAInE,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,CAAA;AAExD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACnC,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAA;CACnB;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;AAE7D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,MAAM,EAAE,WAAW,CAAA;CACpB;AAyCD,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,EAAE,MAAM,EAAE,GAClB,SAAS,EAAE,CAgHb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-view.d.ts","sourceRoot":"","sources":["../../../../src/feature/inline-diff/diff-view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Schema, Node as PMNode } from '@jvs-milkdown/kit/prose/model';
|
|
2
|
+
import type { DiffChunk } from './diff-engine';
|
|
3
|
+
export type ChangeType = 'added' | 'removed';
|
|
4
|
+
export interface ContentRange {
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ChangeInfo {
|
|
9
|
+
type: ChangeType;
|
|
10
|
+
from: number;
|
|
11
|
+
oldText: string;
|
|
12
|
+
newText: string;
|
|
13
|
+
blockRange: ContentRange;
|
|
14
|
+
inlineRanges: ContentRange[];
|
|
15
|
+
chunkId: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function buildNewDoc(chunks: DiffChunk[], schema: Schema): {
|
|
18
|
+
doc: PMNode;
|
|
19
|
+
changes: ChangeInfo[];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=doc-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-builder.d.ts","sourceRoot":"","sources":["../../../../src/feature/inline-diff/doc-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAE3E,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,eAAe,CAAA;AAExD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,CAAA;AAE5C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,YAAY,CAAA;IACxB,YAAY,EAAE,YAAY,EAAE,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAA;CAChB;AAWD,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,EAAE,EACnB,MAAM,EAAE,MAAM,GACb;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,EAAE,CAAA;CAAE,CAyGxC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginKey } from '@jvs-milkdown/kit/prose/state';
|
|
2
|
+
import type { DefineFeature } from '../shared';
|
|
3
|
+
import { inlineDiffApiCtx, type InlineDiffConfig, type InlineDiffApi } from './config';
|
|
4
|
+
export type InlineDiffFeatureConfig = Partial<InlineDiffConfig>;
|
|
5
|
+
export { inlineDiffApiCtx, type InlineDiffApi };
|
|
6
|
+
export declare const inlineDiffKey: PluginKey<any>;
|
|
7
|
+
export declare const inlineDiffPlugin: import("@jvs-milkdown/utils").$Prose;
|
|
8
|
+
export declare const inlineDiff: DefineFeature<InlineDiffFeatureConfig>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/inline-diff/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAIjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAM9C,OAAO,EAEL,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AAIjB,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE/D,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,CAAA;AAE/C,eAAO,MAAM,aAAa,gBAAqC,CAAA;AAyc/D,eAAO,MAAM,gBAAgB,sCAQ3B,CAAA;AAEF,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,uBAAuB,CAiB7D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/feature/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/feature/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AASpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAStC,wBAAgB,WAAW,CACzB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,KAAK,QA8Cf"}
|
|
@@ -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;AAehD,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;
|
|
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;AAehD,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,0WAy9ElB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/toolbar/index.ts"],"names":[],"mappings":"AAiBA,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,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/toolbar/index.ts"],"names":[],"mappings":"AAiBA,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,UAAU,CAAA;AAa3C,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC,KAAK,IAAI,CAAA;CAC3D;AAED,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAqIzD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,oBAAoB,CA+BvD,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const removeIcon = "\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n >\n <path\n d=\"M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z\"\n />\n </svg>\n";
|
|
1
|
+
export declare const removeIcon = "\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n >\n <path\n d=\"M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z\"\n fill=\"#363B4C\"\n />\n </svg>\n";
|
|
2
2
|
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/icons/remove.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/icons/remove.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,g8DAYtB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type Listener = () => void;
|
|
2
|
+
export declare function getIsAnyPopupOpen(): boolean;
|
|
3
|
+
export declare function addPopupChangeListener(fn: Listener): () => void;
|
|
4
|
+
export declare function incrementPopupCount(): void;
|
|
5
|
+
export declare function decrementPopupCount(): void;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=fixed-toolbar-popup-state.d.ts.map
|
|
@@ -0,0 +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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jvs-milkdown/crepe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"crepe",
|
|
6
6
|
"editor",
|
|
@@ -81,6 +81,16 @@
|
|
|
81
81
|
"require": "./lib/cjs/feature/toolbar/index.js",
|
|
82
82
|
"types": "./lib/types/feature/toolbar/index.d.ts"
|
|
83
83
|
},
|
|
84
|
+
"./feature/inline-diff": {
|
|
85
|
+
"import": "./lib/esm/feature/inline-diff/index.js",
|
|
86
|
+
"require": "./lib/cjs/feature/inline-diff/index.js",
|
|
87
|
+
"types": "./lib/types/feature/inline-diff/index.d.ts"
|
|
88
|
+
},
|
|
89
|
+
"./feature/diff-block": {
|
|
90
|
+
"import": "./lib/esm/feature/diff-block/index.js",
|
|
91
|
+
"require": "./lib/cjs/feature/diff-block/index.js",
|
|
92
|
+
"types": "./lib/types/feature/diff-block/index.d.ts"
|
|
93
|
+
},
|
|
84
94
|
"./theme/common/*": "./lib/theme/common/*",
|
|
85
95
|
"./theme/classic.css": "./lib/theme/crepe/style.css",
|
|
86
96
|
"./theme/classic-dark.css": "./lib/theme/crepe-dark/style.css",
|
|
@@ -97,12 +107,13 @@
|
|
|
97
107
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
98
108
|
"@codemirror/view": "^6.26.0",
|
|
99
109
|
"@floating-ui/dom": "^1.7.6",
|
|
100
|
-
"@jvs-milkdown/kit": "^1.2.
|
|
101
|
-
"@jvs-milkdown/prose": "^1.2.
|
|
102
|
-
"@jvs-milkdown/utils": "^1.2.
|
|
110
|
+
"@jvs-milkdown/kit": "^1.2.14",
|
|
111
|
+
"@jvs-milkdown/prose": "^1.2.14",
|
|
112
|
+
"@jvs-milkdown/utils": "^1.2.14",
|
|
103
113
|
"@types/lodash-es": "^4.17.12",
|
|
104
114
|
"clsx": "^2.0.0",
|
|
105
115
|
"codemirror": "^6.0.1",
|
|
116
|
+
"diff": "^9.0.0",
|
|
106
117
|
"katex": "^0.16.0",
|
|
107
118
|
"lodash-es": "^4.17.21",
|
|
108
119
|
"prosemirror-virtual-cursor": "^0.4.2",
|
package/src/core/builder.ts
CHANGED
|
@@ -27,6 +27,7 @@ import type { DefineFeature } from '../feature/shared'
|
|
|
27
27
|
|
|
28
28
|
import { CrepeFeature } from '../feature'
|
|
29
29
|
import { attachmentConfig } from '../feature/attachment/config'
|
|
30
|
+
import { inlineDiffApiCtx } from '../feature/inline-diff/config'
|
|
30
31
|
import { zhCN, enUS, type CrepeTranslations } from './locale'
|
|
31
32
|
import {
|
|
32
33
|
CrepeCtx,
|
|
@@ -244,6 +245,24 @@ export class CrepeBuilder {
|
|
|
244
245
|
return this.#editor.action(getMarkdown())
|
|
245
246
|
}
|
|
246
247
|
|
|
248
|
+
/// Show inline diff between two markdown versions.
|
|
249
|
+
showDiff = (oldMarkdown: string, newMarkdown: string) => {
|
|
250
|
+
this.#editor.action((ctx) => {
|
|
251
|
+
const api = ctx.get(inlineDiffApiCtx.key)
|
|
252
|
+
api.showDiff(oldMarkdown, newMarkdown)
|
|
253
|
+
})
|
|
254
|
+
return this
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/// Hide inline diff and return to editing mode.
|
|
258
|
+
hideDiff = () => {
|
|
259
|
+
this.#editor.action((ctx) => {
|
|
260
|
+
const api = ctx.get(inlineDiffApiCtx.key)
|
|
261
|
+
api.hideDiff()
|
|
262
|
+
})
|
|
263
|
+
return this
|
|
264
|
+
}
|
|
265
|
+
|
|
247
266
|
/// Register event listeners.
|
|
248
267
|
on = (fn: (api: ListenerManager) => void) => {
|
|
249
268
|
if (this.#editor.status !== EditorStatus.Created) {
|
package/src/core/locale.ts
CHANGED
|
@@ -173,6 +173,10 @@ export const zhCN = {
|
|
|
173
173
|
'shortcuts.history': '历史记录',
|
|
174
174
|
'shortcuts.undo': '撤销',
|
|
175
175
|
'shortcuts.redo': '重做',
|
|
176
|
+
|
|
177
|
+
// inline-diff
|
|
178
|
+
'inlineDiff.accept': '接受',
|
|
179
|
+
'inlineDiff.reject': '拒绝',
|
|
176
180
|
}
|
|
177
181
|
|
|
178
182
|
export const enUS: typeof zhCN = {
|
|
@@ -331,6 +335,9 @@ export const enUS: typeof zhCN = {
|
|
|
331
335
|
'shortcuts.history': 'History',
|
|
332
336
|
'shortcuts.undo': 'Undo',
|
|
333
337
|
'shortcuts.redo': 'Redo',
|
|
338
|
+
|
|
339
|
+
'inlineDiff.accept': 'Accept',
|
|
340
|
+
'inlineDiff.reject': 'Reject',
|
|
334
341
|
}
|
|
335
342
|
|
|
336
343
|
export type CrepeTranslations = typeof zhCN
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state'
|
|
2
|
+
|
|
3
|
+
import { oneDark } from '@codemirror/theme-one-dark'
|
|
4
|
+
import {
|
|
5
|
+
diffBlock,
|
|
6
|
+
diffBlockConfig,
|
|
7
|
+
type DiffBlockConfig,
|
|
8
|
+
} from '@jvs-milkdown/kit/component/diff-block'
|
|
9
|
+
import { basicSetup } from 'codemirror'
|
|
10
|
+
|
|
11
|
+
import type { DefineFeature } from '../shared'
|
|
12
|
+
|
|
13
|
+
import { crepeFeatureConfig } from '../../core/slice'
|
|
14
|
+
import { CrepeFeature } from '../index'
|
|
15
|
+
|
|
16
|
+
interface DiffBlockConfigCustom extends Omit<DiffBlockConfig, 'theme'> {
|
|
17
|
+
theme: Extension
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DiffBlockFeatureConfig = Partial<DiffBlockConfigCustom>
|
|
21
|
+
|
|
22
|
+
export const diffBlockFeature: DefineFeature<DiffBlockFeatureConfig> = (
|
|
23
|
+
editor,
|
|
24
|
+
config = {}
|
|
25
|
+
) => {
|
|
26
|
+
editor
|
|
27
|
+
.config(crepeFeatureConfig(CrepeFeature.DiffBlock))
|
|
28
|
+
.config((ctx) => {
|
|
29
|
+
const { languages = [], theme } = config
|
|
30
|
+
const extensions = [basicSetup]
|
|
31
|
+
if (theme) {
|
|
32
|
+
extensions.push(theme)
|
|
33
|
+
} else {
|
|
34
|
+
extensions.push(oneDark)
|
|
35
|
+
}
|
|
36
|
+
if (config.extensions) {
|
|
37
|
+
extensions.push(...config.extensions)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ctx.update(diffBlockConfig.key, (defaultConfig) => ({
|
|
41
|
+
...defaultConfig,
|
|
42
|
+
extensions,
|
|
43
|
+
languages: languages.length > 0 ? languages : defaultConfig.languages,
|
|
44
|
+
renderLanguage: config.renderLanguage || defaultConfig.renderLanguage,
|
|
45
|
+
}))
|
|
46
|
+
})
|
|
47
|
+
.use(diffBlock)
|
|
48
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { Ctx } from '@jvs-milkdown/kit/ctx'
|
|
|
2
2
|
import type { PluginView, Selection } from '@jvs-milkdown/kit/prose/state'
|
|
3
3
|
import type { EditorView } from '@jvs-milkdown/kit/prose/view'
|
|
4
4
|
|
|
5
|
-
import { Plugin, PluginKey } from '@jvs-milkdown/kit/prose/state'
|
|
5
|
+
import { Plugin, PluginKey, TextSelection } from '@jvs-milkdown/kit/prose/state'
|
|
6
6
|
import { $ctx, $prose } from '@jvs-milkdown/kit/utils'
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
import {
|
|
@@ -66,7 +66,9 @@ class FixedToolbarView implements PluginView {
|
|
|
66
66
|
#resizeObserver?: ResizeObserver
|
|
67
67
|
#updateOutlineGeometry?: () => void
|
|
68
68
|
#scrollContainers: Element[] = []
|
|
69
|
+
#onDblClick: ((event: MouseEvent) => void) | undefined
|
|
69
70
|
#view: EditorView
|
|
71
|
+
#editorContainer?: HTMLElement
|
|
70
72
|
|
|
71
73
|
constructor(ctx: Ctx, view: EditorView) {
|
|
72
74
|
this.#view = view
|
|
@@ -90,16 +92,25 @@ class FixedToolbarView implements PluginView {
|
|
|
90
92
|
if (root) {
|
|
91
93
|
root.style.position = 'relative'
|
|
92
94
|
// Use internal styles for transition for smooth resizing
|
|
93
|
-
root.style.transition =
|
|
94
|
-
'padding 0.1s ease-out, background-color 0.2s ease-out'
|
|
95
|
+
root.style.transition = 'background-color 0.2s ease-out'
|
|
95
96
|
|
|
96
97
|
root.prepend(this.#content)
|
|
97
98
|
|
|
99
|
+
const editorContainer = document.createElement('div')
|
|
100
|
+
editorContainer.className = 'milkdown-editor-container'
|
|
101
|
+
editorContainer.style.transition = 'padding 0.1s ease-out'
|
|
102
|
+
editorContainer.style.display = 'flex'
|
|
103
|
+
editorContainer.style.flexDirection = 'column'
|
|
104
|
+
editorContainer.style.flexGrow = '1'
|
|
105
|
+
root.insertBefore(editorContainer, view.dom)
|
|
106
|
+
editorContainer.appendChild(view.dom)
|
|
107
|
+
this.#editorContainer = editorContainer
|
|
108
|
+
|
|
98
109
|
const headerContent = document.createElement('div')
|
|
99
110
|
this.#headerApp = createApp(DocumentHeader, { ctx, config })
|
|
100
111
|
this.#headerApp.mount(headerContent)
|
|
101
112
|
this.#headerContent = headerContent
|
|
102
|
-
|
|
113
|
+
editorContainer.insertBefore(headerContent, view.dom)
|
|
103
114
|
|
|
104
115
|
const outlineContent = document.createElement('div')
|
|
105
116
|
outlineContent.style.position = 'fixed'
|
|
@@ -109,6 +120,39 @@ class FixedToolbarView implements PluginView {
|
|
|
109
120
|
this.#outlineContent = outlineContent
|
|
110
121
|
root.appendChild(outlineContent)
|
|
111
122
|
|
|
123
|
+
// Double-click on bottom padding area: if last block has content, append empty paragraph
|
|
124
|
+
this.#onDblClick = (event: MouseEvent) => {
|
|
125
|
+
const view = this.#view
|
|
126
|
+
if (!view.editable) return
|
|
127
|
+
|
|
128
|
+
const dom = view.dom
|
|
129
|
+
const children = dom.children
|
|
130
|
+
if (children.length === 0) return
|
|
131
|
+
|
|
132
|
+
const lastChild = children[children.length - 1]
|
|
133
|
+
if (!lastChild) return
|
|
134
|
+
const lastRect = lastChild.getBoundingClientRect()
|
|
135
|
+
if (event.clientY <= lastRect.bottom) return
|
|
136
|
+
|
|
137
|
+
const { doc } = view.state
|
|
138
|
+
const lastNode = doc.lastChild
|
|
139
|
+
if (!lastNode) return
|
|
140
|
+
|
|
141
|
+
if (lastNode.type.name === 'paragraph' && lastNode.content.size === 0)
|
|
142
|
+
return
|
|
143
|
+
|
|
144
|
+
const paragraphType = view.state.schema.nodes['paragraph']
|
|
145
|
+
if (!paragraphType) return
|
|
146
|
+
|
|
147
|
+
const pos = doc.content.size
|
|
148
|
+
const tr = view.state.tr.insert(pos, paragraphType.create())
|
|
149
|
+
const sel = TextSelection.create(tr.doc, pos + 1)
|
|
150
|
+
tr.setSelection(sel)
|
|
151
|
+
view.dispatch(tr)
|
|
152
|
+
view.focus()
|
|
153
|
+
}
|
|
154
|
+
view.dom.addEventListener('dblclick', this.#onDblClick)
|
|
155
|
+
|
|
112
156
|
this.#content.style.transition =
|
|
113
157
|
'margin 0.1s ease-out, width 0.1s ease-out'
|
|
114
158
|
|
|
@@ -155,7 +199,29 @@ class FixedToolbarView implements PluginView {
|
|
|
155
199
|
outlineContent.style.right = 'auto'
|
|
156
200
|
} else {
|
|
157
201
|
outlineContent.style.left = 'auto'
|
|
158
|
-
|
|
202
|
+
let baseOffset = window.innerWidth - rootRect.right
|
|
203
|
+
let rightOffset = baseOffset
|
|
204
|
+
let hasVScroll = false
|
|
205
|
+
if (document.documentElement.scrollHeight > window.innerHeight) {
|
|
206
|
+
hasVScroll = true
|
|
207
|
+
}
|
|
208
|
+
let parent: HTMLElement | null = root
|
|
209
|
+
while (parent && parent !== document.body) {
|
|
210
|
+
const { overflowY } = getComputedStyle(parent)
|
|
211
|
+
if (overflowY === 'auto' || overflowY === 'scroll') {
|
|
212
|
+
if (parent.scrollHeight > parent.clientHeight) {
|
|
213
|
+
hasVScroll = true
|
|
214
|
+
break
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
parent = parent.parentElement
|
|
218
|
+
}
|
|
219
|
+
if (hasVScroll) {
|
|
220
|
+
rightOffset = Math.max(rightOffset, 32)
|
|
221
|
+
} else {
|
|
222
|
+
rightOffset = Math.max(rightOffset, 0)
|
|
223
|
+
}
|
|
224
|
+
outlineContent.style.right = `${rightOffset}px`
|
|
159
225
|
}
|
|
160
226
|
}
|
|
161
227
|
}
|
|
@@ -197,26 +263,26 @@ class FixedToolbarView implements PluginView {
|
|
|
197
263
|
root.style.backgroundColor = ''
|
|
198
264
|
}
|
|
199
265
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
266
|
+
// Reset root and toolbar styles to default/full-width
|
|
267
|
+
root.style.paddingLeft = '0'
|
|
268
|
+
root.style.paddingRight = '0'
|
|
269
|
+
this.#content.style.width = '100%'
|
|
270
|
+
this.#content.style.marginLeft = '0'
|
|
271
|
+
this.#content.style.marginRight = '0'
|
|
272
|
+
|
|
273
|
+
if (this.#editorContainer) {
|
|
274
|
+
if (viewState.outlineVisible) {
|
|
275
|
+
if (viewState.outlinePosition === 'left') {
|
|
276
|
+
this.#editorContainer.style.paddingLeft = `${viewState.outlineWidth}px`
|
|
277
|
+
this.#editorContainer.style.paddingRight = '0'
|
|
278
|
+
} else {
|
|
279
|
+
this.#editorContainer.style.paddingLeft = '0'
|
|
280
|
+
this.#editorContainer.style.paddingRight = `${viewState.outlineWidth}px`
|
|
281
|
+
}
|
|
207
282
|
} else {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
this.#content.style.width = `calc(100% + ${viewState.outlineWidth}px)`
|
|
211
|
-
this.#content.style.marginLeft = '0'
|
|
212
|
-
this.#content.style.marginRight = `-${viewState.outlineWidth}px`
|
|
283
|
+
this.#editorContainer.style.paddingLeft = '0'
|
|
284
|
+
this.#editorContainer.style.paddingRight = '0'
|
|
213
285
|
}
|
|
214
|
-
} else {
|
|
215
|
-
root.style.paddingLeft = '0'
|
|
216
|
-
root.style.paddingRight = '0'
|
|
217
|
-
this.#content.style.width = '100%'
|
|
218
|
-
this.#content.style.marginLeft = '0'
|
|
219
|
-
this.#content.style.marginRight = '0'
|
|
220
286
|
}
|
|
221
287
|
|
|
222
288
|
const maxWidth = (editorWidthMap as any)[viewState.editorWidth]
|
|
@@ -225,7 +291,7 @@ class FixedToolbarView implements PluginView {
|
|
|
225
291
|
this.#view.dom.style.maxWidth = maxWidth
|
|
226
292
|
this.#view.dom.style.width = isFull ? '100%' : maxWidth
|
|
227
293
|
this.#view.dom.style.margin = isFull ? '0' : '0 auto'
|
|
228
|
-
this.#view.dom.style.padding = `20px ${px}
|
|
294
|
+
this.#view.dom.style.padding = `20px ${px} 36px`
|
|
229
295
|
if (this.#headerContent) {
|
|
230
296
|
// this.#headerContent.style.maxWidth = maxWidth
|
|
231
297
|
// this.#headerContent.style.width = isFull ? '100%' : maxWidth
|
|
@@ -235,8 +301,11 @@ class FixedToolbarView implements PluginView {
|
|
|
235
301
|
}
|
|
236
302
|
|
|
237
303
|
// Compute geometry after styles and DOM (cover) are updated
|
|
238
|
-
nextTick(() => {
|
|
304
|
+
void nextTick(() => {
|
|
239
305
|
this.#updateOutlineGeometry?.()
|
|
306
|
+
setTimeout(() => {
|
|
307
|
+
this.#updateOutlineGeometry?.()
|
|
308
|
+
}, 100)
|
|
240
309
|
})
|
|
241
310
|
},
|
|
242
311
|
{ immediate: true }
|
|
@@ -250,6 +319,9 @@ class FixedToolbarView implements PluginView {
|
|
|
250
319
|
|
|
251
320
|
destroy = () => {
|
|
252
321
|
if (this.#watcher) this.#watcher()
|
|
322
|
+
if (this.#onDblClick) {
|
|
323
|
+
this.#view.dom.removeEventListener('dblclick', this.#onDblClick)
|
|
324
|
+
}
|
|
253
325
|
if (this.#resizeObserver) this.#resizeObserver.disconnect()
|
|
254
326
|
window.removeEventListener('resize', this.#updateOutlineGeometry!)
|
|
255
327
|
window.removeEventListener('scroll', this.#updateOutlineGeometry!, {
|