@univerjs/docs 0.2.12 → 0.2.13

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/index.js +1 -5
  2. package/lib/es/index.js +178 -4375
  3. package/lib/types/commands/mutations/core-editing.mutation.d.ts +1 -1
  4. package/lib/types/controllers/config.schema.d.ts +1 -0
  5. package/lib/types/controllers/custom-range.controller.d.ts +2 -2
  6. package/lib/types/doc-plugin.d.ts +1 -1
  7. package/lib/types/index.d.ts +7 -48
  8. package/lib/types/services/doc-interceptor/doc-interceptor.service.d.ts +1 -1
  9. package/lib/types/services/doc-selection-manager.service.d.ts +56 -0
  10. package/lib/types/services/doc-state-emit.service.d.ts +27 -0
  11. package/lib/umd/index.js +1 -5
  12. package/package.json +10 -9
  13. package/lib/types/basics/__tests__/plain-text.spec.d.ts +0 -16
  14. package/lib/types/basics/component-tools.d.ts +0 -17
  15. package/lib/types/basics/custom-decoration-factory.d.ts +0 -23
  16. package/lib/types/basics/custom-range-factory.d.ts +0 -24
  17. package/lib/types/basics/custom-range.d.ts +0 -13
  18. package/lib/types/basics/docs-view-key.d.ts +0 -30
  19. package/lib/types/basics/paragraph.d.ts +0 -2
  20. package/lib/types/basics/plain-text.d.ts +0 -9
  21. package/lib/types/basics/replace.d.ts +0 -13
  22. package/lib/types/basics/retain-delete-params.d.ts +0 -6
  23. package/lib/types/basics/selection.d.ts +0 -22
  24. package/lib/types/basics/table.d.ts +0 -16
  25. package/lib/types/commands/commands/__tests__/clipboard.command.spec.d.ts +0 -16
  26. package/lib/types/commands/commands/__tests__/core-editing.command.spec.d.ts +0 -16
  27. package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +0 -34
  28. package/lib/types/commands/commands/__tests__/inline-format.command.spec.d.ts +0 -16
  29. package/lib/types/commands/commands/__tests__/mock-text-selection-render-manager.d.ts +0 -9
  30. package/lib/types/commands/commands/__tests__/replace-content.command.spec.d.ts +0 -16
  31. package/lib/types/commands/commands/auto-format.command.d.ts +0 -7
  32. package/lib/types/commands/commands/break-line.command.d.ts +0 -3
  33. package/lib/types/commands/commands/clipboard.inner.command.d.ts +0 -16
  34. package/lib/types/commands/commands/core-editing.command.d.ts +0 -43
  35. package/lib/types/commands/commands/delete.command.d.ts +0 -19
  36. package/lib/types/commands/commands/ime-input.command.d.ts +0 -9
  37. package/lib/types/commands/commands/inline-format.command.d.ts +0 -17
  38. package/lib/types/commands/commands/list.command.d.ts +0 -42
  39. package/lib/types/commands/commands/paragraph-align.command.d.ts +0 -18
  40. package/lib/types/commands/commands/replace-content.command.d.ts +0 -26
  41. package/lib/types/commands/commands/set-doc-zoom-ratio.command.d.ts +0 -6
  42. package/lib/types/commands/commands/table/doc-table-create.command.d.ts +0 -10
  43. package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +0 -10
  44. package/lib/types/commands/commands/table/doc-table-insert.command.d.ts +0 -34
  45. package/lib/types/commands/commands/table/doc-table-tab.command.d.ts +0 -5
  46. package/lib/types/commands/commands/table/table.d.ts +0 -94
  47. package/lib/types/commands/operations/cursor.operation.d.ts +0 -12
  48. package/lib/types/commands/operations/select-all.operation.d.ts +0 -5
  49. package/lib/types/commands/operations/set-doc-zoom-ratio.operation.d.ts +0 -7
  50. package/lib/types/commands/util.d.ts +0 -9
  51. package/lib/types/controllers/ime-input.controller.d.ts +0 -25
  52. package/lib/types/controllers/move-cursor.controller.d.ts +0 -20
  53. package/lib/types/controllers/normal-input.controller.d.ts +0 -13
  54. package/lib/types/services/doc-auto-format.service.d.ts +0 -37
  55. package/lib/types/services/doc-state-change-manager.service.d.ts +0 -34
  56. package/lib/types/services/ime-input-manager.service.d.ts +0 -28
  57. package/lib/types/services/text-selection-manager.service.d.ts +0 -55
  58. package/lib/types/types/enums/delete-direction.d.ts +0 -19
@@ -1,5 +1,5 @@
1
- import { IMutation, IMutationCommonParams, JSONXActions, Nullable } from '@univerjs/core';
2
1
  import { ITextRangeWithStyle } from '@univerjs/engine-render';
2
+ import { IMutation, IMutationCommonParams, JSONXActions, Nullable } from '@univerjs/core';
3
3
  export interface IRichTextEditingMutationParams extends IMutationCommonParams {
4
4
  unitId: string;
5
5
  actions: JSONXActions;
@@ -16,5 +16,6 @@
16
16
  export declare const PLUGIN_CONFIG_KEY = "docs.config";
17
17
  export declare const configSymbol: unique symbol;
18
18
  export interface IUniverDocsConfig {
19
+ hasScroll?: boolean;
19
20
  }
20
21
  export declare const defaultPluginConfig: IUniverDocsConfig;
@@ -1,10 +1,10 @@
1
1
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
- import { TextSelectionManagerService } from '../services/text-selection-manager.service';
2
+ import { DocSelectionManagerService } from '../services/doc-selection-manager.service';
3
3
  export declare class DocCustomRangeController extends Disposable {
4
4
  private readonly _commandService;
5
5
  private readonly _textSelectionManagerService;
6
6
  private readonly _univerInstanceService;
7
- constructor(_commandService: ICommandService, _textSelectionManagerService: TextSelectionManagerService, _univerInstanceService: IUniverInstanceService);
7
+ constructor(_commandService: ICommandService, _textSelectionManagerService: DocSelectionManagerService, _univerInstanceService: IUniverInstanceService);
8
8
  private _transformCustomRange;
9
9
  private _initSelectionChange;
10
10
  }
@@ -6,7 +6,7 @@ export declare class UniverDocsPlugin extends Plugin {
6
6
  private readonly _configService;
7
7
  static pluginName: string;
8
8
  static type: UniverInstanceType;
9
- constructor(_config: Partial<IUniverDocsConfig>, _injector: Injector, _configService: IConfigService);
9
+ constructor(_config: Partial<IUniverDocsConfig> | undefined, _injector: Injector, _configService: IConfigService);
10
10
  private _initializeCommands;
11
11
  private _initializeDependencies;
12
12
  }
@@ -13,54 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { getParagraphsInRange, getParagraphsInRanges, findNearestSectionBreak } from './commands/commands/list.command';
17
- export { replaceSelectionFactory } from './basics/replace';
18
- export { makeSelection, getSelectionText, getDeleteSelection, getInsertSelection, isSegmentIntersects } from './basics/selection';
19
- export { hasParagraphInTable } from './basics/paragraph';
20
- export type { IDocObjectParam } from './basics/component-tools';
21
- export { getDocObject, neoGetDocObject, getDocObjectById } from './basics/component-tools';
22
- export * from './basics/docs-view-key';
16
+ export { type IRichTextEditingMutationParams, RichTextEditingMutation, } from './commands/mutations/core-editing.mutation';
17
+ export { type ISetTextSelectionsOperationParams, SetTextSelectionsOperation, } from './commands/operations/text-selection.operation';
18
+ export type { IUniverDocsConfig } from './controllers/config.schema';
23
19
  export { UniverDocsPlugin } from './doc-plugin';
24
- export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
25
- export { TextSelectionManagerService, serializeDocRange } from './services/text-selection-manager.service';
26
- export { DocStateChangeManagerService, type IDocStateChangeParams } from './services/doc-state-change-manager.service';
27
- export { IMEInputManagerService } from './services/ime-input-manager.service';
28
- export { BreakLineCommand } from './commands/commands/break-line.command';
29
- export { CutContentCommand, InnerPasteCommand } from './commands/commands/clipboard.inner.command';
30
- export { InsertCommand, DeleteCommand, UpdateCommand, EditorInsertTextCommandId, type ICoverCommandParams, type IDeleteCommandParams, type IInsertCommandParams, type IUpdateCommandParams, } from './commands/commands/core-editing.command';
31
- export { DeleteLeftCommand, DeleteRightCommand, DeleteCustomBlockCommand, MergeTwoParagraphCommand, type IDeleteCustomBlockParams } from './commands/commands/delete.command';
32
- export { IMEInputCommand, type IIMEInputCommandParams } from './commands/commands/ime-input.command';
33
- export { SetInlineFormatBoldCommand, SetInlineFormatItalicCommand, SetInlineFormatUnderlineCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatFontSizeCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatTextColorCommand, SetInlineFormatTextBackgroundColorCommand, ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatCommand, } from './commands/commands/inline-format.command';
34
- export { ListOperationCommand, BulletListCommand, OrderListCommand, ChangeListNestingLevelCommand, ChangeListTypeCommand, CheckListCommand, ToggleCheckListCommand, QuickListCommand, } from './commands/commands/list.command';
35
- export { AlignOperationCommand, AlignLeftCommand, AlignCenterCommand, AlignRightCommand, AlignJustifyCommand, } from './commands/commands/paragraph-align.command';
36
- export { ReplaceContentCommand, CoverContentCommand } from './commands/commands/replace-content.command';
37
- export { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
38
- export { AfterSpaceCommand, TabCommand, EnterCommand, type ITabCommandParams } from './commands/commands/auto-format.command';
39
- export { RichTextEditingMutation, type IRichTextEditingMutationParams, } from './commands/mutations/core-editing.mutation';
40
- export { MoveCursorOperation, MoveSelectionOperation } from './commands/operations/cursor.operation';
41
- export { SelectAllOperation } from './commands/operations/select-all.operation';
42
- export { SetDocZoomRatioOperation, type ISetDocZoomRatioOperationParams } from './commands/operations/set-doc-zoom-ratio.operation';
43
- export { SetTextSelectionsOperation, type ISetTextSelectionsOperationParams, } from './commands/operations/text-selection.operation';
44
- export { getRetainAndDeleteFromReplace } from './basics/retain-delete-params';
45
- export { getRichTextEditPath } from './commands/util';
46
- export { getPlainTextFormDocument, getPlainTextFormBody } from './basics/plain-text';
47
- export { addCustomRangeFactory, addCustomRangeBySelectionFactory, deleteCustomRangeFactory } from './basics/custom-range-factory';
48
- export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory } from './basics/custom-decoration-factory';
49
- export { getCustomRangesInterestsWithRange, copyCustomRange } from './basics/custom-range';
50
20
  export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
51
21
  export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
52
- export { DocAutoFormatService } from './services/doc-auto-format.service';
53
- export { ChangeListNestingLevelType } from './commands/commands/list.command';
54
- export { getCommandSkeleton } from './commands/util';
55
- export { generateParagraphs } from './commands/commands/break-line.command';
56
- export type { IInnerCutCommandParams } from './commands/commands/clipboard.inner.command';
57
- export { getCutActionsFromDocRanges, getCustomBlockIdsInSelections } from './commands/commands/clipboard.inner.command';
58
- export { CreateDocTableCommand, type ICreateDocTableCommandParams } from './commands/commands/table/doc-table-create.command';
59
- export { DocTableDeleteRowsCommand, DocTableDeleteColumnsCommand, DocTableDeleteTableCommand } from './commands/commands/table/doc-table-delete.command';
60
- export type { IDocTableDeleteRowsCommandParams, IDocTableDeleteColumnsCommandParams, IDocTableDeleteTableCommandParams } from './commands/commands/table/doc-table-delete.command';
61
- export type { IDocTableInsertColumnCommandParams, IDocTableInsertRowCommandParams, IDocTableInsertColumnRightCommandParams, IDocTableInsertRowAboveCommandParams, IDocTableInsertRowBellowCommandParams, IDocTableInsertColumnLeftCommandParams } from './commands/commands/table/doc-table-insert.command';
62
- export { DocTableInsertColumnCommand, DocTableInsertRowCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertColumnLeftCommand } from './commands/commands/table/doc-table-insert.command';
63
- export type { IDocTableTabCommandParams } from './commands/commands/table/doc-table-tab.command';
64
- export { DocTableTabCommand } from './commands/commands/table/doc-table-tab.command';
65
- export { genTableSource, getEmptyTableRow, getEmptyTableCell, getTableColumn } from './commands/commands/table/table';
66
- export { getCursorWhenDelete } from './commands/commands/delete.command';
22
+ export { DocSelectionManagerService } from './services/doc-selection-manager.service';
23
+ export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
24
+ export type { IDocStateChangeInfo, IDocStateChangeParams } from './services/doc-state-emit.service';
25
+ export { DocStateEmitService } from './services/doc-state-emit.service';
@@ -6,7 +6,7 @@ export declare class DocInterceptorService extends Disposable implements IRender
6
6
  private readonly _docSkeletonManagerService;
7
7
  private _interceptorsByName;
8
8
  constructor(_context: IRenderContext<DocumentDataModel>, _docSkeletonManagerService: DocSkeletonManagerService);
9
- intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): import('@univerjs/core').IDisposable;
9
+ intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): import('@wendellhu/redi').IDisposable;
10
10
  fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue: Nullable<T>, initContext: C) => Nullable<T>;
11
11
  interceptDocumentViewModel(viewModel: DocumentViewModel): DisposableCollection;
12
12
  }
@@ -0,0 +1,56 @@
1
+ import { ICommandService, RxDisposable, Nullable } from '@univerjs/core';
2
+ import { IDocSelectionInnerParam, IRectRangeWithStyle, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
3
+ interface IDocSelectionManagerSearchParam {
4
+ unitId: string;
5
+ subUnitId: string;
6
+ }
7
+ export interface IRefreshSelectionParam extends IDocSelectionManagerSearchParam {
8
+ docRanges: ISuccinctDocRangeParam[];
9
+ isEditing: boolean;
10
+ options?: {
11
+ [key: string]: boolean;
12
+ };
13
+ }
14
+ interface ITextSelectionManagerInsertParam extends IDocSelectionManagerSearchParam, IDocSelectionInnerParam {
15
+ }
16
+ /**
17
+ * This service is for text selection.
18
+ */
19
+ export declare class DocSelectionManagerService extends RxDisposable {
20
+ private readonly _commandService;
21
+ private _currentSelection;
22
+ private readonly _textSelectionInfo;
23
+ private readonly _textSelection$;
24
+ readonly textSelection$: import('rxjs').Observable<Nullable<ITextSelectionManagerInsertParam>>;
25
+ private readonly _refreshSelection$;
26
+ readonly refreshSelection$: import('rxjs').Observable<Nullable<IRefreshSelectionParam>>;
27
+ constructor(_commandService: ICommandService);
28
+ getCurrentSelection(): Nullable<IDocSelectionManagerSearchParam>;
29
+ /**
30
+ * @deprecated
31
+ */
32
+ getCurrentSelectionInfo(): IDocSelectionInnerParam | undefined;
33
+ refreshSelection(): void;
34
+ setCurrentSelection(param: IDocSelectionManagerSearchParam): void;
35
+ setCurrentSelectionNotRefresh(param: IDocSelectionManagerSearchParam): void;
36
+ getCurrentTextRanges(): Readonly<Nullable<ITextRangeWithStyle[]>>;
37
+ getCurrentRectRanges(): Readonly<Nullable<IRectRangeWithStyle[]>>;
38
+ getDocRanges(): ITextRangeWithStyle[];
39
+ getActiveTextRange(): Nullable<ITextRangeWithStyle>;
40
+ /**
41
+ *
42
+ * @deprecated
43
+ */
44
+ getActiveRectRange(): Nullable<ITextRangeWithStyle>;
45
+ add(textRanges: ITextRangeWithStyle[], isEditing?: boolean): void;
46
+ replaceTextRanges(docRanges: ISuccinctDocRangeParam[], isEditing?: boolean, options?: {
47
+ [key: string]: boolean;
48
+ }): void;
49
+ replaceTextRangesWithNoRefresh(textSelectionInfo: IDocSelectionInnerParam): void;
50
+ dispose(): void;
51
+ private _getTextRanges;
52
+ private _refresh;
53
+ private _replaceByParam;
54
+ private _addByParam;
55
+ }
56
+ export {};
@@ -0,0 +1,27 @@
1
+ import { RxDisposable, JSONXActions, Nullable } from '@univerjs/core';
2
+ import { ITextRangeWithStyle } from '@univerjs/engine-render';
3
+ interface IDocChangeState {
4
+ actions: JSONXActions;
5
+ textRanges: Nullable<ITextRangeWithStyle[]>;
6
+ }
7
+ export interface IDocStateChangeParams {
8
+ commandId: string;
9
+ unitId: string;
10
+ trigger: Nullable<string>;
11
+ redoState: IDocChangeState;
12
+ undoState: IDocChangeState;
13
+ segmentId?: string;
14
+ noHistory?: boolean;
15
+ debounce?: boolean;
16
+ }
17
+ export interface IDocStateChangeInfo extends IDocStateChangeParams {
18
+ isCompositionEnd?: boolean;
19
+ }
20
+ export declare class DocStateEmitService extends RxDisposable {
21
+ private readonly _docStateChangeParams$;
22
+ readonly docStateChangeParams$: import('rxjs').Observable<Nullable<IDocStateChangeInfo>>;
23
+ constructor();
24
+ emitStateChangeInfo(params: IDocStateChangeInfo): void;
25
+ dispose(): void;
26
+ }
27
+ export {};