@ones-editor/editor 0.0.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -207,6 +207,7 @@ export interface OnesEditorDoc {
207
207
  }[]) => void;
208
208
  localDeleteChildContainers: (containerIds: string[]) => void;
209
209
  addResources: (resourceIds: string[]) => Promise<string[]>;
210
+ patchSyncResources: (resourceIds: string[]) => Promise<string[]>;
210
211
  uploadResource: (file: File, options?: UploadResourceOptions) => Promise<UploadResourceResult>;
211
212
  buildResourceUrl: (resourceId: string, options?: BuildResourceUrlOptions) => string;
212
213
  request: <T = unknown>(url: string, options?: unknown) => Promise<T>;
@@ -36,6 +36,7 @@ export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> im
36
36
  onError(error: Error): void;
37
37
  uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
38
38
  addResources(resourceIds: string[]): Promise<string[]>;
39
+ patchSyncResources(resourceIds: string[]): Promise<string[]>;
39
40
  buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
40
41
  request<T = unknown>(url: string, options?: unknown): Promise<T>;
41
42
  broadcastMessage(data: unknown): void;
@@ -24,6 +24,7 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
24
24
  localDeleteChildContainers(containerIds: string[]): void;
25
25
  uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
26
26
  addResources(resourceIds: string[]): Promise<string[]>;
27
+ patchSyncResources(resourceIds: string[]): Promise<string[]>;
27
28
  buildResourceUrl(src: string): string;
28
29
  request<T>(url: string, opt?: any): Promise<T>;
29
30
  broadcastMessage(data: unknown): void;
@@ -0,0 +1,2 @@
1
+ export declare function styleColorToColor(color: string | undefined): "#e52727" | "#eb6414" | "#f0a100" | "#24b47e" | "#0064ff" | "#9678d3" | "#909090" | undefined;
2
+ export declare function styleBackgroundColorToHighlight(color: string | undefined): "#e52727" | "#eb6414" | "#f0a100" | "#24b47e" | "#0064ff" | "#9678d3" | "#909090" | "#fad4d4" | "#fbe0d0" | "#fceccc" | "#d3f0e5" | "#d6e9fa" | "#eae4f6" | "#dedede" | "#e8e8e8" | undefined;
@@ -1,7 +1,7 @@
1
1
  import { BlockElement, CommandItem, DocBlock, DocBlockText, OnesEditor } from '../../../@ones-editor/core';
2
2
  export interface DocListBlock extends DocBlock {
3
3
  text: DocBlockText;
4
- level: number;
4
+ level?: number;
5
5
  start: number;
6
6
  ordered: boolean;
7
7
  groupId: string;
@@ -1,9 +1,18 @@
1
1
  import { OnesEditor } from '../../../../@ones-editor/core';
2
+ type ReturnType<T> = T extends (...args: any) => infer R ? R : never;
2
3
  export interface MathjaxOptions {
3
4
  cdn?: {
4
5
  mathjax?: string;
5
6
  };
6
7
  }
7
8
  export declare function mathjax2Svg(editor: OnesEditor, tex: string): Promise<string>;
9
+ export declare function analyzeMathjaxSvgWidth(svg: string): {
10
+ width: number;
11
+ height: number;
12
+ };
8
13
  export declare function mathjax2DataUrl(editor: OnesEditor, tex: string): Promise<string>;
9
14
  export declare function convertAndUploadMathjax(editor: OnesEditor, tex: string): Promise<string>;
15
+ export declare function convertAndUploadMathjaxForEmbed(editor: OnesEditor, tex: string): Promise<{
16
+ resourceId: string;
17
+ } & ReturnType<typeof analyzeMathjaxSvgWidth>>;
18
+ export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="lodash" />
2
- import { AbstractCommandBar, Popup } from '../../../../@ones-editor/ui-base';
2
+ import { AbstractCommandBar, Popup, ManualShowCommandBarOptions } from '../../../../@ones-editor/ui-base';
3
3
  import { OnesEditor } from '../../../../@ones-editor/core';
4
4
  export type OnEditChange = (tex: string, end: boolean) => void;
5
5
  export default class MathjaxEditor {
@@ -7,7 +7,7 @@ export default class MathjaxEditor {
7
7
  onChange: OnEditChange | null;
8
8
  tex: string;
9
9
  private observer;
10
- editMathjax(elem: HTMLElement, tex: string, onChange: OnEditChange): void;
10
+ editMathjax(elem: HTMLElement, tex: string, onChange: OnEditChange, options?: ManualShowCommandBarOptions): void;
11
11
  handleClose: (commandBar: AbstractCommandBar) => void;
12
12
  handleKeyup: (event: KeyboardEvent) => void;
13
13
  handleChange: import("lodash").DebouncedFunc<(text: string) => void>;
@@ -16,4 +16,4 @@ export default class MathjaxEditor {
16
16
  getTextarea(): HTMLTextAreaElement;
17
17
  destroy(): void;
18
18
  }
19
- export declare function editMathjax(editor: OnesEditor, elem: HTMLElement, tex: string, onChange: OnEditChange): void;
19
+ export declare function editMathjax(editor: OnesEditor, elem: HTMLElement, tex: string, onChange: OnEditChange, options?: ManualShowCommandBarOptions): void;
@@ -30,7 +30,11 @@ export default class ShareDBClient {
30
30
  getFileUrlByHash(uploadFileUrl: string, hash: string, name: string, size: number, headers: {
31
31
  [index: string]: string;
32
32
  }): Promise<any>;
33
+ patchSyncResourceByHash(uploadFileUrl: string, hash: string[], headers: {
34
+ [index: string]: string;
35
+ }): Promise<any[]>;
33
36
  getFileUrlsByHashes(resourceHashes: string[]): Promise<any[]>;
37
+ patchSyncResourceByHashes(resourceHashes: string[]): Promise<any[]>;
34
38
  uploadFile(url: string, file: File, headers: {
35
39
  [index: string]: string;
36
40
  }, onProgress: OnProgress, options?: {
@@ -76,6 +76,7 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
76
76
  onUpdateComment(commentId: string, local: boolean): void;
77
77
  onCustomMessage(msg: unknown): void;
78
78
  addResources(resourceIds: string[]): Promise<string[]>;
79
+ patchSyncResources(resourceIds: string[]): Promise<any[]>;
79
80
  uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
80
81
  buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
81
82
  request<T = unknown>(url: string, options?: unknown): Promise<T>;