@univerjs/docs-thread-comment-ui 0.7.0 → 0.8.0-nightly.202505261607
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 +2 -2
- package/lib/es/index.js +105 -100
- package/lib/index.js +105 -100
- package/lib/umd/index.js +2 -2
- package/package.json +10 -10
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var re=Object.defineProperty;var ie=(e,t,r)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var H=(e,t,r)=>ie(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),b=require("@univerjs/engine-render"),O=require("@univerjs/thread-comment-ui"),_=require("@univerjs/docs"),V=require("@univerjs/docs-ui"),w=require("@univerjs/thread-comment"),u=require("@univerjs/ui"),
|
|
2
|
-
`},startOffset:m.startOffset,endOffset:m.endOffset,collapsed:!0,threadId:M};return f==null||f.blur(),s.startAdd(y),t.setActiveComment({unitId:I,subUnitId:l,commentId:M}),!0}};var ue=Object.getOwnPropertyDescriptor,Ce=(e,t,r,n)=>{for(var i=n>1?void 0:n?ue(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},U=(e,t)=>(r,n)=>t(r,n,e);let B=class extends c.Disposable{constructor(e,t,r,n,i,o){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=r,this._docThreadCommentService=n,this._renderManagerService=i,this._threadCommentModel=o,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var r,n,i,o;if(t.id===_.SetTextSelectionsOperation.id){const a=t.params,{unitId:s,ranges:C}=a;if(c.isInternalEditorID(s))return;const v=this._univerInstanceService.getUnit(s,c.UniverInstanceType.UNIVER_DOC),m=C[0];if((e==null?void 0:e.startOffset)===(m==null?void 0:m.startOffset)&&(e==null?void 0:e.endOffset)===(m==null?void 0:m.endOffset))return;if(e=m,m&&v){const{startOffset:f,endOffset:I,collapsed:g}=m;let d;if(g?d=(n=(r=v.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(l=>l.startIndex<=f&&l.endIndex>=I-1):d=(o=(i=v.getBody())==null?void 0:i.customDecorations)==null?void 0:o.find(l=>l.startIndex<=f&&l.endIndex>=I-1),d){const l=this._threadCommentModel.getComment(s,T,d.id);l&&!l.resolved&&this._commandService.executeCommand(N.id,{activeComment:{unitId:s,subUnitId:T,commentId:d.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(O.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t,r,n,i;if(e){const o=this._univerInstanceService.getUnit(e.unitId);if(o){const a=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with(V.DocBackScrollRenderController),s=(n=(r=o.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(C=>C.id===e.commentId);s&&a&&a.scrollToRange({startOffset:s.startIndex,endOffset:s.endIndex,collapsed:!1})}}(!e||e.commentId!==((i=this._docThreadCommentService.addingComment)==null?void 0:i.id))&&this._docThreadCommentService.endAdd()}))}};B=Ce([U(0,c.Inject(O.ThreadCommentPanelService)),U(1,c.IUniverInstanceService),U(2,c.ICommandService),U(3,c.Inject(E)),U(4,b.IRenderManagerService),U(5,c.Inject(w.ThreadCommentModel))],B);var S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},S.apply(this,arguments)},he=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},Q=p.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,o=e.extend,a=he(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),C=p.useRef("_".concat(ge()));return X(r,"".concat(n),{defIds:r.defIds,idSuffix:C.current},S({ref:t,className:s},a),o)});function X(e,t,r,n,i){return p.createElement(e.tag,S(S({key:t},ve(e,r,i)),n),(fe(e,r).children||[]).map(function(o,a){return X(o,"".concat(t,"-").concat(e.tag,"-").concat(a),r,void 0,i)}))}function ve(e,t,r){var n=S({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1),e.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(o){var a=o[0],s=o[1];a==="mask"&&typeof s=="string"&&(n[a]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var i=t.defIds;return!i||i.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(o){var a=o[0],s=o[1];typeof s=="string"&&(n[a]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function fe(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?S(S({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?S(S({},i),{attrs:S(S({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function ge(){return Math.random().toString(36).substring(2,8)}Q.displayName="UniverIcon";var Ie={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ee=p.forwardRef(function(e,t){return p.createElement(Q,Object.assign({},e,{id:"comment-single",ref:t,icon:Ie}))});ee.displayName="CommentSingle";const Se={[u.RibbonStartGroup.OTHERS]:{[z.id]:{order:1,menuItemFactory:le}},[u.ContextMenuPosition.MAIN_AREA]:{[u.ContextMenuGroup.DATA]:{[j.id]:{order:1,menuItemFactory:me}}}};var pe=Object.getOwnPropertyDescriptor,_e=(e,t,r,n)=>{for(var i=n>1?void 0:n?pe(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},L=(e,t)=>(r,n)=>t(r,n,e);let q=class extends c.Disposable{constructor(e,t,r){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=r,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[G,Z,N,j,z].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(Se)}_initComponents(){[P].forEach(e=>{this.disposeWithMe(this._componentManager.register(e.componentKey,e))}),this.disposeWithMe(this._componentManager.register("CommentSingle",ee))}};q=_e([L(0,c.ICommandService),L(1,u.IMenuManagerService),L(2,c.Inject(u.ComponentManager))],q);var Oe=Object.getOwnPropertyDescriptor,Me=(e,t,r,n)=>{for(var i=n>1?void 0:n?Oe(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},x=(e,t)=>(r,n)=>t(r,n,e);let K=class extends c.Disposable{constructor(e,t,r,n,i,o,a){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=r,this._docRenderController=n,this._univerInstanceService=i,this._threadCommentModel=o,this._commandService=a,this._interceptorViewModel(),this._initReRender(),this._initSyncComments()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var r;if(e){this._docRenderController.reRender(e.unitId);return}const t=(r=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_DOC))==null?void 0:r.getUnitId();t&&this._docRenderController.reRender(t)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{e.type==="resolve"&&this._docRenderController.reRender(e.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(_.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,r)=>{if(!e)return r(e);const{unitId:n,index:i,customDecorations:o}=t,a=this._threadCommentPanelService.activeCommentId,{commentId:s,unitId:C}=a||{},v=o.find(g=>g.id===s),m=this._threadCommentModel.getComment(n,T,e.id);if(!m)return r({...e,show:!1});const f=v&&i>=v.startIndex&&i<=v.endIndex,I=C===n&&e.id===s;return r({...e,active:I||f,show:!m.resolved})}})}_initSyncComments(){var i,o,a;const e=this._context.unit.getUnitId(),t=T,r=(a=(o=(i=this._context.unit.getBody())==null?void 0:i.customDecorations)==null?void 0:o.filter(s=>s.type===c.CustomDecorationType.COMMENT).map(s=>s.id))!=null?a:[];r.forEach(s=>{this._threadCommentModel.getComment(e,t,s)||this._threadCommentModel.addComment(e,t,{id:s,threadId:s,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),r.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),T,r);let n=r.sort();this.disposeWithMe(this._commandService.onCommandExecuted(s=>{var C,v,m;if(s.id===_.RichTextEditingMutation.id){if(s.params.unitId!==this._context.unit.getUnitId())return;const I=(m=(v=(C=this._context.unit.getBody())==null?void 0:C.customDecorations)==null?void 0:v.filter(d=>d.type===c.CustomDecorationType.COMMENT).map(d=>d.id))!=null?m:[],g=I.sort();if(JSON.stringify(n)!==JSON.stringify(g)){const d=new Set(n),l=new Set(g),M=new Set,y=new Set;I.forEach(h=>{d.has(h)||M.add(h)}),n.forEach(h=>{l.has(h)||y.add(h)}),n=g,M.forEach(h=>{this._threadCommentModel.getComment(e,t,h)||this._threadCommentModel.addComment(e,t,{id:h,threadId:h,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),this._threadCommentModel.syncThreadComments(e,t,[...M])}}}))}};K=Me([x(1,c.Inject(_.DocInterceptorService)),x(2,c.Inject(O.ThreadCommentPanelService)),x(3,c.Inject(V.DocRenderController)),x(4,c.IUniverInstanceService),x(5,c.Inject(w.ThreadCommentModel)),x(6,c.ICommandService)],K);var Te=Object.defineProperty,De=Object.getOwnPropertyDescriptor,be=(e,t,r)=>t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ye=(e,t,r,n)=>{for(var i=n>1?void 0:n?De(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},W=(e,t)=>(r,n)=>t(r,n,e),te=(e,t,r)=>be(e,typeof t!="symbol"?t+"":t,r);exports.UniverDocsThreadCommentUIPlugin=class extends c.Plugin{constructor(t=k,r,n,i){super(),this._config=t,this._injector=r,this._renderManagerSrv=n,this._configService=i;const{menu:o,...a}=c.merge({},k,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(ae,a)}onStarting(){[[q],[B],[E]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(B),this._injector.get(q)}_initRenderModule(){[K].forEach(t=>{this._renderManagerSrv.registerRenderModule(c.UniverInstanceType.UNIVER_DOC,t)})}};te(exports.UniverDocsThreadCommentUIPlugin,"pluginName",ce);te(exports.UniverDocsThreadCommentUIPlugin,"type",c.UniverInstanceType.UNIVER_DOC);exports.UniverDocsThreadCommentUIPlugin=ye([c.DependentOn(O.UniverThreadCommentUIPlugin),W(1,c.Inject(c.Injector)),W(2,b.IRenderManagerService),W(3,c.IConfigService)],exports.UniverDocsThreadCommentUIPlugin);exports.AddDocCommentComment=G;exports.DeleteDocCommentComment=Z;exports.ShowCommentPanelOperation=N;exports.StartAddCommentOperation=j;
|
|
1
|
+
"use strict";var re=Object.defineProperty;var ie=(e,t,r)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var H=(e,t,r)=>ie(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),b=require("@univerjs/engine-render"),O=require("@univerjs/thread-comment-ui"),_=require("@univerjs/docs"),V=require("@univerjs/docs-ui"),w=require("@univerjs/thread-comment"),u=require("@univerjs/ui"),E=require("rxjs"),oe=require("react/jsx-runtime"),S=require("react"),ce="DOC_THREAD_COMMENT_UI_PLUGIN",M="default_doc",ae="docs-thread-comment-ui.config",k={};var se=Object.getOwnPropertyDescriptor,de=(e,t,r,n)=>{for(var i=n>1?void 0:n?se(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},J=(e,t)=>(r,n)=>t(r,n,e);let P=class extends c.Disposable{constructor(t,r){super();H(this,"_addingComment$",new E.BehaviorSubject(void 0));H(this,"addingComment$",this._addingComment$.asObservable());this._sidebarService=t,this._threadCommentPanelService=r,this.disposeWithMe(()=>{this._addingComment$.complete()})}get addingComment(){return this._addingComment$.getValue()}startAdd(t){this._addingComment$.next(t)}endAdd(){this._addingComment$.next(void 0)}};P=de([J(0,u.ISidebarService),J(1,c.Inject(O.ThreadCommentPanelService))],P);const G={id:"docs.command.add-comment",type:c.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{comment:r,unitId:n}=t,o=await e.get(w.IThreadCommentDataSourceService).addComment(r),a=e.get(c.ICommandService),s=V.addCustomDecorationBySelectionFactory(e,{id:o.threadId,type:c.CustomDecorationType.COMMENT,unitId:n});if(s){const C={id:w.AddCommentMutation.id,params:{unitId:n,subUnitId:M,comment:o}},v={id:O.SetActiveCommentOperation.id,params:{unitId:n,subUnitId:M,commentId:o.id}};return(await c.sequenceExecute([C,s,v],a)).result}return!1}},Z={id:"docs.command.delete-comment",type:c.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{commentId:r,unitId:n}=t,i=e.get(c.ICommandService),o=V.deleteCustomDecorationFactory(e,{id:r,unitId:n});return o?(await c.sequenceExecute([o],i)).result:!1}},Y=e=>{var a;const t=e.get(b.IRenderManagerService),r=e.get(_.DocSelectionManagerService),n=(a=b.withCurrentTypeOfRenderer(c.UniverInstanceType.UNIVER_DOC,_.DocSkeletonManagerService,e.get(c.IUniverInstanceService),t))==null?void 0:a.getSkeleton(),i=n==null?void 0:n.getViewModel().getEditArea();if(i===b.DocumentEditArea.FOOTER||i===b.DocumentEditArea.HEADER)return!0;const o=r.getActiveTextRange();return!!(o==null||o.collapsed)};function me(e){return{id:j.id,type:u.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:u.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_DOC,void 0,c.SHEET_EDITOR_UNITS),disabled$:new E.Observable(function(t){const n=e.get(_.DocSelectionManagerService).textSelection$.pipe(E.debounceTime(16)).subscribe(()=>{t.next(Y(e))});return()=>{n.unsubscribe()}})}}function le(e){return{id:z.id,type:u.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:u.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_DOC)}}const y=()=>{const e=u.useDependency(c.IUniverInstanceService),t=u.useDependency(c.Injector),r=S.useMemo(()=>e.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_DOC).pipe(E.filter(d=>!!d&&!c.isInternalEditorID(d.getUnitId()))),[e]),n=u.useObservable(r),i=S.useMemo(()=>new E.Observable(d=>d.next(M)),[]),o=u.useDependency(_.DocSelectionManagerService),a=S.useMemo(()=>o.textSelection$.pipe(E.debounceTime(16)),[o.textSelection$]);u.useObservable(a);const s=u.useDependency(c.ICommandService),C=u.useDependency(P),v=u.useObservable(C.addingComment$),[m,f]=S.useState([]);if(S.useEffect(()=>{var U;const d=new Set,l=n==null?void 0:n.getCustomDecorations();f((U=l==null?void 0:l.map(h=>h.id).filter(h=>{const T=d.has(h);return d.add(h),!T}))!=null?U:[]);const D=s.onCommandExecuted(h=>{var T;if(h.id===_.RichTextEditingMutation.id){const A=new Set,F=n==null?void 0:n.getCustomDecorations();f((T=F==null?void 0:F.map($=>$.id).filter($=>{const ne=A.has($);return A.add($),!ne}))!=null?T:[])}});return()=>{D.dispose()}},[s,n]),!n)return null;const g=Y(t),I=n.getUnitId();return oe.jsx(O.ThreadCommentPanel,{unitId:I,subUnitId$:i,type:c.UniverInstanceType.UNIVER_DOC,onAdd:()=>{s.executeCommand(j.id)},getSubUnitName:()=>"",disableAdd:g,tempComment:v,onAddComment:d=>{if(!d.parentId){const l={unitId:I,range:v,comment:d};return s.executeCommand(G.id,l),C.endAdd(),!1}return!0},onDeleteComment:d=>{if(!d.parentId){const l={unitId:I,commentId:d.id};return s.executeCommand(Z.id,l),!1}return!0},showComments:m})};y.componentKey="univer.doc.thread-comment-panel";const N={id:"docs.operation.show-comment-panel",type:c.CommandType.OPERATION,handler(e,t){var i;const r=e.get(O.ThreadCommentPanelService),n=e.get(u.ISidebarService);return(!r.panelVisible||((i=n.options.children)==null?void 0:i.label)!==y.componentKey)&&(n.open({header:{title:"threadCommentUI.panel.title"},children:{label:y.componentKey},width:320,onClose:()=>r.setPanelVisible(!1)}),r.setPanelVisible(!0)),t&&r.setActiveComment(t==null?void 0:t.activeComment),!0}},z={id:"docs.operation.toggle-comment-panel",type:c.CommandType.OPERATION,handler(e){var n;const t=e.get(O.ThreadCommentPanelService),r=e.get(u.ISidebarService);return!t.panelVisible||((n=r.options.children)==null?void 0:n.label)!==y.componentKey?(r.open({header:{title:"threadCommentUI.panel.title"},children:{label:y.componentKey},width:320,onClose:()=>t.setPanelVisible(!1)}),t.setPanelVisible(!0)):(r.close(),t.setPanelVisible(!1),t.setActiveComment(null)),!0}},j={id:"docs.operation.start-add-comment",type:c.CommandType.OPERATION,handler(e){var h,T,A;const t=e.get(O.ThreadCommentPanelService),n=e.get(c.IUniverInstanceService).getCurrentUnitForType(c.UniverInstanceType.UNIVER_DOC),i=e.get(_.DocSelectionManagerService),o=e.get(b.IRenderManagerService),a=e.get(c.UserManagerService),s=e.get(P),C=e.get(c.ICommandService),v=e.get(u.ISidebarService),m=i.getActiveTextRange();if(!n||!m)return!1;const f=(h=o.getRenderById(n.getUnitId()))==null?void 0:h.with(V.DocSelectionRenderService);if(f==null||f.setReserveRangesStatus(!0),m.collapsed)return t.panelVisible?(t.setPanelVisible(!1),v.close()):C.executeCommand(N.id),!0;C.executeCommand(N.id);const g=n.getUnitId(),I=((A=(T=n.getBody())==null?void 0:T.dataStream)!=null?A:"").slice(m.startOffset,m.endOffset),d=c.BuildTextUtils.transform.getPlainText(I),l=M,D="",U={unitId:g,subUnitId:l,id:D,ref:d,dT:w.getDT(),personId:a.getCurrentUser().userID,text:{dataStream:`\r
|
|
2
|
+
`},startOffset:m.startOffset,endOffset:m.endOffset,collapsed:!0,threadId:D};return f==null||f.blur(),s.startAdd(U),t.setActiveComment({unitId:g,subUnitId:l,commentId:D}),!0}};var ue=Object.getOwnPropertyDescriptor,Ce=(e,t,r,n)=>{for(var i=n>1?void 0:n?ue(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},x=(e,t)=>(r,n)=>t(r,n,e);let B=class extends c.Disposable{constructor(e,t,r,n,i,o){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=r,this._docThreadCommentService=n,this._renderManagerService=i,this._threadCommentModel=o,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var r,n,i,o;if(t.id===_.SetTextSelectionsOperation.id){const a=t.params,{unitId:s,ranges:C}=a;if(c.isInternalEditorID(s))return;const v=this._univerInstanceService.getUnit(s,c.UniverInstanceType.UNIVER_DOC),m=C[0];if((e==null?void 0:e.startOffset)===(m==null?void 0:m.startOffset)&&(e==null?void 0:e.endOffset)===(m==null?void 0:m.endOffset))return;if(e=m,m&&v){const{startOffset:f,endOffset:g,collapsed:I}=m;let d;if(I?d=(n=(r=v.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(l=>l.startIndex<=f&&l.endIndex>=g-1):d=(o=(i=v.getBody())==null?void 0:i.customDecorations)==null?void 0:o.find(l=>l.startIndex<=f&&l.endIndex>=g-1),d){const l=this._threadCommentModel.getComment(s,M,d.id);l&&!l.resolved&&this._commandService.executeCommand(N.id,{activeComment:{unitId:s,subUnitId:M,commentId:d.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(O.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t,r,n,i;if(e){const o=this._univerInstanceService.getUnit(e.unitId);if(o){const a=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with(V.DocBackScrollRenderController),s=(n=(r=o.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(C=>C.id===e.commentId);s&&a&&a.scrollToRange({startOffset:s.startIndex,endOffset:s.endIndex,collapsed:!1})}}(!e||e.commentId!==((i=this._docThreadCommentService.addingComment)==null?void 0:i.id))&&this._docThreadCommentService.endAdd()}))}};B=Ce([x(0,c.Inject(O.ThreadCommentPanelService)),x(1,c.IUniverInstanceService),x(2,c.ICommandService),x(3,c.Inject(P)),x(4,b.IRenderManagerService),x(5,c.Inject(w.ThreadCommentModel))],B);var p=function(){return p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},p.apply(this,arguments)},he=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},Q=S.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,o=e.extend,a=he(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),C=S.useRef("_".concat(Ie()));return X(r,"".concat(n),{defIds:r.defIds,idSuffix:C.current},p({ref:t,className:s},a),o)});function X(e,t,r,n,i){return S.createElement(e.tag,p(p({key:t},ve(e,r,i)),n),(fe(e,r).children||[]).map(function(o,a){return X(o,"".concat(t,"-").concat(e.tag,"-").concat(a),r,void 0,i)}))}function ve(e,t,r){var n=p({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1),e.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(o){var a=o[0],s=o[1];a==="mask"&&typeof s=="string"&&(n[a]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var i=t.defIds;return!i||i.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(o){var a=o[0],s=o[1];typeof s=="string"&&(n[a]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function fe(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?p(p({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?p(p({},i),{attrs:p(p({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function Ie(){return Math.random().toString(36).substring(2,8)}Q.displayName="UniverIcon";var ge={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ee=S.forwardRef(function(e,t){return S.createElement(Q,Object.assign({},e,{id:"comment-single",ref:t,icon:ge}))});ee.displayName="CommentSingle";const pe={[u.RibbonInsertGroup.MEDIA]:{[z.id]:{order:3,menuItemFactory:le}},[u.ContextMenuPosition.MAIN_AREA]:{[u.ContextMenuGroup.DATA]:{[j.id]:{order:1,menuItemFactory:me}}}};var Se=Object.getOwnPropertyDescriptor,_e=(e,t,r,n)=>{for(var i=n>1?void 0:n?Se(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},L=(e,t)=>(r,n)=>t(r,n,e);let q=class extends c.Disposable{constructor(e,t,r){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=r,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[G,Z,N,j,z].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(pe)}_initComponents(){[[y.componentKey,y],["CommentSingle",ee]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};q=_e([L(0,c.ICommandService),L(1,u.IMenuManagerService),L(2,c.Inject(u.ComponentManager))],q);var Oe=Object.getOwnPropertyDescriptor,De=(e,t,r,n)=>{for(var i=n>1?void 0:n?Oe(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},R=(e,t)=>(r,n)=>t(r,n,e);let K=class extends c.Disposable{constructor(e,t,r,n,i,o,a){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=r,this._docRenderController=n,this._univerInstanceService=i,this._threadCommentModel=o,this._commandService=a,this._interceptorViewModel(),this._initReRender(),this._initSyncComments()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var r;if(e){this._docRenderController.reRender(e.unitId);return}const t=(r=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_DOC))==null?void 0:r.getUnitId();t&&this._docRenderController.reRender(t)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{e.type==="resolve"&&this._docRenderController.reRender(e.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(_.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,r)=>{if(!e)return r(e);const{unitId:n,index:i,customDecorations:o}=t,a=this._threadCommentPanelService.activeCommentId,{commentId:s,unitId:C}=a||{},v=o.find(I=>I.id===s),m=this._threadCommentModel.getComment(n,M,e.id);if(!m)return r({...e,show:!1});const f=v&&i>=v.startIndex&&i<=v.endIndex,g=C===n&&e.id===s;return r({...e,active:g||f,show:!m.resolved})}})}_initSyncComments(){var i,o,a;const e=this._context.unit.getUnitId(),t=M,r=(a=(o=(i=this._context.unit.getBody())==null?void 0:i.customDecorations)==null?void 0:o.filter(s=>s.type===c.CustomDecorationType.COMMENT).map(s=>s.id))!=null?a:[];r.forEach(s=>{this._threadCommentModel.getComment(e,t,s)||this._threadCommentModel.addComment(e,t,{id:s,threadId:s,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),r.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),M,r);let n=r.sort();this.disposeWithMe(this._commandService.onCommandExecuted(s=>{var C,v,m;if(s.id===_.RichTextEditingMutation.id){if(s.params.unitId!==this._context.unit.getUnitId())return;const g=(m=(v=(C=this._context.unit.getBody())==null?void 0:C.customDecorations)==null?void 0:v.filter(d=>d.type===c.CustomDecorationType.COMMENT).map(d=>d.id))!=null?m:[],I=g.sort();if(JSON.stringify(n)!==JSON.stringify(I)){const d=new Set(n),l=new Set(I),D=new Set,U=new Set;g.forEach(h=>{d.has(h)||D.add(h)}),n.forEach(h=>{l.has(h)||U.add(h)}),n=I,D.forEach(h=>{this._threadCommentModel.getComment(e,t,h)||this._threadCommentModel.addComment(e,t,{id:h,threadId:h,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),this._threadCommentModel.syncThreadComments(e,t,[...D])}}}))}};K=De([R(1,c.Inject(_.DocInterceptorService)),R(2,c.Inject(O.ThreadCommentPanelService)),R(3,c.Inject(V.DocRenderController)),R(4,c.IUniverInstanceService),R(5,c.Inject(w.ThreadCommentModel)),R(6,c.ICommandService)],K);var Me=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,be=(e,t,r)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ye=(e,t,r,n)=>{for(var i=n>1?void 0:n?Te(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},W=(e,t)=>(r,n)=>t(r,n,e),te=(e,t,r)=>be(e,typeof t!="symbol"?t+"":t,r);exports.UniverDocsThreadCommentUIPlugin=class extends c.Plugin{constructor(t=k,r,n,i){super(),this._config=t,this._injector=r,this._renderManagerSrv=n,this._configService=i;const{menu:o,...a}=c.merge({},k,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(ae,a)}onStarting(){[[q],[B],[P]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(B),this._injector.get(q)}_initRenderModule(){[K].forEach(t=>{this._renderManagerSrv.registerRenderModule(c.UniverInstanceType.UNIVER_DOC,t)})}};te(exports.UniverDocsThreadCommentUIPlugin,"pluginName",ce);te(exports.UniverDocsThreadCommentUIPlugin,"type",c.UniverInstanceType.UNIVER_DOC);exports.UniverDocsThreadCommentUIPlugin=ye([c.DependentOn(O.UniverThreadCommentUIPlugin),W(1,c.Inject(c.Injector)),W(2,b.IRenderManagerService),W(3,c.IConfigService)],exports.UniverDocsThreadCommentUIPlugin);exports.AddDocCommentComment=G;exports.DeleteDocCommentComment=Z;exports.ShowCommentPanelOperation=N;exports.StartAddCommentOperation=j;
|
package/lib/es/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var Oe = Object.defineProperty;
|
|
2
2
|
var Me = (e, t, r) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var G = (e, t, r) => Me(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { Inject as _, Disposable as B, CommandType as P, ICommandService as
|
|
4
|
+
import { Inject as _, Disposable as B, CommandType as P, ICommandService as b, CustomDecorationType as q, sequenceExecute as ne, UniverInstanceType as p, SHEET_EDITOR_UNITS as be, IUniverInstanceService as A, Injector as re, isInternalEditorID as ie, UserManagerService as De, BuildTextUtils as ye, DependentOn as xe, IConfigService as Te, Plugin as Ue, merge as Re } from "@univerjs/core";
|
|
5
5
|
import { IRenderManagerService as F, withCurrentTypeOfRenderer as Ee, DocumentEditArea as X } from "@univerjs/engine-render";
|
|
6
6
|
import { ThreadCommentPanelService as U, SetActiveCommentOperation as oe, ThreadCommentPanel as Pe, UniverThreadCommentUIPlugin as Ae } from "@univerjs/thread-comment-ui";
|
|
7
|
-
import { DocSelectionManagerService as H, DocSkeletonManagerService as Ne, RichTextEditingMutation as
|
|
7
|
+
import { DocSelectionManagerService as H, DocSkeletonManagerService as Ne, RichTextEditingMutation as de, SetTextSelectionsOperation as we, DocInterceptorService as Ve, DOC_INTERCEPTOR_POINT as $e } from "@univerjs/docs";
|
|
8
8
|
import { addCustomDecorationBySelectionFactory as je, deleteCustomDecorationFactory as Be, DocSelectionRenderService as Fe, DocBackScrollRenderController as He, DocRenderController as Le } from "@univerjs/docs-ui";
|
|
9
|
-
import { IThreadCommentDataSourceService as We, AddCommentMutation as Ke, getDT as Ge, ThreadCommentModel as
|
|
10
|
-
import { ISidebarService as L, getMenuHiddenObservable as ce, MenuItemType as ae, useDependency as E, useObservable as Z, ContextMenuPosition as Ze, ContextMenuGroup as ze,
|
|
9
|
+
import { IThreadCommentDataSourceService as We, AddCommentMutation as Ke, getDT as Ge, ThreadCommentModel as se } from "@univerjs/thread-comment";
|
|
10
|
+
import { ISidebarService as L, getMenuHiddenObservable as ce, MenuItemType as ae, useDependency as E, useObservable as Z, ContextMenuPosition as Ze, ContextMenuGroup as ze, RibbonInsertGroup as ke, IMenuManagerService as Je, ComponentManager as qe } from "@univerjs/ui";
|
|
11
11
|
import { BehaviorSubject as Ye, Observable as me, debounceTime as le, filter as Qe } from "rxjs";
|
|
12
12
|
import { jsx as Xe } from "react/jsx-runtime";
|
|
13
13
|
import { useMemo as z, useState as et, useEffect as tt, forwardRef as ue, useRef as nt, createElement as fe } from "react";
|
|
14
14
|
const rt = "DOC_THREAD_COMMENT_UI_PLUGIN", S = "default_doc", it = "docs-thread-comment-ui.config", ee = {};
|
|
15
|
-
var ot = Object.getOwnPropertyDescriptor,
|
|
16
|
-
for (var i = n > 1 ? void 0 : n ? ot(t, r) : t, o = e.length - 1,
|
|
17
|
-
(
|
|
15
|
+
var ot = Object.getOwnPropertyDescriptor, dt = (e, t, r, n) => {
|
|
16
|
+
for (var i = n > 1 ? void 0 : n ? ot(t, r) : t, o = e.length - 1, d; o >= 0; o--)
|
|
17
|
+
(d = e[o]) && (i = d(i) || i);
|
|
18
18
|
return i;
|
|
19
19
|
}, te = (e, t) => (r, n) => t(r, n, e);
|
|
20
|
-
let
|
|
20
|
+
let T = class extends B {
|
|
21
21
|
constructor(t, r) {
|
|
22
22
|
super();
|
|
23
23
|
G(this, "_addingComment$", new Ye(void 0));
|
|
@@ -36,17 +36,17 @@ let x = class extends B {
|
|
|
36
36
|
this._addingComment$.next(void 0);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
T = dt([
|
|
40
40
|
te(0, L),
|
|
41
41
|
te(1, _(U))
|
|
42
|
-
],
|
|
42
|
+
], T);
|
|
43
43
|
const he = {
|
|
44
44
|
id: "docs.command.add-comment",
|
|
45
45
|
type: P.COMMAND,
|
|
46
46
|
async handler(e, t) {
|
|
47
47
|
if (!t)
|
|
48
48
|
return !1;
|
|
49
|
-
const { comment: r, unitId: n } = t, o = await e.get(We).addComment(r),
|
|
49
|
+
const { comment: r, unitId: n } = t, o = await e.get(We).addComment(r), d = e.get(b), s = je(
|
|
50
50
|
e,
|
|
51
51
|
{
|
|
52
52
|
id: o.threadId,
|
|
@@ -54,7 +54,7 @@ const he = {
|
|
|
54
54
|
unitId: n
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
|
-
if (
|
|
57
|
+
if (s) {
|
|
58
58
|
const l = {
|
|
59
59
|
id: Ke.id,
|
|
60
60
|
params: {
|
|
@@ -70,7 +70,7 @@ const he = {
|
|
|
70
70
|
commentId: o.id
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
return (await ne([l,
|
|
73
|
+
return (await ne([l, s, f], d)).result;
|
|
74
74
|
}
|
|
75
75
|
return !1;
|
|
76
76
|
}
|
|
@@ -80,26 +80,26 @@ const he = {
|
|
|
80
80
|
async handler(e, t) {
|
|
81
81
|
if (!t)
|
|
82
82
|
return !1;
|
|
83
|
-
const { commentId: r, unitId: n } = t, i = e.get(
|
|
83
|
+
const { commentId: r, unitId: n } = t, i = e.get(b), o = Be(e, {
|
|
84
84
|
id: r,
|
|
85
85
|
unitId: n
|
|
86
86
|
});
|
|
87
87
|
return o ? (await ne([o], i)).result : !1;
|
|
88
88
|
}
|
|
89
89
|
}, ge = (e) => {
|
|
90
|
-
var
|
|
91
|
-
const t = e.get(F), r = e.get(H), n = (
|
|
90
|
+
var d;
|
|
91
|
+
const t = e.get(F), r = e.get(H), n = (d = Ee(
|
|
92
92
|
p.UNIVER_DOC,
|
|
93
93
|
Ne,
|
|
94
94
|
e.get(A),
|
|
95
95
|
t
|
|
96
|
-
)) == null ? void 0 :
|
|
96
|
+
)) == null ? void 0 : d.getSkeleton(), i = n == null ? void 0 : n.getViewModel().getEditArea();
|
|
97
97
|
if (i === X.FOOTER || i === X.HEADER)
|
|
98
98
|
return !0;
|
|
99
99
|
const o = r.getActiveTextRange();
|
|
100
100
|
return !!(o == null || o.collapsed);
|
|
101
101
|
};
|
|
102
|
-
function
|
|
102
|
+
function st(e) {
|
|
103
103
|
return {
|
|
104
104
|
id: W.id,
|
|
105
105
|
type: ae.BUTTON,
|
|
@@ -127,23 +127,23 @@ function ct(e) {
|
|
|
127
127
|
hidden$: ce(e, p.UNIVER_DOC)
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
const
|
|
131
|
-
const e = E(A), t = E(re), r = z(() => e.getCurrentTypeOfUnit$(p.UNIVER_DOC).pipe(Qe((c) => !!c && !ie(c.getUnitId()))), [e]), n = Z(r), i = z(() => new me((c) => c.next(S)), []), o = E(H),
|
|
130
|
+
const M = () => {
|
|
131
|
+
const e = E(A), t = E(re), r = z(() => e.getCurrentTypeOfUnit$(p.UNIVER_DOC).pipe(Qe((c) => !!c && !ie(c.getUnitId()))), [e]), n = Z(r), i = z(() => new me((c) => c.next(S)), []), o = E(H), d = z(
|
|
132
132
|
() => o.textSelection$.pipe(le(16)),
|
|
133
133
|
[o.textSelection$]
|
|
134
134
|
);
|
|
135
|
-
Z(
|
|
136
|
-
const
|
|
135
|
+
Z(d);
|
|
136
|
+
const s = E(b), l = E(T), f = Z(l.addingComment$), [a, h] = et([]);
|
|
137
137
|
if (tt(() => {
|
|
138
|
-
var
|
|
138
|
+
var D;
|
|
139
139
|
const c = /* @__PURE__ */ new Set(), m = n == null ? void 0 : n.getCustomDecorations();
|
|
140
|
-
h((
|
|
140
|
+
h((D = m == null ? void 0 : m.map((u) => u.id).filter((u) => {
|
|
141
141
|
const O = c.has(u);
|
|
142
142
|
return c.add(u), !O;
|
|
143
|
-
})) != null ?
|
|
144
|
-
const I =
|
|
143
|
+
})) != null ? D : []);
|
|
144
|
+
const I = s.onCommandExecuted((u) => {
|
|
145
145
|
var O;
|
|
146
|
-
if (u.id ===
|
|
146
|
+
if (u.id === de.id) {
|
|
147
147
|
const R = /* @__PURE__ */ new Set(), K = n == null ? void 0 : n.getCustomDecorations();
|
|
148
148
|
h((O = K == null ? void 0 : K.map((N) => N.id).filter((N) => {
|
|
149
149
|
const Se = R.has(N);
|
|
@@ -154,7 +154,7 @@ const T = () => {
|
|
|
154
154
|
return () => {
|
|
155
155
|
I.dispose();
|
|
156
156
|
};
|
|
157
|
-
}, [
|
|
157
|
+
}, [s, n]), !n)
|
|
158
158
|
return null;
|
|
159
159
|
const g = ge(t), C = n.getUnitId();
|
|
160
160
|
return /* @__PURE__ */ Xe(
|
|
@@ -164,7 +164,7 @@ const T = () => {
|
|
|
164
164
|
subUnitId$: i,
|
|
165
165
|
type: p.UNIVER_DOC,
|
|
166
166
|
onAdd: () => {
|
|
167
|
-
|
|
167
|
+
s.executeCommand(W.id);
|
|
168
168
|
},
|
|
169
169
|
getSubUnitName: () => "",
|
|
170
170
|
disableAdd: g,
|
|
@@ -176,7 +176,7 @@ const T = () => {
|
|
|
176
176
|
range: f,
|
|
177
177
|
comment: c
|
|
178
178
|
};
|
|
179
|
-
return
|
|
179
|
+
return s.executeCommand(he.id, m), l.endAdd(), !1;
|
|
180
180
|
}
|
|
181
181
|
return !0;
|
|
182
182
|
},
|
|
@@ -186,7 +186,7 @@ const T = () => {
|
|
|
186
186
|
unitId: C,
|
|
187
187
|
commentId: c.id
|
|
188
188
|
};
|
|
189
|
-
return
|
|
189
|
+
return s.executeCommand(Ce.id, m), !1;
|
|
190
190
|
}
|
|
191
191
|
return !0;
|
|
192
192
|
},
|
|
@@ -194,16 +194,16 @@ const T = () => {
|
|
|
194
194
|
}
|
|
195
195
|
);
|
|
196
196
|
};
|
|
197
|
-
|
|
197
|
+
M.componentKey = "univer.doc.thread-comment-panel";
|
|
198
198
|
const w = {
|
|
199
199
|
id: "docs.operation.show-comment-panel",
|
|
200
200
|
type: P.OPERATION,
|
|
201
201
|
handler(e, t) {
|
|
202
202
|
var i;
|
|
203
203
|
const r = e.get(U), n = e.get(L);
|
|
204
|
-
return (!r.panelVisible || ((i = n.options.children) == null ? void 0 : i.label) !==
|
|
204
|
+
return (!r.panelVisible || ((i = n.options.children) == null ? void 0 : i.label) !== M.componentKey) && (n.open({
|
|
205
205
|
header: { title: "threadCommentUI.panel.title" },
|
|
206
|
-
children: { label:
|
|
206
|
+
children: { label: M.componentKey },
|
|
207
207
|
width: 320,
|
|
208
208
|
onClose: () => r.setPanelVisible(!1)
|
|
209
209
|
}), r.setPanelVisible(!0)), t && r.setActiveComment(t == null ? void 0 : t.activeComment), !0;
|
|
@@ -214,9 +214,9 @@ const w = {
|
|
|
214
214
|
handler(e) {
|
|
215
215
|
var n;
|
|
216
216
|
const t = e.get(U), r = e.get(L);
|
|
217
|
-
return !t.panelVisible || ((n = r.options.children) == null ? void 0 : n.label) !==
|
|
217
|
+
return !t.panelVisible || ((n = r.options.children) == null ? void 0 : n.label) !== M.componentKey ? (r.open({
|
|
218
218
|
header: { title: "threadCommentUI.panel.title" },
|
|
219
|
-
children: { label:
|
|
219
|
+
children: { label: M.componentKey },
|
|
220
220
|
width: 320,
|
|
221
221
|
onClose: () => t.setPanelVisible(!1)
|
|
222
222
|
}), t.setPanelVisible(!0)) : (r.close(), t.setPanelVisible(!1), t.setActiveComment(null)), !0;
|
|
@@ -226,20 +226,20 @@ const w = {
|
|
|
226
226
|
type: P.OPERATION,
|
|
227
227
|
handler(e) {
|
|
228
228
|
var u, O, R;
|
|
229
|
-
const t = e.get(U), n = e.get(A).getCurrentUnitForType(p.UNIVER_DOC), i = e.get(H), o = e.get(F),
|
|
229
|
+
const t = e.get(U), n = e.get(A).getCurrentUnitForType(p.UNIVER_DOC), i = e.get(H), o = e.get(F), d = e.get(De), s = e.get(T), l = e.get(b), f = e.get(L), a = i.getActiveTextRange();
|
|
230
230
|
if (!n || !a)
|
|
231
231
|
return !1;
|
|
232
232
|
const h = (u = o.getRenderById(n.getUnitId())) == null ? void 0 : u.with(Fe);
|
|
233
233
|
if (h == null || h.setReserveRangesStatus(!0), a.collapsed)
|
|
234
234
|
return t.panelVisible ? (t.setPanelVisible(!1), f.close()) : l.executeCommand(w.id), !0;
|
|
235
235
|
l.executeCommand(w.id);
|
|
236
|
-
const g = n.getUnitId(), C = ((R = (O = n.getBody()) == null ? void 0 : O.dataStream) != null ? R : "").slice(a.startOffset, a.endOffset), c = ye.transform.getPlainText(C), m = S, I = "",
|
|
236
|
+
const g = n.getUnitId(), C = ((R = (O = n.getBody()) == null ? void 0 : O.dataStream) != null ? R : "").slice(a.startOffset, a.endOffset), c = ye.transform.getPlainText(C), m = S, I = "", D = {
|
|
237
237
|
unitId: g,
|
|
238
238
|
subUnitId: m,
|
|
239
239
|
id: I,
|
|
240
240
|
ref: c,
|
|
241
241
|
dT: Ge(),
|
|
242
|
-
personId:
|
|
242
|
+
personId: d.getCurrentUser().userID,
|
|
243
243
|
text: {
|
|
244
244
|
dataStream: `\r
|
|
245
245
|
`
|
|
@@ -249,7 +249,7 @@ const w = {
|
|
|
249
249
|
collapsed: !0,
|
|
250
250
|
threadId: I
|
|
251
251
|
};
|
|
252
|
-
return h == null || h.blur(),
|
|
252
|
+
return h == null || h.blur(), s.startAdd(D), t.setActiveComment({
|
|
253
253
|
unitId: g,
|
|
254
254
|
subUnitId: m,
|
|
255
255
|
commentId: I
|
|
@@ -257,10 +257,10 @@ const w = {
|
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
259
|
var at = Object.getOwnPropertyDescriptor, mt = (e, t, r, n) => {
|
|
260
|
-
for (var i = n > 1 ? void 0 : n ? at(t, r) : t, o = e.length - 1,
|
|
261
|
-
(
|
|
260
|
+
for (var i = n > 1 ? void 0 : n ? at(t, r) : t, o = e.length - 1, d; o >= 0; o--)
|
|
261
|
+
(d = e[o]) && (i = d(i) || i);
|
|
262
262
|
return i;
|
|
263
|
-
},
|
|
263
|
+
}, y = (e, t) => (r, n) => t(r, n, e);
|
|
264
264
|
let V = class extends B {
|
|
265
265
|
constructor(e, t, r, n, i, o) {
|
|
266
266
|
super(), this._threadCommentPanelService = e, this._univerInstanceService = t, this._commandService = r, this._docThreadCommentService = n, this._renderManagerService = i, this._threadCommentModel = o, this._initSelectionChange(), this._initActiveCommandChange();
|
|
@@ -271,19 +271,19 @@ let V = class extends B {
|
|
|
271
271
|
this._commandService.onCommandExecuted((t) => {
|
|
272
272
|
var r, n, i, o;
|
|
273
273
|
if (t.id === we.id) {
|
|
274
|
-
const
|
|
275
|
-
if (ie(
|
|
276
|
-
const f = this._univerInstanceService.getUnit(
|
|
274
|
+
const d = t.params, { unitId: s, ranges: l } = d;
|
|
275
|
+
if (ie(s)) return;
|
|
276
|
+
const f = this._univerInstanceService.getUnit(s, p.UNIVER_DOC), a = l[0];
|
|
277
277
|
if ((e == null ? void 0 : e.startOffset) === (a == null ? void 0 : a.startOffset) && (e == null ? void 0 : e.endOffset) === (a == null ? void 0 : a.endOffset))
|
|
278
278
|
return;
|
|
279
279
|
if (e = a, a && f) {
|
|
280
280
|
const { startOffset: h, endOffset: g, collapsed: C } = a;
|
|
281
281
|
let c;
|
|
282
282
|
if (C ? c = (n = (r = f.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((m) => m.startIndex <= h && m.endIndex >= g - 1) : c = (o = (i = f.getBody()) == null ? void 0 : i.customDecorations) == null ? void 0 : o.find((m) => m.startIndex <= h && m.endIndex >= g - 1), c) {
|
|
283
|
-
const m = this._threadCommentModel.getComment(
|
|
283
|
+
const m = this._threadCommentModel.getComment(s, S, c.id);
|
|
284
284
|
m && !m.resolved && this._commandService.executeCommand(w.id, {
|
|
285
285
|
activeComment: {
|
|
286
|
-
unitId:
|
|
286
|
+
unitId: s,
|
|
287
287
|
subUnitId: S,
|
|
288
288
|
commentId: c.id
|
|
289
289
|
}
|
|
@@ -304,10 +304,10 @@ let V = class extends B {
|
|
|
304
304
|
if (e) {
|
|
305
305
|
const o = this._univerInstanceService.getUnit(e.unitId);
|
|
306
306
|
if (o) {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
startOffset:
|
|
310
|
-
endOffset:
|
|
307
|
+
const d = (t = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : t.with(He), s = (n = (r = o.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((l) => l.id === e.commentId);
|
|
308
|
+
s && d && d.scrollToRange({
|
|
309
|
+
startOffset: s.startIndex,
|
|
310
|
+
endOffset: s.endIndex,
|
|
311
311
|
collapsed: !1
|
|
312
312
|
});
|
|
313
313
|
}
|
|
@@ -317,12 +317,12 @@ let V = class extends B {
|
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
V = mt([
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
320
|
+
y(0, _(U)),
|
|
321
|
+
y(1, A),
|
|
322
|
+
y(2, b),
|
|
323
|
+
y(3, _(T)),
|
|
324
|
+
y(4, F),
|
|
325
|
+
y(5, _(se))
|
|
326
326
|
], V);
|
|
327
327
|
var v = function() {
|
|
328
328
|
return v = Object.assign || function(e) {
|
|
@@ -340,24 +340,24 @@ var v = function() {
|
|
|
340
340
|
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
|
|
341
341
|
return r;
|
|
342
342
|
}, ve = ue(function(e, t) {
|
|
343
|
-
var r = e.icon, n = e.id, i = e.className, o = e.extend,
|
|
344
|
-
return _e(r, "".concat(n), { defIds: r.defIds, idSuffix: l.current }, v({ ref: t, className:
|
|
343
|
+
var r = e.icon, n = e.id, i = e.className, o = e.extend, d = lt(e, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), l = nt("_".concat(ht()));
|
|
344
|
+
return _e(r, "".concat(n), { defIds: r.defIds, idSuffix: l.current }, v({ ref: t, className: s }, d), o);
|
|
345
345
|
});
|
|
346
346
|
function _e(e, t, r, n, i) {
|
|
347
|
-
return fe(e.tag, v(v({ key: t }, ut(e, r, i)), n), (ft(e, r).children || []).map(function(o,
|
|
348
|
-
return _e(o, "".concat(t, "-").concat(e.tag, "-").concat(
|
|
347
|
+
return fe(e.tag, v(v({ key: t }, ut(e, r, i)), n), (ft(e, r).children || []).map(function(o, d) {
|
|
348
|
+
return _e(o, "".concat(t, "-").concat(e.tag, "-").concat(d), r, void 0, i);
|
|
349
349
|
}));
|
|
350
350
|
}
|
|
351
351
|
function ut(e, t, r) {
|
|
352
352
|
var n = v({}, e.attrs);
|
|
353
353
|
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(function(o) {
|
|
354
|
-
var
|
|
355
|
-
|
|
354
|
+
var d = o[0], s = o[1];
|
|
355
|
+
d === "mask" && typeof s == "string" && (n[d] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
356
356
|
});
|
|
357
357
|
var i = t.defIds;
|
|
358
358
|
return !i || i.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(o) {
|
|
359
|
-
var
|
|
360
|
-
typeof
|
|
359
|
+
var d = o[0], s = o[1];
|
|
360
|
+
typeof s == "string" && (n[d] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
361
361
|
})), n;
|
|
362
362
|
}
|
|
363
363
|
function ft(e, t) {
|
|
@@ -379,9 +379,9 @@ var Ct = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em"
|
|
|
379
379
|
});
|
|
380
380
|
pe.displayName = "CommentSingle";
|
|
381
381
|
const gt = {
|
|
382
|
-
[ke.
|
|
382
|
+
[ke.MEDIA]: {
|
|
383
383
|
[Q.id]: {
|
|
384
|
-
order:
|
|
384
|
+
order: 3,
|
|
385
385
|
menuItemFactory: ct
|
|
386
386
|
}
|
|
387
387
|
},
|
|
@@ -389,14 +389,14 @@ const gt = {
|
|
|
389
389
|
[ze.DATA]: {
|
|
390
390
|
[W.id]: {
|
|
391
391
|
order: 1,
|
|
392
|
-
menuItemFactory:
|
|
392
|
+
menuItemFactory: st
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
};
|
|
397
397
|
var vt = Object.getOwnPropertyDescriptor, _t = (e, t, r, n) => {
|
|
398
|
-
for (var i = n > 1 ? void 0 : n ? vt(t, r) : t, o = e.length - 1,
|
|
399
|
-
(
|
|
398
|
+
for (var i = n > 1 ? void 0 : n ? vt(t, r) : t, o = e.length - 1, d; o >= 0; o--)
|
|
399
|
+
(d = e[o]) && (i = d(i) || i);
|
|
400
400
|
return i;
|
|
401
401
|
}, k = (e, t) => (r, n) => t(r, n, e);
|
|
402
402
|
let $ = class extends B {
|
|
@@ -418,24 +418,29 @@ let $ = class extends B {
|
|
|
418
418
|
this._menuManagerService.mergeMenu(gt);
|
|
419
419
|
}
|
|
420
420
|
_initComponents() {
|
|
421
|
-
[
|
|
422
|
-
|
|
423
|
-
|
|
421
|
+
[
|
|
422
|
+
[M.componentKey, M],
|
|
423
|
+
["CommentSingle", pe]
|
|
424
|
+
].forEach(([e, t]) => {
|
|
425
|
+
this.disposeWithMe(
|
|
426
|
+
this._componentManager.register(e, t)
|
|
427
|
+
);
|
|
428
|
+
});
|
|
424
429
|
}
|
|
425
430
|
};
|
|
426
431
|
$ = _t([
|
|
427
|
-
k(0,
|
|
432
|
+
k(0, b),
|
|
428
433
|
k(1, Je),
|
|
429
434
|
k(2, _(qe))
|
|
430
435
|
], $);
|
|
431
436
|
var pt = Object.getOwnPropertyDescriptor, It = (e, t, r, n) => {
|
|
432
|
-
for (var i = n > 1 ? void 0 : n ? pt(t, r) : t, o = e.length - 1,
|
|
433
|
-
(
|
|
437
|
+
for (var i = n > 1 ? void 0 : n ? pt(t, r) : t, o = e.length - 1, d; o >= 0; o--)
|
|
438
|
+
(d = e[o]) && (i = d(i) || i);
|
|
434
439
|
return i;
|
|
435
|
-
},
|
|
440
|
+
}, x = (e, t) => (r, n) => t(r, n, e);
|
|
436
441
|
let Y = class extends B {
|
|
437
|
-
constructor(e, t, r, n, i, o,
|
|
438
|
-
super(), this._context = e, this._docInterceptorService = t, this._threadCommentPanelService = r, this._docRenderController = n, this._univerInstanceService = i, this._threadCommentModel = o, this._commandService =
|
|
442
|
+
constructor(e, t, r, n, i, o, d) {
|
|
443
|
+
super(), this._context = e, this._docInterceptorService = t, this._threadCommentPanelService = r, this._docRenderController = n, this._univerInstanceService = i, this._threadCommentModel = o, this._commandService = d, this._interceptorViewModel(), this._initReRender(), this._initSyncComments();
|
|
439
444
|
}
|
|
440
445
|
_initReRender() {
|
|
441
446
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((e) => {
|
|
@@ -455,13 +460,13 @@ let Y = class extends B {
|
|
|
455
460
|
handler: (e, t, r) => {
|
|
456
461
|
if (!e)
|
|
457
462
|
return r(e);
|
|
458
|
-
const { unitId: n, index: i, customDecorations: o } = t,
|
|
463
|
+
const { unitId: n, index: i, customDecorations: o } = t, d = this._threadCommentPanelService.activeCommentId, { commentId: s, unitId: l } = d || {}, f = o.find((C) => C.id === s), a = this._threadCommentModel.getComment(n, S, e.id);
|
|
459
464
|
if (!a)
|
|
460
465
|
return r({
|
|
461
466
|
...e,
|
|
462
467
|
show: !1
|
|
463
468
|
});
|
|
464
|
-
const h = f && i >= f.startIndex && i <= f.endIndex, g = l === n && e.id ===
|
|
469
|
+
const h = f && i >= f.startIndex && i <= f.endIndex, g = l === n && e.id === s;
|
|
465
470
|
return r({
|
|
466
471
|
...e,
|
|
467
472
|
active: g || h,
|
|
@@ -471,24 +476,24 @@ let Y = class extends B {
|
|
|
471
476
|
});
|
|
472
477
|
}
|
|
473
478
|
_initSyncComments() {
|
|
474
|
-
var i, o,
|
|
475
|
-
const e = this._context.unit.getUnitId(), t = S, r = (
|
|
476
|
-
r.forEach((
|
|
477
|
-
this._threadCommentModel.getComment(e, t,
|
|
479
|
+
var i, o, d;
|
|
480
|
+
const e = this._context.unit.getUnitId(), t = S, r = (d = (o = (i = this._context.unit.getBody()) == null ? void 0 : i.customDecorations) == null ? void 0 : o.filter((s) => s.type === q.COMMENT).map((s) => s.id)) != null ? d : [];
|
|
481
|
+
r.forEach((s) => {
|
|
482
|
+
this._threadCommentModel.getComment(e, t, s) || this._threadCommentModel.addComment(e, t, { id: s, threadId: s, ref: "", dT: "", personId: "", text: { dataStream: "" }, unitId: e, subUnitId: t });
|
|
478
483
|
}), r.length && this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(), S, r);
|
|
479
484
|
let n = r.sort();
|
|
480
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((
|
|
485
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((s) => {
|
|
481
486
|
var l, f, a;
|
|
482
|
-
if (
|
|
483
|
-
if (
|
|
487
|
+
if (s.id === de.id) {
|
|
488
|
+
if (s.params.unitId !== this._context.unit.getUnitId())
|
|
484
489
|
return;
|
|
485
490
|
const g = (a = (f = (l = this._context.unit.getBody()) == null ? void 0 : l.customDecorations) == null ? void 0 : f.filter((c) => c.type === q.COMMENT).map((c) => c.id)) != null ? a : [], C = g.sort();
|
|
486
491
|
if (JSON.stringify(n) !== JSON.stringify(C)) {
|
|
487
|
-
const c = new Set(n), m = new Set(C), I = /* @__PURE__ */ new Set(),
|
|
492
|
+
const c = new Set(n), m = new Set(C), I = /* @__PURE__ */ new Set(), D = /* @__PURE__ */ new Set();
|
|
488
493
|
g.forEach((u) => {
|
|
489
494
|
c.has(u) || I.add(u);
|
|
490
495
|
}), n.forEach((u) => {
|
|
491
|
-
m.has(u) ||
|
|
496
|
+
m.has(u) || D.add(u);
|
|
492
497
|
}), n = C, I.forEach((u) => {
|
|
493
498
|
this._threadCommentModel.getComment(e, t, u) || this._threadCommentModel.addComment(e, t, { id: u, threadId: u, ref: "", dT: "", personId: "", text: { dataStream: "" }, unitId: e, subUnitId: t });
|
|
494
499
|
}), this._threadCommentModel.syncThreadComments(e, t, [...I]);
|
|
@@ -498,16 +503,16 @@ let Y = class extends B {
|
|
|
498
503
|
}
|
|
499
504
|
};
|
|
500
505
|
Y = It([
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
506
|
+
x(1, _(Ve)),
|
|
507
|
+
x(2, _(U)),
|
|
508
|
+
x(3, _(Le)),
|
|
509
|
+
x(4, A),
|
|
510
|
+
x(5, _(se)),
|
|
511
|
+
x(6, b)
|
|
507
512
|
], Y);
|
|
508
513
|
var St = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Mt = (e, t, r) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, bt = (e, t, r, n) => {
|
|
509
|
-
for (var i = n > 1 ? void 0 : n ? Ot(t, r) : t, o = e.length - 1,
|
|
510
|
-
(
|
|
514
|
+
for (var i = n > 1 ? void 0 : n ? Ot(t, r) : t, o = e.length - 1, d; o >= 0; o--)
|
|
515
|
+
(d = e[o]) && (i = d(i) || i);
|
|
511
516
|
return i;
|
|
512
517
|
}, J = (e, t) => (r, n) => t(r, n, e), Ie = (e, t, r) => Mt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
513
518
|
let j = class extends Ue {
|
|
@@ -524,7 +529,7 @@ let j = class extends Ue {
|
|
|
524
529
|
[
|
|
525
530
|
[$],
|
|
526
531
|
[V],
|
|
527
|
-
[
|
|
532
|
+
[T]
|
|
528
533
|
].forEach((e) => {
|
|
529
534
|
this._injector.add(e);
|
|
530
535
|
});
|