@univerjs/docs-thread-comment-ui 0.5.3 → 0.5.4-nightly.202501131606
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 +3 -3
- package/lib/es/index.js +188 -185
- package/lib/umd/index.js +3 -3
- package/package.json +12 -11
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var de=Object.defineProperty;var ae=(e,t,r)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var L=(e,t,r)=>ae(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var de=Object.defineProperty;var ae=(e,t,r)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var L=(e,t,r)=>ae(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),x=require("@univerjs/engine-render"),O=require("@univerjs/thread-comment-ui"),S=require("@univerjs/docs"),$=require("@univerjs/docs-ui"),N=require("@univerjs/thread-comment"),I=require("@univerjs/ui"),R=require("rxjs"),g=require("react"),me="DOC_THREAD_COMMENT_UI_PLUGIN",M="default_doc",le="docs-thread-comment-ui.config",Q={};var ue=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,Ce=(e,t,r,n)=>{for(var i=n>1?void 0:n?fe(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&ue(t,r,i),i},X=(e,t)=>(r,n)=>t(r,n,e);let P=class extends o.Disposable{constructor(t,r){super();L(this,"_addingComment$",new R.BehaviorSubject(void 0));L(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=Ce([X(0,I.ISidebarService),X(1,o.Inject(O.ThreadCommentPanelService))],P);var W={exports:{}},A={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var k;function he(){if(k)return
|
|
10
|
-
`},startOffset:a.startOffset,endOffset:a.endOffset,collapsed:!0,threadId:b};return h==null||h.blurEditor(),d.startAdd(D),t.setActiveComment({unitId:v,subUnitId:u,commentId:b}),!0}};var ge=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,Oe=(e,t,r,n)=>{for(var o=n>1?void 0:n?Se(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&ge(t,r,o),o},y=(e,t)=>(r,n)=>t(r,n,e);let q=class extends c.Disposable{constructor(e,t,r,n,o,i){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=r,this._docThreadCommentService=n,this._renderManagerService=o,this._threadCommentModel=i,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var r,n,o,i;if(t.id===S.SetTextSelectionsOperation.id){const s=t.params,{unitId:d,ranges:m}=s,C=this._univerInstanceService.getUnit(d,c.UniverInstanceType.UNIVER_DOC),a=m[0];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))return;if(e=a,a&&C){const{startOffset:h,endOffset:v,collapsed:p}=a;let l;if(p?l=(n=(r=C.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(u=>u.startIndex<=h&&u.endIndex>=v-1):l=(i=(o=C.getBody())==null?void 0:o.customDecorations)==null?void 0:i.find(u=>u.startIndex<=h&&u.endIndex>=v-1),l){const u=this._threadCommentModel.getComment(d,M,l.id);u&&!u.resolved&&this._commandService.executeCommand(j.id,{activeComment:{unitId:d,subUnitId:M,commentId:l.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,o;if(e){const i=this._univerInstanceService.getUnit(e.unitId);if(i){const s=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with($.DocBackScrollRenderController),d=(n=(r=i.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(m=>m.id===e.commentId);d&&s&&s.scrollToRange({startOffset:d.startIndex,endOffset:d.endIndex,collapsed:!1})}}(!e||e.commentId!==((o=this._docThreadCommentService.addingComment)==null?void 0:o.id))&&this._docThreadCommentService.endAdd()}))}};q=Oe([y(0,c.Inject(O.ThreadCommentPanelService)),y(1,c.IUniverInstanceService),y(2,c.ICommandService),y(3,c.Inject(R)),y(4,x.IRenderManagerService),y(5,c.Inject(A.ThreadCommentModel))],q);var I=function(){return I=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},I.apply(this,arguments)},be=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 o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},ne=g.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,i=e.extend,s=be(e,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),m=g.useRef("_".concat(De()));return re(r,"".concat(n),{defIds:r.defIds,idSuffix:m.current},I({ref:t,className:d},s),i)});function re(e,t,r,n,o){return g.createElement(e.tag,I(I({key:t},Me(e,r,o)),n),(Te(e,r).children||[]).map(function(i,s){return re(i,"".concat(t,"-").concat(e.tag,"-").concat(s),r,void 0,o)}))}function Me(e,t,r){var n=I({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(i){var s=i[0],d=i[1];typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(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)?I(I({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?I(I({},o),{attrs:I(I({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function De(){return Math.random().toString(36).substring(2,8)}ne.displayName="UniverIcon";var ye={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"}}]},oe=g.forwardRef(function(e,t){return g.createElement(ne,Object.assign({},e,{id:"comment-single",ref:t,icon:ye}))});oe.displayName="CommentSingle";const Ue={[_.RibbonStartGroup.OTHERS]:{[Y.id]:{order:1,menuItemFactory:Ie}},[_.ContextMenuPosition.MAIN_AREA]:{[_.ContextMenuGroup.DATA]:{[V.id]:{order:1,menuItemFactory:_e}}}};var xe=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Pe=(e,t,r,n)=>{for(var o=n>1?void 0:n?Re(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&xe(t,r,o),o},J=(e,t)=>(r,n)=>t(r,n,e);let F=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(){[Z,z,j,V,Y].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(Ue)}_initComponents(){[P].forEach(e=>{this.disposeWithMe(this._componentManager.register(e.componentKey,e))}),this.disposeWithMe(this._componentManager.register("CommentSingle",oe))}};F=Pe([J(0,c.ICommandService),J(1,_.IMenuManagerService),J(2,c.Inject(_.ComponentManager))],F);var Ee=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ae=(e,t,r,n)=>{for(var o=n>1?void 0:n?we(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Ee(t,r,o),o},U=(e,t)=>(r,n)=>t(r,n,e);let G=class extends c.Disposable{constructor(e,t,r,n,o,i,s){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=r,this._docRenderController=n,this._univerInstanceService=o,this._threadCommentModel=i,this._commandService=s,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(S.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,r)=>{if(!e)return r(e);const{unitId:n,index:o,customDecorations:i}=t,s=this._threadCommentPanelService.activeCommentId,{commentId:d,unitId:m}=s||{},C=i.find(p=>p.id===d),a=this._threadCommentModel.getComment(n,M,e.id);if(!a)return r({...e,show:!1});const h=C&&o>=C.startIndex&&o<=C.endIndex,v=m===n&&e.id===d;return r({...e,active:v||h,show:!a.resolved})}})}_initSyncComments(){var o,i,s;const e=this._context.unit.getUnitId(),t=M,r=(s=(i=(o=this._context.unit.getBody())==null?void 0:o.customDecorations)==null?void 0:i.filter(d=>d.type===c.CustomDecorationType.COMMENT).map(d=>d.id))!=null?s:[];r.forEach(d=>{this._threadCommentModel.getComment(e,t,d)||this._threadCommentModel.addComment(e,t,{id:d,threadId:d,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(d=>{var m,C,a;if(d.id===S.RichTextEditingMutation.id){if(d.params.unitId!==this._context.unit.getUnitId())return;const v=(a=(C=(m=this._context.unit.getBody())==null?void 0:m.customDecorations)==null?void 0:C.filter(l=>l.type===c.CustomDecorationType.COMMENT).map(l=>l.id))!=null?a:[],p=v.sort();if(JSON.stringify(n)!==JSON.stringify(p)){const l=new Set(n),u=new Set(p),b=new Set,D=new Set;v.forEach(f=>{l.has(f)||b.add(f)}),n.forEach(f=>{u.has(f)||D.add(f)}),n=p,b.forEach(f=>{this._threadCommentModel.getComment(e,t,f)||this._threadCommentModel.addComment(e,t,{id:f,threadId:f,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),this._threadCommentModel.syncThreadComments(e,t,[...b])}}}))}};G=Ae([U(1,c.Inject(S.DocInterceptorService)),U(2,c.Inject(O.ThreadCommentPanelService)),U(3,c.Inject($.DocRenderController)),U(4,c.IUniverInstanceService),U(5,c.Inject(A.ThreadCommentModel)),U(6,c.ICommandService)],G);var ie=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,je=(e,t,r)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$e=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ne(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&ie(t,r,o),o},K=(e,t)=>(r,n)=>t(r,n,e),ce=(e,t,r)=>je(e,typeof t!="symbol"?t+"":t,r);exports.UniverDocsThreadCommentUIPlugin=class extends c.Plugin{constructor(t=Q,r,n,o){super(),this._config=t,this._injector=r,this._renderManagerSrv=n,this._configService=o;const{menu:i,...s}=c.merge({},Q,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(le,s)}onStarting(){[[F],[q],[R]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(q),this._injector.get(F)}_initRenderModule(){[G].forEach(t=>{this._renderManagerSrv.registerRenderModule(c.UniverInstanceType.UNIVER_DOC,t)})}};ce(exports.UniverDocsThreadCommentUIPlugin,"pluginName",me);ce(exports.UniverDocsThreadCommentUIPlugin,"type",c.UniverInstanceType.UNIVER_DOC);exports.UniverDocsThreadCommentUIPlugin=$e([c.DependentOn(O.UniverThreadCommentUIPlugin),K(1,c.Inject(c.Injector)),K(2,x.IRenderManagerService),K(3,c.IConfigService)],exports.UniverDocsThreadCommentUIPlugin);exports.AddDocCommentComment=Z;exports.DeleteDocCommentComment=z;exports.ShowCommentPanelOperation=j;exports.StartAddCommentOperation=V;
|
|
9
|
+
*/var k;function he(){if(k)return A;k=1;var e=g,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function c(d,m,f){var a,C={},v=null,p=null;f!==void 0&&(v=""+f),m.key!==void 0&&(v=""+m.key),m.ref!==void 0&&(p=m.ref);for(a in m)n.call(m,a)&&!s.hasOwnProperty(a)&&(C[a]=m[a]);if(d&&d.defaultProps)for(a in m=d.defaultProps,m)C[a]===void 0&&(C[a]=m[a]);return{$$typeof:t,type:d,key:v,ref:p,props:C,_owner:i.current}}return A.Fragment=r,A.jsx=c,A.jsxs=c,A}var ee;function ve(){return ee||(ee=1,W.exports=he()),W.exports}var pe=ve();const Z={id:"docs.command.add-comment",type:o.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{comment:r,unitId:n}=t,s=await e.get(N.IThreadCommentDataSourceService).addComment(r),c=e.get(o.ICommandService),d=$.addCustomDecorationBySelectionFactory(e,{id:s.threadId,type:o.CustomDecorationType.COMMENT,unitId:n});if(d){const m={id:N.AddCommentMutation.id,params:{unitId:n,subUnitId:M,comment:s}},f={id:O.SetActiveCommentOperation.id,params:{unitId:n,subUnitId:M,commentId:s.id}};return(await o.sequenceExecute([m,d,f],c)).result}return!1}},z={id:"docs.command.delete-comment",type:o.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{commentId:r,unitId:n}=t,i=e.get(o.ICommandService),s=$.deleteCustomDecorationFactory(e,{id:r,unitId:n});return s?(await o.sequenceExecute([s],i)).result:!1}},te=e=>{const t=e.get(x.IRenderManagerService),r=e.get(S.DocSelectionManagerService),n=t.getCurrent(),i=n==null?void 0:n.with(S.DocSkeletonManagerService).getSkeleton(),s=i==null?void 0:i.getViewModel().getEditArea();if(s===x.DocumentEditArea.FOOTER||s===x.DocumentEditArea.HEADER)return!0;const c=r.getActiveTextRange();return!!(c==null||c.collapsed)};function Ie(e){return{id:V.id,type:I.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:I.getMenuHiddenObservable(e,o.UniverInstanceType.UNIVER_DOC,void 0,o.SHEET_EDITOR_UNITS),disabled$:new R.Observable(function(t){const n=e.get(S.DocSelectionManagerService).textSelection$.pipe(R.debounceTime(16)).subscribe(()=>{t.next(te(e))});return()=>{n.unsubscribe()}})}}function _e(e){return{id:Y.id,type:I.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:I.getMenuHiddenObservable(e,o.UniverInstanceType.UNIVER_DOC)}}const E=()=>{const e=o.useDependency(o.IUniverInstanceService),t=o.useDependency(o.Injector),r=g.useMemo(()=>e.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_DOC).pipe(R.filter(l=>!!l&&!o.isInternalEditorID(l.getUnitId()))),[e]),n=o.useObservable(r),i=g.useMemo(()=>new R.Observable(l=>l.next(M)),[]),s=o.useDependency(S.DocSelectionManagerService),c=g.useMemo(()=>s.textSelection$.pipe(R.debounceTime(16)),[s.textSelection$]);o.useObservable(c);const d=o.useDependency(o.ICommandService),m=o.useDependency(P),f=o.useObservable(m.addingComment$),[a,C]=g.useState([]);if(g.useEffect(()=>{var D;const l=new Set,u=n==null?void 0:n.getCustomDecorations();C((D=u==null?void 0:u.map(h=>h.id).filter(h=>{const T=l.has(h);return l.add(h),!T}))!=null?D:[]);const b=d.onCommandExecuted(h=>{var T;if(h.id===S.RichTextEditingMutation.id){const w=new Set,H=n==null?void 0:n.getCustomDecorations();C((T=H==null?void 0:H.map(B=>B.id).filter(B=>{const ce=w.has(B);return w.add(B),!ce}))!=null?T:[])}});return()=>{b.dispose()}},[d,n]),!n)return null;const v=te(t),p=n.getUnitId();return pe.jsx(O.ThreadCommentPanel,{unitId:p,subUnitId$:i,type:o.UniverInstanceType.UNIVER_DOC,onAdd:()=>{d.executeCommand(V.id)},getSubUnitName:()=>"",disableAdd:v,tempComment:f,onAddComment:l=>{if(!l.parentId){const u={unitId:p,range:f,comment:l};return d.executeCommand(Z.id,u),m.endAdd(),!1}return!0},onDeleteComment:l=>{if(!l.parentId){const u={unitId:p,commentId:l.id};return d.executeCommand(z.id,u),!1}return!0},showComments:a})};E.componentKey="univer.doc.thread-comment-panel";const j={id:"docs.operation.show-comment-panel",type:o.CommandType.OPERATION,handler(e,t){var i;const r=e.get(O.ThreadCommentPanelService),n=e.get(I.ISidebarService);return(!r.panelVisible||((i=n.options.children)==null?void 0:i.label)!==E.componentKey)&&(n.open({header:{title:"threadCommentUI.panel.title"},children:{label:E.componentKey},width:320,onClose:()=>r.setPanelVisible(!1)}),r.setPanelVisible(!0)),t&&r.setActiveComment(t==null?void 0:t.activeComment),!0}},Y={id:"docs.operation.toggle-comment-panel",type:o.CommandType.OPERATION,handler(e){var n;const t=e.get(O.ThreadCommentPanelService),r=e.get(I.ISidebarService);return!t.panelVisible||((n=r.options.children)==null?void 0:n.label)!==E.componentKey?(r.open({header:{title:"threadCommentUI.panel.title"},children:{label:E.componentKey},width:320,onClose:()=>t.setPanelVisible(!1)}),t.setPanelVisible(!0)):(r.close(),t.setPanelVisible(!1),t.setActiveComment(null)),!0}},V={id:"docs.operation.start-add-comment",type:o.CommandType.OPERATION,handler(e){var h,T,w;const t=e.get(O.ThreadCommentPanelService),n=e.get(o.IUniverInstanceService).getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC),i=e.get(S.DocSelectionManagerService),s=e.get(x.IRenderManagerService),c=e.get(o.UserManagerService),d=e.get(P),m=e.get(o.ICommandService),f=e.get(I.ISidebarService),a=i.getActiveTextRange();if(!n||!a)return!1;const C=(h=s.getRenderById(n.getUnitId()))==null?void 0:h.with($.DocSelectionRenderService);if(C==null||C.setReserveRangesStatus(!0),a.collapsed)return t.panelVisible?(t.setPanelVisible(!1),f.close()):m.executeCommand(j.id),!0;m.executeCommand(j.id);const v=n.getUnitId(),p=((w=(T=n.getBody())==null?void 0:T.dataStream)!=null?w:"").slice(a.startOffset,a.endOffset),l=o.BuildTextUtils.transform.getPlainText(p),u=M,b="",D={unitId:v,subUnitId:u,id:b,ref:l,dT:N.getDT(),personId:c.getCurrentUser().userID,text:{dataStream:`\r
|
|
10
|
+
`},startOffset:a.startOffset,endOffset:a.endOffset,collapsed:!0,threadId:b};return C==null||C.blur(),d.startAdd(D),t.setActiveComment({unitId:v,subUnitId:u,commentId:b}),!0}};var ge=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,Oe=(e,t,r,n)=>{for(var i=n>1?void 0:n?Se(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&ge(t,r,i),i},y=(e,t)=>(r,n)=>t(r,n,e);let q=class extends o.Disposable{constructor(e,t,r,n,i,s){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=r,this._docThreadCommentService=n,this._renderManagerService=i,this._threadCommentModel=s,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var r,n,i,s;if(t.id===S.SetTextSelectionsOperation.id){const c=t.params,{unitId:d,ranges:m}=c;if(o.isInternalEditorID(d))return;const f=this._univerInstanceService.getUnit(d,o.UniverInstanceType.UNIVER_DOC),a=m[0];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))return;if(e=a,a&&f){const{startOffset:C,endOffset:v,collapsed:p}=a;let l;if(p?l=(n=(r=f.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(u=>u.startIndex<=C&&u.endIndex>=v-1):l=(s=(i=f.getBody())==null?void 0:i.customDecorations)==null?void 0:s.find(u=>u.startIndex<=C&&u.endIndex>=v-1),l){const u=this._threadCommentModel.getComment(d,M,l.id);u&&!u.resolved&&this._commandService.executeCommand(j.id,{activeComment:{unitId:d,subUnitId:M,commentId:l.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 s=this._univerInstanceService.getUnit(e.unitId);if(s){const c=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with($.DocBackScrollRenderController),d=(n=(r=s.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(m=>m.id===e.commentId);d&&c&&c.scrollToRange({startOffset:d.startIndex,endOffset:d.endIndex,collapsed:!1})}}(!e||e.commentId!==((i=this._docThreadCommentService.addingComment)==null?void 0:i.id))&&this._docThreadCommentService.endAdd()}))}};q=Oe([y(0,o.Inject(O.ThreadCommentPanelService)),y(1,o.IUniverInstanceService),y(2,o.ICommandService),y(3,o.Inject(P)),y(4,x.IRenderManagerService),y(5,o.Inject(N.ThreadCommentModel))],q);var _=function(){return _=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},_.apply(this,arguments)},be=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},ne=g.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,s=e.extend,c=be(e,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),m=g.useRef("_".concat(De()));return re(r,"".concat(n),{defIds:r.defIds,idSuffix:m.current},_({ref:t,className:d},c),s)});function re(e,t,r,n,i){return g.createElement(e.tag,_(_({key:t},Me(e,r,i)),n),(Te(e,r).children||[]).map(function(s,c){return re(s,"".concat(t,"-").concat(e.tag,"-").concat(c),r,void 0,i)}))}function Me(e,t,r){var n=_({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);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(s){var c=s[0],d=s[1];typeof d=="string"&&(n[c]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(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)?_(_({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?_(_({},i),{attrs:_(_({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function De(){return Math.random().toString(36).substring(2,8)}ne.displayName="UniverIcon";var ye={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"}}]},ie=g.forwardRef(function(e,t){return g.createElement(ne,Object.assign({},e,{id:"comment-single",ref:t,icon:ye}))});ie.displayName="CommentSingle";const Ue={[I.RibbonStartGroup.OTHERS]:{[Y.id]:{order:1,menuItemFactory:_e}},[I.ContextMenuPosition.MAIN_AREA]:{[I.ContextMenuGroup.DATA]:{[V.id]:{order:1,menuItemFactory:Ie}}}};var xe=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Pe=(e,t,r,n)=>{for(var i=n>1?void 0:n?Re(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&xe(t,r,i),i},J=(e,t)=>(r,n)=>t(r,n,e);let F=class extends o.Disposable{constructor(e,t,r){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=r,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[Z,z,j,V,Y].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(Ue)}_initComponents(){[E].forEach(e=>{this.disposeWithMe(this._componentManager.register(e.componentKey,e))}),this.disposeWithMe(this._componentManager.register("CommentSingle",ie))}};F=Pe([J(0,o.ICommandService),J(1,I.IMenuManagerService),J(2,o.Inject(I.ComponentManager))],F);var Ee=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ae=(e,t,r,n)=>{for(var i=n>1?void 0:n?we(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&Ee(t,r,i),i},U=(e,t)=>(r,n)=>t(r,n,e);let G=class extends o.Disposable{constructor(e,t,r,n,i,s,c){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=r,this._docRenderController=n,this._univerInstanceService=i,this._threadCommentModel=s,this._commandService=c,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(o.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(S.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,r)=>{if(!e)return r(e);const{unitId:n,index:i,customDecorations:s}=t,c=this._threadCommentPanelService.activeCommentId,{commentId:d,unitId:m}=c||{},f=s.find(p=>p.id===d),a=this._threadCommentModel.getComment(n,M,e.id);if(!a)return r({...e,show:!1});const C=f&&i>=f.startIndex&&i<=f.endIndex,v=m===n&&e.id===d;return r({...e,active:v||C,show:!a.resolved})}})}_initSyncComments(){var i,s,c;const e=this._context.unit.getUnitId(),t=M,r=(c=(s=(i=this._context.unit.getBody())==null?void 0:i.customDecorations)==null?void 0:s.filter(d=>d.type===o.CustomDecorationType.COMMENT).map(d=>d.id))!=null?c:[];r.forEach(d=>{this._threadCommentModel.getComment(e,t,d)||this._threadCommentModel.addComment(e,t,{id:d,threadId:d,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(d=>{var m,f,a;if(d.id===S.RichTextEditingMutation.id){if(d.params.unitId!==this._context.unit.getUnitId())return;const v=(a=(f=(m=this._context.unit.getBody())==null?void 0:m.customDecorations)==null?void 0:f.filter(l=>l.type===o.CustomDecorationType.COMMENT).map(l=>l.id))!=null?a:[],p=v.sort();if(JSON.stringify(n)!==JSON.stringify(p)){const l=new Set(n),u=new Set(p),b=new Set,D=new Set;v.forEach(h=>{l.has(h)||b.add(h)}),n.forEach(h=>{u.has(h)||D.add(h)}),n=p,b.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,[...b])}}}))}};G=Ae([U(1,o.Inject(S.DocInterceptorService)),U(2,o.Inject(O.ThreadCommentPanelService)),U(3,o.Inject($.DocRenderController)),U(4,o.IUniverInstanceService),U(5,o.Inject(N.ThreadCommentModel)),U(6,o.ICommandService)],G);var oe=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,je=(e,t,r)=>t in e?oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$e=(e,t,r,n)=>{for(var i=n>1?void 0:n?Ne(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&oe(t,r,i),i},K=(e,t)=>(r,n)=>t(r,n,e),se=(e,t,r)=>je(e,typeof t!="symbol"?t+"":t,r);exports.UniverDocsThreadCommentUIPlugin=class extends o.Plugin{constructor(t=Q,r,n,i){super(),this._config=t,this._injector=r,this._renderManagerSrv=n,this._configService=i;const{menu:s,...c}=o.merge({},Q,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(le,c)}onStarting(){[[F],[q],[P]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(q),this._injector.get(F)}_initRenderModule(){[G].forEach(t=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,t)})}};se(exports.UniverDocsThreadCommentUIPlugin,"pluginName",me);se(exports.UniverDocsThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC);exports.UniverDocsThreadCommentUIPlugin=$e([o.DependentOn(O.UniverThreadCommentUIPlugin),K(1,o.Inject(o.Injector)),K(2,x.IRenderManagerService),K(3,o.IConfigService)],exports.UniverDocsThreadCommentUIPlugin);exports.AddDocCommentComment=Z;exports.DeleteDocCommentComment=z;exports.ShowCommentPanelOperation=j;exports.StartAddCommentOperation=V;
|
package/lib/es/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var K = (e, t, r) =>
|
|
4
|
-
import { Inject as
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var ye = (e, t, r) => t in e ? Re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var K = (e, t, r) => ye(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { Inject as v, Disposable as B, CommandType as w, ICommandService as M, CustomDecorationType as X, sequenceExecute as se, UniverInstanceType as S, SHEET_EDITOR_UNITS as Te, useDependency as P, IUniverInstanceService as F, Injector as de, isInternalEditorID as ce, useObservable as G, UserManagerService as Ue, BuildTextUtils as Pe, DependentOn as Ee, Plugin as we, merge as Ne, IConfigService as Ae } from "@univerjs/core";
|
|
5
5
|
import { IRenderManagerService as L, DocumentEditArea as te } from "@univerjs/engine-render";
|
|
6
|
-
import { ThreadCommentPanelService as T, SetActiveCommentOperation as
|
|
7
|
-
import { DocSelectionManagerService as H, DocSkeletonManagerService as
|
|
8
|
-
import { addCustomDecorationBySelectionFactory as
|
|
9
|
-
import { IThreadCommentDataSourceService as
|
|
10
|
-
import { ISidebarService as W, MenuItemType as
|
|
11
|
-
import { BehaviorSubject as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
var
|
|
15
|
-
for (var
|
|
16
|
-
(s = e[
|
|
17
|
-
return n &&
|
|
6
|
+
import { ThreadCommentPanelService as T, SetActiveCommentOperation as ae, ThreadCommentPanel as $e, UniverThreadCommentUIPlugin as Ve } from "@univerjs/thread-comment-ui";
|
|
7
|
+
import { DocSelectionManagerService as H, DocSkeletonManagerService as je, RichTextEditingMutation as me, SetTextSelectionsOperation as Be, DocInterceptorService as Fe, DOC_INTERCEPTOR_POINT as Le } from "@univerjs/docs";
|
|
8
|
+
import { addCustomDecorationBySelectionFactory as He, deleteCustomDecorationFactory as We, DocSelectionRenderService as qe, DocBackScrollRenderController as Je, DocRenderController as Ke } from "@univerjs/docs-ui";
|
|
9
|
+
import { IThreadCommentDataSourceService as Ge, AddCommentMutation as Ze, getDT as ze, ThreadCommentModel as le } from "@univerjs/thread-comment";
|
|
10
|
+
import { ISidebarService as W, MenuItemType as ue, getMenuHiddenObservable as fe, RibbonStartGroup as Ye, ContextMenuPosition as Qe, ContextMenuGroup as Xe, ComponentManager as ke, IMenuManagerService as et } from "@univerjs/ui";
|
|
11
|
+
import { BehaviorSubject as tt, Observable as he, debounceTime as Ce, filter as nt } from "rxjs";
|
|
12
|
+
import rt, { useMemo as Z, useState as it, useEffect as ot, forwardRef as _e, useRef as st, createElement as pe } from "react";
|
|
13
|
+
const dt = "DOC_THREAD_COMMENT_UI_PLUGIN", I = "default_doc", ct = "docs-thread-comment-ui.config", ne = {};
|
|
14
|
+
var at = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, lt = (e, t, r, n) => {
|
|
15
|
+
for (var i = n > 1 ? void 0 : n ? mt(t, r) : t, o = e.length - 1, s; o >= 0; o--)
|
|
16
|
+
(s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
|
|
17
|
+
return n && i && at(t, r, i), i;
|
|
18
18
|
}, re = (e, t) => (r, n) => t(r, n, e);
|
|
19
19
|
let R = class extends B {
|
|
20
20
|
constructor(t, r) {
|
|
21
21
|
super();
|
|
22
|
-
K(this, "_addingComment$", new
|
|
22
|
+
K(this, "_addingComment$", new tt(void 0));
|
|
23
23
|
K(this, "addingComment$", this._addingComment$.asObservable());
|
|
24
24
|
this._sidebarService = t, this._threadCommentPanelService = r, this.disposeWithMe(() => {
|
|
25
25
|
this._addingComment$.complete();
|
|
@@ -35,9 +35,9 @@ let R = class extends B {
|
|
|
35
35
|
this._addingComment$.next(void 0);
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
R =
|
|
38
|
+
R = lt([
|
|
39
39
|
re(0, W),
|
|
40
|
-
re(1,
|
|
40
|
+
re(1, v(T))
|
|
41
41
|
], R);
|
|
42
42
|
var z = { exports: {} }, E = {};
|
|
43
43
|
/**
|
|
@@ -49,88 +49,89 @@ var z = { exports: {} }, E = {};
|
|
|
49
49
|
* This source code is licensed under the MIT license found in the
|
|
50
50
|
* LICENSE file in the root directory of this source tree.
|
|
51
51
|
*/
|
|
52
|
-
var
|
|
53
|
-
function
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
var e =
|
|
52
|
+
var ie;
|
|
53
|
+
function ut() {
|
|
54
|
+
if (ie) return E;
|
|
55
|
+
ie = 1;
|
|
56
|
+
var e = rt, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
57
57
|
function s(d, a, u) {
|
|
58
|
-
var c,
|
|
58
|
+
var c, f = {}, C = null, _ = null;
|
|
59
59
|
u !== void 0 && (C = "" + u), a.key !== void 0 && (C = "" + a.key), a.ref !== void 0 && (_ = a.ref);
|
|
60
|
-
for (c in a) n.call(a, c) && !
|
|
61
|
-
if (d && d.defaultProps) for (c in a = d.defaultProps, a)
|
|
62
|
-
return { $$typeof: t, type: d, key: C, ref: _, props:
|
|
60
|
+
for (c in a) n.call(a, c) && !o.hasOwnProperty(c) && (f[c] = a[c]);
|
|
61
|
+
if (d && d.defaultProps) for (c in a = d.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
|
|
62
|
+
return { $$typeof: t, type: d, key: C, ref: _, props: f, _owner: i.current };
|
|
63
63
|
}
|
|
64
64
|
return E.Fragment = r, E.jsx = s, E.jsxs = s, E;
|
|
65
65
|
}
|
|
66
|
-
var
|
|
67
|
-
function
|
|
68
|
-
return
|
|
66
|
+
var oe;
|
|
67
|
+
function ft() {
|
|
68
|
+
return oe || (oe = 1, z.exports = ut()), z.exports;
|
|
69
69
|
}
|
|
70
|
-
var
|
|
70
|
+
var ht = ft();
|
|
71
71
|
const ve = {
|
|
72
72
|
id: "docs.command.add-comment",
|
|
73
73
|
type: w.COMMAND,
|
|
74
74
|
async handler(e, t) {
|
|
75
75
|
if (!t)
|
|
76
76
|
return !1;
|
|
77
|
-
const { comment: r, unitId: n } = t,
|
|
77
|
+
const { comment: r, unitId: n } = t, o = await e.get(Ge).addComment(r), s = e.get(M), d = He(
|
|
78
78
|
e,
|
|
79
79
|
{
|
|
80
|
-
id:
|
|
81
|
-
type: X.COMMENT
|
|
80
|
+
id: o.threadId,
|
|
81
|
+
type: X.COMMENT,
|
|
82
|
+
unitId: n
|
|
82
83
|
}
|
|
83
84
|
);
|
|
84
85
|
if (d) {
|
|
85
86
|
const a = {
|
|
86
|
-
id:
|
|
87
|
+
id: Ze.id,
|
|
87
88
|
params: {
|
|
88
89
|
unitId: n,
|
|
89
90
|
subUnitId: I,
|
|
90
|
-
comment:
|
|
91
|
+
comment: o
|
|
91
92
|
}
|
|
92
93
|
}, u = {
|
|
93
|
-
id:
|
|
94
|
+
id: ae.id,
|
|
94
95
|
params: {
|
|
95
96
|
unitId: n,
|
|
96
97
|
subUnitId: I,
|
|
97
|
-
commentId:
|
|
98
|
+
commentId: o.id
|
|
98
99
|
}
|
|
99
100
|
};
|
|
100
101
|
return (await se([a, d, u], s)).result;
|
|
101
102
|
}
|
|
102
103
|
return !1;
|
|
103
104
|
}
|
|
104
|
-
},
|
|
105
|
+
}, ge = {
|
|
105
106
|
id: "docs.command.delete-comment",
|
|
106
107
|
type: w.COMMAND,
|
|
107
108
|
async handler(e, t) {
|
|
108
109
|
if (!t)
|
|
109
110
|
return !1;
|
|
110
|
-
const { commentId: r, unitId: n } = t,
|
|
111
|
+
const { commentId: r, unitId: n } = t, i = e.get(M), o = We(e, {
|
|
111
112
|
id: r,
|
|
112
113
|
unitId: n
|
|
113
114
|
});
|
|
114
|
-
return
|
|
115
|
+
return o ? (await se([o], i)).result : !1;
|
|
115
116
|
}
|
|
116
|
-
},
|
|
117
|
-
const t = e.get(L), r = e.get(H), n = t.getCurrent(),
|
|
118
|
-
if (
|
|
117
|
+
}, Ie = (e) => {
|
|
118
|
+
const t = e.get(L), r = e.get(H), n = t.getCurrent(), i = n == null ? void 0 : n.with(je).getSkeleton(), o = i == null ? void 0 : i.getViewModel().getEditArea();
|
|
119
|
+
if (o === te.FOOTER || o === te.HEADER)
|
|
119
120
|
return !0;
|
|
120
121
|
const s = r.getActiveTextRange();
|
|
121
122
|
return !!(s == null || s.collapsed);
|
|
122
123
|
};
|
|
123
|
-
function
|
|
124
|
+
function Ct(e) {
|
|
124
125
|
return {
|
|
125
126
|
id: q.id,
|
|
126
|
-
type:
|
|
127
|
+
type: ue.BUTTON,
|
|
127
128
|
icon: "CommentSingle",
|
|
128
129
|
title: "threadCommentUI.panel.addComment",
|
|
129
130
|
tooltip: "threadCommentUI.panel.addComment",
|
|
130
|
-
hidden$:
|
|
131
|
-
disabled$: new
|
|
132
|
-
const n = e.get(H).textSelection$.pipe(
|
|
133
|
-
t.next(
|
|
131
|
+
hidden$: fe(e, S.UNIVER_DOC, void 0, Te),
|
|
132
|
+
disabled$: new he(function(t) {
|
|
133
|
+
const n = e.get(H).textSelection$.pipe(Ce(16)).subscribe(() => {
|
|
134
|
+
t.next(Ie(e));
|
|
134
135
|
});
|
|
135
136
|
return () => {
|
|
136
137
|
n.unsubscribe();
|
|
@@ -138,37 +139,37 @@ function ft(e) {
|
|
|
138
139
|
})
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
|
-
function
|
|
142
|
+
function _t(e) {
|
|
142
143
|
return {
|
|
143
144
|
id: ee.id,
|
|
144
|
-
type:
|
|
145
|
+
type: ue.BUTTON,
|
|
145
146
|
icon: "CommentSingle",
|
|
146
147
|
title: "threadCommentUI.panel.addComment",
|
|
147
148
|
tooltip: "threadCommentUI.panel.addComment",
|
|
148
|
-
hidden$:
|
|
149
|
+
hidden$: fe(e, S.UNIVER_DOC)
|
|
149
150
|
};
|
|
150
151
|
}
|
|
151
152
|
const y = () => {
|
|
152
|
-
const e =
|
|
153
|
-
() =>
|
|
154
|
-
[
|
|
153
|
+
const e = P(F), t = P(de), r = Z(() => e.getCurrentTypeOfUnit$(S.UNIVER_DOC).pipe(nt((m) => !!m && !ce(m.getUnitId()))), [e]), n = G(r), i = Z(() => new he((m) => m.next(I)), []), o = P(H), s = Z(
|
|
154
|
+
() => o.textSelection$.pipe(Ce(16)),
|
|
155
|
+
[o.textSelection$]
|
|
155
156
|
);
|
|
156
157
|
G(s);
|
|
157
|
-
const d =
|
|
158
|
-
if (
|
|
158
|
+
const d = P(M), a = P(R), u = G(a.addingComment$), [c, f] = it([]);
|
|
159
|
+
if (ot(() => {
|
|
159
160
|
var b;
|
|
160
161
|
const m = /* @__PURE__ */ new Set(), l = n == null ? void 0 : n.getCustomDecorations();
|
|
161
|
-
|
|
162
|
-
const O = m.has(
|
|
163
|
-
return m.add(
|
|
162
|
+
f((b = l == null ? void 0 : l.map((h) => h.id).filter((h) => {
|
|
163
|
+
const O = m.has(h);
|
|
164
|
+
return m.add(h), !O;
|
|
164
165
|
})) != null ? b : []);
|
|
165
|
-
const g = d.onCommandExecuted((
|
|
166
|
+
const g = d.onCommandExecuted((h) => {
|
|
166
167
|
var O;
|
|
167
|
-
if (
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
return
|
|
168
|
+
if (h.id === me.id) {
|
|
169
|
+
const U = /* @__PURE__ */ new Set(), J = n == null ? void 0 : n.getCustomDecorations();
|
|
170
|
+
f((O = J == null ? void 0 : J.map((N) => N.id).filter((N) => {
|
|
171
|
+
const De = U.has(N);
|
|
172
|
+
return U.add(N), !De;
|
|
172
173
|
})) != null ? O : []);
|
|
173
174
|
}
|
|
174
175
|
});
|
|
@@ -177,12 +178,12 @@ const y = () => {
|
|
|
177
178
|
};
|
|
178
179
|
}, [d, n]), !n)
|
|
179
180
|
return null;
|
|
180
|
-
const C =
|
|
181
|
-
return /* @__PURE__ */
|
|
182
|
-
|
|
181
|
+
const C = Ie(t), _ = n.getUnitId();
|
|
182
|
+
return /* @__PURE__ */ ht.jsx(
|
|
183
|
+
$e,
|
|
183
184
|
{
|
|
184
185
|
unitId: _,
|
|
185
|
-
subUnitId$:
|
|
186
|
+
subUnitId$: i,
|
|
186
187
|
type: S.UNIVER_DOC,
|
|
187
188
|
onAdd: () => {
|
|
188
189
|
d.executeCommand(q.id);
|
|
@@ -207,7 +208,7 @@ const y = () => {
|
|
|
207
208
|
unitId: _,
|
|
208
209
|
commentId: m.id
|
|
209
210
|
};
|
|
210
|
-
return d.executeCommand(
|
|
211
|
+
return d.executeCommand(ge.id, l), !1;
|
|
211
212
|
}
|
|
212
213
|
return !0;
|
|
213
214
|
},
|
|
@@ -220,9 +221,9 @@ const A = {
|
|
|
220
221
|
id: "docs.operation.show-comment-panel",
|
|
221
222
|
type: w.OPERATION,
|
|
222
223
|
handler(e, t) {
|
|
223
|
-
var
|
|
224
|
+
var i;
|
|
224
225
|
const r = e.get(T), n = e.get(W);
|
|
225
|
-
return (!r.panelVisible || ((
|
|
226
|
+
return (!r.panelVisible || ((i = n.options.children) == null ? void 0 : i.label) !== y.componentKey) && (n.open({
|
|
226
227
|
header: { title: "threadCommentUI.panel.title" },
|
|
227
228
|
children: { label: y.componentKey },
|
|
228
229
|
width: 320,
|
|
@@ -246,20 +247,20 @@ const A = {
|
|
|
246
247
|
id: "docs.operation.start-add-comment",
|
|
247
248
|
type: w.OPERATION,
|
|
248
249
|
handler(e) {
|
|
249
|
-
var
|
|
250
|
-
const t = e.get(T), n = e.get(F).getCurrentUnitForType(S.UNIVER_DOC),
|
|
250
|
+
var h, O, U;
|
|
251
|
+
const t = e.get(T), n = e.get(F).getCurrentUnitForType(S.UNIVER_DOC), i = e.get(H), o = e.get(L), s = e.get(Ue), d = e.get(R), a = e.get(M), u = e.get(W), c = i.getActiveTextRange();
|
|
251
252
|
if (!n || !c)
|
|
252
253
|
return !1;
|
|
253
|
-
const
|
|
254
|
-
if (c.collapsed)
|
|
254
|
+
const f = (h = o.getRenderById(n.getUnitId())) == null ? void 0 : h.with(qe);
|
|
255
|
+
if (f == null || f.setReserveRangesStatus(!0), c.collapsed)
|
|
255
256
|
return t.panelVisible ? (t.setPanelVisible(!1), u.close()) : a.executeCommand(A.id), !0;
|
|
256
257
|
a.executeCommand(A.id);
|
|
257
|
-
const C = n.getUnitId(), _ = ((
|
|
258
|
+
const C = n.getUnitId(), _ = ((U = (O = n.getBody()) == null ? void 0 : O.dataStream) != null ? U : "").slice(c.startOffset, c.endOffset), m = Pe.transform.getPlainText(_), l = I, g = "", b = {
|
|
258
259
|
unitId: C,
|
|
259
260
|
subUnitId: l,
|
|
260
261
|
id: g,
|
|
261
262
|
ref: m,
|
|
262
|
-
dT:
|
|
263
|
+
dT: ze(),
|
|
263
264
|
personId: s.getCurrentUser().userID,
|
|
264
265
|
text: {
|
|
265
266
|
dataStream: `\r
|
|
@@ -270,35 +271,37 @@ const A = {
|
|
|
270
271
|
collapsed: !0,
|
|
271
272
|
threadId: g
|
|
272
273
|
};
|
|
273
|
-
return
|
|
274
|
+
return f == null || f.blur(), d.startAdd(b), t.setActiveComment({
|
|
274
275
|
unitId: C,
|
|
275
276
|
subUnitId: l,
|
|
276
277
|
commentId: g
|
|
277
278
|
}), !0;
|
|
278
279
|
}
|
|
279
280
|
};
|
|
280
|
-
var
|
|
281
|
-
for (var
|
|
282
|
-
(s = e[
|
|
283
|
-
return n &&
|
|
281
|
+
var pt = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, gt = (e, t, r, n) => {
|
|
282
|
+
for (var i = n > 1 ? void 0 : n ? vt(t, r) : t, o = e.length - 1, s; o >= 0; o--)
|
|
283
|
+
(s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
|
|
284
|
+
return n && i && pt(t, r, i), i;
|
|
284
285
|
}, x = (e, t) => (r, n) => t(r, n, e);
|
|
285
286
|
let $ = class extends B {
|
|
286
|
-
constructor(e, t, r, n,
|
|
287
|
-
super(), this._threadCommentPanelService = e, this._univerInstanceService = t, this._commandService = r, this._docThreadCommentService = n, this._renderManagerService =
|
|
287
|
+
constructor(e, t, r, n, i, o) {
|
|
288
|
+
super(), this._threadCommentPanelService = e, this._univerInstanceService = t, this._commandService = r, this._docThreadCommentService = n, this._renderManagerService = i, this._threadCommentModel = o, this._initSelectionChange(), this._initActiveCommandChange();
|
|
288
289
|
}
|
|
289
290
|
_initSelectionChange() {
|
|
290
291
|
let e;
|
|
291
292
|
this.disposeWithMe(
|
|
292
293
|
this._commandService.onCommandExecuted((t) => {
|
|
293
|
-
var r, n,
|
|
294
|
-
if (t.id ===
|
|
295
|
-
const s = t.params, { unitId: d, ranges: a } = s
|
|
294
|
+
var r, n, i, o;
|
|
295
|
+
if (t.id === Be.id) {
|
|
296
|
+
const s = t.params, { unitId: d, ranges: a } = s;
|
|
297
|
+
if (ce(d)) return;
|
|
298
|
+
const u = this._univerInstanceService.getUnit(d, S.UNIVER_DOC), c = a[0];
|
|
296
299
|
if ((e == null ? void 0 : e.startOffset) === (c == null ? void 0 : c.startOffset) && (e == null ? void 0 : e.endOffset) === (c == null ? void 0 : c.endOffset))
|
|
297
300
|
return;
|
|
298
301
|
if (e = c, c && u) {
|
|
299
|
-
const { startOffset:
|
|
302
|
+
const { startOffset: f, endOffset: C, collapsed: _ } = c;
|
|
300
303
|
let m;
|
|
301
|
-
if (_ ? m = (n = (r = u.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((l) => l.startIndex <=
|
|
304
|
+
if (_ ? m = (n = (r = u.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((l) => l.startIndex <= f && l.endIndex >= C - 1) : m = (o = (i = u.getBody()) == null ? void 0 : i.customDecorations) == null ? void 0 : o.find((l) => l.startIndex <= f && l.endIndex >= C - 1), m) {
|
|
302
305
|
const l = this._threadCommentModel.getComment(d, I, m.id);
|
|
303
306
|
l && !l.resolved && this._commandService.executeCommand(A.id, {
|
|
304
307
|
activeComment: {
|
|
@@ -312,18 +315,18 @@ let $ = class extends B {
|
|
|
312
315
|
}
|
|
313
316
|
if (!this._threadCommentPanelService.activeCommentId)
|
|
314
317
|
return;
|
|
315
|
-
this._commandService.executeCommand(
|
|
318
|
+
this._commandService.executeCommand(ae.id);
|
|
316
319
|
}
|
|
317
320
|
})
|
|
318
321
|
);
|
|
319
322
|
}
|
|
320
323
|
_initActiveCommandChange() {
|
|
321
324
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((e) => {
|
|
322
|
-
var t, r, n,
|
|
325
|
+
var t, r, n, i;
|
|
323
326
|
if (e) {
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
const s = (t = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : t.with(
|
|
327
|
+
const o = this._univerInstanceService.getUnit(e.unitId);
|
|
328
|
+
if (o) {
|
|
329
|
+
const s = (t = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : t.with(Je), d = (n = (r = o.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((a) => a.id === e.commentId);
|
|
327
330
|
d && s && s.scrollToRange({
|
|
328
331
|
startOffset: d.startIndex,
|
|
329
332
|
endOffset: d.endIndex,
|
|
@@ -331,89 +334,89 @@ let $ = class extends B {
|
|
|
331
334
|
});
|
|
332
335
|
}
|
|
333
336
|
}
|
|
334
|
-
(!e || e.commentId !== ((
|
|
337
|
+
(!e || e.commentId !== ((i = this._docThreadCommentService.addingComment) == null ? void 0 : i.id)) && this._docThreadCommentService.endAdd();
|
|
335
338
|
}));
|
|
336
339
|
}
|
|
337
340
|
};
|
|
338
|
-
$ =
|
|
339
|
-
x(0,
|
|
341
|
+
$ = gt([
|
|
342
|
+
x(0, v(T)),
|
|
340
343
|
x(1, F),
|
|
341
344
|
x(2, M),
|
|
342
|
-
x(3,
|
|
345
|
+
x(3, v(R)),
|
|
343
346
|
x(4, L),
|
|
344
|
-
x(5,
|
|
347
|
+
x(5, v(le))
|
|
345
348
|
], $);
|
|
346
|
-
var
|
|
347
|
-
return
|
|
349
|
+
var p = function() {
|
|
350
|
+
return p = Object.assign || function(e) {
|
|
348
351
|
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
349
352
|
t = arguments[r];
|
|
350
|
-
for (var
|
|
353
|
+
for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
351
354
|
}
|
|
352
355
|
return e;
|
|
353
|
-
},
|
|
354
|
-
},
|
|
356
|
+
}, p.apply(this, arguments);
|
|
357
|
+
}, It = function(e, t) {
|
|
355
358
|
var r = {};
|
|
356
359
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
357
360
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
358
|
-
for (var
|
|
359
|
-
t.indexOf(n[
|
|
361
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
362
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
|
|
360
363
|
return r;
|
|
361
|
-
},
|
|
362
|
-
var r = e.icon, n = e.id,
|
|
363
|
-
return
|
|
364
|
+
}, Se = _e(function(e, t) {
|
|
365
|
+
var r = e.icon, n = e.id, i = e.className, o = e.extend, s = It(e, ["icon", "id", "className", "extend"]), d = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), a = st("_".concat(Mt()));
|
|
366
|
+
return Oe(r, "".concat(n), { defIds: r.defIds, idSuffix: a.current }, p({ ref: t, className: d }, s), o);
|
|
364
367
|
});
|
|
365
|
-
function
|
|
366
|
-
return
|
|
367
|
-
return
|
|
368
|
+
function Oe(e, t, r, n, i) {
|
|
369
|
+
return pe(e.tag, p(p({ key: t }, St(e, r, i)), n), (Ot(e, r).children || []).map(function(o, s) {
|
|
370
|
+
return Oe(o, "".concat(t, "-").concat(e.tag, "-").concat(s), r, void 0, i);
|
|
368
371
|
}));
|
|
369
372
|
}
|
|
370
|
-
function
|
|
371
|
-
var n =
|
|
373
|
+
function St(e, t, r) {
|
|
374
|
+
var n = p({}, e.attrs);
|
|
372
375
|
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
|
|
373
|
-
var
|
|
374
|
-
return !
|
|
375
|
-
var s =
|
|
376
|
+
var i = t.defIds;
|
|
377
|
+
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) {
|
|
378
|
+
var s = o[0], d = o[1];
|
|
376
379
|
typeof d == "string" && (n[s] = d.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
377
380
|
})), n;
|
|
378
381
|
}
|
|
379
|
-
function
|
|
382
|
+
function Ot(e, t) {
|
|
380
383
|
var r, n = t.defIds;
|
|
381
|
-
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ?
|
|
382
|
-
return typeof
|
|
384
|
+
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) {
|
|
385
|
+
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;
|
|
383
386
|
}) }) : e;
|
|
384
387
|
}
|
|
385
|
-
function
|
|
388
|
+
function Mt() {
|
|
386
389
|
return Math.random().toString(36).substring(2, 8);
|
|
387
390
|
}
|
|
388
|
-
|
|
389
|
-
var
|
|
390
|
-
return
|
|
391
|
+
Se.displayName = "UniverIcon";
|
|
392
|
+
var bt = { 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" } }] }, Me = _e(function(e, t) {
|
|
393
|
+
return pe(Se, Object.assign({}, e, {
|
|
391
394
|
id: "comment-single",
|
|
392
395
|
ref: t,
|
|
393
|
-
icon:
|
|
396
|
+
icon: bt
|
|
394
397
|
}));
|
|
395
398
|
});
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
[
|
|
399
|
+
Me.displayName = "CommentSingle";
|
|
400
|
+
const xt = {
|
|
401
|
+
[Ye.OTHERS]: {
|
|
399
402
|
[ee.id]: {
|
|
400
403
|
order: 1,
|
|
401
|
-
menuItemFactory:
|
|
404
|
+
menuItemFactory: _t
|
|
402
405
|
}
|
|
403
406
|
},
|
|
404
|
-
[
|
|
405
|
-
[
|
|
407
|
+
[Qe.MAIN_AREA]: {
|
|
408
|
+
[Xe.DATA]: {
|
|
406
409
|
[q.id]: {
|
|
407
410
|
order: 1,
|
|
408
|
-
menuItemFactory:
|
|
411
|
+
menuItemFactory: Ct
|
|
409
412
|
}
|
|
410
413
|
}
|
|
411
414
|
}
|
|
412
415
|
};
|
|
413
|
-
var
|
|
414
|
-
for (var
|
|
415
|
-
(s = e[
|
|
416
|
-
return n &&
|
|
416
|
+
var Dt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, yt = (e, t, r, n) => {
|
|
417
|
+
for (var i = n > 1 ? void 0 : n ? Rt(t, r) : t, o = e.length - 1, s; o >= 0; o--)
|
|
418
|
+
(s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
|
|
419
|
+
return n && i && Dt(t, r, i), i;
|
|
417
420
|
}, Y = (e, t) => (r, n) => t(r, n, e);
|
|
418
421
|
let V = class extends B {
|
|
419
422
|
constructor(e, t, r) {
|
|
@@ -422,7 +425,7 @@ let V = class extends B {
|
|
|
422
425
|
_initCommands() {
|
|
423
426
|
[
|
|
424
427
|
ve,
|
|
425
|
-
|
|
428
|
+
ge,
|
|
426
429
|
A,
|
|
427
430
|
q,
|
|
428
431
|
ee
|
|
@@ -431,27 +434,27 @@ let V = class extends B {
|
|
|
431
434
|
});
|
|
432
435
|
}
|
|
433
436
|
_initMenus() {
|
|
434
|
-
this._menuManagerService.mergeMenu(
|
|
437
|
+
this._menuManagerService.mergeMenu(xt);
|
|
435
438
|
}
|
|
436
439
|
_initComponents() {
|
|
437
440
|
[y].forEach((e) => {
|
|
438
441
|
this.disposeWithMe(this._componentManager.register(e.componentKey, e));
|
|
439
|
-
}), this.disposeWithMe(this._componentManager.register("CommentSingle",
|
|
442
|
+
}), this.disposeWithMe(this._componentManager.register("CommentSingle", Me));
|
|
440
443
|
}
|
|
441
444
|
};
|
|
442
|
-
V =
|
|
445
|
+
V = yt([
|
|
443
446
|
Y(0, M),
|
|
444
|
-
Y(1,
|
|
445
|
-
Y(2,
|
|
447
|
+
Y(1, et),
|
|
448
|
+
Y(2, v(ke))
|
|
446
449
|
], V);
|
|
447
|
-
var
|
|
448
|
-
for (var
|
|
449
|
-
(s = e[
|
|
450
|
-
return n &&
|
|
450
|
+
var Tt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, Pt = (e, t, r, n) => {
|
|
451
|
+
for (var i = n > 1 ? void 0 : n ? Ut(t, r) : t, o = e.length - 1, s; o >= 0; o--)
|
|
452
|
+
(s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
|
|
453
|
+
return n && i && Tt(t, r, i), i;
|
|
451
454
|
}, D = (e, t) => (r, n) => t(r, n, e);
|
|
452
455
|
let k = class extends B {
|
|
453
|
-
constructor(e, t, r, n,
|
|
454
|
-
super(), this._context = e, this._docInterceptorService = t, this._threadCommentPanelService = r, this._docRenderController = n, this._univerInstanceService =
|
|
456
|
+
constructor(e, t, r, n, i, o, s) {
|
|
457
|
+
super(), this._context = e, this._docInterceptorService = t, this._threadCommentPanelService = r, this._docRenderController = n, this._univerInstanceService = i, this._threadCommentModel = o, this._commandService = s, this._interceptorViewModel(), this._initReRender(), this._initSyncComments();
|
|
455
458
|
}
|
|
456
459
|
_initReRender() {
|
|
457
460
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((e) => {
|
|
@@ -467,74 +470,74 @@ let k = class extends B {
|
|
|
467
470
|
}));
|
|
468
471
|
}
|
|
469
472
|
_interceptorViewModel() {
|
|
470
|
-
this._docInterceptorService.intercept(
|
|
473
|
+
this._docInterceptorService.intercept(Le.CUSTOM_DECORATION, {
|
|
471
474
|
handler: (e, t, r) => {
|
|
472
475
|
if (!e)
|
|
473
476
|
return r(e);
|
|
474
|
-
const { unitId: n, index:
|
|
477
|
+
const { unitId: n, index: i, customDecorations: o } = t, s = this._threadCommentPanelService.activeCommentId, { commentId: d, unitId: a } = s || {}, u = o.find((_) => _.id === d), c = this._threadCommentModel.getComment(n, I, e.id);
|
|
475
478
|
if (!c)
|
|
476
479
|
return r({
|
|
477
480
|
...e,
|
|
478
481
|
show: !1
|
|
479
482
|
});
|
|
480
|
-
const
|
|
483
|
+
const f = u && i >= u.startIndex && i <= u.endIndex, C = a === n && e.id === d;
|
|
481
484
|
return r({
|
|
482
485
|
...e,
|
|
483
|
-
active: C ||
|
|
486
|
+
active: C || f,
|
|
484
487
|
show: !c.resolved
|
|
485
488
|
});
|
|
486
489
|
}
|
|
487
490
|
});
|
|
488
491
|
}
|
|
489
492
|
_initSyncComments() {
|
|
490
|
-
var
|
|
491
|
-
const e = this._context.unit.getUnitId(), t = I, r = (s = (
|
|
493
|
+
var i, o, s;
|
|
494
|
+
const e = this._context.unit.getUnitId(), t = I, r = (s = (o = (i = this._context.unit.getBody()) == null ? void 0 : i.customDecorations) == null ? void 0 : o.filter((d) => d.type === X.COMMENT).map((d) => d.id)) != null ? s : [];
|
|
492
495
|
r.forEach((d) => {
|
|
493
496
|
this._threadCommentModel.getComment(e, t, d) || this._threadCommentModel.addComment(e, t, { id: d, threadId: d, ref: "", dT: "", personId: "", text: { dataStream: "" }, unitId: e, subUnitId: t });
|
|
494
497
|
}), r.length && this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(), I, r);
|
|
495
498
|
let n = r.sort();
|
|
496
499
|
this.disposeWithMe(this._commandService.onCommandExecuted((d) => {
|
|
497
500
|
var a, u, c;
|
|
498
|
-
if (d.id ===
|
|
501
|
+
if (d.id === me.id) {
|
|
499
502
|
if (d.params.unitId !== this._context.unit.getUnitId())
|
|
500
503
|
return;
|
|
501
504
|
const C = (c = (u = (a = this._context.unit.getBody()) == null ? void 0 : a.customDecorations) == null ? void 0 : u.filter((m) => m.type === X.COMMENT).map((m) => m.id)) != null ? c : [], _ = C.sort();
|
|
502
505
|
if (JSON.stringify(n) !== JSON.stringify(_)) {
|
|
503
506
|
const m = new Set(n), l = new Set(_), g = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
|
|
504
|
-
C.forEach((
|
|
505
|
-
m.has(
|
|
506
|
-
}), n.forEach((
|
|
507
|
-
l.has(
|
|
508
|
-
}), n = _, g.forEach((
|
|
509
|
-
this._threadCommentModel.getComment(e, t,
|
|
507
|
+
C.forEach((h) => {
|
|
508
|
+
m.has(h) || g.add(h);
|
|
509
|
+
}), n.forEach((h) => {
|
|
510
|
+
l.has(h) || b.add(h);
|
|
511
|
+
}), n = _, g.forEach((h) => {
|
|
512
|
+
this._threadCommentModel.getComment(e, t, h) || this._threadCommentModel.addComment(e, t, { id: h, threadId: h, ref: "", dT: "", personId: "", text: { dataStream: "" }, unitId: e, subUnitId: t });
|
|
510
513
|
}), this._threadCommentModel.syncThreadComments(e, t, [...g]);
|
|
511
514
|
}
|
|
512
515
|
}
|
|
513
516
|
}));
|
|
514
517
|
}
|
|
515
518
|
};
|
|
516
|
-
k =
|
|
517
|
-
D(1,
|
|
518
|
-
D(2,
|
|
519
|
-
D(3,
|
|
519
|
+
k = Pt([
|
|
520
|
+
D(1, v(Fe)),
|
|
521
|
+
D(2, v(T)),
|
|
522
|
+
D(3, v(Ke)),
|
|
520
523
|
D(4, F),
|
|
521
|
-
D(5,
|
|
524
|
+
D(5, v(le)),
|
|
522
525
|
D(6, M)
|
|
523
526
|
], k);
|
|
524
|
-
var
|
|
525
|
-
for (var
|
|
526
|
-
(s = e[
|
|
527
|
-
return n &&
|
|
528
|
-
}, Q = (e, t) => (r, n) => t(r, n, e),
|
|
529
|
-
let j = class extends
|
|
527
|
+
var be = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, wt = (e, t, r) => t in e ? be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Nt = (e, t, r, n) => {
|
|
528
|
+
for (var i = n > 1 ? void 0 : n ? Et(t, r) : t, o = e.length - 1, s; o >= 0; o--)
|
|
529
|
+
(s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
|
|
530
|
+
return n && i && be(t, r, i), i;
|
|
531
|
+
}, Q = (e, t) => (r, n) => t(r, n, e), xe = (e, t, r) => wt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
532
|
+
let j = class extends we {
|
|
530
533
|
constructor(e = ne, t, r, n) {
|
|
531
534
|
super(), this._config = e, this._injector = t, this._renderManagerSrv = r, this._configService = n;
|
|
532
|
-
const { menu:
|
|
535
|
+
const { menu: i, ...o } = Ne(
|
|
533
536
|
{},
|
|
534
537
|
ne,
|
|
535
538
|
this._config
|
|
536
539
|
);
|
|
537
|
-
|
|
540
|
+
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(ct, o);
|
|
538
541
|
}
|
|
539
542
|
onStarting() {
|
|
540
543
|
[
|
|
@@ -554,17 +557,17 @@ let j = class extends Ee {
|
|
|
554
557
|
});
|
|
555
558
|
}
|
|
556
559
|
};
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
j =
|
|
560
|
-
|
|
561
|
-
Q(1,
|
|
560
|
+
xe(j, "pluginName", dt);
|
|
561
|
+
xe(j, "type", S.UNIVER_DOC);
|
|
562
|
+
j = Nt([
|
|
563
|
+
Ee(Ve),
|
|
564
|
+
Q(1, v(de)),
|
|
562
565
|
Q(2, L),
|
|
563
|
-
Q(3,
|
|
566
|
+
Q(3, Ae)
|
|
564
567
|
], j);
|
|
565
568
|
export {
|
|
566
569
|
ve as AddDocCommentComment,
|
|
567
|
-
|
|
570
|
+
ge as DeleteDocCommentComment,
|
|
568
571
|
A as ShowCommentPanelOperation,
|
|
569
572
|
q as StartAddCommentOperation,
|
|
570
573
|
j as UniverDocsThreadCommentUIPlugin
|
package/lib/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/thread-comment-ui"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/thread-comment-ui","@univerjs/docs","@univerjs/docs-ui","@univerjs/thread-comment","@univerjs/ui","rxjs","react"],o):(u=typeof globalThis<"u"?globalThis:u||self,o(u.UniverDocsThreadCommentUi={},u.UniverCore,u.UniverEngineRender,u.UniverThreadCommentUi,u.UniverDocs,u.UniverDocsUi,u.UniverThreadComment,u.UniverUi,u.rxjs,u.React))})(this,function(u,o,g,T,D,w,A,_,U,O){"use strict";var Ve=Object.defineProperty;var $e=(u,o,g)=>o in u?Ve(u,o,{enumerable:!0,configurable:!0,writable:!0,value:g}):u[o]=g;var Q=(u,o,g)=>$e(u,typeof o!="symbol"?o+"":o,g);const ae="DOC_THREAD_COMMENT_UI_PLUGIN",M="default_doc",ce="docs-thread-comment-ui.config",X={};var me=Object.defineProperty,ue=Object.getOwnPropertyDescriptor,le=(e,t,r,n)=>{for(var i=n>1?void 0:n?ue(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&me(t,r,i),i},k=(e,t)=>(r,n)=>t(r,n,e);let R=class extends o.Disposable{constructor(t,r){super();Q(this,"_addingComment$",new U.BehaviorSubject(void 0));Q(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)}};R=le([k(0,_.ISidebarService),k(1,o.Inject(T.ThreadCommentPanelService))],R);var W={exports:{}},N={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ee;function
|
|
10
|
-
`},startOffset:c.startOffset,endOffset:c.endOffset,collapsed:!0,threadId:y};return C==null||C.blurEditor(),a.startAdd(E),t.setActiveComment({unitId:p,subUnitId:v,commentId:y}),!0}};var _e=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,Se=(e,t,r,n)=>{for(var i=n>1?void 0:n?Ie(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&_e(t,r,i),i},x=(e,t)=>(r,n)=>t(r,n,e);let F=class extends o.Disposable{constructor(e,t,r,n,i,s){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=r,this._docThreadCommentService=n,this._renderManagerService=i,this._threadCommentModel=s,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var r,n,i,s;if(t.id===M.SetTextSelectionsOperation.id){const d=t.params,{unitId:a,ranges:m}=d,f=this._univerInstanceService.getUnit(a,o.UniverInstanceType.UNIVER_DOC),c=m[0];if((e==null?void 0:e.startOffset)===(c==null?void 0:c.startOffset)&&(e==null?void 0:e.endOffset)===(c==null?void 0:c.endOffset))return;if(e=c,c&&f){const{startOffset:C,endOffset:p,collapsed:_}=c;let u;if(_?u=(n=(r=f.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(v=>v.startIndex<=C&&v.endIndex>=p-1):u=(s=(i=f.getBody())==null?void 0:i.customDecorations)==null?void 0:s.find(v=>v.startIndex<=C&&v.endIndex>=p-1),u){const v=this._threadCommentModel.getComment(a,D,u.id);v&&!v.resolved&&this._commandService.executeCommand(V.id,{activeComment:{unitId:a,subUnitId:D,commentId:u.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(T.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t,r,n,i;if(e){const s=this._univerInstanceService.getUnit(e.unitId);if(s){const d=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with(j.DocBackScrollRenderController),a=(n=(r=s.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(m=>m.id===e.commentId);a&&d&&d.scrollToRange({startOffset:a.startIndex,endOffset:a.endIndex,collapsed:!1})}}(!e||e.commentId!==((i=this._docThreadCommentService.addingComment)==null?void 0:i.id))&&this._docThreadCommentService.endAdd()}))}};F=Se([x(0,o.Inject(T.ThreadCommentPanelService)),x(1,o.IUniverInstanceService),x(2,o.ICommandService),x(3,o.Inject(U)),x(4,g.IRenderManagerService),x(5,o.Inject(w.ThreadCommentModel))],F);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)},ge=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},re=O.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,s=e.extend,d=ge(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),m=O.useRef("_".concat(Me()));return ie(r,"".concat(n),{defIds:r.defIds,idSuffix:m.current},S({ref:t,className:a},d),s)});function ie(e,t,r,n,i){return O.createElement(e.tag,S(S({key:t},Oe(e,r,i)),n),(Te(e,r).children||[]).map(function(s,d){return ie(s,"".concat(t,"-").concat(e.tag,"-").concat(d),r,void 0,i)}))}function Oe(e,t,r){var n=S({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);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(s){var d=s[0],a=s[1];typeof a=="string"&&(n[d]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(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 Me(){return Math.random().toString(36).substring(2,8)}re.displayName="UniverIcon";var De={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"}}]},oe=O.forwardRef(function(e,t){return O.createElement(re,Object.assign({},e,{id:"comment-single",ref:t,icon:De}))});oe.displayName="CommentSingle";const ye={[I.RibbonStartGroup.OTHERS]:{[q.id]:{order:1,menuItemFactory:pe}},[I.ContextMenuPosition.MAIN_AREA]:{[I.ContextMenuGroup.DATA]:{[$.id]:{order:1,menuItemFactory:Ce}}}};var be=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Re=(e,t,r,n)=>{for(var i=n>1?void 0:n?Ue(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&be(t,r,i),i},G=(e,t)=>(r,n)=>t(r,n,e);let H=class extends o.Disposable{constructor(e,t,r){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=r,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[J,K,V,$,q].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(ye)}_initComponents(){[R].forEach(e=>{this.disposeWithMe(this._componentManager.register(e.componentKey,e))}),this.disposeWithMe(this._componentManager.register("CommentSingle",oe))}};H=Re([G(0,o.ICommandService),G(1,I.IMenuManagerService),G(2,o.Inject(I.ComponentManager))],H);var xe=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Ee=(e,t,r,n)=>{for(var i=n>1?void 0:n?Pe(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&xe(t,r,i),i},P=(e,t)=>(r,n)=>t(r,n,e);let Z=class extends o.Disposable{constructor(e,t,r,n,i,s,d){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=r,this._docRenderController=n,this._univerInstanceService=i,this._threadCommentModel=s,this._commandService=d,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(o.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(M.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,r)=>{if(!e)return r(e);const{unitId:n,index:i,customDecorations:s}=t,d=this._threadCommentPanelService.activeCommentId,{commentId:a,unitId:m}=d||{},f=s.find(_=>_.id===a),c=this._threadCommentModel.getComment(n,D,e.id);if(!c)return r({...e,show:!1});const C=f&&i>=f.startIndex&&i<=f.endIndex,p=m===n&&e.id===a;return r({...e,active:p||C,show:!c.resolved})}})}_initSyncComments(){var i,s,d;const e=this._context.unit.getUnitId(),t=D,r=(d=(s=(i=this._context.unit.getBody())==null?void 0:i.customDecorations)==null?void 0:s.filter(a=>a.type===o.CustomDecorationType.COMMENT).map(a=>a.id))!=null?d:[];r.forEach(a=>{this._threadCommentModel.getComment(e,t,a)||this._threadCommentModel.addComment(e,t,{id:a,threadId:a,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),r.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),D,r);let n=r.sort();this.disposeWithMe(this._commandService.onCommandExecuted(a=>{var m,f,c;if(a.id===M.RichTextEditingMutation.id){if(a.params.unitId!==this._context.unit.getUnitId())return;const p=(c=(f=(m=this._context.unit.getBody())==null?void 0:m.customDecorations)==null?void 0:f.filter(u=>u.type===o.CustomDecorationType.COMMENT).map(u=>u.id))!=null?c:[],_=p.sort();if(JSON.stringify(n)!==JSON.stringify(_)){const u=new Set(n),v=new Set(_),y=new Set,E=new Set;p.forEach(h=>{u.has(h)||y.add(h)}),n.forEach(h=>{v.has(h)||E.add(h)}),n=_,y.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,[...y])}}}))}};Z=Ee([P(1,o.Inject(M.DocInterceptorService)),P(2,o.Inject(T.ThreadCommentPanelService)),P(3,o.Inject(j.DocRenderController)),P(4,o.IUniverInstanceService),P(5,o.Inject(w.ThreadCommentModel)),P(6,o.ICommandService)],Z);var se=Object.defineProperty,je=Object.getOwnPropertyDescriptor,we=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ae=(e,t,r,n)=>{for(var i=n>1?void 0:n?je(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&se(t,r,i),i},z=(e,t)=>(r,n)=>t(r,n,e),de=(e,t,r)=>we(e,typeof t!="symbol"?t+"":t,r);l.UniverDocsThreadCommentUIPlugin=class extends o.Plugin{constructor(t=X,r,n,i){super(),this._config=t,this._injector=r,this._renderManagerSrv=n,this._configService=i;const{menu:s,...d}=o.merge({},X,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ce,d)}onStarting(){[[H],[F],[U]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(F),this._injector.get(H)}_initRenderModule(){[Z].forEach(t=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,t)})}},de(l.UniverDocsThreadCommentUIPlugin,"pluginName",ae),de(l.UniverDocsThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC),l.UniverDocsThreadCommentUIPlugin=Ae([o.DependentOn(T.UniverThreadCommentUIPlugin),z(1,o.Inject(o.Injector)),z(2,g.IRenderManagerService),z(3,o.IConfigService)],l.UniverDocsThreadCommentUIPlugin),l.AddDocCommentComment=J,l.DeleteDocCommentComment=K,l.ShowCommentPanelOperation=V,l.StartAddCommentOperation=$,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
*/var ee;function fe(){if(ee)return N;ee=1;var e=O,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(a,m,v){var c,h={},p=null,I=null;v!==void 0&&(p=""+v),m.key!==void 0&&(p=""+m.key),m.ref!==void 0&&(I=m.ref);for(c in m)n.call(m,c)&&!s.hasOwnProperty(c)&&(h[c]=m[c]);if(a&&a.defaultProps)for(c in m=a.defaultProps,m)h[c]===void 0&&(h[c]=m[c]);return{$$typeof:t,type:a,key:p,ref:I,props:h,_owner:i.current}}return N.Fragment=r,N.jsx=d,N.jsxs=d,N}var te;function ve(){return te||(te=1,W.exports=fe()),W.exports}var he=ve();const J={id:"docs.command.add-comment",type:o.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{comment:r,unitId:n}=t,s=await e.get(A.IThreadCommentDataSourceService).addComment(r),d=e.get(o.ICommandService),a=w.addCustomDecorationBySelectionFactory(e,{id:s.threadId,type:o.CustomDecorationType.COMMENT,unitId:n});if(a){const m={id:A.AddCommentMutation.id,params:{unitId:n,subUnitId:M,comment:s}},v={id:T.SetActiveCommentOperation.id,params:{unitId:n,subUnitId:M,commentId:s.id}};return(await o.sequenceExecute([m,a,v],d)).result}return!1}},K={id:"docs.command.delete-comment",type:o.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{commentId:r,unitId:n}=t,i=e.get(o.ICommandService),s=w.deleteCustomDecorationFactory(e,{id:r,unitId:n});return s?(await o.sequenceExecute([s],i)).result:!1}},ne=e=>{const t=e.get(g.IRenderManagerService),r=e.get(D.DocSelectionManagerService),n=t.getCurrent(),i=n==null?void 0:n.with(D.DocSkeletonManagerService).getSkeleton(),s=i==null?void 0:i.getViewModel().getEditArea();if(s===g.DocumentEditArea.FOOTER||s===g.DocumentEditArea.HEADER)return!0;const d=r.getActiveTextRange();return!!(d==null||d.collapsed)};function Ce(e){return{id:$.id,type:_.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:_.getMenuHiddenObservable(e,o.UniverInstanceType.UNIVER_DOC,void 0,o.SHEET_EDITOR_UNITS),disabled$:new U.Observable(function(t){const n=e.get(D.DocSelectionManagerService).textSelection$.pipe(U.debounceTime(16)).subscribe(()=>{t.next(ne(e))});return()=>{n.unsubscribe()}})}}function pe(e){return{id:q.id,type:_.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:_.getMenuHiddenObservable(e,o.UniverInstanceType.UNIVER_DOC)}}const P=()=>{const e=o.useDependency(o.IUniverInstanceService),t=o.useDependency(o.Injector),r=O.useMemo(()=>e.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_DOC).pipe(U.filter(l=>!!l&&!o.isInternalEditorID(l.getUnitId()))),[e]),n=o.useObservable(r),i=O.useMemo(()=>new U.Observable(l=>l.next(M)),[]),s=o.useDependency(D.DocSelectionManagerService),d=O.useMemo(()=>s.textSelection$.pipe(U.debounceTime(16)),[s.textSelection$]);o.useObservable(d);const a=o.useDependency(o.ICommandService),m=o.useDependency(R),v=o.useObservable(m.addingComment$),[c,h]=O.useState([]);if(O.useEffect(()=>{var j;const l=new Set,f=n==null?void 0:n.getCustomDecorations();h((j=f==null?void 0:f.map(C=>C.id).filter(C=>{const b=l.has(C);return l.add(C),!b}))!=null?j:[]);const y=a.onCommandExecuted(C=>{var b;if(C.id===D.RichTextEditingMutation.id){const B=new Set,Y=n==null?void 0:n.getCustomDecorations();h((b=Y==null?void 0:Y.map(L=>L.id).filter(L=>{const Ne=B.has(L);return B.add(L),!Ne}))!=null?b:[])}});return()=>{y.dispose()}},[a,n]),!n)return null;const p=ne(t),I=n.getUnitId();return he.jsx(T.ThreadCommentPanel,{unitId:I,subUnitId$:i,type:o.UniverInstanceType.UNIVER_DOC,onAdd:()=>{a.executeCommand($.id)},getSubUnitName:()=>"",disableAdd:p,tempComment:v,onAddComment:l=>{if(!l.parentId){const f={unitId:I,range:v,comment:l};return a.executeCommand(J.id,f),m.endAdd(),!1}return!0},onDeleteComment:l=>{if(!l.parentId){const f={unitId:I,commentId:l.id};return a.executeCommand(K.id,f),!1}return!0},showComments:c})};P.componentKey="univer.doc.thread-comment-panel";const V={id:"docs.operation.show-comment-panel",type:o.CommandType.OPERATION,handler(e,t){var i;const r=e.get(T.ThreadCommentPanelService),n=e.get(_.ISidebarService);return(!r.panelVisible||((i=n.options.children)==null?void 0:i.label)!==P.componentKey)&&(n.open({header:{title:"threadCommentUI.panel.title"},children:{label:P.componentKey},width:320,onClose:()=>r.setPanelVisible(!1)}),r.setPanelVisible(!0)),t&&r.setActiveComment(t==null?void 0:t.activeComment),!0}},q={id:"docs.operation.toggle-comment-panel",type:o.CommandType.OPERATION,handler(e){var n;const t=e.get(T.ThreadCommentPanelService),r=e.get(_.ISidebarService);return!t.panelVisible||((n=r.options.children)==null?void 0:n.label)!==P.componentKey?(r.open({header:{title:"threadCommentUI.panel.title"},children:{label:P.componentKey},width:320,onClose:()=>t.setPanelVisible(!1)}),t.setPanelVisible(!0)):(r.close(),t.setPanelVisible(!1),t.setActiveComment(null)),!0}},$={id:"docs.operation.start-add-comment",type:o.CommandType.OPERATION,handler(e){var C,b,B;const t=e.get(T.ThreadCommentPanelService),n=e.get(o.IUniverInstanceService).getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC),i=e.get(D.DocSelectionManagerService),s=e.get(g.IRenderManagerService),d=e.get(o.UserManagerService),a=e.get(R),m=e.get(o.ICommandService),v=e.get(_.ISidebarService),c=i.getActiveTextRange();if(!n||!c)return!1;const h=(C=s.getRenderById(n.getUnitId()))==null?void 0:C.with(w.DocSelectionRenderService);if(h==null||h.setReserveRangesStatus(!0),c.collapsed)return t.panelVisible?(t.setPanelVisible(!1),v.close()):m.executeCommand(V.id),!0;m.executeCommand(V.id);const p=n.getUnitId(),I=((B=(b=n.getBody())==null?void 0:b.dataStream)!=null?B:"").slice(c.startOffset,c.endOffset),l=o.BuildTextUtils.transform.getPlainText(I),f=M,y="",j={unitId:p,subUnitId:f,id:y,ref:l,dT:A.getDT(),personId:d.getCurrentUser().userID,text:{dataStream:`\r
|
|
10
|
+
`},startOffset:c.startOffset,endOffset:c.endOffset,collapsed:!0,threadId:y};return h==null||h.blur(),a.startAdd(j),t.setActiveComment({unitId:p,subUnitId:f,commentId:y}),!0}};var Ie=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,Se=(e,t,r,n)=>{for(var i=n>1?void 0:n?_e(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&Ie(t,r,i),i},x=(e,t)=>(r,n)=>t(r,n,e);let F=class extends o.Disposable{constructor(e,t,r,n,i,s){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=r,this._docThreadCommentService=n,this._renderManagerService=i,this._threadCommentModel=s,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var r,n,i,s;if(t.id===D.SetTextSelectionsOperation.id){const d=t.params,{unitId:a,ranges:m}=d;if(o.isInternalEditorID(a))return;const v=this._univerInstanceService.getUnit(a,o.UniverInstanceType.UNIVER_DOC),c=m[0];if((e==null?void 0:e.startOffset)===(c==null?void 0:c.startOffset)&&(e==null?void 0:e.endOffset)===(c==null?void 0:c.endOffset))return;if(e=c,c&&v){const{startOffset:h,endOffset:p,collapsed:I}=c;let l;if(I?l=(n=(r=v.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(f=>f.startIndex<=h&&f.endIndex>=p-1):l=(s=(i=v.getBody())==null?void 0:i.customDecorations)==null?void 0:s.find(f=>f.startIndex<=h&&f.endIndex>=p-1),l){const f=this._threadCommentModel.getComment(a,M,l.id);f&&!f.resolved&&this._commandService.executeCommand(V.id,{activeComment:{unitId:a,subUnitId:M,commentId:l.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(T.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t,r,n,i;if(e){const s=this._univerInstanceService.getUnit(e.unitId);if(s){const d=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with(w.DocBackScrollRenderController),a=(n=(r=s.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(m=>m.id===e.commentId);a&&d&&d.scrollToRange({startOffset:a.startIndex,endOffset:a.endIndex,collapsed:!1})}}(!e||e.commentId!==((i=this._docThreadCommentService.addingComment)==null?void 0:i.id))&&this._docThreadCommentService.endAdd()}))}};F=Se([x(0,o.Inject(T.ThreadCommentPanelService)),x(1,o.IUniverInstanceService),x(2,o.ICommandService),x(3,o.Inject(R)),x(4,g.IRenderManagerService),x(5,o.Inject(A.ThreadCommentModel))],F);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)},ge=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},re=O.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,s=e.extend,d=ge(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),m=O.useRef("_".concat(De()));return ie(r,"".concat(n),{defIds:r.defIds,idSuffix:m.current},S({ref:t,className:a},d),s)});function ie(e,t,r,n,i){return O.createElement(e.tag,S(S({key:t},Oe(e,r,i)),n),(Te(e,r).children||[]).map(function(s,d){return ie(s,"".concat(t,"-").concat(e.tag,"-").concat(d),r,void 0,i)}))}function Oe(e,t,r){var n=S({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);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(s){var d=s[0],a=s[1];typeof a=="string"&&(n[d]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(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 De(){return Math.random().toString(36).substring(2,8)}re.displayName="UniverIcon";var Me={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"}}]},oe=O.forwardRef(function(e,t){return O.createElement(re,Object.assign({},e,{id:"comment-single",ref:t,icon:Me}))});oe.displayName="CommentSingle";const ye={[_.RibbonStartGroup.OTHERS]:{[q.id]:{order:1,menuItemFactory:pe}},[_.ContextMenuPosition.MAIN_AREA]:{[_.ContextMenuGroup.DATA]:{[$.id]:{order:1,menuItemFactory:Ce}}}};var be=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Re=(e,t,r,n)=>{for(var i=n>1?void 0:n?Ue(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&be(t,r,i),i},G=(e,t)=>(r,n)=>t(r,n,e);let H=class extends o.Disposable{constructor(e,t,r){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=r,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[J,K,V,$,q].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(ye)}_initComponents(){[P].forEach(e=>{this.disposeWithMe(this._componentManager.register(e.componentKey,e))}),this.disposeWithMe(this._componentManager.register("CommentSingle",oe))}};H=Re([G(0,o.ICommandService),G(1,_.IMenuManagerService),G(2,o.Inject(_.ComponentManager))],H);var Pe=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Ee=(e,t,r,n)=>{for(var i=n>1?void 0:n?xe(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&Pe(t,r,i),i},E=(e,t)=>(r,n)=>t(r,n,e);let Z=class extends o.Disposable{constructor(e,t,r,n,i,s,d){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=r,this._docRenderController=n,this._univerInstanceService=i,this._threadCommentModel=s,this._commandService=d,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(o.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(D.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,r)=>{if(!e)return r(e);const{unitId:n,index:i,customDecorations:s}=t,d=this._threadCommentPanelService.activeCommentId,{commentId:a,unitId:m}=d||{},v=s.find(I=>I.id===a),c=this._threadCommentModel.getComment(n,M,e.id);if(!c)return r({...e,show:!1});const h=v&&i>=v.startIndex&&i<=v.endIndex,p=m===n&&e.id===a;return r({...e,active:p||h,show:!c.resolved})}})}_initSyncComments(){var i,s,d;const e=this._context.unit.getUnitId(),t=M,r=(d=(s=(i=this._context.unit.getBody())==null?void 0:i.customDecorations)==null?void 0:s.filter(a=>a.type===o.CustomDecorationType.COMMENT).map(a=>a.id))!=null?d:[];r.forEach(a=>{this._threadCommentModel.getComment(e,t,a)||this._threadCommentModel.addComment(e,t,{id:a,threadId:a,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(a=>{var m,v,c;if(a.id===D.RichTextEditingMutation.id){if(a.params.unitId!==this._context.unit.getUnitId())return;const p=(c=(v=(m=this._context.unit.getBody())==null?void 0:m.customDecorations)==null?void 0:v.filter(l=>l.type===o.CustomDecorationType.COMMENT).map(l=>l.id))!=null?c:[],I=p.sort();if(JSON.stringify(n)!==JSON.stringify(I)){const l=new Set(n),f=new Set(I),y=new Set,j=new Set;p.forEach(C=>{l.has(C)||y.add(C)}),n.forEach(C=>{f.has(C)||j.add(C)}),n=I,y.forEach(C=>{this._threadCommentModel.getComment(e,t,C)||this._threadCommentModel.addComment(e,t,{id:C,threadId:C,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),this._threadCommentModel.syncThreadComments(e,t,[...y])}}}))}};Z=Ee([E(1,o.Inject(D.DocInterceptorService)),E(2,o.Inject(T.ThreadCommentPanelService)),E(3,o.Inject(w.DocRenderController)),E(4,o.IUniverInstanceService),E(5,o.Inject(A.ThreadCommentModel)),E(6,o.ICommandService)],Z);var se=Object.defineProperty,je=Object.getOwnPropertyDescriptor,we=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ae=(e,t,r,n)=>{for(var i=n>1?void 0:n?je(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&se(t,r,i),i},z=(e,t)=>(r,n)=>t(r,n,e),de=(e,t,r)=>we(e,typeof t!="symbol"?t+"":t,r);u.UniverDocsThreadCommentUIPlugin=class extends o.Plugin{constructor(t=X,r,n,i){super(),this._config=t,this._injector=r,this._renderManagerSrv=n,this._configService=i;const{menu:s,...d}=o.merge({},X,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ce,d)}onStarting(){[[H],[F],[R]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(F),this._injector.get(H)}_initRenderModule(){[Z].forEach(t=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,t)})}},de(u.UniverDocsThreadCommentUIPlugin,"pluginName",ae),de(u.UniverDocsThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC),u.UniverDocsThreadCommentUIPlugin=Ae([o.DependentOn(T.UniverThreadCommentUIPlugin),z(1,o.Inject(o.Injector)),z(2,g.IRenderManagerService),z(3,o.IConfigService)],u.UniverDocsThreadCommentUIPlugin),u.AddDocCommentComment=J,u.DeleteDocCommentComment=K,u.ShowCommentPanelOperation=V,u.StartAddCommentOperation=$,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs-thread-comment-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4-nightly.202501131606",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer thread comment plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -47,24 +47,25 @@
|
|
|
47
47
|
"rxjs": ">=7.0.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@univerjs/icons": "^0.2.
|
|
50
|
+
"@univerjs/icons": "^0.2.12",
|
|
51
51
|
"clsx": "^2.1.1",
|
|
52
|
-
"@univerjs/core": "0.5.
|
|
53
|
-
"@univerjs/docs": "0.5.
|
|
54
|
-
"@univerjs/docs-ui": "0.5.
|
|
55
|
-
"@univerjs/
|
|
56
|
-
"@univerjs/thread-comment
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/
|
|
52
|
+
"@univerjs/core": "0.5.4-nightly.202501131606",
|
|
53
|
+
"@univerjs/docs": "0.5.4-nightly.202501131606",
|
|
54
|
+
"@univerjs/docs-ui": "0.5.4-nightly.202501131606",
|
|
55
|
+
"@univerjs/thread-comment-ui": "0.5.4-nightly.202501131606",
|
|
56
|
+
"@univerjs/thread-comment": "0.5.4-nightly.202501131606",
|
|
57
|
+
"@univerjs/ui": "0.5.4-nightly.202501131606",
|
|
58
|
+
"@univerjs/engine-render": "0.5.4-nightly.202501131606"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"postcss": "^8.4.49",
|
|
62
62
|
"react": "18.3.1",
|
|
63
63
|
"rxjs": "^7.8.1",
|
|
64
|
+
"tailwindcss": "^3.4.17",
|
|
64
65
|
"typescript": "^5.7.2",
|
|
65
|
-
"vite": "^6.0.
|
|
66
|
+
"vite": "^6.0.7",
|
|
66
67
|
"vitest": "^2.1.8",
|
|
67
|
-
"@univerjs-infra/shared": "0.5.
|
|
68
|
+
"@univerjs-infra/shared": "0.5.4"
|
|
68
69
|
},
|
|
69
70
|
"scripts": {
|
|
70
71
|
"test": "vitest run",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|