@univerjs/docs-ui 0.6.1 → 0.6.2

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.
@@ -23,7 +23,7 @@ export * from './basics/docs-view-key';
23
23
  export { hasParagraphInTable } from './basics/paragraph';
24
24
  export { docDrawingPositionToTransform, transformToDocDrawingPosition } from './basics/transform-position';
25
25
  export { type IKeyboardEventConfig, useKeyboardEvent, useResize } from './views/rich-text-editor/hooks';
26
- export { RichTextEditor } from './views/rich-text-editor';
26
+ export { type IRichTextEditorProps, RichTextEditor } from './views/rich-text-editor';
27
27
  export { getCommandSkeleton, getRichTextEditPath } from './commands/util';
28
28
  export { DocUIController } from './controllers/doc-ui.controller';
29
29
  export { menuSchema as DocsUIMenuSchema } from './controllers/menu.schema';
@@ -2,7 +2,7 @@ import { DocumentDataModel, ICommandService, IDocumentData, IPosition, IUndoRedo
2
2
  import { DocSelectionManagerService } from '@univerjs/docs';
3
3
  import { IDocSelectionInnerParam, IRender, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
4
4
  import { Observable } from 'rxjs';
5
- import { DocSelectionRenderService, IEditorInputConfig } from '../selection/doc-selection-render.service';
5
+ import { IEditorInputConfig, DocSelectionRenderService } from '../selection/doc-selection-render.service';
6
6
  interface IEditorEvent {
7
7
  target: IEditor;
8
8
  data: IDocumentData;
@@ -80,14 +80,14 @@ export declare class Editor extends Disposable implements IEditor {
80
80
  */
81
81
  blur(): void;
82
82
  select(): void;
83
- setSelectionRanges(ranges: ISuccinctDocRangeParam[]): void;
83
+ setSelectionRanges(ranges: ISuccinctDocRangeParam[], shouldFocus?: boolean): void;
84
84
  getSelectionRanges(): ITextRangeWithStyle[];
85
85
  getCursorPosition(): number;
86
86
  getEditorId(): string;
87
87
  getDocumentData(): IDocumentData;
88
88
  getDocumentDataModel(): DocumentDataModel;
89
89
  setDocumentData(data: IDocumentData, textRanges: Nullable<ITextRangeWithStyle[]>): void;
90
- replaceText(text: string, resetCursor?: boolean): void;
90
+ replaceText(text: string, resetCursor?: boolean | ITextRangeWithStyle[]): void;
91
91
  clearUndoRedoHistory(): void;
92
92
  dispose(): void;
93
93
  /**
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const DocFooter: () => import("react/jsx-runtime").JSX.Element;
16
+ export declare const DocFooter: () => import("react/jsx-runtime").JSX.Element | null;
@@ -3,7 +3,7 @@ import { RefObject } from 'react';
3
3
  import { Editor } from '../../../services/editor/editor';
4
4
  export interface IUseEditorProps {
5
5
  editorId: string;
6
- initialValue: Nullable<IDocumentData>;
6
+ initialValue: Nullable<IDocumentData | string>;
7
7
  container: RefObject<HTMLDivElement>;
8
8
  autoFocus?: boolean;
9
9
  isSingle?: boolean;
@@ -1,3 +1,3 @@
1
1
  import { IDocumentData } from '@univerjs/core';
2
2
  import { Editor } from '../../../services/editor/editor';
3
- export declare function useOnChange(editor: Editor | undefined, onChange: (data: IDocumentData) => void): void;
3
+ export declare function useOnChange(editor: Editor | undefined, onChange: (data: IDocumentData, str: string) => void): void;
@@ -1,12 +1,12 @@
1
1
  import { IDocumentData } from '@univerjs/core';
2
+ import { ReactNode, default as React } from 'react';
2
3
  import { Editor } from '../../services/editor/editor';
3
4
  import { IKeyboardEventConfig } from './hooks';
4
- import { default as React } from 'react';
5
5
  export interface IRichTextEditorProps {
6
6
  className?: string;
7
7
  autoFocus?: boolean;
8
- onFocusChange?: (isFocus: boolean) => void;
9
- initialValue?: IDocumentData;
8
+ onFocusChange?: (isFocus: boolean, newValue?: string) => void;
9
+ initialValue?: IDocumentData | string;
10
10
  onClickOutside?: () => void;
11
11
  keyboardEventConfig?: IKeyboardEventConfig;
12
12
  moveCursor?: boolean;
@@ -15,8 +15,10 @@ export interface IRichTextEditorProps {
15
15
  placeholder?: string;
16
16
  editorId?: string;
17
17
  onHeightChange?: (height: number) => void;
18
- onChange?: (data: IDocumentData) => void;
18
+ onChange?: (data: IDocumentData, str: string) => void;
19
19
  maxHeight?: number;
20
20
  defaultHeight?: number;
21
+ icon?: ReactNode;
22
+ editorRef?: React.RefObject<Editor | null> | ((editor: Editor | null) => void);
21
23
  }
22
- export declare const RichTextEditor: React.ForwardRefExoticComponent<IRichTextEditorProps & React.RefAttributes<Editor>>;
24
+ export declare const RichTextEditor: (props: IRichTextEditorProps) => import("react/jsx-runtime").JSX.Element;