@univerjs/docs-ui 0.5.4 → 0.5.5-experimental.20250122-3362a4a

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 (58) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +23 -30
  3. package/lib/cjs/locale/en-US.js +1 -1
  4. package/lib/cjs/locale/fa-IR.js +1 -1
  5. package/lib/cjs/locale/fr-FR.js +1 -1
  6. package/lib/cjs/locale/ru-RU.js +1 -1
  7. package/lib/cjs/locale/vi-VN.js +1 -1
  8. package/lib/cjs/locale/zh-CN.js +1 -1
  9. package/lib/cjs/locale/zh-TW.js +1 -1
  10. package/lib/es/facade.js +61 -58
  11. package/lib/es/index.js +7679 -7808
  12. package/lib/es/locale/en-US.js +2 -2
  13. package/lib/es/locale/fa-IR.js +2 -2
  14. package/lib/es/locale/fr-FR.js +2 -2
  15. package/lib/es/locale/ru-RU.js +2 -2
  16. package/lib/es/locale/vi-VN.js +2 -2
  17. package/lib/es/locale/zh-CN.js +2 -2
  18. package/lib/es/locale/zh-TW.js +2 -2
  19. package/lib/index.css +1 -1
  20. package/lib/types/basics/custom-decoration-factory.d.ts +1 -0
  21. package/lib/types/basics/paragraph.d.ts +1 -1
  22. package/lib/types/commands/commands/replace-content.command.d.ts +1 -0
  23. package/lib/types/components/list-type-picker/picker.d.ts +3 -4
  24. package/lib/types/controllers/doc-container-ui-controller.d.ts +1 -1
  25. package/lib/types/controllers/render-controllers/doc-editor-bridge.controller.d.ts +0 -3
  26. package/lib/types/facade/f-document.d.ts +3 -0
  27. package/lib/types/index.d.ts +3 -2
  28. package/lib/types/services/editor/editor-manager.service.d.ts +5 -177
  29. package/lib/types/services/editor/editor.d.ts +15 -77
  30. package/lib/types/services/selection/doc-selection-render.service.d.ts +7 -10
  31. package/lib/types/views/count-bar/CountBar.d.ts +16 -2
  32. package/lib/types/views/count-bar/ZoomSlider.d.ts +16 -2
  33. package/lib/types/views/doc-container/DocContainer.d.ts +5 -5
  34. package/lib/types/views/doc-footer/DocFooter.d.ts +16 -2
  35. package/lib/types/views/header-footer/panel/DocHeaderFooterOptions.d.ts +16 -2
  36. package/lib/types/views/header-footer/panel/DocHeaderFooterPanel.d.ts +16 -2
  37. package/lib/types/views/paragraph-setting/Setting.d.ts +1 -2
  38. package/lib/types/views/paragraph-setting/index.d.ts +16 -2
  39. package/lib/types/views/rich-text-editor/hooks/index.d.ts +17 -0
  40. package/lib/types/views/rich-text-editor/hooks/useEditor.d.ts +11 -0
  41. package/lib/types/views/rich-text-editor/hooks/useKeyboardEvent.d.ts +10 -0
  42. package/lib/types/views/rich-text-editor/hooks/useLeftAndRightArrow.d.ts +3 -0
  43. package/lib/types/views/rich-text-editor/hooks/useOnChange.d.ts +3 -0
  44. package/lib/types/views/rich-text-editor/index.d.ts +22 -0
  45. package/lib/types/views/table/create/TableCreate.d.ts +16 -2
  46. package/lib/umd/facade.js +1 -1
  47. package/lib/umd/index.js +23 -30
  48. package/lib/umd/locale/en-US.js +1 -1
  49. package/lib/umd/locale/fa-IR.js +1 -1
  50. package/lib/umd/locale/fr-FR.js +1 -1
  51. package/lib/umd/locale/ru-RU.js +1 -1
  52. package/lib/umd/locale/vi-VN.js +1 -1
  53. package/lib/umd/locale/zh-CN.js +1 -1
  54. package/lib/umd/locale/zh-TW.js +1 -1
  55. package/package.json +10 -11
  56. package/LICENSE +0 -176
  57. package/lib/types/components/editor/TextEditor.d.ts +0 -36
  58. package/lib/types/components/range-selector/RangeSelector.d.ts +0 -24
@@ -1,4 +1,4 @@
1
- const e = {
1
+ const locale = {
2
2
  toolbar: {
3
3
  undo: "Undo",
4
4
  redo: "Redo",
@@ -81,5 +81,5 @@ const e = {
81
81
  }
82
82
  };
83
83
  export {
84
- e as default
84
+ locale as default
85
85
  };
@@ -1,4 +1,4 @@
1
- const e = {
1
+ const locale = {
2
2
  toolbar: {
3
3
  undo: "بازگرداندن",
4
4
  redo: "تکرار",
@@ -81,5 +81,5 @@ const e = {
81
81
  }
82
82
  };
83
83
  export {
84
- e as default
84
+ locale as default
85
85
  };
@@ -1,4 +1,4 @@
1
- const e = {
1
+ const locale = {
2
2
  toolbar: {
3
3
  undo: "Annuler",
4
4
  redo: "Rétablir",
@@ -81,5 +81,5 @@ const e = {
81
81
  }
82
82
  };
83
83
  export {
84
- e as default
84
+ locale as default
85
85
  };
@@ -1,4 +1,4 @@
1
- const e = {
1
+ const locale = {
2
2
  toolbar: {
3
3
  undo: "Отменить",
4
4
  redo: "Повторить",
@@ -81,5 +81,5 @@ const e = {
81
81
  }
82
82
  };
83
83
  export {
84
- e as default
84
+ locale as default
85
85
  };
@@ -1,4 +1,4 @@
1
- const n = {
1
+ const locale = {
2
2
  toolbar: {
3
3
  undo: "Hoàn tác",
4
4
  redo: "Làm lại",
@@ -81,5 +81,5 @@ const n = {
81
81
  }
82
82
  };
83
83
  export {
84
- n as default
84
+ locale as default
85
85
  };
@@ -1,4 +1,4 @@
1
- const e = {
1
+ const locale = {
2
2
  toolbar: {
3
3
  undo: "撤销",
4
4
  redo: "重做",
@@ -81,5 +81,5 @@ const e = {
81
81
  }
82
82
  };
83
83
  export {
84
- e as default
84
+ locale as default
85
85
  };
@@ -1,4 +1,4 @@
1
- const e = {
1
+ const locale = {
2
2
  toolbar: {
3
3
  undo: "撤銷",
4
4
  redo: "重做",
@@ -81,5 +81,5 @@ const e = {
81
81
  }
82
82
  };
83
83
  export {
84
- e as default
84
+ locale as default
85
85
  };
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-text-editor-container{position:relative;width:100%;height:30px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border:1px solid rgb(var(--border-color));transition:all .15s;border-radius:var(--border-radius-base)}.univer-text-editor-container:hover,.univer-text-editor-container:active,.univer-text-editor-container-active,.univer-text-editor-container-active:hover{border:1px solid rgb(var(--hyacinth-500))}.univer-text-editor-container-error,.univer-text-editor-container-error:hover{border:1px solid rgb(var(--red-400))}.univer-text-editor-container-disabled,.univer-text-editor-container-disabled:hover{border-color:rgb(var(--grey-100))}.univer-text-editor-container-placeholder{position:absolute;top:49%;left:5px;transform:translateY(-50%);color:rgb(var(--grey-400));font-size:var(--font-size-xs);pointer-events:none}.univer-text-editor-validation-error{position:absolute;top:-16px;font-size:10px;color:rgb(var(--red-400))}.univer-range-selector{overflow:hidden;display:flex;align-items:center;justify-content:space-between;color:rgb(var(--grey-600));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);width:220px;height:28px}.univer-range-selector-editor{position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%;height:100%;border:0;outline:0}.univer-range-selector-icon{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-right:4px;font-size:var(--font-size-lg);color:rgb(var(--text-color));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none}.univer-range-selector-icon:not([disabled]):hover{background-color:rgb(var(--grey-100))}.univer-range-selector-icon[disabled]{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-range-selector:hover,.univer-range-selector-active{border-color:rgb(var(--hyacinth-500))}.univer-range-selector-active .univer-range-selector-icon{color:rgb(var(--hyacinth-500))}.univer-range-selector-error{border-color:rgb(var(--red-400))}.univer-range-selector-error .univer-range-selector-icon{color:rgb(var(--red-400))}.univer-range-selector-error:hover{border-color:rgb(var(--red-400))}.univer-range-selector-disabled{border-color:rgb(var(--grey-100))}.univer-range-selector-disabled .univer-range-selector-icon{color:rgb(var(--grey-100))}.univer-range-selector-disabled:hover{border-color:rgb(var(--grey-100))}.univer-range-selector-modal{position:relative;max-height:500px;overflow:hidden;overflow-y:auto}.univer-range-selector-modal-container{display:flex;flex-direction:row;align-items:center;margin-bottom:10px}.univer-range-selector-modal-container-input{display:inline-block;width:280px}.univer-range-selector-modal-container-input-active{border-color:rgb(var(--hyacinth-500))}.univer-range-selector-modal-container-button{display:inline-block;text-align:center;width:28px}.univer-range-selector-modal-container-button:hover{cursor:pointer;color:rgb(var(--hyacinth-500))}.univer-range-selector-modal-container-delete-button{margin:auto}.univer-range-selector-modal-add{position:relative;width:300px;margin-top:5px;text-align:left;color:rgb(var(--hyacinth-500));font-size:var(--font-size-xs)}.univer-range-selector-modal-add .univer-range-selector-modal-add-button{display:flex;align-items:center;justify-content:center}.univer-range-selector-modal-add .univer-range-selector-modal-add-button:hover{cursor:pointer;background-color:rgb(var(--hyacinth-500),.05)}.univer-panel{padding-top:20px;font-size:var(--font-size-sm)}.univer-options-section{margin-top:10px;padding-bottom:10px}.univer-options-form-item{display:block;margin-bottom:5px}.univer-options-input{width:80%;margin-top:5px}.univer-options-margin-setting{display:flex}.univer-doc-list-type-picker{display:flex;flex-direction:row;justify-content:space-between;flex-wrap:wrap;padding:var(--padding-sm);width:240px;margin-bottom:-var(--margin-xs)}.univer-doc-list-type-picker-item{width:72px;height:81px;border-radius:4px;border:1px solid rgb(var(--border-color));margin-bottom:var(--margin-xs)}.univer-doc-list-type-picker-item:hover,.univer-doc-list-type-picker-item-active{border:1px solid rgb(var(--blue-400))}.univer-doc-count-bar{display:flex;flex:0 0 260px;justify-content:flex-end}.univer-doc-footer-container{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0 var(--padding-xl)}.univer-paragraph-setting-icon-list{display:flex;width:100%;padding:4px;align-items:center;gap:4px;justify-content:space-between;border:1px solid var(---Grey-200, #e5e5e5);border-radius:var(--radius-m, 6px)}.univer-paragraph-setting-icon-list-item{padding:4px 14px;border-radius:4px;background:none;display:flex;justify-content:center;align-items:center;cursor:pointer}.univer-paragraph-setting-icon-list-item:hover{background:var(--black-6, rgba(30, 34, 43, .06))}.univer-paragraph-setting-icon-list-item.univer-paragraph-setting-icon-list-active{background:var(--black-9, rgba(30, 34, 43, .09))}.univer-paragraph-setting-title{margin-top:var(--margin-base);font-size:13px;color:#1e222b;font-weight:500}.univer-paragraph-setting-label{font-size:12px;margin-top:var(--margin-sm);color:#1e222b;font-weight:400}.univer-paragraph-setting-mt-base{margin-top:var(--margin-base)}.univer-paragraph-setting-flex-col{display:flex;justify-content:space-between;align-items:center}.univer-paragraph-setting-space-line{display:flex;flex-direction:column;gap:6px}.univer-create{padding:20px auto;display:flex;align-content:center;justify-content:space-between}.univer-create-item{display:flex;align-items:center}.univer-create-label{margin-right:5px}.univer-create-input{width:110px}
1
+ .univer-rich-text-editor-active{border-color:rgb(var(--hyacinth-500))!important}.univer-rich-text-editor-wrap{height:32px;padding:6px 8px 2px 6px;width:100%;display:flex;justify-content:space-around;align-items:center;gap:8px;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);box-sizing:border-box;position:relative}.univer-rich-text-editor-wrap .univer-rich-text-editor-text{width:100%;height:100%;position:relative}.univer-rich-text-editor-wrap .univer-rich-text-editor-error-wrap{font-size:12px;color:rgb(var(--red-500));position:absolute;bottom:-18px;left:0}.univer-rich-text-editor-placeholder{font-size:14px;color:rgb(var(--grey-500));position:absolute;left:5px;top:5px}.univer-panel{padding-top:20px;font-size:var(--font-size-sm)}.univer-options-section{margin-top:10px;padding-bottom:10px}.univer-options-form-item{display:block;margin-bottom:5px}.univer-options-input{width:80%;margin-top:5px}.univer-options-margin-setting{display:flex}.univer-doc-list-type-picker{display:flex;flex-direction:row;justify-content:space-between;flex-wrap:wrap;padding:var(--padding-sm);width:240px;margin-bottom:-var(--margin-xs)}.univer-doc-list-type-picker-item{width:72px;height:81px;border-radius:4px;border:1px solid rgb(var(--border-color));margin-bottom:var(--margin-xs)}.univer-doc-list-type-picker-item:hover,.univer-doc-list-type-picker-item-active{border:1px solid rgb(var(--blue-400))}.univer-doc-count-bar{display:flex;flex:0 0 260px;justify-content:flex-end}.univer-doc-footer-container{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0 var(--padding-xl)}.univer-paragraph-setting-icon-list{display:flex;width:100%;padding:4px;align-items:center;gap:4px;justify-content:space-between;border:1px solid #e5e5e5;border:1px solid var(---Grey-200, #e5e5e5);border-radius:6px;border-radius:var(--radius-m, 6px)}.univer-paragraph-setting-icon-list-item{padding:4px 14px;border-radius:4px;background:none;display:flex;justify-content:center;align-items:center;cursor:pointer}.univer-paragraph-setting-icon-list-item:hover{background:#1e222b0f;background:var(--black-6, rgba(30, 34, 43, .06))}.univer-paragraph-setting-icon-list-item.univer-paragraph-setting-icon-list-active{background:#1e222b17;background:var(--black-9, rgba(30, 34, 43, .09))}.univer-paragraph-setting-title{margin-top:var(--margin-base);font-size:13px;color:#1e222b;font-weight:500}.univer-paragraph-setting-label{font-size:12px;margin-top:var(--margin-sm);color:#1e222b;font-weight:400}.univer-paragraph-setting-mt-base{margin-top:var(--margin-base)}.univer-paragraph-setting-flex-col{display:flex;justify-content:space-between;align-items:center}.univer-paragraph-setting-space-line{display:flex;flex-direction:column;gap:6px}.univer-create{padding:20px auto;display:flex;align-content:center;justify-content:space-between}.univer-create-item{display:flex;align-items:center}.univer-create-label{margin-right:5px}.univer-create-input{width:110px}
@@ -13,6 +13,7 @@ interface IAddCustomDecorationFactoryParam {
13
13
  segmentId?: string;
14
14
  id: string;
15
15
  type: CustomDecorationType;
16
+ unitId?: string;
16
17
  }
17
18
  export declare function addCustomDecorationBySelectionFactory(accessor: IAccessor, param: IAddCustomDecorationFactoryParam): false | IMutationInfo<IRichTextEditingMutationParams>;
18
19
  export interface IDeleteCustomRangeParam {
@@ -1,5 +1,5 @@
1
1
  import { ICustomDecoration, ICustomRange, ICustomTable, IParagraph, ITextRun, ITextStyle, Nullable } from '@univerjs/core';
2
2
  export declare function hasParagraphInTable(paragraph: IParagraph, tables: ICustomTable[]): boolean;
3
3
  export declare function getTextRunAtPosition(textRuns: ITextRun[], position: number, defaultStyle: ITextStyle, cacheStyle: Nullable<ITextStyle>): ITextRun;
4
- export declare function getCustomRangeAtPosition(customRanges: ICustomRange[], position: number, extendRange?: boolean): ICustomRange<Record<string, any>> | undefined;
4
+ export declare function getCustomRangeAtPosition(customRanges: ICustomRange[], position: number, extendRange?: boolean): ICustomRange<Record<string, any>> | null | undefined;
5
5
  export declare function getCustomDecorationAtPosition(customDecorations: ICustomDecoration[], position: number): ICustomDecoration[];
@@ -36,4 +36,5 @@ export interface IReplaceSelectionCommandParams {
36
36
  textRanges?: ITextRangeWithStyle[];
37
37
  }
38
38
  export declare const ReplaceSelectionCommand: ICommand<IReplaceSelectionCommandParams>;
39
+ export declare const ReplaceTextRunsCommand: ICommand<IReplaceContentCommandParams>;
39
40
  export {};
@@ -1,5 +1,4 @@
1
1
  import { PresetListType } from '@univerjs/core';
2
- import { default as React } from 'react';
3
2
  export interface IListTypePickerBaseProps {
4
3
  value?: PresetListType;
5
4
  onChange: (value: PresetListType | undefined) => void;
@@ -10,7 +9,7 @@ interface IListTypePickerProps extends IListTypePickerBaseProps {
10
9
  img: string;
11
10
  }[];
12
11
  }
13
- export declare const ListTypePicker: (props: IListTypePickerProps) => React.JSX.Element;
14
- export declare const OrderListTypePicker: (props: IListTypePickerBaseProps) => React.JSX.Element;
15
- export declare const BulletListTypePicker: (props: IListTypePickerBaseProps) => React.JSX.Element;
12
+ export declare const ListTypePicker: (props: IListTypePickerProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const OrderListTypePicker: (props: IListTypePickerBaseProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const BulletListTypePicker: (props: IListTypePickerBaseProps) => import("react/jsx-runtime").JSX.Element;
16
15
  export {};
@@ -22,7 +22,7 @@ export declare class DocContainerUIController {
22
22
  *
23
23
  */
24
24
  changeLocale: (locale: string) => void;
25
- getContentRef(): import('react').RefObject<HTMLDivElement>;
25
+ getContentRef(): import('react').RefObject<HTMLDivElement | null>;
26
26
  UIDidMount(cb: Function): any;
27
27
  getDocContainer(): DocContainer | undefined;
28
28
  }
@@ -15,11 +15,8 @@ export declare class DocEditorBridgeController extends Disposable implements IRe
15
15
  constructor(_context: IRenderContext<DocumentDataModel>, _univerInstanceService: IUniverInstanceService, _editorService: IEditorService, _commandService: ICommandService, _docSelectionRenderService: DocSelectionRenderService, _docSkeletonManagerService: DocSkeletonManagerService, _renderManagerService: IRenderManagerService);
16
16
  private _initialize;
17
17
  private _resize;
18
- private _initialSetValue;
19
18
  private _initialBlur;
20
19
  private _initialFocus;
21
- private _initialValueChange;
22
- private _valueChange;
23
20
  /**
24
21
  * Listen to document edits to refresh the size of the formula editor.
25
22
  */
@@ -1,5 +1,8 @@
1
1
  import { DocumentDataModel, IDocumentData, ICommandService, Injector, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IRenderManagerService } from '@univerjs/engine-render';
3
+ /**
4
+ * @hideconstructor
5
+ */
3
6
  export declare class FDocument {
4
7
  private readonly _documentDataModel;
5
8
  protected readonly _injector: Injector;
@@ -22,9 +22,9 @@ export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, dele
22
22
  export * from './basics/docs-view-key';
23
23
  export { hasParagraphInTable } from './basics/paragraph';
24
24
  export { docDrawingPositionToTransform, transformToDocDrawingPosition } from './basics/transform-position';
25
+ export { type IKeyboardEventConfig, useKeyboardEvent, useResize } from './views/rich-text-editor/hooks';
26
+ export { RichTextEditor } from './views/rich-text-editor';
25
27
  export { getCommandSkeleton, getRichTextEditPath } from './commands/util';
26
- export { TextEditor } from './components/editor/TextEditor';
27
- export { RangeSelector as DocRangeSelector } from './components/range-selector/RangeSelector';
28
28
  export { DocUIController } from './controllers/doc-ui.controller';
29
29
  export { menuSchema as DocsUIMenuSchema } from './controllers/menu.schema';
30
30
  export { DocBackScrollRenderController } from './controllers/render-controllers/back-scroll.render-controller';
@@ -67,6 +67,7 @@ export { getParagraphsInRange, getParagraphsInRanges } from './commands/commands
67
67
  export { BulletListCommand, ChangeListNestingLevelCommand, ChangeListTypeCommand, CheckListCommand, ListOperationCommand, OrderListCommand, QuickListCommand, ToggleCheckListCommand, } from './commands/commands/list.command';
68
68
  export { ChangeListNestingLevelType } from './commands/commands/list.command';
69
69
  export { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand, } from './commands/commands/paragraph-align.command';
70
+ export { ReplaceTextRunsCommand } from './commands/commands/replace-content.command';
70
71
  export { CoverContentCommand, type IReplaceSelectionCommandParams, type IReplaceSnapshotCommandParams, ReplaceContentCommand, ReplaceSnapshotCommand } from './commands/commands/replace-content.command';
71
72
  export { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
72
73
  export { CreateDocTableCommand, type ICreateDocTableCommandParams } from './commands/commands/table/doc-table-create.command';
@@ -1,9 +1,8 @@
1
1
  import { IDisposable, IDocumentBody, Nullable, Disposable, ICommandService, IContextService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { ISuccinctDocRangeParam, IRenderManagerService } from '@univerjs/engine-render';
3
3
  import { Observable } from 'rxjs';
4
- import { IEditorConfigParams, IEditorStateParams, Editor } from './editor';
4
+ import { IEditorConfigParams, Editor } from './editor';
5
5
  import { DocSelectionManagerService } from '@univerjs/docs';
6
- import { LexerTreeBuilder } from '@univerjs/engine-formula';
7
6
  export interface IEditorSetValueParam {
8
7
  editorUnitId: string;
9
8
  body: IDocumentBody;
@@ -12,218 +11,47 @@ export interface IEditorInputFormulaParam {
12
11
  editorUnitId: string;
13
12
  formulaString: string;
14
13
  }
15
- /**
16
- * @deprecated
17
- */
18
14
  export interface IEditorService {
19
15
  getEditor(id?: string): Readonly<Nullable<Editor>>;
20
16
  register(config: IEditorConfigParams, container: HTMLDivElement): IDisposable;
21
- /**
22
- * @deprecated
23
- */
24
- isVisible(id: string): Nullable<boolean>;
25
- inputFormula$: Observable<IEditorInputFormulaParam>;
26
- /**
27
- * @deprecated
28
- */
29
- setFormula(formulaString: string): void;
30
- resize$: Observable<string>;
31
- /**
32
- * @deprecated
33
- */
34
- resize(id: string): void;
35
- /**
36
- * @deprecated
37
- */
38
17
  getAllEditor(): Map<string, Editor>;
39
- /**
40
- * The sheet currently being operated on will determine
41
- * whether to include unitId information in the ref.
42
- */
43
- setOperationSheetUnitId(unitId: Nullable<string>): void;
44
- getOperationSheetUnitId(): Nullable<string>;
45
- /**
46
- * The sub-table within the sheet currently being operated on
47
- * will determine whether to include subUnitId information in the ref.
48
- */
49
- setOperationSheetSubUnitId(sheetId: Nullable<string>): void;
50
- getOperationSheetSubUnitId(): Nullable<string>;
51
18
  isEditor(editorUnitId: string): boolean;
52
19
  isSheetEditor(editorUnitId: string): boolean;
53
- closeRangePrompt$: Observable<unknown>;
54
- /**
55
- * @deprecated
56
- */
57
- closeRangePrompt(): void;
58
20
  blur$: Observable<unknown>;
59
- /**
60
- * @deprecated
61
- */
62
21
  blur(): void;
63
22
  focus$: Observable<ISuccinctDocRangeParam>;
64
- /**
65
- * @deprecated
66
- */
67
- focus(editorUnitId?: string): void;
68
- setValue$: Observable<IEditorSetValueParam>;
69
- valueChange$: Observable<Readonly<Editor>>;
70
- /**
71
- * @deprecated
72
- */
73
- setValue(val: string, editorUnitId?: string): void;
74
- /**
75
- * @deprecated
76
- */
77
- setValueNoRefresh(val: string, editorUnitId?: string): void;
78
- /**
79
- * @deprecated
80
- */
81
- setRichValue(body: IDocumentBody, editorUnitId?: string): void;
82
- /**
83
- * @deprecated
84
- */
85
- getFirstEditor(): Editor;
86
- focusStyle$: Observable<Nullable<string>>;
87
- /**
88
- * @deprecated
89
- */
90
- focusStyle(editorUnitId: Nullable<string>): void;
91
- /**
92
- * @deprecated
93
- */
94
- refreshValueChange(editorId: string): void;
95
- /**
96
- * @deprecated
97
- */
98
- checkValueLegality(editorId: string): boolean;
99
- /**
100
- * @deprecated
101
- */
102
- getValue(id: string): Nullable<string>;
103
- /**
104
- * @deprecated
105
- */
106
- getRichValue(id: string): Nullable<IDocumentBody>;
107
- /**
108
- * @deprecated
109
- */
110
- changeSpreadsheetFocusState(state: boolean): void;
111
- /**
112
- * @deprecated
113
- */
114
- getSpreadsheetFocusState(): boolean;
115
- /**
116
- * @deprecated
117
- */
118
- selectionChangingState(): boolean;
119
- singleSelection$: Observable<boolean>;
120
- /**
121
- * @deprecated
122
- */
123
- singleSelection(state: boolean): void;
124
- setFocusId(id: Nullable<string>): void;
23
+ focus(editorUnitId: string): void;
125
24
  getFocusId(): Nullable<string>;
126
25
  getFocusEditor(): Readonly<Nullable<Editor>>;
127
26
  }
128
27
  export declare class EditorService extends Disposable implements IEditorService, IDisposable {
129
28
  private readonly _univerInstanceService;
130
29
  private readonly _renderManagerService;
131
- private readonly _lexerTreeBuilder;
132
30
  private readonly _docSelectionManagerService;
133
31
  private readonly _contextService;
134
32
  private readonly _commandService;
135
33
  private readonly _undoRedoService;
136
34
  private _editors;
137
35
  private _focusEditorUnitId;
138
- private readonly _state$;
139
- readonly state$: Observable<Nullable<IEditorStateParams>>;
140
- private _currentSheetUnitId;
141
- private _currentSheetSubUnitId;
142
- private readonly _inputFormula$;
143
- readonly inputFormula$: Observable<IEditorInputFormulaParam>;
144
- private readonly _resize$;
145
- readonly resize$: Observable<string>;
146
- private readonly _closeRangePrompt$;
147
- readonly closeRangePrompt$: Observable<unknown>;
148
36
  private readonly _blur$;
149
37
  readonly blur$: Observable<unknown>;
150
38
  private readonly _focus$;
151
39
  readonly focus$: Observable<ISuccinctDocRangeParam>;
152
- private readonly _setValue$;
153
- readonly setValue$: Observable<IEditorSetValueParam>;
154
- private readonly _valueChange$;
155
- readonly valueChange$: Observable<Readonly<Editor>>;
156
- private readonly _focusStyle$;
157
- readonly focusStyle$: Observable<Nullable<string>>;
158
- private readonly _singleSelection$;
159
- readonly singleSelection$: Observable<boolean>;
160
- private _spreadsheetFocusState;
161
- constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _lexerTreeBuilder: LexerTreeBuilder, _docSelectionManagerService: DocSelectionManagerService, _contextService: IContextService, _commandService: ICommandService, _undoRedoService: IUndoRedoService);
40
+ constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _docSelectionManagerService: DocSelectionManagerService, _contextService: IContextService, _commandService: ICommandService, _undoRedoService: IUndoRedoService);
162
41
  private _initUniverFocusListener;
163
- /** @deprecated */
164
42
  private _blurSheetEditor;
165
- /** @deprecated */
166
- setFocusId(id: Nullable<string>): void;
167
- /** @deprecated */
43
+ private _setFocusId;
168
44
  getFocusId(): Nullable<string>;
169
- /** @deprecated */
170
45
  getFocusEditor(): Readonly<Nullable<Editor>>;
171
46
  isEditor(editorUnitId: string): boolean;
172
- /** @deprecated */
173
47
  isSheetEditor(editorUnitId: string): boolean;
174
- /** @deprecated */
175
- closeRangePrompt(): void;
176
- /** @deprecated */
177
- changeSpreadsheetFocusState(state: boolean): void;
178
- /** @deprecated */
179
- getSpreadsheetFocusState(): boolean;
180
- /** @deprecated */
181
- focusStyle(editorUnitId: string): false | undefined;
182
- /** @deprecated */
183
- singleSelection(state: boolean): void;
184
- /** @deprecated */
185
- selectionChangingState(): boolean;
186
- /** @deprecated */
187
48
  blur(): void;
188
- /** @deprecated */
189
- focus(editorUnitId?: string | undefined): void;
190
- /** @deprecated */
191
- setFormula(formulaString: string, editorUnitId?: string): void;
192
- /** @deprecated */
193
- setValue(val: string, editorUnitId?: string): void;
194
- /** @deprecated */
195
- setValueNoRefresh(val: string, editorUnitId: string): void;
196
- /** @deprecated */
197
- getValue(id: string): string | undefined;
198
- /** @deprecated */
199
- setRichValue(body: IDocumentBody, editorUnitId?: string): void;
200
- /** @deprecated */
201
- getRichValue(id: string): IDocumentBody | undefined;
49
+ focus(editorUnitId: string): void;
202
50
  dispose(): void;
203
51
  getEditor(id?: string): Readonly<Nullable<Editor>>;
204
- /** @deprecated */
205
52
  getAllEditor(): Map<string, Editor>;
206
- /** @deprecated */
207
- getFirstEditor(): Editor;
208
- /** @deprecated */
209
- resize(unitId: string): void;
210
- /** @deprecated */
211
- isVisible(id: string): boolean | undefined;
212
- /** @deprecated */
213
- setOperationSheetUnitId(unitId: Nullable<string>): void;
214
- /** @deprecated */
215
- getOperationSheetUnitId(): Nullable<string>;
216
- /** @deprecated */
217
- setOperationSheetSubUnitId(sheetId: Nullable<string>): void;
218
- /** @deprecated */
219
- getOperationSheetSubUnitId(): Nullable<string>;
220
53
  register(config: IEditorConfigParams, container: HTMLDivElement): IDisposable;
221
54
  private _unRegister;
222
- /** @deprecated */
223
- refreshValueChange(editorUnitId: string): void;
224
- /** @deprecated */
225
- checkValueLegality(editorUnitId: string): boolean;
226
- private _refreshValueChange;
227
55
  private _getCurrentEditorUnitId;
228
56
  private _getBlank;
229
57
  }
@@ -1,8 +1,8 @@
1
- import { ICommandService, IDocumentData, IPosition, IUndoRedoService, IUniverInstanceService, Nullable, Disposable } from '@univerjs/core';
1
+ import { DocumentDataModel, ICommandService, IDocumentData, IPosition, IUndoRedoService, IUniverInstanceService, Nullable, Disposable } from '@univerjs/core';
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 { IEditorInputConfig } from '../selection/doc-selection-render.service';
5
+ import { DocSelectionRenderService, IEditorInputConfig } from '../selection/doc-selection-render.service';
6
6
  interface IEditorEvent {
7
7
  target: IEditor;
8
8
  data: IDocumentData;
@@ -18,9 +18,9 @@ interface IEditor {
18
18
  focus$: Observable<IEditorInputConfig>;
19
19
  blur$: Observable<IEditorInputConfig>;
20
20
  selectionChange$: Observable<IDocSelectionInnerParam>;
21
+ isFocus(): boolean;
21
22
  focus(): void;
22
23
  blur(): void;
23
- isFocus(): boolean;
24
24
  select(): void;
25
25
  setSelectionRanges(ranges: ISuccinctDocRangeParam[]): void;
26
26
  getSelectionRanges(): ITextRangeWithStyle[];
@@ -44,45 +44,6 @@ export interface IEditorConfigParams {
44
44
  backScrollOffset?: number;
45
45
  editorUnitId?: string;
46
46
  scrollBar?: boolean;
47
- /** @deprecated */
48
- noNeedVerticalAlign?: boolean;
49
- /**
50
- * @deprecated The implementer makes its own judgment.
51
- */
52
- isSheetEditor?: boolean;
53
- /**
54
- * If the editor is for formula editing.
55
- * @deprecated this is a temp fix before refactoring editor.
56
- */
57
- isFormulaEditor?: boolean;
58
- /**
59
- * @deprecated The implementer makes its own judgment.
60
- */
61
- isSingle?: boolean;
62
- /**
63
- * @deprecated The implementer makes its own judgment.
64
- */
65
- onlyInputFormula?: boolean;
66
- /**
67
- * @deprecated The implementer makes its own judgment.
68
- */
69
- onlyInputRange?: boolean;
70
- /**
71
- * @deprecated The implementer makes its own judgment.
72
- */
73
- onlyInputContent?: boolean;
74
- /**
75
- * @deprecated The implementer makes its own judgment.
76
- */
77
- isSingleChoice?: boolean;
78
- /**
79
- * @deprecated The implementer makes its own judgment.
80
- */
81
- openForSheetUnitId?: Nullable<string>;
82
- /**
83
- * @deprecated The implementer makes its own judgment.
84
- */
85
- openForSheetSubUnitId?: Nullable<string>;
86
47
  }
87
48
  export interface IEditorOptions extends IEditorConfigParams, IEditorStateParams {
88
49
  render: IRender;
@@ -100,26 +61,33 @@ export declare class Editor extends Disposable implements IEditor {
100
61
  input$: Observable<IEditorInputEvent>;
101
62
  private readonly _paste$;
102
63
  paste$: Observable<IEditorInputConfig>;
103
- private _focus;
104
64
  private readonly _focus$;
105
65
  focus$: Observable<IEditorInputConfig>;
106
66
  private readonly _blur$;
107
67
  blur$: Observable<IEditorInputConfig>;
108
68
  private readonly _selectionChange$;
109
69
  selectionChange$: Observable<IDocSelectionInnerParam>;
110
- private _valueLegality;
111
- private _openForSheetUnitId;
112
- private _openForSheetSubUnitId;
113
70
  constructor(_param: IEditorOptions, _univerInstanceService: IUniverInstanceService, _docSelectionManagerService: DocSelectionManagerService, _commandService: ICommandService, _undoRedoService: IUndoRedoService);
71
+ get docSelectionRenderService(): DocSelectionRenderService;
114
72
  private _listenSelection;
73
+ isFocus(): boolean;
74
+ /**
75
+ * @deprecated use `IEditorService.focus` as instead. this is for internal usage.
76
+ */
115
77
  focus(): void;
78
+ /**
79
+ * @deprecated use `IEditorService.blur` as instead. this is for internal usage.
80
+ */
116
81
  blur(): void;
117
82
  select(): void;
118
83
  setSelectionRanges(ranges: ISuccinctDocRangeParam[]): void;
119
84
  getSelectionRanges(): ITextRangeWithStyle[];
85
+ getCursorPosition(): number;
120
86
  getEditorId(): string;
121
87
  getDocumentData(): IDocumentData;
88
+ getDocumentDataModel(): DocumentDataModel;
122
89
  setDocumentData(data: IDocumentData, textRanges: Nullable<ITextRangeWithStyle[]>): void;
90
+ replaceText(text: string, resetCursor?: boolean): void;
123
91
  clearUndoRedoHistory(): void;
124
92
  dispose(): void;
125
93
  /**
@@ -132,37 +100,11 @@ export declare class Editor extends Disposable implements IEditor {
132
100
  get params(): IEditorOptions;
133
101
  get cancelDefaultResizeListener(): boolean | undefined;
134
102
  get render(): IRender;
135
- isSingleChoice(): boolean;
136
- /** @deprecated */
137
- setOpenForSheetUnitId(unitId: Nullable<string>): void;
138
- /** @deprecated */
139
- getOpenForSheetUnitId(): Nullable<string>;
140
- /** @deprecated */
141
- setOpenForSheetSubUnitId(subUnitId: Nullable<string>): void;
142
- /** @deprecated */
143
- getOpenForSheetSubUnitId(): Nullable<string>;
144
- /** @deprecated */
145
- isValueLegality(): boolean;
146
- /** @deprecated */
147
- setValueLegality(state?: boolean): void;
148
- isFocus(): boolean;
149
- /** @deprecated */
150
- setFocus(state?: boolean): void;
151
- /** @deprecated */
152
- isSingle(): boolean;
153
103
  isReadOnly(): boolean;
154
- /** @deprecated */
155
- onlyInputContent(): boolean;
156
- /** @deprecated */
157
- onlyInputFormula(): boolean;
158
- /** @deprecated */
159
- onlyInputRange(): boolean;
160
104
  getBoundingClientRect(): DOMRect;
105
+ get editorDOM(): HTMLDivElement;
161
106
  isVisible(): boolean | undefined;
162
- /** @deprecated */
163
107
  isSheetEditor(): boolean;
164
- /** @deprecated */
165
- isFormulaEditor(): boolean;
166
108
  /**
167
109
  * @deprecated use getDocumentData.
168
110
  */
@@ -175,10 +117,6 @@ export declare class Editor extends Disposable implements IEditor {
175
117
  * @deprecated.
176
118
  */
177
119
  update(param: Partial<IEditorOptions>): void;
178
- /**
179
- * @deprecated.
180
- */
181
- verticalAlign(): void;
182
120
  /**
183
121
  * @deprecated.
184
122
  */
@@ -29,6 +29,7 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
29
29
  readonly onCompositionend$: import('rxjs').Observable<Nullable<IEditorInputConfig>>;
30
30
  private readonly _onSelectionStart$;
31
31
  readonly onSelectionStart$: import('rxjs').Observable<Nullable<INodePosition>>;
32
+ readonly onChangeByEvent$: import('rxjs').Observable<Nullable<IEditorInputConfig>>;
32
33
  private readonly _onPaste$;
33
34
  readonly onPaste$: import('rxjs').Observable<IEditorInputConfig>;
34
35
  private readonly _textSelectionInner$;
@@ -52,12 +53,15 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
52
53
  private _currentSegmentId;
53
54
  private _currentSegmentPage;
54
55
  private _selectionStyle;
56
+ private _onPointerEvent;
55
57
  private _viewPortObserverMap;
56
58
  private _isIMEInputApply;
57
59
  private _scenePointerMoveSubs;
58
60
  private _scenePointerUpSubs;
59
- private _editorFocusing;
60
61
  private _reserveRanges;
62
+ get isOnPointerEvent(): boolean;
63
+ get isFocusing(): boolean;
64
+ get canFocusing(): boolean;
61
65
  constructor(_context: IRenderContext<DocumentDataModel>, _layoutService: ILayoutService, _logService: ILogService, _univerInstanceService: IUniverInstanceService, _docSkeletonManagerService: DocSkeletonManagerService);
62
66
  private _listenCurrentUnitChange;
63
67
  get activeViewPort(): import('@univerjs/engine-render').Viewport;
@@ -79,14 +83,6 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
79
83
  hasFocus(): boolean;
80
84
  focus(): void;
81
85
  blur(): void;
82
- /**
83
- * @deprecated
84
- */
85
- focusEditor(): void;
86
- /**
87
- * @deprecated
88
- */
89
- blurEditor(): void;
90
86
  /**
91
87
  * @deprecated
92
88
  */
@@ -100,6 +96,8 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
100
96
  private _setSystemHighlightColorToStyle;
101
97
  private _getAllTextRanges;
102
98
  private _getAllRectRanges;
99
+ getAllTextRanges(): ITextRangeWithStyle[];
100
+ getAllRectRanges(): import('@univerjs/engine-render').IRectRangeWithStyle[];
103
101
  private _getActiveRange;
104
102
  private _getActiveRangeInstance;
105
103
  dispose(): void;
@@ -109,7 +107,6 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
109
107
  private _getNodePosition;
110
108
  private _interactTextRanges;
111
109
  private _interactRectRanges;
112
- private _removeCollapsedTextRange;
113
110
  private _removeAllRanges;
114
111
  private _removeAllCacheRanges;
115
112
  private _removeAllTextRanges;