@univerjs/docs-hyper-link-ui 0.5.5-nightly.202501211606 → 0.5.5-nightly.202501221606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,9 +1 @@
1
- "use strict";var Pe=Object.defineProperty;var Re=(n,e,t)=>e in n?Pe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var P=(n,e,t)=>Re(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),Ee=require("@univerjs/docs-hyper-link"),De=require("@univerjs/engine-render"),C=require("@univerjs/docs"),K=require("@univerjs/docs-ui"),R=require("rxjs"),m=require("react"),S=require("@univerjs/design"),_=require("@univerjs/ui"),be="docs-hyper-link-ui.config",ae={};var V={exports:{}},D={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var le;function Me(){if(le)return D;le=1;var n=m,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function c(d,a,f){var u,v={},g=null,l=null;f!==void 0&&(g=""+f),a.key!==void 0&&(g=""+a.key),a.ref!==void 0&&(l=a.ref);for(u in a)i.call(a,u)&&!s.hasOwnProperty(u)&&(v[u]=a[u]);if(d&&d.defaultProps)for(u in a=d.defaultProps,a)v[u]===void 0&&(v[u]=a[u]);return{$$typeof:e,type:d,key:g,ref:l,props:v,_owner:r.current}}return D.Fragment=t,D.jsx=c,D.jsxs=c,D}var ue;function Ue(){return ue||(ue=1,V.exports=Me()),V.exports}var p=Ue();const ge={type:o.CommandType.COMMAND,id:"docs.command.add-hyper-link",async handler(n,e){if(!e)return!1;const{payload:t,unitId:i,selections:r}=e,s=n.get(o.ICommandService),c=o.generateRandomId(),d=C.addCustomRangeBySelectionFactory(n,{rangeId:c,rangeType:o.CustomRangeType.HYPERLINK,properties:{url:t},unitId:i,selections:r});return d?s.syncExecuteCommand(d.id,d.params):!1}},he={id:"docs.command.update-hyper-link",type:o.CommandType.COMMAND,handler(n,e){var I;if(!e)return!1;const{unitId:t,payload:i,segmentId:r,linkId:s}=e,c=n.get(o.ICommandService),d=n.get(o.IUniverInstanceService),f=n.get(C.DocSelectionManagerService).getActiveTextRange(),u=d.getUnit(t,o.UniverInstanceType.UNIVER_DOC);if(!f||!u)return!1;const g=(I=o.getBodySlice(u.getSelfOrHeaderFooterModel(r).getBody(),f.startOffset,f.endOffset).textRuns)==null?void 0:I[0];g&&(g.ed=e.label.length+1);const l=C.replaceSelectionFactory(n,{unitId:t,body:{dataStream:`${e.label}`,customRanges:[{rangeId:s,rangeType:o.CustomRangeType.HYPERLINK,startIndex:0,endIndex:e.label.length+1,properties:{url:i}}],textRuns:g?[g]:void 0},selection:{startOffset:f.startOffset,endOffset:f.endOffset,collapsed:!1,segmentId:r}});return l?c.syncExecuteCommand(l.id,l.params):!1}},we="univer-docs-link-edit",Te="univer-docs-link-edit-title",je="univer-docs-link-edit-close",Ne="univer-docs-link-edit-buttons",$e="univer-docs-link-edit-button",j={docsLinkEdit:we,docsLinkEditTitle:Te,docsLinkEditClose:je,docsLinkEditButtons:Ne,docsLinkEditButton:$e};function He(n){return/^[a-zA-Z]+:\/\//.test(n)}function Be(n){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(n)}function Ae(n){return He(n)?n:Be(n)?`mailto://${n}`:`https://${n}`}const $=()=>{const n=o.useDependency(k),e=o.useDependency(o.LocaleService),t=o.useObservable(n.editingLink$),i=o.useDependency(o.ICommandService),r=o.useDependency(o.IUniverInstanceService),s=o.useDependency(C.DocSelectionManagerService),[c,d]=m.useState(""),[a,f]=m.useState(""),[u,v]=m.useState(!1),g=o.Tools.isLegalUrl(c),l=t?r.getUnit(t.unitId,o.UniverInstanceType.UNIVER_DOC):r.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC);m.useEffect(()=>{var ee,ne,te,ie,re,oe,se,ce,de;const h=s.getActiveTextRange();if(!h)return;if(t){const w=(ee=l==null?void 0:l.getSelfOrHeaderFooterModel(t.segmentId))==null?void 0:ee.getBody(),T=(ne=w==null?void 0:w.customRanges)==null?void 0:ne.find(F=>(t==null?void 0:t.linkId)===F.rangeId&&F.startIndex===t.startIndex&&F.endIndex===t.endIndex);l&&T&&(d((ie=(te=T.properties)==null?void 0:te.url)!=null?ie:""),f(o.BuildTextUtils.transform.getPlainText(o.getBodySlice(w,T.startIndex,T.endIndex+1).dataStream)));return}const x=(re=l==null?void 0:l.getSelfOrHeaderFooterModel(h.segmentId))==null?void 0:re.getBody(),X=x?h:null,U=X&&((se=o.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(X,(oe=x==null?void 0:x.customRanges)!=null?oe:[]))==null?void 0:se[0]);l&&U&&d((de=(ce=U==null?void 0:U.properties)==null?void 0:ce.url)!=null?de:"")},[l,t,s,r]);const I=()=>{n.hideEditPopup()},L=()=>{if(v(!0),!g||!l)return;const h=Ae(c);if(!t)i.executeCommand(ge.id,{unitId:l.getUnitId(),payload:h});else{if(!a)return;i.executeCommand(he.id,{unitId:l.getUnitId(),payload:h,linkId:t.linkId,label:a,segmentId:t.segmentId})}n.hideEditPopup()};if(l)return p.jsxs("div",{className:j.docsLinkEdit,children:[p.jsxs("div",{children:[t?p.jsx(S.FormLayout,{label:e.t("docLink.edit.label"),error:u&&!a?e.t("docLink.edit.labelError"):"",children:p.jsx(S.Input,{value:a,onChange:f,autoFocus:!0,onKeyDown:h=>{h.keyCode===_.KeyCode.ENTER&&L()}})}):null,p.jsx(S.FormLayout,{label:e.t("docLink.edit.address"),error:u&&!g?e.t("docLink.edit.addressError"):"",children:p.jsx(S.Input,{value:c,onChange:d,autoFocus:!0,onKeyDown:h=>{h.keyCode===_.KeyCode.ENTER&&L()}})})]}),p.jsxs("div",{className:j.docsLinkEditButtons,children:[p.jsx(S.Button,{className:j.docsLinkEditButton,onClick:I,children:e.t("docLink.edit.cancel")}),p.jsx(S.Button,{disabled:!c,className:j.docsLinkEditButton,type:"primary",onClick:L,children:e.t("docLink.edit.confirm")})]})]})};$.componentKey="docs-hyper-link-edit";var y=function(){return y=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},y.apply(this,arguments)},Ke=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t},M=m.forwardRef(function(n,e){var t=n.icon,i=n.id,r=n.className,s=n.extend,c=Ke(n,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(i," ").concat(r||"").trim(),a=m.useRef("_".concat(qe()));return ve(t,"".concat(i),{defIds:t.defIds,idSuffix:a.current},y({ref:e,className:d},c),s)});function ve(n,e,t,i,r){return m.createElement(n.tag,y(y({key:e},Fe(n,t,r)),i),(Ve(n,t).children||[]).map(function(s,c){return ve(s,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,r)}))}function Fe(n,e,t){var i=y({},n.attrs);t!=null&&t.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(n.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+e.idSuffix),Object.entries(i).forEach(function(s){var c=s[0],d=s[1];typeof d=="string"&&(i[c]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),i}function Ve(n,e){var t,i=e.defIds;return!i||i.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?y(y({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&i&&i.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):n}function qe(){return Math.random().toString(36).substring(2,8)}M.displayName="UniverIcon";var Ye={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=m.forwardRef(function(n,e){return m.createElement(M,Object.assign({},n,{id:"copy-single",ref:e,icon:Ye}))});Ie.displayName="CopySingle";var Ze={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z"}}]},Q=m.forwardRef(function(n,e){return m.createElement(M,Object.assign({},n,{id:"link-single",ref:e,icon:Ze}))});Q.displayName="LinkSingle";var We={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},me=m.forwardRef(function(n,e){return m.createElement(M,Object.assign({},n,{id:"unlink-single",ref:e,icon:We}))});me.displayName="UnlinkSingle";var Ge={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},_e=m.forwardRef(function(n,e){return m.createElement(M,Object.assign({},n,{id:"write-single",ref:e,icon:Ge}))});_e.displayName="WriteSingle";function Ce(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=Ce(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function pe(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=Ce(n))&&(i&&(i+=" "),i+=e);return i}const ye={type:o.CommandType.COMMAND,id:"docs.command.delete-hyper-link",async handler(n,e){if(!e)return!1;const{unitId:t,linkId:i,segmentId:r}=e,s=n.get(o.ICommandService),c=C.deleteCustomRangeFactory(n,{unitId:t,rangeId:i,segmentId:r});return c?await s.syncExecuteCommand(c.id,c.params):!1}},Se=n=>{const e=n.get(C.DocSelectionManagerService),t=n.get(o.IUniverInstanceService),i=e.getTextRanges();if(!(i!=null&&i.length))return!0;const r=i[0];return!!(!t.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC)||!r||r.collapsed)},E={type:o.CommandType.OPERATION,id:"doc.operation.show-hyper-link-edit-popup",handler(n,e){var c;const t=e==null?void 0:e.link,i=n.get(o.IUniverInstanceService);if(Se(n)&&!t)return!1;const r=n.get(k),s=(t==null?void 0:t.unitId)||((c=i.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC))==null?void 0:c.getUnitId());return s?(r.showEditPopup(s,t),!0):!1}},G={type:o.CommandType.OPERATION,id:"doc.operation.toggle-hyper-link-info-popup",handler(n,e){const t=n.get(k);return e?(t.showInfoPopup(e),!0):(t.hideInfoPopup(),!0)}},Le={type:o.CommandType.OPERATION,id:"doc.operation.click-hyper-link",handler(n,e){var f,u,v;if(!e)return!1;const{unitId:t,linkId:i,segmentId:r}=e,c=n.get(o.IUniverInstanceService).getUnit(t,o.UniverInstanceType.UNIVER_DOC),d=c==null?void 0:c.getSelfOrHeaderFooterModel(r).getBody(),a=(v=(u=(f=d==null?void 0:d.customRanges)==null?void 0:f.find(g=>g.rangeId===i&&g.rangeType===o.CustomRangeType.HYPERLINK))==null?void 0:u.properties)==null?void 0:v.url;return a&&window.open(a,"_blank","noopener noreferrer"),!0}},Je="univer-doc-link",ze="univer-doc-link-type",Qe="univer-doc-link-content",Xe="univer-doc-link-content-error",en="univer-doc-link-url",nn="univer-doc-link-operations",tn="univer-doc-link-operation",rn="univer-doc-link-operation-error",O={docLink:Je,docLinkType:ze,docLinkContent:Qe,docLinkContentError:Xe,docLinkUrl:en,docLinkOperations:nn,docLinkOperation:tn,docLinkOperationError:rn},H=()=>{var L,h;const n=o.useDependency(k),e=o.useDependency(o.ICommandService),t=o.useDependency(_.IMessageService),i=o.useDependency(o.LocaleService),r=_.useObservable(n.showingLink$),s=o.useDependency(o.IUniverInstanceService);if(!r)return null;const{unitId:c,linkId:d,segmentId:a,startIndex:f,endIndex:u}=r,v=s.getUnit(c,o.UniverInstanceType.UNIVER_DOC),g=v==null?void 0:v.getSelfOrHeaderFooterModel(a).getBody(),l=(L=g==null?void 0:g.customRanges)==null?void 0:L.find(x=>x.rangeId===d&&x.rangeType===o.CustomRangeType.HYPERLINK&&x.startIndex===f&&x.endIndex===u);if(!l)return null;const I=(h=l.properties)==null?void 0:h.url;return p.jsxs("div",{className:O.docLink,onClick:()=>{n.hideInfoPopup()},children:[p.jsxs("div",{className:pe(O.docLinkContent),onClick:()=>window.open(I),children:[p.jsx("div",{className:O.docLinkType,children:p.jsx(Q,{})}),p.jsx(S.Tooltip,{showIfEllipsis:!0,title:I,children:p.jsx("span",{className:O.docLinkUrl,children:I})})]}),p.jsxs("div",{className:O.docLinkOperations,children:[p.jsx("div",{className:pe(O.docLinkOperation),onClick:()=>{navigator.clipboard.writeText(I),t.show({content:i.t("docLink.info.coped"),type:S.MessageType.Info})},children:p.jsx(S.Tooltip,{placement:"bottom",title:i.t("docLink.info.copy"),children:p.jsx(Ie,{})})}),p.jsx("div",{className:O.docLinkOperation,onClick:()=>{e.executeCommand(E.id,{link:r})},children:p.jsx(S.Tooltip,{placement:"bottom",title:i.t("docLink.info.edit"),children:p.jsx(_e,{})})}),p.jsx("div",{className:O.docLinkOperation,onClick:()=>{e.executeCommand(ye.id,{unitId:c,linkId:l.rangeId,segmentId:a})},children:p.jsx(S.Tooltip,{placement:"bottom",title:i.t("docLink.info.cancel"),children:p.jsx(me,{})})})]})]})};H.componentKey="univer.doc.link-info-popup";var on=Object.defineProperty,sn=Object.getOwnPropertyDescriptor,cn=(n,e,t,i)=>{for(var r=i>1?void 0:i?sn(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&on(e,t,r),r},q=(n,e)=>(t,i)=>e(t,i,n);let k=class extends o.Disposable{constructor(e,t,i){super();P(this,"_editingLink$",new R.BehaviorSubject(null));P(this,"_showingLink$",new R.BehaviorSubject(null));P(this,"editingLink$",this._editingLink$.asObservable());P(this,"showingLink$",this._showingLink$.asObservable());P(this,"_editPopup",null);P(this,"_infoPopup",null);this._docCanvasPopupManagerService=e,this._textSelectionManagerService=t,this._univerInstanceService=i,this.disposeWithMe(()=>{this._editingLink$.complete(),this._showingLink$.complete()})}get editing(){return this._editingLink$.value}get showing(){return this._showingLink$.value}showEditPopup(e,t){this._editPopup&&this._editPopup.dispose(),this._editingLink$.next(t);const i=this._textSelectionManagerService.getTextRanges({unitId:e,subUnitId:e});let r=i==null?void 0:i[i.length-1];if(t){const{segmentId:s,segmentPage:c,startIndex:d,endIndex:a}=t;r={collapsed:!1,startOffset:d,endOffset:a+1,segmentId:s,segmentPage:c},this._textSelectionManagerService.replaceDocRanges([{startOffset:d,endOffset:a+1}])}return r?(this._editPopup=this._docCanvasPopupManagerService.attachPopupToRange(r,{componentKey:$.componentKey,direction:"bottom"},e),this._editPopup):null}hideEditPopup(){var e;this._editingLink$.next(null),(e=this._editPopup)==null||e.dispose()}showInfoPopup(e){var f,u,v,g,l,I;const{linkId:t,unitId:i,segmentId:r,segmentPage:s,startIndex:c,endIndex:d}=e;if(!(((f=this.showing)==null?void 0:f.linkId)===t&&((u=this.showing)==null?void 0:u.unitId)===i&&((v=this.showing)==null?void 0:v.segmentId)===r&&((g=this.showing)==null?void 0:g.segmentPage)===s&&((l=this.showing)==null?void 0:l.startIndex)===c&&((I=this.showing)==null?void 0:I.endIndex)===d||(this._infoPopup&&this._infoPopup.dispose(),!this._univerInstanceService.getUnit(i,o.UniverInstanceType.UNIVER_DOC))))return this._showingLink$.next({unitId:i,linkId:t,segmentId:r,segmentPage:s,startIndex:c,endIndex:d}),this._infoPopup=this._docCanvasPopupManagerService.attachPopupToRange({collapsed:!1,startOffset:c,endOffset:d+1,segmentId:r,segmentPage:s},{componentKey:H.componentKey,direction:"top-center",multipleDirection:"top",onClickOutside:()=>{this.hideInfoPopup()}},i),this._infoPopup}hideInfoPopup(){var e;this._showingLink$.next(null),(e=this._infoPopup)==null||e.dispose()}};k=cn([q(0,o.Inject(K.DocCanvasPopManagerService)),q(1,o.Inject(C.DocSelectionManagerService)),q(2,o.IUniverInstanceService)],k);var dn=Object.defineProperty,an=Object.getOwnPropertyDescriptor,ln=(n,e,t,i)=>{for(var r=i>1?void 0:i?an(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&dn(e,t,r),r},Y=(n,e)=>(t,i)=>e(t,i,n);let B=class extends o.Disposable{constructor(n,e,t){super(),this._commandService=n,this._univerInstanceService=e,this._docHyperLinkService=t,this._initSelectionChange()}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(n=>{var e,t,i;if(n.id===C.SetTextSelectionsOperation.id){const r=n.params,{unitId:s,ranges:c,segmentId:d}=r,a=this._univerInstanceService.getUnit(s,o.UniverInstanceType.UNIVER_DOC),f=c[0];if(f&&a){const{startOffset:u,endOffset:v,collapsed:g,segmentPage:l}=f,I=(t=(e=a.getSelfOrHeaderFooterModel(d))==null?void 0:e.getBody())==null?void 0:t.customRanges;if(g){const L=(i=I==null?void 0:I.findIndex(h=>h.startIndex<u&&h.endIndex>v-1))!=null?i:-1;if(L>-1){const h=I[L];this._docHyperLinkService.showInfoPopup({unitId:s,linkId:h.rangeId,segmentId:d,segmentPage:l,startIndex:h.startIndex,endIndex:h.endIndex});return}}else if(I==null?void 0:I.find(h=>h.startIndex<=u&&h.endIndex>=v-1))return}this._docHyperLinkService.hideInfoPopup(),this._docHyperLinkService.hideEditPopup()}}))}};B=ln([Y(0,o.ICommandService),Y(1,o.IUniverInstanceService),Y(2,o.Inject(k))],B);var un=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,fn=(n,e,t,i)=>{for(var r=i>1?void 0:i?pn(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&un(e,t,r),r},b=(n,e)=>(t,i)=>e(t,i,n);let J=class extends o.Disposable{constructor(n,e,t,i,r,s){super(),this._context=n,this._docEventManagerService=e,this._commandService=t,this._hyperLinkPopupService=i,this._docSkeletonManagerService=r,this._docSelectionManagerService=s,!(this._context.unitId===o.DOCS_ZEN_EDITOR_UNIT_ID_KEY||this._context.unitId===o.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)&&(this._initHover(),this._initClick())}get _skeleton(){return this._docSkeletonManagerService.getSkeleton()}_hideInfoPopup(){this._hyperLinkPopupService.showing&&this._commandService.executeCommand(G.id)}_initHover(){this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe(n=>{var r;const e=n.find(s=>s.range.rangeType===o.CustomRangeType.HYPERLINK),t=this._docSelectionManagerService.getTextRanges(),i=t==null?void 0:t[0].segmentId;if(((r=e==null?void 0:e.segmentId)!=null?r:"")!==i){this._hideInfoPopup();return}e?this._commandService.executeCommand(G.id,{unitId:this._context.unitId,linkId:e.range.rangeId,segmentId:e.segmentId,segmentPage:e.segmentPageIndex,rangeId:e.range.rangeId,startIndex:e.range.startIndex,endIndex:e.range.endIndex}):this._hideInfoPopup()}))}_initClick(){this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe(n=>{const e=n.range;e&&this._commandService.executeCommand(Le.id,{unitId:this._context.unitId,linkId:e.rangeId,segmentId:n.segmentId})}))}};J=fn([b(1,o.Inject(K.DocEventManagerService)),b(2,o.ICommandService),b(3,o.Inject(k)),b(4,o.Inject(C.DocSkeletonManagerService)),b(5,o.Inject(C.DocSelectionManagerService))],J);var gn=Object.defineProperty,hn=Object.getOwnPropertyDescriptor,vn=(n,e,t,i)=>{for(var r=i>1?void 0:i?hn(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&gn(e,t,r),r},Z=(n,e)=>(t,i)=>e(t,i,n);let z=class extends o.Disposable{constructor(n,e,t,i){super(),this._context=n,this._docInterceptorService=e,this._hyperLinkService=t,this._docRenderController=i,this._init(),this._initReRender()}_init(){this._docInterceptorService.intercept(C.DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{handler:(n,e,t)=>{if(!n)return t(n);const{unitId:i,index:r}=e,s=this._hyperLinkService.showing;if(!s)return t({...n,active:!1});const{linkId:c,unitId:d,startIndex:a,endIndex:f}=s,u=d===i&&n.rangeId===c&&r>=a&&r<=f;return t({...n,active:u})}})}_initReRender(){this.disposeWithMe(this._hyperLinkService.showingLink$.pipe(R.distinctUntilChanged((n,e)=>(n==null?void 0:n.linkId)===(e==null?void 0:e.linkId)&&(n==null?void 0:n.unitId)===(e==null?void 0:e.unitId)&&(n==null?void 0:n.startIndex)===(e==null?void 0:e.startIndex)),R.pairwise()).subscribe(([n,e])=>{e?e.unitId===this._context.unitId&&this._docRenderController.reRender(e.unitId):n&&n.unitId===this._context.unitId&&this._docRenderController.reRender(n.unitId)}))}};z=vn([Z(1,o.Inject(C.DocInterceptorService)),Z(2,o.Inject(k)),Z(3,o.Inject(K.DocRenderController))],z);const ke="doc-hyper-link-icon";function fe(n){return{id:E.id,type:_.MenuItemType.BUTTON,icon:ke,title:"docLink.menu.tooltip",tooltip:"docLink.menu.tooltip",hidden$:_.getMenuHiddenObservable(n,o.UniverInstanceType.UNIVER_DOC),disabled$:new R.Observable(function(e){const i=n.get(C.DocSelectionManagerService).textSelection$.pipe(R.debounceTime(16)).subscribe(()=>{e.next(Se(n))});return()=>{i.unsubscribe()}})}}const In={id:E.id,binding:_.MetaKeys.CTRL_COMMAND|_.KeyCode.K,description:"docLink.menu.tooltip",preconditions:K.whenDocAndEditorFocused},mn={[_.RibbonStartGroup.OTHERS]:{[E.id]:{order:0,menuItemFactory:fe}},[_.ContextMenuPosition.MAIN_AREA]:{[_.ContextMenuGroup.DATA]:{[E.id]:{order:0,menuItemFactory:fe}}}};var _n=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,yn=(n,e,t,i)=>{for(var r=i>1?void 0:i?Cn(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&_n(e,t,r),r},N=(n,e)=>(t,i)=>e(t,i,n);let A=class extends o.Disposable{constructor(n,e,t,i){super(),this._componentManager=n,this._commandService=e,this._menuManagerService=t,this._shortcutService=i,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortcut()}_initComponents(){[[$,$.componentKey],[H,H.componentKey],[Q,ke]].forEach(([n,e])=>{this._componentManager.register(e,n)})}_initCommands(){[ge,he,ye,E,G,Le].forEach(n=>{this._commandService.registerCommand(n)})}_initShortcut(){[In].forEach(n=>{this._shortcutService.registerShortcut(n)})}_initMenus(){this._menuManagerService.mergeMenu(mn)}};A=yn([N(0,o.Inject(_.ComponentManager)),N(1,o.ICommandService),N(2,_.IMenuManagerService),N(3,_.IShortcutService)],A);const Sn="DOC_HYPER_LINK_UI_PLUGIN";var xe=Object.defineProperty,Ln=Object.getOwnPropertyDescriptor,kn=(n,e,t)=>e in n?xe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,xn=(n,e,t,i)=>{for(var r=i>1?void 0:i?Ln(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&xe(e,t,r),r},W=(n,e)=>(t,i)=>e(t,i,n),Oe=(n,e,t)=>kn(n,typeof e!="symbol"?e+"":e,t);exports.UniverDocsHyperLinkUIPlugin=class extends o.Plugin{constructor(e=ae,t,i,r){super(),this._config=e,this._injector=t,this._renderManagerSrv=i,this._configService=r;const{menu:s,...c}=o.merge({},ae,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(be,c)}onStarting(){[[k],[A],[B]].forEach(t=>{this._injector.add(t)}),this._injector.get(A)}onReady(){this._injector.get(B)}onRendered(){this._initRenderModule()}_initRenderModule(){[[z],[J]].forEach(e=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,e)})}};Oe(exports.UniverDocsHyperLinkUIPlugin,"pluginName",Sn);Oe(exports.UniverDocsHyperLinkUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC);exports.UniverDocsHyperLinkUIPlugin=xn([o.DependentOn(Ee.UniverDocsHyperLinkPlugin),W(1,o.Inject(o.Injector)),W(2,De.IRenderManagerService),W(3,o.IConfigService)],exports.UniverDocsHyperLinkUIPlugin);
1
+ "use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),docsHyperLink=require("@univerjs/docs-hyper-link"),engineRender=require("@univerjs/engine-render"),docs=require("@univerjs/docs"),docsUi=require("@univerjs/docs-ui"),rxjs=require("rxjs"),jsxRuntime=require("react/jsx-runtime"),design=require("@univerjs/design"),ui=require("@univerjs/ui"),react=require("react"),DOCS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY="docs-hyper-link-ui.config",defaultPluginConfig={},AddDocHyperLinkCommand={type:core.CommandType.COMMAND,id:"docs.command.add-hyper-link",async handler(accessor,params){if(!params)return!1;const{payload,unitId,selections}=params,commandService=accessor.get(core.ICommandService),id=core.generateRandomId(),doMutation=docs.addCustomRangeBySelectionFactory(accessor,{rangeId:id,rangeType:core.CustomRangeType.HYPERLINK,properties:{url:payload},unitId,selections});return doMutation?commandService.syncExecuteCommand(doMutation.id,doMutation.params):!1}},UpdateDocHyperLinkCommand={id:"docs.command.update-hyper-link",type:core.CommandType.COMMAND,handler(accessor,params){var _a7;if(!params)return!1;const{unitId,payload,segmentId,linkId}=params,commandService=accessor.get(core.ICommandService),univerInstanceService=accessor.get(core.IUniverInstanceService),currentSelection=accessor.get(docs.DocSelectionManagerService).getActiveTextRange(),doc=univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC);if(!currentSelection||!doc)return!1;const textRun=(_a7=core.getBodySlice(doc.getSelfOrHeaderFooterModel(segmentId).getBody(),currentSelection.startOffset,currentSelection.endOffset).textRuns)==null?void 0:_a7[0];textRun&&(textRun.ed=params.label.length+1);const replaceSelection=docs.replaceSelectionFactory(accessor,{unitId,body:{dataStream:`${params.label}`,customRanges:[{rangeId:linkId,rangeType:core.CustomRangeType.HYPERLINK,startIndex:0,endIndex:params.label.length+1,properties:{url:payload}}],textRuns:textRun?[textRun]:void 0},selection:{startOffset:currentSelection.startOffset,endOffset:currentSelection.endOffset,collapsed:!1,segmentId}});return replaceSelection?commandService.syncExecuteCommand(replaceSelection.id,replaceSelection.params):!1}},docsLinkEdit="univer-docs-link-edit",docsLinkEditTitle="univer-docs-link-edit-title",docsLinkEditClose="univer-docs-link-edit-close",docsLinkEditButtons="univer-docs-link-edit-buttons",docsLinkEditButton="univer-docs-link-edit-button",styles$1={docsLinkEdit,docsLinkEditTitle,docsLinkEditClose,docsLinkEditButtons,docsLinkEditButton};function hasProtocol(urlString){return/^[a-zA-Z]+:\/\//.test(urlString)}__name(hasProtocol,"hasProtocol");function isEmail(url){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(url)}__name(isEmail,"isEmail");function transformUrl(urlStr){return hasProtocol(urlStr)?urlStr:isEmail(urlStr)?`mailto://${urlStr}`:`https://${urlStr}`}__name(transformUrl,"transformUrl");const DocHyperLinkEdit=__name(()=>{const hyperLinkService=core.useDependency(DocHyperLinkPopupService),localeService=core.useDependency(core.LocaleService),editing=core.useObservable(hyperLinkService.editingLink$),commandService=core.useDependency(core.ICommandService),univerInstanceService=core.useDependency(core.IUniverInstanceService),docSelectionManagerService=core.useDependency(docs.DocSelectionManagerService),[link,setLink]=react.useState(""),[label,setLabel]=react.useState(""),[showError,setShowError]=react.useState(!1),isLegal=core.Tools.isLegalUrl(link),doc=editing?univerInstanceService.getUnit(editing.unitId,core.UniverInstanceType.UNIVER_DOC):univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC);react.useEffect(()=>{var _a7,_b,_c,_d,_e,_f,_g,_h,_i;const activeRange=docSelectionManagerService.getActiveTextRange();if(!activeRange)return;if(editing){const body2=(_a7=doc==null?void 0:doc.getSelfOrHeaderFooterModel(editing.segmentId))==null?void 0:_a7.getBody(),matchedRange2=(_b=body2==null?void 0:body2.customRanges)==null?void 0:_b.find(i=>(editing==null?void 0:editing.linkId)===i.rangeId&&i.startIndex===editing.startIndex&&i.endIndex===editing.endIndex);doc&&matchedRange2&&(setLink((_d=(_c=matchedRange2.properties)==null?void 0:_c.url)!=null?_d:""),setLabel(core.BuildTextUtils.transform.getPlainText(core.getBodySlice(body2,matchedRange2.startIndex,matchedRange2.endIndex+1).dataStream)));return}const body=(_e=doc==null?void 0:doc.getSelfOrHeaderFooterModel(activeRange.segmentId))==null?void 0:_e.getBody(),selection=body?activeRange:null,matchedRange=selection&&((_g=core.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection,(_f=body==null?void 0:body.customRanges)!=null?_f:[]))==null?void 0:_g[0]);doc&&matchedRange&&setLink((_i=(_h=matchedRange==null?void 0:matchedRange.properties)==null?void 0:_h.url)!=null?_i:"")},[doc,editing,docSelectionManagerService,univerInstanceService]);const handleCancel=__name(()=>{hyperLinkService.hideEditPopup()},"handleCancel"),handleConfirm=__name(()=>{if(setShowError(!0),!isLegal||!doc)return;const linkFinal=transformUrl(link);if(!editing)commandService.executeCommand(AddDocHyperLinkCommand.id,{unitId:doc.getUnitId(),payload:linkFinal});else{if(!label)return;commandService.executeCommand(UpdateDocHyperLinkCommand.id,{unitId:doc.getUnitId(),payload:linkFinal,linkId:editing.linkId,label,segmentId:editing.segmentId})}hyperLinkService.hideEditPopup()},"handleConfirm");if(doc)return jsxRuntime.jsxs("div",{className:styles$1.docsLinkEdit,children:[jsxRuntime.jsxs("div",{children:[editing?jsxRuntime.jsx(design.FormLayout,{label:localeService.t("docLink.edit.label"),error:showError&&!label?localeService.t("docLink.edit.labelError"):"",children:jsxRuntime.jsx(design.Input,{value:label,onChange:setLabel,autoFocus:!0,onKeyDown:__name(evt=>{evt.keyCode===ui.KeyCode.ENTER&&handleConfirm()},"onKeyDown")})}):null,jsxRuntime.jsx(design.FormLayout,{label:localeService.t("docLink.edit.address"),error:showError&&!isLegal?localeService.t("docLink.edit.addressError"):"",children:jsxRuntime.jsx(design.Input,{value:link,onChange:setLink,autoFocus:!0,onKeyDown:__name(evt=>{evt.keyCode===ui.KeyCode.ENTER&&handleConfirm()},"onKeyDown")})})]}),jsxRuntime.jsxs("div",{className:styles$1.docsLinkEditButtons,children:[jsxRuntime.jsx(design.Button,{className:styles$1.docsLinkEditButton,onClick:handleCancel,children:localeService.t("docLink.edit.cancel")}),jsxRuntime.jsx(design.Button,{disabled:!link,className:styles$1.docsLinkEditButton,type:"primary",onClick:handleConfirm,children:localeService.t("docLink.edit.confirm")})]})]})},"DocHyperLinkEdit");DocHyperLinkEdit.componentKey="docs-hyper-link-edit";var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=react.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=react.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return react.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a7){var key=_a7[0],value=_a7[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a7,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a7=node.children)===null||_a7===void 0)&&_a7.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CopySingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"copy-single",ref,icon:element$3}))});CopySingle.displayName="CopySingle";var element$2={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z"}}]},LinkSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"link-single",ref,icon:element$2}))});LinkSingle.displayName="LinkSingle";var element$1={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},UnlinkSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"unlink-single",ref,icon:element$1}))});UnlinkSingle.displayName="UnlinkSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},WriteSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"write-single",ref,icon:element}))});WriteSingle.displayName="WriteSingle";function r(e){var t,f,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}__name(r,"r");function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}__name(clsx,"clsx");const DeleteDocHyperLinkCommand={type:core.CommandType.COMMAND,id:"docs.command.delete-hyper-link",async handler(accessor,params){if(!params)return!1;const{unitId,linkId,segmentId}=params,commandService=accessor.get(core.ICommandService),doMutation=docs.deleteCustomRangeFactory(accessor,{unitId,rangeId:linkId,segmentId});return doMutation?await commandService.syncExecuteCommand(doMutation.id,doMutation.params):!1}},shouldDisableAddLink=__name(accessor=>{const textSelectionService=accessor.get(docs.DocSelectionManagerService),univerInstanceService=accessor.get(core.IUniverInstanceService),textRanges=textSelectionService.getTextRanges();if(!(textRanges!=null&&textRanges.length))return!0;const activeRange=textRanges[0];return!!(!univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC)||!activeRange||activeRange.collapsed)},"shouldDisableAddLink"),ShowDocHyperLinkEditPopupOperation={type:core.CommandType.OPERATION,id:"doc.operation.show-hyper-link-edit-popup",handler(accessor,params){var _a7;const linkInfo=params==null?void 0:params.link,univerInstanceService=accessor.get(core.IUniverInstanceService);if(shouldDisableAddLink(accessor)&&!linkInfo)return!1;const hyperLinkService=accessor.get(DocHyperLinkPopupService),unitId=(linkInfo==null?void 0:linkInfo.unitId)||((_a7=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC))==null?void 0:_a7.getUnitId());return unitId?(hyperLinkService.showEditPopup(unitId,linkInfo),!0):!1}},ToggleDocHyperLinkInfoPopupOperation={type:core.CommandType.OPERATION,id:"doc.operation.toggle-hyper-link-info-popup",handler(accessor,params){const hyperLinkService=accessor.get(DocHyperLinkPopupService);return params?(hyperLinkService.showInfoPopup(params),!0):(hyperLinkService.hideInfoPopup(),!0)}},ClickDocHyperLinkOperation={type:core.CommandType.OPERATION,id:"doc.operation.click-hyper-link",handler(accessor,params){var _a7,_b,_c;if(!params)return!1;const{unitId,linkId,segmentId}=params,doc=accessor.get(core.IUniverInstanceService).getUnit(unitId,core.UniverInstanceType.UNIVER_DOC),body=doc==null?void 0:doc.getSelfOrHeaderFooterModel(segmentId).getBody(),link=(_c=(_b=(_a7=body==null?void 0:body.customRanges)==null?void 0:_a7.find(range=>range.rangeId===linkId&&range.rangeType===core.CustomRangeType.HYPERLINK))==null?void 0:_b.properties)==null?void 0:_c.url;return link&&window.open(link,"_blank","noopener noreferrer"),!0}},docLink="univer-doc-link",docLinkType="univer-doc-link-type",docLinkContent="univer-doc-link-content",docLinkContentError="univer-doc-link-content-error",docLinkUrl="univer-doc-link-url",docLinkOperations="univer-doc-link-operations",docLinkOperation="univer-doc-link-operation",docLinkOperationError="univer-doc-link-operation-error",styles={docLink,docLinkType,docLinkContent,docLinkContentError,docLinkUrl,docLinkOperations,docLinkOperation,docLinkOperationError},DocLinkPopup=__name(()=>{var _a7,_b;const hyperLinkService=core.useDependency(DocHyperLinkPopupService),commandService=core.useDependency(core.ICommandService),messageService=core.useDependency(ui.IMessageService),localeService=core.useDependency(core.LocaleService),currentPopup=ui.useObservable(hyperLinkService.showingLink$),univerInstanceService=core.useDependency(core.IUniverInstanceService);if(!currentPopup)return null;const{unitId,linkId,segmentId,startIndex,endIndex}=currentPopup,doc=univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC),body=doc==null?void 0:doc.getSelfOrHeaderFooterModel(segmentId).getBody(),link=(_a7=body==null?void 0:body.customRanges)==null?void 0:_a7.find(range=>range.rangeId===linkId&&range.rangeType===core.CustomRangeType.HYPERLINK&&range.startIndex===startIndex&&range.endIndex===endIndex);if(!link)return null;const url=(_b=link.properties)==null?void 0:_b.url;return jsxRuntime.jsxs("div",{className:styles.docLink,onClick:__name(()=>{hyperLinkService.hideInfoPopup()},"onClick"),children:[jsxRuntime.jsxs("div",{className:clsx(styles.docLinkContent),onClick:__name(()=>window.open(url),"onClick"),children:[jsxRuntime.jsx("div",{className:styles.docLinkType,children:jsxRuntime.jsx(LinkSingle,{})}),jsxRuntime.jsx(design.Tooltip,{showIfEllipsis:!0,title:url,children:jsxRuntime.jsx("span",{className:styles.docLinkUrl,children:url})})]}),jsxRuntime.jsxs("div",{className:styles.docLinkOperations,children:[jsxRuntime.jsx("div",{className:clsx(styles.docLinkOperation),onClick:__name(()=>{navigator.clipboard.writeText(url),messageService.show({content:localeService.t("docLink.info.coped"),type:design.MessageType.Info})},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("docLink.info.copy"),children:jsxRuntime.jsx(CopySingle,{})})}),jsxRuntime.jsx("div",{className:styles.docLinkOperation,onClick:__name(()=>{commandService.executeCommand(ShowDocHyperLinkEditPopupOperation.id,{link:currentPopup})},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("docLink.info.edit"),children:jsxRuntime.jsx(WriteSingle,{})})}),jsxRuntime.jsx("div",{className:styles.docLinkOperation,onClick:__name(()=>{commandService.executeCommand(DeleteDocHyperLinkCommand.id,{unitId,linkId:link.rangeId,segmentId})},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("docLink.info.cancel"),children:jsxRuntime.jsx(UnlinkSingle,{})})})]})]})},"DocLinkPopup");DocLinkPopup.componentKey="univer.doc.link-info-popup";var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$5"),_a;let DocHyperLinkPopupService=(_a=class extends core.Disposable{constructor(_docCanvasPopupManagerService,_textSelectionManagerService,_univerInstanceService){super();__publicField(this,"_editingLink$",new rxjs.BehaviorSubject(null));__publicField(this,"_showingLink$",new rxjs.BehaviorSubject(null));__publicField(this,"editingLink$",this._editingLink$.asObservable());__publicField(this,"showingLink$",this._showingLink$.asObservable());__publicField(this,"_editPopup",null);__publicField(this,"_infoPopup",null);this._docCanvasPopupManagerService=_docCanvasPopupManagerService,this._textSelectionManagerService=_textSelectionManagerService,this._univerInstanceService=_univerInstanceService,this.disposeWithMe(()=>{this._editingLink$.complete(),this._showingLink$.complete()})}get editing(){return this._editingLink$.value}get showing(){return this._showingLink$.value}showEditPopup(unitId,linkInfo){this._editPopup&&this._editPopup.dispose(),this._editingLink$.next(linkInfo);const textRanges=this._textSelectionManagerService.getTextRanges({unitId,subUnitId:unitId});let activeRange=textRanges==null?void 0:textRanges[textRanges.length-1];if(linkInfo){const{segmentId,segmentPage,startIndex,endIndex}=linkInfo;activeRange={collapsed:!1,startOffset:startIndex,endOffset:endIndex+1,segmentId,segmentPage},this._textSelectionManagerService.replaceDocRanges([{startOffset:startIndex,endOffset:endIndex+1}])}return activeRange?(this._editPopup=this._docCanvasPopupManagerService.attachPopupToRange(activeRange,{componentKey:DocHyperLinkEdit.componentKey,direction:"bottom"},unitId),this._editPopup):null}hideEditPopup(){var _a7;this._editingLink$.next(null),(_a7=this._editPopup)==null||_a7.dispose()}showInfoPopup(info){var _a7,_b,_c,_d,_e,_f;const{linkId,unitId,segmentId,segmentPage,startIndex,endIndex}=info;if(!(((_a7=this.showing)==null?void 0:_a7.linkId)===linkId&&((_b=this.showing)==null?void 0:_b.unitId)===unitId&&((_c=this.showing)==null?void 0:_c.segmentId)===segmentId&&((_d=this.showing)==null?void 0:_d.segmentPage)===segmentPage&&((_e=this.showing)==null?void 0:_e.startIndex)===startIndex&&((_f=this.showing)==null?void 0:_f.endIndex)===endIndex||(this._infoPopup&&this._infoPopup.dispose(),!this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC))))return this._showingLink$.next({unitId,linkId,segmentId,segmentPage,startIndex,endIndex}),this._infoPopup=this._docCanvasPopupManagerService.attachPopupToRange({collapsed:!1,startOffset:startIndex,endOffset:endIndex+1,segmentId,segmentPage},{componentKey:DocLinkPopup.componentKey,direction:"top-center",multipleDirection:"top",onClickOutside:__name(()=>{this.hideInfoPopup()},"onClickOutside")},unitId),this._infoPopup}hideInfoPopup(){var _a7;this._showingLink$.next(null),(_a7=this._infoPopup)==null||_a7.dispose()}},__name(_a,"DocHyperLinkPopupService"),_a);DocHyperLinkPopupService=__decorateClass$5([__decorateParam$5(0,core.Inject(docsUi.DocCanvasPopManagerService)),__decorateParam$5(1,core.Inject(docs.DocSelectionManagerService)),__decorateParam$5(2,core.IUniverInstanceService)],DocHyperLinkPopupService);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4"),_a2;let DocHyperLinkSelectionController=(_a2=class extends core.Disposable{constructor(_commandService,_univerInstanceService,_docHyperLinkService){super(),this._commandService=_commandService,this._univerInstanceService=_univerInstanceService,this._docHyperLinkService=_docHyperLinkService,this._initSelectionChange()}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{var _a7,_b,_c;if(commandInfo.id===docs.SetTextSelectionsOperation.id){const params=commandInfo.params,{unitId,ranges,segmentId}=params,doc=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC),primary=ranges[0];if(primary&&doc){const{startOffset,endOffset,collapsed,segmentPage}=primary,customRanges=(_b=(_a7=doc.getSelfOrHeaderFooterModel(segmentId))==null?void 0:_a7.getBody())==null?void 0:_b.customRanges;if(collapsed){const index=(_c=customRanges==null?void 0:customRanges.findIndex(value=>value.startIndex<startOffset&&value.endIndex>endOffset-1))!=null?_c:-1;if(index>-1){const customRange=customRanges[index];this._docHyperLinkService.showInfoPopup({unitId,linkId:customRange.rangeId,segmentId,segmentPage,startIndex:customRange.startIndex,endIndex:customRange.endIndex});return}}else if(customRanges==null?void 0:customRanges.find(value=>value.startIndex<=startOffset&&value.endIndex>=endOffset-1))return}this._docHyperLinkService.hideInfoPopup(),this._docHyperLinkService.hideEditPopup()}}))}},__name(_a2,"DocHyperLinkSelectionController"),_a2);DocHyperLinkSelectionController=__decorateClass$4([__decorateParam$4(0,core.ICommandService),__decorateParam$4(1,core.IUniverInstanceService),__decorateParam$4(2,core.Inject(DocHyperLinkPopupService))],DocHyperLinkSelectionController);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3"),_a3;let DocHyperLinkEventRenderController=(_a3=class extends core.Disposable{constructor(_context,_docEventManagerService,_commandService,_hyperLinkPopupService,_docSkeletonManagerService,_docSelectionManagerService){super(),this._context=_context,this._docEventManagerService=_docEventManagerService,this._commandService=_commandService,this._hyperLinkPopupService=_hyperLinkPopupService,this._docSkeletonManagerService=_docSkeletonManagerService,this._docSelectionManagerService=_docSelectionManagerService,!(this._context.unitId===core.DOCS_ZEN_EDITOR_UNIT_ID_KEY||this._context.unitId===core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)&&(this._initHover(),this._initClick())}get _skeleton(){return this._docSkeletonManagerService.getSkeleton()}_hideInfoPopup(){this._hyperLinkPopupService.showing&&this._commandService.executeCommand(ToggleDocHyperLinkInfoPopupOperation.id)}_initHover(){this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe(ranges=>{var _a7;const link=ranges.find(range=>range.range.rangeType===core.CustomRangeType.HYPERLINK),activeRanges=this._docSelectionManagerService.getTextRanges(),currentSegmentId=activeRanges==null?void 0:activeRanges[0].segmentId;if(((_a7=link==null?void 0:link.segmentId)!=null?_a7:"")!==currentSegmentId){this._hideInfoPopup();return}link?this._commandService.executeCommand(ToggleDocHyperLinkInfoPopupOperation.id,{unitId:this._context.unitId,linkId:link.range.rangeId,segmentId:link.segmentId,segmentPage:link.segmentPageIndex,rangeId:link.range.rangeId,startIndex:link.range.startIndex,endIndex:link.range.endIndex}):this._hideInfoPopup()}))}_initClick(){this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe(range=>{const link=range.range;link&&this._commandService.executeCommand(ClickDocHyperLinkOperation.id,{unitId:this._context.unitId,linkId:link.rangeId,segmentId:range.segmentId})}))}},__name(_a3,"DocHyperLinkEventRenderController"),_a3);DocHyperLinkEventRenderController=__decorateClass$3([__decorateParam$3(1,core.Inject(docsUi.DocEventManagerService)),__decorateParam$3(2,core.ICommandService),__decorateParam$3(3,core.Inject(DocHyperLinkPopupService)),__decorateParam$3(4,core.Inject(docs.DocSkeletonManagerService)),__decorateParam$3(5,core.Inject(docs.DocSelectionManagerService))],DocHyperLinkEventRenderController);var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a4;let DocHyperLinkRenderController=(_a4=class extends core.Disposable{constructor(_context,_docInterceptorService,_hyperLinkService,_docRenderController){super(),this._context=_context,this._docInterceptorService=_docInterceptorService,this._hyperLinkService=_hyperLinkService,this._docRenderController=_docRenderController,this._init(),this._initReRender()}_init(){this._docInterceptorService.intercept(docs.DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{handler:__name((data,pos,next)=>{if(!data)return next(data);const{unitId,index}=pos,activeLink=this._hyperLinkService.showing;if(!activeLink)return next({...data,active:!1});const{linkId,unitId:linkUnitId,startIndex,endIndex}=activeLink,isActive=linkUnitId===unitId&&data.rangeId===linkId&&index>=startIndex&&index<=endIndex;return next({...data,active:isActive})},"handler")})}_initReRender(){this.disposeWithMe(this._hyperLinkService.showingLink$.pipe(rxjs.distinctUntilChanged((prev,aft)=>(prev==null?void 0:prev.linkId)===(aft==null?void 0:aft.linkId)&&(prev==null?void 0:prev.unitId)===(aft==null?void 0:aft.unitId)&&(prev==null?void 0:prev.startIndex)===(aft==null?void 0:aft.startIndex)),rxjs.pairwise()).subscribe(([preLink,link])=>{link?link.unitId===this._context.unitId&&this._docRenderController.reRender(link.unitId):preLink&&preLink.unitId===this._context.unitId&&this._docRenderController.reRender(preLink.unitId)}))}},__name(_a4,"DocHyperLinkRenderController"),_a4);DocHyperLinkRenderController=__decorateClass$2([__decorateParam$2(1,core.Inject(docs.DocInterceptorService)),__decorateParam$2(2,core.Inject(DocHyperLinkPopupService)),__decorateParam$2(3,core.Inject(docsUi.DocRenderController))],DocHyperLinkRenderController);const DOC_LINK_ICON="doc-hyper-link-icon";function AddHyperLinkMenuItemFactory(accessor){return{id:ShowDocHyperLinkEditPopupOperation.id,type:ui.MenuItemType.BUTTON,icon:DOC_LINK_ICON,title:"docLink.menu.tooltip",tooltip:"docLink.menu.tooltip",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC),disabled$:new rxjs.Observable(function(subscribe){const observer=accessor.get(docs.DocSelectionManagerService).textSelection$.pipe(rxjs.debounceTime(16)).subscribe(()=>{subscribe.next(shouldDisableAddLink(accessor))});return()=>{observer.unsubscribe()}})}}__name(AddHyperLinkMenuItemFactory,"AddHyperLinkMenuItemFactory");const addLinkShortcut={id:ShowDocHyperLinkEditPopupOperation.id,binding:ui.MetaKeys.CTRL_COMMAND|ui.KeyCode.K,description:"docLink.menu.tooltip",preconditions:docsUi.whenDocAndEditorFocused},menuSchema={[ui.RibbonStartGroup.OTHERS]:{[ShowDocHyperLinkEditPopupOperation.id]:{order:0,menuItemFactory:AddHyperLinkMenuItemFactory}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.DATA]:{[ShowDocHyperLinkEditPopupOperation.id]:{order:0,menuItemFactory:AddHyperLinkMenuItemFactory}}}};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),_a5;let DocHyperLinkUIController=(_a5=class extends core.Disposable{constructor(_componentManager,_commandService,_menuManagerService,_shortcutService){super(),this._componentManager=_componentManager,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._shortcutService=_shortcutService,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortcut()}_initComponents(){[[DocHyperLinkEdit,DocHyperLinkEdit.componentKey],[DocLinkPopup,DocLinkPopup.componentKey],[LinkSingle,DOC_LINK_ICON]].forEach(([comp,key])=>{this._componentManager.register(key,comp)})}_initCommands(){[AddDocHyperLinkCommand,UpdateDocHyperLinkCommand,DeleteDocHyperLinkCommand,ShowDocHyperLinkEditPopupOperation,ToggleDocHyperLinkInfoPopupOperation,ClickDocHyperLinkOperation].forEach(command=>{this._commandService.registerCommand(command)})}_initShortcut(){[addLinkShortcut].forEach(shortcut=>{this._shortcutService.registerShortcut(shortcut)})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}},__name(_a5,"DocHyperLinkUIController"),_a5);DocHyperLinkUIController=__decorateClass$1([__decorateParam$1(0,core.Inject(ui.ComponentManager)),__decorateParam$1(1,core.ICommandService),__decorateParam$1(2,ui.IMenuManagerService),__decorateParam$1(3,ui.IShortcutService)],DocHyperLinkUIController);const DOC_HYPER_LINK_UI_PLUGIN="DOC_HYPER_LINK_UI_PLUGIN";var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField"),_a6;exports.UniverDocsHyperLinkUIPlugin=(_a6=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_renderManagerSrv,_configService){super(),this._config=_config,this._injector=_injector,this._renderManagerSrv=_renderManagerSrv,this._configService=_configService;const{menu,...rest}=core.merge({},defaultPluginConfig,this._config);menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(DOCS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY,rest)}onStarting(){[[DocHyperLinkPopupService],[DocHyperLinkUIController],[DocHyperLinkSelectionController]].forEach(dep=>{this._injector.add(dep)}),this._injector.get(DocHyperLinkUIController)}onReady(){this._injector.get(DocHyperLinkSelectionController)}onRendered(){this._initRenderModule()}_initRenderModule(){[[DocHyperLinkRenderController],[DocHyperLinkEventRenderController]].forEach(dep=>{this._renderManagerSrv.registerRenderModule(core.UniverInstanceType.UNIVER_DOC,dep)})}},__name(_a6,"UniverDocsHyperLinkUIPlugin"),_a6);__publicField2(exports.UniverDocsHyperLinkUIPlugin,"pluginName",DOC_HYPER_LINK_UI_PLUGIN);__publicField2(exports.UniverDocsHyperLinkUIPlugin,"type",core.UniverInstanceType.UNIVER_DOC);exports.UniverDocsHyperLinkUIPlugin=__decorateClass([core.DependentOn(docsHyperLink.UniverDocsHyperLinkPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,engineRender.IRenderManagerService),__decorateParam(3,core.IConfigService)],exports.UniverDocsHyperLinkUIPlugin);
@@ -1 +1 @@
1
- "use strict";const l={docLink:{edit:{confirm:"Confirm",cancel:"Cancel",title:"Link",address:"Link",placeholder:"Please input a link url",addressError:"Url is illegal!",label:"Label",labelError:"Please input label of link"},info:{copy:"Copy",edit:"Edit",cancel:"Cancel link",coped:"Link copied to clipboard"},menu:{tooltip:"Add link"}}};module.exports=l;
1
+ "use strict";const enUS={docLink:{edit:{confirm:"Confirm",cancel:"Cancel",title:"Link",address:"Link",placeholder:"Please input a link url",addressError:"Url is illegal!",label:"Label",labelError:"Please input label of link"},info:{copy:"Copy",edit:"Edit",cancel:"Cancel link",coped:"Link copied to clipboard"},menu:{tooltip:"Add link"}}};module.exports=enUS;
@@ -1 +1 @@
1
- "use strict";const e={docLink:{edit:{confirm:"تایید",cancel:"انصراف",title:"لینک",address:"لینک",placeholder:"لطفا یک آدرس لینک وارد کنید",addressError:"آدرس غیرمجاز است!",label:"برچسب",labelError:"لطفا برچسب لینک را وارد کنید"},info:{copy:"کپی",edit:"ویرایش",cancel:"لینک را لغو کنید",coped:"لینک به کلیپ بورد کپی شد"},menu:{tooltip:"افزودن لینک"}}};module.exports=e;
1
+ "use strict";const locale={docLink:{edit:{confirm:"تایید",cancel:"انصراف",title:"لینک",address:"لینک",placeholder:"لطفا یک آدرس لینک وارد کنید",addressError:"آدرس غیرمجاز است!",label:"برچسب",labelError:"لطفا برچسب لینک را وارد کنید"},info:{copy:"کپی",edit:"ویرایش",cancel:"لینک را لغو کنید",coped:"لینک به کلیپ بورد کپی شد"},menu:{tooltip:"افزودن لینک"}}};module.exports=locale;
@@ -1 +1 @@
1
- "use strict";const e={docLink:{edit:{confirm:"Confirmer",cancel:"Annuler",title:"Lien",address:"Link",placeholder:"Veuillez entrer un lien",addressError:"L'url est illégal!",label:"Label",labelError:"Veuillez entrer le label du lien"},info:{copy:"Copy",edit:"Edit",cancel:"Cancel link",coped:"Link copied to clipboard"},menu:{tooltip:"Add link"}}};module.exports=e;
1
+ "use strict";const frFR={docLink:{edit:{confirm:"Confirmer",cancel:"Annuler",title:"Lien",address:"Link",placeholder:"Veuillez entrer un lien",addressError:"L'url est illégal!",label:"Label",labelError:"Veuillez entrer le label du lien"},info:{copy:"Copy",edit:"Edit",cancel:"Cancel link",coped:"Link copied to clipboard"},menu:{tooltip:"Add link"}}};module.exports=frFR;
@@ -1 +1 @@
1
- "use strict";const e={docLink:{edit:{confirm:"Подтвердить",cancel:"Отменить",title:"Ссылка",address:"Cсылки",label:"Текст",labelError:"Введите текст ссылки",placeholder:"Пожалуйста, введите URL ссылки",addressError:"URL некорректен!"},info:{copy:"Копировать",edit:"Редактировать",cancel:"Отменить ссылку",coped:"Link copied to clipboard"},menu:{tooltip:"Добавить ссылку"}}};module.exports=e;
1
+ "use strict";const ruRU={docLink:{edit:{confirm:"Подтвердить",cancel:"Отменить",title:"Ссылка",address:"Cсылки",label:"Текст",labelError:"Введите текст ссылки",placeholder:"Пожалуйста, введите URL ссылки",addressError:"URL некорректен!"},info:{copy:"Копировать",edit:"Редактировать",cancel:"Отменить ссылку",coped:"Link copied to clipboard"},menu:{tooltip:"Добавить ссылку"}}};module.exports=ruRU;
@@ -1 +1 @@
1
- "use strict";const n={docLink:{edit:{confirm:"Xác nhận",cancel:"Hủy",title:"Liên kết",address:"Liên kết",label:"Nhãn",labelError:"Vui lòng nhập nhãn liên kết",placeholder:"Vui lòng nhập liên kết hợp lệ",addressError:"Vui lòng nhập liên kết hợp lệ"},info:{copy:"Sao chép",edit:"Chỉnh sửa",cancel:"Hủy liên kết",coped:"Liên kết đã được sao chép vào clipboard"},menu:{tooltip:"Thêm liên kết"}}};module.exports=n;
1
+ "use strict";const locale={docLink:{edit:{confirm:"Xác nhận",cancel:"Hủy",title:"Liên kết",address:"Liên kết",label:"Nhãn",labelError:"Vui lòng nhập nhãn liên kết",placeholder:"Vui lòng nhập liên kết hợp lệ",addressError:"Vui lòng nhập liên kết hợp lệ"},info:{copy:"Sao chép",edit:"Chỉnh sửa",cancel:"Hủy liên kết",coped:"Liên kết đã được sao chép vào clipboard"},menu:{tooltip:"Thêm liên kết"}}};module.exports=locale;
@@ -1 +1 @@
1
- "use strict";const e={docLink:{edit:{confirm:"确认",cancel:"取消",title:"链接",address:"链接",label:"文本",labelError:"请输入链接文本",placeholder:"请输入合法的链接",addressError:"请输入合法的链接"},info:{copy:"复制",edit:"编辑",cancel:"取消链接",coped:"链接已被复制到剪贴板"},menu:{tooltip:"添加链接"}}};module.exports=e;
1
+ "use strict";const zhCN={docLink:{edit:{confirm:"确认",cancel:"取消",title:"链接",address:"链接",label:"文本",labelError:"请输入链接文本",placeholder:"请输入合法的链接",addressError:"请输入合法的链接"},info:{copy:"复制",edit:"编辑",cancel:"取消链接",coped:"链接已被复制到剪贴板"},menu:{tooltip:"添加链接"}}};module.exports=zhCN;
@@ -1 +1 @@
1
- "use strict";const e={docLink:{edit:{confirm:"確認",cancel:"取消",title:"連結",address:"連結",label:"文本",labelError:"请输入链接文本",placeholder:"請輸入合法的連結",addressError:"請輸入合法的連結"},info:{copy:"複製",edit:"編輯",cancel:"取消連結",coped:"連結已複製到剪貼板"},menu:{tooltip:"新增連結"}}};module.exports=e;
1
+ "use strict";const locale={docLink:{edit:{confirm:"確認",cancel:"取消",title:"連結",address:"連結",label:"文本",labelError:"请输入链接文本",placeholder:"請輸入合法的連結",addressError:"請輸入合法的連結"},info:{copy:"複製",edit:"編輯",cancel:"取消連結",coped:"連結已複製到剪貼板"},menu:{tooltip:"新增連結"}}};module.exports=locale;
package/lib/es/index.js CHANGED
@@ -8,42 +8,11 @@ import { IRenderManagerService } from "@univerjs/engine-render";
8
8
  import { addCustomRangeBySelectionFactory, DocSelectionManagerService, replaceSelectionFactory, deleteCustomRangeFactory, SetTextSelectionsOperation, DocSkeletonManagerService, DocInterceptorService, DOC_INTERCEPTOR_POINT } from "@univerjs/docs";
9
9
  import { DocCanvasPopManagerService, DocEventManagerService, DocRenderController, whenDocAndEditorFocused } from "@univerjs/docs-ui";
10
10
  import { BehaviorSubject, distinctUntilChanged, pairwise, Observable, debounceTime } from "rxjs";
11
- import require$$0, { useState, useEffect, forwardRef, useRef, createElement } from "react";
11
+ import { jsxs, jsx } from "react/jsx-runtime";
12
12
  import { FormLayout, Input, Button, Tooltip, MessageType } from "@univerjs/design";
13
13
  import { KeyCode, IMessageService, useObservable as useObservable$1, MetaKeys, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, ComponentManager, IMenuManagerService, IShortcutService } from "@univerjs/ui";
14
- const DOCS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY = "docs-hyper-link-ui.config", defaultPluginConfig = {};
15
- var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
16
- /**
17
- * @license React
18
- * react-jsx-runtime.production.min.js
19
- *
20
- * Copyright (c) Facebook, Inc. and its affiliates.
21
- *
22
- * This source code is licensed under the MIT license found in the
23
- * LICENSE file in the root directory of this source tree.
24
- */
25
- var hasRequiredReactJsxRuntime_production_min;
26
- function requireReactJsxRuntime_production_min() {
27
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
28
- hasRequiredReactJsxRuntime_production_min = 1;
29
- var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
30
- function q(c, a, g) {
31
- var b, d = {}, e = null, h = null;
32
- g !== void 0 && (e = "" + g), a.key !== void 0 && (e = "" + a.key), a.ref !== void 0 && (h = a.ref);
33
- for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
34
- if (c && c.defaultProps) for (b in a = c.defaultProps, a) d[b] === void 0 && (d[b] = a[b]);
35
- return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
36
- }
37
- return __name(q, "q"), reactJsxRuntime_production_min.Fragment = l, reactJsxRuntime_production_min.jsx = q, reactJsxRuntime_production_min.jsxs = q, reactJsxRuntime_production_min;
38
- }
39
- __name(requireReactJsxRuntime_production_min, "requireReactJsxRuntime_production_min");
40
- var hasRequiredJsxRuntime;
41
- function requireJsxRuntime() {
42
- return hasRequiredJsxRuntime || (hasRequiredJsxRuntime = 1, jsxRuntime.exports = requireReactJsxRuntime_production_min()), jsxRuntime.exports;
43
- }
44
- __name(requireJsxRuntime, "requireJsxRuntime");
45
- var jsxRuntimeExports = requireJsxRuntime();
46
- const AddDocHyperLinkCommand = {
14
+ import { useState, useEffect, forwardRef, useRef, createElement } from "react";
15
+ const DOCS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY = "docs-hyper-link-ui.config", defaultPluginConfig = {}, AddDocHyperLinkCommand = {
47
16
  type: CommandType.COMMAND,
48
17
  id: "docs.command.add-hyper-link",
49
18
  async handler(accessor, params) {
@@ -158,14 +127,14 @@ const DocHyperLinkEdit = /* @__PURE__ */ __name(() => {
158
127
  hyperLinkService.hideEditPopup();
159
128
  }, "handleConfirm");
160
129
  if (doc)
161
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.docsLinkEdit, children: [
162
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
163
- editing ? /* @__PURE__ */ jsxRuntimeExports.jsx(
130
+ return /* @__PURE__ */ jsxs("div", { className: styles$1.docsLinkEdit, children: [
131
+ /* @__PURE__ */ jsxs("div", { children: [
132
+ editing ? /* @__PURE__ */ jsx(
164
133
  FormLayout,
165
134
  {
166
135
  label: localeService.t("docLink.edit.label"),
167
136
  error: showError && !label ? localeService.t("docLink.edit.labelError") : "",
168
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
137
+ children: /* @__PURE__ */ jsx(
169
138
  Input,
170
139
  {
171
140
  value: label,
@@ -178,12 +147,12 @@ const DocHyperLinkEdit = /* @__PURE__ */ __name(() => {
178
147
  )
179
148
  }
180
149
  ) : null,
181
- /* @__PURE__ */ jsxRuntimeExports.jsx(
150
+ /* @__PURE__ */ jsx(
182
151
  FormLayout,
183
152
  {
184
153
  label: localeService.t("docLink.edit.address"),
185
154
  error: showError && !isLegal ? localeService.t("docLink.edit.addressError") : "",
186
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
155
+ children: /* @__PURE__ */ jsx(
187
156
  Input,
188
157
  {
189
158
  value: link,
@@ -197,8 +166,8 @@ const DocHyperLinkEdit = /* @__PURE__ */ __name(() => {
197
166
  }
198
167
  )
199
168
  ] }),
200
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.docsLinkEditButtons, children: [
201
- /* @__PURE__ */ jsxRuntimeExports.jsx(
169
+ /* @__PURE__ */ jsxs("div", { className: styles$1.docsLinkEditButtons, children: [
170
+ /* @__PURE__ */ jsx(
202
171
  Button,
203
172
  {
204
173
  className: styles$1.docsLinkEditButton,
@@ -206,7 +175,7 @@ const DocHyperLinkEdit = /* @__PURE__ */ __name(() => {
206
175
  children: localeService.t("docLink.edit.cancel")
207
176
  }
208
177
  ),
209
- /* @__PURE__ */ jsxRuntimeExports.jsx(
178
+ /* @__PURE__ */ jsx(
210
179
  Button,
211
180
  {
212
181
  disabled: !link,
@@ -375,7 +344,7 @@ const DeleteDocHyperLinkCommand = {
375
344
  if (!link)
376
345
  return null;
377
346
  const url = (_b = link.properties) == null ? void 0 : _b.url;
378
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
347
+ return /* @__PURE__ */ jsxs(
379
348
  "div",
380
349
  {
381
350
  className: styles.docLink,
@@ -383,12 +352,12 @@ const DeleteDocHyperLinkCommand = {
383
352
  hyperLinkService.hideInfoPopup();
384
353
  }, "onClick"),
385
354
  children: [
386
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: clsx(styles.docLinkContent), onClick: /* @__PURE__ */ __name(() => window.open(url), "onClick"), children: [
387
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.docLinkType, children: /* @__PURE__ */ jsxRuntimeExports.jsx(LinkSingle, {}) }),
388
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { showIfEllipsis: !0, title: url, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles.docLinkUrl, children: url }) })
355
+ /* @__PURE__ */ jsxs("div", { className: clsx(styles.docLinkContent), onClick: /* @__PURE__ */ __name(() => window.open(url), "onClick"), children: [
356
+ /* @__PURE__ */ jsx("div", { className: styles.docLinkType, children: /* @__PURE__ */ jsx(LinkSingle, {}) }),
357
+ /* @__PURE__ */ jsx(Tooltip, { showIfEllipsis: !0, title: url, children: /* @__PURE__ */ jsx("span", { className: styles.docLinkUrl, children: url }) })
389
358
  ] }),
390
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.docLinkOperations, children: [
391
- /* @__PURE__ */ jsxRuntimeExports.jsx(
359
+ /* @__PURE__ */ jsxs("div", { className: styles.docLinkOperations, children: [
360
+ /* @__PURE__ */ jsx(
392
361
  "div",
393
362
  {
394
363
  className: clsx(styles.docLinkOperation),
@@ -398,10 +367,10 @@ const DeleteDocHyperLinkCommand = {
398
367
  type: MessageType.Info
399
368
  });
400
369
  }, "onClick"),
401
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { placement: "bottom", title: localeService.t("docLink.info.copy"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopySingle, {}) })
370
+ children: /* @__PURE__ */ jsx(Tooltip, { placement: "bottom", title: localeService.t("docLink.info.copy"), children: /* @__PURE__ */ jsx(CopySingle, {}) })
402
371
  }
403
372
  ),
404
- /* @__PURE__ */ jsxRuntimeExports.jsx(
373
+ /* @__PURE__ */ jsx(
405
374
  "div",
406
375
  {
407
376
  className: styles.docLinkOperation,
@@ -410,10 +379,10 @@ const DeleteDocHyperLinkCommand = {
410
379
  link: currentPopup
411
380
  });
412
381
  }, "onClick"),
413
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { placement: "bottom", title: localeService.t("docLink.info.edit"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(WriteSingle, {}) })
382
+ children: /* @__PURE__ */ jsx(Tooltip, { placement: "bottom", title: localeService.t("docLink.info.edit"), children: /* @__PURE__ */ jsx(WriteSingle, {}) })
414
383
  }
415
384
  ),
416
- /* @__PURE__ */ jsxRuntimeExports.jsx(
385
+ /* @__PURE__ */ jsx(
417
386
  "div",
418
387
  {
419
388
  className: styles.docLinkOperation,
@@ -424,7 +393,7 @@ const DeleteDocHyperLinkCommand = {
424
393
  segmentId
425
394
  });
426
395
  }, "onClick"),
427
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { placement: "bottom", title: localeService.t("docLink.info.cancel"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(UnlinkSingle, {}) })
396
+ children: /* @__PURE__ */ jsx(Tooltip, { placement: "bottom", title: localeService.t("docLink.info.cancel"), children: /* @__PURE__ */ jsx(UnlinkSingle, {}) })
428
397
  }
429
398
  )
430
399
  ] })
@@ -1,5 +1,19 @@
1
- import { default as React } from 'react';
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
2
16
  export declare const DocHyperLinkEdit: {
3
- (): React.JSX.Element | undefined;
17
+ (): import("react/jsx-runtime").JSX.Element | undefined;
4
18
  componentKey: string;
5
19
  };
@@ -1,5 +1,19 @@
1
- import { default as React } from 'react';
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
2
16
  export declare const DocLinkPopup: {
3
- (): React.JSX.Element | null;
17
+ (): import("react/jsx-runtime").JSX.Element | null;
4
18
  componentKey: string;
5
19
  };
package/lib/umd/index.js CHANGED
@@ -1,9 +1 @@
1
- (function(p,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/docs-hyper-link"),require("@univerjs/engine-render"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-hyper-link","@univerjs/engine-render","@univerjs/docs","@univerjs/docs-ui","rxjs","react","@univerjs/design","@univerjs/ui"],o):(p=typeof globalThis<"u"?globalThis:p||self,o(p.UniverDocsHyperLinkUi={},p.UniverCore,p.UniverDocsHyperLink,p.UniverEngineRender,p.UniverDocs,p.UniverDocsUi,p.rxjs,p.React,p.UniverDesign,p.UniverUi))})(this,function(p,o,E,Ee,y,b,D,_,L,C){"use strict";var pn=Object.defineProperty;var fn=(p,o,E)=>o in p?pn(p,o,{enumerable:!0,configurable:!0,writable:!0,value:E}):p[o]=E;var R=(p,o,E)=>fn(p,typeof o!="symbol"?o+"":o,E);const De="docs-hyper-link-ui.config",ne={};var Y={exports:{}},j={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var te;function Ue(){if(te)return j;te=1;var n=_,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function c(d,a,v){var u,I={},g=null,l=null;v!==void 0&&(g=""+v),a.key!==void 0&&(g=""+a.key),a.ref!==void 0&&(l=a.ref);for(u in a)i.call(a,u)&&!s.hasOwnProperty(u)&&(I[u]=a[u]);if(d&&d.defaultProps)for(u in a=d.defaultProps,a)I[u]===void 0&&(I[u]=a[u]);return{$$typeof:e,type:d,key:g,ref:l,props:I,_owner:r.current}}return j.Fragment=t,j.jsx=c,j.jsxs=c,j}var ie;function je(){return ie||(ie=1,Y.exports=Ue()),Y.exports}var f=je();const re={type:o.CommandType.COMMAND,id:"docs.command.add-hyper-link",async handler(n,e){if(!e)return!1;const{payload:t,unitId:i,selections:r}=e,s=n.get(o.ICommandService),c=o.generateRandomId(),d=y.addCustomRangeBySelectionFactory(n,{rangeId:c,rangeType:o.CustomRangeType.HYPERLINK,properties:{url:t},unitId:i,selections:r});return d?s.syncExecuteCommand(d.id,d.params):!1}},oe={id:"docs.command.update-hyper-link",type:o.CommandType.COMMAND,handler(n,e){var m;if(!e)return!1;const{unitId:t,payload:i,segmentId:r,linkId:s}=e,c=n.get(o.ICommandService),d=n.get(o.IUniverInstanceService),v=n.get(y.DocSelectionManagerService).getActiveTextRange(),u=d.getUnit(t,o.UniverInstanceType.UNIVER_DOC);if(!v||!u)return!1;const g=(m=o.getBodySlice(u.getSelfOrHeaderFooterModel(r).getBody(),v.startOffset,v.endOffset).textRuns)==null?void 0:m[0];g&&(g.ed=e.label.length+1);const l=y.replaceSelectionFactory(n,{unitId:t,body:{dataStream:`${e.label}`,customRanges:[{rangeId:s,rangeType:o.CustomRangeType.HYPERLINK,startIndex:0,endIndex:e.label.length+1,properties:{url:i}}],textRuns:g?[g]:void 0},selection:{startOffset:v.startOffset,endOffset:v.endOffset,collapsed:!1,segmentId:r}});return l?c.syncExecuteCommand(l.id,l.params):!1}},w={docsLinkEdit:"univer-docs-link-edit",docsLinkEditTitle:"univer-docs-link-edit-title",docsLinkEditClose:"univer-docs-link-edit-close",docsLinkEditButtons:"univer-docs-link-edit-buttons",docsLinkEditButton:"univer-docs-link-edit-button"};function Me(n){return/^[a-zA-Z]+:\/\//.test(n)}function Te(n){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(n)}function be(n){return Me(n)?n:Te(n)?`mailto://${n}`:`https://${n}`}const N=()=>{const n=o.useDependency(k),e=o.useDependency(o.LocaleService),t=o.useObservable(n.editingLink$),i=o.useDependency(o.ICommandService),r=o.useDependency(o.IUniverInstanceService),s=o.useDependency(y.DocSelectionManagerService),[c,d]=_.useState(""),[a,v]=_.useState(""),[u,I]=_.useState(!1),g=o.Tools.isLegalUrl(c),l=t?r.getUnit(t.unitId,o.UniverInstanceType.UNIVER_DOC):r.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC);_.useEffect(()=>{var Ce,ye,Se,Le,ke,xe,Oe,Pe,Re;const h=s.getActiveTextRange();if(!h)return;if(t){const $=(Ce=l==null?void 0:l.getSelfOrHeaderFooterModel(t.segmentId))==null?void 0:Ce.getBody(),V=(ye=$==null?void 0:$.customRanges)==null?void 0:ye.find(ee=>(t==null?void 0:t.linkId)===ee.rangeId&&ee.startIndex===t.startIndex&&ee.endIndex===t.endIndex);l&&V&&(d((Le=(Se=V.properties)==null?void 0:Se.url)!=null?Le:""),v(o.BuildTextUtils.transform.getPlainText(o.getBodySlice($,V.startIndex,V.endIndex+1).dataStream)));return}const O=(ke=l==null?void 0:l.getSelfOrHeaderFooterModel(h.segmentId))==null?void 0:ke.getBody(),_e=O?h:null,F=_e&&((Oe=o.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(_e,(xe=O==null?void 0:O.customRanges)!=null?xe:[]))==null?void 0:Oe[0]);l&&F&&d((Re=(Pe=F==null?void 0:F.properties)==null?void 0:Pe.url)!=null?Re:"")},[l,t,s,r]);const m=()=>{n.hideEditPopup()},x=()=>{if(I(!0),!g||!l)return;const h=be(c);if(!t)i.executeCommand(re.id,{unitId:l.getUnitId(),payload:h});else{if(!a)return;i.executeCommand(oe.id,{unitId:l.getUnitId(),payload:h,linkId:t.linkId,label:a,segmentId:t.segmentId})}n.hideEditPopup()};if(l)return f.jsxs("div",{className:w.docsLinkEdit,children:[f.jsxs("div",{children:[t?f.jsx(L.FormLayout,{label:e.t("docLink.edit.label"),error:u&&!a?e.t("docLink.edit.labelError"):"",children:f.jsx(L.Input,{value:a,onChange:v,autoFocus:!0,onKeyDown:h=>{h.keyCode===C.KeyCode.ENTER&&x()}})}):null,f.jsx(L.FormLayout,{label:e.t("docLink.edit.address"),error:u&&!g?e.t("docLink.edit.addressError"):"",children:f.jsx(L.Input,{value:c,onChange:d,autoFocus:!0,onKeyDown:h=>{h.keyCode===C.KeyCode.ENTER&&x()}})})]}),f.jsxs("div",{className:w.docsLinkEditButtons,children:[f.jsx(L.Button,{className:w.docsLinkEditButton,onClick:m,children:e.t("docLink.edit.cancel")}),f.jsx(L.Button,{disabled:!c,className:w.docsLinkEditButton,type:"primary",onClick:x,children:e.t("docLink.edit.confirm")})]})]})};N.componentKey="docs-hyper-link-edit";var S=function(){return S=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},S.apply(this,arguments)},we=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t},M=_.forwardRef(function(n,e){var t=n.icon,i=n.id,r=n.className,s=n.extend,c=we(n,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(i," ").concat(r||"").trim(),a=_.useRef("_".concat(Be()));return se(t,"".concat(i),{defIds:t.defIds,idSuffix:a.current},S({ref:e,className:d},c),s)});function se(n,e,t,i,r){return _.createElement(n.tag,S(S({key:e},Ne(n,t,r)),i),(He(n,t).children||[]).map(function(s,c){return se(s,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,r)}))}function Ne(n,e,t){var i=S({},n.attrs);t!=null&&t.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(n.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+e.idSuffix),Object.entries(i).forEach(function(s){var c=s[0],d=s[1];typeof d=="string"&&(i[c]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),i}function He(n,e){var t,i=e.defIds;return!i||i.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?S(S({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&i&&i.indexOf(r.attrs.id)>-1?S(S({},r),{attrs:S(S({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):n}function Be(){return Math.random().toString(36).substring(2,8)}M.displayName="UniverIcon";var Ae={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ce=_.forwardRef(function(n,e){return _.createElement(M,Object.assign({},n,{id:"copy-single",ref:e,icon:Ae}))});ce.displayName="CopySingle";var Ke={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z"}}]},Z=_.forwardRef(function(n,e){return _.createElement(M,Object.assign({},n,{id:"link-single",ref:e,icon:Ke}))});Z.displayName="LinkSingle";var Fe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},de=_.forwardRef(function(n,e){return _.createElement(M,Object.assign({},n,{id:"unlink-single",ref:e,icon:Fe}))});de.displayName="UnlinkSingle";var $e={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},ae=_.forwardRef(function(n,e){return _.createElement(M,Object.assign({},n,{id:"write-single",ref:e,icon:$e}))});ae.displayName="WriteSingle";function le(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=le(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function ue(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=le(n))&&(i&&(i+=" "),i+=e);return i}const pe={type:o.CommandType.COMMAND,id:"docs.command.delete-hyper-link",async handler(n,e){if(!e)return!1;const{unitId:t,linkId:i,segmentId:r}=e,s=n.get(o.ICommandService),c=y.deleteCustomRangeFactory(n,{unitId:t,rangeId:i,segmentId:r});return c?await s.syncExecuteCommand(c.id,c.params):!1}},fe=n=>{const e=n.get(y.DocSelectionManagerService),t=n.get(o.IUniverInstanceService),i=e.getTextRanges();if(!(i!=null&&i.length))return!0;const r=i[0];return!!(!t.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC)||!r||r.collapsed)},U={type:o.CommandType.OPERATION,id:"doc.operation.show-hyper-link-edit-popup",handler(n,e){var c;const t=e==null?void 0:e.link,i=n.get(o.IUniverInstanceService);if(fe(n)&&!t)return!1;const r=n.get(k),s=(t==null?void 0:t.unitId)||((c=i.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC))==null?void 0:c.getUnitId());return s?(r.showEditPopup(s,t),!0):!1}},W={type:o.CommandType.OPERATION,id:"doc.operation.toggle-hyper-link-info-popup",handler(n,e){const t=n.get(k);return e?(t.showInfoPopup(e),!0):(t.hideInfoPopup(),!0)}},ve={type:o.CommandType.OPERATION,id:"doc.operation.click-hyper-link",handler(n,e){var v,u,I;if(!e)return!1;const{unitId:t,linkId:i,segmentId:r}=e,c=n.get(o.IUniverInstanceService).getUnit(t,o.UniverInstanceType.UNIVER_DOC),d=c==null?void 0:c.getSelfOrHeaderFooterModel(r).getBody(),a=(I=(u=(v=d==null?void 0:d.customRanges)==null?void 0:v.find(g=>g.rangeId===i&&g.rangeType===o.CustomRangeType.HYPERLINK))==null?void 0:u.properties)==null?void 0:I.url;return a&&window.open(a,"_blank","noopener noreferrer"),!0}},P={docLink:"univer-doc-link",docLinkType:"univer-doc-link-type",docLinkContent:"univer-doc-link-content",docLinkContentError:"univer-doc-link-content-error",docLinkUrl:"univer-doc-link-url",docLinkOperations:"univer-doc-link-operations",docLinkOperation:"univer-doc-link-operation",docLinkOperationError:"univer-doc-link-operation-error"},H=()=>{var x,h;const n=o.useDependency(k),e=o.useDependency(o.ICommandService),t=o.useDependency(C.IMessageService),i=o.useDependency(o.LocaleService),r=C.useObservable(n.showingLink$),s=o.useDependency(o.IUniverInstanceService);if(!r)return null;const{unitId:c,linkId:d,segmentId:a,startIndex:v,endIndex:u}=r,I=s.getUnit(c,o.UniverInstanceType.UNIVER_DOC),g=I==null?void 0:I.getSelfOrHeaderFooterModel(a).getBody(),l=(x=g==null?void 0:g.customRanges)==null?void 0:x.find(O=>O.rangeId===d&&O.rangeType===o.CustomRangeType.HYPERLINK&&O.startIndex===v&&O.endIndex===u);if(!l)return null;const m=(h=l.properties)==null?void 0:h.url;return f.jsxs("div",{className:P.docLink,onClick:()=>{n.hideInfoPopup()},children:[f.jsxs("div",{className:ue(P.docLinkContent),onClick:()=>window.open(m),children:[f.jsx("div",{className:P.docLinkType,children:f.jsx(Z,{})}),f.jsx(L.Tooltip,{showIfEllipsis:!0,title:m,children:f.jsx("span",{className:P.docLinkUrl,children:m})})]}),f.jsxs("div",{className:P.docLinkOperations,children:[f.jsx("div",{className:ue(P.docLinkOperation),onClick:()=>{navigator.clipboard.writeText(m),t.show({content:i.t("docLink.info.coped"),type:L.MessageType.Info})},children:f.jsx(L.Tooltip,{placement:"bottom",title:i.t("docLink.info.copy"),children:f.jsx(ce,{})})}),f.jsx("div",{className:P.docLinkOperation,onClick:()=>{e.executeCommand(U.id,{link:r})},children:f.jsx(L.Tooltip,{placement:"bottom",title:i.t("docLink.info.edit"),children:f.jsx(ae,{})})}),f.jsx("div",{className:P.docLinkOperation,onClick:()=>{e.executeCommand(pe.id,{unitId:c,linkId:l.rangeId,segmentId:a})},children:f.jsx(L.Tooltip,{placement:"bottom",title:i.t("docLink.info.cancel"),children:f.jsx(de,{})})})]})]})};H.componentKey="univer.doc.link-info-popup";var Ve=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ze=(n,e,t,i)=>{for(var r=i>1?void 0:i?Ye(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&Ve(e,t,r),r},G=(n,e)=>(t,i)=>e(t,i,n);let k=class extends o.Disposable{constructor(e,t,i){super();R(this,"_editingLink$",new D.BehaviorSubject(null));R(this,"_showingLink$",new D.BehaviorSubject(null));R(this,"editingLink$",this._editingLink$.asObservable());R(this,"showingLink$",this._showingLink$.asObservable());R(this,"_editPopup",null);R(this,"_infoPopup",null);this._docCanvasPopupManagerService=e,this._textSelectionManagerService=t,this._univerInstanceService=i,this.disposeWithMe(()=>{this._editingLink$.complete(),this._showingLink$.complete()})}get editing(){return this._editingLink$.value}get showing(){return this._showingLink$.value}showEditPopup(e,t){this._editPopup&&this._editPopup.dispose(),this._editingLink$.next(t);const i=this._textSelectionManagerService.getTextRanges({unitId:e,subUnitId:e});let r=i==null?void 0:i[i.length-1];if(t){const{segmentId:s,segmentPage:c,startIndex:d,endIndex:a}=t;r={collapsed:!1,startOffset:d,endOffset:a+1,segmentId:s,segmentPage:c},this._textSelectionManagerService.replaceDocRanges([{startOffset:d,endOffset:a+1}])}return r?(this._editPopup=this._docCanvasPopupManagerService.attachPopupToRange(r,{componentKey:N.componentKey,direction:"bottom"},e),this._editPopup):null}hideEditPopup(){var e;this._editingLink$.next(null),(e=this._editPopup)==null||e.dispose()}showInfoPopup(e){var v,u,I,g,l,m;const{linkId:t,unitId:i,segmentId:r,segmentPage:s,startIndex:c,endIndex:d}=e;if(!(((v=this.showing)==null?void 0:v.linkId)===t&&((u=this.showing)==null?void 0:u.unitId)===i&&((I=this.showing)==null?void 0:I.segmentId)===r&&((g=this.showing)==null?void 0:g.segmentPage)===s&&((l=this.showing)==null?void 0:l.startIndex)===c&&((m=this.showing)==null?void 0:m.endIndex)===d||(this._infoPopup&&this._infoPopup.dispose(),!this._univerInstanceService.getUnit(i,o.UniverInstanceType.UNIVER_DOC))))return this._showingLink$.next({unitId:i,linkId:t,segmentId:r,segmentPage:s,startIndex:c,endIndex:d}),this._infoPopup=this._docCanvasPopupManagerService.attachPopupToRange({collapsed:!1,startOffset:c,endOffset:d+1,segmentId:r,segmentPage:s},{componentKey:H.componentKey,direction:"top-center",multipleDirection:"top",onClickOutside:()=>{this.hideInfoPopup()}},i),this._infoPopup}hideInfoPopup(){var e;this._showingLink$.next(null),(e=this._infoPopup)==null||e.dispose()}};k=Ze([G(0,o.Inject(b.DocCanvasPopManagerService)),G(1,o.Inject(y.DocSelectionManagerService)),G(2,o.IUniverInstanceService)],k);var We=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Je=(n,e,t,i)=>{for(var r=i>1?void 0:i?Ge(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&We(e,t,r),r},J=(n,e)=>(t,i)=>e(t,i,n);let B=class extends o.Disposable{constructor(n,e,t){super(),this._commandService=n,this._univerInstanceService=e,this._docHyperLinkService=t,this._initSelectionChange()}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(n=>{var e,t,i;if(n.id===y.SetTextSelectionsOperation.id){const r=n.params,{unitId:s,ranges:c,segmentId:d}=r,a=this._univerInstanceService.getUnit(s,o.UniverInstanceType.UNIVER_DOC),v=c[0];if(v&&a){const{startOffset:u,endOffset:I,collapsed:g,segmentPage:l}=v,m=(t=(e=a.getSelfOrHeaderFooterModel(d))==null?void 0:e.getBody())==null?void 0:t.customRanges;if(g){const x=(i=m==null?void 0:m.findIndex(h=>h.startIndex<u&&h.endIndex>I-1))!=null?i:-1;if(x>-1){const h=m[x];this._docHyperLinkService.showInfoPopup({unitId:s,linkId:h.rangeId,segmentId:d,segmentPage:l,startIndex:h.startIndex,endIndex:h.endIndex});return}}else if(m==null?void 0:m.find(h=>h.startIndex<=u&&h.endIndex>=I-1))return}this._docHyperLinkService.hideInfoPopup(),this._docHyperLinkService.hideEditPopup()}}))}};B=Je([J(0,o.ICommandService),J(1,o.IUniverInstanceService),J(2,o.Inject(k))],B);var ze=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,Xe=(n,e,t,i)=>{for(var r=i>1?void 0:i?Qe(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&ze(e,t,r),r},T=(n,e)=>(t,i)=>e(t,i,n);let z=class extends o.Disposable{constructor(n,e,t,i,r,s){super(),this._context=n,this._docEventManagerService=e,this._commandService=t,this._hyperLinkPopupService=i,this._docSkeletonManagerService=r,this._docSelectionManagerService=s,!(this._context.unitId===o.DOCS_ZEN_EDITOR_UNIT_ID_KEY||this._context.unitId===o.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)&&(this._initHover(),this._initClick())}get _skeleton(){return this._docSkeletonManagerService.getSkeleton()}_hideInfoPopup(){this._hyperLinkPopupService.showing&&this._commandService.executeCommand(W.id)}_initHover(){this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe(n=>{var r;const e=n.find(s=>s.range.rangeType===o.CustomRangeType.HYPERLINK),t=this._docSelectionManagerService.getTextRanges(),i=t==null?void 0:t[0].segmentId;if(((r=e==null?void 0:e.segmentId)!=null?r:"")!==i){this._hideInfoPopup();return}e?this._commandService.executeCommand(W.id,{unitId:this._context.unitId,linkId:e.range.rangeId,segmentId:e.segmentId,segmentPage:e.segmentPageIndex,rangeId:e.range.rangeId,startIndex:e.range.startIndex,endIndex:e.range.endIndex}):this._hideInfoPopup()}))}_initClick(){this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe(n=>{const e=n.range;e&&this._commandService.executeCommand(ve.id,{unitId:this._context.unitId,linkId:e.rangeId,segmentId:n.segmentId})}))}};z=Xe([T(1,o.Inject(b.DocEventManagerService)),T(2,o.ICommandService),T(3,o.Inject(k)),T(4,o.Inject(y.DocSkeletonManagerService)),T(5,o.Inject(y.DocSelectionManagerService))],z);var qe=Object.defineProperty,en=Object.getOwnPropertyDescriptor,nn=(n,e,t,i)=>{for(var r=i>1?void 0:i?en(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&qe(e,t,r),r},Q=(n,e)=>(t,i)=>e(t,i,n);let X=class extends o.Disposable{constructor(n,e,t,i){super(),this._context=n,this._docInterceptorService=e,this._hyperLinkService=t,this._docRenderController=i,this._init(),this._initReRender()}_init(){this._docInterceptorService.intercept(y.DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{handler:(n,e,t)=>{if(!n)return t(n);const{unitId:i,index:r}=e,s=this._hyperLinkService.showing;if(!s)return t({...n,active:!1});const{linkId:c,unitId:d,startIndex:a,endIndex:v}=s,u=d===i&&n.rangeId===c&&r>=a&&r<=v;return t({...n,active:u})}})}_initReRender(){this.disposeWithMe(this._hyperLinkService.showingLink$.pipe(D.distinctUntilChanged((n,e)=>(n==null?void 0:n.linkId)===(e==null?void 0:e.linkId)&&(n==null?void 0:n.unitId)===(e==null?void 0:e.unitId)&&(n==null?void 0:n.startIndex)===(e==null?void 0:e.startIndex)),D.pairwise()).subscribe(([n,e])=>{e?e.unitId===this._context.unitId&&this._docRenderController.reRender(e.unitId):n&&n.unitId===this._context.unitId&&this._docRenderController.reRender(n.unitId)}))}};X=nn([Q(1,o.Inject(y.DocInterceptorService)),Q(2,o.Inject(k)),Q(3,o.Inject(b.DocRenderController))],X);const ge="doc-hyper-link-icon";function he(n){return{id:U.id,type:C.MenuItemType.BUTTON,icon:ge,title:"docLink.menu.tooltip",tooltip:"docLink.menu.tooltip",hidden$:C.getMenuHiddenObservable(n,o.UniverInstanceType.UNIVER_DOC),disabled$:new D.Observable(function(e){const i=n.get(y.DocSelectionManagerService).textSelection$.pipe(D.debounceTime(16)).subscribe(()=>{e.next(fe(n))});return()=>{i.unsubscribe()}})}}const tn={id:U.id,binding:C.MetaKeys.CTRL_COMMAND|C.KeyCode.K,description:"docLink.menu.tooltip",preconditions:b.whenDocAndEditorFocused},rn={[C.RibbonStartGroup.OTHERS]:{[U.id]:{order:0,menuItemFactory:he}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[U.id]:{order:0,menuItemFactory:he}}}};var on=Object.defineProperty,sn=Object.getOwnPropertyDescriptor,cn=(n,e,t,i)=>{for(var r=i>1?void 0:i?sn(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&on(e,t,r),r},A=(n,e)=>(t,i)=>e(t,i,n);let K=class extends o.Disposable{constructor(n,e,t,i){super(),this._componentManager=n,this._commandService=e,this._menuManagerService=t,this._shortcutService=i,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortcut()}_initComponents(){[[N,N.componentKey],[H,H.componentKey],[Z,ge]].forEach(([n,e])=>{this._componentManager.register(e,n)})}_initCommands(){[re,oe,pe,U,W,ve].forEach(n=>{this._commandService.registerCommand(n)})}_initShortcut(){[tn].forEach(n=>{this._shortcutService.registerShortcut(n)})}_initMenus(){this._menuManagerService.mergeMenu(rn)}};K=cn([A(0,o.Inject(C.ComponentManager)),A(1,o.ICommandService),A(2,C.IMenuManagerService),A(3,C.IShortcutService)],K);const dn="DOC_HYPER_LINK_UI_PLUGIN";var Ie=Object.defineProperty,an=Object.getOwnPropertyDescriptor,ln=(n,e,t)=>e in n?Ie(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,un=(n,e,t,i)=>{for(var r=i>1?void 0:i?an(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&Ie(e,t,r),r},q=(n,e)=>(t,i)=>e(t,i,n),me=(n,e,t)=>ln(n,typeof e!="symbol"?e+"":e,t);p.UniverDocsHyperLinkUIPlugin=class extends o.Plugin{constructor(e=ne,t,i,r){super(),this._config=e,this._injector=t,this._renderManagerSrv=i,this._configService=r;const{menu:s,...c}=o.merge({},ne,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(De,c)}onStarting(){[[k],[K],[B]].forEach(t=>{this._injector.add(t)}),this._injector.get(K)}onReady(){this._injector.get(B)}onRendered(){this._initRenderModule()}_initRenderModule(){[[X],[z]].forEach(e=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,e)})}},me(p.UniverDocsHyperLinkUIPlugin,"pluginName",dn),me(p.UniverDocsHyperLinkUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC),p.UniverDocsHyperLinkUIPlugin=un([o.DependentOn(E.UniverDocsHyperLinkPlugin),q(1,o.Inject(o.Injector)),q(2,Ee.IRenderManagerService),q(3,o.IConfigService)],p.UniverDocsHyperLinkUIPlugin),Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/docs-hyper-link"),require("@univerjs/engine-render"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/design"),require("@univerjs/ui"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-hyper-link","@univerjs/engine-render","@univerjs/docs","@univerjs/docs-ui","rxjs","react/jsx-runtime","@univerjs/design","@univerjs/ui","react"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverDocsHyperLinkUi={},global.UniverCore,global.UniverDocsHyperLink,global.UniverEngineRender,global.UniverDocs,global.UniverDocsUi,global.rxjs,global.React,global.UniverDesign,global.UniverUi,global.React))})(this,function(exports2,core,docsHyperLink,engineRender,docs,docsUi,rxjs,jsxRuntime,design,ui,react){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c,_d,_e,_f;const DOCS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY="docs-hyper-link-ui.config",defaultPluginConfig={},AddDocHyperLinkCommand={type:core.CommandType.COMMAND,id:"docs.command.add-hyper-link",async handler(accessor,params){if(!params)return!1;const{payload,unitId,selections}=params,commandService=accessor.get(core.ICommandService),id=core.generateRandomId(),doMutation=docs.addCustomRangeBySelectionFactory(accessor,{rangeId:id,rangeType:core.CustomRangeType.HYPERLINK,properties:{url:payload},unitId,selections});return doMutation?commandService.syncExecuteCommand(doMutation.id,doMutation.params):!1}},UpdateDocHyperLinkCommand={id:"docs.command.update-hyper-link",type:core.CommandType.COMMAND,handler(accessor,params){var _a2;if(!params)return!1;const{unitId,payload,segmentId,linkId}=params,commandService=accessor.get(core.ICommandService),univerInstanceService=accessor.get(core.IUniverInstanceService),currentSelection=accessor.get(docs.DocSelectionManagerService).getActiveTextRange(),doc=univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC);if(!currentSelection||!doc)return!1;const textRun=(_a2=core.getBodySlice(doc.getSelfOrHeaderFooterModel(segmentId).getBody(),currentSelection.startOffset,currentSelection.endOffset).textRuns)==null?void 0:_a2[0];textRun&&(textRun.ed=params.label.length+1);const replaceSelection=docs.replaceSelectionFactory(accessor,{unitId,body:{dataStream:`${params.label}`,customRanges:[{rangeId:linkId,rangeType:core.CustomRangeType.HYPERLINK,startIndex:0,endIndex:params.label.length+1,properties:{url:payload}}],textRuns:textRun?[textRun]:void 0},selection:{startOffset:currentSelection.startOffset,endOffset:currentSelection.endOffset,collapsed:!1,segmentId}});return replaceSelection?commandService.syncExecuteCommand(replaceSelection.id,replaceSelection.params):!1}},styles$1={docsLinkEdit:"univer-docs-link-edit",docsLinkEditTitle:"univer-docs-link-edit-title",docsLinkEditClose:"univer-docs-link-edit-close",docsLinkEditButtons:"univer-docs-link-edit-buttons",docsLinkEditButton:"univer-docs-link-edit-button"};function hasProtocol(urlString){return/^[a-zA-Z]+:\/\//.test(urlString)}__name(hasProtocol,"hasProtocol");function isEmail(url){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(url)}__name(isEmail,"isEmail");function transformUrl(urlStr){return hasProtocol(urlStr)?urlStr:isEmail(urlStr)?`mailto://${urlStr}`:`https://${urlStr}`}__name(transformUrl,"transformUrl");const DocHyperLinkEdit=__name(()=>{const hyperLinkService=core.useDependency(DocHyperLinkPopupService),localeService=core.useDependency(core.LocaleService),editing=core.useObservable(hyperLinkService.editingLink$),commandService=core.useDependency(core.ICommandService),univerInstanceService=core.useDependency(core.IUniverInstanceService),docSelectionManagerService=core.useDependency(docs.DocSelectionManagerService),[link,setLink]=react.useState(""),[label,setLabel]=react.useState(""),[showError,setShowError]=react.useState(!1),isLegal=core.Tools.isLegalUrl(link),doc=editing?univerInstanceService.getUnit(editing.unitId,core.UniverInstanceType.UNIVER_DOC):univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC);react.useEffect(()=>{var _a2,_b2,_c2,_d2,_e2,_f2,_g,_h,_i;const activeRange=docSelectionManagerService.getActiveTextRange();if(!activeRange)return;if(editing){const body2=(_a2=doc==null?void 0:doc.getSelfOrHeaderFooterModel(editing.segmentId))==null?void 0:_a2.getBody(),matchedRange2=(_b2=body2==null?void 0:body2.customRanges)==null?void 0:_b2.find(i=>(editing==null?void 0:editing.linkId)===i.rangeId&&i.startIndex===editing.startIndex&&i.endIndex===editing.endIndex);doc&&matchedRange2&&(setLink((_d2=(_c2=matchedRange2.properties)==null?void 0:_c2.url)!=null?_d2:""),setLabel(core.BuildTextUtils.transform.getPlainText(core.getBodySlice(body2,matchedRange2.startIndex,matchedRange2.endIndex+1).dataStream)));return}const body=(_e2=doc==null?void 0:doc.getSelfOrHeaderFooterModel(activeRange.segmentId))==null?void 0:_e2.getBody(),selection=body?activeRange:null,matchedRange=selection&&((_g=core.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection,(_f2=body==null?void 0:body.customRanges)!=null?_f2:[]))==null?void 0:_g[0]);doc&&matchedRange&&setLink((_i=(_h=matchedRange==null?void 0:matchedRange.properties)==null?void 0:_h.url)!=null?_i:"")},[doc,editing,docSelectionManagerService,univerInstanceService]);const handleCancel=__name(()=>{hyperLinkService.hideEditPopup()},"handleCancel"),handleConfirm=__name(()=>{if(setShowError(!0),!isLegal||!doc)return;const linkFinal=transformUrl(link);if(!editing)commandService.executeCommand(AddDocHyperLinkCommand.id,{unitId:doc.getUnitId(),payload:linkFinal});else{if(!label)return;commandService.executeCommand(UpdateDocHyperLinkCommand.id,{unitId:doc.getUnitId(),payload:linkFinal,linkId:editing.linkId,label,segmentId:editing.segmentId})}hyperLinkService.hideEditPopup()},"handleConfirm");if(doc)return jsxRuntime.jsxs("div",{className:styles$1.docsLinkEdit,children:[jsxRuntime.jsxs("div",{children:[editing?jsxRuntime.jsx(design.FormLayout,{label:localeService.t("docLink.edit.label"),error:showError&&!label?localeService.t("docLink.edit.labelError"):"",children:jsxRuntime.jsx(design.Input,{value:label,onChange:setLabel,autoFocus:!0,onKeyDown:__name(evt=>{evt.keyCode===ui.KeyCode.ENTER&&handleConfirm()},"onKeyDown")})}):null,jsxRuntime.jsx(design.FormLayout,{label:localeService.t("docLink.edit.address"),error:showError&&!isLegal?localeService.t("docLink.edit.addressError"):"",children:jsxRuntime.jsx(design.Input,{value:link,onChange:setLink,autoFocus:!0,onKeyDown:__name(evt=>{evt.keyCode===ui.KeyCode.ENTER&&handleConfirm()},"onKeyDown")})})]}),jsxRuntime.jsxs("div",{className:styles$1.docsLinkEditButtons,children:[jsxRuntime.jsx(design.Button,{className:styles$1.docsLinkEditButton,onClick:handleCancel,children:localeService.t("docLink.edit.cancel")}),jsxRuntime.jsx(design.Button,{disabled:!link,className:styles$1.docsLinkEditButton,type:"primary",onClick:handleConfirm,children:localeService.t("docLink.edit.confirm")})]})]})},"DocHyperLinkEdit");DocHyperLinkEdit.componentKey="docs-hyper-link-edit";var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=react.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=react.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return react.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid"),IconBase.displayName="UniverIcon";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CopySingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"copy-single",ref,icon:element$3}))});CopySingle.displayName="CopySingle";var element$2={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z"}}]},LinkSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"link-single",ref,icon:element$2}))});LinkSingle.displayName="LinkSingle";var element$1={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},UnlinkSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"unlink-single",ref,icon:element$1}))});UnlinkSingle.displayName="UnlinkSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},WriteSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"write-single",ref,icon:element}))});WriteSingle.displayName="WriteSingle";function r(e){var t,f,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}__name(r,"r");function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}__name(clsx,"clsx");const DeleteDocHyperLinkCommand={type:core.CommandType.COMMAND,id:"docs.command.delete-hyper-link",async handler(accessor,params){if(!params)return!1;const{unitId,linkId,segmentId}=params,commandService=accessor.get(core.ICommandService),doMutation=docs.deleteCustomRangeFactory(accessor,{unitId,rangeId:linkId,segmentId});return doMutation?await commandService.syncExecuteCommand(doMutation.id,doMutation.params):!1}},shouldDisableAddLink=__name(accessor=>{const textSelectionService=accessor.get(docs.DocSelectionManagerService),univerInstanceService=accessor.get(core.IUniverInstanceService),textRanges=textSelectionService.getTextRanges();if(!(textRanges!=null&&textRanges.length))return!0;const activeRange=textRanges[0];return!!(!univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC)||!activeRange||activeRange.collapsed)},"shouldDisableAddLink"),ShowDocHyperLinkEditPopupOperation={type:core.CommandType.OPERATION,id:"doc.operation.show-hyper-link-edit-popup",handler(accessor,params){var _a2;const linkInfo=params==null?void 0:params.link,univerInstanceService=accessor.get(core.IUniverInstanceService);if(shouldDisableAddLink(accessor)&&!linkInfo)return!1;const hyperLinkService=accessor.get(DocHyperLinkPopupService),unitId=(linkInfo==null?void 0:linkInfo.unitId)||((_a2=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC))==null?void 0:_a2.getUnitId());return unitId?(hyperLinkService.showEditPopup(unitId,linkInfo),!0):!1}},ToggleDocHyperLinkInfoPopupOperation={type:core.CommandType.OPERATION,id:"doc.operation.toggle-hyper-link-info-popup",handler(accessor,params){const hyperLinkService=accessor.get(DocHyperLinkPopupService);return params?(hyperLinkService.showInfoPopup(params),!0):(hyperLinkService.hideInfoPopup(),!0)}},ClickDocHyperLinkOperation={type:core.CommandType.OPERATION,id:"doc.operation.click-hyper-link",handler(accessor,params){var _a2,_b2,_c2;if(!params)return!1;const{unitId,linkId,segmentId}=params,doc=accessor.get(core.IUniverInstanceService).getUnit(unitId,core.UniverInstanceType.UNIVER_DOC),body=doc==null?void 0:doc.getSelfOrHeaderFooterModel(segmentId).getBody(),link=(_c2=(_b2=(_a2=body==null?void 0:body.customRanges)==null?void 0:_a2.find(range=>range.rangeId===linkId&&range.rangeType===core.CustomRangeType.HYPERLINK))==null?void 0:_b2.properties)==null?void 0:_c2.url;return link&&window.open(link,"_blank","noopener noreferrer"),!0}},styles={docLink:"univer-doc-link",docLinkType:"univer-doc-link-type",docLinkContent:"univer-doc-link-content",docLinkContentError:"univer-doc-link-content-error",docLinkUrl:"univer-doc-link-url",docLinkOperations:"univer-doc-link-operations",docLinkOperation:"univer-doc-link-operation",docLinkOperationError:"univer-doc-link-operation-error"},DocLinkPopup=__name(()=>{var _a2,_b2;const hyperLinkService=core.useDependency(DocHyperLinkPopupService),commandService=core.useDependency(core.ICommandService),messageService=core.useDependency(ui.IMessageService),localeService=core.useDependency(core.LocaleService),currentPopup=ui.useObservable(hyperLinkService.showingLink$),univerInstanceService=core.useDependency(core.IUniverInstanceService);if(!currentPopup)return null;const{unitId,linkId,segmentId,startIndex,endIndex}=currentPopup,doc=univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC),body=doc==null?void 0:doc.getSelfOrHeaderFooterModel(segmentId).getBody(),link=(_a2=body==null?void 0:body.customRanges)==null?void 0:_a2.find(range=>range.rangeId===linkId&&range.rangeType===core.CustomRangeType.HYPERLINK&&range.startIndex===startIndex&&range.endIndex===endIndex);if(!link)return null;const url=(_b2=link.properties)==null?void 0:_b2.url;return jsxRuntime.jsxs("div",{className:styles.docLink,onClick:__name(()=>{hyperLinkService.hideInfoPopup()},"onClick"),children:[jsxRuntime.jsxs("div",{className:clsx(styles.docLinkContent),onClick:__name(()=>window.open(url),"onClick"),children:[jsxRuntime.jsx("div",{className:styles.docLinkType,children:jsxRuntime.jsx(LinkSingle,{})}),jsxRuntime.jsx(design.Tooltip,{showIfEllipsis:!0,title:url,children:jsxRuntime.jsx("span",{className:styles.docLinkUrl,children:url})})]}),jsxRuntime.jsxs("div",{className:styles.docLinkOperations,children:[jsxRuntime.jsx("div",{className:clsx(styles.docLinkOperation),onClick:__name(()=>{navigator.clipboard.writeText(url),messageService.show({content:localeService.t("docLink.info.coped"),type:design.MessageType.Info})},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("docLink.info.copy"),children:jsxRuntime.jsx(CopySingle,{})})}),jsxRuntime.jsx("div",{className:styles.docLinkOperation,onClick:__name(()=>{commandService.executeCommand(ShowDocHyperLinkEditPopupOperation.id,{link:currentPopup})},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("docLink.info.edit"),children:jsxRuntime.jsx(WriteSingle,{})})}),jsxRuntime.jsx("div",{className:styles.docLinkOperation,onClick:__name(()=>{commandService.executeCommand(DeleteDocHyperLinkCommand.id,{unitId,linkId:link.rangeId,segmentId})},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("docLink.info.cancel"),children:jsxRuntime.jsx(UnlinkSingle,{})})})]})]})},"DocLinkPopup");DocLinkPopup.componentKey="univer.doc.link-info-popup";var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$5");let DocHyperLinkPopupService=(_a=class extends core.Disposable{constructor(_docCanvasPopupManagerService,_textSelectionManagerService,_univerInstanceService){super();__publicField(this,"_editingLink$",new rxjs.BehaviorSubject(null));__publicField(this,"_showingLink$",new rxjs.BehaviorSubject(null));__publicField(this,"editingLink$",this._editingLink$.asObservable());__publicField(this,"showingLink$",this._showingLink$.asObservable());__publicField(this,"_editPopup",null);__publicField(this,"_infoPopup",null);this._docCanvasPopupManagerService=_docCanvasPopupManagerService,this._textSelectionManagerService=_textSelectionManagerService,this._univerInstanceService=_univerInstanceService,this.disposeWithMe(()=>{this._editingLink$.complete(),this._showingLink$.complete()})}get editing(){return this._editingLink$.value}get showing(){return this._showingLink$.value}showEditPopup(unitId,linkInfo){this._editPopup&&this._editPopup.dispose(),this._editingLink$.next(linkInfo);const textRanges=this._textSelectionManagerService.getTextRanges({unitId,subUnitId:unitId});let activeRange=textRanges==null?void 0:textRanges[textRanges.length-1];if(linkInfo){const{segmentId,segmentPage,startIndex,endIndex}=linkInfo;activeRange={collapsed:!1,startOffset:startIndex,endOffset:endIndex+1,segmentId,segmentPage},this._textSelectionManagerService.replaceDocRanges([{startOffset:startIndex,endOffset:endIndex+1}])}return activeRange?(this._editPopup=this._docCanvasPopupManagerService.attachPopupToRange(activeRange,{componentKey:DocHyperLinkEdit.componentKey,direction:"bottom"},unitId),this._editPopup):null}hideEditPopup(){var _a2;this._editingLink$.next(null),(_a2=this._editPopup)==null||_a2.dispose()}showInfoPopup(info){var _a2,_b2,_c2,_d2,_e2,_f2;const{linkId,unitId,segmentId,segmentPage,startIndex,endIndex}=info;if(!(((_a2=this.showing)==null?void 0:_a2.linkId)===linkId&&((_b2=this.showing)==null?void 0:_b2.unitId)===unitId&&((_c2=this.showing)==null?void 0:_c2.segmentId)===segmentId&&((_d2=this.showing)==null?void 0:_d2.segmentPage)===segmentPage&&((_e2=this.showing)==null?void 0:_e2.startIndex)===startIndex&&((_f2=this.showing)==null?void 0:_f2.endIndex)===endIndex||(this._infoPopup&&this._infoPopup.dispose(),!this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC))))return this._showingLink$.next({unitId,linkId,segmentId,segmentPage,startIndex,endIndex}),this._infoPopup=this._docCanvasPopupManagerService.attachPopupToRange({collapsed:!1,startOffset:startIndex,endOffset:endIndex+1,segmentId,segmentPage},{componentKey:DocLinkPopup.componentKey,direction:"top-center",multipleDirection:"top",onClickOutside:__name(()=>{this.hideInfoPopup()},"onClickOutside")},unitId),this._infoPopup}hideInfoPopup(){var _a2;this._showingLink$.next(null),(_a2=this._infoPopup)==null||_a2.dispose()}},__name(_a,"DocHyperLinkPopupService"),_a);DocHyperLinkPopupService=__decorateClass$5([__decorateParam$5(0,core.Inject(docsUi.DocCanvasPopManagerService)),__decorateParam$5(1,core.Inject(docs.DocSelectionManagerService)),__decorateParam$5(2,core.IUniverInstanceService)],DocHyperLinkPopupService);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4");let DocHyperLinkSelectionController=(_b=class extends core.Disposable{constructor(_commandService,_univerInstanceService,_docHyperLinkService){super(),this._commandService=_commandService,this._univerInstanceService=_univerInstanceService,this._docHyperLinkService=_docHyperLinkService,this._initSelectionChange()}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{var _a2,_b2,_c2;if(commandInfo.id===docs.SetTextSelectionsOperation.id){const params=commandInfo.params,{unitId,ranges,segmentId}=params,doc=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC),primary=ranges[0];if(primary&&doc){const{startOffset,endOffset,collapsed,segmentPage}=primary,customRanges=(_b2=(_a2=doc.getSelfOrHeaderFooterModel(segmentId))==null?void 0:_a2.getBody())==null?void 0:_b2.customRanges;if(collapsed){const index=(_c2=customRanges==null?void 0:customRanges.findIndex(value=>value.startIndex<startOffset&&value.endIndex>endOffset-1))!=null?_c2:-1;if(index>-1){const customRange=customRanges[index];this._docHyperLinkService.showInfoPopup({unitId,linkId:customRange.rangeId,segmentId,segmentPage,startIndex:customRange.startIndex,endIndex:customRange.endIndex});return}}else if(customRanges==null?void 0:customRanges.find(value=>value.startIndex<=startOffset&&value.endIndex>=endOffset-1))return}this._docHyperLinkService.hideInfoPopup(),this._docHyperLinkService.hideEditPopup()}}))}},__name(_b,"DocHyperLinkSelectionController"),_b);DocHyperLinkSelectionController=__decorateClass$4([__decorateParam$4(0,core.ICommandService),__decorateParam$4(1,core.IUniverInstanceService),__decorateParam$4(2,core.Inject(DocHyperLinkPopupService))],DocHyperLinkSelectionController);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3");let DocHyperLinkEventRenderController=(_c=class extends core.Disposable{constructor(_context,_docEventManagerService,_commandService,_hyperLinkPopupService,_docSkeletonManagerService,_docSelectionManagerService){super(),this._context=_context,this._docEventManagerService=_docEventManagerService,this._commandService=_commandService,this._hyperLinkPopupService=_hyperLinkPopupService,this._docSkeletonManagerService=_docSkeletonManagerService,this._docSelectionManagerService=_docSelectionManagerService,!(this._context.unitId===core.DOCS_ZEN_EDITOR_UNIT_ID_KEY||this._context.unitId===core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)&&(this._initHover(),this._initClick())}get _skeleton(){return this._docSkeletonManagerService.getSkeleton()}_hideInfoPopup(){this._hyperLinkPopupService.showing&&this._commandService.executeCommand(ToggleDocHyperLinkInfoPopupOperation.id)}_initHover(){this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe(ranges=>{var _a2;const link=ranges.find(range=>range.range.rangeType===core.CustomRangeType.HYPERLINK),activeRanges=this._docSelectionManagerService.getTextRanges(),currentSegmentId=activeRanges==null?void 0:activeRanges[0].segmentId;if(((_a2=link==null?void 0:link.segmentId)!=null?_a2:"")!==currentSegmentId){this._hideInfoPopup();return}link?this._commandService.executeCommand(ToggleDocHyperLinkInfoPopupOperation.id,{unitId:this._context.unitId,linkId:link.range.rangeId,segmentId:link.segmentId,segmentPage:link.segmentPageIndex,rangeId:link.range.rangeId,startIndex:link.range.startIndex,endIndex:link.range.endIndex}):this._hideInfoPopup()}))}_initClick(){this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe(range=>{const link=range.range;link&&this._commandService.executeCommand(ClickDocHyperLinkOperation.id,{unitId:this._context.unitId,linkId:link.rangeId,segmentId:range.segmentId})}))}},__name(_c,"DocHyperLinkEventRenderController"),_c);DocHyperLinkEventRenderController=__decorateClass$3([__decorateParam$3(1,core.Inject(docsUi.DocEventManagerService)),__decorateParam$3(2,core.ICommandService),__decorateParam$3(3,core.Inject(DocHyperLinkPopupService)),__decorateParam$3(4,core.Inject(docs.DocSkeletonManagerService)),__decorateParam$3(5,core.Inject(docs.DocSelectionManagerService))],DocHyperLinkEventRenderController);var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");let DocHyperLinkRenderController=(_d=class extends core.Disposable{constructor(_context,_docInterceptorService,_hyperLinkService,_docRenderController){super(),this._context=_context,this._docInterceptorService=_docInterceptorService,this._hyperLinkService=_hyperLinkService,this._docRenderController=_docRenderController,this._init(),this._initReRender()}_init(){this._docInterceptorService.intercept(docs.DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{handler:__name((data,pos,next)=>{if(!data)return next(data);const{unitId,index}=pos,activeLink=this._hyperLinkService.showing;if(!activeLink)return next({...data,active:!1});const{linkId,unitId:linkUnitId,startIndex,endIndex}=activeLink,isActive=linkUnitId===unitId&&data.rangeId===linkId&&index>=startIndex&&index<=endIndex;return next({...data,active:isActive})},"handler")})}_initReRender(){this.disposeWithMe(this._hyperLinkService.showingLink$.pipe(rxjs.distinctUntilChanged((prev,aft)=>(prev==null?void 0:prev.linkId)===(aft==null?void 0:aft.linkId)&&(prev==null?void 0:prev.unitId)===(aft==null?void 0:aft.unitId)&&(prev==null?void 0:prev.startIndex)===(aft==null?void 0:aft.startIndex)),rxjs.pairwise()).subscribe(([preLink,link])=>{link?link.unitId===this._context.unitId&&this._docRenderController.reRender(link.unitId):preLink&&preLink.unitId===this._context.unitId&&this._docRenderController.reRender(preLink.unitId)}))}},__name(_d,"DocHyperLinkRenderController"),_d);DocHyperLinkRenderController=__decorateClass$2([__decorateParam$2(1,core.Inject(docs.DocInterceptorService)),__decorateParam$2(2,core.Inject(DocHyperLinkPopupService)),__decorateParam$2(3,core.Inject(docsUi.DocRenderController))],DocHyperLinkRenderController);const DOC_LINK_ICON="doc-hyper-link-icon";function AddHyperLinkMenuItemFactory(accessor){return{id:ShowDocHyperLinkEditPopupOperation.id,type:ui.MenuItemType.BUTTON,icon:DOC_LINK_ICON,title:"docLink.menu.tooltip",tooltip:"docLink.menu.tooltip",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC),disabled$:new rxjs.Observable(function(subscribe){const observer=accessor.get(docs.DocSelectionManagerService).textSelection$.pipe(rxjs.debounceTime(16)).subscribe(()=>{subscribe.next(shouldDisableAddLink(accessor))});return()=>{observer.unsubscribe()}})}}__name(AddHyperLinkMenuItemFactory,"AddHyperLinkMenuItemFactory");const addLinkShortcut={id:ShowDocHyperLinkEditPopupOperation.id,binding:ui.MetaKeys.CTRL_COMMAND|ui.KeyCode.K,description:"docLink.menu.tooltip",preconditions:docsUi.whenDocAndEditorFocused},menuSchema={[ui.RibbonStartGroup.OTHERS]:{[ShowDocHyperLinkEditPopupOperation.id]:{order:0,menuItemFactory:AddHyperLinkMenuItemFactory}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.DATA]:{[ShowDocHyperLinkEditPopupOperation.id]:{order:0,menuItemFactory:AddHyperLinkMenuItemFactory}}}};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");let DocHyperLinkUIController=(_e=class extends core.Disposable{constructor(_componentManager,_commandService,_menuManagerService,_shortcutService){super(),this._componentManager=_componentManager,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._shortcutService=_shortcutService,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortcut()}_initComponents(){[[DocHyperLinkEdit,DocHyperLinkEdit.componentKey],[DocLinkPopup,DocLinkPopup.componentKey],[LinkSingle,DOC_LINK_ICON]].forEach(([comp,key])=>{this._componentManager.register(key,comp)})}_initCommands(){[AddDocHyperLinkCommand,UpdateDocHyperLinkCommand,DeleteDocHyperLinkCommand,ShowDocHyperLinkEditPopupOperation,ToggleDocHyperLinkInfoPopupOperation,ClickDocHyperLinkOperation].forEach(command=>{this._commandService.registerCommand(command)})}_initShortcut(){[addLinkShortcut].forEach(shortcut=>{this._shortcutService.registerShortcut(shortcut)})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}},__name(_e,"DocHyperLinkUIController"),_e);DocHyperLinkUIController=__decorateClass$1([__decorateParam$1(0,core.Inject(ui.ComponentManager)),__decorateParam$1(1,core.ICommandService),__decorateParam$1(2,ui.IMenuManagerService),__decorateParam$1(3,ui.IShortcutService)],DocHyperLinkUIController);const DOC_HYPER_LINK_UI_PLUGIN="DOC_HYPER_LINK_UI_PLUGIN";var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");exports2.UniverDocsHyperLinkUIPlugin=(_f=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_renderManagerSrv,_configService){super(),this._config=_config,this._injector=_injector,this._renderManagerSrv=_renderManagerSrv,this._configService=_configService;const{menu,...rest}=core.merge({},defaultPluginConfig,this._config);menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(DOCS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY,rest)}onStarting(){[[DocHyperLinkPopupService],[DocHyperLinkUIController],[DocHyperLinkSelectionController]].forEach(dep=>{this._injector.add(dep)}),this._injector.get(DocHyperLinkUIController)}onReady(){this._injector.get(DocHyperLinkSelectionController)}onRendered(){this._initRenderModule()}_initRenderModule(){[[DocHyperLinkRenderController],[DocHyperLinkEventRenderController]].forEach(dep=>{this._renderManagerSrv.registerRenderModule(core.UniverInstanceType.UNIVER_DOC,dep)})}},__name(_f,"UniverDocsHyperLinkUIPlugin"),_f),__publicField2(exports2.UniverDocsHyperLinkUIPlugin,"pluginName",DOC_HYPER_LINK_UI_PLUGIN),__publicField2(exports2.UniverDocsHyperLinkUIPlugin,"type",core.UniverInstanceType.UNIVER_DOC),exports2.UniverDocsHyperLinkUIPlugin=__decorateClass([core.DependentOn(docsHyperLink.UniverDocsHyperLinkPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,engineRender.IRenderManagerService),__decorateParam(3,core.IConfigService)],exports2.UniverDocsHyperLinkUIPlugin),Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverDocsHyperLinkUiEnUS=n())})(this,function(){"use strict";return{docLink:{edit:{confirm:"Confirm",cancel:"Cancel",title:"Link",address:"Link",placeholder:"Please input a link url",addressError:"Url is illegal!",label:"Label",labelError:"Please input label of link"},info:{copy:"Copy",edit:"Edit",cancel:"Cancel link",coped:"Link copied to clipboard"},menu:{tooltip:"Add link"}}}});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverDocsHyperLinkUiEnUS=factory())})(this,function(){"use strict";return{docLink:{edit:{confirm:"Confirm",cancel:"Cancel",title:"Link",address:"Link",placeholder:"Please input a link url",addressError:"Url is illegal!",label:"Label",labelError:"Please input label of link"},info:{copy:"Copy",edit:"Edit",cancel:"Cancel link",coped:"Link copied to clipboard"},menu:{tooltip:"Add link"}}}});
@@ -1 +1 @@
1
- (function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverDocsHyperLinkUiFaIR=o())})(this,function(){"use strict";return{docLink:{edit:{confirm:"تایید",cancel:"انصراف",title:"لینک",address:"لینک",placeholder:"لطفا یک آدرس لینک وارد کنید",addressError:"آدرس غیرمجاز است!",label:"برچسب",labelError:"لطفا برچسب لینک را وارد کنید"},info:{copy:"کپی",edit:"ویرایش",cancel:"لینک را لغو کنید",coped:"لینک به کلیپ بورد کپی شد"},menu:{tooltip:"افزودن لینک"}}}});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverDocsHyperLinkUiFaIR=factory())})(this,function(){"use strict";return{docLink:{edit:{confirm:"تایید",cancel:"انصراف",title:"لینک",address:"لینک",placeholder:"لطفا یک آدرس لینک وارد کنید",addressError:"آدرس غیرمجاز است!",label:"برچسب",labelError:"لطفا برچسب لینک را وارد کنید"},info:{copy:"کپی",edit:"ویرایش",cancel:"لینک را لغو کنید",coped:"لینک به کلیپ بورد کپی شد"},menu:{tooltip:"افزودن لینک"}}}});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverDocsHyperLinkUiFrFR=n())})(this,function(){"use strict";return{docLink:{edit:{confirm:"Confirmer",cancel:"Annuler",title:"Lien",address:"Link",placeholder:"Veuillez entrer un lien",addressError:"L'url est illégal!",label:"Label",labelError:"Veuillez entrer le label du lien"},info:{copy:"Copy",edit:"Edit",cancel:"Cancel link",coped:"Link copied to clipboard"},menu:{tooltip:"Add link"}}}});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverDocsHyperLinkUiFrFR=factory())})(this,function(){"use strict";return{docLink:{edit:{confirm:"Confirmer",cancel:"Annuler",title:"Lien",address:"Link",placeholder:"Veuillez entrer un lien",addressError:"L'url est illégal!",label:"Label",labelError:"Veuillez entrer le label du lien"},info:{copy:"Copy",edit:"Edit",cancel:"Cancel link",coped:"Link copied to clipboard"},menu:{tooltip:"Add link"}}}});
@@ -1 +1 @@
1
- (function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverDocsHyperLinkUiRuRU=i())})(this,function(){"use strict";return{docLink:{edit:{confirm:"Подтвердить",cancel:"Отменить",title:"Ссылка",address:"Cсылки",label:"Текст",labelError:"Введите текст ссылки",placeholder:"Пожалуйста, введите URL ссылки",addressError:"URL некорректен!"},info:{copy:"Копировать",edit:"Редактировать",cancel:"Отменить ссылку",coped:"Link copied to clipboard"},menu:{tooltip:"Добавить ссылку"}}}});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverDocsHyperLinkUiRuRU=factory())})(this,function(){"use strict";return{docLink:{edit:{confirm:"Подтвердить",cancel:"Отменить",title:"Ссылка",address:"Cсылки",label:"Текст",labelError:"Введите текст ссылки",placeholder:"Пожалуйста, введите URL ссылки",addressError:"URL некорректен!"},info:{copy:"Копировать",edit:"Редактировать",cancel:"Отменить ссылку",coped:"Link copied to clipboard"},menu:{tooltip:"Добавить ссылку"}}}});
@@ -1 +1 @@
1
- (function(n,e){typeof exports=="object"&&typeof module<"u"?module.exports=e():typeof define=="function"&&define.amd?define(e):(n=typeof globalThis<"u"?globalThis:n||self,n.UniverDocsHyperLinkUiViVN=e())})(this,function(){"use strict";return{docLink:{edit:{confirm:"Xác nhận",cancel:"Hủy",title:"Liên kết",address:"Liên kết",label:"Nhãn",labelError:"Vui lòng nhập nhãn liên kết",placeholder:"Vui lòng nhập liên kết hợp lệ",addressError:"Vui lòng nhập liên kết hợp lệ"},info:{copy:"Sao chép",edit:"Chỉnh sửa",cancel:"Hủy liên kết",coped:"Liên kết đã được sao chép vào clipboard"},menu:{tooltip:"Thêm liên kết"}}}});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverDocsHyperLinkUiViVN=factory())})(this,function(){"use strict";return{docLink:{edit:{confirm:"Xác nhận",cancel:"Hủy",title:"Liên kết",address:"Liên kết",label:"Nhãn",labelError:"Vui lòng nhập nhãn liên kết",placeholder:"Vui lòng nhập liên kết hợp lệ",addressError:"Vui lòng nhập liên kết hợp lệ"},info:{copy:"Sao chép",edit:"Chỉnh sửa",cancel:"Hủy liên kết",coped:"Liên kết đã được sao chép vào clipboard"},menu:{tooltip:"Thêm liên kết"}}}});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverDocsHyperLinkUiZhCN=n())})(this,function(){"use strict";return{docLink:{edit:{confirm:"确认",cancel:"取消",title:"链接",address:"链接",label:"文本",labelError:"请输入链接文本",placeholder:"请输入合法的链接",addressError:"请输入合法的链接"},info:{copy:"复制",edit:"编辑",cancel:"取消链接",coped:"链接已被复制到剪贴板"},menu:{tooltip:"添加链接"}}}});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverDocsHyperLinkUiZhCN=factory())})(this,function(){"use strict";return{docLink:{edit:{confirm:"确认",cancel:"取消",title:"链接",address:"链接",label:"文本",labelError:"请输入链接文本",placeholder:"请输入合法的链接",addressError:"请输入合法的链接"},info:{copy:"复制",edit:"编辑",cancel:"取消链接",coped:"链接已被复制到剪贴板"},menu:{tooltip:"添加链接"}}}});
@@ -1 +1 @@
1
- (function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverDocsHyperLinkUiZhTW=o())})(this,function(){"use strict";return{docLink:{edit:{confirm:"確認",cancel:"取消",title:"連結",address:"連結",label:"文本",labelError:"请输入链接文本",placeholder:"請輸入合法的連結",addressError:"請輸入合法的連結"},info:{copy:"複製",edit:"編輯",cancel:"取消連結",coped:"連結已複製到剪貼板"},menu:{tooltip:"新增連結"}}}});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverDocsHyperLinkUiZhTW=factory())})(this,function(){"use strict";return{docLink:{edit:{confirm:"確認",cancel:"取消",title:"連結",address:"連結",label:"文本",labelError:"请输入链接文本",placeholder:"請輸入合法的連結",addressError:"請輸入合法的連結"},info:{copy:"複製",edit:"編輯",cancel:"取消連結",coped:"連結已複製到剪貼板"},menu:{tooltip:"新增連結"}}}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/docs-hyper-link-ui",
3
- "version": "0.5.5-nightly.202501211606",
3
+ "version": "0.5.5-nightly.202501221606",
4
4
  "private": false,
5
5
  "description": "Univer thread comment plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -48,19 +48,19 @@
48
48
  "lib"
49
49
  ],
50
50
  "peerDependencies": {
51
- "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
51
+ "react": ">=16.9.0 || >=17 || >=18 || >=19",
52
52
  "rxjs": ">=7.0.0"
53
53
  },
54
54
  "dependencies": {
55
55
  "@univerjs/icons": "^0.2.12",
56
56
  "clsx": "^2.1.1",
57
- "@univerjs/core": "0.5.5-nightly.202501211606",
58
- "@univerjs/docs-ui": "0.5.5-nightly.202501211606",
59
- "@univerjs/docs-hyper-link": "0.5.5-nightly.202501211606",
60
- "@univerjs/engine-render": "0.5.5-nightly.202501211606",
61
- "@univerjs/design": "0.5.5-nightly.202501211606",
62
- "@univerjs/docs": "0.5.5-nightly.202501211606",
63
- "@univerjs/ui": "0.5.5-nightly.202501211606"
57
+ "@univerjs/core": "0.5.5-nightly.202501221606",
58
+ "@univerjs/design": "0.5.5-nightly.202501221606",
59
+ "@univerjs/docs": "0.5.5-nightly.202501221606",
60
+ "@univerjs/docs-hyper-link": "0.5.5-nightly.202501221606",
61
+ "@univerjs/engine-render": "0.5.5-nightly.202501221606",
62
+ "@univerjs/ui": "0.5.5-nightly.202501221606",
63
+ "@univerjs/docs-ui": "0.5.5-nightly.202501221606"
64
64
  },
65
65
  "devDependencies": {
66
66
  "postcss": "^8.4.49",