@ones-editor/editor 2.0.5-beta.28 → 2.0.5-beta.30

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.
Files changed (122) hide show
  1. package/@ones-editor/block-menu/src/block-menu/items/insert-block-items/index.d.ts +1 -1
  2. package/@ones-editor/block-menu/src/block-menu-button/drag-preview/element-to-data-url.d.ts +1 -1
  3. package/@ones-editor/block-menu/src/block-menu-button/index.d.ts +4 -15
  4. package/@ones-editor/block-menu/src/block-menu-button/menu-button/index.d.ts +23 -0
  5. package/@ones-editor/callout-block/package.json +11 -0
  6. package/@ones-editor/callout-block/src/callout-block/callout-block-content.d.ts +3 -0
  7. package/@ones-editor/callout-block/src/callout-block/callout-block-doc.d.ts +2 -0
  8. package/@ones-editor/callout-block/src/callout-block/callout-block.d.ts +3 -0
  9. package/@ones-editor/callout-block/src/callout-block/callout-converter-interceptor.d.ts +8 -0
  10. package/@ones-editor/callout-block/src/callout-block/callout-drop-target-finder.d.ts +10 -0
  11. package/@ones-editor/callout-block/src/callout-block/callout-input-handler.d.ts +11 -0
  12. package/@ones-editor/callout-block/src/callout-block/callout-last-callout-payload.d.ts +9 -0
  13. package/@ones-editor/callout-block/src/callout-block/callout-options.d.ts +2 -0
  14. package/@ones-editor/callout-block/src/callout-block/callout-properties.d.ts +2 -0
  15. package/@ones-editor/callout-block/src/callout-block/callout-quick-menu-item-filter.d.ts +8 -0
  16. package/@ones-editor/callout-block/src/callout-block/command-items/bg-color-item.d.ts +22 -0
  17. package/@ones-editor/callout-block/src/callout-block/command-items/delete-icon-item.d.ts +3 -0
  18. package/@ones-editor/callout-block/src/callout-block/command-items/preset-item.d.ts +16 -0
  19. package/@ones-editor/callout-block/src/callout-block/converter.d.ts +3 -0
  20. package/@ones-editor/callout-block/src/callout-block/helper.d.ts +4 -0
  21. package/@ones-editor/callout-block/src/callout-block/index.d.ts +1 -0
  22. package/@ones-editor/callout-block/src/callout-block/types.d.ts +9 -0
  23. package/@ones-editor/callout-block/src/index.d.ts +3 -0
  24. package/@ones-editor/callout-block/src/locale/en-us.d.ts +12 -0
  25. package/@ones-editor/callout-block/src/locale/index.d.ts +1 -0
  26. package/@ones-editor/callout-block/src/locale/ja-jp.d.ts +12 -0
  27. package/@ones-editor/callout-block/src/locale/zh-cn.d.ts +12 -0
  28. package/@ones-editor/core/src/core/blocks/common/block-wrapper.d.ts +2 -1
  29. package/@ones-editor/core/src/core/blocks/common/insert-empty-block.d.ts +3 -2
  30. package/@ones-editor/core/src/core/blocks/embed-blocks/embed-block/common.d.ts +1 -0
  31. package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -1
  32. package/@ones-editor/core/src/core/containers/children.d.ts +5 -2
  33. package/@ones-editor/core/src/core/containers/element.d.ts +1 -0
  34. package/@ones-editor/core/src/core/doc/container.d.ts +2 -2
  35. package/@ones-editor/core/src/core/editor/actions/insert-doc/insert-doc.d.ts +1 -1
  36. package/@ones-editor/core/src/core/editor-doc/handle-block-data-changed.d.ts +2 -1
  37. package/@ones-editor/core/src/core/selection/editor-selection.d.ts +1 -3
  38. package/@ones-editor/core/src/core/types.d.ts +58 -10
  39. package/@ones-editor/core/src/helper/hovering-block.d.ts +3 -1
  40. package/@ones-editor/drop-target/src/drop-indicator.d.ts +3 -2
  41. package/@ones-editor/drop-target/src/drop-target.d.ts +8 -1
  42. package/@ones-editor/drop-target/src/find-drop-target.d.ts +1 -1
  43. package/@ones-editor/drop-target/src/index.d.ts +3 -1
  44. package/@ones-editor/find-dialog/src/shortcuts.d.ts +0 -2
  45. package/@ones-editor/heading-collapse/src/heading-collapse-button/heading-utils.d.ts +2 -1
  46. package/@ones-editor/heading-collapse/src/index.d.ts +1 -0
  47. package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +1 -4
  48. package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +1 -0
  49. package/@ones-editor/image-embed/src/hovering-toolbar/index.d.ts +22 -0
  50. package/@ones-editor/image-embed/src/image-object.d.ts +3 -0
  51. package/@ones-editor/image-embed/src/index.d.ts +5 -1
  52. package/@ones-editor/image-embed/src/types.d.ts +1 -0
  53. package/@ones-editor/input-handlers/src/enforce-with-document-title/enforce-with-document-title-handler.d.ts +0 -1
  54. package/@ones-editor/input-handlers/src/enforce-with-document-title/placeholder.d.ts +0 -1
  55. package/@ones-editor/input-handlers/src/index.d.ts +4 -1
  56. package/@ones-editor/input-handlers/src/markdown-shortcuts/converter-interceptors.d.ts +12 -0
  57. package/@ones-editor/input-handlers/src/markdown-shortcuts/match-block-convert.d.ts +9 -1
  58. package/@ones-editor/{column-block → layout-block}/package.json +1 -1
  59. package/@ones-editor/layout-block/src/block-drop.d.ts +3 -0
  60. package/@ones-editor/layout-block/src/caption.d.ts +8 -0
  61. package/@ones-editor/layout-block/src/child-containers.d.ts +3 -0
  62. package/@ones-editor/layout-block/src/column-resizer/index.d.ts +2 -0
  63. package/@ones-editor/layout-block/src/constants.d.ts +32 -0
  64. package/@ones-editor/layout-block/src/index.d.ts +6 -0
  65. package/@ones-editor/layout-block/src/layout-creator/index.d.ts +27 -0
  66. package/@ones-editor/layout-block/src/layout-operations.d.ts +11 -0
  67. package/@ones-editor/layout-block/src/locale/en-us.d.ts +10 -0
  68. package/@ones-editor/layout-block/src/locale/index.d.ts +1 -0
  69. package/@ones-editor/layout-block/src/locale/ja-jp.d.ts +10 -0
  70. package/@ones-editor/layout-block/src/locale/zh-cn.d.ts +10 -0
  71. package/@ones-editor/layout-block/src/options.d.ts +2 -0
  72. package/@ones-editor/layout-block/src/percent-bar.d.ts +3 -0
  73. package/@ones-editor/layout-block/src/selection.d.ts +5 -0
  74. package/@ones-editor/layout-block/src/toolbar.d.ts +33 -0
  75. package/@ones-editor/layout-block/src/types.d.ts +17 -0
  76. package/@ones-editor/layout-block/src/utils.d.ts +6 -0
  77. package/@ones-editor/media-embed/src/core/hovering-toolbar/index.d.ts +22 -0
  78. package/@ones-editor/paste-special/src/paste-special-handler.d.ts +1 -0
  79. package/@ones-editor/table-block/src/index.d.ts +1 -0
  80. package/@ones-editor/table-block/src/table-block/table-creator/index.d.ts +1 -1
  81. package/@ones-editor/to-docx/src/doc2other/colors.d.ts +7 -1
  82. package/@ones-editor/to-docx/src/doc2other/core.d.ts +2 -0
  83. package/@ones-editor/to-docx/src/doc2other/layout.d.ts +10 -0
  84. package/@ones-editor/toc/src/build-toc.d.ts +1 -0
  85. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  86. package/@ones-editor/ui/src/index.d.ts +2 -2
  87. package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +1 -1
  88. package/@ones-editor/ui/src/quick-menu/index.d.ts +9 -2
  89. package/@ones-editor/ui/src/quick-menu/quick-menu-items.d.ts +4 -2
  90. package/@ones-editor/ui/src/quick-menu/types.d.ts +5 -0
  91. package/@ones-editor/ui-base/src/color-palette/color-palette.d.ts +2 -1
  92. package/@ones-editor/ui-base/src/color-palette/create-palette.d.ts +8 -0
  93. package/@ones-editor/ui-base/src/color-palette/index.d.ts +2 -2
  94. package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -0
  95. package/@ones-editor/ui-base/src/emoji-item/emoji-item.d.ts +19 -0
  96. package/@ones-editor/ui-base/src/emoji-item/index.d.ts +2 -0
  97. package/@ones-editor/ui-base/src/emoji-palette/emoji-content.d.ts +21 -0
  98. package/@ones-editor/ui-base/src/emoji-palette/emoji-data.d.ts +60 -0
  99. package/@ones-editor/ui-base/src/emoji-palette/emoji-navigation.d.ts +16 -0
  100. package/@ones-editor/ui-base/src/emoji-palette/emoji-search.d.ts +11 -0
  101. package/@ones-editor/ui-base/src/emoji-palette/index.d.ts +23 -0
  102. package/@ones-editor/ui-base/src/emoji-palette/types.d.ts +0 -0
  103. package/@ones-editor/ui-base/src/icons/index.d.ts +19 -1
  104. package/@ones-editor/ui-base/src/index.d.ts +1 -0
  105. package/@ones-editor/ui-base/src/input/create-input.d.ts +1 -0
  106. package/@ones-editor/ui-base/src/locale/en-us.d.ts +20 -0
  107. package/@ones-editor/ui-base/src/locale/ja-jp.d.ts +20 -0
  108. package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +20 -0
  109. package/@ones-editor/versions/src/types.d.ts +1 -1
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.js +303 -212
  112. package/dist/lang/en-us.d.ts +1 -0
  113. package/dist/lang/ja-jp.d.ts +1 -0
  114. package/dist/lang/zh-cn.d.ts +1 -0
  115. package/dist/types.d.ts +2 -0
  116. package/package.json +1 -1
  117. package/@ones-editor/column-block/src/child-containers.d.ts +0 -2
  118. package/@ones-editor/column-block/src/columns-options.d.ts +0 -2
  119. package/@ones-editor/column-block/src/columns-properties.d.ts +0 -15
  120. package/@ones-editor/column-block/src/index.d.ts +0 -4
  121. package/@ones-editor/column-block/src/types.d.ts +0 -11
  122. package/@ones-editor/list-block/src/converter/selection-to-doc.d.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  import { BlockElement, OnesEditor } from '../../../../../../@ones-editor/core';
2
2
  import type { GetAllQuickMenuItemsOptions } from '../../../../../../@ones-editor/ui';
3
3
  import type { BlockMenuItem } from '../types';
4
- export declare function getAllInsertBlockItems(editor: OnesEditor, source: 'insert-block' | 'insert-block-before', options: GetAllQuickMenuItemsOptions): BlockMenuItem[];
4
+ export declare function getAllInsertBlockItems(editor: OnesEditor, block: BlockElement, source: 'insert-block' | 'insert-block-before', options: GetAllQuickMenuItemsOptions): BlockMenuItem[];
5
5
  export declare function executeInsertBlockCommand(editor: OnesEditor, block: BlockElement, item: BlockMenuItem, insertAbove?: boolean): Promise<BlockElement | null> | undefined;
@@ -1,2 +1,2 @@
1
1
  import { OnesEditor } from '../../../../../@ones-editor/core';
2
- export declare function elementToDataUrl(editor: OnesEditor, element: HTMLElement): Promise<string>;
2
+ export declare function elementToDataUrl(editor: OnesEditor, element: HTMLElement, marginIncluded?: boolean): Promise<string>;
@@ -1,19 +1,8 @@
1
- import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
2
- import EmptyBlockMenu from '../empty-block-menu';
3
- import BlockMenu from '../block-menu';
4
- export default class OnesEditorBlockMenuButton {
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ import OnesEditorBlockMenuButton from './menu-button';
3
+ export default class OnesEditorBlockMenuButtons {
5
4
  private editor;
6
- buttonElement: HTMLButtonElement;
7
- emptyBlockMenu: EmptyBlockMenu;
8
- blockMenu: BlockMenu;
9
- private dragHandler;
5
+ rootButton: OnesEditorBlockMenuButton;
10
6
  constructor(editor: OnesEditor);
11
7
  destroy(): void;
12
- handleHoverBlock: (hoverBlock: BlockElement | null, oldBlock: BlockElement | null, event: MouseEvent) => void;
13
- handleButtonClick: () => void;
14
- updatePlaceholder: (block: BlockElement) => void;
15
- handleChanged: () => void;
16
- createButton(): HTMLButtonElement;
17
- setButtonType(type: 'move' | 'insert'): void;
18
- updateButton(block: BlockElement): void;
19
8
  }
@@ -0,0 +1,23 @@
1
+ import { BlockElement, OnesEditor } from '../../../../../@ones-editor/core';
2
+ import EmptyBlockMenu from '../../empty-block-menu';
3
+ import BlockMenu from '../../block-menu';
4
+ export default class OnesEditorBlockMenuButton {
5
+ private editor;
6
+ buttonElement: HTMLButtonElement;
7
+ emptyBlockMenu: EmptyBlockMenu;
8
+ blockMenu: BlockMenu;
9
+ private dragHandler;
10
+ constructor(editor: OnesEditor);
11
+ destroy(): void;
12
+ handleHoverBlock: (hoverBlock: BlockElement | null, oldBlock: BlockElement | null, target: EventTarget | null, oldTarget: EventTarget | null) => void;
13
+ showRootButton(hoverBlock: BlockElement): void;
14
+ showParentButton(hoverBlock: BlockElement): boolean;
15
+ removeParentButton: () => void;
16
+ addButtonToView(block: BlockElement): void;
17
+ handleButtonClick: () => void;
18
+ updatePlaceholder: (block: BlockElement) => void;
19
+ handleChanged: () => void;
20
+ createButton(): HTMLButtonElement;
21
+ setButtonType(type: 'move' | 'insert'): void;
22
+ updateButton(block: BlockElement): void;
23
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@ones-editor/callout-block",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "main": "./src/index.ts",
7
+ "devDependencies": {
8
+ "@types/lodash.isequal": "^4.5.7"
9
+ },
10
+ "types": "src/index.d.ts"
11
+ }
@@ -0,0 +1,3 @@
1
+ import type { OnesEditor, BlockPath, BlockElement } from '../../../../@ones-editor/core';
2
+ import type { DocCalloutBlockData } from './types';
3
+ export declare function createCalloutBlockContent(editor: OnesEditor, path: BlockPath, blockElement: BlockElement, blockData: DocCalloutBlockData): import("@ones-editor/core").BlockContentElement;
@@ -0,0 +1,2 @@
1
+ import { DocCalloutBlockData } from './types';
2
+ export declare function isCalloutBlockData(v: unknown): v is DocCalloutBlockData;
@@ -0,0 +1,3 @@
1
+ import type { ComplexKindBlock } from '../../../../@ones-editor/core';
2
+ declare const CalloutBlock: ComplexKindBlock;
3
+ export { CalloutBlock, };
@@ -0,0 +1,8 @@
1
+ import { BlockConverter, ConverterInterceptor } from '../../../../@ones-editor/input-handlers';
2
+ import { OnesEditor, BlockElement, OnesEditorCustom } from '../../../../@ones-editor/core';
3
+ export declare class CalloutConverterInterceptor implements ConverterInterceptor, OnesEditorCustom {
4
+ constructor(editor: OnesEditor);
5
+ handler(editor: OnesEditor, block: BlockElement, converter: BlockConverter): boolean;
6
+ destroy(): void;
7
+ static init(editor: OnesEditor): CalloutConverterInterceptor;
8
+ }
@@ -0,0 +1,10 @@
1
+ import { DropTargetFinder } from '../../../../@ones-editor/drop-target';
2
+ import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
3
+ export declare class CalloutDropTargetFinder implements DropTargetFinder {
4
+ private editor;
5
+ constructor(editor: OnesEditor);
6
+ private checkBlockAllowToDrop;
7
+ finder(editor: OnesEditor, source: BlockElement | null, x: number, y: number): BlockElement | null;
8
+ destroy(): void;
9
+ static init(editor: OnesEditor): CalloutDropTargetFinder;
10
+ }
@@ -0,0 +1,11 @@
1
+ import type { OnesEditorInputHandler, OnesEditor, OnesEditorCustom, DocObject } from '../../../../@ones-editor/core';
2
+ export declare class CalloutInputHandler implements OnesEditorInputHandler, OnesEditorCustom {
3
+ constructor(editor: OnesEditor);
4
+ private pasteHasForbidden;
5
+ private handleBackspaceEvent;
6
+ handleBeforeKeyDown(editor: OnesEditor, event: KeyboardEvent): boolean;
7
+ handleBeforePasteDoc(editor: OnesEditor, doc: DocObject): Promise<boolean>;
8
+ handleAfterPaste(): Promise<boolean>;
9
+ destroy(): void;
10
+ static init(editor: OnesEditor): void;
11
+ }
@@ -0,0 +1,9 @@
1
+ import { OnesEditor, OnesEditorCustom } from '../../../../@ones-editor/core';
2
+ import { CalloutBlockPayload } from './types';
3
+ export declare class CalloutLastUpdateData implements OnesEditorCustom {
4
+ private lastCalloutBlockPayload;
5
+ get(): CalloutBlockPayload;
6
+ update(payload: Partial<CalloutBlockPayload>): void;
7
+ destroy(): void;
8
+ static init(editor: OnesEditor): CalloutLastUpdateData;
9
+ }
@@ -0,0 +1,2 @@
1
+ import { BlockOptions } from '../../../../@ones-editor/core';
2
+ export declare function getOptions(): BlockOptions;
@@ -0,0 +1,2 @@
1
+ import type { OnesEditor, BlockProperties } from '../../../../@ones-editor/core';
2
+ export declare function getBlockProperties(editor: OnesEditor): BlockProperties;
@@ -0,0 +1,8 @@
1
+ import { OnesEditor, OnesEditorCustom } from '../../../../@ones-editor/core';
2
+ import type { QuickMenuItem, QuickMenuItemFilter } from '../../../../@ones-editor/ui';
3
+ export declare class CalloutQuickMenuItemFilter implements QuickMenuItemFilter, OnesEditorCustom {
4
+ constructor(editor: OnesEditor);
5
+ filter(editor: OnesEditor, items: QuickMenuItem[], from: string): QuickMenuItem[];
6
+ destroy(): void;
7
+ static init(editor: OnesEditor): CalloutQuickMenuItemFilter;
8
+ }
@@ -0,0 +1,22 @@
1
+ import { BlockElement, CommandItem, OnesEditor, OnesEditorCustom } from '../../../../../@ones-editor/core';
2
+ import { ColorPaletteItem } from '../../../../../@ones-editor/ui-base';
3
+ import { ColorId } from '../types';
4
+ export declare class BgColorItem implements CommandItem, OnesEditorCustom {
5
+ private editor;
6
+ id: string;
7
+ name: string;
8
+ manualShowChildren: boolean;
9
+ dropdown: boolean;
10
+ childrenPlacement: "bottom-start";
11
+ private bgColorButton;
12
+ bgColorPaletteItem: ColorPaletteItem;
13
+ element: HTMLButtonElement;
14
+ children: CommandItem[];
15
+ private constructor();
16
+ private createPaletteButton;
17
+ private getBgColorFromBlock;
18
+ updateButtonColor(bgColor: ColorId): void;
19
+ updateItem(block: BlockElement): void;
20
+ destroy(): void;
21
+ static get(editor: OnesEditor): BgColorItem;
22
+ }
@@ -0,0 +1,3 @@
1
+ import { BlockElement, CommandItem, OnesEditor } from '../../../../../@ones-editor/core';
2
+ export declare const EMPTY_ICON = "";
3
+ export declare function createDeleteIconItem(editor: OnesEditor, block: BlockElement): CommandItem;
@@ -0,0 +1,16 @@
1
+ import { BlockElement, CommandItem, OnesEditor } from '../../../../../@ones-editor/core';
2
+ import { CalloutBlockPayload } from '../types';
3
+ export type PresetId = `preset-${0 | 1}`;
4
+ type Preset = CalloutBlockPayload & {
5
+ name: string;
6
+ };
7
+ export declare function isPresetId(id: string): id is PresetId;
8
+ export declare function getPresetId(id: PresetId): string;
9
+ export declare function getPreset(id: PresetId): Preset;
10
+ export declare function getPresetIcon(id: string): string;
11
+ export declare function getPresetPayload(presetId: PresetId): {
12
+ backgroundColor: number;
13
+ icon: "preset-0" | "preset-1";
14
+ };
15
+ export declare function createPresetItem(presetId: PresetId, editor: OnesEditor, block: BlockElement): CommandItem;
16
+ export {};
@@ -0,0 +1,3 @@
1
+ import { OnesEditor, DocBlock, DocObject, BlockPath } from '../../../../@ones-editor/core';
2
+ export declare function toStandardDoc(editor: OnesEditor, blockData: DocBlock, doc: DocObject): Promise<DocObject>;
3
+ export declare function convertTo(editor: OnesEditor, blockData: DocBlock, doc: DocObject, type: 'text' | 'html' | 'markdown', path: BlockPath): string;
@@ -0,0 +1,4 @@
1
+ import { DocBlock } from '../../../../@ones-editor/core';
2
+ import { ColorId } from './types';
3
+ export declare function checkBlockAllowInCallout(block: DocBlock): boolean;
4
+ export declare function getHexBackgroundColor(backgroundColor: ColorId): string;
@@ -0,0 +1 @@
1
+ export { CalloutBlock } from './callout-block';
@@ -0,0 +1,9 @@
1
+ import { DocBlock } from '../../../../@ones-editor/core';
2
+ export type ColorId = number;
3
+ export interface DocCalloutBlockData extends DocBlock {
4
+ type: 'callout';
5
+ icon: string;
6
+ backgroundColor: ColorId;
7
+ children: string[];
8
+ }
9
+ export type CalloutBlockPayload = Pick<DocCalloutBlockData, 'icon' | 'backgroundColor'>;
@@ -0,0 +1,3 @@
1
+ import './index.scss';
2
+ import './locale';
3
+ export { CalloutBlock } from './callout-block';
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ callout: {
3
+ name: string;
4
+ command: {
5
+ presetInfo: string;
6
+ presetAlert: string;
7
+ clearEmoji: string;
8
+ background: string;
9
+ };
10
+ };
11
+ };
12
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ callout: {
3
+ name: string;
4
+ command: {
5
+ presetInfo: string;
6
+ presetAlert: string;
7
+ clearEmoji: string;
8
+ background: string;
9
+ };
10
+ };
11
+ };
12
+ export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ callout: {
3
+ name: string;
4
+ command: {
5
+ presetInfo: string;
6
+ presetAlert: string;
7
+ clearEmoji: string;
8
+ background: string;
9
+ };
10
+ };
11
+ };
12
+ export default _default;
@@ -1,9 +1,10 @@
1
- import { OnesEditor, BlockElement, BlockPosition, ConvertBlockResult, SelectionRange, BlockStyles } from '../../types';
1
+ import { OnesEditor, BlockElement, BlockPosition, ConvertBlockResult, SelectionRange, BlockStyles, ContainerElement } from '../../types';
2
2
  import { DocBlock, DocBlockAttributes } from '../../doc';
3
3
  export declare function getBlockTextLength(editor: OnesEditor, block: BlockElement): number;
4
4
  export declare function clearAllSelection(editor: OnesEditor): void;
5
5
  export declare function updateBlockSelection(editor: OnesEditor, block: BlockElement, from: BlockPosition, to: BlockPosition): void;
6
6
  export declare function getRootBlock(block: BlockElement): BlockElement;
7
+ export declare function getClosestContainerByCondition(_block: BlockElement, condition: (container: ContainerElement) => boolean): BlockElement | undefined;
7
8
  export declare function getBlockMinWidth(editor: OnesEditor, block: BlockElement): number | undefined;
8
9
  export declare function handleBlockElementUpdated(editor: OnesEditor, block: BlockElement, data: DocBlock): void;
9
10
  export declare function convertBlockFrom(editor: OnesEditor, block: BlockElement, type: string, options: {
@@ -1,3 +1,4 @@
1
- import { OnesEditor } from '../../types';
1
+ import { ContainerBlockOverrideInsertEmptyBlockInsideOptions, OnesEditor } from '../../types';
2
+ export declare function getContainerBlockOverrideOptions(editor: OnesEditor, containerID: string, blockType?: string): ContainerBlockOverrideInsertEmptyBlockInsideOptions | undefined;
2
3
  export declare function insertEmptyEmbedBlock(editor: OnesEditor, embedType: string, containerId: string, blockIndex: number, data?: Record<string, unknown>): Promise<import("../../types").BlockElement | null>;
3
- export declare function insertEmptyBlock(editor: OnesEditor, type: string, containerId: string, blockIndex: number, data?: Record<string, unknown>): Promise<import("../../types").BlockElement | null> | null;
4
+ export declare function insertEmptyBlock(editor: OnesEditor, type: string, containerId: string, blockIndex: number, data?: Record<string, unknown>, item?: Record<string, unknown>): Promise<import("../../types").BlockElement | null> | null;
@@ -1,3 +1,4 @@
1
1
  import { BlockElement } from '../../../types';
2
+ export declare function isColumnsBlock(block: BlockElement): boolean;
2
3
  export declare function isEmbedBlock(block: BlockElement): boolean;
3
4
  export declare function getEmbedType(block: BlockElement): string;
@@ -27,7 +27,7 @@ export declare class EditorInput implements OnesEditorInput {
27
27
  callbacks: EditorInputCallbacks;
28
28
  inputElement: HTMLInputElement;
29
29
  constructor(editor: OnesEditor, callbacks: EditorInputCallbacks);
30
- private isInCommandbar;
30
+ private isInCommandBar;
31
31
  destroy(): void;
32
32
  getInput(): HTMLInputElement;
33
33
  focus(): void;
@@ -1,5 +1,8 @@
1
- import { BlockElement, ContainerElement } from '../types';
2
- export declare function getChildBlocks(container: ContainerElement): BlockElement[];
1
+ import { BlockElement, ContainerElement, OnesEditor } from '../types';
2
+ export declare function getChildBlocks(container: ContainerElement, traverseChild?: {
3
+ condition: (block: BlockElement) => boolean;
4
+ editor: OnesEditor;
5
+ }): BlockElement[];
3
6
  export declare function getFirstChildBlock(container: ContainerElement): BlockElement;
4
7
  export declare function getLastChildBlock(container: ContainerElement): BlockElement;
5
8
  export declare function getChildBlockCount(container: ContainerElement): number;
@@ -4,3 +4,4 @@ export declare function getContainerById(editor: OnesEditor, containerId: string
4
4
  export declare function getExistsContainerById(editor: OnesEditor, containerId: string): ContainerElement | null;
5
5
  export declare function getContainerBlocksElement(container: ContainerElement): ContainerBlocksElement;
6
6
  export declare function getContainerToolsElement(container: ContainerElement): ContainerToolsElement;
7
+ export declare function isContainerBlocksElement(element: Element): element is ContainerBlocksElement;
@@ -1,3 +1,3 @@
1
- import { DocBlock, OnesEditorDoc } from './doc';
2
- export declare function createContainer(doc: OnesEditorDoc, blocks: DocBlock[]): string;
1
+ import { DocBlock, DocObject, OnesEditorDoc } from './doc';
2
+ export declare function createContainer(doc: OnesEditorDoc, docsOrDocObject: DocBlock[] | DocObject): string;
3
3
  export declare function createEmptyContainer(doc: OnesEditorDoc, text?: string): string;
@@ -1,4 +1,4 @@
1
1
  import { DocObject } from '../../../doc';
2
2
  import { BlockElement, CloneBlockResultInfo, ContainerElement, OnesEditor } from '../../../types';
3
3
  export declare function editorInsertDoc(editor: OnesEditor, block: BlockElement, offset: number, insertedDoc: DocObject, cloneDocResult?: CloneBlockResultInfo): void;
4
- export declare function editorInsertDocAt(editor: OnesEditor, container: ContainerElement, blockIndex: number, insertedDoc: DocObject, cloneDocResult?: CloneBlockResultInfo): BlockElement[];
4
+ export declare function editorInsertDocAt(editor: OnesEditor, container: ContainerElement, blockIndex: number, _docToInsert: DocObject, cloneDocResult?: CloneBlockResultInfo): BlockElement[];
@@ -1,2 +1,3 @@
1
+ import type { DocBlockDelta } from '../doc';
1
2
  import { OnesEditor } from '../types';
2
- export declare function onBlockDataChanged(editor: OnesEditor, containerId: string, blockIndex: number): void;
3
+ export declare function onBlockDataChanged(editor: OnesEditor, containerId: string, blockIndex: number, delta?: DocBlockDelta): void;
@@ -17,9 +17,7 @@ export declare class EditorSelection implements OnesEditorSelection {
17
17
  selectBlock(block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions): void;
18
18
  setSelection(anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions): SelectionRange;
19
19
  setRange(range: SelectionRange, options?: ChangeSelectionOptions): SelectionRange;
20
- updateSelection(oldRange: SelectionRange | null, options?: {
21
- focusBlockChanged: boolean;
22
- }): void;
20
+ updateSelection(): void;
23
21
  getFocusedPos(): BlockPosition;
24
22
  getAnchorPos(): BlockPosition;
25
23
  selectionChanging(anchor: BlockPosition, focus: BlockPosition): boolean;
@@ -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 } from './doc';
2
+ import { DocBlock, DocBlockAttributes, DocBlockDelta, 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
  };
@@ -118,6 +118,7 @@ export interface Closeable {
118
118
  click: (item: CommandItem, target: HTMLElement) => void;
119
119
  }
120
120
  export type CommandItemChildrenPlacement = 'auto' | 'top' | 'left' | 'right' | 'bottom' | 'auto-start' | 'auto-end' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end';
121
+ export type CommandItemMenuType = 'inline' | 'sibling';
121
122
  export interface CommandItem {
122
123
  id: string;
123
124
  name: string;
@@ -147,6 +148,10 @@ export interface CommandItem {
147
148
  hideGroupItem?: boolean;
148
149
  setCloseable?: (closeable: Closeable) => void;
149
150
  beforePopup?: (parent: unknown) => void;
151
+ /**
152
+ * defaults to true
153
+ */
154
+ shouldShown?: (currentBlock: BlockElement | undefined, menuType: CommandItemMenuType) => boolean;
150
155
  }
151
156
  export interface BlockCommandItem extends CommandItem {
152
157
  blockId: string;
@@ -172,10 +177,47 @@ export interface BlockProperties {
172
177
  blockCommands?: Record<string, BlockCommands>;
173
178
  abstract?: string;
174
179
  }
180
+ export interface DropHandler {
181
+ handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
182
+ }
183
+ export interface CombineToCreateOptions {
184
+ /**
185
+ * @returns sideway: 两侧合并(左右 indicator)
186
+ *
187
+ * body: 中间合并(target block 激活)(暂未实现)
188
+ */
189
+ combinable: (editor: OnesEditor, source: BlockElement, target: BlockElement) => undefined | 'sideway' | 'body';
190
+ onCombine: (editor: OnesEditor, source: BlockElement, target: BlockElement, position: CombineDropInsertPos['pos'], dragObject: DragObject | null, handlers: DropHandler[]) => BlockElement | undefined;
191
+ }
192
+ export type ContainerBlockOverrideInsertEmptyBlockInsideOptionsDict = Record<string, ContainerBlockOverrideInsertEmptyBlockInsideOptions>;
193
+ export type ContainerBlockOverrideInsertEmptyBlockInsideOptions = {
194
+ item?: CommandItem;
195
+ data?: Record<string, unknown>;
196
+ };
175
197
  export interface BlockOptions {
176
198
  name: string;
177
199
  insertBlockCommandItems?: CommandItem[];
200
+ overrideInertEmptyBlockInsideOptions?: ContainerBlockOverrideInsertEmptyBlockInsideOptionsDict;
178
201
  handleInsertEmptyBlock?: (editor: OnesEditor, options: InsertEmptyBlockOptions) => Promise<BlockElement | null>;
202
+ isMenuButtonBaseContainer?: (container: ContainerElement) => boolean;
203
+ combineToCreate?: CombineToCreateOptions;
204
+ /**
205
+ * defaults to true.
206
+ *
207
+ * 'without-margin': include margin for dragging preview computing.
208
+ */
209
+ draggingPreview?: boolean | 'margin-included';
210
+ innerToc?: boolean;
211
+ blockMenu?: {
212
+ showComment?: boolean;
213
+ showLocker?: boolean;
214
+ };
215
+ findPreviewElement?: (editor: OnesEditor, complexBlock: BlockElement) => HTMLElement;
216
+ headingCollapsable?: boolean;
217
+ /**
218
+ * 拖拽时,是否显示缩略图容器自带的阴影,默认为 false
219
+ */
220
+ previewNoShadow?: boolean;
179
221
  }
180
222
  export interface StandardDragObject {
181
223
  type: 'block';
@@ -193,10 +235,17 @@ export interface CustomDragObject {
193
235
  }
194
236
  export type DragObject = StandardDragObject | CustomDragObject;
195
237
  export interface CustomDropInsertPos {
238
+ type: 'custom';
196
239
  rect: DOMRect;
197
240
  data: unknown;
241
+ targetBlock?: BlockElement;
198
242
  }
199
- export type DropInsertPos = 'before' | 'after' | CustomDropInsertPos;
243
+ export type CombineDropInsertPos = {
244
+ type: 'combine';
245
+ pos: 'left' | 'right';
246
+ onCombine: CombineToCreateOptions['onCombine'];
247
+ };
248
+ export type DropInsertPos = 'before' | 'after' | CombineDropInsertPos | CustomDropInsertPos;
200
249
  export interface DropOptions {
201
250
  isSourceBlock: boolean;
202
251
  targetBlock: BlockElement;
@@ -217,9 +266,9 @@ export interface Block {
217
266
  handleBlockElementUpdated?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => void;
218
267
  handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
219
268
  handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
220
- handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
269
+ handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock, delta?: DocBlockDelta) => boolean;
221
270
  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: DropInsertPos, options: DropOptions) => boolean | undefined;
271
+ handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | ContainerElement | undefined;
223
272
  getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
224
273
  getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
225
274
  convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
@@ -230,7 +279,7 @@ export interface Block {
230
279
  convertTo?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, type: 'text' | 'html' | 'markdown', path: BlockPath) => string;
231
280
  toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
232
281
  getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
233
- blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
282
+ blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject, cloneDocResult?: CloneBlockResultInfo) => DocObject;
234
283
  getResources?: (editor: OnesEditor, data: DocBlock) => string[] | null;
235
284
  replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
236
285
  }
@@ -258,6 +307,7 @@ export interface ComplexKindBlock extends Block {
258
307
  getTextToolbarReferenceClient?: (editor: OnesEditor, complexBlock: BlockElement) => DOMRect | undefined;
259
308
  isChildContainerVisible?: (editor: OnesEditor, complexBlock: BlockElement, childContainer: ContainerElement) => boolean;
260
309
  showChildContainer?: (editor: OnesEditor, complexBlock: BlockElement, childContainer: ContainerElement) => void;
310
+ beforeInsertDoc?: (editor: OnesEditor, container: ContainerElement, insertDoc: DocObject) => DocObject | undefined;
261
311
  }
262
312
  export interface SelectedBlock {
263
313
  block: BlockElement;
@@ -446,7 +496,7 @@ export declare class OnesEditorCustomDataWrapper<T> {
446
496
  getEditor(): OnesEditor;
447
497
  destroy(): void;
448
498
  }
449
- export type OnesEditorCustomCreator = (editor: OnesEditor) => OnesEditorCustom;
499
+ export type OnesEditorCustomCreator<T extends OnesEditorCustom = OnesEditorCustom> = (editor: OnesEditor) => T;
450
500
  export interface CloneBlockResultInfo {
451
501
  containerIdMap: Map<string, string>;
452
502
  blockIdMap: Map<string, string>;
@@ -487,7 +537,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
487
537
  readonly settingsProvider: OnesEditorSettingsProvider;
488
538
  version: string;
489
539
  readonly: boolean;
490
- addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
540
+ addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator<T>) => T;
491
541
  getCustom: <T extends OnesEditorCustom>(name: string) => T;
492
542
  replaceCustom: <T extends OnesEditorCustom>(name: string, newCustom: T) => T;
493
543
  findCustom: <T extends OnesEditorCustom>(name: string) => T | null;
@@ -568,9 +618,7 @@ export interface OnesEditorSelection {
568
618
  setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
569
619
  setRange: (range: SelectionRange, options?: ChangeSelectionOptions) => SelectionRange;
570
620
  selectBlock: (block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions) => void;
571
- updateSelection: (old: SelectionRange | null, options?: {
572
- focusBlockChanged: boolean;
573
- }) => void;
621
+ updateSelection: (old: SelectionRange | null) => void;
574
622
  updateLastCaretRect: () => void;
575
623
  getSuggestedCaretX: () => number | undefined;
576
624
  getAnchorPos: () => BlockPosition;
@@ -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;
@@ -1,4 +1,4 @@
1
- import { BlockElement, DropInsertPos, OnesEditor } from '../../../@ones-editor/core';
1
+ import { BlockContentElement, BlockElement, DropInsertPos, OnesEditor } from '../../../@ones-editor/core';
2
2
  export declare const INDICATOR_SIZE = 2;
3
3
  interface DropTarget {
4
4
  block: BlockElement;
@@ -9,9 +9,10 @@ export default class DropIndicator {
9
9
  private indicator;
10
10
  target: DropTarget | null;
11
11
  constructor(editor: OnesEditor);
12
+ createIndicator(): void;
12
13
  show(block: BlockElement, insertPos: DropInsertPos): 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,8 +1,12 @@
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;
5
5
  }
6
+ export type DropTargetFinderId = keyof any;
7
+ export interface DropTargetFinder {
8
+ finder: (editor: OnesEditor, source: BlockElement | null, x: number, y: number) => BlockElement | null;
9
+ }
6
10
  export default class OnesEditorDropTarget {
7
11
  private editor;
8
12
  indicator: DropIndicator;
@@ -12,9 +16,12 @@ export default class OnesEditorDropTarget {
12
16
  dropEffect: 'move' | 'none';
13
17
  } | undefined;
14
18
  handlers: DropHandler[];
19
+ dropTargetFinders: Map<string | number | symbol, DropTargetFinder>;
20
+ combineToCreate: CombineToCreateOptions[];
15
21
  constructor(editor: OnesEditor);
16
22
  destroy(): void;
17
23
  addHandler(handler: DropHandler): void;
24
+ addFinder(id: DropTargetFinderId, finder: DropTargetFinder): void;
18
25
  static register(editor: OnesEditor): OnesEditorDropTarget;
19
26
  static get(editor: OnesEditor): OnesEditorDropTarget;
20
27
  static find(editor: OnesEditor): OnesEditorDropTarget | null;
@@ -1,3 +1,3 @@
1
1
  import { BlockElement, OnesEditor } from '../../../@ones-editor/core';
2
- export declare function findTargetBlock(editor: OnesEditor, x: number, y: number): BlockElement | null;
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,7 @@
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';
5
+ export type { DropTargetFinder, DropTargetFinderId } from './drop-target';
4
6
  export * from './drag-object';
5
- export { OnesEditorDropTarget, DropHandler, patchInsertFile };
7
+ export { OnesEditorDropTarget, DropHandler, patchInsertFile, INDICATOR_SIZE };
@@ -1,9 +1,7 @@
1
1
  import { OnesEditor } from '../../../@ones-editor/core';
2
2
  import './locale';
3
3
  export declare function handleFindReplace(editor: OnesEditor): boolean;
4
- declare function handleReplaceAndFind(editor: OnesEditor): boolean;
5
4
  declare const FindReplaceShortcuts: {
6
5
  'CtrlOrCmd+F': typeof handleFindReplace;
7
- 'CtrlOrCmd+Shift+H': typeof handleReplaceAndFind;
8
6
  };
9
7
  export { FindReplaceShortcuts, };
@@ -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;
@@ -3,3 +3,4 @@ import './style.scss';
3
3
  export * from './heading-collapse-button';
4
4
  export * from './keyboard';
5
5
  export * from './doc-event';
6
+ export { isHeadingCollapsed } from './doc-event/collapse-handler';