@ones-editor/editor 2.1.7 → 2.1.8-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import './style.scss';
2
2
  import OnesEditorToolbar from './toolbar/toolbar-handler';
3
3
  import OnesEditorQuickMenu, { getAllQuickMenuItems, getHeadingMenuOptions, QuickMenuCommandBetween, QuickMenuCommandInline, QuickMenuCommandProvider, BasicCommands, GetAllQuickMenuItemsOptions, QuickMenuCommandParams, AddMenuCommand, QuickMenuItemFilter } from './quick-menu';
4
- import OnesEditorTooltip from './tooltips';
4
+ import OnesEditorTooltip, { OnesEditorTooltipCallbacks, EditorTooltipTippyInstance, OnesEditorTooltipProps } from './tooltips';
5
5
  import TextStyleShortcuts from './shortcuts';
6
6
  import { editLink } from './link-popup';
7
7
  import { getToolbar } from './toolbar/helper';
@@ -12,7 +12,7 @@ import { InlineBoxCommandProvider } from './quick-menu/inline-box-items';
12
12
  import './locale';
13
13
  import type { OnesEditorToolbarBase } from './toolbar/types';
14
14
  import type { QuickMenuItem } from './quick-menu';
15
- export type { QuickMenuItemFilter, QuickMenuCommandParams, QuickMenuCommandProvider, QuickMenuCommandBetween, AddMenuCommand, QuickMenuCommandInline, GetAllQuickMenuItemsOptions, OnesEditorToolbarBase, };
15
+ export type { QuickMenuItemFilter, QuickMenuCommandParams, QuickMenuCommandProvider, QuickMenuCommandBetween, AddMenuCommand, QuickMenuCommandInline, GetAllQuickMenuItemsOptions, OnesEditorToolbarBase, OnesEditorTooltipCallbacks, EditorTooltipTippyInstance, OnesEditorTooltipProps, };
16
16
  export { OnesEditorToolbar, OnesEditorQuickMenu, OnesEditorTooltip, getAllQuickMenuItems, QuickMenuItem, editLink, TextStyleShortcuts, getToolbar, getHeadingMenuOptions, BasicCommands, GroupOrder, isSelectBoxOnly, InlineBoxCommandProvider, getReferenceClientRect, };
17
17
  export { createTextButton } from './text-button';
18
18
  export { mergeCommands } from './toolbar/merge-commands';
@@ -1,16 +1,27 @@
1
- import { OnesEditor } from '../../../../@ones-editor/core';
2
- import { Instance } from 'tippy.js';
3
- export default class OnesEditorTooltip {
1
+ import { EventCallbacks, OnesEditor } from '../../../../@ones-editor/core';
2
+ import { delegate, DelegateInstance } from 'tippy.js';
3
+ export type OnesEditorTooltipCallbacks = {
4
+ onBeforeShow?: (instance: EditorTooltipTippyInstance) => void;
5
+ };
6
+ export type EditorTooltipTippyInstance = DelegateInstance;
7
+ export type OnesEditorTooltipProps = Omit<Parameters<typeof delegate>[1], 'onShow' | 'content' | 'onShown' | 'onHide' | 'target'>;
8
+ type DelegateProps = OnesEditorTooltipProps & {
9
+ attributeNames: string[];
10
+ };
11
+ type OnesEditorTooltipOptions = {
12
+ onBeforeTooltipInitialize?: (props: Partial<DelegateProps>) => DelegateProps;
13
+ };
14
+ export default class OnesEditorTooltip extends EventCallbacks<OnesEditorTooltipCallbacks> {
4
15
  private editor;
5
- instance: Instance;
16
+ instance: DelegateInstance;
6
17
  mousedown: boolean;
7
- currentInstance: Instance | null;
8
- attributeName: string[];
18
+ currentInstance: DelegateInstance | null;
19
+ attributeNames: string[];
9
20
  attributeDesc: string;
10
21
  private _lastClickButtonId;
11
22
  private observer;
12
23
  private observerCallback;
13
- constructor(editor: OnesEditor);
24
+ constructor(editor: OnesEditor, options?: OnesEditorTooltipOptions);
14
25
  set lastClickButtonId(value: string);
15
26
  createContent: (reference: Element) => string | HTMLDivElement;
16
27
  visible(): boolean | undefined;
@@ -20,9 +31,9 @@ export default class OnesEditorTooltip {
20
31
  private destroyObserver;
21
32
  handleDocumentMouseDown: () => void;
22
33
  handleDocumentMouseUp: () => void;
23
- handleShown: (a: Instance) => void;
34
+ handleShown: (a: DelegateInstance) => void;
24
35
  handleHidden: () => void;
25
- handleShow: (instance: Instance) => boolean;
36
+ handleShow: (instance: DelegateInstance) => boolean;
26
37
  private fixContainerForFullscreen;
27
38
  }
28
39
  declare global {
@@ -30,3 +41,4 @@ declare global {
30
41
  isDragging?: boolean;
31
42
  }
32
43
  }
44
+ export {};
@@ -7,3 +7,4 @@ export declare enum HistoryClass {
7
7
  }
8
8
  export declare const OpColor = "--op-color";
9
9
  export declare const OpSelectedColor = "--op-selected-color";
10
+ export declare const HISTORY_TOOLTIP_IDENTIFIER = "data-history-editor-tooltip";
@@ -1,4 +1,4 @@
1
- import { BlockElement, BlockPath, DocBlock, DocBlockTextAttributes, OnesEditor, OnesEditorBlockRenderer, OnesEditorBlockRenderResult } from '../../../../@ones-editor/core';
1
+ import type { BlockElement, BlockPath, DocBlock, DocBlockTextAttributes, OnesEditor, OnesEditorBlockRenderer, OnesEditorBlockRenderResult } from '../../../../@ones-editor/core';
2
2
  export default class OnesEditorHistoryRender implements OnesEditorBlockRenderer {
3
3
  renderBox(editor: OnesEditor, path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
4
4
  renderText(editor: OnesEditor, path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
@@ -0,0 +1,10 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ import { OnesEditorTooltipCallbacks, EditorTooltipTippyInstance } from '../../../../@ones-editor/ui';
3
+ import './index.scss';
4
+ export declare class OnesEditorHistoryTooltip implements OnesEditorTooltipCallbacks {
5
+ static register(editor: OnesEditor): void;
6
+ private createContent;
7
+ private getReferenceClientRect;
8
+ private getPropsFromDifferentBlock;
9
+ onBeforeShow: (instance: EditorTooltipTippyInstance) => void;
10
+ }
@@ -12,6 +12,7 @@ export declare class OnesEditorVersionsDialog implements OnesEditorCustom {
12
12
  get versionHelper(): import("@ones-editor/core").OnesEditorDocVersionHelper;
13
13
  get editor(): OnesEditor | null;
14
14
  constructor(server: OnesEditorDocServer, provider: OnesEditorVersionsProvider);
15
+ private handleBeforeShowTooltip;
15
16
  private handleRevert;
16
17
  private handleSelectVersion;
17
18
  private handleCompareWithVersion;