@ones-editor/editor 0.0.3-beta.8 → 0.0.3-beta.80
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/auto-link/package.json +8 -0
- package/@ones-editor/auto-link/src/index.d.ts +3 -0
- package/@ones-editor/block-locker/src/hook.d.ts +1 -0
- package/@ones-editor/block-locker/src/i18n/en-US.d.ts +8 -0
- package/@ones-editor/block-locker/src/i18n/index.d.ts +1 -0
- package/@ones-editor/block-locker/src/i18n/zh-CN.d.ts +8 -0
- package/@ones-editor/block-locker/src/index.d.ts +4 -1
- package/@ones-editor/block-locker/src/paste-handler.d.ts +4 -0
- package/@ones-editor/block-menu/src/block-menu/items/block-command-items.d.ts +1 -1
- 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-drop/find-preview-element.d.ts +1 -1
- package/@ones-editor/block-menu/src/block-menu-button/drag-preview/index.d.ts +1 -1
- package/@ones-editor/code-block/src/code-block/caption/caption-input-handler.d.ts +2 -2
- package/@ones-editor/code-block/src/code-block/child-container.d.ts +2 -2
- package/@ones-editor/code-block/src/code-block/code-caret.d.ts +7 -0
- package/@ones-editor/code-block/src/code-block/code-copy.d.ts +4 -0
- package/@ones-editor/code-block/src/code-block/create-empty-code.d.ts +2 -2
- package/@ones-editor/code-block/src/code-block/index.d.ts +3 -1
- package/@ones-editor/code-block/src/code-block/settings/index.d.ts +3 -0
- package/@ones-editor/comments/src/actions/add-comment-to-block.d.ts +3 -2
- package/@ones-editor/comments/src/actions/add-comment-to-text-block.d.ts +2 -1
- package/@ones-editor/comments/src/actions/editor-add-comment.d.ts +2 -0
- package/@ones-editor/comments/src/comment-item/comment-item.d.ts +1 -0
- package/@ones-editor/comments/src/comments/comments.d.ts +5 -4
- package/@ones-editor/comments/src/comments-helper/utils.d.ts +1 -1
- package/@ones-editor/comments/src/comments-list/arrange-items.d.ts +1 -1
- package/@ones-editor/comments/src/comments-list/comments-list.d.ts +2 -10
- package/@ones-editor/comments/src/comments-list/group-item.d.ts +1 -0
- package/@ones-editor/comments/src/comments-list/group-list.d.ts +4 -2
- package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +1 -4
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +2 -2
- package/@ones-editor/comments/src/index.d.ts +1 -0
- package/@ones-editor/comments/src/types.d.ts +11 -4
- package/@ones-editor/core/src/core/blocks/block-anchor/create-block-anchor.d.ts +1 -0
- package/@ones-editor/core/src/core/blocks/common/block-dom.d.ts +1 -0
- package/@ones-editor/core/src/core/blocks/text-blocks/index.d.ts +1 -0
- package/@ones-editor/core/src/core/blocks/text-blocks/text-block/to-markdown.d.ts +3 -0
- package/@ones-editor/core/src/core/blocks/text-blocks/text-block/to-plain-html.d.ts +3 -0
- package/@ones-editor/core/src/core/blocks/text-blocks/text-block/to-plain-text.d.ts +3 -0
- package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +3 -2
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +3 -0
- package/@ones-editor/core/src/core/composition/index.d.ts +1 -1
- package/@ones-editor/core/src/core/containers/root-container.d.ts +2 -1
- package/@ones-editor/core/src/core/converter/block-to-html.d.ts +2 -2
- package/@ones-editor/core/src/core/converter/block-to-markdown.d.ts +2 -2
- package/@ones-editor/core/src/core/converter/block-to-text.d.ts +2 -2
- package/@ones-editor/core/src/core/doc/doc.d.ts +6 -2
- package/@ones-editor/core/src/core/doc/to-plain-text.d.ts +1 -0
- package/@ones-editor/core/src/core/editor/actions/auto-insert-block.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/actions/break-text-block.d.ts +2 -0
- package/@ones-editor/core/src/core/editor/actions/delete-block-text.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/actions/focus-to-end.d.ts +0 -1
- package/@ones-editor/core/src/core/editor/actions/insert-block.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/actions/insert-text.d.ts +2 -2
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +5 -3
- package/@ones-editor/core/src/core/index.d.ts +1 -0
- package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +3 -0
- package/@ones-editor/core/src/core/input-handler/remove-quoted.d.ts +2 -0
- package/@ones-editor/core/src/core/selection/actions/index.d.ts +2 -2
- package/@ones-editor/core/src/core/selection/actions/select-all.d.ts +3 -1
- package/@ones-editor/core/src/core/selection/actions/select-block.d.ts +2 -0
- package/@ones-editor/core/src/core/selection/actions/word-offset.d.ts +1 -1
- package/@ones-editor/core/src/core/selection/editor-selection.d.ts +3 -2
- package/@ones-editor/core/src/core/selection/index.d.ts +1 -0
- package/@ones-editor/core/src/core/selection/range/simple-range.d.ts +2 -1
- package/@ones-editor/core/src/core/settings/index.d.ts +3 -3
- package/@ones-editor/core/src/core/types.d.ts +30 -18
- package/@ones-editor/core/src/i18n/i18n.d.ts +36 -0
- package/@ones-editor/core/src/local-doc/index.d.ts +6 -2
- package/@ones-editor/core/src/utils/dom-scroll.d.ts +3 -1
- package/@ones-editor/core/src/utils/dom.d.ts +2 -0
- package/@ones-editor/core/src/utils/file.d.ts +1 -0
- package/@ones-editor/core/src/utils/logger/index.d.ts +9 -0
- package/@ones-editor/drawio-embed/src/helper/index.d.ts +3 -3
- package/@ones-editor/drawio-embed/types/index.d.ts +2 -2
- package/@ones-editor/drop-target/src/drop-indicator.d.ts +1 -0
- package/@ones-editor/drop-target/src/drop-target.d.ts +1 -1
- package/@ones-editor/drop-target/src/handlers/drag-file.d.ts +8 -0
- package/@ones-editor/embed-block-helper/src/block-properties/embed-block-properties.d.ts +2 -1
- package/@ones-editor/exclusive-block/package.json +6 -0
- package/@ones-editor/exclusive-block/src/exclusive-block-hook.d.ts +6 -0
- package/@ones-editor/exclusive-block/src/exclusive-block.d.ts +22 -0
- package/@ones-editor/exclusive-block/src/exclusive-dom.d.ts +5 -0
- package/@ones-editor/exclusive-block/src/handle-remote-exclusive-message.d.ts +3 -0
- package/@ones-editor/exclusive-block/src/index.d.ts +5 -0
- package/@ones-editor/exclusive-block/src/types.d.ts +7 -0
- package/@ones-editor/file/src/file-embed/card/index.d.ts +3 -3
- package/@ones-editor/file/src/index.d.ts +1 -0
- package/@ones-editor/file/src/types.d.ts +1 -0
- package/@ones-editor/find-dialog/src/find-dialog.d.ts +1 -0
- package/@ones-editor/graph-embed/src/helper/graph-base.d.ts +3 -2
- package/@ones-editor/graph-embed/src/helper/graph-block-commands.d.ts +3 -2
- package/@ones-editor/heading-collapse/src/heading-collapse-button/drop-handler.d.ts +1 -1
- package/@ones-editor/image-embed/package.json +2 -1
- package/@ones-editor/image-embed/src/drag-drop/drag-handler.d.ts +4 -0
- package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +5 -1
- package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +1 -1
- package/@ones-editor/image-embed/src/empty-image-converter.d.ts +5 -0
- package/@ones-editor/image-embed/src/index.d.ts +2 -1
- package/@ones-editor/input-handlers/src/enforce-with-document-title/types.d.ts +1 -0
- package/@ones-editor/input-handlers/src/i18n/en-us.d.ts +1 -0
- package/@ones-editor/input-handlers/src/i18n/zh-cn.d.ts +1 -0
- package/@ones-editor/input-handlers/src/markdown-shortcuts/table-converter.d.ts +2 -0
- package/@ones-editor/list-block/src/converter/convert-list-to.d.ts +2 -0
- package/@ones-editor/list-block/src/converter/convert-to-list.d.ts +14 -0
- package/@ones-editor/list-block/src/converter/index.d.ts +2 -14
- package/@ones-editor/list-block/src/drop/index.d.ts +1 -1
- package/@ones-editor/list-block/src/index.d.ts +3 -2
- package/@ones-editor/list-block/src/level/change-multi-levels.d.ts +2 -0
- package/@ones-editor/list-block/src/level/decrease-level.d.ts +1 -0
- package/@ones-editor/list-block/src/mindmap/index.d.ts +1 -1
- package/@ones-editor/list-block/src/mindmap/to-mindmap/index.d.ts +1 -1
- package/@ones-editor/list-block/src/types.d.ts +2 -1
- package/@ones-editor/list-block/src/utils/list-brother.d.ts +5 -1
- package/@ones-editor/markdown-to-doc/src/markdown-to-doc.d.ts +1 -0
- package/@ones-editor/markdown-to-doc/src/tokens/block-tokens/latex.d.ts +4 -0
- package/@ones-editor/markdown-to-doc/src/tokens/block-tokens/paragraph.d.ts +1 -0
- package/@ones-editor/mathjax/package.json +3 -0
- package/@ones-editor/mathjax/src/index.d.ts +2 -1
- package/@ones-editor/mathjax/src/mathjax-box/convert-mathjax.d.ts +5 -0
- package/@ones-editor/mathjax/src/mathjax-box/mathjax-editor.d.ts +2 -2
- package/@ones-editor/media-embed/src/core/media-embed.d.ts +3 -1
- package/@ones-editor/mention/src/block-mention.d.ts +1 -1
- package/@ones-editor/mention/src/dom/mention-button.d.ts +1 -1
- package/@ones-editor/mention/src/mention.d.ts +1 -0
- package/@ones-editor/mobile-helper/package.json +9 -0
- package/@ones-editor/mobile-helper/src/index.d.ts +11 -0
- package/@ones-editor/paste-handler/src/paste-handler.d.ts +1 -1
- package/@ones-editor/paste-special/src/paste-special-handler.d.ts +2 -2
- package/@ones-editor/scroll-container/src/dom-utils.d.ts +9 -0
- package/@ones-editor/scroll-container/src/index.d.ts +8 -18
- package/@ones-editor/scroll-container/src/observer/container-resize-observer.d.ts +2 -1
- package/@ones-editor/scroll-container/src/observer/locating-resize-observer.d.ts +13 -0
- package/@ones-editor/scroll-container/src/scroll-listener.d.ts +3 -0
- package/@ones-editor/scroll-container/src/types.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +3 -3
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +3 -3
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +6 -1
- package/@ones-editor/sharedb-doc/src/index.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/types.d.ts +3 -2
- package/@ones-editor/table-block/src/constant/index.d.ts +1 -0
- package/@ones-editor/table-block/src/locale/en-us.d.ts +5 -0
- package/@ones-editor/table-block/src/locale/zh-cn.d.ts +5 -0
- package/@ones-editor/table-block/src/table-block/border-bar/table-row-column-toolbar.d.ts +1 -0
- package/@ones-editor/table-block/src/table-block/convert-table-to.d.ts +2 -0
- package/@ones-editor/table-block/src/table-block/doc-table-data.d.ts +1 -1
- package/@ones-editor/table-block/src/table-block/selection-range.d.ts +2 -1
- package/@ones-editor/table-block/src/table-block/table-creator/index.d.ts +1 -1
- package/@ones-editor/table-block/src/table-block/table-resize/resize-gripper.d.ts +1 -1
- package/@ones-editor/table-block/src/table-block/table-scroll-events.d.ts +1 -0
- package/@ones-editor/table-block/src/types.d.ts +2 -0
- package/@ones-editor/templates/package.json +9 -0
- package/@ones-editor/templates/src/index.d.ts +4 -0
- package/@ones-editor/templates/src/locale/en-us.d.ts +9 -0
- package/@ones-editor/templates/src/locale/index.d.ts +1 -0
- package/@ones-editor/templates/src/locale/zh-cn.d.ts +9 -0
- package/@ones-editor/templates/src/templates/select-template.d.ts +7 -0
- package/@ones-editor/templates/src/templates/types.d.ts +14 -0
- package/@ones-editor/text-commands/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/text-commands/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/text-commands/src/text-command-provider.d.ts +1 -0
- package/@ones-editor/toc/src/heading-scroll/index.d.ts +22 -0
- package/@ones-editor/toc/src/heading-scroll/utils.d.ts +7 -0
- package/@ones-editor/toc/src/index.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/index.d.ts +3 -3
- package/@ones-editor/ui/src/locale/en-us.d.ts +2 -0
- package/@ones-editor/ui/src/locale/zh-cn.d.ts +2 -0
- package/@ones-editor/ui/src/quick-menu/basic-commands.d.ts +5 -0
- package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +10 -10
- package/@ones-editor/ui/src/quick-menu/index.d.ts +6 -0
- package/@ones-editor/ui/src/quick-menu/inline-box-items.d.ts +8 -14
- package/@ones-editor/ui/src/toolbar/box-only.d.ts +2 -0
- package/@ones-editor/ui/src/toolbar/commands/paragraph.d.ts +1 -0
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +4 -1
- package/@ones-editor/ui/src/tooltips/index.d.ts +4 -0
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +2 -1
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +4 -1
- package/@ones-editor/ui-base/src/auto-suggest/index.d.ts +2 -1
- package/@ones-editor/ui-base/src/auto-suggest/should-focus-to-editor.d.ts +2 -0
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +4 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +6 -0
- package/@ones-editor/ui-base/src/dialog/index.d.ts +1 -0
- package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +1 -1
- package/@ones-editor/ui-base/src/dialog/types.d.ts +4 -0
- 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/item-shortcuts/index.d.ts +1 -0
- package/@ones-editor/ui-base/src/list/drop-down-filterable-list.d.ts +2 -2
- package/@ones-editor/ui-base/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/versions/src/types.d.ts +1 -0
- package/@ones-editor/versions/src/version-dialog/index.d.ts +3 -1
- package/@ones-editor/webpage-embed/src/ui/dialog.d.ts +2 -2
- package/@ones-editor/webpage-embed/src/webpage-embed/webpage-items.d.ts +2 -0
- package/dist/comments/create-comment-editor.d.ts +4 -7
- package/dist/comments/local-doc-comments-provider.d.ts +18 -0
- package/dist/comments/{comments-provider.d.ts → sharedb-doc-comments-provider.d.ts} +3 -6
- package/dist/index.d.ts +15 -3
- package/dist/index.js +242 -288
- package/dist/lang/en-us.d.ts +14 -0
- package/dist/lang/index.d.ts +1 -0
- package/dist/lang/zh-cn.d.ts +14 -0
- package/dist/types.d.ts +31 -2
- package/package.json +3 -4
- package/@ones-editor/e2e/cypress/support/commands.d.ts +0 -19
- package/@ones-editor/e2e/cypress/support/e2e.d.ts +0 -1
- package/@ones-editor/e2e/cypress.config.d.ts +0 -3
- package/@ones-editor/e2e/package.json +0 -13
- package/@ones-editor/e2e/src/block-menu/menu-list.cy.d.ts +0 -0
- package/@ones-editor/e2e/src/data.d.ts +0 -106
- package/@ones-editor/e2e/src/input-handlers/case.d.ts +0 -10
- package/@ones-editor/e2e/src/input-handlers/shortcut.cy.d.ts +0 -1
- package/@ones-editor/e2e/src/list-block/case.d.ts +0 -8
- package/@ones-editor/e2e/src/list-block/list.cy.d.ts +0 -1
- package/@ones-editor/e2e/src/toc/case.d.ts +0 -5
- package/@ones-editor/e2e/src/toc/toc.cy.d.ts +0 -1
- package/@ones-editor/list-block/src/command/covert-to-list.d.ts +0 -3
- /package/@ones-editor/block-menu/src/block-menu-button/{drag-drop → drag-preview}/element-to-data-url.d.ts +0 -0
|
@@ -11,7 +11,9 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
|
11
11
|
onRemoteChanged(type: RemoteChangeType): void;
|
|
12
12
|
onCompositionStart(event: Event): void;
|
|
13
13
|
onUpdateCompositionText(event: Event, text: string, end: boolean): void;
|
|
14
|
+
onCopy(event: ClipboardEvent): void;
|
|
14
15
|
onPaste(event: ClipboardEvent): void;
|
|
16
|
+
onPasteText: (text: string) => Promise<void>;
|
|
15
17
|
onFocus(): void;
|
|
16
18
|
onBlur(): void;
|
|
17
19
|
addHandler(handler: OnesEditorInputHandler): void;
|
|
@@ -23,5 +25,6 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
|
23
25
|
defaultInsertText(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string): void;
|
|
24
26
|
defaultHandleKeydown(editor: OnesEditor, event: KeyboardEvent): boolean;
|
|
25
27
|
pasteDoc(doc: DocObject): Promise<void>;
|
|
28
|
+
private pasteDocs;
|
|
26
29
|
destroy(): void;
|
|
27
30
|
}
|
|
@@ -22,5 +22,5 @@ import { editorMovePageUp } from './move-page-up';
|
|
|
22
22
|
import { editorMovePageDown } from './move-page-down';
|
|
23
23
|
import { editorSelectPageUp } from './select-page-up';
|
|
24
24
|
import { editorSelectPageDown } from './select-page-down';
|
|
25
|
-
import { editorSelectAll } from './select-all';
|
|
26
|
-
export { editorMoveLeft, editorMoveRight, editorMoveUp, editorMoveDown, editorSelectDown, editorSelectUp, editorSelectLeft, editorSelectRight, editorMoveWordLeft, editorMoveWordEnd, editorSelectWordLeft, editorSelectWordEnd, editorMoveHome, editorMoveEnd, editorSelectHome, editorSelectEnd, editorMovePageUp, editorMovePageDown, editorSelectPageUp, editorSelectPageDown, editorSelectLineHome, editorSelectLineEnd, editorMoveLineHome, editorMoveLineEnd, editorSelectAll, };
|
|
25
|
+
import { editorSelectAll, editorSelectContainer, isContainerSelectedAllChildBlocks } from './select-all';
|
|
26
|
+
export { editorMoveLeft, editorMoveRight, editorMoveUp, editorMoveDown, editorSelectDown, editorSelectUp, editorSelectLeft, editorSelectRight, editorMoveWordLeft, editorMoveWordEnd, editorSelectWordLeft, editorSelectWordEnd, editorMoveHome, editorMoveEnd, editorSelectHome, editorSelectEnd, editorMovePageUp, editorMovePageDown, editorSelectPageUp, editorSelectPageDown, editorSelectLineHome, editorSelectLineEnd, editorMoveLineHome, editorMoveLineEnd, editorSelectAll, editorSelectContainer, isContainerSelectedAllChildBlocks, };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { OnesEditor } from '../../types';
|
|
1
|
+
import { ContainerElement, OnesEditor, SimpleSelectionRange } from '../../types';
|
|
2
|
+
export declare function isContainerSelectedAllChildBlocks(container: ContainerElement, range: SimpleSelectionRange): boolean;
|
|
2
3
|
export declare function editorSelectAll(editor: OnesEditor): boolean;
|
|
4
|
+
export declare function editorSelectContainer(editor: OnesEditor, container: ContainerElement): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { OnesEditor, SimpleBlockPosition } from '../../types';
|
|
2
2
|
export declare function editorGetWordLeftPos(editor: OnesEditor, type: 'move' | 'select'): SimpleBlockPosition | null;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function editorGetWordRightPos(editor: OnesEditor, type: 'move' | 'select'): SimpleBlockPosition | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorCaret } from '../blocks/text-blocks/caret/editor-caret';
|
|
2
|
-
import { OnesEditorSelection, BlockElement, BlockPosition, SelectionRange, OnesEditor,
|
|
2
|
+
import { OnesEditorSelection, BlockElement, BlockPosition, SelectionRange, OnesEditor, DeleteBlockEventOptions, ChangeSelectionOptions } from '../types';
|
|
3
3
|
export declare class EditorSelection implements OnesEditorSelection {
|
|
4
4
|
readonly editor: OnesEditor;
|
|
5
5
|
readonly caret: EditorCaret;
|
|
@@ -16,7 +16,7 @@ export declare class EditorSelection implements OnesEditorSelection {
|
|
|
16
16
|
getEndBlock(): BlockElement;
|
|
17
17
|
selectBlock(block: BlockElement, start: number, end?: number): void;
|
|
18
18
|
setSelection(anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions): SelectionRange;
|
|
19
|
-
setRange(range: SelectionRange): SelectionRange;
|
|
19
|
+
setRange(range: SelectionRange, options?: ChangeSelectionOptions): SelectionRange;
|
|
20
20
|
updateSelection(): void;
|
|
21
21
|
getFocusedPos(): BlockPosition;
|
|
22
22
|
getAnchorPos(): BlockPosition;
|
|
@@ -29,6 +29,7 @@ export declare class EditorSelection implements OnesEditorSelection {
|
|
|
29
29
|
private verifyPos;
|
|
30
30
|
private updateFocusedBlock;
|
|
31
31
|
verify(): void;
|
|
32
|
+
to(type: 'text' | 'markdown' | 'html'): string;
|
|
32
33
|
private removeAllBlockFocusedClass;
|
|
33
34
|
private setBlockFocused;
|
|
34
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnesEditorDocRange } from '../../doc';
|
|
2
|
-
import { OnesEditor, SelectionRange, SelectedBlock, ContainerElement } from '../../types';
|
|
2
|
+
import { OnesEditor, SelectionRange, SelectedBlock, ContainerElement, SimpleSelectionRange } from '../../types';
|
|
3
3
|
import { EditorSimpleBlockPosition } from '../editor-position';
|
|
4
4
|
interface SimpleRangeOptions {
|
|
5
5
|
anchor: EditorSimpleBlockPosition;
|
|
@@ -26,5 +26,6 @@ export default class EditorSimpleSelectionRange implements SelectionRange {
|
|
|
26
26
|
getFocusedPos(): EditorSimpleBlockPosition;
|
|
27
27
|
clone(): EditorSimpleSelectionRange;
|
|
28
28
|
toDocRange(): OnesEditorDocRange;
|
|
29
|
+
static from(editor: OnesEditor, other: SimpleSelectionRange): EditorSimpleSelectionRange;
|
|
29
30
|
}
|
|
30
31
|
export {};
|
|
@@ -3,7 +3,7 @@ export default class DefaultSettingsProvider implements OnesEditorSettingsProvid
|
|
|
3
3
|
private editor;
|
|
4
4
|
constructor(editor: OnesEditor);
|
|
5
5
|
getKey(key: string): string;
|
|
6
|
-
getItem(key: string):
|
|
7
|
-
setItem(key: string, value: string | null):
|
|
8
|
-
removeItem(key: string):
|
|
6
|
+
getItem(key: string): string | null;
|
|
7
|
+
setItem(key: string, value: string | null): void;
|
|
8
|
+
removeItem(key: string): void;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, OnesEditorDoc, OnesEditorDocRange } from './doc';
|
|
2
|
+
import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange } from './doc';
|
|
3
3
|
export type ContainerElement = HTMLDivElement & {
|
|
4
4
|
__neverUse: 'ContainerElement';
|
|
5
5
|
};
|
|
@@ -61,6 +61,7 @@ export interface Box {
|
|
|
61
61
|
boxType: string;
|
|
62
62
|
updateBoxContent: (editor: OnesEditor, boxElement: BoxElement, boxContent: BoxContentElement, boxData: DocBox) => void;
|
|
63
63
|
convertFrom?: (editor: OnesEditor, text: string) => DocBox | null;
|
|
64
|
+
convertTo?: (editor: OnesEditor, boxData: DocBox, doc: DocObject, type: 'text' | 'html' | 'markdown') => string;
|
|
64
65
|
handleClickBox?: (editor: OnesEditor, box: BoxElement, event: MouseEvent) => void;
|
|
65
66
|
toStandardText?: (editor: OnesEditor, box: DocBox) => Promise<DocBlockText | undefined>;
|
|
66
67
|
getBoxProperties?: (editor: OnesEditor, boxElement: BoxElement) => BoxProperties;
|
|
@@ -88,12 +89,13 @@ export interface Embed {
|
|
|
88
89
|
getOptions?: (editor: OnesEditor) => EmbedOptions;
|
|
89
90
|
handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
|
|
90
91
|
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocEmbedBlock) => boolean;
|
|
91
|
-
handleDropOver?: (editor: OnesEditor, block: BlockElement,
|
|
92
|
-
handleDrop?: (editor: OnesEditor, block: BlockElement,
|
|
92
|
+
handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | undefined;
|
|
93
|
+
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
|
|
93
94
|
convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
|
|
94
95
|
offset: number;
|
|
95
96
|
data?: DocBlockAttributes;
|
|
96
97
|
}) => ConvertBlockResult | null;
|
|
98
|
+
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, path: BlockPath) => Promise<DocObject | undefined>;
|
|
97
99
|
}
|
|
98
100
|
export interface ConvertBlockResult {
|
|
99
101
|
blockData: DocBlock;
|
|
@@ -118,7 +120,7 @@ export interface CommandItem {
|
|
|
118
120
|
value?: string;
|
|
119
121
|
order?: number;
|
|
120
122
|
type?: CommandItemType;
|
|
121
|
-
element?: HTMLElement;
|
|
123
|
+
element?: HTMLElement | ((item: CommandItem) => HTMLElement);
|
|
122
124
|
icon?: string;
|
|
123
125
|
childrenType?: 'menu' | 'toolbar';
|
|
124
126
|
children?: CommandItem[];
|
|
@@ -130,7 +132,9 @@ export interface CommandItem {
|
|
|
130
132
|
manualShowChildren?: boolean;
|
|
131
133
|
childrenPlacement?: CommandItemChildrenPlacement;
|
|
132
134
|
childrenOffset?: [number, number];
|
|
133
|
-
|
|
135
|
+
subText?: string;
|
|
136
|
+
defaultCheckedChildren?: string[];
|
|
137
|
+
disableTooltip?: boolean;
|
|
134
138
|
setCloseable?: (closeable: Closeable) => void;
|
|
135
139
|
beforePopup?: (parent: unknown) => void;
|
|
136
140
|
}
|
|
@@ -204,8 +208,8 @@ export interface Block {
|
|
|
204
208
|
handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
|
|
205
209
|
handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
|
|
206
210
|
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
|
|
207
|
-
handleDropOver?: (editor: OnesEditor, block: BlockElement,
|
|
208
|
-
handleDrop?: (editor: OnesEditor, block: BlockElement,
|
|
211
|
+
handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | false | undefined;
|
|
212
|
+
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
|
|
209
213
|
getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
|
|
210
214
|
getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
|
|
211
215
|
convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
|
|
@@ -213,7 +217,7 @@ export interface Block {
|
|
|
213
217
|
data?: DocBlockAttributes;
|
|
214
218
|
}) => ConvertBlockResult | null;
|
|
215
219
|
selectionToDoc?: (editor: OnesEditor, selectedBlock: SelectedBlock) => DocObject;
|
|
216
|
-
convertTo?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, type: 'text' | 'html' | 'markdown') => string;
|
|
220
|
+
convertTo?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, type: 'text' | 'html' | 'markdown', path: BlockPath) => string;
|
|
217
221
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
|
|
218
222
|
getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
|
|
219
223
|
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
@@ -344,9 +348,10 @@ export interface OnesEditorDataConverters {
|
|
|
344
348
|
export interface BreakTextOptions {
|
|
345
349
|
forceInsertAfter?: boolean;
|
|
346
350
|
newBlockData?: DocBlock;
|
|
351
|
+
copyBlockAttributes?: boolean;
|
|
347
352
|
}
|
|
348
353
|
export interface OnesEditorEvents {
|
|
349
|
-
'docChanged': (editor: OnesEditor) => void;
|
|
354
|
+
'docChanged': (editor: OnesEditor, local: boolean) => void;
|
|
350
355
|
'readonlyChanged': (editor: OnesEditor) => void;
|
|
351
356
|
'selectionChanged': (editor: OnesEditor) => void;
|
|
352
357
|
'focusBlockChanged': (editor: OnesEditor, newBlock: BlockElement | null, oldBlock: BlockElement | null) => void;
|
|
@@ -355,15 +360,16 @@ export interface OnesEditorEvents {
|
|
|
355
360
|
'resize': (editor: OnesEditor) => void;
|
|
356
361
|
'load': (editor: OnesEditor, reload: boolean) => void;
|
|
357
362
|
'click': (editor: OnesEditor, event: MouseEvent) => void;
|
|
363
|
+
'clickLink': (editor: OnesEditor, event: MouseEvent, link: Element) => void;
|
|
358
364
|
'beforeClearSelection': (editor: OnesEditor) => void;
|
|
359
365
|
'afterClearSelection': (editor: OnesEditor) => void;
|
|
360
366
|
'blur': (editor: OnesEditor) => void;
|
|
361
367
|
'focus': (editor: OnesEditor) => void;
|
|
362
368
|
}
|
|
363
369
|
export interface OnesEditorSettingsProvider {
|
|
364
|
-
getItem: (key: string) =>
|
|
365
|
-
setItem: (key: string, value: string | null) =>
|
|
366
|
-
removeItem: (key: string) =>
|
|
370
|
+
getItem: (key: string) => string | null;
|
|
371
|
+
setItem: (key: string, value: string | null) => void;
|
|
372
|
+
removeItem: (key: string) => void;
|
|
367
373
|
}
|
|
368
374
|
export interface OnesEditorOptionalOptions {
|
|
369
375
|
shortcuts?: ShortcutRecords[];
|
|
@@ -425,6 +431,7 @@ export interface OnesEditorDomEvents extends OnesEditorCustom {
|
|
|
425
431
|
removeEventListener: (element: Element | Document | Window | null, eventName: string | null, eventHandler: (editor: OnesEditor, event: Event) => void) => void;
|
|
426
432
|
removeAllListeners: (element: Element | Document | Window, eventName?: string) => void;
|
|
427
433
|
}
|
|
434
|
+
export type InsertTextOptions = InsertBlockOptions;
|
|
428
435
|
export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
429
436
|
readonly parent: HTMLElement;
|
|
430
437
|
readonly rootElement: HTMLDivElement;
|
|
@@ -489,7 +496,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
489
496
|
contains: (node: Node) => boolean;
|
|
490
497
|
getSelectedText: () => string;
|
|
491
498
|
clearSelectedContents: () => void;
|
|
492
|
-
insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange) => BlockElement;
|
|
499
|
+
insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange, options?: InsertBlockOptions) => BlockElement;
|
|
493
500
|
insertEmbed: (containerId: string, blockIndex: number, embedType: string, embedData: DocEmbedData, newRange?: OnesEditorDocRange) => BlockElement;
|
|
494
501
|
deleteBlock: (block: BlockElement, newRange?: OnesEditorDocRange) => void;
|
|
495
502
|
getTextPosition: () => BlockTextPosition;
|
|
@@ -500,8 +507,8 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
500
507
|
getBlockText: (block: BlockElement) => DocBlockText;
|
|
501
508
|
setBlockText: (block: BlockElement, text: DocBlockText) => void;
|
|
502
509
|
getBoxData: (box: BoxElement) => DocBox;
|
|
503
|
-
deleteTextFromBlock: (block: BlockElement, offset: number, count: number) => number;
|
|
504
|
-
insertTextToBlock: (block: BlockElement, offset: number, text: string | DocBlockText) => DocBlockText;
|
|
510
|
+
deleteTextFromBlock: (block: BlockElement, offset: number, count: number, options?: InsertTextOptions) => number;
|
|
511
|
+
insertTextToBlock: (block: BlockElement, offset: number, text: string | DocBlockText, options?: InsertTextOptions) => DocBlockText;
|
|
505
512
|
insertBoxToBlock: (block: BlockElement, offset: number, boxData: DocBox) => DocBlockText;
|
|
506
513
|
mergeTextBlock: (block1: BlockElement, block2: BlockElement, options?: {
|
|
507
514
|
focus?: boolean;
|
|
@@ -509,6 +516,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
509
516
|
breakTextBlock: (block: BlockElement, offset: number, options?: BreakTextOptions) => BlockElement;
|
|
510
517
|
insertTextBlock: (text?: string | DocBlockText, containerId?: string, blockIndex?: number, options?: {
|
|
511
518
|
newRange?: OnesEditorDocRange;
|
|
519
|
+
insertBlockOptions?: InsertBlockOptions;
|
|
512
520
|
}) => BlockElement;
|
|
513
521
|
insertDoc: (block: BlockElement, offset: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => void;
|
|
514
522
|
insertDocAt: (container: ContainerElement, blockIndex: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => BlockElement[];
|
|
@@ -530,7 +538,7 @@ export interface OnesEditorSelection {
|
|
|
530
538
|
readonly startBlock: BlockElement;
|
|
531
539
|
readonly endBlock: BlockElement;
|
|
532
540
|
setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
|
|
533
|
-
setRange: (range: SelectionRange) => SelectionRange;
|
|
541
|
+
setRange: (range: SelectionRange, options?: ChangeSelectionOptions) => SelectionRange;
|
|
534
542
|
selectBlock: (block: BlockElement, start: number, end?: number) => void;
|
|
535
543
|
updateSelection: (old: SelectionRange | null) => void;
|
|
536
544
|
updateLastCaretRect: () => void;
|
|
@@ -538,6 +546,7 @@ export interface OnesEditorSelection {
|
|
|
538
546
|
getAnchorPos: () => BlockPosition;
|
|
539
547
|
getFocusedPos: () => BlockPosition;
|
|
540
548
|
scrollIntoView: () => void;
|
|
549
|
+
to: (type: 'text' | 'markdown' | 'html') => string;
|
|
541
550
|
}
|
|
542
551
|
export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBlock' | 'DeleteBlock' | 'InsertChildContainer' | 'DeleteChildContainer';
|
|
543
552
|
export interface OnesEditorInput {
|
|
@@ -551,6 +560,7 @@ export interface OnesEditorInput {
|
|
|
551
560
|
handleKeyDown: (event: KeyboardEvent) => void;
|
|
552
561
|
handleChanged: (action: OnesEditorUndoAction) => void;
|
|
553
562
|
handleRemoteChanged: (type: RemoteChangeType) => void;
|
|
563
|
+
handlePasteText: (text: string) => void;
|
|
554
564
|
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
555
565
|
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
556
566
|
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
@@ -574,8 +584,9 @@ export interface OnesEditorInputHandler {
|
|
|
574
584
|
handleAfterInsertText?: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => boolean;
|
|
575
585
|
handleBeforeKeyDown?: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
576
586
|
handleAfterKeyDown?: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
577
|
-
|
|
578
|
-
|
|
587
|
+
handleBeforeCopy?: (editor: OnesEditor, event: ClipboardEvent, doc: DocObject) => DocObject | boolean | undefined;
|
|
588
|
+
handleBeforePaste?: (editor: OnesEditor, event: ClipboardEvent | null, doc: OnesEditorDocs) => Promise<boolean>;
|
|
589
|
+
handleAfterPaste?: (editor: OnesEditor, event: ClipboardEvent | null, doc: OnesEditorDocs) => Promise<boolean>;
|
|
579
590
|
handleBeforePasteDoc?: (editor: OnesEditor, doc: DocObject) => Promise<boolean>;
|
|
580
591
|
handleAfterPasteDoc?: (editor: OnesEditor, doc: DocObject) => Promise<boolean>;
|
|
581
592
|
handleChanged?: (editor: OnesEditor, action: OnesEditorUndoAction) => void;
|
|
@@ -589,6 +600,7 @@ export interface OnesEditorBlocks {
|
|
|
589
600
|
getBlockClass: (type: string) => Block;
|
|
590
601
|
createBlock: (path: BlockPath, container: ContainerElement, block: DocBlock) => BlockElement;
|
|
591
602
|
forEach: (callback: (blockClass: Block) => void) => void;
|
|
603
|
+
hasBlock: (type: string) => boolean;
|
|
592
604
|
}
|
|
593
605
|
export interface OnesEditorEmbeds {
|
|
594
606
|
registerEmbedClass: (embedClass: Embed) => void;
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
declare const langs: {
|
|
2
|
+
'en-US': {
|
|
3
|
+
name: string;
|
|
4
|
+
date: {
|
|
5
|
+
dateFromFuture: string;
|
|
6
|
+
dateJustNow: string;
|
|
7
|
+
dateYesterday: string;
|
|
8
|
+
dateMinutesAgo: string;
|
|
9
|
+
date1HourAgo: string;
|
|
10
|
+
dateHoursAgo: string;
|
|
11
|
+
dateDaysAgo: string;
|
|
12
|
+
dateWeeksAgo: string;
|
|
13
|
+
};
|
|
14
|
+
common: {
|
|
15
|
+
cancel: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
'zh-CN': {
|
|
19
|
+
name: string;
|
|
20
|
+
date: {
|
|
21
|
+
dateFromFuture: string;
|
|
22
|
+
dateJustNow: string;
|
|
23
|
+
dateYesterday: string;
|
|
24
|
+
dateMinutesAgo: string;
|
|
25
|
+
date1HourAgo: string;
|
|
26
|
+
dateHoursAgo: string;
|
|
27
|
+
dateDaysAgo: string;
|
|
28
|
+
dateWeeksAgo: string;
|
|
29
|
+
};
|
|
30
|
+
common: {
|
|
31
|
+
cancel: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
1
35
|
export declare function setLang(lang?: string | null | undefined): void;
|
|
2
36
|
export declare function mergeLang(l: any): void;
|
|
3
37
|
export declare function t(key: string, args?: Record<string, string>): string;
|
|
38
|
+
export type LANGS = keyof typeof langs;
|
|
39
|
+
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorUser, UploadResourceOptions, UploadResourceResult } from '../core/doc';
|
|
1
|
+
import { DocBlock, DocBlockDelta, DocBlockText, OnesEditorDocServerMeta, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorUser, UploadResourceOptions, UploadResourceResult } from '../core/doc';
|
|
2
2
|
import { EventCallbacks } from '../utils';
|
|
3
3
|
import { RemoteUsers } from '../users';
|
|
4
4
|
export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc {
|
|
5
5
|
doc: DocObject;
|
|
6
|
-
|
|
6
|
+
serviceUrl: string;
|
|
7
|
+
constructor(doc: DocObject | null, options?: {
|
|
8
|
+
serverUrl?: string;
|
|
9
|
+
});
|
|
7
10
|
beginBatchUpdate(): number;
|
|
8
11
|
endBatchUpdate(): number;
|
|
9
12
|
toJSON(): DocObject;
|
|
@@ -20,6 +23,7 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
|
|
|
20
23
|
buildResourceUrl(src: string): string;
|
|
21
24
|
request<T>(url: string, opt?: any): Promise<T>;
|
|
22
25
|
broadcastMessage(data: unknown): void;
|
|
26
|
+
getServerMeta(): OnesEditorDocServerMeta;
|
|
23
27
|
getUser(): OnesEditorUser;
|
|
24
28
|
getRemoteUsers(): RemoteUsers;
|
|
25
29
|
setDoc(doc: DocObject): void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export declare function getScrollContainer(element: HTMLElement
|
|
1
|
+
export declare function getScrollContainer(element: HTMLElement, options?: {
|
|
2
|
+
horizontal?: boolean;
|
|
3
|
+
}): HTMLElement;
|
|
2
4
|
export declare function disablePageScroll(id: string): void;
|
|
3
5
|
export declare function enablePageScroll(id: string): void;
|
|
@@ -26,4 +26,6 @@ export declare function getElementOffset(el: Element): {
|
|
|
26
26
|
left: number;
|
|
27
27
|
};
|
|
28
28
|
export declare function findTarget(event: Event, cssSelector: string): Element | null;
|
|
29
|
+
export declare function findEventTargetBlock(event: Event): Element | null;
|
|
30
|
+
export declare function isElementVisible(element: Element | null): boolean;
|
|
29
31
|
export {};
|
|
@@ -4,6 +4,7 @@ interface SelectFileOptions {
|
|
|
4
4
|
export declare function selectFile<T extends SelectFileOptions = SelectFileOptions>(accept: string, options?: T): Promise<T extends {
|
|
5
5
|
multiple: true;
|
|
6
6
|
} ? File[] : File>;
|
|
7
|
+
export declare function isDraggingFiles(v: unknown): v is File[];
|
|
7
8
|
export declare function getFileExt(file: string): string;
|
|
8
9
|
export declare function requestDownload(downloadUrl: string, fileName?: string): void;
|
|
9
10
|
export {};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
DEBUG = "DEBUG",
|
|
3
|
+
INFO = "INFO ",
|
|
4
|
+
WARN = "WARN ",
|
|
5
|
+
ERROR = "ERROR"
|
|
6
|
+
}
|
|
1
7
|
export declare class Logger {
|
|
2
8
|
private category;
|
|
3
9
|
private times;
|
|
10
|
+
static debugMode: boolean;
|
|
11
|
+
static level: LogLevel;
|
|
4
12
|
constructor(category: string);
|
|
13
|
+
shouldLog(level: LogLevel): boolean;
|
|
5
14
|
private _log;
|
|
6
15
|
log(msg: string | object, context?: string): void;
|
|
7
16
|
debug(msg: string | object, context?: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OnesEditor,
|
|
1
|
+
import type { OnesEditor, BlockElement } from '../../../../@ones-editor/core';
|
|
2
2
|
import { type EmbedElement, DrawIoData, GraphDataType, XmlData, XmlSvgData, SrcData, DrawIoOptions } from '../../types';
|
|
3
3
|
import '../../types/window.d';
|
|
4
4
|
export declare function getDrawioOptions(editor: OnesEditor): DrawIoOptions;
|
|
@@ -11,8 +11,8 @@ export declare function initializeDrawioIframe(editor: OnesEditor): Promise<{
|
|
|
11
11
|
drawioIframe: HTMLIFrameElement;
|
|
12
12
|
exit: () => void;
|
|
13
13
|
}>;
|
|
14
|
-
export declare function contactWithIframe(editor: OnesEditor, block:
|
|
15
|
-
export declare function editGraph(editor: OnesEditor, block:
|
|
14
|
+
export declare function contactWithIframe(editor: OnesEditor, block: BlockElement, drawIoData: DrawIoData, iframe: HTMLIFrameElement, loaded: () => void, exit: () => void, isInitializationCompleted: boolean): void;
|
|
15
|
+
export declare function editGraph(editor: OnesEditor, block: BlockElement, data: DrawIoData, isInitializationCompleted: boolean): Promise<void>;
|
|
16
16
|
export declare function initDrawIo(editor: OnesEditor): Promise<void>;
|
|
17
17
|
export declare function removeDrawioEmptyStatus(el: HTMLElement): void;
|
|
18
18
|
export declare function addDrawioEmptyStatus(el: HTMLElement): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type OnesEditor,
|
|
1
|
+
import { type OnesEditor, BlockElement } from '@ones-editor/core';
|
|
2
2
|
export type WithNull<T> = T | null;
|
|
3
3
|
export type EmbedElement = HTMLElement & {
|
|
4
4
|
__neverUse: 'EmbedElement';
|
|
@@ -34,6 +34,6 @@ export interface DrawIoOptions {
|
|
|
34
34
|
onError?: (editor: OnesEditor, error: Error) => void;
|
|
35
35
|
onCreateDrawIoFrame?: (editor: OnesEditor) => Promise<HTMLIFrameElement>;
|
|
36
36
|
onCloseDrawIoFrame?: (editor: OnesEditor, iframe: HTMLIFrameElement) => boolean;
|
|
37
|
-
onBeginInitDrawIo?: (editor: OnesEditor, block:
|
|
37
|
+
onBeginInitDrawIo?: (editor: OnesEditor, block: BlockElement) => void;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BlockElement, ContainerElement, OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
import DropIndicator from './drop-indicator';
|
|
3
3
|
export interface DropHandler {
|
|
4
|
-
handleDrop: (editor: OnesEditor,
|
|
4
|
+
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
|
|
5
5
|
}
|
|
6
6
|
export default class OnesEditorDropTarget {
|
|
7
7
|
private editor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OnesEditor, ContainerElement, BlockElement } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { DropHandler } from '../drop-target';
|
|
3
|
+
export declare class DropFileHandler implements DropHandler {
|
|
4
|
+
private editor;
|
|
5
|
+
constructor(editor: OnesEditor);
|
|
6
|
+
private getEmbedClassByFile;
|
|
7
|
+
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean;
|
|
8
|
+
}
|
|
@@ -8,10 +8,11 @@ export interface StandardEmbedBlockProperties<T = PresetCommandId> {
|
|
|
8
8
|
export declare function addCommentToBlock(editor: OnesEditor, block: BlockElement): boolean;
|
|
9
9
|
export declare class StandardEmbedBlockCommands<T = PresetCommandId> implements BlockCommands {
|
|
10
10
|
protected editor: OnesEditor;
|
|
11
|
+
protected block: BlockElement;
|
|
11
12
|
protected properties?: StandardEmbedBlockProperties<T> | undefined;
|
|
12
13
|
group: string;
|
|
14
|
+
constructor(editor: OnesEditor, block: BlockElement, properties?: StandardEmbedBlockProperties<T> | undefined);
|
|
13
15
|
_commands: CommandItem[];
|
|
14
|
-
constructor(editor: OnesEditor, properties?: StandardEmbedBlockProperties<T> | undefined);
|
|
15
16
|
get commands(): CommandItem[];
|
|
16
17
|
executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
|
|
17
18
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BlockElement, BlockPath, ContainerElement, DocBlock, OnesEditor, OnesEditorBlockHook } from '../../../@ones-editor/core';
|
|
2
|
+
export default class BlockExclusiveHook implements OnesEditorBlockHook {
|
|
3
|
+
writable(editor: OnesEditor, blockElement: BlockElement): boolean | undefined;
|
|
4
|
+
create(editor: OnesEditor, path: BlockPath, container: ContainerElement, blockElement: BlockElement, blockData: DocBlock): void;
|
|
5
|
+
update(editor: OnesEditor, path: BlockPath, container: ContainerElement, blockElement: BlockElement, blockData: DocBlock): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BlockElement, OnesEditor, OnesEditorCustom, OnesEditorDocCallbacks, OnesEditorUser } from '../../../@ones-editor/core';
|
|
2
|
+
import { ExclusiveBlockMessage } from './types';
|
|
3
|
+
export declare class OnesEditorExclusiveBlock implements OnesEditorCustom, OnesEditorDocCallbacks {
|
|
4
|
+
private editor;
|
|
5
|
+
exclusiveBlockIds: Set<string>;
|
|
6
|
+
exclusiveBlockTimer: number;
|
|
7
|
+
remoteExclusiveBlockIds: Map<string, ExclusiveBlockMessage>;
|
|
8
|
+
constructor(editor: OnesEditor);
|
|
9
|
+
destroy(): void;
|
|
10
|
+
onCustomMessage(msg: unknown): void;
|
|
11
|
+
handleUserChanged: (users: OnesEditorUser[]) => void;
|
|
12
|
+
getExclusiveMessage(blockId: string): ExclusiveBlockMessage | undefined;
|
|
13
|
+
broadcastExclusiveBlockMessage(blocks: BlockElement[], exclusive: boolean): void;
|
|
14
|
+
exclusiveBlock(block: BlockElement): void;
|
|
15
|
+
unexclusiveBlock(block: BlockElement): void;
|
|
16
|
+
startExclusiveBlockTimer(): void;
|
|
17
|
+
stopExclusiveBlockTimer(): void;
|
|
18
|
+
static get(editor: OnesEditor): OnesEditorExclusiveBlock;
|
|
19
|
+
static register(editor: OnesEditor): OnesEditorExclusiveBlock;
|
|
20
|
+
}
|
|
21
|
+
export declare function exclusiveBlock(editor: OnesEditor, block: BlockElement): void;
|
|
22
|
+
export declare function unexclusiveBlock(editor: OnesEditor, block: BlockElement): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BlockElement, OnesEditor } from '../../../@ones-editor/core';
|
|
2
|
+
export declare function addExclusiveStyle(block: BlockElement, userId: string, displayName: string): void;
|
|
3
|
+
export declare function removeExclusiveStyle(block: BlockElement): void;
|
|
4
|
+
export declare function updateBlockExclusive(editor: OnesEditor, block: BlockElement, exclusive: boolean, userId: string, displayName: string): void;
|
|
5
|
+
export declare function isExclusiveBlock(block: BlockElement): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OnesEditorExclusiveBlock } from './exclusive-block';
|
|
2
|
+
import BlockExclusiveHook from './exclusive-block-hook';
|
|
3
|
+
import './exclusive-block-styles.scss';
|
|
4
|
+
export { exclusiveBlock, unexclusiveBlock } from './exclusive-block';
|
|
5
|
+
export { BlockExclusiveHook, OnesEditorExclusiveBlock };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BlockContentElement } from '../../../../../@ones-editor/core';
|
|
1
|
+
import { OnesEditor, BlockContentElement } from '../../../../../@ones-editor/core';
|
|
2
2
|
import { FileEmbedData } from '../../types';
|
|
3
|
-
export declare function renderFileCard(content: BlockContentElement, data: FileEmbedData): {
|
|
3
|
+
export declare function renderFileCard(editor: OnesEditor, content: BlockContentElement, data: FileEmbedData): Promise<{
|
|
4
4
|
card: HTMLDivElement;
|
|
5
5
|
downloadButton: HTMLButtonElement;
|
|
6
|
-
}
|
|
6
|
+
}>;
|
|
@@ -19,4 +19,5 @@ export interface FileEmbedData extends DocEmbedData, FileData {
|
|
|
19
19
|
export interface FileOptions {
|
|
20
20
|
onClick?: (editor: OnesEditor, elem: BlockElement | BoxElement, event: MouseEvent) => void;
|
|
21
21
|
onDownloadFile?: (editor: OnesEditor, data: FileData) => void;
|
|
22
|
+
renderFileCardIcon?: (editor: OnesEditor, blockData: FileEmbedData) => Promise<false | HTMLImageElement>;
|
|
22
23
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BlockProperties } from '../../../../@ones-editor/core';
|
|
2
|
-
import type { OnesEditor, BlockContentElement, DocEmbedBlock, Logger } from '../../../../@ones-editor/core';
|
|
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;
|
|
6
6
|
private codeEmbedDataKey;
|
|
7
7
|
protected editor: OnesEditor;
|
|
8
8
|
logger: Logger;
|
|
9
|
+
editing: boolean;
|
|
9
10
|
constructor(editor: OnesEditor, graphType: GraphType, codeEmbedDataKey: string);
|
|
10
11
|
protected abstract code2ObjectUrl(code: string): Promise<string>;
|
|
11
12
|
protected abstract code2ResourceId(code: string): Promise<string>;
|
|
@@ -18,6 +19,6 @@ export default abstract class GraphBase {
|
|
|
18
19
|
protected updateImage(embed: HTMLDivElement, code: string | undefined, url: string | undefined | null, err: Error | null): Promise<void>;
|
|
19
20
|
protected updateClasses(embed: HTMLDivElement, code: string | undefined, err: Error | null): void;
|
|
20
21
|
editGraph(content: BlockContentElement): void;
|
|
21
|
-
getBlockProperties(properties?: GraphEmbedBlockProperties): BlockProperties;
|
|
22
|
+
getBlockProperties(block: BlockElement, properties?: GraphEmbedBlockProperties): BlockProperties;
|
|
22
23
|
private hasChanged;
|
|
23
24
|
}
|
|
@@ -6,14 +6,15 @@ export type GraphType = 'mermaid' | 'flowchart' | 'plantuml';
|
|
|
6
6
|
export type GraphEmbedBlockProperties = StandardEmbedBlockProperties<PresetCommandId>;
|
|
7
7
|
declare class GraphBlockCommands extends StandardEmbedBlockCommands<PresetCommandId> {
|
|
8
8
|
editor: OnesEditor;
|
|
9
|
+
block: BlockElement;
|
|
9
10
|
graphType: GraphType;
|
|
10
11
|
properties?: GraphEmbedBlockProperties | undefined;
|
|
11
12
|
group: string;
|
|
12
13
|
_commands: CommandItem[];
|
|
13
|
-
constructor(editor: OnesEditor, graphType: GraphType, properties?: GraphEmbedBlockProperties | undefined);
|
|
14
|
+
constructor(editor: OnesEditor, block: BlockElement, graphType: GraphType, properties?: GraphEmbedBlockProperties | undefined);
|
|
14
15
|
executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
|
|
15
16
|
}
|
|
16
|
-
export declare function getGraphEmbedBlockProperties(editor: OnesEditor, type: 'mermaid' | 'flowchart' | 'plantuml', properties?: GraphEmbedBlockProperties): {
|
|
17
|
+
export declare function getGraphEmbedBlockProperties(editor: OnesEditor, block: BlockElement, type: 'mermaid' | 'flowchart' | 'plantuml', properties?: GraphEmbedBlockProperties): {
|
|
17
18
|
blockCommands: {
|
|
18
19
|
'hovering-toolbar': GraphBlockCommands;
|
|
19
20
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropHandler } from '../../../../@ones-editor/drop-target';
|
|
2
2
|
import { OnesEditor, BlockElement, ContainerElement } from '../../../../@ones-editor/core';
|
|
3
3
|
export default class HeadingBlockDropHandler implements DropHandler {
|
|
4
|
-
handleDrop(editor: OnesEditor,
|
|
4
|
+
handleDrop(editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number): boolean | undefined;
|
|
5
5
|
}
|