@univerjs/sheets-zen-editor 0.1.16 → 0.2.0

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,4 +1,4 @@
1
- "use strict";var te=Object.defineProperty;var ne=(n,e,i)=>e in n?te(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var I=(n,e,i)=>ne(n,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),S=require("@wendellhu/redi"),C=require("@univerjs/docs"),M=require("@univerjs/engine-render"),N=require("@univerjs/sheets-ui"),_=require("@univerjs/ui"),q=require("rxjs"),T=require("@univerjs/sheets"),p=require("react"),L=require("@wendellhu/redi/react-bindings"),W=require("clsx"),V={id:"zen-editor.operation.open-zen-editor",type:a.CommandType.OPERATION,handler:n=>!0};class ie{constructor(){I(this,"_position",null);I(this,"_position$",new q.BehaviorSubject(null));I(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(e){this._position=e,this._refresh(e)}getPosition(){return this._position}_refresh(e){this._position$.next(e)}}const k=S.createIdentifier("univer.sheet-zen-editor-manager.service");var re=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,se=(n,e,i,t)=>{for(var r=t>1?void 0:t?oe(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&re(e,i,r),r},g=(n,e)=>(i,t)=>e(i,t,n);const h="__defaultDocumentZenEditorSpecialUnitId_20231218__";let P=class extends a.RxDisposable{constructor(e,i,t,r,o,s,c,d,l,u,f){super();I(this,"_zenEditorInitialState",!1);this._injector=e,this._univerInstanceService=i,this._zenEditorManagerService=t,this._renderManagerService=r,this._commandService=o,this._zenZoneService=s,this._editorBridgeService=c,this._undoRedoService=d,this._textSelectionManagerService=l,this._docSkeletonManagerService=u,this._docViewModelManagerService=f,this._initialize()}_initialize(){this._syncZenEditorSize(),this._commandExecutedListener()}_createZenEditorInstance(){const e={id:h,body:{dataStream:`${a.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],paragraphs:[{startIndex:0}]},documentStyle:{pageSize:{width:595,height:842},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}}};return this._univerInstanceService.createUnit(a.UniverInstanceType.UNIVER_DOC,e)}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(q.takeUntil(this.dispose$)).subscribe(e=>{var d;if(e==null)return;const i=N.getEditorObject(h,this._renderManagerService),t=this._univerInstanceService.getUniverDocInstance(h);if(i==null||t==null)return;const{width:r,height:o}=e,{engine:s}=i,c=(d=this._docSkeletonManagerService.getSkeletonByUnitId(h))==null?void 0:d.skeleton;requestIdleCallback(()=>{s.resizeBySize(r,o),this._calculatePagePosition(i),c&&this._textSelectionManagerService.refreshSelection()})})}_handleOpenZenEditor(){this._zenEditorInitialState||(this._createZenEditorInstance(),this._zenEditorInitialState=!0),this._zenZoneService.open(),this._undoRedoService.clearUndoRedo(h),this._univerInstanceService.focusUnit(h),this._univerInstanceService.setCurrentUnitForType(h),this._editorBridgeService.isVisible().visible===!1&&this._editorBridgeService.changeVisible({visible:!0,eventType:M.DeviceInputEventType.PointerDown});const i=this._editorBridgeService.getLatestEditCellState();if(i==null)return;this._editorSyncHandler(i);const t=[{startOffset:0,endOffset:0}];this._textSelectionManagerService.replaceTextRanges(t)}_editorSyncHandler(e){var s,c;const i=(s=e.documentLayoutObject.documentModel)==null?void 0:s.getBody(),t=i==null?void 0:i.dataStream,r=i==null?void 0:i.paragraphs;let o=[];t==null||r==null||((c=i==null?void 0:i.textRuns)!=null&&c.length&&(o=i==null?void 0:i.textRuns),this._syncContentAndRender(h,t,r,o))}_syncContentAndRender(e,i,t,r=[]){const o=[h,a.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,a.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY],s=this._docSkeletonManagerService.getSkeletonByUnitId(e),c=this._univerInstanceService.getUniverDocInstance(e),d=this._docViewModelManagerService.getViewModel(e);if(c==null||d==null||s==null)return;const l=c.getBody();l.dataStream=i,l.paragraphs=t,e===a.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&(l.textRuns=[]),r.length>0&&(l.textRuns=r),d.reset(c);const{skeleton:u}=s,f=this._getDocObject();f!=null&&(u.calculate(),o.includes(e)&&f.document.makeDirty())}_calculatePagePosition(e){const{document:i,scene:t,docBackground:r}=e,o=t==null?void 0:t.getParent(),{width:s,height:c,pageMarginLeft:d,pageMarginTop:l}=i;if(o==null||s===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:u,height:f}=o;let O=0,z=0,D=0,Z=0,x=Number.POSITIVE_INFINITY;const{scaleX:y,scaleY:Q}=t.getAncestorScale();u>(s+d*2)*y?(O=u/2-s*y/2,O/=y,D=(u-d*2)/y,x=0):(O=d,D=s+d*2,x=(D-u/y)/2),f>c?(z=f/2-c/2,Z=(f-l*2)/Q):(z=l,Z=c+l*2),t.resize(D,Z+200),i.translate(O,z),r.translate(O,z);const w=t.getViewport(C.VIEWPORT_KEY.VIEW_MAIN);if(x!==Number.POSITIVE_INFINITY&&w!=null){const ee=w.transScroll2ViewportScrollValue(x,0).x;w.scrollTo({x:ee})}return this}_commandExecutedListener(){const e=[V.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{e.includes(t.id)&&this._handleOpenZenEditor()}));const i=[C.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(i.includes(t.id)){const r=t.params,{unitId:o}=r;if(o===h){const s=this._univerInstanceService.getUniverDocInstance(o),c=s==null?void 0:s.getBody(),d=c==null?void 0:c.dataStream,l=c==null?void 0:c.paragraphs,u=c==null?void 0:c.textRuns;if(this._editorBridgeService.changeEditorDirty(!0),d==null||l==null)return;this._syncContentAndRender(a.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,d,l,u)}}}))}_getDocObject(){return C.getDocObject(this._univerInstanceService,this._renderManagerService)}};P=se([a.OnLifecycle(a.LifecycleStages.Steady,P),g(0,S.Inject(S.Injector)),g(1,a.IUniverInstanceService),g(2,k),g(3,M.IRenderManagerService),g(4,a.ICommandService),g(5,_.IZenZoneService),g(6,N.IEditorBridgeService),g(7,a.IUndoRedoService),g(8,S.Inject(C.TextSelectionManagerService)),g(9,S.Inject(C.DocSkeletonManagerService)),g(10,S.Inject(C.DocViewModelManagerService))],P);const A={id:"zen-editor.command.cancel-zen-edit",type:a.CommandType.COMMAND,handler:async n=>{const e=n.get(_.IZenZoneService),i=n.get(N.IEditorBridgeService),t=n.get(a.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:M.DeviceInputEventType.Keyboard,keycode:_.KeyCode.ESC}),e.close();const o=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);return o?(t.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},B={id:"zen-editor.command.confirm-zen-edit",type:a.CommandType.COMMAND,handler:async n=>{const e=n.get(_.IZenZoneService),i=n.get(N.IEditorBridgeService),t=n.get(a.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:M.DeviceInputEventType.PointerDown}),e.close();const o=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);return o?(t.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}};function ce(n){return{id:V.id,group:_.MenuGroup.CONTEXT_MENU_OTHERS,type:_.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",positions:[_.MenuPosition.CONTEXT_MENU],disabled$:N.getCurrentRangeDisable$(n,{workbookTypes:[T.WorkbookEditablePermission],worksheetTypes:[T.WorksheetEditPermission,T.WorksheetSetCellValuePermission,T.WorksheetSetCellStylePermission],rangeTypes:[T.RangeProtectionPermissionEditPoint]})}}var Y={exports:{}},j={};/**
1
+ "use strict";var te=Object.defineProperty;var ne=(n,e,i)=>e in n?te(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var E=(n,e,i)=>ne(n,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),p=require("@wendellhu/redi"),O=require("@univerjs/docs"),N=require("@univerjs/engine-render"),D=require("@univerjs/sheets-ui"),_=require("@univerjs/ui"),q=require("rxjs"),T=require("@univerjs/sheets"),f=require("react"),B=require("@wendellhu/redi/react-bindings"),F=require("clsx"),j={id:"zen-editor.operation.open-zen-editor",type:c.CommandType.OPERATION,handler:n=>!0};class ie{constructor(){E(this,"_position",null);E(this,"_position$",new q.BehaviorSubject(null));E(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(e){this._position=e,this._refresh(e)}getPosition(){return this._position}_refresh(e){this._position$.next(e)}}const $=p.createIdentifier("univer.sheet-zen-editor-manager.service");var re=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,se=(n,e,i,t)=>{for(var r=t>1?void 0:t?oe(e,i):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(r=(t?o(e,i,r):o(r))||r);return t&&r&&re(e,i,r),r},S=(n,e)=>(i,t)=>e(i,t,n);const h="__defaultDocumentZenEditorSpecialUnitId_20231218__";let P=class extends c.RxDisposable{constructor(e,i,t,r,s,o,a,d,l){super();E(this,"_zenEditorInitialState",!1);this._injector=e,this._univerInstanceService=i,this._zenEditorManagerService=t,this._renderManagerService=r,this._commandService=s,this._zenZoneService=o,this._editorBridgeService=a,this._undoRedoService=d,this._textSelectionManagerService=l,this._initialize()}_initialize(){this._syncZenEditorSize(),this._commandExecutedListener()}_createZenEditorInstance(){const e={id:h,body:{dataStream:`${c.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],paragraphs:[{startIndex:0}]},documentStyle:{pageSize:{width:595,height:842},documentFlavor:c.DocumentFlavor.MODERN,marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}}};return this._univerInstanceService.createUnit(c.UniverInstanceType.UNIVER_DOC,e)}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(q.takeUntil(this.dispose$)).subscribe(e=>{var d;if(e==null)return;const i=D.getEditorObject(h,this._renderManagerService),t=this._univerInstanceService.getUniverDocInstance(h);if(i==null||t==null)return;const{width:r,height:s}=e,{engine:o}=i,a=(d=this._renderManagerService.getRenderById(h))==null?void 0:d.with(O.DocSkeletonManagerService).getSkeleton();requestIdleCallback(()=>{o.resizeBySize(r,s),this._calculatePagePosition(i),a&&this._textSelectionManagerService.refreshSelection()})})}_handleOpenZenEditor(){this._zenEditorInitialState||(this._createZenEditorInstance(),this._zenEditorInitialState=!0),this._zenZoneService.open(),this._undoRedoService.clearUndoRedo(h),this._univerInstanceService.focusUnit(h),this._univerInstanceService.setCurrentUnitForType(h),this._editorBridgeService.isVisible().visible===!1&&this._editorBridgeService.changeVisible({visible:!0,eventType:N.DeviceInputEventType.PointerDown});const i=this._editorBridgeService.getLatestEditCellState();if(i==null)return;this._editorSyncHandler(i);const t=[{startOffset:0,endOffset:0}];this._textSelectionManagerService.replaceTextRanges(t)}_editorSyncHandler(e){var o,a;const i=(o=e.documentLayoutObject.documentModel)==null?void 0:o.getBody(),t=i==null?void 0:i.dataStream,r=i==null?void 0:i.paragraphs;let s=[];t==null||r==null||((a=i==null?void 0:i.textRuns)!=null&&a.length&&(s=i==null?void 0:i.textRuns),this._syncContentAndRender(h,t,r,s))}_syncContentAndRender(e,i,t,r=[]){var I;const s=[h,c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY],o=(I=this._renderManagerService.getRenderById(e))==null?void 0:I.with(O.DocSkeletonManagerService),a=o==null?void 0:o.getSkeleton(),d=this._univerInstanceService.getUniverDocInstance(e),l=o==null?void 0:o.getViewModel();if(d==null||l==null||a==null)return;const u=d.getBody();u.dataStream=i,u.paragraphs=t,e===c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&(u.textRuns=[]),r.length>0&&(u.textRuns=r),l.reset(d);const g=this._getDocObject();g!=null&&(a.calculate(),s.includes(e)&&g.document.makeDirty())}_calculatePagePosition(e){const{document:i,scene:t,docBackground:r}=e,s=t==null?void 0:t.getParent(),{width:o,height:a,pageMarginLeft:d,pageMarginTop:l}=i;if(s==null||o===Number.POSITIVE_INFINITY||a===Number.POSITIVE_INFINITY)return;const{width:u,height:g}=s;let I=0,z=0,M=0,A=0,x=Number.POSITIVE_INFINITY;const{scaleX:y,scaleY:Q}=t.getAncestorScale();u>(o+d*2)*y?(I=u/2-o*y/2,I/=y,M=(u-d*2)/y,x=0):(I=d,M=o+d*2,x=(M-u/y)/2),g>a?(z=g/2-a/2,A=(g-l*2)/Q):(z=l,A=a+l*2),t.resize(M,A+200),i.translate(I,z),r.translate(I,z);const V=t.getViewport(O.VIEWPORT_KEY.VIEW_MAIN);if(x!==Number.POSITIVE_INFINITY&&V!=null){const ee=V.transScroll2ViewportScrollValue(x,0).x;V.scrollTo({x:ee})}return this}_commandExecutedListener(){const e=[j.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{e.includes(t.id)&&this._handleOpenZenEditor()}));const i=[O.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(i.includes(t.id)){const r=t.params,{unitId:s}=r;if(s===h){const o=this._univerInstanceService.getUniverDocInstance(s),a=o==null?void 0:o.getBody(),d=a==null?void 0:a.dataStream,l=a==null?void 0:a.paragraphs,u=a==null?void 0:a.textRuns;if(this._editorBridgeService.changeEditorDirty(!0),d==null||l==null)return;this._syncContentAndRender(c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,d,l,u)}}}))}_getDocObject(){return O.getDocObject(this._univerInstanceService,this._renderManagerService)}};P=se([c.OnLifecycle(c.LifecycleStages.Steady,P),S(0,p.Inject(p.Injector)),S(1,c.IUniverInstanceService),S(2,$),S(3,N.IRenderManagerService),S(4,c.ICommandService),S(5,_.IZenZoneService),S(6,D.IEditorBridgeService),S(7,c.IUndoRedoService),S(8,p.Inject(O.TextSelectionManagerService))],P);const Z={id:"zen-editor.command.cancel-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const e=n.get(_.IZenZoneService),i=n.get(D.IEditorBridgeService),t=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:N.DeviceInputEventType.Keyboard,keycode:_.KeyCode.ESC}),e.close();const s=t.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return s?(t.focusUnit(s.getUnitId()),i.refreshEditCellState(),!0):!1}},L={id:"zen-editor.command.confirm-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const e=n.get(_.IZenZoneService),i=n.get(D.IEditorBridgeService),t=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:N.DeviceInputEventType.PointerDown}),e.close();const s=t.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return s?(t.focusUnit(s.getUnitId()),i.refreshEditCellState(),!0):!1}};function ce(n){return{id:j.id,group:_.MenuGroup.CONTEXT_MENU_OTHERS,type:_.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",positions:[_.MenuPosition.CONTEXT_MENU],disabled$:D.getCurrentRangeDisable$(n,{workbookTypes:[T.WorkbookEditablePermission],worksheetTypes:[T.WorksheetEditPermission,T.WorksheetSetCellValuePermission,T.WorksheetSetCellStylePermission],rangeTypes:[T.RangeProtectionPermissionEditPoint]})}}var Y={exports:{}},w={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ae=p,de=Symbol.for("react.element"),le=Symbol.for("react.fragment"),ue=Object.prototype.hasOwnProperty,_e=ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,he={key:!0,ref:!0,__self:!0,__source:!0};function K(n,e,i){var t,r={},o=null,s=null;i!==void 0&&(o=""+i),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(t in e)ue.call(e,t)&&!he.hasOwnProperty(t)&&(r[t]=e[t]);if(n&&n.defaultProps)for(t in e=n.defaultProps,e)r[t]===void 0&&(r[t]=e[t]);return{$$typeof:de,type:n,key:o,ref:s,props:r,_owner:_e.current}}j.Fragment=le;j.jsx=K;j.jsxs=K;Y.exports=j;var E=Y.exports,v=function(){return v=Object.assign||function(n){for(var e,i=1,t=arguments.length;i<t;i++){e=arguments[i];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},v.apply(this,arguments)},ve=function(n,e){var i={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(i[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(n);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(n,t[r])&&(i[t[r]]=n[t[r]]);return i},$=p.forwardRef(function(n,e){var i=n.icon,t=n.id,r=n.className,o=n.extend,s=ve(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),d=p.useRef("_".concat(Se()));return H(i,"".concat(t),{defIds:i.defIds,idSuffix:d.current},v({ref:e,className:c},s),o)});function H(n,e,i,t,r){return p.createElement(n.tag,v(v({key:e},fe(n,i,r)),t),(ge(n,i).children||[]).map(function(o,s){return H(o,"".concat(e,"-").concat(n.tag,"-").concat(s),i,void 0,r)}))}function fe(n,e,i){var t=v({},n.attrs);i!=null&&i.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=i.colorChannel1);var r=e.defIds;return!r||r.length===0||(n.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(t[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function ge(n,e){var i,t=e.defIds;return!t||t.length===0?n:n.tag==="defs"&&(!((i=n.children)===null||i===void 0)&&i.length)?v(v({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?v(v({},r),{attrs:v(v({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):n}function Se(){return Math.random().toString(36).substring(2,8)}$.displayName="UniverIcon";var pe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},X=p.forwardRef(function(n,e){return p.createElement($,Object.assign({},n,{id:"check-mark-single",ref:e,icon:pe}))});X.displayName="CheckMarkSingle";var Ie={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},G=p.forwardRef(function(n,e){return p.createElement($,Object.assign({},n,{id:"close-single",ref:e,icon:Ie}))});G.displayName="CloseSingle";const Ee="univer-zen-editor",me="univer-zen-editor-icon-wrapper",Ce="univer-zen-editor-icon-container",Oe="univer-zen-editor-icon-success",ye="univer-zen-editor-icon-error",Te="univer-zen-editor-canvas-container",m={zenEditor:Ee,zenEditorIconWrapper:me,zenEditorIconContainer:Ce,zenEditorIconSuccess:Oe,zenEditorIconError:ye,zenEditorCanvasContainer:Te},Re="ZEN_EDITOR_PLUGIN_",be=`${Re}ZEN_EDITOR_COMPONENT`;function Me(){const n=p.useRef(null),e=L.useDependency(M.IRenderManagerService),i=L.useDependency(k),t=L.useDependency(a.ICommandService);p.useEffect(()=>{const s=n.current;if(!s)return;const c=e.currentRender$.subscribe(l=>{var f;if(l!==h)return;const u=(f=e.getRenderById(h))==null?void 0:f.engine;u==null||u.setContainer(s)}),d=new ResizeObserver(()=>{const l=s.getBoundingClientRect();i.setPosition(l)});return d.observe(s),()=>{d.unobserve(s),c.unsubscribe()}},[]);function r(){t.executeCommand(A.id)}function o(){t.executeCommand(B.id)}return E.jsxs("div",{className:m.zenEditor,children:[E.jsxs("div",{className:m.zenEditorIconWrapper,children:[E.jsx("span",{className:W(m.zenEditorIconContainer,m.zenEditorIconError),onClick:r,children:E.jsx(G,{style:{fontSize:"22px"}})}),E.jsx("span",{className:W(m.zenEditorIconContainer,m.zenEditorIconSuccess),onClick:o,children:E.jsx(X,{style:{fontSize:"22px"}})})]}),E.jsx("div",{className:m.zenEditorCanvasContainer,ref:n})]})}const Ne={id:B.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ENTER|_.MetaKeys.ALT},ze={id:A.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ESC};function J(n){return n.getContextValue(a.FOCUSING_DOC)&&n.getContextValue(a.FOCUSING_UNIVER_EDITOR)&&n.getContextValue(a.EDITOR_ACTIVATED)&&!n.getContextValue(a.FOCUSING_EDITOR_STANDALONE)}var De=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Ue=(n,e,i,t)=>{for(var r=t>1?void 0:t?xe(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&De(e,i,r),r},R=(n,e)=>(i,t)=>e(i,t,n);const Pe={};let b=class extends a.Disposable{constructor(n,e,i,t,r,o){super(),this._config=n,this._injector=e,this._zenZoneService=i,this._commandService=t,this._menuService=r,this._shortcutService=o,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(be,Me))}_initCommands(){[V,A,B].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initMenus(){const{menu:n={}}=this._config;[ce].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e),n))})}_initShortcuts(){[Ne,ze].forEach(n=>{this.disposeWithMe(this._shortcutService.registerShortcut(n))})}};b=Ue([a.OnLifecycle(a.LifecycleStages.Rendered,b),R(1,S.Inject(S.Injector)),R(2,_.IZenZoneService),R(3,a.ICommandService),R(4,_.IMenuService),R(5,_.IShortcutService)],b);var je=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,we=(n,e,i,t)=>{for(var r=t>1?void 0:t?Ze(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&je(e,i,r),r},F=(n,e)=>(i,t)=>e(i,t,n),U;exports.UniverSheetsZenEditorPlugin=(U=class extends a.Plugin{constructor(e={},i,t){super(),this._config=e,this._injector=i,this._localeService=t,this._initializeDependencies(this._injector),this._config=a.Tools.deepMerge({},Pe,this._config)}_initializeDependencies(e){[[b,{useFactory:()=>this._injector.createInstance(b,this._config)}],[P],[k,{useClass:ie}]].forEach(t=>e.add(t))}},I(U,"pluginName","zen-editor"),I(U,"type",a.UniverInstanceType.UNIVER_DOC),U);exports.UniverSheetsZenEditorPlugin=we([F(1,S.Inject(S.Injector)),F(2,S.Inject(a.LocaleService))],exports.UniverSheetsZenEditorPlugin);
9
+ */var ae=f,de=Symbol.for("react.element"),le=Symbol.for("react.fragment"),ue=Object.prototype.hasOwnProperty,_e=ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,he={key:!0,ref:!0,__self:!0,__source:!0};function K(n,e,i){var t,r={},s=null,o=null;i!==void 0&&(s=""+i),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(t in e)ue.call(e,t)&&!he.hasOwnProperty(t)&&(r[t]=e[t]);if(n&&n.defaultProps)for(t in e=n.defaultProps,e)r[t]===void 0&&(r[t]=e[t]);return{$$typeof:de,type:n,key:s,ref:o,props:r,_owner:_e.current}}w.Fragment=le;w.jsx=K;w.jsxs=K;Y.exports=w;var m=Y.exports,v=function(){return v=Object.assign||function(n){for(var e,i=1,t=arguments.length;i<t;i++){e=arguments[i];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},v.apply(this,arguments)},ve=function(n,e){var i={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(i[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(n);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(n,t[r])&&(i[t[r]]=n[t[r]]);return i},k=f.forwardRef(function(n,e){var i=n.icon,t=n.id,r=n.className,s=n.extend,o=ve(n,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),d=f.useRef("_".concat(Se()));return H(i,"".concat(t),{defIds:i.defIds,idSuffix:d.current},v({ref:e,className:a},o),s)});function H(n,e,i,t,r){return f.createElement(n.tag,v(v({key:e},fe(n,i,r)),t),(ge(n,i).children||[]).map(function(s,o){return H(s,"".concat(e,"-").concat(n.tag,"-").concat(o),i,void 0,r)}))}function fe(n,e,i){var t=v({},n.attrs);i!=null&&i.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=i.colorChannel1);var r=e.defIds;return!r||r.length===0||(n.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(s){var o=s[0],a=s[1];typeof a=="string"&&(t[o]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function ge(n,e){var i,t=e.defIds;return!t||t.length===0?n:n.tag==="defs"&&(!((i=n.children)===null||i===void 0)&&i.length)?v(v({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?v(v({},r),{attrs:v(v({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):n}function Se(){return Math.random().toString(36).substring(2,8)}k.displayName="UniverIcon";var pe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},X=f.forwardRef(function(n,e){return f.createElement(k,Object.assign({},n,{id:"check-mark-single",ref:e,icon:pe}))});X.displayName="CheckMarkSingle";var Ie={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},G=f.forwardRef(function(n,e){return f.createElement(k,Object.assign({},n,{id:"close-single",ref:e,icon:Ie}))});G.displayName="CloseSingle";const Ee="univer-zen-editor",me="univer-zen-editor-icon-wrapper",Ce="univer-zen-editor-icon-container",Oe="univer-zen-editor-icon-success",ye="univer-zen-editor-icon-error",Te="univer-zen-editor-canvas-container",C={zenEditor:Ee,zenEditorIconWrapper:me,zenEditorIconContainer:Ce,zenEditorIconSuccess:Oe,zenEditorIconError:ye,zenEditorCanvasContainer:Te},Re="ZEN_EDITOR_PLUGIN_",be=`${Re}ZEN_EDITOR_COMPONENT`;function Ne(){const n=f.useRef(null),e=B.useDependency(N.IRenderManagerService),i=B.useDependency($),t=B.useDependency(c.ICommandService);f.useEffect(()=>{const o=n.current;if(!o)return;const a=e.currentRender$.subscribe(l=>{var g;if(l!==h)return;const u=(g=e.getRenderById(h))==null?void 0:g.engine;u==null||u.setContainer(o)}),d=new ResizeObserver(()=>{const l=o.getBoundingClientRect();i.setPosition(l)});return d.observe(o),()=>{d.unobserve(o),a.unsubscribe()}},[]);function r(){t.executeCommand(Z.id)}function s(){t.executeCommand(L.id)}return m.jsxs("div",{className:C.zenEditor,children:[m.jsxs("div",{className:C.zenEditorIconWrapper,children:[m.jsx("span",{className:F(C.zenEditorIconContainer,C.zenEditorIconError),onClick:r,children:m.jsx(G,{style:{fontSize:"22px"}})}),m.jsx("span",{className:F(C.zenEditorIconContainer,C.zenEditorIconSuccess),onClick:s,children:m.jsx(X,{style:{fontSize:"22px"}})})]}),m.jsx("div",{className:C.zenEditorCanvasContainer,ref:n})]})}const De={id:L.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ENTER|_.MetaKeys.ALT},ze={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ESC};function J(n){return n.getContextValue(c.FOCUSING_DOC)&&n.getContextValue(c.FOCUSING_UNIVER_EDITOR)&&n.getContextValue(c.EDITOR_ACTIVATED)&&!n.getContextValue(c.FOCUSING_EDITOR_STANDALONE)}var Me=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Ue=(n,e,i,t)=>{for(var r=t>1?void 0:t?xe(e,i):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(r=(t?o(e,i,r):o(r))||r);return t&&r&&Me(e,i,r),r},R=(n,e)=>(i,t)=>e(i,t,n);const Pe={};let b=class extends c.Disposable{constructor(n,e,i,t,r,s){super(),this._config=n,this._injector=e,this._zenZoneService=i,this._commandService=t,this._menuService=r,this._shortcutService=s,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(be,Ne))}_initCommands(){[j,Z,L].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initMenus(){const{menu:n={}}=this._config;[ce].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e),n))})}_initShortcuts(){[De,ze].forEach(n=>{this.disposeWithMe(this._shortcutService.registerShortcut(n))})}};b=Ue([c.OnLifecycle(c.LifecycleStages.Rendered,b),R(1,p.Inject(p.Injector)),R(2,_.IZenZoneService),R(3,c.ICommandService),R(4,_.IMenuService),R(5,_.IShortcutService)],b);var je=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,Le=(n,e,i,t)=>{for(var r=t>1?void 0:t?Ze(e,i):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(r=(t?o(e,i,r):o(r))||r);return t&&r&&je(e,i,r),r},W=(n,e)=>(i,t)=>e(i,t,n),U;exports.UniverSheetsZenEditorPlugin=(U=class extends c.Plugin{constructor(e={},i,t){super(),this._config=e,this._injector=i,this._localeService=t,this._initializeDependencies(this._injector),this._config=c.Tools.deepMerge({},Pe,this._config)}_initializeDependencies(e){[[b,{useFactory:()=>this._injector.createInstance(b,this._config)}],[P],[$,{useClass:ie}]].forEach(t=>e.add(t))}},E(U,"pluginName","zen-editor"),E(U,"type",c.UniverInstanceType.UNIVER_DOC),U);exports.UniverSheetsZenEditorPlugin=Le([W(1,p.Inject(p.Injector)),W(2,p.Inject(c.LocaleService))],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=Z;exports.ConfirmZenEditCommand=L;exports.OpenZenEditorOperation=j;
package/lib/es/index.js CHANGED
@@ -1,27 +1,27 @@
1
- var ue = Object.defineProperty;
2
- var he = (t, e, i) => e in t ? ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
- var v = (t, e, i) => he(t, typeof e != "symbol" ? e + "" : e, i);
4
- import { CommandType as U, RxDisposable as _e, UniverInstanceType as N, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as K, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as X, OnLifecycle as Q, LifecycleStages as ee, DEFAULT_EMPTY_DOCUMENT_VALUE as fe, IUniverInstanceService as j, ICommandService as w, IUndoRedoService as ve, FOCUSING_DOC as ge, FOCUSING_UNIVER_EDITOR as pe, EDITOR_ACTIVATED as Se, FOCUSING_EDITOR_STANDALONE as me, Disposable as Ee, Plugin as Ie, Tools as Ce, LocaleService as Oe } from "@univerjs/core";
5
- import { createIdentifier as ye, Inject as S, Injector as L } from "@wendellhu/redi";
6
- import { VIEWPORT_KEY as be, RichTextEditingMutation as Te, getDocObject as Me, TextSelectionManagerService as Ne, DocSkeletonManagerService as Re, DocViewModelManagerService as ze } from "@univerjs/docs";
7
- import { DeviceInputEventType as Z, IRenderManagerService as te } from "@univerjs/engine-render";
8
- import { getEditorObject as xe, IEditorBridgeService as V, getCurrentRangeDisable$ as De } from "@univerjs/sheets-ui";
9
- import { IZenZoneService as R, KeyCode as k, MenuGroup as Pe, MenuItemType as Ue, MenuPosition as je, MetaKeys as we, IMenuService as Le, IShortcutService as Ze } from "@univerjs/ui";
10
- import { BehaviorSubject as Ve, takeUntil as ke } from "rxjs";
11
- import { WorkbookEditablePermission as Ae, WorksheetEditPermission as $e, WorksheetSetCellValuePermission as Be, WorksheetSetCellStylePermission as We, RangeProtectionPermissionEditPoint as Fe } from "@univerjs/sheets";
12
- import Ye, { forwardRef as A, useRef as ne, createElement as $, useEffect as He } from "react";
1
+ var he = Object.defineProperty;
2
+ var _e = (t, e, i) => e in t ? he(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
+ var g = (t, e, i) => _e(t, typeof e != "symbol" ? e + "" : e, i);
4
+ import { CommandType as U, RxDisposable as fe, DEFAULT_EMPTY_DOCUMENT_VALUE as ve, DocumentFlavor as ge, UniverInstanceType as N, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as K, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as X, OnLifecycle as ee, LifecycleStages as te, IUniverInstanceService as j, ICommandService as w, IUndoRedoService as pe, FOCUSING_DOC as me, FOCUSING_UNIVER_EDITOR as Se, EDITOR_ACTIVATED as Ee, FOCUSING_EDITOR_STANDALONE as Ie, Disposable as Ce, Plugin as Oe, Tools as ye, LocaleService as be } from "@univerjs/core";
5
+ import { createIdentifier as Te, Inject as C, Injector as L } from "@wendellhu/redi";
6
+ import { DocSkeletonManagerService as G, VIEWPORT_KEY as Re, RichTextEditingMutation as Ne, getDocObject as ze, TextSelectionManagerService as xe } from "@univerjs/docs";
7
+ import { DeviceInputEventType as Z, IRenderManagerService as ne } from "@univerjs/engine-render";
8
+ import { getEditorObject as Me, IEditorBridgeService as V, getCurrentRangeDisable$ as De } from "@univerjs/sheets-ui";
9
+ import { IZenZoneService as z, KeyCode as A, MenuGroup as Pe, MenuItemType as Ue, MenuPosition as je, MetaKeys as we, IMenuService as Le, IShortcutService as Ze } from "@univerjs/ui";
10
+ import { BehaviorSubject as Ve, takeUntil as Ae } from "rxjs";
11
+ import { WorkbookEditablePermission as $e, WorksheetEditPermission as Be, WorksheetSetCellValuePermission as ke, WorksheetSetCellStylePermission as Fe, RangeProtectionPermissionEditPoint as We } from "@univerjs/sheets";
12
+ import Ye, { forwardRef as $, useRef as ie, createElement as B, useEffect as He } from "react";
13
13
  import { useDependency as P } from "@wendellhu/redi/react-bindings";
14
- import G from "clsx";
15
- const B = {
14
+ import q from "clsx";
15
+ const k = {
16
16
  id: "zen-editor.operation.open-zen-editor",
17
17
  type: U.OPERATION,
18
18
  handler: (t) => !0
19
19
  };
20
20
  class Ke {
21
21
  constructor() {
22
- v(this, "_position", null);
23
- v(this, "_position$", new Ve(null));
24
- v(this, "position$", this._position$.asObservable());
22
+ g(this, "_position", null);
23
+ g(this, "_position$", new Ve(null));
24
+ g(this, "position$", this._position$.asObservable());
25
25
  }
26
26
  dispose() {
27
27
  this._position$.complete(), this._position = null;
@@ -36,20 +36,20 @@ class Ke {
36
36
  this._position$.next(e);
37
37
  }
38
38
  }
39
- const W = ye(
39
+ const F = Te(
40
40
  "univer.sheet-zen-editor-manager.service"
41
41
  );
42
42
  var Xe = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, qe = (t, e, i, n) => {
43
- for (var r = n > 1 ? void 0 : n ? Ge(e, i) : e, o = t.length - 1, s; o >= 0; o--)
44
- (s = t[o]) && (r = (n ? s(e, i, r) : s(r)) || r);
43
+ for (var r = n > 1 ? void 0 : n ? Ge(e, i) : e, s = t.length - 1, o; s >= 0; s--)
44
+ (o = t[s]) && (r = (n ? o(e, i, r) : o(r)) || r);
45
45
  return n && r && Xe(e, i, r), r;
46
46
  }, f = (t, e) => (i, n) => e(i, n, t);
47
47
  const u = "__defaultDocumentZenEditorSpecialUnitId_20231218__";
48
- let M = class extends _e {
49
- constructor(e, i, n, r, o, s, c, a, d, l, _) {
48
+ let R = class extends fe {
49
+ constructor(e, i, n, r, s, o, c, a, d) {
50
50
  super();
51
- v(this, "_zenEditorInitialState", !1);
52
- this._injector = e, this._univerInstanceService = i, this._zenEditorManagerService = n, this._renderManagerService = r, this._commandService = o, this._zenZoneService = s, this._editorBridgeService = c, this._undoRedoService = a, this._textSelectionManagerService = d, this._docSkeletonManagerService = l, this._docViewModelManagerService = _, this._initialize();
51
+ g(this, "_zenEditorInitialState", !1);
52
+ this._injector = e, this._univerInstanceService = i, this._zenEditorManagerService = n, this._renderManagerService = r, this._commandService = s, this._zenZoneService = o, this._editorBridgeService = c, this._undoRedoService = a, this._textSelectionManagerService = d, this._initialize();
53
53
  }
54
54
  _initialize() {
55
55
  this._syncZenEditorSize(), this._commandExecutedListener();
@@ -58,7 +58,7 @@ let M = class extends _e {
58
58
  const e = {
59
59
  id: u,
60
60
  body: {
61
- dataStream: `${fe}`,
61
+ dataStream: `${ve}`,
62
62
  textRuns: [],
63
63
  paragraphs: [
64
64
  {
@@ -71,6 +71,7 @@ let M = class extends _e {
71
71
  width: 595,
72
72
  height: 842
73
73
  },
74
+ documentFlavor: ge.MODERN,
74
75
  marginTop: 50,
75
76
  marginBottom: 50,
76
77
  marginRight: 40,
@@ -85,16 +86,16 @@ let M = class extends _e {
85
86
  }
86
87
  // Listen to changes in the size of the zen editor container to set the size of the editor.
87
88
  _syncZenEditorSize() {
88
- this._zenEditorManagerService.position$.pipe(ke(this.dispose$)).subscribe((e) => {
89
+ this._zenEditorManagerService.position$.pipe(Ae(this.dispose$)).subscribe((e) => {
89
90
  var a;
90
91
  if (e == null)
91
92
  return;
92
- const i = xe(u, this._renderManagerService), n = this._univerInstanceService.getUniverDocInstance(u);
93
+ const i = Me(u, this._renderManagerService), n = this._univerInstanceService.getUniverDocInstance(u);
93
94
  if (i == null || n == null)
94
95
  return;
95
- const { width: r, height: o } = e, { engine: s } = i, c = (a = this._docSkeletonManagerService.getSkeletonByUnitId(u)) == null ? void 0 : a.skeleton;
96
+ const { width: r, height: s } = e, { engine: o } = i, c = (a = this._renderManagerService.getRenderById(u)) == null ? void 0 : a.with(G).getSkeleton();
96
97
  requestIdleCallback(() => {
97
- s.resizeBySize(r, o), this._calculatePagePosition(i), c && this._textSelectionManagerService.refreshSelection();
98
+ o.resizeBySize(r, s), this._calculatePagePosition(i), c && this._textSelectionManagerService.refreshSelection();
98
99
  });
99
100
  });
100
101
  }
@@ -116,55 +117,56 @@ let M = class extends _e {
116
117
  this._textSelectionManagerService.replaceTextRanges(n);
117
118
  }
118
119
  _editorSyncHandler(e) {
119
- var s, c;
120
- const i = (s = e.documentLayoutObject.documentModel) == null ? void 0 : s.getBody(), n = i == null ? void 0 : i.dataStream, r = i == null ? void 0 : i.paragraphs;
121
- let o = [];
122
- n == null || r == null || ((c = i == null ? void 0 : i.textRuns) != null && c.length && (o = i == null ? void 0 : i.textRuns), this._syncContentAndRender(u, n, r, o));
120
+ var o, c;
121
+ const i = (o = e.documentLayoutObject.documentModel) == null ? void 0 : o.getBody(), n = i == null ? void 0 : i.dataStream, r = i == null ? void 0 : i.paragraphs;
122
+ let s = [];
123
+ n == null || r == null || ((c = i == null ? void 0 : i.textRuns) != null && c.length && (s = i == null ? void 0 : i.textRuns), this._syncContentAndRender(u, n, r, s));
123
124
  }
124
125
  _syncContentAndRender(e, i, n, r = []) {
125
- const o = [
126
+ var v;
127
+ const s = [
126
128
  u,
127
129
  X,
128
130
  K
129
- ], s = this._docSkeletonManagerService.getSkeletonByUnitId(e), c = this._univerInstanceService.getUniverDocInstance(e), a = this._docViewModelManagerService.getViewModel(e);
130
- if (c == null || a == null || s == null)
131
+ ], o = (v = this._renderManagerService.getRenderById(e)) == null ? void 0 : v.with(G), c = o == null ? void 0 : o.getSkeleton(), a = this._univerInstanceService.getUniverDocInstance(e), d = o == null ? void 0 : o.getViewModel();
132
+ if (a == null || d == null || c == null)
131
133
  return;
132
- const d = c.getBody();
133
- d.dataStream = i, d.paragraphs = n, e === K && (d.textRuns = []), r.length > 0 && (d.textRuns = r), a.reset(c);
134
- const { skeleton: l } = s, _ = this._getDocObject();
135
- _ != null && (l.calculate(), o.includes(e) && _.document.makeDirty());
134
+ const l = a.getBody();
135
+ l.dataStream = i, l.paragraphs = n, e === K && (l.textRuns = []), r.length > 0 && (l.textRuns = r), d.reset(a);
136
+ const _ = this._getDocObject();
137
+ _ != null && (c.calculate(), s.includes(e) && _.document.makeDirty());
136
138
  }
137
139
  _calculatePagePosition(e) {
138
- const { document: i, scene: n, docBackground: r } = e, o = n == null ? void 0 : n.getParent(), { width: s, height: c, pageMarginLeft: a, pageMarginTop: d } = i;
139
- if (o == null || s === Number.POSITIVE_INFINITY || c === Number.POSITIVE_INFINITY)
140
+ const { document: i, scene: n, docBackground: r } = e, s = n == null ? void 0 : n.getParent(), { width: o, height: c, pageMarginLeft: a, pageMarginTop: d } = i;
141
+ if (s == null || o === Number.POSITIVE_INFINITY || c === Number.POSITIVE_INFINITY)
140
142
  return;
141
- const { width: l, height: _ } = o;
142
- let m = 0, O = 0, y = 0, x = 0, b = Number.POSITIVE_INFINITY;
143
- const { scaleX: E, scaleY: de } = n.getAncestorScale();
144
- l > (s + a * 2) * E ? (m = l / 2 - s * E / 2, m /= E, y = (l - a * 2) / E, b = 0) : (m = a, y = s + a * 2, b = (y - l / E) / 2), _ > c ? (O = _ / 2 - c / 2, x = (_ - d * 2) / de) : (O = d, x = c + d * 2), n.resize(y, x + 200), i.translate(m, O), r.translate(m, O);
145
- const D = n.getViewport(be.VIEW_MAIN);
143
+ const { width: l, height: _ } = s;
144
+ let v = 0, O = 0, y = 0, M = 0, b = Number.POSITIVE_INFINITY;
145
+ const { scaleX: S, scaleY: le } = n.getAncestorScale();
146
+ l > (o + a * 2) * S ? (v = l / 2 - o * S / 2, v /= S, y = (l - a * 2) / S, b = 0) : (v = a, y = o + a * 2, b = (y - l / S) / 2), _ > c ? (O = _ / 2 - c / 2, M = (_ - d * 2) / le) : (O = d, M = c + d * 2), n.resize(y, M + 200), i.translate(v, O), r.translate(v, O);
147
+ const D = n.getViewport(Re.VIEW_MAIN);
146
148
  if (b !== Number.POSITIVE_INFINITY && D != null) {
147
- const le = D.transScroll2ViewportScrollValue(b, 0).x;
149
+ const ue = D.transScroll2ViewportScrollValue(b, 0).x;
148
150
  D.scrollTo({
149
- x: le
151
+ x: ue
150
152
  });
151
153
  }
152
154
  return this;
153
155
  }
154
156
  _commandExecutedListener() {
155
- const e = [B.id];
157
+ const e = [k.id];
156
158
  this.disposeWithMe(
157
159
  this._commandService.onCommandExecuted((n) => {
158
160
  e.includes(n.id) && this._handleOpenZenEditor();
159
161
  })
160
162
  );
161
- const i = [Te.id];
163
+ const i = [Ne.id];
162
164
  this.disposeWithMe(
163
165
  this._commandService.onCommandExecuted((n) => {
164
166
  if (i.includes(n.id)) {
165
- const r = n.params, { unitId: o } = r;
166
- if (o === u) {
167
- const s = this._univerInstanceService.getUniverDocInstance(o), c = s == null ? void 0 : s.getBody(), a = c == null ? void 0 : c.dataStream, d = c == null ? void 0 : c.paragraphs, l = c == null ? void 0 : c.textRuns;
167
+ const r = n.params, { unitId: s } = r;
168
+ if (s === u) {
169
+ const o = this._univerInstanceService.getUniverDocInstance(s), c = o == null ? void 0 : o.getBody(), a = c == null ? void 0 : c.dataStream, d = c == null ? void 0 : c.paragraphs, l = c == null ? void 0 : c.textRuns;
168
170
  if (this._editorBridgeService.changeEditorDirty(!0), a == null || d == null)
169
171
  return;
170
172
  this._syncContentAndRender(X, a, d, l);
@@ -174,61 +176,59 @@ let M = class extends _e {
174
176
  );
175
177
  }
176
178
  _getDocObject() {
177
- return Me(this._univerInstanceService, this._renderManagerService);
179
+ return ze(this._univerInstanceService, this._renderManagerService);
178
180
  }
179
181
  };
180
- M = qe([
181
- Q(ee.Steady, M),
182
- f(0, S(L)),
182
+ R = qe([
183
+ ee(te.Steady, R),
184
+ f(0, C(L)),
183
185
  f(1, j),
184
- f(2, W),
185
- f(3, te),
186
+ f(2, F),
187
+ f(3, ne),
186
188
  f(4, w),
187
- f(5, R),
189
+ f(5, z),
188
190
  f(6, V),
189
- f(7, ve),
190
- f(8, S(Ne)),
191
- f(9, S(Re)),
192
- f(10, S(ze))
193
- ], M);
194
- const F = {
191
+ f(7, pe),
192
+ f(8, C(xe))
193
+ ], R);
194
+ const W = {
195
195
  id: "zen-editor.command.cancel-zen-edit",
196
196
  type: U.COMMAND,
197
197
  handler: async (t) => {
198
- const e = t.get(R), i = t.get(V), n = t.get(j);
198
+ const e = t.get(z), i = t.get(V), n = t.get(j);
199
199
  i.isVisible().visible && i.changeVisible({
200
200
  visible: !1,
201
201
  eventType: Z.Keyboard,
202
- keycode: k.ESC
202
+ keycode: A.ESC
203
203
  }), e.close();
204
- const o = n.getCurrentUnitForType(N.UNIVER_SHEET);
205
- return o ? (n.focusUnit(o.getUnitId()), i.refreshEditCellState(), !0) : !1;
204
+ const s = n.getCurrentUnitForType(N.UNIVER_SHEET);
205
+ return s ? (n.focusUnit(s.getUnitId()), i.refreshEditCellState(), !0) : !1;
206
206
  }
207
207
  }, Y = {
208
208
  id: "zen-editor.command.confirm-zen-edit",
209
209
  type: U.COMMAND,
210
210
  handler: async (t) => {
211
- const e = t.get(R), i = t.get(V), n = t.get(j);
211
+ const e = t.get(z), i = t.get(V), n = t.get(j);
212
212
  i.isVisible().visible && i.changeVisible({
213
213
  visible: !1,
214
214
  eventType: Z.PointerDown
215
215
  }), e.close();
216
- const o = n.getCurrentUnitForType(N.UNIVER_SHEET);
217
- return o ? (n.focusUnit(o.getUnitId()), i.refreshEditCellState(), !0) : !1;
216
+ const s = n.getCurrentUnitForType(N.UNIVER_SHEET);
217
+ return s ? (n.focusUnit(s.getUnitId()), i.refreshEditCellState(), !0) : !1;
218
218
  }
219
219
  };
220
220
  function Je(t) {
221
221
  return {
222
- id: B.id,
222
+ id: k.id,
223
223
  group: Pe.CONTEXT_MENU_OTHERS,
224
224
  type: Ue.BUTTON,
225
225
  title: "rightClick.zenEditor",
226
226
  icon: "AmplifySingle",
227
227
  positions: [je.CONTEXT_MENU],
228
- disabled$: De(t, { workbookTypes: [Ae], worksheetTypes: [$e, Be, We], rangeTypes: [Fe] })
228
+ disabled$: De(t, { workbookTypes: [$e], worksheetTypes: [Be, ke, Fe], rangeTypes: [We] })
229
229
  };
230
230
  }
231
- var ie = { exports: {} }, z = {};
231
+ var re = { exports: {} }, x = {};
232
232
  /**
233
233
  * @license React
234
234
  * react-jsx-runtime.production.min.js
@@ -239,18 +239,18 @@ var ie = { exports: {} }, z = {};
239
239
  * LICENSE file in the root directory of this source tree.
240
240
  */
241
241
  var Qe = Ye, et = Symbol.for("react.element"), tt = Symbol.for("react.fragment"), nt = Object.prototype.hasOwnProperty, it = Qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, rt = { key: !0, ref: !0, __self: !0, __source: !0 };
242
- function re(t, e, i) {
243
- var n, r = {}, o = null, s = null;
244
- i !== void 0 && (o = "" + i), e.key !== void 0 && (o = "" + e.key), e.ref !== void 0 && (s = e.ref);
242
+ function oe(t, e, i) {
243
+ var n, r = {}, s = null, o = null;
244
+ i !== void 0 && (s = "" + i), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref);
245
245
  for (n in e) nt.call(e, n) && !rt.hasOwnProperty(n) && (r[n] = e[n]);
246
246
  if (t && t.defaultProps) for (n in e = t.defaultProps, e) r[n] === void 0 && (r[n] = e[n]);
247
- return { $$typeof: et, type: t, key: o, ref: s, props: r, _owner: it.current };
247
+ return { $$typeof: et, type: t, key: s, ref: o, props: r, _owner: it.current };
248
248
  }
249
- z.Fragment = tt;
250
- z.jsx = re;
251
- z.jsxs = re;
252
- ie.exports = z;
253
- var g = ie.exports, h = function() {
249
+ x.Fragment = tt;
250
+ x.jsx = oe;
251
+ x.jsxs = oe;
252
+ re.exports = x;
253
+ var p = re.exports, h = function() {
254
254
  return h = Object.assign || function(t) {
255
255
  for (var e, i = 1, n = arguments.length; i < n; i++) {
256
256
  e = arguments[i];
@@ -265,22 +265,22 @@ var g = ie.exports, h = function() {
265
265
  for (var r = 0, n = Object.getOwnPropertySymbols(t); r < n.length; r++)
266
266
  e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[r]) && (i[n[r]] = t[n[r]]);
267
267
  return i;
268
- }, H = A(function(t, e) {
269
- var i = t.icon, n = t.id, r = t.className, o = t.extend, s = ot(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), a = ne("_".concat(at()));
270
- return oe(i, "".concat(n), { defIds: i.defIds, idSuffix: a.current }, h({ ref: e, className: c }, s), o);
268
+ }, H = $(function(t, e) {
269
+ var i = t.icon, n = t.id, r = t.className, s = t.extend, o = ot(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), a = ie("_".concat(at()));
270
+ return se(i, "".concat(n), { defIds: i.defIds, idSuffix: a.current }, h({ ref: e, className: c }, o), s);
271
271
  });
272
- function oe(t, e, i, n, r) {
273
- return $(t.tag, h(h({ key: e }, st(t, i, r)), n), (ct(t, i).children || []).map(function(o, s) {
274
- return oe(o, "".concat(e, "-").concat(t.tag, "-").concat(s), i, void 0, r);
272
+ function se(t, e, i, n, r) {
273
+ return B(t.tag, h(h({ key: e }, st(t, i, r)), n), (ct(t, i).children || []).map(function(s, o) {
274
+ return se(s, "".concat(e, "-").concat(t.tag, "-").concat(o), i, void 0, r);
275
275
  }));
276
276
  }
277
277
  function st(t, e, i) {
278
278
  var n = h({}, t.attrs);
279
279
  i != null && i.colorChannel1 && n.fill === "colorChannel1" && (n.fill = i.colorChannel1);
280
280
  var r = e.defIds;
281
- return !r || r.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(o) {
282
- var s = o[0], c = o[1];
283
- typeof c == "string" && (n[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
281
+ return !r || r.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(s) {
282
+ var o = s[0], c = s[1];
283
+ typeof c == "string" && (n[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
284
284
  })), n;
285
285
  }
286
286
  function ct(t, e) {
@@ -293,112 +293,112 @@ function at() {
293
293
  return Math.random().toString(36).substring(2, 8);
294
294
  }
295
295
  H.displayName = "UniverIcon";
296
- var dt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, se = A(function(t, e) {
297
- return $(H, Object.assign({}, t, {
296
+ var dt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, ce = $(function(t, e) {
297
+ return B(H, Object.assign({}, t, {
298
298
  id: "check-mark-single",
299
299
  ref: e,
300
300
  icon: dt
301
301
  }));
302
302
  });
303
- se.displayName = "CheckMarkSingle";
304
- var lt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, ce = A(function(t, e) {
305
- return $(H, Object.assign({}, t, {
303
+ ce.displayName = "CheckMarkSingle";
304
+ var lt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, ae = $(function(t, e) {
305
+ return B(H, Object.assign({}, t, {
306
306
  id: "close-single",
307
307
  ref: e,
308
308
  icon: lt
309
309
  }));
310
310
  });
311
- ce.displayName = "CloseSingle";
312
- const ut = "univer-zen-editor", ht = "univer-zen-editor-icon-wrapper", _t = "univer-zen-editor-icon-container", ft = "univer-zen-editor-icon-success", vt = "univer-zen-editor-icon-error", gt = "univer-zen-editor-canvas-container", p = {
311
+ ae.displayName = "CloseSingle";
312
+ const ut = "univer-zen-editor", ht = "univer-zen-editor-icon-wrapper", _t = "univer-zen-editor-icon-container", ft = "univer-zen-editor-icon-success", vt = "univer-zen-editor-icon-error", gt = "univer-zen-editor-canvas-container", m = {
313
313
  zenEditor: ut,
314
314
  zenEditorIconWrapper: ht,
315
315
  zenEditorIconContainer: _t,
316
316
  zenEditorIconSuccess: ft,
317
317
  zenEditorIconError: vt,
318
318
  zenEditorCanvasContainer: gt
319
- }, pt = "ZEN_EDITOR_PLUGIN_", St = `${pt}ZEN_EDITOR_COMPONENT`;
320
- function mt() {
321
- const t = ne(null), e = P(te), i = P(W), n = P(w);
319
+ }, pt = "ZEN_EDITOR_PLUGIN_", mt = `${pt}ZEN_EDITOR_COMPONENT`;
320
+ function St() {
321
+ const t = ie(null), e = P(ne), i = P(F), n = P(w);
322
322
  He(() => {
323
- const s = t.current;
324
- if (!s)
323
+ const o = t.current;
324
+ if (!o)
325
325
  return;
326
326
  const c = e.currentRender$.subscribe((d) => {
327
327
  var _;
328
328
  if (d !== u)
329
329
  return;
330
330
  const l = (_ = e.getRenderById(u)) == null ? void 0 : _.engine;
331
- l == null || l.setContainer(s);
331
+ l == null || l.setContainer(o);
332
332
  }), a = new ResizeObserver(() => {
333
- const d = s.getBoundingClientRect();
333
+ const d = o.getBoundingClientRect();
334
334
  i.setPosition(d);
335
335
  });
336
- return a.observe(s), () => {
337
- a.unobserve(s), c.unsubscribe();
336
+ return a.observe(o), () => {
337
+ a.unobserve(o), c.unsubscribe();
338
338
  };
339
339
  }, []);
340
340
  function r() {
341
- n.executeCommand(F.id);
341
+ n.executeCommand(W.id);
342
342
  }
343
- function o() {
343
+ function s() {
344
344
  n.executeCommand(Y.id);
345
345
  }
346
- return /* @__PURE__ */ g.jsxs("div", { className: p.zenEditor, children: [
347
- /* @__PURE__ */ g.jsxs("div", { className: p.zenEditorIconWrapper, children: [
348
- /* @__PURE__ */ g.jsx(
346
+ return /* @__PURE__ */ p.jsxs("div", { className: m.zenEditor, children: [
347
+ /* @__PURE__ */ p.jsxs("div", { className: m.zenEditorIconWrapper, children: [
348
+ /* @__PURE__ */ p.jsx(
349
349
  "span",
350
350
  {
351
- className: G(p.zenEditorIconContainer, p.zenEditorIconError),
351
+ className: q(m.zenEditorIconContainer, m.zenEditorIconError),
352
352
  onClick: r,
353
- children: /* @__PURE__ */ g.jsx(ce, { style: { fontSize: "22px" } })
353
+ children: /* @__PURE__ */ p.jsx(ae, { style: { fontSize: "22px" } })
354
354
  }
355
355
  ),
356
- /* @__PURE__ */ g.jsx(
356
+ /* @__PURE__ */ p.jsx(
357
357
  "span",
358
358
  {
359
- className: G(p.zenEditorIconContainer, p.zenEditorIconSuccess),
360
- onClick: o,
361
- children: /* @__PURE__ */ g.jsx(se, { style: { fontSize: "22px" } })
359
+ className: q(m.zenEditorIconContainer, m.zenEditorIconSuccess),
360
+ onClick: s,
361
+ children: /* @__PURE__ */ p.jsx(ce, { style: { fontSize: "22px" } })
362
362
  }
363
363
  )
364
364
  ] }),
365
- /* @__PURE__ */ g.jsx("div", { className: p.zenEditorCanvasContainer, ref: t })
365
+ /* @__PURE__ */ p.jsx("div", { className: m.zenEditorCanvasContainer, ref: t })
366
366
  ] });
367
367
  }
368
368
  const Et = {
369
369
  id: Y.id,
370
370
  description: "shortcut.sheet.zen-edit-confirm",
371
371
  group: "4_sheet-edit",
372
- preconditions: (t) => ae(t),
373
- binding: k.ENTER | we.ALT
372
+ preconditions: (t) => de(t),
373
+ binding: A.ENTER | we.ALT
374
374
  }, It = {
375
- id: F.id,
375
+ id: W.id,
376
376
  description: "shortcut.sheet.zen-edit-cancel",
377
377
  group: "4_sheet-edit",
378
- preconditions: (t) => ae(t),
379
- binding: k.ESC
378
+ preconditions: (t) => de(t),
379
+ binding: A.ESC
380
380
  };
381
- function ae(t) {
382
- return t.getContextValue(ge) && t.getContextValue(pe) && t.getContextValue(Se) && !t.getContextValue(me);
381
+ function de(t) {
382
+ return t.getContextValue(me) && t.getContextValue(Se) && t.getContextValue(Ee) && !t.getContextValue(Ie);
383
383
  }
384
384
  var Ct = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, yt = (t, e, i, n) => {
385
- for (var r = n > 1 ? void 0 : n ? Ot(e, i) : e, o = t.length - 1, s; o >= 0; o--)
386
- (s = t[o]) && (r = (n ? s(e, i, r) : s(r)) || r);
385
+ for (var r = n > 1 ? void 0 : n ? Ot(e, i) : e, s = t.length - 1, o; s >= 0; s--)
386
+ (o = t[s]) && (r = (n ? o(e, i, r) : o(r)) || r);
387
387
  return n && r && Ct(e, i, r), r;
388
- }, I = (t, e) => (i, n) => e(i, n, t);
388
+ }, E = (t, e) => (i, n) => e(i, n, t);
389
389
  const bt = {};
390
- let C = class extends Ee {
391
- constructor(t, e, i, n, r, o) {
392
- super(), this._config = t, this._injector = e, this._zenZoneService = i, this._commandService = n, this._menuService = r, this._shortcutService = o, this._initialize();
390
+ let I = class extends Ce {
391
+ constructor(t, e, i, n, r, s) {
392
+ super(), this._config = t, this._injector = e, this._zenZoneService = i, this._commandService = n, this._menuService = r, this._shortcutService = s, this._initialize();
393
393
  }
394
394
  _initialize() {
395
395
  this._initCustomComponents(), this._initCommands(), this._initMenus(), this._initShortcuts();
396
396
  }
397
397
  _initCustomComponents() {
398
- this.disposeWithMe(this._zenZoneService.set(St, mt));
398
+ this.disposeWithMe(this._zenZoneService.set(mt, St));
399
399
  }
400
400
  _initCommands() {
401
- [B, F, Y].forEach((t) => {
401
+ [k, W, Y].forEach((t) => {
402
402
  this.disposeWithMe(this._commandService.registerCommand(t));
403
403
  });
404
404
  }
@@ -417,40 +417,43 @@ let C = class extends Ee {
417
417
  });
418
418
  }
419
419
  };
420
- C = yt([
421
- Q(ee.Rendered, C),
422
- I(1, S(L)),
423
- I(2, R),
424
- I(3, w),
425
- I(4, Le),
426
- I(5, Ze)
427
- ], C);
428
- var Tt = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, Nt = (t, e, i, n) => {
429
- for (var r = n > 1 ? void 0 : n ? Mt(e, i) : e, o = t.length - 1, s; o >= 0; o--)
430
- (s = t[o]) && (r = (n ? s(e, i, r) : s(r)) || r);
420
+ I = yt([
421
+ ee(te.Rendered, I),
422
+ E(1, C(L)),
423
+ E(2, z),
424
+ E(3, w),
425
+ E(4, Le),
426
+ E(5, Ze)
427
+ ], I);
428
+ var Tt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Nt = (t, e, i, n) => {
429
+ for (var r = n > 1 ? void 0 : n ? Rt(e, i) : e, s = t.length - 1, o; s >= 0; s--)
430
+ (o = t[s]) && (r = (n ? o(e, i, r) : o(r)) || r);
431
431
  return n && r && Tt(e, i, r), r;
432
- }, q = (t, e) => (i, n) => e(i, n, t), T;
433
- let J = (T = class extends Ie {
432
+ }, J = (t, e) => (i, n) => e(i, n, t), T;
433
+ let Q = (T = class extends Oe {
434
434
  constructor(t = {}, e, i) {
435
- super(), this._config = t, this._injector = e, this._localeService = i, this._initializeDependencies(this._injector), this._config = Ce.deepMerge({}, bt, this._config);
435
+ super(), this._config = t, this._injector = e, this._localeService = i, this._initializeDependencies(this._injector), this._config = ye.deepMerge({}, bt, this._config);
436
436
  }
437
437
  _initializeDependencies(t) {
438
438
  [
439
439
  [
440
- C,
440
+ I,
441
441
  {
442
- useFactory: () => this._injector.createInstance(C, this._config)
442
+ useFactory: () => this._injector.createInstance(I, this._config)
443
443
  }
444
444
  ],
445
- [M],
446
- [W, { useClass: Ke }]
445
+ [R],
446
+ [F, { useClass: Ke }]
447
447
  ].forEach((i) => t.add(i));
448
448
  }
449
- }, v(T, "pluginName", "zen-editor"), v(T, "type", N.UNIVER_DOC), T);
450
- J = Nt([
451
- q(1, S(L)),
452
- q(2, S(Oe))
453
- ], J);
449
+ }, g(T, "pluginName", "zen-editor"), g(T, "type", N.UNIVER_DOC), T);
450
+ Q = Nt([
451
+ J(1, C(L)),
452
+ J(2, C(be))
453
+ ], Q);
454
454
  export {
455
- J as UniverSheetsZenEditorPlugin
455
+ W as CancelZenEditCommand,
456
+ Y as ConfirmZenEditCommand,
457
+ k as OpenZenEditorOperation,
458
+ Q as UniverSheetsZenEditorPlugin
456
459
  };
@@ -1,5 +1,5 @@
1
1
  import { ICommandService, IUndoRedoService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
- import { DocSkeletonManagerService, DocViewModelManagerService, TextSelectionManagerService } from '@univerjs/docs';
2
+ import { TextSelectionManagerService } from '@univerjs/docs';
3
3
  import { IRenderManagerService } from '@univerjs/engine-render';
4
4
  import { IEditorBridgeService } from '@univerjs/sheets-ui';
5
5
  import { IZenZoneService } from '@univerjs/ui';
@@ -17,9 +17,7 @@ export declare class ZenEditorController extends RxDisposable {
17
17
  private readonly _editorBridgeService;
18
18
  private readonly _undoRedoService;
19
19
  private readonly _textSelectionManagerService;
20
- private readonly _docSkeletonManagerService;
21
- private readonly _docViewModelManagerService;
22
- constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _zenEditorManagerService: IZenEditorManagerService, _renderManagerService: IRenderManagerService, _commandService: ICommandService, _zenZoneService: IZenZoneService, _editorBridgeService: IEditorBridgeService, _undoRedoService: IUndoRedoService, _textSelectionManagerService: TextSelectionManagerService, _docSkeletonManagerService: DocSkeletonManagerService, _docViewModelManagerService: DocViewModelManagerService);
20
+ constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _zenEditorManagerService: IZenEditorManagerService, _renderManagerService: IRenderManagerService, _commandService: ICommandService, _zenZoneService: IZenZoneService, _editorBridgeService: IEditorBridgeService, _undoRedoService: IUndoRedoService, _textSelectionManagerService: TextSelectionManagerService);
23
21
  private _initialize;
24
22
  private _createZenEditorInstance;
25
23
  private _syncZenEditorSize;
@@ -14,3 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { UniverSheetsZenEditorPlugin } from './plugin';
17
+ export { OpenZenEditorOperation } from './commands/operations/zen-editor.operation';
18
+ export { CancelZenEditCommand, ConfirmZenEditCommand } from './commands/commands/zen-editor.command';
package/lib/umd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(d,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/sheets"),require("react"),require("@wendellhu/redi/react-bindings"),require("clsx")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/docs","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/sheets","react","@wendellhu/redi/react-bindings","clsx"],c):(d=typeof globalThis<"u"?globalThis:d||self,c(d.UniverSheetsZenEditor={},d.UniverCore,d["@wendellhu/redi"],d.UniverDocs,d.UniverEngineRender,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverSheets,d.React,d["@wendellhu/redi/react-bindings"],d.clsx))})(this,function(d,c,v,O,y,T,_,Y,R,I,Z,K){"use strict";var je=Object.defineProperty;var be=(d,c,v)=>c in d?je(d,c,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[c]=v;var C=(d,c,v)=>be(d,typeof c!="symbol"?c+"":c,v);var x;const L={id:"zen-editor.operation.open-zen-editor",type:c.CommandType.OPERATION,handler:n=>!0};class ee{constructor(){C(this,"_position",null);C(this,"_position$",new Y.BehaviorSubject(null));C(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const V=v.createIdentifier("univer.sheet-zen-editor-manager.service");var te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,ie=(n,t,i,e)=>{for(var r=e>1?void 0:e?ne(t,i):t,s=n.length-1,o;s>=0;s--)(o=n[s])&&(r=(e?o(t,i,r):o(r))||r);return e&&r&&te(t,i,r),r},p=(n,t)=>(i,e)=>t(i,e,n);const f="__defaultDocumentZenEditorSpecialUnitId_20231218__";let b=class extends c.RxDisposable{constructor(t,i,e,r,s,o,a,l,u,h,g){super();C(this,"_zenEditorInitialState",!1);this._injector=t,this._univerInstanceService=i,this._zenEditorManagerService=e,this._renderManagerService=r,this._commandService=s,this._zenZoneService=o,this._editorBridgeService=a,this._undoRedoService=l,this._textSelectionManagerService=u,this._docSkeletonManagerService=h,this._docViewModelManagerService=g,this._initialize()}_initialize(){this._syncZenEditorSize(),this._commandExecutedListener()}_createZenEditorInstance(){const t={id:f,body:{dataStream:`${c.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],paragraphs:[{startIndex:0}]},documentStyle:{pageSize:{width:595,height:842},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}}};return this._univerInstanceService.createUnit(c.UniverInstanceType.UNIVER_DOC,t)}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(Y.takeUntil(this.dispose$)).subscribe(t=>{var l;if(t==null)return;const i=T.getEditorObject(f,this._renderManagerService),e=this._univerInstanceService.getUniverDocInstance(f);if(i==null||e==null)return;const{width:r,height:s}=t,{engine:o}=i,a=(l=this._docSkeletonManagerService.getSkeletonByUnitId(f))==null?void 0:l.skeleton;requestIdleCallback(()=>{o.resizeBySize(r,s),this._calculatePagePosition(i),a&&this._textSelectionManagerService.refreshSelection()})})}_handleOpenZenEditor(){this._zenEditorInitialState||(this._createZenEditorInstance(),this._zenEditorInitialState=!0),this._zenZoneService.open(),this._undoRedoService.clearUndoRedo(f),this._univerInstanceService.focusUnit(f),this._univerInstanceService.setCurrentUnitForType(f),this._editorBridgeService.isVisible().visible===!1&&this._editorBridgeService.changeVisible({visible:!0,eventType:y.DeviceInputEventType.PointerDown});const i=this._editorBridgeService.getLatestEditCellState();if(i==null)return;this._editorSyncHandler(i);const e=[{startOffset:0,endOffset:0}];this._textSelectionManagerService.replaceTextRanges(e)}_editorSyncHandler(t){var o,a;const i=(o=t.documentLayoutObject.documentModel)==null?void 0:o.getBody(),e=i==null?void 0:i.dataStream,r=i==null?void 0:i.paragraphs;let s=[];e==null||r==null||((a=i==null?void 0:i.textRuns)!=null&&a.length&&(s=i==null?void 0:i.textRuns),this._syncContentAndRender(f,e,r,s))}_syncContentAndRender(t,i,e,r=[]){const s=[f,c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY],o=this._docSkeletonManagerService.getSkeletonByUnitId(t),a=this._univerInstanceService.getUniverDocInstance(t),l=this._docViewModelManagerService.getViewModel(t);if(a==null||l==null||o==null)return;const u=a.getBody();u.dataStream=i,u.paragraphs=e,t===c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&(u.textRuns=[]),r.length>0&&(u.textRuns=r),l.reset(a);const{skeleton:h}=o,g=this._getDocObject();g!=null&&(h.calculate(),s.includes(t)&&g.document.makeDirty())}_calculatePagePosition(t){const{document:i,scene:e,docBackground:r}=t,s=e==null?void 0:e.getParent(),{width:o,height:a,pageMarginLeft:l,pageMarginTop:u}=i;if(s==null||o===Number.POSITIVE_INFINITY||a===Number.POSITIVE_INFINITY)return;const{width:h,height:g}=s;let z=0,U=0,P=0,W=0,w=Number.POSITIVE_INFINITY;const{scaleX:j,scaleY:Ne}=e.getAncestorScale();h>(o+l*2)*j?(z=h/2-o*j/2,z/=j,P=(h-l*2)/j,w=0):(z=l,P=o+l*2,w=(P-h/j)/2),g>a?(U=g/2-a/2,W=(g-u*2)/Ne):(U=u,W=a+u*2),e.resize(P,W+200),i.translate(z,U),r.translate(z,U);const F=e.getViewport(O.VIEWPORT_KEY.VIEW_MAIN);if(w!==Number.POSITIVE_INFINITY&&F!=null){const ze=F.transScroll2ViewportScrollValue(w,0).x;F.scrollTo({x:ze})}return this}_commandExecutedListener(){const t=[L.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{t.includes(e.id)&&this._handleOpenZenEditor()}));const i=[O.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(i.includes(e.id)){const r=e.params,{unitId:s}=r;if(s===f){const o=this._univerInstanceService.getUniverDocInstance(s),a=o==null?void 0:o.getBody(),l=a==null?void 0:a.dataStream,u=a==null?void 0:a.paragraphs,h=a==null?void 0:a.textRuns;if(this._editorBridgeService.changeEditorDirty(!0),l==null||u==null)return;this._syncContentAndRender(c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,l,u,h)}}}))}_getDocObject(){return O.getDocObject(this._univerInstanceService,this._renderManagerService)}};b=ie([c.OnLifecycle(c.LifecycleStages.Steady,b),p(0,v.Inject(v.Injector)),p(1,c.IUniverInstanceService),p(2,V),p(3,y.IRenderManagerService),p(4,c.ICommandService),p(5,_.IZenZoneService),p(6,T.IEditorBridgeService),p(7,c.IUndoRedoService),p(8,v.Inject(O.TextSelectionManagerService)),p(9,v.Inject(O.DocSkeletonManagerService)),p(10,v.Inject(O.DocViewModelManagerService))],b);const k={id:"zen-editor.command.cancel-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const t=n.get(_.IZenZoneService),i=n.get(T.IEditorBridgeService),e=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:y.DeviceInputEventType.Keyboard,keycode:_.KeyCode.ESC}),t.close();const s=e.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return s?(e.focusUnit(s.getUnitId()),i.refreshEditCellState(),!0):!1}},A={id:"zen-editor.command.confirm-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const t=n.get(_.IZenZoneService),i=n.get(T.IEditorBridgeService),e=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:y.DeviceInputEventType.PointerDown}),t.close();const s=e.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return s?(e.focusUnit(s.getUnitId()),i.refreshEditCellState(),!0):!1}};function re(n){return{id:L.id,group:_.MenuGroup.CONTEXT_MENU_OTHERS,type:_.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",positions:[_.MenuPosition.CONTEXT_MENU],disabled$:T.getCurrentRangeDisable$(n,{workbookTypes:[R.WorkbookEditablePermission],worksheetTypes:[R.WorksheetEditPermission,R.WorksheetSetCellValuePermission,R.WorksheetSetCellStylePermission],rangeTypes:[R.RangeProtectionPermissionEditPoint]})}}var H={exports:{}},D={};/**
1
+ (function(d,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/sheets"),require("react"),require("@wendellhu/redi/react-bindings"),require("clsx")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/docs","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/sheets","react","@wendellhu/redi/react-bindings","clsx"],c):(d=typeof globalThis<"u"?globalThis:d||self,c(d.UniverSheetsZenEditor={},d.UniverCore,d["@wendellhu/redi"],d.UniverDocs,d.UniverEngineRender,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverSheets,d.React,d["@wendellhu/redi/react-bindings"],d.clsx))})(this,function(d,c,h,y,T,R,_,Y,N,p,V,K){"use strict";var je=Object.defineProperty;var be=(d,c,h)=>c in d?je(d,c,{enumerable:!0,configurable:!0,writable:!0,value:h}):d[c]=h;var O=(d,c,h)=>be(d,typeof c!="symbol"?c+"":c,h);var Z;const b={id:"zen-editor.operation.open-zen-editor",type:c.CommandType.OPERATION,handler:n=>!0};class ee{constructor(){O(this,"_position",null);O(this,"_position$",new Y.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const B=h.createIdentifier("univer.sheet-zen-editor-manager.service");var te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,ie=(n,t,i,e)=>{for(var r=e>1?void 0:e?ne(t,i):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(e?s(t,i,r):s(r))||r);return e&&r&&te(t,i,r),r},g=(n,t)=>(i,e)=>t(i,e,n);const f="__defaultDocumentZenEditorSpecialUnitId_20231218__";let M=class extends c.RxDisposable{constructor(t,i,e,r,o,s,a,l,u){super();O(this,"_zenEditorInitialState",!1);this._injector=t,this._univerInstanceService=i,this._zenEditorManagerService=e,this._renderManagerService=r,this._commandService=o,this._zenZoneService=s,this._editorBridgeService=a,this._undoRedoService=l,this._textSelectionManagerService=u,this._initialize()}_initialize(){this._syncZenEditorSize(),this._commandExecutedListener()}_createZenEditorInstance(){const t={id:f,body:{dataStream:`${c.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],paragraphs:[{startIndex:0}]},documentStyle:{pageSize:{width:595,height:842},documentFlavor:c.DocumentFlavor.MODERN,marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}}};return this._univerInstanceService.createUnit(c.UniverInstanceType.UNIVER_DOC,t)}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(Y.takeUntil(this.dispose$)).subscribe(t=>{var l;if(t==null)return;const i=R.getEditorObject(f,this._renderManagerService),e=this._univerInstanceService.getUniverDocInstance(f);if(i==null||e==null)return;const{width:r,height:o}=t,{engine:s}=i,a=(l=this._renderManagerService.getRenderById(f))==null?void 0:l.with(y.DocSkeletonManagerService).getSkeleton();requestIdleCallback(()=>{s.resizeBySize(r,o),this._calculatePagePosition(i),a&&this._textSelectionManagerService.refreshSelection()})})}_handleOpenZenEditor(){this._zenEditorInitialState||(this._createZenEditorInstance(),this._zenEditorInitialState=!0),this._zenZoneService.open(),this._undoRedoService.clearUndoRedo(f),this._univerInstanceService.focusUnit(f),this._univerInstanceService.setCurrentUnitForType(f),this._editorBridgeService.isVisible().visible===!1&&this._editorBridgeService.changeVisible({visible:!0,eventType:T.DeviceInputEventType.PointerDown});const i=this._editorBridgeService.getLatestEditCellState();if(i==null)return;this._editorSyncHandler(i);const e=[{startOffset:0,endOffset:0}];this._textSelectionManagerService.replaceTextRanges(e)}_editorSyncHandler(t){var s,a;const i=(s=t.documentLayoutObject.documentModel)==null?void 0:s.getBody(),e=i==null?void 0:i.dataStream,r=i==null?void 0:i.paragraphs;let o=[];e==null||r==null||((a=i==null?void 0:i.textRuns)!=null&&a.length&&(o=i==null?void 0:i.textRuns),this._syncContentAndRender(f,e,r,o))}_syncContentAndRender(t,i,e,r=[]){var I;const o=[f,c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY],s=(I=this._renderManagerService.getRenderById(t))==null?void 0:I.with(y.DocSkeletonManagerService),a=s==null?void 0:s.getSkeleton(),l=this._univerInstanceService.getUniverDocInstance(t),u=s==null?void 0:s.getViewModel();if(l==null||u==null||a==null)return;const v=l.getBody();v.dataStream=i,v.paragraphs=e,t===c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&(v.textRuns=[]),r.length>0&&(v.textRuns=r),u.reset(l);const E=this._getDocObject();E!=null&&(a.calculate(),o.includes(t)&&E.document.makeDirty())}_calculatePagePosition(t){const{document:i,scene:e,docBackground:r}=t,o=e==null?void 0:e.getParent(),{width:s,height:a,pageMarginLeft:l,pageMarginTop:u}=i;if(o==null||s===Number.POSITIVE_INFINITY||a===Number.POSITIVE_INFINITY)return;const{width:v,height:E}=o;let I=0,w=0,L=0,F=0,A=Number.POSITIVE_INFINITY;const{scaleX:j,scaleY:ze}=e.getAncestorScale();v>(s+l*2)*j?(I=v/2-s*j/2,I/=j,L=(v-l*2)/j,A=0):(I=l,L=s+l*2,A=(L-v/j)/2),E>a?(w=E/2-a/2,F=(E-u*2)/ze):(w=u,F=a+u*2),e.resize(L,F+200),i.translate(I,w),r.translate(I,w);const W=e.getViewport(y.VIEWPORT_KEY.VIEW_MAIN);if(A!==Number.POSITIVE_INFINITY&&W!=null){const De=W.transScroll2ViewportScrollValue(A,0).x;W.scrollTo({x:De})}return this}_commandExecutedListener(){const t=[b.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{t.includes(e.id)&&this._handleOpenZenEditor()}));const i=[y.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(i.includes(e.id)){const r=e.params,{unitId:o}=r;if(o===f){const s=this._univerInstanceService.getUniverDocInstance(o),a=s==null?void 0:s.getBody(),l=a==null?void 0:a.dataStream,u=a==null?void 0:a.paragraphs,v=a==null?void 0:a.textRuns;if(this._editorBridgeService.changeEditorDirty(!0),l==null||u==null)return;this._syncContentAndRender(c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,l,u,v)}}}))}_getDocObject(){return y.getDocObject(this._univerInstanceService,this._renderManagerService)}};M=ie([c.OnLifecycle(c.LifecycleStages.Steady,M),g(0,h.Inject(h.Injector)),g(1,c.IUniverInstanceService),g(2,B),g(3,T.IRenderManagerService),g(4,c.ICommandService),g(5,_.IZenZoneService),g(6,R.IEditorBridgeService),g(7,c.IUndoRedoService),g(8,h.Inject(y.TextSelectionManagerService))],M);const x={id:"zen-editor.command.cancel-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const t=n.get(_.IZenZoneService),i=n.get(R.IEditorBridgeService),e=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:T.DeviceInputEventType.Keyboard,keycode:_.KeyCode.ESC}),t.close();const o=e.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return o?(e.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},U={id:"zen-editor.command.confirm-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const t=n.get(_.IZenZoneService),i=n.get(R.IEditorBridgeService),e=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:T.DeviceInputEventType.PointerDown}),t.close();const o=e.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return o?(e.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}};function re(n){return{id:b.id,group:_.MenuGroup.CONTEXT_MENU_OTHERS,type:_.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",positions:[_.MenuPosition.CONTEXT_MENU],disabled$:R.getCurrentRangeDisable$(n,{workbookTypes:[N.WorkbookEditablePermission],worksheetTypes:[N.WorksheetEditPermission,N.WorksheetSetCellValuePermission,N.WorksheetSetCellStylePermission],rangeTypes:[N.RangeProtectionPermissionEditPoint]})}}var H={exports:{}},P={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var se=I,oe=Symbol.for("react.element"),ce=Symbol.for("react.fragment"),ae=Object.prototype.hasOwnProperty,de=se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,le={key:!0,ref:!0,__self:!0,__source:!0};function X(n,t,i){var e,r={},s=null,o=null;i!==void 0&&(s=""+i),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(e in t)ae.call(t,e)&&!le.hasOwnProperty(e)&&(r[e]=t[e]);if(n&&n.defaultProps)for(e in t=n.defaultProps,t)r[e]===void 0&&(r[e]=t[e]);return{$$typeof:oe,type:n,key:s,ref:o,props:r,_owner:de.current}}D.Fragment=ce,D.jsx=X,D.jsxs=X,H.exports=D;var E=H.exports,S=function(){return S=Object.assign||function(n){for(var t,i=1,e=arguments.length;i<e;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},S.apply(this,arguments)},ue=function(n,t){var i={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(i[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(n);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(n,e[r])&&(i[e[r]]=n[e[r]]);return i},B=I.forwardRef(function(n,t){var i=n.icon,e=n.id,r=n.className,s=n.extend,o=ue(n,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),l=I.useRef("_".concat(_e()));return $(i,"".concat(e),{defIds:i.defIds,idSuffix:l.current},S({ref:t,className:a},o),s)});function $(n,t,i,e,r){return I.createElement(n.tag,S(S({key:t},ve(n,i,r)),e),(he(n,i).children||[]).map(function(s,o){return $(s,"".concat(t,"-").concat(n.tag,"-").concat(o),i,void 0,r)}))}function ve(n,t,i){var e=S({},n.attrs);i!=null&&i.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=i.colorChannel1);var r=t.defIds;return!r||r.length===0||(n.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(s){var o=s[0],a=s[1];typeof a=="string"&&(e[o]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function he(n,t){var i,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((i=n.children)===null||i===void 0)&&i.length)?S(S({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?S(S({},r),{attrs:S(S({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):n}function _e(){return Math.random().toString(36).substring(2,8)}B.displayName="UniverIcon";var fe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},G=I.forwardRef(function(n,t){return I.createElement(B,Object.assign({},n,{id:"check-mark-single",ref:t,icon:fe}))});G.displayName="CheckMarkSingle";var Se={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},q=I.forwardRef(function(n,t){return I.createElement(B,Object.assign({},n,{id:"close-single",ref:t,icon:Se}))});q.displayName="CloseSingle";const m={zenEditor:"univer-zen-editor",zenEditorIconWrapper:"univer-zen-editor-icon-wrapper",zenEditorIconContainer:"univer-zen-editor-icon-container",zenEditorIconSuccess:"univer-zen-editor-icon-success",zenEditorIconError:"univer-zen-editor-icon-error",zenEditorCanvasContainer:"univer-zen-editor-canvas-container"},pe="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT";function ge(){const n=I.useRef(null),t=Z.useDependency(y.IRenderManagerService),i=Z.useDependency(V),e=Z.useDependency(c.ICommandService);I.useEffect(()=>{const o=n.current;if(!o)return;const a=t.currentRender$.subscribe(u=>{var g;if(u!==f)return;const h=(g=t.getRenderById(f))==null?void 0:g.engine;h==null||h.setContainer(o)}),l=new ResizeObserver(()=>{const u=o.getBoundingClientRect();i.setPosition(u)});return l.observe(o),()=>{l.unobserve(o),a.unsubscribe()}},[]);function r(){e.executeCommand(k.id)}function s(){e.executeCommand(A.id)}return E.jsxs("div",{className:m.zenEditor,children:[E.jsxs("div",{className:m.zenEditorIconWrapper,children:[E.jsx("span",{className:K(m.zenEditorIconContainer,m.zenEditorIconError),onClick:r,children:E.jsx(q,{style:{fontSize:"22px"}})}),E.jsx("span",{className:K(m.zenEditorIconContainer,m.zenEditorIconSuccess),onClick:s,children:E.jsx(G,{style:{fontSize:"22px"}})})]}),E.jsx("div",{className:m.zenEditorCanvasContainer,ref:n})]})}const Ie={id:A.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ENTER|_.MetaKeys.ALT},Ee={id:k.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ESC};function J(n){return n.getContextValue(c.FOCUSING_DOC)&&n.getContextValue(c.FOCUSING_UNIVER_EDITOR)&&n.getContextValue(c.EDITOR_ACTIVATED)&&!n.getContextValue(c.FOCUSING_EDITOR_STANDALONE)}var me=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,Oe=(n,t,i,e)=>{for(var r=e>1?void 0:e?Ce(t,i):t,s=n.length-1,o;s>=0;s--)(o=n[s])&&(r=(e?o(t,i,r):o(r))||r);return e&&r&&me(t,i,r),r},M=(n,t)=>(i,e)=>t(i,e,n);const ye={};let N=class extends c.Disposable{constructor(n,t,i,e,r,s){super(),this._config=n,this._injector=t,this._zenZoneService=i,this._commandService=e,this._menuService=r,this._shortcutService=s,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(pe,ge))}_initCommands(){[L,k,A].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initMenus(){const{menu:n={}}=this._config;[re].forEach(t=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(t),n))})}_initShortcuts(){[Ie,Ee].forEach(n=>{this.disposeWithMe(this._shortcutService.registerShortcut(n))})}};N=Oe([c.OnLifecycle(c.LifecycleStages.Rendered,N),M(1,v.Inject(v.Injector)),M(2,_.IZenZoneService),M(3,c.ICommandService),M(4,_.IMenuService),M(5,_.IShortcutService)],N);var Te=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Me=(n,t,i,e)=>{for(var r=e>1?void 0:e?Re(t,i):t,s=n.length-1,o;s>=0;s--)(o=n[s])&&(r=(e?o(t,i,r):o(r))||r);return e&&r&&Te(t,i,r),r},Q=(n,t)=>(i,e)=>t(i,e,n);d.UniverSheetsZenEditorPlugin=(x=class extends c.Plugin{constructor(t={},i,e){super(),this._config=t,this._injector=i,this._localeService=e,this._initializeDependencies(this._injector),this._config=c.Tools.deepMerge({},ye,this._config)}_initializeDependencies(t){[[N,{useFactory:()=>this._injector.createInstance(N,this._config)}],[b],[V,{useClass:ee}]].forEach(e=>t.add(e))}},C(x,"pluginName","zen-editor"),C(x,"type",c.UniverInstanceType.UNIVER_DOC),x),d.UniverSheetsZenEditorPlugin=Me([Q(1,v.Inject(v.Injector)),Q(2,v.Inject(c.LocaleService))],d.UniverSheetsZenEditorPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
9
+ */var se=p,oe=Symbol.for("react.element"),ce=Symbol.for("react.fragment"),ae=Object.prototype.hasOwnProperty,de=se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,le={key:!0,ref:!0,__self:!0,__source:!0};function X(n,t,i){var e,r={},o=null,s=null;i!==void 0&&(o=""+i),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)ae.call(t,e)&&!le.hasOwnProperty(e)&&(r[e]=t[e]);if(n&&n.defaultProps)for(e in t=n.defaultProps,t)r[e]===void 0&&(r[e]=t[e]);return{$$typeof:oe,type:n,key:o,ref:s,props:r,_owner:de.current}}P.Fragment=ce,P.jsx=X,P.jsxs=X,H.exports=P;var m=H.exports,S=function(){return S=Object.assign||function(n){for(var t,i=1,e=arguments.length;i<e;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},S.apply(this,arguments)},ue=function(n,t){var i={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(i[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(n);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(n,e[r])&&(i[e[r]]=n[e[r]]);return i},k=p.forwardRef(function(n,t){var i=n.icon,e=n.id,r=n.className,o=n.extend,s=ue(n,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),l=p.useRef("_".concat(_e()));return $(i,"".concat(e),{defIds:i.defIds,idSuffix:l.current},S({ref:t,className:a},s),o)});function $(n,t,i,e,r){return p.createElement(n.tag,S(S({key:t},ve(n,i,r)),e),(he(n,i).children||[]).map(function(o,s){return $(o,"".concat(t,"-").concat(n.tag,"-").concat(s),i,void 0,r)}))}function ve(n,t,i){var e=S({},n.attrs);i!=null&&i.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=i.colorChannel1);var r=t.defIds;return!r||r.length===0||(n.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],a=o[1];typeof a=="string"&&(e[s]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function he(n,t){var i,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((i=n.children)===null||i===void 0)&&i.length)?S(S({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?S(S({},r),{attrs:S(S({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):n}function _e(){return Math.random().toString(36).substring(2,8)}k.displayName="UniverIcon";var fe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},G=p.forwardRef(function(n,t){return p.createElement(k,Object.assign({},n,{id:"check-mark-single",ref:t,icon:fe}))});G.displayName="CheckMarkSingle";var Se={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},q=p.forwardRef(function(n,t){return p.createElement(k,Object.assign({},n,{id:"close-single",ref:t,icon:Se}))});q.displayName="CloseSingle";const C={zenEditor:"univer-zen-editor",zenEditorIconWrapper:"univer-zen-editor-icon-wrapper",zenEditorIconContainer:"univer-zen-editor-icon-container",zenEditorIconSuccess:"univer-zen-editor-icon-success",zenEditorIconError:"univer-zen-editor-icon-error",zenEditorCanvasContainer:"univer-zen-editor-canvas-container"},pe="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT";function ge(){const n=p.useRef(null),t=V.useDependency(T.IRenderManagerService),i=V.useDependency(B),e=V.useDependency(c.ICommandService);p.useEffect(()=>{const s=n.current;if(!s)return;const a=t.currentRender$.subscribe(u=>{var E;if(u!==f)return;const v=(E=t.getRenderById(f))==null?void 0:E.engine;v==null||v.setContainer(s)}),l=new ResizeObserver(()=>{const u=s.getBoundingClientRect();i.setPosition(u)});return l.observe(s),()=>{l.unobserve(s),a.unsubscribe()}},[]);function r(){e.executeCommand(x.id)}function o(){e.executeCommand(U.id)}return m.jsxs("div",{className:C.zenEditor,children:[m.jsxs("div",{className:C.zenEditorIconWrapper,children:[m.jsx("span",{className:K(C.zenEditorIconContainer,C.zenEditorIconError),onClick:r,children:m.jsx(q,{style:{fontSize:"22px"}})}),m.jsx("span",{className:K(C.zenEditorIconContainer,C.zenEditorIconSuccess),onClick:o,children:m.jsx(G,{style:{fontSize:"22px"}})})]}),m.jsx("div",{className:C.zenEditorCanvasContainer,ref:n})]})}const Ee={id:U.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ENTER|_.MetaKeys.ALT},Ie={id:x.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ESC};function J(n){return n.getContextValue(c.FOCUSING_DOC)&&n.getContextValue(c.FOCUSING_UNIVER_EDITOR)&&n.getContextValue(c.EDITOR_ACTIVATED)&&!n.getContextValue(c.FOCUSING_EDITOR_STANDALONE)}var me=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,Oe=(n,t,i,e)=>{for(var r=e>1?void 0:e?Ce(t,i):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(e?s(t,i,r):s(r))||r);return e&&r&&me(t,i,r),r},z=(n,t)=>(i,e)=>t(i,e,n);const ye={};let D=class extends c.Disposable{constructor(n,t,i,e,r,o){super(),this._config=n,this._injector=t,this._zenZoneService=i,this._commandService=e,this._menuService=r,this._shortcutService=o,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(pe,ge))}_initCommands(){[b,x,U].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initMenus(){const{menu:n={}}=this._config;[re].forEach(t=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(t),n))})}_initShortcuts(){[Ee,Ie].forEach(n=>{this.disposeWithMe(this._shortcutService.registerShortcut(n))})}};D=Oe([c.OnLifecycle(c.LifecycleStages.Rendered,D),z(1,h.Inject(h.Injector)),z(2,_.IZenZoneService),z(3,c.ICommandService),z(4,_.IMenuService),z(5,_.IShortcutService)],D);var Te=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Ne=(n,t,i,e)=>{for(var r=e>1?void 0:e?Re(t,i):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(e?s(t,i,r):s(r))||r);return e&&r&&Te(t,i,r),r},Q=(n,t)=>(i,e)=>t(i,e,n);d.UniverSheetsZenEditorPlugin=(Z=class extends c.Plugin{constructor(t={},i,e){super(),this._config=t,this._injector=i,this._localeService=e,this._initializeDependencies(this._injector),this._config=c.Tools.deepMerge({},ye,this._config)}_initializeDependencies(t){[[D,{useFactory:()=>this._injector.createInstance(D,this._config)}],[M],[B,{useClass:ee}]].forEach(e=>t.add(e))}},O(Z,"pluginName","zen-editor"),O(Z,"type",c.UniverInstanceType.UNIVER_DOC),Z),d.UniverSheetsZenEditorPlugin=Ne([Q(1,h.Inject(h.Injector)),Q(2,h.Inject(c.LocaleService))],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=x,d.ConfirmZenEditCommand=U,d.OpenZenEditorOperation=b,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-zen-editor",
3
- "version": "0.1.16",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "description": "Zen Editor plugin for Univer Sheets.",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -50,38 +50,38 @@
50
50
  "lib"
51
51
  ],
52
52
  "peerDependencies": {
53
- "@wendellhu/redi": "0.15.4",
53
+ "@wendellhu/redi": "0.15.5",
54
54
  "clsx": ">=2.0.0",
55
55
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
56
56
  "rxjs": ">=7.0.0",
57
- "@univerjs/core": "0.1.16",
58
- "@univerjs/docs": "0.1.16",
59
- "@univerjs/sheets": "0.1.16",
60
- "@univerjs/sheets-ui": "0.1.16",
61
- "@univerjs/engine-render": "0.1.16",
62
- "@univerjs/ui": "0.1.16"
57
+ "@univerjs/core": "0.2.0",
58
+ "@univerjs/engine-render": "0.2.0",
59
+ "@univerjs/docs": "0.2.0",
60
+ "@univerjs/sheets": "0.2.0",
61
+ "@univerjs/sheets-ui": "0.2.0",
62
+ "@univerjs/ui": "0.2.0"
63
63
  },
64
64
  "dependencies": {
65
- "@univerjs/icons": "^0.1.57",
66
- "@univerjs/sheets": "0.1.16"
65
+ "@univerjs/icons": "^0.1.58",
66
+ "@univerjs/sheets": "0.2.0"
67
67
  },
68
68
  "devDependencies": {
69
- "@wendellhu/redi": "0.15.4",
69
+ "@wendellhu/redi": "0.15.5",
70
70
  "clsx": "^2.1.1",
71
71
  "less": "^4.2.0",
72
72
  "react": "18.3.1",
73
73
  "rxjs": "^7.8.1",
74
- "typescript": "^5.4.5",
75
- "vite": "^5.3.1",
74
+ "typescript": "^5.5.3",
75
+ "vite": "^5.3.3",
76
76
  "vitest": "^1.6.0",
77
- "@univerjs/design": "0.1.16",
78
- "@univerjs/docs": "0.1.16",
79
- "@univerjs/engine-render": "0.1.16",
80
- "@univerjs/sheets": "0.1.16",
81
- "@univerjs/core": "0.1.16",
82
- "@univerjs/shared": "0.1.16",
83
- "@univerjs/sheets-ui": "0.1.16",
84
- "@univerjs/ui": "0.1.16"
77
+ "@univerjs/design": "0.2.0",
78
+ "@univerjs/docs": "0.2.0",
79
+ "@univerjs/core": "0.2.0",
80
+ "@univerjs/engine-render": "0.2.0",
81
+ "@univerjs/shared": "0.2.0",
82
+ "@univerjs/sheets": "0.2.0",
83
+ "@univerjs/ui": "0.2.0",
84
+ "@univerjs/sheets-ui": "0.2.0"
85
85
  },
86
86
  "univerSpace": {
87
87
  ".": {