@univerjs/docs 0.2.14 → 0.2.15
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/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),engineRender=require("@univerjs/engine-render"),rxjs=require("rxjs"),SetTextSelectionsOperation={id:"doc.operation.set-selections",type:core.CommandType.OPERATION,handler:__name((_,__)=>!0,"handler")};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4"),_a;exports.DocSelectionManagerService=(_a=class extends core.RxDisposable{constructor(_commandService){super();__publicField(this,"_currentSelection",null);__publicField(this,"_textSelectionInfo",new Map);__publicField(this,"_textSelection$",new rxjs.BehaviorSubject(null));__publicField(this,"textSelection$",this._textSelection$.asObservable());__publicField(this,"_refreshSelection$",new rxjs.BehaviorSubject(null));__publicField(this,"refreshSelection$",this._refreshSelection$.asObservable());this._commandService=_commandService}getCurrentSelection(){return this._currentSelection}getCurrentSelectionInfo(){return this._getTextRanges(this._currentSelection)}refreshSelection(){this._currentSelection!=null&&this._refresh(this._currentSelection)}setCurrentSelection(param){this._currentSelection=param,this._refresh(param)}setCurrentSelectionNotRefresh(param){var _a6;const{unitId,subUnitId}=(_a6=this._currentSelection)!=null?_a6:{},{unitId:newUnitId,subUnitId:newSubUnitId}=param;(unitId!==newUnitId||subUnitId!==newSubUnitId)&&(unitId&&subUnitId&&this._refreshSelection$.next({unitId,subUnitId,docRanges:[],isEditing:!1}),this._currentSelection=param)}getCurrentTextRanges(){var _a6;return(_a6=this._getTextRanges(this._currentSelection))==null?void 0:_a6.textRanges}getCurrentRectRanges(){var _a6;return(_a6=this._getTextRanges(this._currentSelection))==null?void 0:_a6.rectRanges}getDocRanges(){var _a6,_b;const textRanges=(_a6=this.getCurrentTextRanges())!=null?_a6:[],rectRanges=(_b=this.getCurrentRectRanges())!=null?_b:[];return[...textRanges,...rectRanges].filter(range=>range.startOffset!=null&&range.endOffset!=null).sort((a,b)=>a.startOffset>b.startOffset?1:a.startOffset<b.startOffset?-1:0)}getActiveTextRange(){const selectionInfo=this._getTextRanges(this._currentSelection);if(selectionInfo==null)return;const{textRanges}=selectionInfo;return textRanges.find(textRange=>textRange.isActive)}getActiveRectRange(){const selectionInfo=this._getTextRanges(this._currentSelection);if(selectionInfo==null)return;const{rectRanges}=selectionInfo;return rectRanges.find(rectRange=>rectRange.isActive)}add(textRanges,isEditing=!0){this._currentSelection!=null&&this._addByParam({...this._currentSelection,textRanges,rectRanges:[],segmentId:"",segmentPage:-1,isEditing,style:engineRender.NORMAL_TEXT_SELECTION_PLUGIN_STYLE})}replaceTextRanges(docRanges,isEditing=!0,options){if(this._currentSelection==null)return;const{unitId,subUnitId}=this._currentSelection;this._refreshSelection$.next({unitId,subUnitId,docRanges,isEditing,options})}replaceTextRangesWithNoRefresh(textSelectionInfo){if(this._currentSelection==null)return;const params={...this._currentSelection,...textSelectionInfo};this._replaceByParam(params),this._textSelection$.next(params);const{unitId,subUnitId,segmentId,style,textRanges,rectRanges,isEditing}=params,ranges=[...textRanges,...rectRanges].filter(range=>range.startOffset!=null&&range.endOffset!=null).sort((a,b)=>a.startOffset>b.startOffset?1:a.startOffset<b.startOffset?-1:0);this._commandService.executeCommand(SetTextSelectionsOperation.id,{unitId,subUnitId,segmentId,style,isEditing,ranges})}dispose(){this._textSelection$.complete()}_getTextRanges(param){var _a6;if(param==null)return;const{unitId,subUnitId=""}=param;return(_a6=this._textSelectionInfo.get(unitId))==null?void 0:_a6.get(subUnitId)}_refresh(param){const allTextSelectionInfo=this._getTextRanges(param);if(allTextSelectionInfo==null)return;const{textRanges,rectRanges}=allTextSelectionInfo,docRanges=[...textRanges,...rectRanges],{unitId,subUnitId}=param;this._refreshSelection$.next({unitId,subUnitId,docRanges,isEditing:!1})}_replaceByParam(insertParam){const{unitId,subUnitId,...selectionInsertParam}=insertParam;this._textSelectionInfo.has(unitId)||this._textSelectionInfo.set(unitId,new Map),this._textSelectionInfo.get(unitId).set(subUnitId,{...selectionInsertParam})}_addByParam(insertParam){const{unitId,subUnitId,...selectionInsertParam}=insertParam;this._textSelectionInfo.has(unitId)||this._textSelectionInfo.set(unitId,new Map);const unitTextRange=this._textSelectionInfo.get(unitId);unitTextRange.has(subUnitId)?unitTextRange.get(subUnitId).textRanges.push(...insertParam.textRanges):unitTextRange.set(subUnitId,{...selectionInsertParam})}},__name(_a,"DocSelectionManagerService"),_a);exports.DocSelectionManagerService=__decorateClass$4([__decorateParam$4(0,core.ICommandService)],exports.DocSelectionManagerService);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3"),_a2;exports.DocSkeletonManagerService=(_a2=class extends core.RxDisposable{constructor(_context,_localeService,_univerInstanceService){super();__publicField(this,"_skeleton");__publicField(this,"_docViewModel");__publicField(this,"_currentSkeleton$",new rxjs.BehaviorSubject(null));__publicField(this,"currentSkeleton$",this._currentSkeleton$.asObservable());__publicField(this,"_currentSkeletonBefore$",new rxjs.BehaviorSubject(null));__publicField(this,"currentSkeletonBefore$",this._currentSkeletonBefore$.asObservable());__publicField(this,"_currentViewModel$",new rxjs.BehaviorSubject(null));__publicField(this,"currentViewModel$",this._currentViewModel$.asObservable());this._context=_context,this._localeService=_localeService,this._univerInstanceService=_univerInstanceService,this._init(),this._univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_DOC).pipe(rxjs.takeUntil(this.dispose$)).subscribe(documentModel=>{documentModel&&documentModel.getUnitId()===this._context.unitId&&this._update(documentModel)})}dispose(){super.dispose(),this._currentSkeletonBefore$.complete(),this._currentSkeleton$.complete()}getSkeleton(){return this._skeleton}getViewModel(){return this._docViewModel}_init(){const documentDataModel=this._context.unit;this._update(documentDataModel)}_update(documentDataModel){const unitId=this._context.unitId;if(documentDataModel.getBody()==null)return;this._docViewModel&&core.isInternalEditorID(unitId)?(this._docViewModel.reset(documentDataModel),this._context.unit=documentDataModel):this._docViewModel||(this._docViewModel=this._buildDocViewModel(documentDataModel)),this._skeleton||(this._skeleton=this._buildSkeleton(this._docViewModel));const skeleton=this._skeleton;skeleton.calculate(),this._currentSkeletonBefore$.next(skeleton),this._currentSkeleton$.next(skeleton),this._currentViewModel$.next(this._docViewModel)}_buildSkeleton(documentViewModel){return engineRender.DocumentSkeleton.create(documentViewModel,this._localeService)}_buildDocViewModel(documentDataModel){return new engineRender.DocumentViewModel(documentDataModel)}},__name(_a2,"DocSkeletonManagerService"),_a2);exports.DocSkeletonManagerService=__decorateClass$3([__decorateParam$3(1,core.Inject(core.LocaleService)),__decorateParam$3(2,core.IUniverInstanceService)],exports.DocSkeletonManagerService);const _DocStateEmitService=class _DocStateEmitService extends core.RxDisposable{constructor(){super();__publicField(this,"_docStateChangeParams$",new rxjs.BehaviorSubject(null));__publicField(this,"docStateChangeParams$",this._docStateChangeParams$.asObservable())}emitStateChangeInfo(params){this._docStateChangeParams$.next(params)}dispose(){super.dispose(),this._docStateChangeParams$.complete()}};__name(_DocStateEmitService,"DocStateEmitService");let DocStateEmitService=_DocStateEmitService;const RichTextEditingMutationId="doc.mutation.rich-text-editing",RichTextEditingMutation={id:RichTextEditingMutationId,type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{var _a6,_b;const{unitId,segmentId="",actions,textRanges,prevTextRanges,trigger,noHistory,isCompositionEnd,noNeedSetTextRange,debounce}=params,univerInstanceService=accessor.get(core.IUniverInstanceService),renderManagerService=accessor.get(engineRender.IRenderManagerService),docStateEmitService=accessor.get(DocStateEmitService),documentDataModel=univerInstanceService.getUniverDocInstance(unitId),documentViewModel=(_a6=renderManagerService.getRenderById(unitId))==null?void 0:_a6.with(exports.DocSkeletonManagerService).getViewModel();if(documentDataModel==null||documentViewModel==null)throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${unitId}`);const docSelectionManagerService=accessor.get(exports.DocSelectionManagerService),docRanges=(_b=docSelectionManagerService.getDocRanges())!=null?_b:[],disabled=!!documentDataModel.getSnapshot().disabled;if(core.JSONX.isNoop(actions)||actions&&actions.length===0||disabled)return{unitId,actions:[],textRanges:docRanges};const undoActions=core.JSONX.invertWithDoc(actions,documentDataModel.getSnapshot());documentDataModel.apply(actions),documentViewModel.reset(documentDataModel),!noNeedSetTextRange&&textRanges&&trigger!=null&&queueMicrotask(()=>{docSelectionManagerService.replaceTextRanges(textRanges,!0,params.options)});const changeState={commandId:RichTextEditingMutationId,unitId,segmentId,trigger,noHistory,debounce,redoState:{actions,textRanges},undoState:{actions:undoActions,textRanges:prevTextRanges!=null?prevTextRanges:docRanges},isCompositionEnd};return docStateEmitService.emitStateChangeInfo(changeState),{unitId,actions:undoActions,textRanges:docRanges}},"handler")},DocsRenameMutation={id:"doc.mutation.rename-doc",type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{const doc=accessor.get(core.IUniverInstanceService).getUnit(params.unitId,core.UniverInstanceType.UNIVER_DOC);return doc?(doc.setName(params.name),!0):!1},"handler")},PLUGIN_CONFIG_KEY="docs.config",defaultPluginConfig={};var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a3;let DocCustomRangeController=(_a3=class extends core.Disposable{constructor(_commandService,_textSelectionManagerService,_univerInstanceService){super(),this._commandService=_commandService,this._textSelectionManagerService=_textSelectionManagerService,this._univerInstanceService=_univerInstanceService,this._initSelectionChange()}_transformCustomRange(doc,selection){var _a6;const{startOffset,endOffset,collapsed}=selection,customRanges=(_a6=doc.getCustomRanges())==null?void 0:_a6.filter(range=>!range.wholeEntity||startOffset<=range.startIndex&&endOffset>range.endIndex?!1:collapsed?range.startIndex<startOffset&&range.endIndex>=endOffset:core.BuildTextUtils.range.isIntersects(startOffset,endOffset-1,range.startIndex,range.endIndex));if(customRanges!=null&&customRanges.length){let start=startOffset,end=endOffset;return customRanges.forEach(range=>{start=Math.min(range.startIndex,start),end=Math.max(range.endIndex+1,end)}),{...selection,startOffset:start,endOffset:end,collapsed:start===end}}return selection}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{if(commandInfo.id===SetTextSelectionsOperation.id){const params=commandInfo.params,{unitId,ranges,isEditing}=params,doc=this._univerInstanceService.getUnit(unitId);if(!doc)return;const transformedRanges=ranges.map(range=>this._transformCustomRange(doc,range));transformedRanges.some((range,i)=>ranges[i]!==range)&&this._textSelectionManagerService.replaceTextRanges(transformedRanges,isEditing)}}))}},__name(_a3,"DocCustomRangeController"),_a3);DocCustomRangeController=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Ready,DocCustomRangeController),__decorateParam$2(0,core.ICommandService),__decorateParam$2(1,core.Inject(exports.DocSelectionManagerService)),__decorateParam$2(2,core.IUniverInstanceService)],DocCustomRangeController);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const PLUGIN_NAME="DOCS_PLUGIN";var _a4;exports.UniverDocsPlugin=(_a4=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest),this._initializeDependencies(_injector),this._initializeCommands()}_initializeCommands(){[RichTextEditingMutation,DocsRenameMutation,SetTextSelectionsOperation].forEach(command=>{this._injector.get(core.ICommandService).registerCommand(command)})}_initializeDependencies(docInjector){[[exports.DocSelectionManagerService],[DocStateEmitService],[DocCustomRangeController]].forEach(d=>docInjector.add(d))}},__name(_a4,"UniverDocsPlugin"),__publicField(_a4,"pluginName",PLUGIN_NAME),__publicField(_a4,"type",core.UniverInstanceType.UNIVER_DOC),_a4);exports.UniverDocsPlugin=__decorateClass$1([__decorateParam$1(1,core.Inject(core.Injector)),__decorateParam$1(2,core.IConfigService)],exports.UniverDocsPlugin);const CUSTOM_RANGE=core.createInterceptorKey("CUSTOM_RANGE"),CUSTOM_DECORATION=core.createInterceptorKey("CUSTOM_DECORATION"),DOC_INTERCEPTOR_POINT={CUSTOM_RANGE,CUSTOM_DECORATION};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),_a5;exports.DocInterceptorService=(_a5=class extends core.Disposable{constructor(_context,_docSkeletonManagerService){super();__publicField(this,"_interceptorsByName",new Map);this._context=_context,this._docSkeletonManagerService=_docSkeletonManagerService;const viewModel=this._docSkeletonManagerService.getViewModel(),unitId=viewModel.getDataModel().getUnitId();if(unitId===core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY||unitId===core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)return;this.disposeWithMe(this.interceptDocumentViewModel(viewModel)),this.disposeWithMe(this.intercept(DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{priority:-1,handler:__name((data,pos,next)=>next(data),"handler")}));let disposableCollection=new core.DisposableCollection;viewModel.segmentViewModels$.subscribe(segmentViewModels=>{disposableCollection.dispose(),disposableCollection=new core.DisposableCollection,segmentViewModels.forEach(segmentViewModel=>{disposableCollection.add(this.interceptDocumentViewModel(segmentViewModel))})}),this.disposeWithMe(disposableCollection)}intercept(name,interceptor){const key=name;this._interceptorsByName.has(key)||this._interceptorsByName.set(key,[]);const interceptors=this._interceptorsByName.get(key);return interceptors.push(interceptor),this._interceptorsByName.set(key,interceptors.sort((a,b)=>{var _a6,_b;return((_a6=b.priority)!=null?_a6:0)-((_b=a.priority)!=null?_b:0)})),this.disposeWithMe(core.toDisposable(()=>core.remove(this._interceptorsByName.get(key),interceptor)))}fetchThroughInterceptors(name){const key=name,interceptors=this._interceptorsByName.get(key);return core.composeInterceptors(interceptors||[])}interceptDocumentViewModel(viewModel){const disposableCollection=new core.DisposableCollection;return disposableCollection.add(viewModel.registerCustomRangeInterceptor({getCustomRange:__name(index=>{var _a6;return this.fetchThroughInterceptors(DOC_INTERCEPTOR_POINT.CUSTOM_RANGE)(viewModel.getCustomRangeRaw(index),{index,unitId:viewModel.getDataModel().getUnitId(),customRanges:(_a6=viewModel.getDataModel().getCustomRanges())!=null?_a6:[]})},"getCustomRange"),getCustomDecoration:__name(index=>{var _a6;return this.fetchThroughInterceptors(DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION)(viewModel.getCustomDecorationRaw(index),{index,unitId:viewModel.getDataModel().getUnitId(),customDecorations:(_a6=viewModel.getDataModel().getCustomDecorations())!=null?_a6:[]})},"getCustomDecoration")})),disposableCollection}},__name(_a5,"DocInterceptorService"),_a5);exports.DocInterceptorService=__decorateClass([core.OnLifecycle(core.LifecycleStages.Starting,exports.DocInterceptorService),__decorateParam(1,core.Inject(exports.DocSkeletonManagerService))],exports.DocInterceptorService);exports.DOC_INTERCEPTOR_POINT=DOC_INTERCEPTOR_POINT;exports.DocStateEmitService=DocStateEmitService;exports.RichTextEditingMutation=RichTextEditingMutation;exports.SetTextSelectionsOperation=SetTextSelectionsOperation;
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),engineRender=require("@univerjs/engine-render"),rxjs=require("rxjs"),SetTextSelectionsOperation={id:"doc.operation.set-selections",type:core.CommandType.OPERATION,handler:__name((_,__)=>!0,"handler")};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4"),_a;exports.DocSelectionManagerService=(_a=class extends core.RxDisposable{constructor(_commandService,_univerInstanceService){super();__publicField(this,"_currentSelection",null);__publicField(this,"_textSelectionInfo",new Map);__publicField(this,"_textSelection$",new rxjs.BehaviorSubject(null));__publicField(this,"textSelection$",this._textSelection$.asObservable());__publicField(this,"_refreshSelection$",new rxjs.BehaviorSubject(null));__publicField(this,"refreshSelection$",this._refreshSelection$.asObservable());this._commandService=_commandService,this._univerInstanceService=_univerInstanceService,this._listenCurrentUnit()}_listenCurrentUnit(){this._univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_DOC).pipe(rxjs.takeUntil(this.dispose$)).subscribe(documentModel=>{if(documentModel==null)return;const unitId=documentModel.getUnitId();this._setCurrentSelectionNotRefresh({unitId,subUnitId:unitId})})}getCurrentSelection(){return this._currentSelection}getCurrentSelectionInfo(){return this._getTextRanges(this._currentSelection)}refreshSelection(){this._currentSelection!=null&&this._refresh(this._currentSelection)}setCurrentSelection(param){this._currentSelection=param,this._refresh(param)}getCurrentTextRanges(){var _a6;return(_a6=this._getTextRanges(this._currentSelection))==null?void 0:_a6.textRanges}getCurrentRectRanges(){var _a6;return(_a6=this._getTextRanges(this._currentSelection))==null?void 0:_a6.rectRanges}getDocRanges(){var _a6,_b;const textRanges=(_a6=this.getCurrentTextRanges())!=null?_a6:[],rectRanges=(_b=this.getCurrentRectRanges())!=null?_b:[];return[...textRanges,...rectRanges].filter(range=>range.startOffset!=null&&range.endOffset!=null).sort((a,b)=>a.startOffset>b.startOffset?1:a.startOffset<b.startOffset?-1:0)}getActiveTextRange(){const selectionInfo=this._getTextRanges(this._currentSelection);if(selectionInfo==null)return;const{textRanges}=selectionInfo;return textRanges.find(textRange=>textRange.isActive)}getActiveRectRange(){const selectionInfo=this._getTextRanges(this._currentSelection);if(selectionInfo==null)return;const{rectRanges}=selectionInfo;return rectRanges.find(rectRange=>rectRange.isActive)}add(textRanges,isEditing=!0){this._currentSelection!=null&&this._addByParam({...this._currentSelection,textRanges,rectRanges:[],segmentId:"",segmentPage:-1,isEditing,style:engineRender.NORMAL_TEXT_SELECTION_PLUGIN_STYLE})}replaceTextRanges(docRanges,isEditing=!0,options){if(this._currentSelection==null)return;const{unitId,subUnitId}=this._currentSelection;this._refreshSelection$.next({unitId,subUnitId,docRanges,isEditing,options})}__replaceTextRangesWithNoRefresh(textSelectionInfo){if(this._currentSelection==null)return;const params={...this._currentSelection,...textSelectionInfo};this._replaceByParam(params),this._textSelection$.next(params);const{unitId,subUnitId,segmentId,style,textRanges,rectRanges,isEditing}=params,ranges=[...textRanges,...rectRanges].filter(range=>range.startOffset!=null&&range.endOffset!=null).sort((a,b)=>a.startOffset>b.startOffset?1:a.startOffset<b.startOffset?-1:0);this._commandService.executeCommand(SetTextSelectionsOperation.id,{unitId,subUnitId,segmentId,style,isEditing,ranges})}dispose(){this._textSelection$.complete()}_setCurrentSelectionNotRefresh(param){var _a6;const{unitId,subUnitId}=(_a6=this._currentSelection)!=null?_a6:{},{unitId:newUnitId,subUnitId:newSubUnitId}=param;(unitId!==newUnitId||subUnitId!==newSubUnitId)&&(unitId&&subUnitId&&this._refreshSelection$.next({unitId,subUnitId,docRanges:[],isEditing:!1}),this._currentSelection=param)}_getTextRanges(param){var _a6;if(param==null)return;const{unitId,subUnitId=""}=param;return(_a6=this._textSelectionInfo.get(unitId))==null?void 0:_a6.get(subUnitId)}_refresh(param){const allTextSelectionInfo=this._getTextRanges(param);if(allTextSelectionInfo==null)return;const{textRanges,rectRanges}=allTextSelectionInfo,docRanges=[...textRanges,...rectRanges],{unitId,subUnitId}=param;this._refreshSelection$.next({unitId,subUnitId,docRanges,isEditing:!1})}_replaceByParam(insertParam){const{unitId,subUnitId,...selectionInsertParam}=insertParam;this._textSelectionInfo.has(unitId)||this._textSelectionInfo.set(unitId,new Map),this._textSelectionInfo.get(unitId).set(subUnitId,{...selectionInsertParam})}_addByParam(insertParam){const{unitId,subUnitId,...selectionInsertParam}=insertParam;this._textSelectionInfo.has(unitId)||this._textSelectionInfo.set(unitId,new Map);const unitTextRange=this._textSelectionInfo.get(unitId);unitTextRange.has(subUnitId)?unitTextRange.get(subUnitId).textRanges.push(...insertParam.textRanges):unitTextRange.set(subUnitId,{...selectionInsertParam})}},__name(_a,"DocSelectionManagerService"),_a);exports.DocSelectionManagerService=__decorateClass$4([__decorateParam$4(0,core.ICommandService),__decorateParam$4(1,core.IUniverInstanceService)],exports.DocSelectionManagerService);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3"),_a2;exports.DocSkeletonManagerService=(_a2=class extends core.RxDisposable{constructor(_context,_localeService,_univerInstanceService){super();__publicField(this,"_skeleton");__publicField(this,"_docViewModel");__publicField(this,"_currentSkeleton$",new rxjs.BehaviorSubject(null));__publicField(this,"currentSkeleton$",this._currentSkeleton$.asObservable());__publicField(this,"_currentSkeletonBefore$",new rxjs.BehaviorSubject(null));__publicField(this,"currentSkeletonBefore$",this._currentSkeletonBefore$.asObservable());__publicField(this,"_currentViewModel$",new rxjs.BehaviorSubject(null));__publicField(this,"currentViewModel$",this._currentViewModel$.asObservable());this._context=_context,this._localeService=_localeService,this._univerInstanceService=_univerInstanceService,this._init(),this._univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_DOC).pipe(rxjs.takeUntil(this.dispose$)).subscribe(documentModel=>{documentModel&&documentModel.getUnitId()===this._context.unitId&&this._update(documentModel)})}dispose(){super.dispose(),this._currentSkeletonBefore$.complete(),this._currentSkeleton$.complete()}getSkeleton(){return this._skeleton}getViewModel(){return this._docViewModel}_init(){const documentDataModel=this._context.unit;this._update(documentDataModel)}_update(documentDataModel){const unitId=this._context.unitId;if(documentDataModel.getBody()==null)return;this._docViewModel&&core.isInternalEditorID(unitId)?(this._docViewModel.reset(documentDataModel),this._context.unit=documentDataModel):this._docViewModel||(this._docViewModel=this._buildDocViewModel(documentDataModel)),this._skeleton||(this._skeleton=this._buildSkeleton(this._docViewModel));const skeleton=this._skeleton;skeleton.calculate(),this._currentSkeletonBefore$.next(skeleton),this._currentSkeleton$.next(skeleton),this._currentViewModel$.next(this._docViewModel)}_buildSkeleton(documentViewModel){return engineRender.DocumentSkeleton.create(documentViewModel,this._localeService)}_buildDocViewModel(documentDataModel){return new engineRender.DocumentViewModel(documentDataModel)}},__name(_a2,"DocSkeletonManagerService"),_a2);exports.DocSkeletonManagerService=__decorateClass$3([__decorateParam$3(1,core.Inject(core.LocaleService)),__decorateParam$3(2,core.IUniverInstanceService)],exports.DocSkeletonManagerService);const _DocStateEmitService=class _DocStateEmitService extends core.RxDisposable{constructor(){super();__publicField(this,"_docStateChangeParams$",new rxjs.BehaviorSubject(null));__publicField(this,"docStateChangeParams$",this._docStateChangeParams$.asObservable())}emitStateChangeInfo(params){this._docStateChangeParams$.next(params)}dispose(){super.dispose(),this._docStateChangeParams$.complete()}};__name(_DocStateEmitService,"DocStateEmitService");let DocStateEmitService=_DocStateEmitService;const RichTextEditingMutationId="doc.mutation.rich-text-editing",RichTextEditingMutation={id:RichTextEditingMutationId,type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{var _a6,_b;const{unitId,segmentId="",actions,textRanges,prevTextRanges,trigger,noHistory,isCompositionEnd,noNeedSetTextRange,debounce}=params,univerInstanceService=accessor.get(core.IUniverInstanceService),renderManagerService=accessor.get(engineRender.IRenderManagerService),docStateEmitService=accessor.get(DocStateEmitService),documentDataModel=univerInstanceService.getUniverDocInstance(unitId),documentViewModel=(_a6=renderManagerService.getRenderById(unitId))==null?void 0:_a6.with(exports.DocSkeletonManagerService).getViewModel();if(documentDataModel==null||documentViewModel==null)throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${unitId}`);const docSelectionManagerService=accessor.get(exports.DocSelectionManagerService),docRanges=(_b=docSelectionManagerService.getDocRanges())!=null?_b:[],disabled=!!documentDataModel.getSnapshot().disabled;if(core.JSONX.isNoop(actions)||actions&&actions.length===0||disabled)return{unitId,actions:[],textRanges:docRanges};const undoActions=core.JSONX.invertWithDoc(actions,documentDataModel.getSnapshot());documentDataModel.apply(actions),documentViewModel.reset(documentDataModel),!noNeedSetTextRange&&textRanges&&trigger!=null&&queueMicrotask(()=>{docSelectionManagerService.replaceTextRanges(textRanges,!0,params.options)});const changeState={commandId:RichTextEditingMutationId,unitId,segmentId,trigger,noHistory,debounce,redoState:{actions,textRanges},undoState:{actions:undoActions,textRanges:prevTextRanges!=null?prevTextRanges:docRanges},isCompositionEnd};return docStateEmitService.emitStateChangeInfo(changeState),{unitId,actions:undoActions,textRanges:docRanges}},"handler")},DocsRenameMutation={id:"doc.mutation.rename-doc",type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{const doc=accessor.get(core.IUniverInstanceService).getUnit(params.unitId,core.UniverInstanceType.UNIVER_DOC);return doc?(doc.setName(params.name),!0):!1},"handler")},PLUGIN_CONFIG_KEY="docs.config",defaultPluginConfig={};var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a3;let DocCustomRangeController=(_a3=class extends core.Disposable{constructor(_commandService,_textSelectionManagerService,_univerInstanceService){super(),this._commandService=_commandService,this._textSelectionManagerService=_textSelectionManagerService,this._univerInstanceService=_univerInstanceService,this._initSelectionChange()}_transformCustomRange(doc,selection){var _a6;const{startOffset,endOffset,collapsed}=selection,customRanges=(_a6=doc.getCustomRanges())==null?void 0:_a6.filter(range=>!range.wholeEntity||startOffset<=range.startIndex&&endOffset>range.endIndex?!1:collapsed?range.startIndex<startOffset&&range.endIndex>=endOffset:core.BuildTextUtils.range.isIntersects(startOffset,endOffset-1,range.startIndex,range.endIndex));if(customRanges!=null&&customRanges.length){let start=startOffset,end=endOffset;return customRanges.forEach(range=>{start=Math.min(range.startIndex,start),end=Math.max(range.endIndex+1,end)}),{...selection,startOffset:start,endOffset:end,collapsed:start===end}}return selection}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{if(commandInfo.id===SetTextSelectionsOperation.id){const params=commandInfo.params,{unitId,ranges,isEditing}=params,doc=this._univerInstanceService.getUnit(unitId);if(!doc)return;const transformedRanges=ranges.map(range=>this._transformCustomRange(doc,range));transformedRanges.some((range,i)=>ranges[i]!==range)&&this._textSelectionManagerService.replaceTextRanges(transformedRanges,isEditing)}}))}},__name(_a3,"DocCustomRangeController"),_a3);DocCustomRangeController=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Ready,DocCustomRangeController),__decorateParam$2(0,core.ICommandService),__decorateParam$2(1,core.Inject(exports.DocSelectionManagerService)),__decorateParam$2(2,core.IUniverInstanceService)],DocCustomRangeController);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const PLUGIN_NAME="DOCS_PLUGIN";var _a4;exports.UniverDocsPlugin=(_a4=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest),this._initializeDependencies(_injector),this._initializeCommands()}_initializeCommands(){[RichTextEditingMutation,DocsRenameMutation,SetTextSelectionsOperation].forEach(command=>{this._injector.get(core.ICommandService).registerCommand(command)})}_initializeDependencies(docInjector){[[exports.DocSelectionManagerService],[DocStateEmitService],[DocCustomRangeController]].forEach(d=>docInjector.add(d))}},__name(_a4,"UniverDocsPlugin"),__publicField(_a4,"pluginName",PLUGIN_NAME),__publicField(_a4,"type",core.UniverInstanceType.UNIVER_DOC),_a4);exports.UniverDocsPlugin=__decorateClass$1([__decorateParam$1(1,core.Inject(core.Injector)),__decorateParam$1(2,core.IConfigService)],exports.UniverDocsPlugin);const CUSTOM_RANGE=core.createInterceptorKey("CUSTOM_RANGE"),CUSTOM_DECORATION=core.createInterceptorKey("CUSTOM_DECORATION"),DOC_INTERCEPTOR_POINT={CUSTOM_RANGE,CUSTOM_DECORATION};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),_a5;exports.DocInterceptorService=(_a5=class extends core.Disposable{constructor(_context,_docSkeletonManagerService){super();__publicField(this,"_interceptorsByName",new Map);this._context=_context,this._docSkeletonManagerService=_docSkeletonManagerService;const viewModel=this._docSkeletonManagerService.getViewModel(),unitId=viewModel.getDataModel().getUnitId();if(unitId===core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY||unitId===core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)return;this.disposeWithMe(this.interceptDocumentViewModel(viewModel)),this.disposeWithMe(this.intercept(DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{priority:-1,handler:__name((data,pos,next)=>next(data),"handler")}));let disposableCollection=new core.DisposableCollection;viewModel.segmentViewModels$.subscribe(segmentViewModels=>{disposableCollection.dispose(),disposableCollection=new core.DisposableCollection,segmentViewModels.forEach(segmentViewModel=>{disposableCollection.add(this.interceptDocumentViewModel(segmentViewModel))})}),this.disposeWithMe(disposableCollection)}intercept(name,interceptor){const key=name;this._interceptorsByName.has(key)||this._interceptorsByName.set(key,[]);const interceptors=this._interceptorsByName.get(key);return interceptors.push(interceptor),this._interceptorsByName.set(key,interceptors.sort((a,b)=>{var _a6,_b;return((_a6=b.priority)!=null?_a6:0)-((_b=a.priority)!=null?_b:0)})),this.disposeWithMe(core.toDisposable(()=>core.remove(this._interceptorsByName.get(key),interceptor)))}fetchThroughInterceptors(name){const key=name,interceptors=this._interceptorsByName.get(key);return core.composeInterceptors(interceptors||[])}interceptDocumentViewModel(viewModel){const disposableCollection=new core.DisposableCollection;return disposableCollection.add(viewModel.registerCustomRangeInterceptor({getCustomRange:__name(index=>{var _a6;return this.fetchThroughInterceptors(DOC_INTERCEPTOR_POINT.CUSTOM_RANGE)(viewModel.getCustomRangeRaw(index),{index,unitId:viewModel.getDataModel().getUnitId(),customRanges:(_a6=viewModel.getDataModel().getCustomRanges())!=null?_a6:[]})},"getCustomRange"),getCustomDecoration:__name(index=>{var _a6;return this.fetchThroughInterceptors(DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION)(viewModel.getCustomDecorationRaw(index),{index,unitId:viewModel.getDataModel().getUnitId(),customDecorations:(_a6=viewModel.getDataModel().getCustomDecorations())!=null?_a6:[]})},"getCustomDecoration")})),disposableCollection}},__name(_a5,"DocInterceptorService"),_a5);exports.DocInterceptorService=__decorateClass([core.OnLifecycle(core.LifecycleStages.Starting,exports.DocInterceptorService),__decorateParam(1,core.Inject(exports.DocSkeletonManagerService))],exports.DocInterceptorService);exports.DOC_INTERCEPTOR_POINT=DOC_INTERCEPTOR_POINT;exports.DocStateEmitService=DocStateEmitService;exports.RichTextEditingMutation=RichTextEditingMutation;exports.SetTextSelectionsOperation=SetTextSelectionsOperation;
|
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { CommandType, RxDisposable, ICommandService, Inject, LocaleService,
|
|
5
|
+
import { CommandType, RxDisposable, UniverInstanceType, ICommandService, IUniverInstanceService, Inject, LocaleService, isInternalEditorID, JSONX, OnLifecycle, LifecycleStages, Disposable, BuildTextUtils, Plugin, Injector, IConfigService, createInterceptorKey, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, toDisposable, remove, composeInterceptors } from "@univerjs/core";
|
|
6
6
|
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE, DocumentSkeleton, DocumentViewModel, IRenderManagerService } from "@univerjs/engine-render";
|
|
7
7
|
import { BehaviorSubject, takeUntil } from "rxjs";
|
|
8
8
|
const SetTextSelectionsOperation = {
|
|
@@ -16,7 +16,7 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
|
|
|
16
16
|
return kind && result && __defProp$4(target, key, result), result;
|
|
17
17
|
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a;
|
|
18
18
|
let DocSelectionManagerService = (_a = class extends RxDisposable {
|
|
19
|
-
constructor(_commandService) {
|
|
19
|
+
constructor(_commandService, _univerInstanceService) {
|
|
20
20
|
super();
|
|
21
21
|
__publicField(this, "_currentSelection", null);
|
|
22
22
|
__publicField(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
|
|
@@ -24,7 +24,18 @@ let DocSelectionManagerService = (_a = class extends RxDisposable {
|
|
|
24
24
|
__publicField(this, "textSelection$", this._textSelection$.asObservable());
|
|
25
25
|
__publicField(this, "_refreshSelection$", new BehaviorSubject(null));
|
|
26
26
|
__publicField(this, "refreshSelection$", this._refreshSelection$.asObservable());
|
|
27
|
-
this._commandService = _commandService;
|
|
27
|
+
this._commandService = _commandService, this._univerInstanceService = _univerInstanceService, this._listenCurrentUnit();
|
|
28
|
+
}
|
|
29
|
+
_listenCurrentUnit() {
|
|
30
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((documentModel) => {
|
|
31
|
+
if (documentModel == null)
|
|
32
|
+
return;
|
|
33
|
+
const unitId = documentModel.getUnitId();
|
|
34
|
+
this._setCurrentSelectionNotRefresh({
|
|
35
|
+
unitId,
|
|
36
|
+
subUnitId: unitId
|
|
37
|
+
});
|
|
38
|
+
});
|
|
28
39
|
}
|
|
29
40
|
getCurrentSelection() {
|
|
30
41
|
return this._currentSelection;
|
|
@@ -43,16 +54,6 @@ let DocSelectionManagerService = (_a = class extends RxDisposable {
|
|
|
43
54
|
setCurrentSelection(param) {
|
|
44
55
|
this._currentSelection = param, this._refresh(param);
|
|
45
56
|
}
|
|
46
|
-
setCurrentSelectionNotRefresh(param) {
|
|
47
|
-
var _a6;
|
|
48
|
-
const { unitId, subUnitId } = (_a6 = this._currentSelection) != null ? _a6 : {}, { unitId: newUnitId, subUnitId: newSubUnitId } = param;
|
|
49
|
-
(unitId !== newUnitId || subUnitId !== newSubUnitId) && (unitId && subUnitId && this._refreshSelection$.next({
|
|
50
|
-
unitId,
|
|
51
|
-
subUnitId,
|
|
52
|
-
docRanges: [],
|
|
53
|
-
isEditing: !1
|
|
54
|
-
}), this._currentSelection = param);
|
|
55
|
-
}
|
|
56
57
|
getCurrentTextRanges() {
|
|
57
58
|
var _a6;
|
|
58
59
|
return (_a6 = this._getTextRanges(this._currentSelection)) == null ? void 0 : _a6.textRanges;
|
|
@@ -109,7 +110,8 @@ let DocSelectionManagerService = (_a = class extends RxDisposable {
|
|
|
109
110
|
options
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
+
// Only use in doc-selection-render.controller.ts
|
|
114
|
+
__replaceTextRangesWithNoRefresh(textSelectionInfo) {
|
|
113
115
|
if (this._currentSelection == null)
|
|
114
116
|
return;
|
|
115
117
|
const params = {
|
|
@@ -130,6 +132,16 @@ let DocSelectionManagerService = (_a = class extends RxDisposable {
|
|
|
130
132
|
dispose() {
|
|
131
133
|
this._textSelection$.complete();
|
|
132
134
|
}
|
|
135
|
+
_setCurrentSelectionNotRefresh(param) {
|
|
136
|
+
var _a6;
|
|
137
|
+
const { unitId, subUnitId } = (_a6 = this._currentSelection) != null ? _a6 : {}, { unitId: newUnitId, subUnitId: newSubUnitId } = param;
|
|
138
|
+
(unitId !== newUnitId || subUnitId !== newSubUnitId) && (unitId && subUnitId && this._refreshSelection$.next({
|
|
139
|
+
unitId,
|
|
140
|
+
subUnitId,
|
|
141
|
+
docRanges: [],
|
|
142
|
+
isEditing: !1
|
|
143
|
+
}), this._currentSelection = param);
|
|
144
|
+
}
|
|
133
145
|
_getTextRanges(param) {
|
|
134
146
|
var _a6;
|
|
135
147
|
if (param == null)
|
|
@@ -161,7 +173,8 @@ let DocSelectionManagerService = (_a = class extends RxDisposable {
|
|
|
161
173
|
}
|
|
162
174
|
}, __name(_a, "DocSelectionManagerService"), _a);
|
|
163
175
|
DocSelectionManagerService = __decorateClass$4([
|
|
164
|
-
__decorateParam$4(0, ICommandService)
|
|
176
|
+
__decorateParam$4(0, ICommandService),
|
|
177
|
+
__decorateParam$4(1, IUniverInstanceService)
|
|
165
178
|
], DocSelectionManagerService);
|
|
166
179
|
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
167
180
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICommandService, RxDisposable, Nullable } from '@univerjs/core';
|
|
1
|
+
import { ICommandService, IUniverInstanceService, RxDisposable, Nullable } from '@univerjs/core';
|
|
2
2
|
import { IDocSelectionInnerParam, IRectRangeWithStyle, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
3
3
|
interface IDocSelectionManagerSearchParam {
|
|
4
4
|
unitId: string;
|
|
@@ -18,13 +18,15 @@ interface ITextSelectionManagerInsertParam extends IDocSelectionManagerSearchPar
|
|
|
18
18
|
*/
|
|
19
19
|
export declare class DocSelectionManagerService extends RxDisposable {
|
|
20
20
|
private readonly _commandService;
|
|
21
|
+
private readonly _univerInstanceService;
|
|
21
22
|
private _currentSelection;
|
|
22
23
|
private readonly _textSelectionInfo;
|
|
23
24
|
private readonly _textSelection$;
|
|
24
25
|
readonly textSelection$: import('rxjs').Observable<Nullable<ITextSelectionManagerInsertParam>>;
|
|
25
26
|
private readonly _refreshSelection$;
|
|
26
27
|
readonly refreshSelection$: import('rxjs').Observable<Nullable<IRefreshSelectionParam>>;
|
|
27
|
-
constructor(_commandService: ICommandService);
|
|
28
|
+
constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService);
|
|
29
|
+
private _listenCurrentUnit;
|
|
28
30
|
getCurrentSelection(): Nullable<IDocSelectionManagerSearchParam>;
|
|
29
31
|
/**
|
|
30
32
|
* @deprecated
|
|
@@ -32,7 +34,6 @@ export declare class DocSelectionManagerService extends RxDisposable {
|
|
|
32
34
|
getCurrentSelectionInfo(): IDocSelectionInnerParam | undefined;
|
|
33
35
|
refreshSelection(): void;
|
|
34
36
|
setCurrentSelection(param: IDocSelectionManagerSearchParam): void;
|
|
35
|
-
setCurrentSelectionNotRefresh(param: IDocSelectionManagerSearchParam): void;
|
|
36
37
|
getCurrentTextRanges(): Readonly<Nullable<ITextRangeWithStyle[]>>;
|
|
37
38
|
getCurrentRectRanges(): Readonly<Nullable<IRectRangeWithStyle[]>>;
|
|
38
39
|
getDocRanges(): ITextRangeWithStyle[];
|
|
@@ -46,8 +47,9 @@ export declare class DocSelectionManagerService extends RxDisposable {
|
|
|
46
47
|
replaceTextRanges(docRanges: ISuccinctDocRangeParam[], isEditing?: boolean, options?: {
|
|
47
48
|
[key: string]: boolean;
|
|
48
49
|
}): void;
|
|
49
|
-
|
|
50
|
+
__replaceTextRangesWithNoRefresh(textSelectionInfo: IDocSelectionInnerParam): void;
|
|
50
51
|
dispose(): void;
|
|
52
|
+
private _setCurrentSelectionNotRefresh;
|
|
51
53
|
private _getTextRanges;
|
|
52
54
|
private _refresh;
|
|
53
55
|
private _replaceByParam;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IUniverInstanceService, LocaleService, RxDisposable, DocumentDataModel, Nullable } from '@univerjs/core';
|
|
2
|
+
import { DocumentSkeleton, DocumentViewModel, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
3
|
/**
|
|
4
4
|
* This service is for document build and manage doc skeletons. It also manages
|
|
5
5
|
* DocumentViewModels.
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","rxjs"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverDocs={},global.UniverCore,global.UniverEngineRender,global.rxjs))})(this,function(exports2,core,engineRender,rxjs){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c,_d,_e;const SetTextSelectionsOperation={id:"doc.operation.set-selections",type:core.CommandType.OPERATION,handler:__name((_,__)=>!0,"handler")};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4");exports2.DocSelectionManagerService=(_a=class extends core.RxDisposable{constructor(_commandService){super();__publicField(this,"_currentSelection",null);__publicField(this,"_textSelectionInfo",new Map);__publicField(this,"_textSelection$",new rxjs.BehaviorSubject(null));__publicField(this,"textSelection$",this._textSelection$.asObservable());__publicField(this,"_refreshSelection$",new rxjs.BehaviorSubject(null));__publicField(this,"refreshSelection$",this._refreshSelection$.asObservable());this._commandService=_commandService}getCurrentSelection(){return this._currentSelection}getCurrentSelectionInfo(){return this._getTextRanges(this._currentSelection)}refreshSelection(){this._currentSelection!=null&&this._refresh(this._currentSelection)}setCurrentSelection(param){this._currentSelection=param,this._refresh(param)}setCurrentSelectionNotRefresh(param){var _a2;const{unitId,subUnitId}=(_a2=this._currentSelection)!=null?_a2:{},{unitId:newUnitId,subUnitId:newSubUnitId}=param;(unitId!==newUnitId||subUnitId!==newSubUnitId)&&(unitId&&subUnitId&&this._refreshSelection$.next({unitId,subUnitId,docRanges:[],isEditing:!1}),this._currentSelection=param)}getCurrentTextRanges(){var _a2;return(_a2=this._getTextRanges(this._currentSelection))==null?void 0:_a2.textRanges}getCurrentRectRanges(){var _a2;return(_a2=this._getTextRanges(this._currentSelection))==null?void 0:_a2.rectRanges}getDocRanges(){var _a2,_b2;const textRanges=(_a2=this.getCurrentTextRanges())!=null?_a2:[],rectRanges=(_b2=this.getCurrentRectRanges())!=null?_b2:[];return[...textRanges,...rectRanges].filter(range=>range.startOffset!=null&&range.endOffset!=null).sort((a,b)=>a.startOffset>b.startOffset?1:a.startOffset<b.startOffset?-1:0)}getActiveTextRange(){const selectionInfo=this._getTextRanges(this._currentSelection);if(selectionInfo==null)return;const{textRanges}=selectionInfo;return textRanges.find(textRange=>textRange.isActive)}getActiveRectRange(){const selectionInfo=this._getTextRanges(this._currentSelection);if(selectionInfo==null)return;const{rectRanges}=selectionInfo;return rectRanges.find(rectRange=>rectRange.isActive)}add(textRanges,isEditing=!0){this._currentSelection!=null&&this._addByParam({...this._currentSelection,textRanges,rectRanges:[],segmentId:"",segmentPage:-1,isEditing,style:engineRender.NORMAL_TEXT_SELECTION_PLUGIN_STYLE})}replaceTextRanges(docRanges,isEditing=!0,options){if(this._currentSelection==null)return;const{unitId,subUnitId}=this._currentSelection;this._refreshSelection$.next({unitId,subUnitId,docRanges,isEditing,options})}replaceTextRangesWithNoRefresh(textSelectionInfo){if(this._currentSelection==null)return;const params={...this._currentSelection,...textSelectionInfo};this._replaceByParam(params),this._textSelection$.next(params);const{unitId,subUnitId,segmentId,style,textRanges,rectRanges,isEditing}=params,ranges=[...textRanges,...rectRanges].filter(range=>range.startOffset!=null&&range.endOffset!=null).sort((a,b)=>a.startOffset>b.startOffset?1:a.startOffset<b.startOffset?-1:0);this._commandService.executeCommand(SetTextSelectionsOperation.id,{unitId,subUnitId,segmentId,style,isEditing,ranges})}dispose(){this._textSelection$.complete()}_getTextRanges(param){var _a2;if(param==null)return;const{unitId,subUnitId=""}=param;return(_a2=this._textSelectionInfo.get(unitId))==null?void 0:_a2.get(subUnitId)}_refresh(param){const allTextSelectionInfo=this._getTextRanges(param);if(allTextSelectionInfo==null)return;const{textRanges,rectRanges}=allTextSelectionInfo,docRanges=[...textRanges,...rectRanges],{unitId,subUnitId}=param;this._refreshSelection$.next({unitId,subUnitId,docRanges,isEditing:!1})}_replaceByParam(insertParam){const{unitId,subUnitId,...selectionInsertParam}=insertParam;this._textSelectionInfo.has(unitId)||this._textSelectionInfo.set(unitId,new Map),this._textSelectionInfo.get(unitId).set(subUnitId,{...selectionInsertParam})}_addByParam(insertParam){const{unitId,subUnitId,...selectionInsertParam}=insertParam;this._textSelectionInfo.has(unitId)||this._textSelectionInfo.set(unitId,new Map);const unitTextRange=this._textSelectionInfo.get(unitId);unitTextRange.has(subUnitId)?unitTextRange.get(subUnitId).textRanges.push(...insertParam.textRanges):unitTextRange.set(subUnitId,{...selectionInsertParam})}},__name(_a,"DocSelectionManagerService"),_a),exports2.DocSelectionManagerService=__decorateClass$4([__decorateParam$4(0,core.ICommandService)],exports2.DocSelectionManagerService);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3");exports2.DocSkeletonManagerService=(_b=class extends core.RxDisposable{constructor(_context,_localeService,_univerInstanceService){super();__publicField(this,"_skeleton");__publicField(this,"_docViewModel");__publicField(this,"_currentSkeleton$",new rxjs.BehaviorSubject(null));__publicField(this,"currentSkeleton$",this._currentSkeleton$.asObservable());__publicField(this,"_currentSkeletonBefore$",new rxjs.BehaviorSubject(null));__publicField(this,"currentSkeletonBefore$",this._currentSkeletonBefore$.asObservable());__publicField(this,"_currentViewModel$",new rxjs.BehaviorSubject(null));__publicField(this,"currentViewModel$",this._currentViewModel$.asObservable());this._context=_context,this._localeService=_localeService,this._univerInstanceService=_univerInstanceService,this._init(),this._univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_DOC).pipe(rxjs.takeUntil(this.dispose$)).subscribe(documentModel=>{documentModel&&documentModel.getUnitId()===this._context.unitId&&this._update(documentModel)})}dispose(){super.dispose(),this._currentSkeletonBefore$.complete(),this._currentSkeleton$.complete()}getSkeleton(){return this._skeleton}getViewModel(){return this._docViewModel}_init(){const documentDataModel=this._context.unit;this._update(documentDataModel)}_update(documentDataModel){const unitId=this._context.unitId;if(documentDataModel.getBody()==null)return;this._docViewModel&&core.isInternalEditorID(unitId)?(this._docViewModel.reset(documentDataModel),this._context.unit=documentDataModel):this._docViewModel||(this._docViewModel=this._buildDocViewModel(documentDataModel)),this._skeleton||(this._skeleton=this._buildSkeleton(this._docViewModel));const skeleton=this._skeleton;skeleton.calculate(),this._currentSkeletonBefore$.next(skeleton),this._currentSkeleton$.next(skeleton),this._currentViewModel$.next(this._docViewModel)}_buildSkeleton(documentViewModel){return engineRender.DocumentSkeleton.create(documentViewModel,this._localeService)}_buildDocViewModel(documentDataModel){return new engineRender.DocumentViewModel(documentDataModel)}},__name(_b,"DocSkeletonManagerService"),_b),exports2.DocSkeletonManagerService=__decorateClass$3([__decorateParam$3(1,core.Inject(core.LocaleService)),__decorateParam$3(2,core.IUniverInstanceService)],exports2.DocSkeletonManagerService);const _DocStateEmitService=class _DocStateEmitService extends core.RxDisposable{constructor(){super();__publicField(this,"_docStateChangeParams$",new rxjs.BehaviorSubject(null));__publicField(this,"docStateChangeParams$",this._docStateChangeParams$.asObservable())}emitStateChangeInfo(params){this._docStateChangeParams$.next(params)}dispose(){super.dispose(),this._docStateChangeParams$.complete()}};__name(_DocStateEmitService,"DocStateEmitService");let DocStateEmitService=_DocStateEmitService;const RichTextEditingMutationId="doc.mutation.rich-text-editing",RichTextEditingMutation={id:RichTextEditingMutationId,type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{var _a2,_b2;const{unitId,segmentId="",actions,textRanges,prevTextRanges,trigger,noHistory,isCompositionEnd,noNeedSetTextRange,debounce}=params,univerInstanceService=accessor.get(core.IUniverInstanceService),renderManagerService=accessor.get(engineRender.IRenderManagerService),docStateEmitService=accessor.get(DocStateEmitService),documentDataModel=univerInstanceService.getUniverDocInstance(unitId),documentViewModel=(_a2=renderManagerService.getRenderById(unitId))==null?void 0:_a2.with(exports2.DocSkeletonManagerService).getViewModel();if(documentDataModel==null||documentViewModel==null)throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${unitId}`);const docSelectionManagerService=accessor.get(exports2.DocSelectionManagerService),docRanges=(_b2=docSelectionManagerService.getDocRanges())!=null?_b2:[],disabled=!!documentDataModel.getSnapshot().disabled;if(core.JSONX.isNoop(actions)||actions&&actions.length===0||disabled)return{unitId,actions:[],textRanges:docRanges};const undoActions=core.JSONX.invertWithDoc(actions,documentDataModel.getSnapshot());documentDataModel.apply(actions),documentViewModel.reset(documentDataModel),!noNeedSetTextRange&&textRanges&&trigger!=null&&queueMicrotask(()=>{docSelectionManagerService.replaceTextRanges(textRanges,!0,params.options)});const changeState={commandId:RichTextEditingMutationId,unitId,segmentId,trigger,noHistory,debounce,redoState:{actions,textRanges},undoState:{actions:undoActions,textRanges:prevTextRanges!=null?prevTextRanges:docRanges},isCompositionEnd};return docStateEmitService.emitStateChangeInfo(changeState),{unitId,actions:undoActions,textRanges:docRanges}},"handler")},DocsRenameMutation={id:"doc.mutation.rename-doc",type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{const doc=accessor.get(core.IUniverInstanceService).getUnit(params.unitId,core.UniverInstanceType.UNIVER_DOC);return doc?(doc.setName(params.name),!0):!1},"handler")},PLUGIN_CONFIG_KEY="docs.config",defaultPluginConfig={};var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");let DocCustomRangeController=(_c=class extends core.Disposable{constructor(_commandService,_textSelectionManagerService,_univerInstanceService){super(),this._commandService=_commandService,this._textSelectionManagerService=_textSelectionManagerService,this._univerInstanceService=_univerInstanceService,this._initSelectionChange()}_transformCustomRange(doc,selection){var _a2;const{startOffset,endOffset,collapsed}=selection,customRanges=(_a2=doc.getCustomRanges())==null?void 0:_a2.filter(range=>!range.wholeEntity||startOffset<=range.startIndex&&endOffset>range.endIndex?!1:collapsed?range.startIndex<startOffset&&range.endIndex>=endOffset:core.BuildTextUtils.range.isIntersects(startOffset,endOffset-1,range.startIndex,range.endIndex));if(customRanges!=null&&customRanges.length){let start=startOffset,end=endOffset;return customRanges.forEach(range=>{start=Math.min(range.startIndex,start),end=Math.max(range.endIndex+1,end)}),{...selection,startOffset:start,endOffset:end,collapsed:start===end}}return selection}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{if(commandInfo.id===SetTextSelectionsOperation.id){const params=commandInfo.params,{unitId,ranges,isEditing}=params,doc=this._univerInstanceService.getUnit(unitId);if(!doc)return;const transformedRanges=ranges.map(range=>this._transformCustomRange(doc,range));transformedRanges.some((range,i)=>ranges[i]!==range)&&this._textSelectionManagerService.replaceTextRanges(transformedRanges,isEditing)}}))}},__name(_c,"DocCustomRangeController"),_c);DocCustomRangeController=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Ready,DocCustomRangeController),__decorateParam$2(0,core.ICommandService),__decorateParam$2(1,core.Inject(exports2.DocSelectionManagerService)),__decorateParam$2(2,core.IUniverInstanceService)],DocCustomRangeController);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const PLUGIN_NAME="DOCS_PLUGIN";exports2.UniverDocsPlugin=(_d=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest),this._initializeDependencies(_injector),this._initializeCommands()}_initializeCommands(){[RichTextEditingMutation,DocsRenameMutation,SetTextSelectionsOperation].forEach(command=>{this._injector.get(core.ICommandService).registerCommand(command)})}_initializeDependencies(docInjector){[[exports2.DocSelectionManagerService],[DocStateEmitService],[DocCustomRangeController]].forEach(d=>docInjector.add(d))}},__name(_d,"UniverDocsPlugin"),__publicField(_d,"pluginName",PLUGIN_NAME),__publicField(_d,"type",core.UniverInstanceType.UNIVER_DOC),_d),exports2.UniverDocsPlugin=__decorateClass$1([__decorateParam$1(1,core.Inject(core.Injector)),__decorateParam$1(2,core.IConfigService)],exports2.UniverDocsPlugin);const CUSTOM_RANGE=core.createInterceptorKey("CUSTOM_RANGE"),CUSTOM_DECORATION=core.createInterceptorKey("CUSTOM_DECORATION"),DOC_INTERCEPTOR_POINT={CUSTOM_RANGE,CUSTOM_DECORATION};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");exports2.DocInterceptorService=(_e=class extends core.Disposable{constructor(_context,_docSkeletonManagerService){super();__publicField(this,"_interceptorsByName",new Map);this._context=_context,this._docSkeletonManagerService=_docSkeletonManagerService;const viewModel=this._docSkeletonManagerService.getViewModel(),unitId=viewModel.getDataModel().getUnitId();if(unitId===core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY||unitId===core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)return;this.disposeWithMe(this.interceptDocumentViewModel(viewModel)),this.disposeWithMe(this.intercept(DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{priority:-1,handler:__name((data,pos,next)=>next(data),"handler")}));let disposableCollection=new core.DisposableCollection;viewModel.segmentViewModels$.subscribe(segmentViewModels=>{disposableCollection.dispose(),disposableCollection=new core.DisposableCollection,segmentViewModels.forEach(segmentViewModel=>{disposableCollection.add(this.interceptDocumentViewModel(segmentViewModel))})}),this.disposeWithMe(disposableCollection)}intercept(name,interceptor){const key=name;this._interceptorsByName.has(key)||this._interceptorsByName.set(key,[]);const interceptors=this._interceptorsByName.get(key);return interceptors.push(interceptor),this._interceptorsByName.set(key,interceptors.sort((a,b)=>{var _a2,_b2;return((_a2=b.priority)!=null?_a2:0)-((_b2=a.priority)!=null?_b2:0)})),this.disposeWithMe(core.toDisposable(()=>core.remove(this._interceptorsByName.get(key),interceptor)))}fetchThroughInterceptors(name){const key=name,interceptors=this._interceptorsByName.get(key);return core.composeInterceptors(interceptors||[])}interceptDocumentViewModel(viewModel){const disposableCollection=new core.DisposableCollection;return disposableCollection.add(viewModel.registerCustomRangeInterceptor({getCustomRange:__name(index=>{var _a2;return this.fetchThroughInterceptors(DOC_INTERCEPTOR_POINT.CUSTOM_RANGE)(viewModel.getCustomRangeRaw(index),{index,unitId:viewModel.getDataModel().getUnitId(),customRanges:(_a2=viewModel.getDataModel().getCustomRanges())!=null?_a2:[]})},"getCustomRange"),getCustomDecoration:__name(index=>{var _a2;return this.fetchThroughInterceptors(DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION)(viewModel.getCustomDecorationRaw(index),{index,unitId:viewModel.getDataModel().getUnitId(),customDecorations:(_a2=viewModel.getDataModel().getCustomDecorations())!=null?_a2:[]})},"getCustomDecoration")})),disposableCollection}},__name(_e,"DocInterceptorService"),_e),exports2.DocInterceptorService=__decorateClass([core.OnLifecycle(core.LifecycleStages.Starting,exports2.DocInterceptorService),__decorateParam(1,core.Inject(exports2.DocSkeletonManagerService))],exports2.DocInterceptorService),exports2.DOC_INTERCEPTOR_POINT=DOC_INTERCEPTOR_POINT,exports2.DocStateEmitService=DocStateEmitService,exports2.RichTextEditingMutation=RichTextEditingMutation,exports2.SetTextSelectionsOperation=SetTextSelectionsOperation,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","rxjs"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverDocs={},global.UniverCore,global.UniverEngineRender,global.rxjs))})(this,function(exports2,core,engineRender,rxjs){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c,_d,_e;const SetTextSelectionsOperation={id:"doc.operation.set-selections",type:core.CommandType.OPERATION,handler:__name((_,__)=>!0,"handler")};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4");exports2.DocSelectionManagerService=(_a=class extends core.RxDisposable{constructor(_commandService,_univerInstanceService){super();__publicField(this,"_currentSelection",null);__publicField(this,"_textSelectionInfo",new Map);__publicField(this,"_textSelection$",new rxjs.BehaviorSubject(null));__publicField(this,"textSelection$",this._textSelection$.asObservable());__publicField(this,"_refreshSelection$",new rxjs.BehaviorSubject(null));__publicField(this,"refreshSelection$",this._refreshSelection$.asObservable());this._commandService=_commandService,this._univerInstanceService=_univerInstanceService,this._listenCurrentUnit()}_listenCurrentUnit(){this._univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_DOC).pipe(rxjs.takeUntil(this.dispose$)).subscribe(documentModel=>{if(documentModel==null)return;const unitId=documentModel.getUnitId();this._setCurrentSelectionNotRefresh({unitId,subUnitId:unitId})})}getCurrentSelection(){return this._currentSelection}getCurrentSelectionInfo(){return this._getTextRanges(this._currentSelection)}refreshSelection(){this._currentSelection!=null&&this._refresh(this._currentSelection)}setCurrentSelection(param){this._currentSelection=param,this._refresh(param)}getCurrentTextRanges(){var _a2;return(_a2=this._getTextRanges(this._currentSelection))==null?void 0:_a2.textRanges}getCurrentRectRanges(){var _a2;return(_a2=this._getTextRanges(this._currentSelection))==null?void 0:_a2.rectRanges}getDocRanges(){var _a2,_b2;const textRanges=(_a2=this.getCurrentTextRanges())!=null?_a2:[],rectRanges=(_b2=this.getCurrentRectRanges())!=null?_b2:[];return[...textRanges,...rectRanges].filter(range=>range.startOffset!=null&&range.endOffset!=null).sort((a,b)=>a.startOffset>b.startOffset?1:a.startOffset<b.startOffset?-1:0)}getActiveTextRange(){const selectionInfo=this._getTextRanges(this._currentSelection);if(selectionInfo==null)return;const{textRanges}=selectionInfo;return textRanges.find(textRange=>textRange.isActive)}getActiveRectRange(){const selectionInfo=this._getTextRanges(this._currentSelection);if(selectionInfo==null)return;const{rectRanges}=selectionInfo;return rectRanges.find(rectRange=>rectRange.isActive)}add(textRanges,isEditing=!0){this._currentSelection!=null&&this._addByParam({...this._currentSelection,textRanges,rectRanges:[],segmentId:"",segmentPage:-1,isEditing,style:engineRender.NORMAL_TEXT_SELECTION_PLUGIN_STYLE})}replaceTextRanges(docRanges,isEditing=!0,options){if(this._currentSelection==null)return;const{unitId,subUnitId}=this._currentSelection;this._refreshSelection$.next({unitId,subUnitId,docRanges,isEditing,options})}__replaceTextRangesWithNoRefresh(textSelectionInfo){if(this._currentSelection==null)return;const params={...this._currentSelection,...textSelectionInfo};this._replaceByParam(params),this._textSelection$.next(params);const{unitId,subUnitId,segmentId,style,textRanges,rectRanges,isEditing}=params,ranges=[...textRanges,...rectRanges].filter(range=>range.startOffset!=null&&range.endOffset!=null).sort((a,b)=>a.startOffset>b.startOffset?1:a.startOffset<b.startOffset?-1:0);this._commandService.executeCommand(SetTextSelectionsOperation.id,{unitId,subUnitId,segmentId,style,isEditing,ranges})}dispose(){this._textSelection$.complete()}_setCurrentSelectionNotRefresh(param){var _a2;const{unitId,subUnitId}=(_a2=this._currentSelection)!=null?_a2:{},{unitId:newUnitId,subUnitId:newSubUnitId}=param;(unitId!==newUnitId||subUnitId!==newSubUnitId)&&(unitId&&subUnitId&&this._refreshSelection$.next({unitId,subUnitId,docRanges:[],isEditing:!1}),this._currentSelection=param)}_getTextRanges(param){var _a2;if(param==null)return;const{unitId,subUnitId=""}=param;return(_a2=this._textSelectionInfo.get(unitId))==null?void 0:_a2.get(subUnitId)}_refresh(param){const allTextSelectionInfo=this._getTextRanges(param);if(allTextSelectionInfo==null)return;const{textRanges,rectRanges}=allTextSelectionInfo,docRanges=[...textRanges,...rectRanges],{unitId,subUnitId}=param;this._refreshSelection$.next({unitId,subUnitId,docRanges,isEditing:!1})}_replaceByParam(insertParam){const{unitId,subUnitId,...selectionInsertParam}=insertParam;this._textSelectionInfo.has(unitId)||this._textSelectionInfo.set(unitId,new Map),this._textSelectionInfo.get(unitId).set(subUnitId,{...selectionInsertParam})}_addByParam(insertParam){const{unitId,subUnitId,...selectionInsertParam}=insertParam;this._textSelectionInfo.has(unitId)||this._textSelectionInfo.set(unitId,new Map);const unitTextRange=this._textSelectionInfo.get(unitId);unitTextRange.has(subUnitId)?unitTextRange.get(subUnitId).textRanges.push(...insertParam.textRanges):unitTextRange.set(subUnitId,{...selectionInsertParam})}},__name(_a,"DocSelectionManagerService"),_a),exports2.DocSelectionManagerService=__decorateClass$4([__decorateParam$4(0,core.ICommandService),__decorateParam$4(1,core.IUniverInstanceService)],exports2.DocSelectionManagerService);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3");exports2.DocSkeletonManagerService=(_b=class extends core.RxDisposable{constructor(_context,_localeService,_univerInstanceService){super();__publicField(this,"_skeleton");__publicField(this,"_docViewModel");__publicField(this,"_currentSkeleton$",new rxjs.BehaviorSubject(null));__publicField(this,"currentSkeleton$",this._currentSkeleton$.asObservable());__publicField(this,"_currentSkeletonBefore$",new rxjs.BehaviorSubject(null));__publicField(this,"currentSkeletonBefore$",this._currentSkeletonBefore$.asObservable());__publicField(this,"_currentViewModel$",new rxjs.BehaviorSubject(null));__publicField(this,"currentViewModel$",this._currentViewModel$.asObservable());this._context=_context,this._localeService=_localeService,this._univerInstanceService=_univerInstanceService,this._init(),this._univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_DOC).pipe(rxjs.takeUntil(this.dispose$)).subscribe(documentModel=>{documentModel&&documentModel.getUnitId()===this._context.unitId&&this._update(documentModel)})}dispose(){super.dispose(),this._currentSkeletonBefore$.complete(),this._currentSkeleton$.complete()}getSkeleton(){return this._skeleton}getViewModel(){return this._docViewModel}_init(){const documentDataModel=this._context.unit;this._update(documentDataModel)}_update(documentDataModel){const unitId=this._context.unitId;if(documentDataModel.getBody()==null)return;this._docViewModel&&core.isInternalEditorID(unitId)?(this._docViewModel.reset(documentDataModel),this._context.unit=documentDataModel):this._docViewModel||(this._docViewModel=this._buildDocViewModel(documentDataModel)),this._skeleton||(this._skeleton=this._buildSkeleton(this._docViewModel));const skeleton=this._skeleton;skeleton.calculate(),this._currentSkeletonBefore$.next(skeleton),this._currentSkeleton$.next(skeleton),this._currentViewModel$.next(this._docViewModel)}_buildSkeleton(documentViewModel){return engineRender.DocumentSkeleton.create(documentViewModel,this._localeService)}_buildDocViewModel(documentDataModel){return new engineRender.DocumentViewModel(documentDataModel)}},__name(_b,"DocSkeletonManagerService"),_b),exports2.DocSkeletonManagerService=__decorateClass$3([__decorateParam$3(1,core.Inject(core.LocaleService)),__decorateParam$3(2,core.IUniverInstanceService)],exports2.DocSkeletonManagerService);const _DocStateEmitService=class _DocStateEmitService extends core.RxDisposable{constructor(){super();__publicField(this,"_docStateChangeParams$",new rxjs.BehaviorSubject(null));__publicField(this,"docStateChangeParams$",this._docStateChangeParams$.asObservable())}emitStateChangeInfo(params){this._docStateChangeParams$.next(params)}dispose(){super.dispose(),this._docStateChangeParams$.complete()}};__name(_DocStateEmitService,"DocStateEmitService");let DocStateEmitService=_DocStateEmitService;const RichTextEditingMutationId="doc.mutation.rich-text-editing",RichTextEditingMutation={id:RichTextEditingMutationId,type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{var _a2,_b2;const{unitId,segmentId="",actions,textRanges,prevTextRanges,trigger,noHistory,isCompositionEnd,noNeedSetTextRange,debounce}=params,univerInstanceService=accessor.get(core.IUniverInstanceService),renderManagerService=accessor.get(engineRender.IRenderManagerService),docStateEmitService=accessor.get(DocStateEmitService),documentDataModel=univerInstanceService.getUniverDocInstance(unitId),documentViewModel=(_a2=renderManagerService.getRenderById(unitId))==null?void 0:_a2.with(exports2.DocSkeletonManagerService).getViewModel();if(documentDataModel==null||documentViewModel==null)throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${unitId}`);const docSelectionManagerService=accessor.get(exports2.DocSelectionManagerService),docRanges=(_b2=docSelectionManagerService.getDocRanges())!=null?_b2:[],disabled=!!documentDataModel.getSnapshot().disabled;if(core.JSONX.isNoop(actions)||actions&&actions.length===0||disabled)return{unitId,actions:[],textRanges:docRanges};const undoActions=core.JSONX.invertWithDoc(actions,documentDataModel.getSnapshot());documentDataModel.apply(actions),documentViewModel.reset(documentDataModel),!noNeedSetTextRange&&textRanges&&trigger!=null&&queueMicrotask(()=>{docSelectionManagerService.replaceTextRanges(textRanges,!0,params.options)});const changeState={commandId:RichTextEditingMutationId,unitId,segmentId,trigger,noHistory,debounce,redoState:{actions,textRanges},undoState:{actions:undoActions,textRanges:prevTextRanges!=null?prevTextRanges:docRanges},isCompositionEnd};return docStateEmitService.emitStateChangeInfo(changeState),{unitId,actions:undoActions,textRanges:docRanges}},"handler")},DocsRenameMutation={id:"doc.mutation.rename-doc",type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{const doc=accessor.get(core.IUniverInstanceService).getUnit(params.unitId,core.UniverInstanceType.UNIVER_DOC);return doc?(doc.setName(params.name),!0):!1},"handler")},PLUGIN_CONFIG_KEY="docs.config",defaultPluginConfig={};var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");let DocCustomRangeController=(_c=class extends core.Disposable{constructor(_commandService,_textSelectionManagerService,_univerInstanceService){super(),this._commandService=_commandService,this._textSelectionManagerService=_textSelectionManagerService,this._univerInstanceService=_univerInstanceService,this._initSelectionChange()}_transformCustomRange(doc,selection){var _a2;const{startOffset,endOffset,collapsed}=selection,customRanges=(_a2=doc.getCustomRanges())==null?void 0:_a2.filter(range=>!range.wholeEntity||startOffset<=range.startIndex&&endOffset>range.endIndex?!1:collapsed?range.startIndex<startOffset&&range.endIndex>=endOffset:core.BuildTextUtils.range.isIntersects(startOffset,endOffset-1,range.startIndex,range.endIndex));if(customRanges!=null&&customRanges.length){let start=startOffset,end=endOffset;return customRanges.forEach(range=>{start=Math.min(range.startIndex,start),end=Math.max(range.endIndex+1,end)}),{...selection,startOffset:start,endOffset:end,collapsed:start===end}}return selection}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{if(commandInfo.id===SetTextSelectionsOperation.id){const params=commandInfo.params,{unitId,ranges,isEditing}=params,doc=this._univerInstanceService.getUnit(unitId);if(!doc)return;const transformedRanges=ranges.map(range=>this._transformCustomRange(doc,range));transformedRanges.some((range,i)=>ranges[i]!==range)&&this._textSelectionManagerService.replaceTextRanges(transformedRanges,isEditing)}}))}},__name(_c,"DocCustomRangeController"),_c);DocCustomRangeController=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Ready,DocCustomRangeController),__decorateParam$2(0,core.ICommandService),__decorateParam$2(1,core.Inject(exports2.DocSelectionManagerService)),__decorateParam$2(2,core.IUniverInstanceService)],DocCustomRangeController);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const PLUGIN_NAME="DOCS_PLUGIN";exports2.UniverDocsPlugin=(_d=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest),this._initializeDependencies(_injector),this._initializeCommands()}_initializeCommands(){[RichTextEditingMutation,DocsRenameMutation,SetTextSelectionsOperation].forEach(command=>{this._injector.get(core.ICommandService).registerCommand(command)})}_initializeDependencies(docInjector){[[exports2.DocSelectionManagerService],[DocStateEmitService],[DocCustomRangeController]].forEach(d=>docInjector.add(d))}},__name(_d,"UniverDocsPlugin"),__publicField(_d,"pluginName",PLUGIN_NAME),__publicField(_d,"type",core.UniverInstanceType.UNIVER_DOC),_d),exports2.UniverDocsPlugin=__decorateClass$1([__decorateParam$1(1,core.Inject(core.Injector)),__decorateParam$1(2,core.IConfigService)],exports2.UniverDocsPlugin);const CUSTOM_RANGE=core.createInterceptorKey("CUSTOM_RANGE"),CUSTOM_DECORATION=core.createInterceptorKey("CUSTOM_DECORATION"),DOC_INTERCEPTOR_POINT={CUSTOM_RANGE,CUSTOM_DECORATION};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");exports2.DocInterceptorService=(_e=class extends core.Disposable{constructor(_context,_docSkeletonManagerService){super();__publicField(this,"_interceptorsByName",new Map);this._context=_context,this._docSkeletonManagerService=_docSkeletonManagerService;const viewModel=this._docSkeletonManagerService.getViewModel(),unitId=viewModel.getDataModel().getUnitId();if(unitId===core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY||unitId===core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)return;this.disposeWithMe(this.interceptDocumentViewModel(viewModel)),this.disposeWithMe(this.intercept(DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{priority:-1,handler:__name((data,pos,next)=>next(data),"handler")}));let disposableCollection=new core.DisposableCollection;viewModel.segmentViewModels$.subscribe(segmentViewModels=>{disposableCollection.dispose(),disposableCollection=new core.DisposableCollection,segmentViewModels.forEach(segmentViewModel=>{disposableCollection.add(this.interceptDocumentViewModel(segmentViewModel))})}),this.disposeWithMe(disposableCollection)}intercept(name,interceptor){const key=name;this._interceptorsByName.has(key)||this._interceptorsByName.set(key,[]);const interceptors=this._interceptorsByName.get(key);return interceptors.push(interceptor),this._interceptorsByName.set(key,interceptors.sort((a,b)=>{var _a2,_b2;return((_a2=b.priority)!=null?_a2:0)-((_b2=a.priority)!=null?_b2:0)})),this.disposeWithMe(core.toDisposable(()=>core.remove(this._interceptorsByName.get(key),interceptor)))}fetchThroughInterceptors(name){const key=name,interceptors=this._interceptorsByName.get(key);return core.composeInterceptors(interceptors||[])}interceptDocumentViewModel(viewModel){const disposableCollection=new core.DisposableCollection;return disposableCollection.add(viewModel.registerCustomRangeInterceptor({getCustomRange:__name(index=>{var _a2;return this.fetchThroughInterceptors(DOC_INTERCEPTOR_POINT.CUSTOM_RANGE)(viewModel.getCustomRangeRaw(index),{index,unitId:viewModel.getDataModel().getUnitId(),customRanges:(_a2=viewModel.getDataModel().getCustomRanges())!=null?_a2:[]})},"getCustomRange"),getCustomDecoration:__name(index=>{var _a2;return this.fetchThroughInterceptors(DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION)(viewModel.getCustomDecorationRaw(index),{index,unitId:viewModel.getDataModel().getUnitId(),customDecorations:(_a2=viewModel.getDataModel().getCustomDecorations())!=null?_a2:[]})},"getCustomDecoration")})),disposableCollection}},__name(_e,"DocInterceptorService"),_e),exports2.DocInterceptorService=__decorateClass([core.OnLifecycle(core.LifecycleStages.Starting,exports2.DocInterceptorService),__decorateParam(1,core.Inject(exports2.DocSkeletonManagerService))],exports2.DocInterceptorService),exports2.DOC_INTERCEPTOR_POINT=DOC_INTERCEPTOR_POINT,exports2.DocStateEmitService=DocStateEmitService,exports2.RichTextEditingMutation=RichTextEditingMutation,exports2.SetTextSelectionsOperation=SetTextSelectionsOperation,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UniverSheet normal base-docs",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -47,19 +47,19 @@
|
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"rxjs": ">=7.0.0",
|
|
50
|
-
"@univerjs/core": "0.2.
|
|
51
|
-
"@univerjs/engine-render": "0.2.
|
|
50
|
+
"@univerjs/core": "0.2.15",
|
|
51
|
+
"@univerjs/engine-render": "0.2.15"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@univerjs/core": "0.2.
|
|
55
|
-
"@univerjs/engine-render": "0.2.
|
|
54
|
+
"@univerjs/core": "0.2.15",
|
|
55
|
+
"@univerjs/engine-render": "0.2.15"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"rxjs": "^7.8.1",
|
|
59
59
|
"typescript": "^5.6.2",
|
|
60
60
|
"vite": "^5.4.4",
|
|
61
61
|
"vitest": "^2.0.5",
|
|
62
|
-
"@univerjs-infra/shared": "0.2.
|
|
62
|
+
"@univerjs-infra/shared": "0.2.15"
|
|
63
63
|
},
|
|
64
64
|
"univerSpace": {
|
|
65
65
|
".": {
|