mce 0.17.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,40 +32,55 @@ npm i mce
32
32
  <script setup lang="ts">
33
33
  import { Editor, EditorLayout, EditorLayoutItem } from 'mce'
34
34
  import 'mce/styles'
35
+ import gif from '@mce/gif'
35
36
  import mp4 from '@mce/mp4'
36
37
  import openxml from '@mce/openxml'
37
38
  import pdf from '@mce/pdf'
38
39
  import svg from '@mce/svg'
40
+ import gifWorkerUrl from 'modern-gif/worker?url'
39
41
 
40
42
  const editor = new Editor({
41
43
  plugins: [
44
+ gif(),
42
45
  mp4(),
43
- openxml(),
44
- pdf(),
45
46
  svg(),
47
+ pdf(),
48
+ openxml(),
46
49
  ],
47
- theme: 'system',
48
- watermark: '/example.jpg',
49
- checkerboard: true,
50
- checkerboardStyle: 'grid',
51
- pixelGrid: true,
52
- pixelate: true,
53
- camera: true,
54
- ruler: true,
55
- scrollbar: true,
56
- toolbelt: true,
57
- statusbar: true,
58
- frameGap: 48,
59
- typographyStrategy: 'autoHeight',
60
- handleShape: 'rect',
61
- screenCenterOffset: { left: 0, top: 0, right: 0, bottom: 0 },
62
- localDb: false,
50
+ gifWorkerUrl,
51
+ locale: { locale: 'en' },
52
+ viewport: {
53
+ camera: { enabled: true },
54
+ zoom: { strategy: 'contain' },
55
+ screenPadding: { left: 0, top: 0, right: 0, bottom: 0 },
56
+ },
57
+ canvas: {
58
+ checkerboard: { enabled: true, style: 'grid' },
59
+ pixelGrid: { enabled: true },
60
+ frame: { outline: false },
61
+ watermark: {
62
+ url: '/example.jpg',
63
+ width: 100,
64
+ alpha: 0.05,
65
+ rotation: 0.5236,
66
+ },
67
+ },
68
+ ui: {
69
+ ruler: { visible: true },
70
+ scrollbar: { visible: true },
71
+ statusbar: { visible: true },
72
+ toolbelt: { visible: true },
73
+ madeWith: { visible: false },
74
+ },
75
+ typography: {
76
+ strategy: 'autoHeight',
77
+ defaultFont: {
78
+ family: 'SourceHanSansCN-Normal',
79
+ src: '/fonts/SourceHanSansCN-Normal.woff',
80
+ },
81
+ },
63
82
  customUpload: async (blob) => URL.createObjectURL(blob),
64
83
  customContextMenu: (menu) => menu,
65
- locale: {
66
- locale: 'zhHans', // default 'en'
67
- },
68
- defaultFont: { family: 'SourceHanSansCN-Normal', src: '/SourceHanSansCN-Normal.woff' },
69
84
  doc: {
70
85
  children: [
71
86
  { foreground: '/example.png', style: { rotate: 60, left: 200, top: 10, width: 50, height: 50 } },
@@ -15,8 +15,8 @@ export interface LayerProvide {
15
15
  dragging: Ref<boolean>;
16
16
  droppingItemId: Ref<string | undefined>;
17
17
  }
18
- export declare const MceLayerKey: InjectionKey<LayerProvide>;
19
- export declare const MceLayerItemKey: InjectionKey<{
18
+ export declare const LayerKey: InjectionKey<LayerProvide>;
19
+ export declare const LayerItemKey: InjectionKey<{
20
20
  id: string;
21
21
  }>;
22
22
  export declare function createLayer(): {
@@ -33,8 +33,8 @@ interface LayoutProvide {
33
33
  layoutRect: Ref<DOMRectReadOnly | undefined>;
34
34
  rootZIndex: Ref<number>;
35
35
  }
36
- export declare const MceLayoutKey: InjectionKey<LayoutProvide>;
37
- export declare const MceLayoutItemKey: InjectionKey<{
36
+ export declare const LayoutKey: InjectionKey<LayoutProvide>;
37
+ export declare const LayoutItemKey: InjectionKey<{
38
38
  id: string;
39
39
  }>;
40
40
  export declare function makeLayoutProps(): {
@@ -73,9 +73,9 @@ export declare function createLayout(props: {
73
73
  fullHeight?: boolean;
74
74
  }): {
75
75
  layoutClasses: Readonly<Ref<(string | {
76
- 'mce-layout--full-height': boolean | undefined;
76
+ 'm-layout--full-height': boolean | undefined;
77
77
  })[], (string | {
78
- 'mce-layout--full-height': boolean | undefined;
78
+ 'm-layout--full-height': boolean | undefined;
79
79
  })[]>>;
80
80
  layoutStyles: Readonly<Ref<{
81
81
  zIndex: number | undefined;
@@ -28,13 +28,12 @@ export declare class YDoc extends Observable {
28
28
  _nodeMap: Map<string, Node>;
29
29
  indexeddb?: IndexeddbProvider;
30
30
  undoManager: Y.UndoManager;
31
- protected _ready: boolean;
32
31
  constructor(id?: string);
33
32
  protected _isSelfTransaction(transaction?: Y.Transaction): boolean;
34
33
  protected _initUndoManager(typeScope?: any[]): void;
35
34
  loadIndexeddb(): Promise<void>;
35
+ load(): void;
36
36
  transact<T>(fn: () => T, should?: boolean): T;
37
- load(initFn?: () => void | Promise<void>): Promise<this>;
38
37
  protected _debug(..._args: any[]): void;
39
38
  protected _yChildrenChange(event: Y.YMapEvent<Y.Map<unknown>>, transaction: Y.Transaction): void;
40
39
  reset(): this;