@ones-editor/editor 1.1.20-beta.13 → 1.1.20-beta.15
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/items/insert-block-items/index.d.ts +1 -1
- package/@ones-editor/block-menu/src/block-menu-button/drag-preview/element-to-data-url.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +16 -11
- package/@ones-editor/drop-target/src/index.d.ts +2 -1
- package/@ones-editor/image-embed/src/index.d.ts +2 -1
- package/@ones-editor/layout-block/src/caption.d.ts +8 -0
- package/@ones-editor/layout-block/src/constants.d.ts +5 -2
- package/@ones-editor/layout-block/src/layout-operations.d.ts +1 -1
- package/@ones-editor/layout-block/src/locale/en-us.d.ts +2 -0
- package/@ones-editor/layout-block/src/locale/ja-jp.d.ts +2 -0
- package/@ones-editor/layout-block/src/locale/zh-cn.d.ts +2 -0
- package/@ones-editor/layout-block/src/options.d.ts +2 -0
- package/@ones-editor/layout-block/src/toolbar.d.ts +0 -1
- package/@ones-editor/layout-block/src/types.d.ts +0 -18
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/quick-menu/index.d.ts +4 -3
- package/@ones-editor/ui/src/quick-menu/quick-menu-items.d.ts +4 -2
- package/@ones-editor/ui-base/src/popup/popup.d.ts +0 -1
- package/dist/index.js +123 -123
- package/package.json +1 -1
- package/@ones-editor/layout-block/src/columns-options.d.ts +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../../../../@ones-editor/core';
|
|
2
2
|
import type { GetAllQuickMenuItemsOptions } from '../../../../../../@ones-editor/ui';
|
|
3
3
|
import type { BlockMenuItem } from '../types';
|
|
4
|
-
export declare function getAllInsertBlockItems(editor: OnesEditor, source: 'insert-block' | 'insert-block-before', options: GetAllQuickMenuItemsOptions): BlockMenuItem[];
|
|
4
|
+
export declare function getAllInsertBlockItems(editor: OnesEditor, block: BlockElement, source: 'insert-block' | 'insert-block-before', options: GetAllQuickMenuItemsOptions): BlockMenuItem[];
|
|
5
5
|
export declare function executeInsertBlockCommand(editor: OnesEditor, block: BlockElement, item: BlockMenuItem, insertAbove?: boolean): Promise<BlockElement | null> | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
-
export declare function elementToDataUrl(editor: OnesEditor, element: HTMLElement): Promise<string>;
|
|
2
|
+
export declare function elementToDataUrl(editor: OnesEditor, element: HTMLElement, marginIncluded?: boolean): Promise<string>;
|
|
@@ -109,7 +109,6 @@ export interface ConvertBlockResult {
|
|
|
109
109
|
}
|
|
110
110
|
export interface DeleteBlockEventOptions {
|
|
111
111
|
child: boolean;
|
|
112
|
-
data?: unknown;
|
|
113
112
|
}
|
|
114
113
|
export type CommandItemType = 'normal' | 'separator' | 'section';
|
|
115
114
|
export type CommandItemState = 'disabled' | 'checked' | 'selected';
|
|
@@ -119,6 +118,7 @@ export interface Closeable {
|
|
|
119
118
|
click: (item: CommandItem, target: HTMLElement) => void;
|
|
120
119
|
}
|
|
121
120
|
export type CommandItemChildrenPlacement = 'auto' | 'top' | 'left' | 'right' | 'bottom' | 'auto-start' | 'auto-end' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end';
|
|
121
|
+
export type CommandItemMenuType = 'inline' | 'sibling';
|
|
122
122
|
export interface CommandItem {
|
|
123
123
|
id: string;
|
|
124
124
|
name: string;
|
|
@@ -148,7 +148,10 @@ export interface CommandItem {
|
|
|
148
148
|
hideGroupItem?: boolean;
|
|
149
149
|
setCloseable?: (closeable: Closeable) => void;
|
|
150
150
|
beforePopup?: (parent: unknown) => void;
|
|
151
|
-
|
|
151
|
+
/**
|
|
152
|
+
* defaults to true
|
|
153
|
+
*/
|
|
154
|
+
shouldShown?: (currentBlock: BlockElement | undefined, menuType: CommandItemMenuType) => boolean;
|
|
152
155
|
}
|
|
153
156
|
export interface BlockCommandItem extends CommandItem {
|
|
154
157
|
blockId: string;
|
|
@@ -176,23 +179,25 @@ export interface BlockProperties {
|
|
|
176
179
|
}
|
|
177
180
|
export interface CombineToCreateOptions {
|
|
178
181
|
/**
|
|
179
|
-
* @returns sideway 两侧合并(左右 indicator
|
|
182
|
+
* @returns sideway: 两侧合并(左右 indicator)
|
|
183
|
+
*
|
|
184
|
+
* body: 中间合并(target block 激活)(暂未实现)
|
|
180
185
|
*/
|
|
181
|
-
combinable: (source: BlockElement, target: BlockElement) => undefined | 'sideway' | 'body';
|
|
186
|
+
combinable: (editor: OnesEditor, source: BlockElement, target: BlockElement) => undefined | 'sideway' | 'body';
|
|
182
187
|
onCombine: (editor: OnesEditor, source: BlockElement, target: BlockElement, position: CombineDropInsertPos['pos'], dragObject: DragObject | null) => BlockElement | undefined;
|
|
183
188
|
}
|
|
184
189
|
export interface BlockOptions {
|
|
185
190
|
name: string;
|
|
186
191
|
insertBlockCommandItems?: CommandItem[];
|
|
187
192
|
handleInsertEmptyBlock?: (editor: OnesEditor, options: InsertEmptyBlockOptions) => Promise<BlockElement | null>;
|
|
188
|
-
/**
|
|
189
|
-
* 当前 hover 的元素是否可以展示左侧更多按钮
|
|
190
|
-
* @param editor 编辑器实例
|
|
191
|
-
* @param hoverBlock hover 元素
|
|
192
|
-
* @returns true -> 展示,false -> 不展示
|
|
193
|
-
*/
|
|
194
193
|
isMenuButtonBaseContainer?: (container: ContainerElement) => boolean;
|
|
195
194
|
combineToCreate?: CombineToCreateOptions;
|
|
195
|
+
/**
|
|
196
|
+
* defaults to true.
|
|
197
|
+
*
|
|
198
|
+
* 'without-margin': include margin for dragging preview computing.
|
|
199
|
+
*/
|
|
200
|
+
draggingPreview?: boolean | 'margin-included';
|
|
196
201
|
}
|
|
197
202
|
export interface StandardDragObject {
|
|
198
203
|
type: 'block';
|
|
@@ -550,7 +555,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
550
555
|
clearSelectedContents: () => void;
|
|
551
556
|
insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange, options?: InsertBlockOptions) => BlockElement;
|
|
552
557
|
insertEmbed: (containerId: string, blockIndex: number, embedType: string, embedData: DocEmbedData, newRange?: OnesEditorDocRange, attributes?: DocBlockAttributes) => BlockElement;
|
|
553
|
-
deleteBlock: (block: BlockElement, newRange?: OnesEditorDocRange
|
|
558
|
+
deleteBlock: (block: BlockElement, newRange?: OnesEditorDocRange) => void;
|
|
554
559
|
getTextPosition: () => BlockTextPosition;
|
|
555
560
|
getBlockString: (block: BlockElement, options?: {
|
|
556
561
|
boxReplacement: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { INDICATOR_SIZE } from './drop-indicator';
|
|
1
2
|
import OnesEditorDropTarget from './drop-target';
|
|
2
3
|
import type { DropHandler } from './drop-target';
|
|
3
4
|
import { patchInsertFile } from './handlers/patch-insert-file';
|
|
4
5
|
export * from './drag-object';
|
|
5
|
-
export { OnesEditorDropTarget, DropHandler, patchInsertFile };
|
|
6
|
+
export { OnesEditorDropTarget, DropHandler, patchInsertFile, INDICATOR_SIZE };
|
|
@@ -8,8 +8,9 @@ import { getImageContainersByBlock } from './image-dom/helper';
|
|
|
8
8
|
import EmptyImageConverterInputHandler from './empty-image-converter';
|
|
9
9
|
import { ImagePasteHandler } from './paste-handler';
|
|
10
10
|
import type { ImageDragObject } from './drag-drop/types';
|
|
11
|
+
import { updateImageBlockSize } from './image-size';
|
|
11
12
|
export * from './shortcuts';
|
|
12
13
|
export * from './types';
|
|
13
|
-
export { ImageObject, ImagePasteHandler, getImageContainersByBlock, toImageEmbedData, deleteImageFromBlock, ImageDragObject };
|
|
14
|
+
export { ImageObject, ImagePasteHandler, getImageContainersByBlock, toImageEmbedData, deleteImageFromBlock, ImageDragObject, updateImageBlockSize };
|
|
14
15
|
declare const ImageEmbed: Embed;
|
|
15
16
|
export { ImageEmbed, EmptyImageConverterInputHandler };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OnesEditorInputHandler, OnesEditorCustom, OnesEditor, OnesEditorDocs } from '../../../@ones-editor/core';
|
|
2
|
+
export default class LayoutBlockCaptionInputHandler implements OnesEditorInputHandler, OnesEditorCustom {
|
|
3
|
+
private editor;
|
|
4
|
+
constructor(editor: OnesEditor);
|
|
5
|
+
destroy(): void;
|
|
6
|
+
handleBeforePaste(editor: OnesEditor, event: ClipboardEvent | null, docs: OnesEditorDocs): Promise<boolean>;
|
|
7
|
+
static init(editor: OnesEditor): void;
|
|
8
|
+
}
|
|
@@ -15,12 +15,15 @@ export declare const LAYOUT_BLOCK_TYPE = "layout";
|
|
|
15
15
|
* 最大分栏数
|
|
16
16
|
*/
|
|
17
17
|
export declare const MAX_LAYOUT_COLUMNS = 6;
|
|
18
|
+
/**
|
|
19
|
+
* 最小分栏数
|
|
20
|
+
*/
|
|
21
|
+
export declare const MIN_LAYOUT_COLUMNS = 2;
|
|
18
22
|
/**
|
|
19
23
|
* 分栏最小宽度,百分比
|
|
20
24
|
*/
|
|
21
25
|
export declare const MIN_LAYOUT_WIDTH_PERCENT = 0.08;
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const DROP_EMBED_BLOCK_TYPE_WHITE_LIST: string[];
|
|
26
|
+
export declare const DROP_BLOCK_TYPE_BLACK_LIST: string[];
|
|
24
27
|
/**
|
|
25
28
|
* custom dom
|
|
26
29
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor, InsertEmptyBlockOptions, BlockPathComponent, DocBlock } from '../../../@ones-editor/core';
|
|
2
2
|
export declare function handleInsertEmptyBlock(editor: OnesEditor, options: InsertEmptyBlockOptions): Promise<BlockElement>;
|
|
3
|
-
export declare function createLayout(editor: OnesEditor, col: number | (BlockElement | DocBlock)[], path: BlockPathComponent): BlockElement;
|
|
3
|
+
export declare function createLayout(editor: OnesEditor, col: number | (BlockElement | DocBlock)[], path: BlockPathComponent, dataOverriding?: (DocBlock | undefined)[]): BlockElement;
|
|
4
4
|
export declare function selectContainer(editor: OnesEditor, layoutBlockElement: BlockElement, startContainerID: string, endContainerID?: string): void;
|
|
5
5
|
export declare function reorderColumns(editor: OnesEditor, layoutBlock: BlockElement, sourceContainerID: string, position: number): void;
|
|
6
6
|
export declare function combineLayoutBlock(editor: OnesEditor, from: BlockElement, to: BlockElement, position?: number): void;
|
|
@@ -16,7 +16,6 @@ export declare class OnesEditorCustomLayoutDragHandler implements OnesEditorCust
|
|
|
16
16
|
get draggingContainerIndex(): number | undefined;
|
|
17
17
|
constructor(editor: OnesEditor);
|
|
18
18
|
destroy(): void;
|
|
19
|
-
private changeDraggingStatus;
|
|
20
19
|
private handleMouseDown;
|
|
21
20
|
private previewShouldScale;
|
|
22
21
|
private initContainerPreview;
|
|
@@ -11,21 +11,3 @@ export type LayoutDropData = {
|
|
|
11
11
|
export interface CreateLayoutData {
|
|
12
12
|
colCount?: number;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated
|
|
16
|
-
*/
|
|
17
|
-
export declare const COMMANDS: readonly [{
|
|
18
|
-
readonly id: "column-2";
|
|
19
|
-
readonly name: "2 columns";
|
|
20
|
-
}, {
|
|
21
|
-
readonly id: "column-3";
|
|
22
|
-
readonly name: "3 columns";
|
|
23
|
-
}, {
|
|
24
|
-
readonly id: "column-4";
|
|
25
|
-
readonly name: "4 columns";
|
|
26
|
-
}, {
|
|
27
|
-
readonly id: "add-column";
|
|
28
|
-
readonly name: "AddColumn";
|
|
29
|
-
}];
|
|
30
|
-
export type CommandID = (typeof COMMANDS)[number]['id'];
|
|
31
|
-
export declare function getColumnLengthByType(type: string): number;
|