@ones-editor/editor 1.1.20-beta.4 → 1.1.20-beta.5
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-button/index.d.ts +15 -5
- package/@ones-editor/core/src/core/types.d.ts +2 -26
- package/@ones-editor/drop-target/src/drop-indicator.d.ts +2 -3
- package/@ones-editor/drop-target/src/drop-target.d.ts +1 -2
- package/@ones-editor/drop-target/src/find-drop-target.d.ts +1 -1
- package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +4 -1
- package/@ones-editor/to-docx/src/doc2other/core.d.ts +0 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/quick-menu/index.d.ts +0 -4
- package/@ones-editor/ui-base/src/icons/index.d.ts +1 -3
- package/@ones-editor/ui-base/src/popup/popup.d.ts +0 -1
- package/dist/index.js +77696 -851
- package/package.json +1 -1
- package/@ones-editor/block-menu/src/block-menu-button/menu-button/index.d.ts +0 -32
- package/@ones-editor/layout-block/package.json +0 -8
- package/@ones-editor/layout-block/src/block-drop.d.ts +0 -3
- package/@ones-editor/layout-block/src/child-containers.d.ts +0 -3
- package/@ones-editor/layout-block/src/column-resizer/index.d.ts +0 -2
- package/@ones-editor/layout-block/src/columns-options.d.ts +0 -2
- package/@ones-editor/layout-block/src/constants.d.ts +0 -28
- package/@ones-editor/layout-block/src/index.d.ts +0 -4
- package/@ones-editor/layout-block/src/layout-creator/index.d.ts +0 -27
- package/@ones-editor/layout-block/src/layout-operations.d.ts +0 -11
- package/@ones-editor/layout-block/src/locale/en-us.d.ts +0 -7
- package/@ones-editor/layout-block/src/locale/index.d.ts +0 -1
- package/@ones-editor/layout-block/src/locale/ja-jp.d.ts +0 -7
- package/@ones-editor/layout-block/src/locale/zh-cn.d.ts +0 -7
- package/@ones-editor/layout-block/src/percent-bar.d.ts +0 -3
- package/@ones-editor/layout-block/src/selection.d.ts +0 -5
- package/@ones-editor/layout-block/src/toolbar.d.ts +0 -35
- package/@ones-editor/layout-block/src/types.d.ts +0 -31
- package/@ones-editor/to-docx/src/doc2other/layout.d.ts +0 -10
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import EmptyBlockMenu from '../empty-block-menu';
|
|
3
|
+
import BlockMenu from '../block-menu';
|
|
4
|
+
export default class OnesEditorBlockMenuButton {
|
|
4
5
|
private editor;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
buttonElement: HTMLButtonElement;
|
|
7
|
+
emptyBlockMenu: EmptyBlockMenu;
|
|
8
|
+
blockMenu: BlockMenu;
|
|
9
|
+
private dragHandler;
|
|
7
10
|
constructor(editor: OnesEditor);
|
|
8
11
|
destroy(): void;
|
|
12
|
+
handleHoverBlock: (hoverBlock: BlockElement | null, oldBlock: BlockElement | null, event: MouseEvent) => void;
|
|
13
|
+
handleButtonClick: () => void;
|
|
14
|
+
updatePlaceholder: (block: BlockElement) => void;
|
|
15
|
+
handleChanged: () => void;
|
|
16
|
+
createButton(): HTMLButtonElement;
|
|
17
|
+
setButtonType(type: 'move' | 'insert'): void;
|
|
18
|
+
updateButton(block: BlockElement): void;
|
|
9
19
|
}
|
|
@@ -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';
|
|
@@ -148,7 +147,6 @@ export interface CommandItem {
|
|
|
148
147
|
hideGroupItem?: boolean;
|
|
149
148
|
setCloseable?: (closeable: Closeable) => void;
|
|
150
149
|
beforePopup?: (parent: unknown) => void;
|
|
151
|
-
shouldShown?: (currentBlock: BlockElement) => boolean;
|
|
152
150
|
}
|
|
153
151
|
export interface BlockCommandItem extends CommandItem {
|
|
154
152
|
blockId: string;
|
|
@@ -174,25 +172,10 @@ export interface BlockProperties {
|
|
|
174
172
|
blockCommands?: Record<string, BlockCommands>;
|
|
175
173
|
abstract?: string;
|
|
176
174
|
}
|
|
177
|
-
export interface CombineToCreateOptions {
|
|
178
|
-
/**
|
|
179
|
-
* @returns sideway 两侧合并(左右 indicator),body 中间合并(target block 激活)(暂未实现)
|
|
180
|
-
*/
|
|
181
|
-
combinable: (source: BlockElement, target: BlockElement) => undefined | 'sideway' | 'body';
|
|
182
|
-
onCombine: (editor: OnesEditor, source: BlockElement, target: BlockElement, position: CombineDropInsertPos['pos'], dragObject: DragObject | null) => BlockElement | undefined;
|
|
183
|
-
}
|
|
184
175
|
export interface BlockOptions {
|
|
185
176
|
name: string;
|
|
186
177
|
insertBlockCommandItems?: CommandItem[];
|
|
187
178
|
handleInsertEmptyBlock?: (editor: OnesEditor, options: InsertEmptyBlockOptions) => Promise<BlockElement | null>;
|
|
188
|
-
/**
|
|
189
|
-
* 当前 hover 的元素是否可以展示左侧更多按钮
|
|
190
|
-
* @param editor 编辑器实例
|
|
191
|
-
* @param hoverBlock hover 元素
|
|
192
|
-
* @returns true -> 展示,false -> 不展示
|
|
193
|
-
*/
|
|
194
|
-
contentMenuBtnShouldShown?: (editor: OnesEditor, hoverBlock: BlockElement) => boolean;
|
|
195
|
-
combineToCreate?: CombineToCreateOptions;
|
|
196
179
|
}
|
|
197
180
|
export interface StandardDragObject {
|
|
198
181
|
type: 'block';
|
|
@@ -210,17 +193,10 @@ export interface CustomDragObject {
|
|
|
210
193
|
}
|
|
211
194
|
export type DragObject = StandardDragObject | CustomDragObject;
|
|
212
195
|
export interface CustomDropInsertPos {
|
|
213
|
-
type: 'custom';
|
|
214
196
|
rect: DOMRect;
|
|
215
197
|
data: unknown;
|
|
216
|
-
targetBlock?: BlockElement;
|
|
217
198
|
}
|
|
218
|
-
export type
|
|
219
|
-
type: 'combine';
|
|
220
|
-
pos: 'left' | 'right';
|
|
221
|
-
onCombine: CombineToCreateOptions['onCombine'];
|
|
222
|
-
};
|
|
223
|
-
export type DropInsertPos = 'before' | 'after' | CombineDropInsertPos | CustomDropInsertPos;
|
|
199
|
+
export type DropInsertPos = 'before' | 'after' | CustomDropInsertPos;
|
|
224
200
|
export interface DropOptions {
|
|
225
201
|
isSourceBlock: boolean;
|
|
226
202
|
targetBlock: BlockElement;
|
|
@@ -550,7 +526,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
550
526
|
clearSelectedContents: () => void;
|
|
551
527
|
insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange, options?: InsertBlockOptions) => BlockElement;
|
|
552
528
|
insertEmbed: (containerId: string, blockIndex: number, embedType: string, embedData: DocEmbedData, newRange?: OnesEditorDocRange, attributes?: DocBlockAttributes) => BlockElement;
|
|
553
|
-
deleteBlock: (block: BlockElement, newRange?: OnesEditorDocRange
|
|
529
|
+
deleteBlock: (block: BlockElement, newRange?: OnesEditorDocRange) => void;
|
|
554
530
|
getTextPosition: () => BlockTextPosition;
|
|
555
531
|
getBlockString: (block: BlockElement, options?: {
|
|
556
532
|
boxReplacement: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockElement, DropInsertPos, OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
export declare const INDICATOR_SIZE = 2;
|
|
3
3
|
interface DropTarget {
|
|
4
4
|
block: BlockElement;
|
|
@@ -9,10 +9,9 @@ export default class DropIndicator {
|
|
|
9
9
|
private indicator;
|
|
10
10
|
target: DropTarget | null;
|
|
11
11
|
constructor(editor: OnesEditor);
|
|
12
|
-
createIndicator(): void;
|
|
13
12
|
show(block: BlockElement, insertPos: DropInsertPos): void;
|
|
14
13
|
hide(): void;
|
|
15
14
|
private getIndicatorRect;
|
|
16
|
-
getViewRect(block: BlockElement
|
|
15
|
+
getViewRect(block: BlockElement): DOMRect;
|
|
17
16
|
}
|
|
18
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlockElement,
|
|
1
|
+
import { BlockElement, ContainerElement, OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
import DropIndicator from './drop-indicator';
|
|
3
3
|
export interface DropHandler {
|
|
4
4
|
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
|
|
@@ -12,7 +12,6 @@ export default class OnesEditorDropTarget {
|
|
|
12
12
|
dropEffect: 'move' | 'none';
|
|
13
13
|
} | undefined;
|
|
14
14
|
handlers: DropHandler[];
|
|
15
|
-
combineToCreate: CombineToCreateOptions[];
|
|
16
15
|
constructor(editor: OnesEditor);
|
|
17
16
|
destroy(): void;
|
|
18
17
|
addHandler(handler: DropHandler): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../@ones-editor/core';
|
|
2
|
-
export declare function findTargetBlock(editor: OnesEditor, x
|
|
2
|
+
export declare function findTargetBlock(editor: OnesEditor, x: number, y: number): BlockElement | null;
|
|
3
3
|
export declare function canInsertAsSibling(editor: OnesEditor, block: BlockElement): boolean;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { BlockElement, DragObject, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
2
|
import { ImageDragInsertPos } from './types';
|
|
3
|
-
export declare function getDragInsertPos(editor: OnesEditor, block: BlockElement, images: HTMLElement[], x: number, y?: number):
|
|
3
|
+
export declare function getDragInsertPos(editor: OnesEditor, block: BlockElement, images: HTMLElement[], x: number, y?: number): {
|
|
4
|
+
rect: DOMRect;
|
|
5
|
+
data: number;
|
|
6
|
+
};
|
|
4
7
|
export declare function handleDropOver(editor: OnesEditor, block: BlockElement, dragObject: DragObject | DataTransferItemList | null, x: number, y: number): ImageDragInsertPos | undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DocBlock, DocObject } from '../../../../@ones-editor/core';
|
|
2
2
|
import { CalcCell } from './table';
|
|
3
|
-
import { CalcCol } from './layout';
|
|
4
3
|
import { BlockObject, CodeObject, ExportState, GetDocByBlockFunc, GetTextsByBoxFunc, MD5Func } from './types';
|
|
5
4
|
/**
|
|
6
5
|
* 生成docx/html blocks的接口
|
|
@@ -21,7 +20,6 @@ export interface BlocksGenerator {
|
|
|
21
20
|
addTableMatrix(colsWidth: number[], matrix: CalcCell[][], data: DocObject): Promise<void>;
|
|
22
21
|
addVirtualBlock(blockId: string, data: DocObject, maxWidth: number): Promise<void>;
|
|
23
22
|
addEmptyParagraph(): void;
|
|
24
|
-
addLayoutMatrix(colsWidth: number[], matrix: CalcCol[], data: DocObject): Promise<void>;
|
|
25
23
|
}
|
|
26
24
|
export declare function convertBlocksOfDoc(parent: string, // 父节点,暂时只有list block需要这个
|
|
27
25
|
blocks: DocBlock[], data: DocObject, // 协作笔记里的block数组
|