@ones-editor/editor 2.0.8-beta.1 → 2.1.0-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/block-menu/src/block-menu-button/drag-preview/element-to-data-url.d.ts +1 -1
- package/@ones-editor/block-menu/src/block-menu-button/index.d.ts +4 -15
- package/@ones-editor/block-menu/src/block-menu-button/menu-button/index.d.ts +23 -0
- package/@ones-editor/callout-block/package.json +11 -0
- package/@ones-editor/callout-block/src/callout-block/callout-block-content.d.ts +3 -0
- package/@ones-editor/callout-block/src/callout-block/callout-block-doc.d.ts +2 -0
- package/@ones-editor/callout-block/src/callout-block/callout-block.d.ts +3 -0
- package/@ones-editor/callout-block/src/callout-block/callout-converter-interceptor.d.ts +8 -0
- package/@ones-editor/callout-block/src/callout-block/callout-input-handler.d.ts +11 -0
- package/@ones-editor/callout-block/src/callout-block/callout-last-callout-payload.d.ts +9 -0
- package/@ones-editor/callout-block/src/callout-block/callout-options.d.ts +2 -0
- package/@ones-editor/callout-block/src/callout-block/callout-properties.d.ts +2 -0
- package/@ones-editor/callout-block/src/callout-block/callout-quick-menu-item-filter.d.ts +7 -0
- package/@ones-editor/callout-block/src/callout-block/command-items/bg-color-item.d.ts +22 -0
- package/@ones-editor/callout-block/src/callout-block/command-items/delete-icon-item.d.ts +4 -0
- package/@ones-editor/callout-block/src/callout-block/command-items/preset-item.d.ts +16 -0
- package/@ones-editor/callout-block/src/callout-block/converter.d.ts +3 -0
- package/@ones-editor/callout-block/src/callout-block/helper.d.ts +4 -0
- package/@ones-editor/callout-block/src/callout-block/index.d.ts +1 -0
- package/@ones-editor/callout-block/src/callout-block/types.d.ts +9 -0
- package/@ones-editor/callout-block/src/index.d.ts +3 -0
- package/@ones-editor/callout-block/src/locale/en-us.d.ts +12 -0
- package/@ones-editor/callout-block/src/locale/index.d.ts +1 -0
- package/@ones-editor/callout-block/src/locale/ja-jp.d.ts +12 -0
- package/@ones-editor/callout-block/src/locale/zh-cn.d.ts +12 -0
- package/@ones-editor/comments/src/text-comments/comments-command-provider.d.ts +4 -3
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +1 -0
- package/@ones-editor/core/src/core/blocks/common/block-wrapper.d.ts +2 -1
- package/@ones-editor/core/src/core/blocks/common/execute-block-command.d.ts +2 -2
- package/@ones-editor/core/src/core/blocks/common/insert-empty-block.d.ts +3 -2
- package/@ones-editor/core/src/core/blocks/embed-blocks/embed-block/common.d.ts +1 -0
- package/@ones-editor/core/src/core/blocks/embed-blocks/embed-block/index.d.ts +1 -0
- package/@ones-editor/core/src/core/command-providers/commands/index.d.ts +2 -0
- package/@ones-editor/core/src/core/command-providers/commands/inject-source.d.ts +3 -0
- package/@ones-editor/core/src/core/command-providers/commands/merge-commands.d.ts +3 -0
- package/@ones-editor/core/src/core/command-providers/commands/range-commands.d.ts +3 -3
- package/@ones-editor/core/src/core/command-providers/editor-command-providers.d.ts +4 -3
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +3 -3
- package/@ones-editor/core/src/core/containers/children.d.ts +5 -2
- package/@ones-editor/core/src/core/containers/element.d.ts +1 -0
- package/@ones-editor/core/src/core/doc/container.d.ts +2 -2
- package/@ones-editor/core/src/core/doc/doc.d.ts +1 -1
- package/@ones-editor/core/src/core/editor/actions/insert-doc/insert-doc.d.ts +1 -1
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +1 -1
- package/@ones-editor/core/src/core/editor-doc/handle-block-data-changed.d.ts +2 -1
- package/@ones-editor/core/src/core/types.d.ts +82 -25
- package/@ones-editor/core/src/core/undo-manager/undo-manager.d.ts +2 -0
- package/@ones-editor/core/src/helper/hovering-block.d.ts +3 -1
- package/@ones-editor/core/src/i18n/en-us.d.ts +1 -0
- package/@ones-editor/core/src/i18n/i18n.d.ts +3 -0
- package/@ones-editor/core/src/i18n/ja-jp.d.ts +1 -0
- package/@ones-editor/core/src/i18n/zh-cn.d.ts +1 -0
- package/@ones-editor/core/src/utils/clipboard.d.ts +6 -4
- package/@ones-editor/core/src/utils/data-url.d.ts +1 -0
- package/@ones-editor/drop-target/src/drop-indicator.d.ts +5 -4
- package/@ones-editor/drop-target/src/drop-target.d.ts +2 -1
- package/@ones-editor/drop-target/src/find-drop-target.d.ts +1 -1
- package/@ones-editor/drop-target/src/index.d.ts +2 -1
- package/@ones-editor/embed-block-helper/src/block-resizer/index.d.ts +2 -0
- package/@ones-editor/file/src/file-embed/card/index.d.ts +1 -1
- package/@ones-editor/file/src/types.d.ts +1 -0
- package/@ones-editor/graph-embed/src/config/index.d.ts +1 -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/heading-collapse/src/heading-collapse-button/heading-utils.d.ts +2 -1
- package/@ones-editor/heading-collapse/src/index.d.ts +1 -0
- package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +1 -4
- package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +3 -2
- package/@ones-editor/image-embed/src/hovering-toolbar/index.d.ts +22 -0
- package/@ones-editor/image-embed/src/image-dom/download-image.d.ts +2 -0
- package/@ones-editor/image-embed/src/image-object.d.ts +3 -0
- package/@ones-editor/image-embed/src/index.d.ts +5 -1
- package/@ones-editor/image-embed/src/types.d.ts +1 -0
- package/@ones-editor/input-handlers/src/index.d.ts +4 -1
- package/@ones-editor/input-handlers/src/markdown-shortcuts/converter-interceptors.d.ts +12 -0
- package/@ones-editor/input-handlers/src/markdown-shortcuts/match-block-convert.d.ts +9 -1
- package/@ones-editor/{column-block → layout-block}/package.json +1 -1
- package/@ones-editor/layout-block/src/block-drop.d.ts +3 -0
- package/@ones-editor/layout-block/src/caption.d.ts +8 -0
- package/@ones-editor/layout-block/src/child-containers.d.ts +3 -0
- package/@ones-editor/layout-block/src/column-resizer/index.d.ts +2 -0
- package/@ones-editor/layout-block/src/command-filter.d.ts +7 -0
- package/@ones-editor/layout-block/src/constants.d.ts +32 -0
- package/@ones-editor/layout-block/src/index.d.ts +6 -0
- package/@ones-editor/layout-block/src/layout-creator/index.d.ts +27 -0
- package/@ones-editor/layout-block/src/layout-operations.d.ts +11 -0
- package/@ones-editor/layout-block/src/locale/en-us.d.ts +10 -0
- package/@ones-editor/layout-block/src/locale/index.d.ts +1 -0
- package/@ones-editor/layout-block/src/locale/ja-jp.d.ts +10 -0
- package/@ones-editor/layout-block/src/locale/zh-cn.d.ts +10 -0
- package/@ones-editor/layout-block/src/options.d.ts +2 -0
- package/@ones-editor/layout-block/src/percent-bar.d.ts +3 -0
- package/@ones-editor/layout-block/src/selection.d.ts +5 -0
- package/@ones-editor/layout-block/src/toolbar.d.ts +33 -0
- package/@ones-editor/layout-block/src/types.d.ts +17 -0
- package/@ones-editor/layout-block/src/utils.d.ts +6 -0
- package/@ones-editor/media-embed/src/core/hovering-toolbar/index.d.ts +22 -0
- package/@ones-editor/misc/src/image.d.ts +2 -1
- package/@ones-editor/misc/src/re-auth/index.d.ts +7 -2
- package/@ones-editor/misc/src/re-auth/locale/en-us.d.ts +1 -0
- package/@ones-editor/misc/src/re-auth/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/misc/src/re-auth/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/misc/src/re-auth/ui/toolbar.d.ts +2 -0
- package/@ones-editor/paste-special/src/paste-special-handler.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +2 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +1 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +1 -1
- package/@ones-editor/table-block/src/commands/table-block-commands.d.ts +4 -3
- package/@ones-editor/table-block/src/index.d.ts +1 -0
- package/@ones-editor/table-block/src/table-block/doc-table-grid.d.ts +1 -0
- package/@ones-editor/table-block/src/table-block/table-creator/index.d.ts +1 -1
- package/@ones-editor/table-block/src/table-block/table-grid.d.ts +1 -0
- package/@ones-editor/text-commands/src/text-command-provider.d.ts +4 -3
- package/@ones-editor/text-commands/src/text-commands.d.ts +3 -3
- package/@ones-editor/to-docx/src/doc2other/colors.d.ts +7 -1
- package/@ones-editor/to-docx/src/doc2other/core.d.ts +2 -0
- package/@ones-editor/to-docx/src/doc2other/layout.d.ts +10 -0
- package/@ones-editor/toc/src/build-toc.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/block-menu/block-command-providers.d.ts +10 -0
- package/@ones-editor/{block-menu → ui}/src/block-menu/index.d.ts +3 -1
- package/@ones-editor/ui/src/index.d.ts +7 -7
- package/@ones-editor/ui/src/providers/abstract-providers.d.ts +19 -0
- package/@ones-editor/ui/src/providers/align-dropdown.d.ts +10 -0
- package/@ones-editor/ui/src/{toolbar/commands → providers}/align.d.ts +4 -4
- package/@ones-editor/ui/src/providers/block-hook-provider.d.ts +16 -0
- package/@ones-editor/ui/src/providers/heading.d.ts +13 -0
- package/@ones-editor/ui/src/providers/insert-above.d.ts +9 -0
- package/@ones-editor/ui/src/providers/insert-after.d.ts +9 -0
- package/@ones-editor/ui/src/providers/insert-box-provider.d.ts +12 -0
- package/@ones-editor/ui/src/providers/insert-group.d.ts +7 -0
- package/@ones-editor/ui/src/providers/insert-menu.d.ts +16 -0
- package/@ones-editor/ui/src/providers/link.d.ts +17 -0
- package/@ones-editor/ui/src/providers/list.d.ts +13 -0
- package/@ones-editor/ui/src/providers/paragraph.d.ts +8 -0
- package/@ones-editor/ui/src/providers/proxy-provider.d.ts +9 -0
- package/@ones-editor/ui/src/providers/quoted.d.ts +10 -0
- package/@ones-editor/ui/src/providers/text-fixed-provider.d.ts +16 -0
- package/@ones-editor/ui/src/providers/text-styles.d.ts +9 -0
- package/@ones-editor/ui/src/providers/turn-into.d.ts +9 -0
- package/@ones-editor/ui/src/providers/utils/add-section.d.ts +2 -0
- package/@ones-editor/ui/src/{quick-menu → providers/utils}/basic-commands.d.ts +1 -2
- package/@ones-editor/ui/src/providers/utils/inject-block-options.d.ts +5 -0
- package/@ones-editor/ui/src/quick-menu/index.d.ts +5 -10
- package/@ones-editor/ui/src/quick-menu/quick-command-providers.d.ts +10 -0
- package/@ones-editor/ui/src/quick-menu/types.d.ts +1 -0
- package/@ones-editor/ui/src/toolbar/text-commands.d.ts +2 -2
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +2 -0
- package/@ones-editor/ui-base/src/color-palette/color-palette.d.ts +2 -1
- package/@ones-editor/ui-base/src/color-palette/create-palette.d.ts +8 -0
- package/@ones-editor/ui-base/src/color-palette/index.d.ts +2 -2
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +2 -2
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +2 -0
- package/@ones-editor/ui-base/src/emoji-item/emoji-item.d.ts +19 -0
- package/@ones-editor/ui-base/src/emoji-item/index.d.ts +2 -0
- package/@ones-editor/ui-base/src/emoji-palette/emoji-content.d.ts +21 -0
- package/@ones-editor/ui-base/src/emoji-palette/emoji-data.d.ts +60 -0
- package/@ones-editor/ui-base/src/emoji-palette/emoji-navigation.d.ts +16 -0
- package/@ones-editor/ui-base/src/emoji-palette/emoji-search.d.ts +11 -0
- package/@ones-editor/ui-base/src/emoji-palette/index.d.ts +23 -0
- package/@ones-editor/ui-base/src/emoji-palette/types.d.ts +0 -0
- package/@ones-editor/ui-base/src/icons/index.d.ts +20 -1
- package/@ones-editor/ui-base/src/index.d.ts +1 -0
- package/@ones-editor/ui-base/src/input/create-input.d.ts +1 -0
- package/@ones-editor/ui-base/src/locale/en-us.d.ts +20 -0
- package/@ones-editor/ui-base/src/locale/ja-jp.d.ts +20 -0
- package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +20 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +128530 -842
- package/dist/lang/en-us.d.ts +1 -0
- package/dist/lang/ja-jp.d.ts +1 -0
- package/dist/lang/zh-cn.d.ts +1 -0
- package/dist/types.d.ts +3 -2
- package/package.json +3 -3
- package/@ones-editor/block-menu/src/block-menu/items/block-command-items.d.ts +0 -3
- package/@ones-editor/block-menu/src/block-menu/items/index.d.ts +0 -5
- package/@ones-editor/block-menu/src/block-menu/items/insert-block-items/index.d.ts +0 -5
- package/@ones-editor/block-menu/src/block-menu/items/text-styles/text-style-item.d.ts +0 -30
- package/@ones-editor/block-menu/src/block-menu/items/types.d.ts +0 -5
- package/@ones-editor/column-block/src/child-containers.d.ts +0 -2
- package/@ones-editor/column-block/src/columns-options.d.ts +0 -2
- package/@ones-editor/column-block/src/columns-properties.d.ts +0 -15
- package/@ones-editor/column-block/src/index.d.ts +0 -4
- package/@ones-editor/column-block/src/types.d.ts +0 -11
- package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +0 -16
- package/@ones-editor/ui/src/quick-menu/inline-box-items.d.ts +0 -8
- package/@ones-editor/ui/src/quick-menu/insert-empty-block.d.ts +0 -4
- package/@ones-editor/ui/src/quick-menu/order.d.ts +0 -1
- package/@ones-editor/ui/src/quick-menu/quick-menu-items.d.ts +0 -7
- package/@ones-editor/ui/src/toolbar/commands/paragraph.d.ts +0 -11
- package/@ones-editor/ui/src/toolbar/commands/turn-into.d.ts +0 -10
- package/@ones-editor/ui/src/toolbar/merge-commands.d.ts +0 -2
- /package/@ones-editor/{block-menu → ui}/src/block-menu/standard-block-actions/hook.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange, UpdateBlockOptions } from './doc';
|
|
2
|
+
import { DocBlock, DocBlockAttributes, DocBlockDelta, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange, UpdateBlockOptions } from './doc';
|
|
3
3
|
export type ContainerElement = HTMLDivElement & {
|
|
4
4
|
__neverUse: 'ContainerElement';
|
|
5
5
|
};
|
|
@@ -87,6 +87,7 @@ export interface EmbedOptions {
|
|
|
87
87
|
}
|
|
88
88
|
export interface Embed {
|
|
89
89
|
embedType: string;
|
|
90
|
+
adjustableMinHeight?: number;
|
|
90
91
|
createEmbedContent: (editor: OnesEditor, content: BlockContentElement, block: DocEmbedBlock, path: BlockPath, container: ContainerElement, blockElement: BlockElement) => void;
|
|
91
92
|
convertTo?: (editor: OnesEditor, blockData: DocEmbedBlock, doc: DocObject, type: 'text' | 'html' | 'markdown') => string;
|
|
92
93
|
getBlockProperties?: (editor: OnesEditor, block: BlockElement) => BlockProperties;
|
|
@@ -94,7 +95,7 @@ export interface Embed {
|
|
|
94
95
|
handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
|
|
95
96
|
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocEmbedBlock) => boolean;
|
|
96
97
|
handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | DataTransferItemList | null, x: number, y: number) => DropInsertPos | undefined;
|
|
97
|
-
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos:
|
|
98
|
+
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertResolvedPos, options: DropOptions) => boolean | undefined;
|
|
98
99
|
convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
|
|
99
100
|
offset: number;
|
|
100
101
|
data?: DocBlockAttributes;
|
|
@@ -147,12 +148,10 @@ export interface CommandItem {
|
|
|
147
148
|
hideGroupItem?: boolean;
|
|
148
149
|
setCloseable?: (closeable: Closeable) => void;
|
|
149
150
|
beforePopup?: (parent: unknown) => void;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
blockKind: BlockKind;
|
|
155
|
-
groupIndex: number;
|
|
151
|
+
/**
|
|
152
|
+
* defaults to true
|
|
153
|
+
*/
|
|
154
|
+
clickToClose?: boolean;
|
|
156
155
|
}
|
|
157
156
|
export type StyleType = boolean | string | number;
|
|
158
157
|
export type BlockStyles = {
|
|
@@ -172,10 +171,47 @@ export interface BlockProperties {
|
|
|
172
171
|
blockCommands?: Record<string, BlockCommands>;
|
|
173
172
|
abstract?: string;
|
|
174
173
|
}
|
|
174
|
+
export interface DropHandler {
|
|
175
|
+
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
|
|
176
|
+
}
|
|
177
|
+
export interface CombineToCreateOptions {
|
|
178
|
+
/**
|
|
179
|
+
* @returns sideway: 两侧合并(左右 indicator)
|
|
180
|
+
*
|
|
181
|
+
* body: 中间合并(target block 激活)(暂未实现)
|
|
182
|
+
*/
|
|
183
|
+
combinable: (editor: OnesEditor, source: BlockElement, target: BlockElement) => undefined | 'sideway' | 'body';
|
|
184
|
+
onCombine: (editor: OnesEditor, source: BlockElement, target: BlockElement, position: CombineDropInsertPos['pos'], dragObject: DragObject | null, handlers: DropHandler[]) => BlockElement | undefined;
|
|
185
|
+
}
|
|
186
|
+
export type ContainerBlockOverrideInsertEmptyBlockInsideOptionsDict = Record<string, ContainerBlockOverrideInsertEmptyBlockInsideOptions>;
|
|
187
|
+
export type ContainerBlockOverrideInsertEmptyBlockInsideOptions = {
|
|
188
|
+
item?: CommandItem;
|
|
189
|
+
data?: Record<string, unknown>;
|
|
190
|
+
};
|
|
175
191
|
export interface BlockOptions {
|
|
176
192
|
name: string;
|
|
177
193
|
insertBlockCommandItems?: CommandItem[];
|
|
194
|
+
overrideInertEmptyBlockInsideOptions?: ContainerBlockOverrideInsertEmptyBlockInsideOptionsDict;
|
|
178
195
|
handleInsertEmptyBlock?: (editor: OnesEditor, options: InsertEmptyBlockOptions) => Promise<BlockElement | null>;
|
|
196
|
+
isMenuButtonBaseContainer?: (container: ContainerElement) => boolean;
|
|
197
|
+
combineToCreate?: CombineToCreateOptions;
|
|
198
|
+
/**
|
|
199
|
+
* defaults to true.
|
|
200
|
+
*
|
|
201
|
+
* 'without-margin': include margin for dragging preview computing.
|
|
202
|
+
*/
|
|
203
|
+
draggingPreview?: boolean | 'margin-included';
|
|
204
|
+
innerToc?: boolean;
|
|
205
|
+
blockMenu?: {
|
|
206
|
+
showComment?: boolean;
|
|
207
|
+
showLocker?: boolean;
|
|
208
|
+
};
|
|
209
|
+
findPreviewElement?: (editor: OnesEditor, complexBlock: BlockElement) => HTMLElement;
|
|
210
|
+
headingCollapsable?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* 拖拽时,是否显示缩略图容器自带的阴影,默认为 false
|
|
213
|
+
*/
|
|
214
|
+
previewNoShadow?: boolean;
|
|
179
215
|
}
|
|
180
216
|
export interface StandardDragObject {
|
|
181
217
|
type: 'block';
|
|
@@ -193,10 +229,18 @@ export interface CustomDragObject {
|
|
|
193
229
|
}
|
|
194
230
|
export type DragObject = StandardDragObject | CustomDragObject;
|
|
195
231
|
export interface CustomDropInsertPos {
|
|
232
|
+
type: 'custom';
|
|
196
233
|
rect: DOMRect;
|
|
197
234
|
data: unknown;
|
|
235
|
+
targetBlock?: BlockElement;
|
|
198
236
|
}
|
|
199
|
-
export type
|
|
237
|
+
export type CombineDropInsertPos = {
|
|
238
|
+
type: 'combine';
|
|
239
|
+
pos: 'left' | 'right';
|
|
240
|
+
onCombine: CombineToCreateOptions['onCombine'];
|
|
241
|
+
};
|
|
242
|
+
export type DropInsertPos = 'before' | 'after' | CombineDropInsertPos | CustomDropInsertPos | 'before-container' | 'after-container';
|
|
243
|
+
export type DropInsertResolvedPos = Exclude<DropInsertPos, 'before-container' | 'after-container'>;
|
|
200
244
|
export interface DropOptions {
|
|
201
245
|
isSourceBlock: boolean;
|
|
202
246
|
targetBlock: BlockElement;
|
|
@@ -217,9 +261,9 @@ export interface Block {
|
|
|
217
261
|
handleBlockElementUpdated?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => void;
|
|
218
262
|
handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
|
|
219
263
|
handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
|
|
220
|
-
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
|
|
264
|
+
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock, delta?: DocBlockDelta) => boolean;
|
|
221
265
|
handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | DataTransferItemList | null, x: number, y: number) => DropInsertPos | false | undefined;
|
|
222
|
-
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos:
|
|
266
|
+
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertResolvedPos, options: DropOptions) => boolean | ContainerElement | undefined;
|
|
223
267
|
getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
|
|
224
268
|
getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
|
|
225
269
|
convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
|
|
@@ -230,7 +274,7 @@ export interface Block {
|
|
|
230
274
|
convertTo?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, type: 'text' | 'html' | 'markdown', path: BlockPath) => string;
|
|
231
275
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
|
|
232
276
|
getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
|
|
233
|
-
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
277
|
+
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject, cloneDocResult?: CloneBlockResultInfo) => DocObject;
|
|
234
278
|
getResources?: (editor: OnesEditor, data: DocBlock) => string[] | null;
|
|
235
279
|
replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
|
|
236
280
|
}
|
|
@@ -258,6 +302,7 @@ export interface ComplexKindBlock extends Block {
|
|
|
258
302
|
getTextToolbarReferenceClient?: (editor: OnesEditor, complexBlock: BlockElement) => DOMRect | undefined;
|
|
259
303
|
isChildContainerVisible?: (editor: OnesEditor, complexBlock: BlockElement, childContainer: ContainerElement) => boolean;
|
|
260
304
|
showChildContainer?: (editor: OnesEditor, complexBlock: BlockElement, childContainer: ContainerElement) => void;
|
|
305
|
+
beforeInsertDoc?: (editor: OnesEditor, container: ContainerElement, insertDoc: DocObject) => DocObject | undefined;
|
|
261
306
|
}
|
|
262
307
|
export interface SelectedBlock {
|
|
263
308
|
block: BlockElement;
|
|
@@ -446,7 +491,7 @@ export declare class OnesEditorCustomDataWrapper<T> {
|
|
|
446
491
|
getEditor(): OnesEditor;
|
|
447
492
|
destroy(): void;
|
|
448
493
|
}
|
|
449
|
-
export type OnesEditorCustomCreator = (editor: OnesEditor) =>
|
|
494
|
+
export type OnesEditorCustomCreator<T extends OnesEditorCustom = OnesEditorCustom> = (editor: OnesEditor) => T;
|
|
450
495
|
export interface CloneBlockResultInfo {
|
|
451
496
|
containerIdMap: Map<string, string>;
|
|
452
497
|
blockIdMap: Map<string, string>;
|
|
@@ -487,7 +532,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
487
532
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
488
533
|
version: string;
|
|
489
534
|
readonly: boolean;
|
|
490
|
-
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
|
|
535
|
+
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator<T>) => T;
|
|
491
536
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
492
537
|
replaceCustom: <T extends OnesEditorCustom>(name: string, newCustom: T) => T;
|
|
493
538
|
findCustom: <T extends OnesEditorCustom>(name: string) => T | null;
|
|
@@ -499,7 +544,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
499
544
|
createBox: (blockContent: BlockContentElement, box: DocBox) => BoxElement;
|
|
500
545
|
createInsertion: (blockContent: BlockContentElement, insertion: DocInsertion) => InsertionElement;
|
|
501
546
|
destroy: () => void;
|
|
502
|
-
focus: () => void;
|
|
547
|
+
focus: (options?: FocusOptions) => void;
|
|
503
548
|
focusToBlock: (block: BlockElement, options?: {
|
|
504
549
|
tryFocusToChildSimpleBlock?: boolean;
|
|
505
550
|
}) => void;
|
|
@@ -583,7 +628,7 @@ export type PasteOptions = {
|
|
|
583
628
|
toPlainText?: boolean;
|
|
584
629
|
};
|
|
585
630
|
export interface OnesEditorInput {
|
|
586
|
-
readonly inputElement:
|
|
631
|
+
readonly inputElement: HTMLTextAreaElement;
|
|
587
632
|
destroy: () => void;
|
|
588
633
|
focus: () => void;
|
|
589
634
|
handleDocumentSelectionChange: () => void;
|
|
@@ -658,29 +703,41 @@ export interface OnesEditorInsertions {
|
|
|
658
703
|
}
|
|
659
704
|
export type CommandParams = {
|
|
660
705
|
[index: string]: unknown;
|
|
706
|
+
} & {
|
|
707
|
+
source?: string[];
|
|
661
708
|
};
|
|
662
709
|
export type CommandResult = {
|
|
663
710
|
[index: string]: unknown;
|
|
664
711
|
};
|
|
665
712
|
export interface OnesEditorCommandProvider {
|
|
666
713
|
id: string;
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
714
|
+
groupIndex?: number;
|
|
715
|
+
getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => CommandItem[];
|
|
716
|
+
getInsertCommands?: (editor: OnesEditor, containerId: string, blockIndex: number) => CommandItem[];
|
|
717
|
+
executeInsertCommand?: (editor: OnesEditor, containerId: string, blockIndex: number, item: CommandItem, params: CommandParams, result?: CommandResult) => boolean;
|
|
718
|
+
executeRangeCommand?: (editor: OnesEditor, range: SelectionRange, command: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
|
|
719
|
+
executeCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams, result?: CommandResult) => boolean;
|
|
720
|
+
filterCommands?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, commands: CommandItemWithSource[]) => CommandItemWithSource[] | undefined;
|
|
721
|
+
beforeExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams) => boolean | undefined;
|
|
722
|
+
afterExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams, result: CommandResult) => void;
|
|
672
723
|
getEmptyBlockTextAttributes?: (editor: OnesEditor, blockId: string) => DocBlockTextAttributes | undefined;
|
|
673
|
-
executeRangeCommand?: (editor: OnesEditor, range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams, result: CommandResult) => boolean;
|
|
674
724
|
}
|
|
675
|
-
export interface
|
|
725
|
+
export interface CommandItemWithSource extends CommandItem {
|
|
676
726
|
source: string;
|
|
677
727
|
}
|
|
728
|
+
export interface CommandFilter {
|
|
729
|
+
filter: (editor: OnesEditor, range: SelectionRange, items: CommandItemWithSource[], source: string[]) => CommandItemWithSource[];
|
|
730
|
+
}
|
|
731
|
+
export type CommandFilterId = keyof any;
|
|
678
732
|
export interface OnesEditorCommandProviders {
|
|
733
|
+
commandFilters?: Map<CommandFilterId, CommandFilter>;
|
|
734
|
+
addFilter?: (id: CommandFilterId, filter: CommandFilter) => void;
|
|
735
|
+
filterItems?: (range: SelectionRange, items: CommandItemWithSource[]) => CommandItemWithSource[];
|
|
679
736
|
registerCommandProvider: (provider: OnesEditorCommandProvider) => void;
|
|
680
737
|
getCommandProviders: () => OnesEditorCommandProvider[];
|
|
681
738
|
getCommandProvider: (id: string) => OnesEditorCommandProvider;
|
|
682
|
-
getCommands: (range: SelectionRange
|
|
683
|
-
executeCommand: (range: SelectionRange, item:
|
|
739
|
+
getCommands: (range: SelectionRange) => CommandItemWithSource[];
|
|
740
|
+
executeCommand: (range: SelectionRange, item: CommandItemWithSource, params: CommandParams) => {
|
|
684
741
|
[index: string]: CommandResult;
|
|
685
742
|
};
|
|
686
743
|
getEmptyBlockTextAttributes: (editor: OnesEditor, blockId: string) => DocBlockTextAttributes | undefined;
|
|
@@ -16,6 +16,8 @@ declare class UndoManager implements OnesEditorUndoManager, EditorDocLocalAction
|
|
|
16
16
|
private endGroup;
|
|
17
17
|
hasGroup(): boolean;
|
|
18
18
|
runInGroup<T>(action: () => T): T;
|
|
19
|
+
private verifyPos;
|
|
20
|
+
private checkRange;
|
|
19
21
|
undo(): boolean;
|
|
20
22
|
redo(): boolean;
|
|
21
23
|
canUndo(): boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { TextBlockContentChild } from '../core/blocks/text-blocks/base/child';
|
|
2
|
+
import type { TextBlockContentChild } from '../core/blocks/text-blocks/base/child';
|
|
3
3
|
import { BlockElement, OnesEditor, OnesEditorCustom } from '../core/types';
|
|
4
4
|
export interface OnesEditorHoveringBlockEvents {
|
|
5
5
|
change: (block: BlockElement | null, old: BlockElement | null, event: MouseEvent) => void;
|
|
6
|
+
targetChange: (block: BlockElement | null, old: BlockElement | null, target: EventTarget | null, oldTarget: EventTarget | null) => void;
|
|
6
7
|
childChange: (block: BlockElement | null, child: TextBlockContentChild | null, old: TextBlockContentChild | null, event: MouseEvent) => void;
|
|
7
8
|
}
|
|
8
9
|
export interface OnesEditorHoveringBlockFilter extends OnesEditorCustom {
|
|
@@ -14,6 +15,7 @@ export interface OnesEditorHoveringBlockFinder extends OnesEditorCustom {
|
|
|
14
15
|
export default class OnesEditorHoveringBlock extends TypedEmitter<OnesEditorHoveringBlockEvents> {
|
|
15
16
|
private editor;
|
|
16
17
|
private hoveringBlock;
|
|
18
|
+
private hoveringElem;
|
|
17
19
|
private hoveringTextChild;
|
|
18
20
|
private filters;
|
|
19
21
|
private finders;
|
|
@@ -14,6 +14,7 @@ declare const langs: {
|
|
|
14
14
|
};
|
|
15
15
|
common: {
|
|
16
16
|
cancel: string;
|
|
17
|
+
downloadAsImage: string;
|
|
17
18
|
};
|
|
18
19
|
docx: {
|
|
19
20
|
imageExportFailed: string;
|
|
@@ -33,6 +34,7 @@ declare const langs: {
|
|
|
33
34
|
};
|
|
34
35
|
common: {
|
|
35
36
|
cancel: string;
|
|
37
|
+
downloadAsImage: string;
|
|
36
38
|
};
|
|
37
39
|
docx: {
|
|
38
40
|
imageExportFailed: string;
|
|
@@ -52,6 +54,7 @@ declare const langs: {
|
|
|
52
54
|
};
|
|
53
55
|
common: {
|
|
54
56
|
cancel: string;
|
|
57
|
+
downloadAsImage: string;
|
|
55
58
|
};
|
|
56
59
|
docx: {
|
|
57
60
|
imageExportFailed: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
type ClipboardItemData = {
|
|
2
|
+
type: string;
|
|
3
|
+
data: string | Blob;
|
|
4
|
+
};
|
|
1
5
|
export declare function setClipboardDataByEvent(items: {
|
|
2
6
|
type: string;
|
|
3
7
|
data: string;
|
|
4
8
|
}[], event: ClipboardEvent): Promise<boolean>;
|
|
5
|
-
export declare function setClipboardData(items:
|
|
6
|
-
|
|
7
|
-
data: string | Blob;
|
|
8
|
-
}[]): Promise<boolean>;
|
|
9
|
+
export declare function setClipboardData(items: ClipboardItemData[]): Promise<boolean>;
|
|
10
|
+
export {};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { BlockElement,
|
|
1
|
+
import { BlockContentElement, BlockElement, DropInsertResolvedPos, OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
export declare const INDICATOR_SIZE = 2;
|
|
3
3
|
interface DropTarget {
|
|
4
4
|
block: BlockElement;
|
|
5
|
-
insertPos:
|
|
5
|
+
insertPos: DropInsertResolvedPos;
|
|
6
6
|
}
|
|
7
7
|
export default class DropIndicator {
|
|
8
8
|
private editor;
|
|
9
9
|
private indicator;
|
|
10
10
|
target: DropTarget | null;
|
|
11
11
|
constructor(editor: OnesEditor);
|
|
12
|
-
|
|
12
|
+
createIndicator(): void;
|
|
13
|
+
show(block: BlockElement, insertPos: DropInsertResolvedPos): void;
|
|
13
14
|
hide(): void;
|
|
14
15
|
private getIndicatorRect;
|
|
15
|
-
getViewRect(block: BlockElement): DOMRect;
|
|
16
|
+
getViewRect(block: BlockElement | BlockContentElement): DOMRect;
|
|
16
17
|
}
|
|
17
18
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlockElement, ContainerElement, OnesEditor } from '../../../@ones-editor/core';
|
|
1
|
+
import { BlockElement, CombineToCreateOptions, 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,6 +12,7 @@ export default class OnesEditorDropTarget {
|
|
|
12
12
|
dropEffect: 'move' | 'none';
|
|
13
13
|
} | undefined;
|
|
14
14
|
handlers: DropHandler[];
|
|
15
|
+
combineToCreate: CombineToCreateOptions[];
|
|
15
16
|
constructor(editor: OnesEditor);
|
|
16
17
|
destroy(): void;
|
|
17
18
|
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,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 };
|
|
@@ -2,8 +2,10 @@ import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
|
|
|
2
2
|
import { BlockResizer } from '../../../../@ones-editor/block-resizer';
|
|
3
3
|
export declare class EmbedBlockResizer {
|
|
4
4
|
private editor;
|
|
5
|
+
private resizing;
|
|
5
6
|
blockResizer: BlockResizer;
|
|
6
7
|
constructor(editor: OnesEditor);
|
|
8
|
+
handleResized: () => void;
|
|
7
9
|
handleResizing: (resizer: BlockResizer, rect: DOMRect) => void;
|
|
8
10
|
destroy(): void;
|
|
9
11
|
handleHoveringBlockChange: (block: BlockElement | null, old: BlockElement | null) => void;
|
|
@@ -2,5 +2,5 @@ import { OnesEditor, BlockContentElement } from '../../../../../@ones-editor/cor
|
|
|
2
2
|
import { FileEmbedData } from '../../types';
|
|
3
3
|
export declare function renderFileCard(editor: OnesEditor, content: BlockContentElement, data: FileEmbedData): Promise<{
|
|
4
4
|
card: HTMLDivElement;
|
|
5
|
-
downloadButton:
|
|
5
|
+
downloadButton: HTMLElement | undefined;
|
|
6
6
|
}>;
|
|
@@ -18,6 +18,7 @@ export interface FileEmbedData extends DocEmbedData, FileData {
|
|
|
18
18
|
}
|
|
19
19
|
export interface FileOptions {
|
|
20
20
|
onClick?: (editor: OnesEditor, elem: BlockElement | BoxElement, event: MouseEvent) => void;
|
|
21
|
+
canDownload?: boolean;
|
|
21
22
|
onDownloadFile?: (editor: OnesEditor, data: FileData | FileBoxData, source: 'embed' | 'box') => void;
|
|
22
23
|
renderFileCardIcon?: (editor: OnesEditor, blockData: FileEmbedData) => Promise<false | HTMLImageElement>;
|
|
23
24
|
onGetFileDownloadUrl?: (editor: OnesEditor, data: FileBoxData | FileEmbedData) => Promise<string | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
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";
|
|
4
|
+
export declare const GRAPH_MIN_HEIGHT = 200;
|
|
@@ -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,2 +1,3 @@
|
|
|
1
|
-
import { BlockElement } from '../../../../@ones-editor/core';
|
|
1
|
+
import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
2
|
export declare function isTitleBlock(block: BlockElement): boolean;
|
|
3
|
+
export declare function canShowCollapseButtons(editor: OnesEditor, hoverBlock: BlockElement | null): boolean;
|
|
@@ -1,7 +1,4 @@
|
|
|
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):
|
|
4
|
-
rect: DOMRect;
|
|
5
|
-
data: number;
|
|
6
|
-
};
|
|
3
|
+
export declare function getDragInsertPos(editor: OnesEditor, block: BlockElement, images: HTMLElement[], x: number, y?: number): ImageDragInsertPos;
|
|
7
4
|
export declare function handleDropOver(editor: OnesEditor, block: BlockElement, dragObject: DragObject | DataTransferItemList | null, x: number, y: number): ImageDragInsertPos | undefined;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { BlockElement, DragObject,
|
|
2
|
-
export declare function
|
|
1
|
+
import { BlockElement, DragObject, DropInsertResolvedPos, DropOptions, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
export declare function deleteImageFromBlock(editor: OnesEditor, block: BlockElement, index: number): void;
|
|
3
|
+
export declare function handleDrop(editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertResolvedPos, options: DropOptions): boolean | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BlockCommands, BlockElement, CommandItem, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { CommandItemType } from '../../../../@ones-editor/core';
|
|
3
|
+
export default class ImageHoveringToolbarCommands implements BlockCommands {
|
|
4
|
+
protected editor: OnesEditor;
|
|
5
|
+
protected block: BlockElement;
|
|
6
|
+
group: string;
|
|
7
|
+
constructor(editor: OnesEditor, block: BlockElement);
|
|
8
|
+
_commands: ({
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
type?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
type: CommandItemType;
|
|
17
|
+
icon?: undefined;
|
|
18
|
+
})[];
|
|
19
|
+
private createIconItem;
|
|
20
|
+
get commands(): CommandItem[];
|
|
21
|
+
executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
|
|
22
|
+
}
|
|
@@ -10,6 +10,9 @@ export declare class ImageObject implements ImageObjectBase {
|
|
|
10
10
|
private resizing;
|
|
11
11
|
private parentContainerResizerObserver;
|
|
12
12
|
private autoFix;
|
|
13
|
+
focusTimes: number;
|
|
14
|
+
mouseStartX: number;
|
|
15
|
+
mouseStartY: number;
|
|
13
16
|
constructor(editor: OnesEditor, blockData: DocEmbedBlock);
|
|
14
17
|
destroy(): void;
|
|
15
18
|
setAutoFix(autoFix: boolean): void;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { Embed } from '../../../@ones-editor/core';
|
|
2
|
+
import { toImageEmbedData } from './image-data';
|
|
2
3
|
import { ImageObject } from './image-object';
|
|
3
4
|
import './image-embed-style.scss';
|
|
5
|
+
import { deleteImageFromBlock } from './drag-drop/handle-drop';
|
|
4
6
|
import './locale';
|
|
5
7
|
import { getImageContainersByBlock } from './image-dom/helper';
|
|
6
8
|
import EmptyImageConverterInputHandler from './empty-image-converter';
|
|
7
9
|
import { ImagePasteHandler } from './paste-handler';
|
|
10
|
+
import type { ImageDragObject } from './drag-drop/types';
|
|
11
|
+
import { updateImageBlockSize } from './image-size';
|
|
8
12
|
export * from './shortcuts';
|
|
9
13
|
export * from './types';
|
|
10
|
-
export { ImageObject, ImagePasteHandler, getImageContainersByBlock };
|
|
14
|
+
export { ImageObject, ImagePasteHandler, getImageContainersByBlock, toImageEmbedData, deleteImageFromBlock, ImageDragObject, updateImageBlockSize };
|
|
11
15
|
declare const ImageEmbed: Embed;
|
|
12
16
|
export { ImageEmbed, EmptyImageConverterInputHandler };
|
|
@@ -1,4 +1,7 @@
|
|
|
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';
|
|
2
5
|
import './i18n';
|
|
3
6
|
export * from './enforce-with-document-title';
|
|
4
|
-
export { MarkdownInputHandler, converterIntercept };
|
|
7
|
+
export { MarkdownInputHandler, converterIntercept, ConverterInterceptor, MarkdownConverterInterceptors, BlockConverter };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BlockElement, OnesEditor, OnesEditorCustom } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { BlockConverter } from './match-block-convert';
|
|
3
|
+
export interface ConverterInterceptor {
|
|
4
|
+
handler: (editor: OnesEditor, block: BlockElement, converter: BlockConverter) => boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class MarkdownConverterInterceptors implements OnesEditorCustom {
|
|
7
|
+
private interceptors;
|
|
8
|
+
addInterceptor(interceptor: ConverterInterceptor): void;
|
|
9
|
+
runInterceptors(editor: OnesEditor, block: BlockElement, converter: BlockConverter): boolean;
|
|
10
|
+
destroy(): void;
|
|
11
|
+
static get(editor: OnesEditor): MarkdownConverterInterceptors;
|
|
12
|
+
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
1
|
+
import { DocBlockAttributes, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
export type BlockConverter = {
|
|
3
|
+
reg: RegExp;
|
|
4
|
+
blockType: string;
|
|
5
|
+
data?: DocBlockAttributes;
|
|
6
|
+
};
|
|
7
|
+
export type BlockConverters = {
|
|
8
|
+
[index: string]: BlockConverter;
|
|
9
|
+
};
|
|
2
10
|
export declare function converterIntercept(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, type: 'enter' | 'space'): boolean;
|
|
3
11
|
export declare function matchBlockConvert(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, type: 'enter' | 'space'): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OnesEditorInputHandler, OnesEditorCustom, OnesEditor, OnesEditorDocs } from '../../../@ones-editor/core';
|
|
2
|
+
export declare class LayoutBlockCaptionInputHandler implements OnesEditorInputHandler, OnesEditorCustom {
|
|
3
|
+
private editor;
|
|
4
|
+
private skipForRootContainer;
|
|
5
|
+
constructor(editor: OnesEditor, skipForRootContainer?: boolean);
|
|
6
|
+
destroy(): void;
|
|
7
|
+
handleBeforePaste(editor: OnesEditor, event: ClipboardEvent | null, docs: OnesEditorDocs): Promise<boolean>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BlockElement, ContainerElement, OnesEditor } from '../../../@ones-editor/core';
|
|
2
|
+
export declare function getChildContainers(editor: OnesEditor, block: BlockElement, from?: string, to?: string): ContainerElement[];
|
|
3
|
+
export declare function getChildSeparators(block: BlockElement): HTMLElement[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommandFilter, CommandItemWithSource, OnesEditor, OnesEditorCustom, SelectionRange } from '../../../@ones-editor/core';
|
|
2
|
+
export declare class LayoutQuickMenuItemFilter implements CommandFilter, OnesEditorCustom {
|
|
3
|
+
constructor(editor: OnesEditor);
|
|
4
|
+
filter(editor: OnesEditor, range: SelectionRange, items: CommandItemWithSource[], source: string[]): CommandItemWithSource[];
|
|
5
|
+
destroy(): void;
|
|
6
|
+
static init(editor: OnesEditor): LayoutQuickMenuItemFilter;
|
|
7
|
+
}
|