@yoopta/editor 1.9.15-rc → 1.9.16-rc

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/dist/types.d.ts CHANGED
@@ -2,6 +2,7 @@ import { BaseEditor, BaseElement } from 'slate';
2
2
  import { ReactEditor, RenderElementProps as ElementProps } from 'slate-react';
3
3
  import { HistoryEditor } from 'slate-history';
4
4
  import { YooptaPluginType, YooptaRenderHTMLAttributes } from './utils/plugins';
5
+ import { CSSProperties } from 'react';
5
6
  export type EmptyText = {
6
7
  text: string;
7
8
  };
@@ -18,7 +19,18 @@ export type YooptaBaseElement<T> = {
18
19
  export type RenderYooptaElementProps<T extends BaseElement = BaseElement> = ElementProps & {
19
20
  element: T;
20
21
  } & YooptaRenderHTMLAttributes;
22
+ export type YooptaEditorValue<V> = V[];
23
+ export type YooptaBaseToolEvents = {
24
+ [x: string]: (...args: any) => void;
25
+ };
26
+ export type YooptaBaseToolProps<P extends YooptaPluginType = YooptaPluginType, Events extends YooptaBaseToolEvents = YooptaBaseToolEvents> = {
27
+ style?: CSSProperties;
28
+ className?: string;
29
+ plugins?: P[];
30
+ fromHook?: boolean;
31
+ on?: Events;
32
+ };
21
33
  export interface YooEditor extends BaseEditor, ReactEditor, HistoryEditor {
22
- shortcuts: Record<string, YooptaPluginType<string>>;
34
+ shortcuts: Record<string, YooptaPluginType>;
23
35
  plugins: Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>;
24
36
  }
@@ -12,10 +12,9 @@ export type DecoratorFn = (nodeEntry: NodeEntry) => Range[];
12
12
  export type YooptaPluginEventHandlers = {
13
13
  [key in keyof EditorEventHandlers]: (editor: YooEditor, options: HandlersOptions) => EditorEventHandlers[key] | void;
14
14
  };
15
- export type YooptaPluginBaseOptions = {
15
+ export type YooptaPluginBaseOptions = YooptaRenderHTMLAttributes & {
16
16
  searchString?: string;
17
17
  displayLabel?: string;
18
- [x: string]: any;
19
18
  };
20
19
  export type YooptaRenderElementFunc<P extends YooptaBaseElement<string> = YooptaBaseElement<string>> = (editor: YooEditor, plugin: YooptaPluginType) => (props: RenderYooptaElementProps<P> & YooptaRenderHTMLAttributes) => ReactElement;
21
20
  export type YooptaRender<P extends YooptaBaseElement<string>> = YooptaRenderElementFunc<P>;
@@ -71,7 +70,7 @@ export type YooptaPluginType<O extends YooptaPluginBaseOptions = YooptaPluginBas
71
70
  * The element's options object that can be extended with custom options for your plugin
72
71
  * Default options: HTMLAttributes
73
72
  */
74
- options?: O & YooptaRenderHTMLAttributes;
73
+ options?: O;
75
74
  /**
76
75
  *
77
76
  * @param editor
@@ -90,7 +89,7 @@ export type YooptaPluginType<O extends YooptaPluginBaseOptions = YooptaPluginBas
90
89
  createElement?: (editor: YooEditor, elementData?: Partial<P>) => void;
91
90
  defineElement: () => P;
92
91
  };
93
- export type ParentYooptaPlugin<O = YooptaPluginBaseOptions> = Omit<YooptaPluginType<O>, 'childPlugin' | 'hasParent'>;
92
+ export type ParentYooptaPlugin = Omit<YooptaPluginType, 'childPlugin' | 'hasParent'>;
94
93
  export declare class YooptaPlugin<O extends YooptaPluginBaseOptions, P extends YooptaBaseElement<string>> {
95
94
  #private;
96
95
  constructor(inputPlugin: YooptaPluginType<O, P>);
@@ -1,4 +1,4 @@
1
- import { Descendant } from 'slate';
1
+ import { YooptaEditorValue } from '../types';
2
2
  export type OFFLINE_STORAGE = boolean | string;
3
3
  export declare function getStorageName(offline?: OFFLINE_STORAGE): string;
4
- export declare function getInitialState(storageName: string, offline?: OFFLINE_STORAGE, value?: Descendant[]): Descendant[];
4
+ export declare function getInitialState<V>(storageName: string, offline?: OFFLINE_STORAGE, value?: YooptaEditorValue<V>): YooptaEditorValue<V>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/editor",
3
- "version": "1.9.15-rc",
3
+ "version": "1.9.16-rc",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "type": "module",