@ones-editor/editor 2.0.5-beta.9 → 2.0.6-beta.1
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/core/src/core/composition/editor-input.d.ts +1 -1
- package/@ones-editor/core/src/core/containers/element.d.ts +0 -1
- package/@ones-editor/core/src/core/types.d.ts +8 -4
- package/@ones-editor/core/src/utils/data-url.d.ts +1 -0
- package/@ones-editor/drop-target/src/drop-target.d.ts +0 -6
- package/@ones-editor/drop-target/src/index.d.ts +0 -1
- package/@ones-editor/graph-embed/src/helper/dom.d.ts +3 -0
- package/@ones-editor/graph-embed/src/helper/graph-base.d.ts +1 -1
- package/@ones-editor/graph-embed/src/helper/graph-block-commands.d.ts +3 -1
- package/@ones-editor/image-embed/src/image-dom/download-image.d.ts +2 -0
- package/@ones-editor/input-handlers/src/index.d.ts +1 -4
- package/@ones-editor/input-handlers/src/markdown-shortcuts/match-block-convert.d.ts +1 -9
- package/@ones-editor/misc/src/image.d.ts +1 -0
- package/@ones-editor/paste-special/src/paste-special-handler.d.ts +0 -1
- package/@ones-editor/to-docx/src/doc2other/colors.d.ts +1 -7
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/index.d.ts +2 -2
- package/@ones-editor/ui/src/quick-menu/index.d.ts +1 -3
- package/@ones-editor/ui/src/quick-menu/types.d.ts +0 -4
- package/@ones-editor/ui-base/src/color-palette/color-palette.d.ts +1 -2
- package/@ones-editor/ui-base/src/color-palette/create-palette.d.ts +0 -8
- package/@ones-editor/ui-base/src/color-palette/index.d.ts +2 -2
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +0 -1
- package/@ones-editor/ui-base/src/icons/index.d.ts +2 -17
- package/@ones-editor/ui-base/src/index.d.ts +0 -1
- package/@ones-editor/ui-base/src/input/create-input.d.ts +0 -1
- package/@ones-editor/ui-base/src/locale/en-us.d.ts +0 -20
- package/@ones-editor/ui-base/src/locale/ja-jp.d.ts +0 -20
- package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +0 -20
- package/dist/index.js +206 -282
- package/dist/lang/en-us.d.ts +0 -1
- package/dist/lang/ja-jp.d.ts +0 -1
- package/dist/lang/zh-cn.d.ts +0 -1
- package/package.json +1 -1
- package/@ones-editor/callout-block/package.json +0 -11
- package/@ones-editor/callout-block/src/callout-block/callout-block-content.d.ts +0 -3
- package/@ones-editor/callout-block/src/callout-block/callout-block-doc.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/callout-block.d.ts +0 -3
- package/@ones-editor/callout-block/src/callout-block/callout-converter-interceptor.d.ts +0 -8
- package/@ones-editor/callout-block/src/callout-block/callout-drop-target-finder.d.ts +0 -10
- package/@ones-editor/callout-block/src/callout-block/callout-input-handler.d.ts +0 -11
- package/@ones-editor/callout-block/src/callout-block/callout-last-callout-payload.d.ts +0 -11
- package/@ones-editor/callout-block/src/callout-block/callout-options.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/callout-properties.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/callout-quick-menu-item-filter.d.ts +0 -8
- package/@ones-editor/callout-block/src/callout-block/command-items/bg-color-item.d.ts +0 -22
- package/@ones-editor/callout-block/src/callout-block/command-items/delete-icon-item.d.ts +0 -3
- package/@ones-editor/callout-block/src/callout-block/command-items/preset-item.d.ts +0 -16
- package/@ones-editor/callout-block/src/callout-block/covert-to.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/helper.d.ts +0 -4
- package/@ones-editor/callout-block/src/callout-block/index.d.ts +0 -1
- package/@ones-editor/callout-block/src/callout-block/types.d.ts +0 -9
- package/@ones-editor/callout-block/src/index.d.ts +0 -3
- package/@ones-editor/callout-block/src/locale/en-us.d.ts +0 -12
- package/@ones-editor/callout-block/src/locale/index.d.ts +0 -1
- package/@ones-editor/callout-block/src/locale/ja-jp.d.ts +0 -12
- package/@ones-editor/callout-block/src/locale/zh-cn.d.ts +0 -12
- package/@ones-editor/input-handlers/src/markdown-shortcuts/converter-interceptors.d.ts +0 -12
- package/@ones-editor/ui-base/src/emoji-item/emoji-item.d.ts +0 -19
- package/@ones-editor/ui-base/src/emoji-item/index.d.ts +0 -2
- package/@ones-editor/ui-base/src/emoji-palette/emoji-content.d.ts +0 -21
- package/@ones-editor/ui-base/src/emoji-palette/emoji-data.d.ts +0 -60
- package/@ones-editor/ui-base/src/emoji-palette/emoji-navigation.d.ts +0 -16
- package/@ones-editor/ui-base/src/emoji-palette/emoji-search.d.ts +0 -11
- package/@ones-editor/ui-base/src/emoji-palette/index.d.ts +0 -23
- package/@ones-editor/ui-base/src/emoji-palette/types.d.ts +0 -0
|
@@ -27,7 +27,7 @@ export declare class EditorInput implements OnesEditorInput {
|
|
|
27
27
|
callbacks: EditorInputCallbacks;
|
|
28
28
|
inputElement: HTMLInputElement;
|
|
29
29
|
constructor(editor: OnesEditor, callbacks: EditorInputCallbacks);
|
|
30
|
-
private
|
|
30
|
+
private isInCommandbar;
|
|
31
31
|
destroy(): void;
|
|
32
32
|
getInput(): HTMLInputElement;
|
|
33
33
|
focus(): void;
|
|
@@ -4,4 +4,3 @@ export declare function getContainerById(editor: OnesEditor, containerId: string
|
|
|
4
4
|
export declare function getExistsContainerById(editor: OnesEditor, containerId: string): ContainerElement | null;
|
|
5
5
|
export declare function getContainerBlocksElement(container: ContainerElement): ContainerBlocksElement;
|
|
6
6
|
export declare function getContainerToolsElement(container: ContainerElement): ContainerToolsElement;
|
|
7
|
-
export declare function isContainerBlocksElement(element: Element): element is ContainerBlocksElement;
|
|
@@ -150,8 +150,12 @@ export interface CommandItem {
|
|
|
150
150
|
beforePopup?: (parent: unknown) => void;
|
|
151
151
|
/**
|
|
152
152
|
* defaults to true
|
|
153
|
-
|
|
153
|
+
*/
|
|
154
154
|
shouldShown?: (currentBlock: BlockElement | undefined, menuType: CommandItemMenuType) => boolean;
|
|
155
|
+
/**
|
|
156
|
+
* defaults to true
|
|
157
|
+
*/
|
|
158
|
+
clickToClose?: boolean;
|
|
155
159
|
}
|
|
156
160
|
export interface BlockCommandItem extends CommandItem {
|
|
157
161
|
blockId: string;
|
|
@@ -279,7 +283,7 @@ export interface Block {
|
|
|
279
283
|
convertTo?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, type: 'text' | 'html' | 'markdown', path: BlockPath) => string;
|
|
280
284
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
|
|
281
285
|
getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
|
|
282
|
-
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject
|
|
286
|
+
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
283
287
|
getResources?: (editor: OnesEditor, data: DocBlock) => string[] | null;
|
|
284
288
|
replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
|
|
285
289
|
}
|
|
@@ -496,7 +500,7 @@ export declare class OnesEditorCustomDataWrapper<T> {
|
|
|
496
500
|
getEditor(): OnesEditor;
|
|
497
501
|
destroy(): void;
|
|
498
502
|
}
|
|
499
|
-
export type OnesEditorCustomCreator
|
|
503
|
+
export type OnesEditorCustomCreator = (editor: OnesEditor) => OnesEditorCustom;
|
|
500
504
|
export interface CloneBlockResultInfo {
|
|
501
505
|
containerIdMap: Map<string, string>;
|
|
502
506
|
blockIdMap: Map<string, string>;
|
|
@@ -537,7 +541,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
537
541
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
538
542
|
version: string;
|
|
539
543
|
readonly: boolean;
|
|
540
|
-
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator
|
|
544
|
+
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
|
|
541
545
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
542
546
|
replaceCustom: <T extends OnesEditorCustom>(name: string, newCustom: T) => T;
|
|
543
547
|
findCustom: <T extends OnesEditorCustom>(name: string) => T | null;
|
|
@@ -3,10 +3,6 @@ import DropIndicator from './drop-indicator';
|
|
|
3
3
|
export interface DropHandler {
|
|
4
4
|
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
|
|
5
5
|
}
|
|
6
|
-
export type DropTargetFinderId = keyof any;
|
|
7
|
-
export interface DropTargetFinder {
|
|
8
|
-
finder: (editor: OnesEditor, source: BlockElement | null, x: number, y: number) => BlockElement | null;
|
|
9
|
-
}
|
|
10
6
|
export default class OnesEditorDropTarget {
|
|
11
7
|
private editor;
|
|
12
8
|
indicator: DropIndicator;
|
|
@@ -16,12 +12,10 @@ export default class OnesEditorDropTarget {
|
|
|
16
12
|
dropEffect: 'move' | 'none';
|
|
17
13
|
} | undefined;
|
|
18
14
|
handlers: DropHandler[];
|
|
19
|
-
dropTargetFinders: Map<string | number | symbol, DropTargetFinder>;
|
|
20
15
|
combineToCreate: CombineToCreateOptions[];
|
|
21
16
|
constructor(editor: OnesEditor);
|
|
22
17
|
destroy(): void;
|
|
23
18
|
addHandler(handler: DropHandler): void;
|
|
24
|
-
addFinder(id: DropTargetFinderId, finder: DropTargetFinder): void;
|
|
25
19
|
static register(editor: OnesEditor): OnesEditorDropTarget;
|
|
26
20
|
static get(editor: OnesEditor): OnesEditorDropTarget;
|
|
27
21
|
static find(editor: OnesEditor): OnesEditorDropTarget | null;
|
|
@@ -2,6 +2,5 @@ import { INDICATOR_SIZE } from './drop-indicator';
|
|
|
2
2
|
import OnesEditorDropTarget from './drop-target';
|
|
3
3
|
import type { DropHandler } from './drop-target';
|
|
4
4
|
import { patchInsertFile } from './handlers/patch-insert-file';
|
|
5
|
-
export type { DropTargetFinder, DropTargetFinderId } from './drop-target';
|
|
6
5
|
export * from './drag-object';
|
|
7
6
|
export { OnesEditorDropTarget, DropHandler, patchInsertFile, INDICATOR_SIZE };
|
|
@@ -8,7 +8,7 @@ export default abstract class GraphBase {
|
|
|
8
8
|
logger: Logger;
|
|
9
9
|
editing: boolean;
|
|
10
10
|
private graphEmbedContent;
|
|
11
|
-
private
|
|
11
|
+
private _status;
|
|
12
12
|
constructor(editor: OnesEditor, graphType: GraphType, codeEmbedDataKey: string);
|
|
13
13
|
protected abstract code2ObjectUrl(code: string): Promise<string>;
|
|
14
14
|
protected abstract code2ResourceId(code: string): Promise<string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { BlockElement } from '../../../../@ones-editor/core';
|
|
1
2
|
import { StandardEmbedBlockCommands } from '../../../../@ones-editor/embed-block-helper';
|
|
2
|
-
import type {
|
|
3
|
+
import type { CommandItem, OnesEditor } from '../../../../@ones-editor/core';
|
|
3
4
|
import type { StandardEmbedBlockProperties } from '../../../../@ones-editor/embed-block-helper';
|
|
4
5
|
export type PresetCommandId = 'edit' | 'help';
|
|
5
6
|
export type GraphType = 'mermaid' | 'flowchart' | 'plantuml';
|
|
@@ -12,6 +13,7 @@ declare class GraphBlockCommands extends StandardEmbedBlockCommands<PresetComman
|
|
|
12
13
|
group: string;
|
|
13
14
|
_commands: CommandItem[];
|
|
14
15
|
constructor(editor: OnesEditor, block: BlockElement, graphType: GraphType, properties?: GraphEmbedBlockProperties | undefined);
|
|
16
|
+
get commands(): CommandItem[];
|
|
15
17
|
executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
|
|
16
18
|
}
|
|
17
19
|
export declare function getGraphEmbedBlockProperties(editor: OnesEditor, block: BlockElement, type: 'mermaid' | 'flowchart' | 'plantuml', properties?: GraphEmbedBlockProperties): {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { MarkdownInputHandler, converterIntercept } from './markdown-shortcuts';
|
|
2
|
-
import { MarkdownConverterInterceptors } from './markdown-shortcuts/converter-interceptors';
|
|
3
|
-
import type { ConverterInterceptor } from './markdown-shortcuts/converter-interceptors';
|
|
4
|
-
import type { BlockConverter } from './markdown-shortcuts/match-block-convert';
|
|
5
2
|
import './i18n';
|
|
6
3
|
export * from './enforce-with-document-title';
|
|
7
|
-
export { MarkdownInputHandler, converterIntercept
|
|
4
|
+
export { MarkdownInputHandler, converterIntercept };
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type BlockConverter = {
|
|
3
|
-
reg: RegExp;
|
|
4
|
-
blockType: string;
|
|
5
|
-
data?: DocBlockAttributes;
|
|
6
|
-
};
|
|
7
|
-
export type BlockConverters = {
|
|
8
|
-
[index: string]: BlockConverter;
|
|
9
|
-
};
|
|
1
|
+
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
10
2
|
export declare function converterIntercept(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, type: 'enter' | 'space'): boolean;
|
|
11
3
|
export declare function matchBlockConvert(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, type: 'enter' | 'space'): boolean;
|
|
@@ -6,7 +6,6 @@ export default class PasteSpecialHandler implements OnesEditorInputHandler {
|
|
|
6
6
|
lastUndoAction: OnesEditorUndoAction | null;
|
|
7
7
|
lastPos: BlockPosition | null;
|
|
8
8
|
event: ClipboardEvent | null;
|
|
9
|
-
order: number;
|
|
10
9
|
constructor(editor: OnesEditor);
|
|
11
10
|
destroy(): void;
|
|
12
11
|
handleChanged(editor: OnesEditor, action: OnesEditorUndoAction): void;
|
|
@@ -6,16 +6,10 @@ export declare function styleColorToColor(color: string | undefined): "d83931" |
|
|
|
6
6
|
* @param color
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare function styleBackgroundColorToHighlight(color: string | undefined): "
|
|
9
|
+
export declare function styleBackgroundColorToHighlight(color: string | undefined): "yellow" | "magenta" | "green" | "blue" | "lightGray" | "red" | "darkGreen" | "darkMagenta" | "darkGray" | undefined;
|
|
10
10
|
export declare function styleBackgroundColorToHex(color: string | undefined): "fbbab6" | "ffdcb0" | "fff7a0" | "ceefc5" | "d1ddfb" | "d9cbf8" | "eaeaea" | "fe837c" | "ffbd6a" | "ffe662" | "a8f393" | "98b5ff" | "b394f8" | "b1b1b1" | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* 将rgb(rrr,ggg,bbb)格式的颜色转为RRGGBB格式
|
|
13
13
|
* #RRGGBB 转为 RRGGBB
|
|
14
14
|
*/
|
|
15
15
|
export declare function colorToHex(color: any): string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* 判断是否是合法的 Hex 格式颜色值
|
|
18
|
-
* @param color
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
export declare function isValidHexColor(color: string): boolean;
|