@univerjs/docs 1.0.0-alpha.0 → 1.0.0-alpha.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.
package/lib/es/index.js CHANGED
@@ -532,7 +532,7 @@ const UpdateTextCommand = {
532
532
  //#endregion
533
533
  //#region package.json
534
534
  var name = "@univerjs/docs";
535
- var version = "1.0.0-alpha.0";
535
+ var version = "1.0.0-alpha.1";
536
536
 
537
537
  //#endregion
538
538
  //#region src/commands/mutations/docs-rename.mutation.ts
@@ -621,6 +621,33 @@ DocCustomRangeController = __decorate([
621
621
  __decorateParam(2, IUniverInstanceService)
622
622
  ], DocCustomRangeController);
623
623
 
624
+ //#endregion
625
+ //#region src/services/doc-block-move-validator.service.ts
626
+ var DocBlockMoveValidatorService = class extends Disposable {
627
+ constructor(..._args) {
628
+ super(..._args);
629
+ _defineProperty(this, "_validators", []);
630
+ _defineProperty(this, "_transformers", []);
631
+ }
632
+ registerValidator(validator) {
633
+ this._validators.push(validator);
634
+ return this.disposeWithMe(toDisposable(() => remove(this._validators, validator)));
635
+ }
636
+ registerTransformer(transformer) {
637
+ this._transformers.push(transformer);
638
+ return this.disposeWithMe(toDisposable(() => remove(this._transformers, transformer)));
639
+ }
640
+ canMoveBlock(context) {
641
+ return this._validators.every((validator) => validator(context));
642
+ }
643
+ transformMoveResult(context) {
644
+ return this._transformers.reduce((result, transformer) => transformer({
645
+ ...context,
646
+ result
647
+ }), context.result);
648
+ }
649
+ };
650
+
624
651
  //#endregion
625
652
  //#region src/services/doc-content-insert.service.ts
626
653
  /**
@@ -839,6 +866,7 @@ let UniverDocsPlugin = class UniverDocsPlugin extends Plugin {
839
866
  [DocSelectionManagerService],
840
867
  [DocStateEmitService],
841
868
  [DocStateChangeManagerService],
869
+ [DocBlockMoveValidatorService],
842
870
  [DocContentInsertService],
843
871
  [DocCustomRangeController]
844
872
  ].forEach((d) => this._injector.add(d));
@@ -1064,4 +1092,4 @@ function replaceSelectionFactory(accessor, params) {
1064
1092
  }
1065
1093
 
1066
1094
  //#endregion
1067
- export { DOC_INTERCEPTOR_POINT, DeleteTextCommand, DocContentInsertService, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, DocStateEmitService, IDocStateChangeInterceptorService, InsertTextCommand, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin, UpdateTextCommand, addCustomRangeBySelectionFactory, addCustomRangeFactory, deleteCustomRangeFactory, replaceSelectionFactory };
1095
+ export { DOC_INTERCEPTOR_POINT, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, DocStateEmitService, IDocStateChangeInterceptorService, InsertTextCommand, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin, UpdateTextCommand, addCustomRangeBySelectionFactory, addCustomRangeFactory, deleteCustomRangeFactory, replaceSelectionFactory };