@ones-editor/editor 1.0.2-beta.7 → 1.0.2-beta.9
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/@ones-editor/block-menu/src/block-menu/index.d.ts +0 -1
- package/@ones-editor/context-menu/index.d.ts +3 -0
- package/@ones-editor/context-menu/package.json +1 -1
- package/@ones-editor/context-menu/src/helper/actions.d.ts +1 -1
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +1 -1
- package/@ones-editor/context-menu/src/menu/index.d.ts +2 -2
- package/@ones-editor/core/src/core/doc/doc.d.ts +7 -5
- package/@ones-editor/core/src/core/types.d.ts +0 -16
- package/@ones-editor/graph-embed/src/config/index.d.ts +1 -1
- package/@ones-editor/graph-embed/src/helper/graph-base.d.ts +1 -2
- package/@ones-editor/graph-embed/src/helper/graph-block-commands.d.ts +1 -1
- package/@ones-editor/mathjax/src/mathjax/convert.d.ts +9 -0
- package/@ones-editor/mathjax/src/mathjax-box/mathjax-editor.d.ts +3 -3
- package/@ones-editor/sharedb-doc/src/index.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/versions/index.d.ts +2 -0
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +29 -0
- package/@ones-editor/sharedb-doc/src/versions/simple-client.d.ts +25 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +0 -1
- package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +1 -1
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +3 -3
- package/@ones-editor/versions/src/utils/index.d.ts +2 -2
- package/@ones-editor/versions/src/version-dialog/index.d.ts +3 -3
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +165 -165
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/@ones-editor/context-menu/src/index.d.ts +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { OnesEditor, EditorInputHandlers } from '../../../../@ones-editor/core';
|
|
2
2
|
export declare function handleCopyAction(editor: OnesEditor, inputHandlers: EditorInputHandlers | null, id: 'copy' | 'copy-markdown'): Promise<void>;
|
|
3
3
|
export declare function handleCutAction(editor: OnesEditor, inputHandlers: EditorInputHandlers | null): Promise<void>;
|
|
4
|
-
export declare function handlePasteAction(editor: OnesEditor): Promise<void>;
|
|
4
|
+
export declare function handlePasteAction(editor: OnesEditor, inputHandlers: EditorInputHandlers | null): Promise<void>;
|
|
@@ -14,7 +14,7 @@ export default class ContextMenuCommandItems {
|
|
|
14
14
|
get stepItem(): CommandItem;
|
|
15
15
|
get selectionCommandItems(): CommandItem[];
|
|
16
16
|
destroy(): void;
|
|
17
|
-
handleActionByExternal: (item: CommandItem) =>
|
|
17
|
+
handleActionByExternal: (item: CommandItem) => unknown;
|
|
18
18
|
getPasteCommandItem: () => Promise<CommandItem>;
|
|
19
19
|
getCommandItems: () => Promise<CommandItem[]>;
|
|
20
20
|
private getExternalContextMenuOptions;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EditorInputHandlers } from '../../../../@ones-editor/core';
|
|
2
2
|
import type { OnesEditor, OnesEditorContextMenuInstance } from '../../../../@ones-editor/core';
|
|
3
3
|
import './context-menu.scss';
|
|
4
|
-
declare class
|
|
4
|
+
declare class OnesEditorContextMenu implements OnesEditorContextMenuInstance {
|
|
5
5
|
private editor;
|
|
6
6
|
private contextMenu;
|
|
7
7
|
private contextMenuCommandItems;
|
|
@@ -18,4 +18,4 @@ declare class RightContextMenu implements OnesEditorContextMenuInstance {
|
|
|
18
18
|
private handleContextMenuClick;
|
|
19
19
|
private handleImageEmbedAction;
|
|
20
20
|
}
|
|
21
|
-
export default
|
|
21
|
+
export default OnesEditorContextMenu;
|
|
@@ -190,7 +190,13 @@ export interface InsertBlockOptions {
|
|
|
190
190
|
noFocus?: boolean;
|
|
191
191
|
}
|
|
192
192
|
export type UpdateBlockOptions = InsertBlockOptions;
|
|
193
|
-
export interface
|
|
193
|
+
export interface OnesEditorDocServer {
|
|
194
|
+
getServerMeta?: () => OnesEditorDocServerMeta;
|
|
195
|
+
buildResourceUrl: (resourceId: string, options?: BuildResourceUrlOptions) => string;
|
|
196
|
+
getVersionHelper?: () => OnesEditorDocVersionHelper | undefined;
|
|
197
|
+
getRemoteUsers: () => OnesEditorRemoteUsers;
|
|
198
|
+
}
|
|
199
|
+
export interface OnesEditorDoc extends OnesEditorDocServer {
|
|
194
200
|
registerCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
195
201
|
unregisterCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
196
202
|
toJSON: () => DocObject;
|
|
@@ -208,15 +214,11 @@ export interface OnesEditorDoc {
|
|
|
208
214
|
localDeleteChildContainers: (containerIds: string[]) => void;
|
|
209
215
|
addResources: (resourceIds: string[]) => Promise<string[]>;
|
|
210
216
|
uploadResource: (file: File, options?: UploadResourceOptions) => Promise<UploadResourceResult>;
|
|
211
|
-
buildResourceUrl: (resourceId: string, options?: BuildResourceUrlOptions) => string;
|
|
212
217
|
request: <T = unknown>(url: string, options?: unknown) => Promise<T>;
|
|
213
218
|
broadcastMessage: (data: unknown) => void;
|
|
214
219
|
destroy: () => void;
|
|
215
220
|
getUser: () => OnesEditorUser;
|
|
216
|
-
getRemoteUsers: () => OnesEditorRemoteUsers;
|
|
217
221
|
recognizeLink?: (link: string) => Promise<RecognizeLinkResult>;
|
|
218
|
-
getVersionHelper?: () => OnesEditorDocVersionHelper | undefined;
|
|
219
|
-
getServerMeta?: () => OnesEditorDocServerMeta;
|
|
220
222
|
beginBatchUpdate: () => number;
|
|
221
223
|
endBatchUpdate: () => number;
|
|
222
224
|
}
|
|
@@ -82,14 +82,6 @@ export interface EmbedOptions {
|
|
|
82
82
|
insertEmbedCommandItems?: CommandItem[];
|
|
83
83
|
handleInsertEmptyEmbed?: (editor: OnesEditor, options: InsertEmptyBlockOptions) => Promise<BlockElement | null>;
|
|
84
84
|
}
|
|
85
|
-
export interface OnesContextMenuOptions {
|
|
86
|
-
id: string;
|
|
87
|
-
inserts: {
|
|
88
|
-
insertBefore?: string;
|
|
89
|
-
commands: CommandItem[];
|
|
90
|
-
};
|
|
91
|
-
handleContextMenuAction?: (editor: OnesEditor, srcBlock: BlockElement, item: CommandItem) => boolean;
|
|
92
|
-
}
|
|
93
85
|
export interface Embed {
|
|
94
86
|
embedType: string;
|
|
95
87
|
createEmbedContent: (editor: OnesEditor, content: BlockContentElement, block: DocEmbedBlock, path: BlockPath, container: ContainerElement, blockElement: BlockElement) => void;
|
|
@@ -105,7 +97,6 @@ export interface Embed {
|
|
|
105
97
|
data?: DocBlockAttributes;
|
|
106
98
|
}) => ConvertBlockResult | null;
|
|
107
99
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, path: BlockPath) => Promise<DocObject | undefined>;
|
|
108
|
-
getContextMenu?: (editor: OnesEditor, srcBlock: BlockElement, isSecureContext: boolean) => OnesContextMenuOptions;
|
|
109
100
|
}
|
|
110
101
|
export interface ConvertBlockResult {
|
|
111
102
|
blockData: DocBlock;
|
|
@@ -237,7 +228,6 @@ export interface Block {
|
|
|
237
228
|
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
238
229
|
getResources?: (data: DocBlock) => string[];
|
|
239
230
|
replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
|
|
240
|
-
getContextMenu?: (editor: OnesEditor, srcBlock: BlockElement, isSecureContext: boolean) => OnesContextMenuOptions | undefined;
|
|
241
231
|
}
|
|
242
232
|
export type TextStyles = {
|
|
243
233
|
[index: string]: StyleType;
|
|
@@ -414,9 +404,6 @@ export interface OnesEditorOptions {
|
|
|
414
404
|
export interface OnesEditorContextMenuInstance {
|
|
415
405
|
show: (event: MouseEvent) => void;
|
|
416
406
|
}
|
|
417
|
-
interface OnesEditorContextMenu {
|
|
418
|
-
new (editor: OnesEditor): OnesEditorContextMenuInstance;
|
|
419
|
-
}
|
|
420
407
|
export interface OnesEditorComponents {
|
|
421
408
|
blocks?: Block[];
|
|
422
409
|
boxes?: Box[];
|
|
@@ -427,7 +414,6 @@ export interface OnesEditorComponents {
|
|
|
427
414
|
commandProviders?: OnesEditorCommandProvider[];
|
|
428
415
|
textRenders?: OnesEditorBlockRenderer[];
|
|
429
416
|
blockHooks?: OnesEditorBlockHook[];
|
|
430
|
-
contextMenu?: OnesEditorContextMenu;
|
|
431
417
|
options?: {
|
|
432
418
|
[index: string]: unknown;
|
|
433
419
|
};
|
|
@@ -491,7 +477,6 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
491
477
|
readonly options: OnesEditorOptions;
|
|
492
478
|
readonly domEvents: OnesEditorDomEvents;
|
|
493
479
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
494
|
-
readonly contextMenu: OnesEditorContextMenuInstance | null;
|
|
495
480
|
readonly: boolean;
|
|
496
481
|
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
|
|
497
482
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
@@ -724,4 +709,3 @@ export interface OnesEditorBlockHook {
|
|
|
724
709
|
writable?: (editor: OnesEditor, blockElement: BlockElement | BlockElement[]) => boolean | undefined;
|
|
725
710
|
commands?: (editor: OnesEditor, blockElement: BlockElement) => BlockCommands;
|
|
726
711
|
}
|
|
727
|
-
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const MERMAID_SCRIPTS = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js";
|
|
1
|
+
export declare const MERMAID_SCRIPTS = "https://cdn.jsdelivr.net/npm/mermaid@9.0.1/dist/mermaid.min.js";
|
|
2
2
|
export declare const FLOWCHART_SCRIPTS: string[];
|
|
3
3
|
export declare const PLANTUML_PRE = "https://www.plantuml.com/plantuml/svg";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockProperties } from '../../../../@ones-editor/core';
|
|
2
|
-
import type { OnesEditor, BlockContentElement, DocEmbedBlock, BlockElement, Logger
|
|
2
|
+
import type { OnesEditor, BlockContentElement, DocEmbedBlock, BlockElement, Logger } from '../../../../@ones-editor/core';
|
|
3
3
|
import type { GraphType, GraphEmbedBlockProperties } from './graph-block-commands';
|
|
4
4
|
export default abstract class GraphBase {
|
|
5
5
|
private graphType;
|
|
@@ -23,7 +23,6 @@ export default abstract class GraphBase {
|
|
|
23
23
|
protected emptyContent(): void;
|
|
24
24
|
protected updateSpecialClasses(embed: HTMLDivElement, code: string | undefined, err: Error | null): void;
|
|
25
25
|
editGraph(content: BlockContentElement): void;
|
|
26
|
-
getContextMenu(): OnesContextMenuOptions;
|
|
27
26
|
getBlockProperties(block: BlockElement, properties?: GraphEmbedBlockProperties): BlockProperties;
|
|
28
27
|
private hasChanged;
|
|
29
28
|
private removeStatusContent;
|
|
@@ -15,7 +15,7 @@ declare class GraphBlockCommands extends StandardEmbedBlockCommands<PresetComman
|
|
|
15
15
|
executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
|
|
16
16
|
}
|
|
17
17
|
export declare function getGraphEmbedBlockProperties(editor: OnesEditor, block: BlockElement, type: 'mermaid' | 'flowchart' | 'plantuml', properties?: GraphEmbedBlockProperties): {
|
|
18
|
-
blockCommands: {
|
|
18
|
+
blockCommands: Record<string, import("@ones-editor/core").BlockCommands> | {
|
|
19
19
|
'hovering-toolbar': GraphBlockCommands;
|
|
20
20
|
};
|
|
21
21
|
abstract: 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;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BuildResourceUrlOptions, DocObject, DocVersion, EventCallbacks, OnesEditorDocHistoryData, OnesEditorDocServer, OnesEditorDocServerMeta, OnesEditorDocVersionExtra, OnesEditorDocVersionHelper, OnesEditorHistoryDataParseHandler, RemoteUsers } from '../../../../@ones-editor/core';
|
|
2
|
+
import { ShareDBDocCallbacks, ShareDBDocOptions } from '../types';
|
|
3
|
+
import ShareDBSimpleClient from './simple-client';
|
|
4
|
+
export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> implements OnesEditorDocServer, OnesEditorDocVersionHelper {
|
|
5
|
+
private options;
|
|
6
|
+
remoteUsers: RemoteUsers;
|
|
7
|
+
client: ShareDBSimpleClient;
|
|
8
|
+
constructor(options: ShareDBDocOptions);
|
|
9
|
+
destroy(): void;
|
|
10
|
+
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
11
|
+
getRemoteUsers(): RemoteUsers;
|
|
12
|
+
getVersionHelper(): OnesEditorDocVersionHelper;
|
|
13
|
+
getVersions(): Promise<DocVersion[]>;
|
|
14
|
+
getVersion(ver: number): Promise<DocObject>;
|
|
15
|
+
getLatestVersion(): Promise<DocObject>;
|
|
16
|
+
getHistoryData(version: number, from?: number | undefined): Promise<{
|
|
17
|
+
doc: DocObject;
|
|
18
|
+
historyData: OnesEditorDocHistoryData[];
|
|
19
|
+
}>;
|
|
20
|
+
getVersionData(version: number, from?: number): Promise<{
|
|
21
|
+
doc: DocObject;
|
|
22
|
+
versionData: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
updateVersionExtra(version: number, tagId: string, extra: OnesEditorDocVersionExtra): Promise<void>;
|
|
25
|
+
revertVersion(ver: number): Promise<void>;
|
|
26
|
+
createVersion(tag: string, publish: boolean): Promise<DocVersion>;
|
|
27
|
+
parseHistoryData(historyData: OnesEditorDocHistoryData, handler: OnesEditorHistoryDataParseHandler): void;
|
|
28
|
+
getServerMeta(): OnesEditorDocServerMeta;
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BuildResourceUrlOptions, DocVersion, OnesEditorDocVersionExtra } from '../../../../@ones-editor/core';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
import { AuthMessage, EditorDoc, EditorOp } from '../types';
|
|
4
|
+
export default class ShareDBSimpleClient {
|
|
5
|
+
private serverUrl;
|
|
6
|
+
auth: AuthMessage;
|
|
7
|
+
clientId: string;
|
|
8
|
+
constructor(auth: AuthMessage, serverUrl: string);
|
|
9
|
+
editorServer(): string;
|
|
10
|
+
apiServer(): string;
|
|
11
|
+
getBaseURL(): string;
|
|
12
|
+
getBase64BaseURL(): string;
|
|
13
|
+
request<T = unknown>(url: string, opt?: any): Promise<AxiosResponse<any, T>>;
|
|
14
|
+
getVersions(): Promise<DocVersion[]>;
|
|
15
|
+
getVersion(ver: number): Promise<EditorDoc>;
|
|
16
|
+
getLatestVersion(): Promise<EditorDoc>;
|
|
17
|
+
getVersionOps(version: number, from?: number): Promise<{
|
|
18
|
+
doc: EditorDoc;
|
|
19
|
+
ops: EditorOp[];
|
|
20
|
+
}>;
|
|
21
|
+
updateVersionExtra(version: number, tagId: string, extra: OnesEditorDocVersionExtra): Promise<void>;
|
|
22
|
+
revertVersion(ver: number): Promise<void>;
|
|
23
|
+
createVersion(tag: string, publish: boolean): Promise<any>;
|
|
24
|
+
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
25
|
+
}
|