@univerjs/sheets-zen-editor 0.17.0 → 0.18.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.
Files changed (80) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +9 -3
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/sk-SK.js +1 -1
  12. package/lib/cjs/locale/vi-VN.js +1 -1
  13. package/lib/cjs/locale/zh-CN.js +1 -1
  14. package/lib/cjs/locale/zh-TW.js +1 -1
  15. package/lib/es/facade.js +1 -144
  16. package/lib/es/index.js +9 -466
  17. package/lib/es/locale/ca-ES.js +1 -14
  18. package/lib/es/locale/en-US.js +1 -14
  19. package/lib/es/locale/es-ES.js +1 -14
  20. package/lib/es/locale/fa-IR.js +1 -14
  21. package/lib/es/locale/fr-FR.js +1 -14
  22. package/lib/es/locale/ja-JP.js +1 -14
  23. package/lib/es/locale/ko-KR.js +1 -14
  24. package/lib/es/locale/ru-RU.js +1 -14
  25. package/lib/es/locale/sk-SK.js +1 -14
  26. package/lib/es/locale/vi-VN.js +1 -14
  27. package/lib/es/locale/zh-CN.js +1 -14
  28. package/lib/es/locale/zh-TW.js +1 -14
  29. package/lib/facade.js +1 -144
  30. package/lib/index.css +82 -1
  31. package/lib/index.js +9 -466
  32. package/lib/locale/ca-ES.js +1 -14
  33. package/lib/locale/en-US.js +1 -14
  34. package/lib/locale/es-ES.js +1 -14
  35. package/lib/locale/fa-IR.js +1 -14
  36. package/lib/locale/fr-FR.js +1 -14
  37. package/lib/locale/ja-JP.js +1 -14
  38. package/lib/locale/ko-KR.js +1 -14
  39. package/lib/locale/ru-RU.js +1 -14
  40. package/lib/locale/sk-SK.js +1 -14
  41. package/lib/locale/vi-VN.js +1 -14
  42. package/lib/locale/zh-CN.js +1 -14
  43. package/lib/locale/zh-TW.js +1 -14
  44. package/lib/types/commands/commands/zen-editor.command.d.ts +16 -1
  45. package/lib/types/config/config.d.ts +16 -1
  46. package/lib/types/controllers/shortcuts/zen-editor.shortcut.d.ts +17 -2
  47. package/lib/types/controllers/zen-editor-ui.controller.d.ts +15 -0
  48. package/lib/types/controllers/zen-editor.controller.d.ts +15 -0
  49. package/lib/types/facade/f-univer.d.ts +16 -1
  50. package/lib/types/facade/f-workbook.d.ts +15 -0
  51. package/lib/types/locale/ca-ES.d.ts +16 -1
  52. package/lib/types/locale/es-ES.d.ts +16 -1
  53. package/lib/types/locale/fa-IR.d.ts +16 -1
  54. package/lib/types/locale/fr-FR.d.ts +16 -1
  55. package/lib/types/locale/ja-JP.d.ts +16 -1
  56. package/lib/types/locale/ko-KR.d.ts +16 -1
  57. package/lib/types/locale/ru-RU.d.ts +16 -1
  58. package/lib/types/locale/sk-SK.d.ts +16 -1
  59. package/lib/types/locale/vi-VN.d.ts +16 -1
  60. package/lib/types/locale/zh-CN.d.ts +16 -1
  61. package/lib/types/locale/zh-TW.d.ts +16 -1
  62. package/lib/types/menu/menu.d.ts +17 -2
  63. package/lib/types/menu/schema.d.ts +16 -1
  64. package/lib/types/plugin.d.ts +16 -1
  65. package/lib/types/services/zen-editor.service.d.ts +18 -3
  66. package/lib/umd/facade.js +1 -1
  67. package/lib/umd/index.js +9 -3
  68. package/lib/umd/locale/ca-ES.js +1 -1
  69. package/lib/umd/locale/en-US.js +1 -1
  70. package/lib/umd/locale/es-ES.js +1 -1
  71. package/lib/umd/locale/fa-IR.js +1 -1
  72. package/lib/umd/locale/fr-FR.js +1 -1
  73. package/lib/umd/locale/ja-JP.js +1 -1
  74. package/lib/umd/locale/ko-KR.js +1 -1
  75. package/lib/umd/locale/ru-RU.js +1 -1
  76. package/lib/umd/locale/sk-SK.js +1 -1
  77. package/lib/umd/locale/vi-VN.js +1 -1
  78. package/lib/umd/locale/zh-CN.js +1 -1
  79. package/lib/umd/locale/zh-TW.js +1 -1
  80. package/package.json +14 -13
package/lib/cjs/facade.js CHANGED
@@ -1 +1 @@
1
- "use strict";const r=require("@univerjs/core"),u=require("@univerjs/core/facade"),Z=require("@univerjs/docs"),g=require("@univerjs/sheets-ui"),s=require("@univerjs/sheets-zen-editor"),C=require("@univerjs/sheets/facade");class k extends u.FUniver{_initSheetZenEditorEvent(i){const v=i.get(r.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>v.beforeCommandExecuted(e=>{if(e.id===s.OpenZenEditorCommand.id){const t=this.getCommandSheetTarget(e);if(!t)return;const{workbook:c,worksheet:a}=t,d=i.get(g.IEditorBridgeService),E=e.params,{keycode:h,eventType:m}=E,n=d.getEditLocation(),o={row:n.row,column:n.column,eventType:m,keycode:h,workbook:c,worksheet:a,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,o),o.cancel)throw new r.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>v.beforeCommandExecuted(e=>{if(e.id===s.CancelZenEditCommand.id||e.id===s.ConfirmZenEditCommand.id){const t=this.getCommandSheetTarget(e);if(!t)return;const{workbook:c,worksheet:a}=t,d=i.get(g.IEditorBridgeService),E=i.get(r.IUniverInstanceService),h=e.params,{keycode:m,eventType:n}=h,o=d.getEditLocation(),S={row:o.row,column:o.column,eventType:n,keycode:m,workbook:c,worksheet:a,isZenEditor:!0,value:r.RichTextValue.create(E.getUnit(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:e.id===s.ConfirmZenEditCommand.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,S),S.cancel)throw new r.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>v.onCommandExecuted(e=>{if(e.id===s.OpenZenEditorCommand.id){const t=this.getCommandSheetTarget(e);if(!t)return;const{workbook:c,worksheet:a}=t,d=i.get(g.IEditorBridgeService),E=e.params,{keycode:h,eventType:m}=E,n=d.getEditLocation(),o={row:n.row,column:n.column,eventType:m,keycode:h,workbook:c,worksheet:a,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,o)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>v.onCommandExecuted(e=>{if(e.id===s.CancelZenEditCommand.id||e.id===s.ConfirmZenEditCommand.id){const t=this.getCommandSheetTarget(e);if(!t)return;const{workbook:c,worksheet:a}=t,d=i.get(g.IEditorBridgeService),E=e.params,{keycode:h,eventType:m}=E,n=d.getEditLocation(),o={row:n.row,column:n.column,eventType:m,keycode:h,workbook:c,worksheet:a,isZenEditor:!0,isConfirm:e.id===s.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,o)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>v.onCommandExecuted(e=>{if(e.id===Z.RichTextEditingMutation.id){const t=this.getActiveSheet();if(!t)return;const{workbook:c,worksheet:a}=t,d=i.get(g.IEditorBridgeService),E=i.get(r.IUniverInstanceService),h=e.params;if(!d.isVisible().visible)return;const{unitId:m}=h;if(m===r.DOCS_ZEN_EDITOR_UNIT_ID_KEY){const{row:n,column:o}=d.getEditLocation(),S={workbook:c,worksheet:a,row:n,column:o,value:r.RichTextValue.create(E.getUnit(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,S)}}})))}_initialize(i){this._initSheetZenEditorEvent(i)}}u.FUniver.extend(k);class p extends C.FWorkbook{startZenEditingAsync(){return this._injector.get(r.ICommandService).executeCommand(s.OpenZenEditorCommand.id)}endZenEditingAsync(i=!0){const v=this._injector.get(r.ICommandService);return i?v.executeCommand(s.ConfirmZenEditCommand.id):v.executeCommand(s.CancelZenEditCommand.id)}}C.FWorkbook.extend(p);
1
+ let e=require(`@univerjs/core`),t=require(`@univerjs/core/facade`),n=require(`@univerjs/docs`),r=require(`@univerjs/sheets-ui`),i=require(`@univerjs/sheets-zen-editor`),a=require(`@univerjs/sheets/facade`);var o=class extends t.FUniver{_initSheetZenEditorEvent(t){let a=t.get(e.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>a.beforeCommandExecuted(n=>{if(n.id===i.OpenZenEditorCommand.id){let i=this.getCommandSheetTarget(n);if(!i)return;let{workbook:a,worksheet:o}=i,s=t.get(r.IEditorBridgeService),{keycode:c,eventType:l}=n.params,u=s.getEditLocation(),d={row:u.row,column:u.column,eventType:l,keycode:c,workbook:a,worksheet:o,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,d),d.cancel)throw new e.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>a.beforeCommandExecuted(n=>{if(n.id===i.CancelZenEditCommand.id||n.id===i.ConfirmZenEditCommand.id){let a=this.getCommandSheetTarget(n);if(!a)return;let{workbook:o,worksheet:s}=a,c=t.get(r.IEditorBridgeService),l=t.get(e.IUniverInstanceService),{keycode:u,eventType:d}=n.params,f=c.getEditLocation(),p={row:f.row,column:f.column,eventType:d,keycode:u,workbook:o,worksheet:s,isZenEditor:!0,value:e.RichTextValue.create(l.getUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:n.id===i.ConfirmZenEditCommand.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,p),p.cancel)throw new e.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>a.onCommandExecuted(e=>{if(e.id===i.OpenZenEditorCommand.id){let n=this.getCommandSheetTarget(e);if(!n)return;let{workbook:i,worksheet:a}=n,o=t.get(r.IEditorBridgeService),{keycode:s,eventType:c}=e.params,l=o.getEditLocation(),u={row:l.row,column:l.column,eventType:c,keycode:s,workbook:i,worksheet:a,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,u)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>a.onCommandExecuted(e=>{if(e.id===i.CancelZenEditCommand.id||e.id===i.ConfirmZenEditCommand.id){let n=this.getCommandSheetTarget(e);if(!n)return;let{workbook:a,worksheet:o}=n,s=t.get(r.IEditorBridgeService),{keycode:c,eventType:l}=e.params,u=s.getEditLocation(),d={row:u.row,column:u.column,eventType:l,keycode:c,workbook:a,worksheet:o,isZenEditor:!0,isConfirm:e.id===i.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,d)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>a.onCommandExecuted(i=>{if(i.id===n.RichTextEditingMutation.id){let n=this.getActiveSheet();if(!n)return;let{workbook:a,worksheet:o}=n,s=t.get(r.IEditorBridgeService),c=t.get(e.IUniverInstanceService),l=i.params;if(!s.isVisible().visible)return;let{unitId:u}=l;if(u===e.DOCS_ZEN_EDITOR_UNIT_ID_KEY){let{row:t,column:n}=s.getEditLocation(),r={workbook:a,worksheet:o,row:t,column:n,value:e.RichTextValue.create(c.getUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,r)}}})))}_initialize(e){this._initSheetZenEditorEvent(e)}};t.FUniver.extend(o);var s=class extends a.FWorkbook{startZenEditingAsync(){return this._injector.get(e.ICommandService).executeCommand(i.OpenZenEditorCommand.id)}endZenEditingAsync(t=!0){let n=this._injector.get(e.ICommandService);return t?n.executeCommand(i.ConfirmZenEditCommand.id):n.executeCommand(i.CancelZenEditCommand.id)}};a.FWorkbook.extend(s);
package/lib/cjs/index.js CHANGED
@@ -1,7 +1,13 @@
1
- "use strict";var q=Object.defineProperty;var H=(e,t,n)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var h=(e,t,n)=>H(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),T=require("@univerjs/docs-ui"),L=require("@univerjs/engine-render"),_=require("@univerjs/sheets-ui"),d=require("@univerjs/ui"),N=require("@univerjs/sheets"),b=require("rxjs"),m=require("react/jsx-runtime"),k=require("@univerjs/design"),v=require("react"),U={id:"zen-editor.command.open-zen-editor",type:s.CommandType.COMMAND,handler:async e=>{var D;const t=e.get(d.IZenZoneService),n=e.get(T.IEditorService),i=e.get(_.IEditorBridgeService),r=e.get(s.IUniverInstanceService),o=e.get(d.ISidebarService);o.visible&&(o.close(),await s.delayAnimationFrame()),t.open();const c=n.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(c==null)return!1;const a=i.getLatestEditCellState();if(a==null)return!1;const l=(D=a.documentLayoutObject.documentModel)==null?void 0:D.getSnapshot();if(l==null)return!1;r.focusUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:u,drawings:S,drawingsOrder:g,tableSource:I,settings:E}=s.Tools.deepClone(l),C={...c.getDocumentData(),body:u,drawings:S,drawingsOrder:g,tableSource:I,settings:E},f=[{startOffset:0,endOffset:0,collapsed:!0}];return c.focus(),c.setDocumentData(C,f),c.clearUndoRedoHistory(),!0}},Z={id:"zen-editor.command.cancel-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{const t=e.get(d.IZenZoneService),n=e.get(_.IEditorBridgeService),i=e.get(s.IUniverInstanceService),r=e.get(d.ISidebarService);r.visible&&(r.close(),await s.delayAnimationFrame()),t.close();const o=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return o?(i.focusUnit(o.getUnitId()),n.refreshEditCellState(),!0):!1}},w={id:"zen-editor.command.confirm-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{var u;const t=e.get(d.IZenZoneService),n=e.get(_.IEditorBridgeService),i=e.get(s.IUniverInstanceService),r=e.get(T.IEditorService),o=e.get(d.ISidebarService);o.visible&&(o.close(),await s.delayAnimationFrame()),t.close();const c=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(c==null)return!1;const a=e.get(L.IRenderManagerService),l=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(l){const S=l.getUnitId(),g=(u=a.getRenderById(S))==null?void 0:u.with(_.EditingRenderController);if(g){const I=s.Tools.deepClone(c.getDocumentData());I.documentStyle.documentFlavor=s.DocumentFlavor.UNSPECIFIED,g.submitCellData(new s.DocumentDataModel(I))}return i.focusUnit(l.getUnitId()),n.refreshEditCellState(),!0}return!1}},G="@univerjs/sheets-zen-editor",X="0.17.0",$={name:G,version:X},J="sheets-zen-editor.config",j={};function Q(e){const t=e.get(_.IEditorBridgeService);return{id:U.id,type:d.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifyIcon",hidden$:_.getCurrentExclusiveRangeInterest$(e),disabled$:t.currentEditCell$.pipe(b.switchMap(n=>_.getCurrentRangeDisable$(e,{workbookTypes:[N.WorkbookEditablePermission],worksheetTypes:[N.WorksheetEditPermission,N.WorksheetSetCellValuePermission,N.WorksheetSetCellStylePermission],rangeTypes:[N.RangeProtectionPermissionEditPoint]}).pipe(b.map(i=>{var r,o,c,a;return i||((a=(c=(o=(r=n==null?void 0:n.documentLayoutObject.documentModel)==null?void 0:r.getBody())==null?void 0:o.customBlocks)==null?void 0:c.length)!=null?a:0)>0}))))}}const ee={[d.ContextMenuPosition.MAIN_AREA]:{[d.ContextMenuGroup.OTHERS]:{[U.id]:{order:2,menuItemFactory:Q}}}};function P({ref:e,...t}){const{icon:n,id:i,className:r,extend:o,...c}=t,a=`univerjs-icon univerjs-icon-${i} ${r||""}`.trim(),l=v.useRef(`_${ie()}`);return F(n,`${i}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:a,...c},o)}function F(e,t,n,i,r){return v.createElement(e.tag,{key:t,...te(e,n,r),...i},(ne(e,n).children||[]).map((o,c)=>F(o,`${t}-${e.tag}-${c}`,n,void 0,r)))}function te(e,t,n){const i={...e.attrs};n!=null&&n.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=n.colorChannel1),e.tag==="mask"&&i.id&&(i.id=i.id+t.idSuffix),Object.entries(i).forEach(([o,c])=>{o==="mask"&&typeof c=="string"&&(i[o]=c.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});const{defIds:r}=t;return!r||r.length===0||(e.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+t.idSuffix),Object.entries(i).forEach(([o,c])=>{typeof c=="string"&&(i[o]=c.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))})),i}function ne(e,t){var i;const{defIds:n}=t;return!n||n.length===0?e:e.tag==="defs"&&((i=e.children)!=null&&i.length)?{...e,children:e.children.map(r=>typeof r.attrs.id=="string"&&n&&n.includes(r.attrs.id)?{...r,attrs:{...r.attrs,id:r.attrs.id+t.idSuffix}}:r)}:e}function ie(){return Math.random().toString(36).substring(2,8)}P.displayName="UniverIcon";const re={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},V=v.forwardRef(function(t,n){return v.createElement(P,Object.assign({},t,{id:"check-mark-icon",ref:n,icon:re}))});V.displayName="CheckMarkIcon";const oe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},Y=v.forwardRef(function(t,n){return v.createElement(P,Object.assign({},t,{id:"close-icon",ref:n,icon:oe}))});Y.displayName="CloseIcon";class se{constructor(){h(this,"_position",null);h(this,"_position$",new b.BehaviorSubject(null));h(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 z=s.createIdentifier("univer.sheet-zen-editor-manager.service"),ce="ZEN_EDITOR_PLUGIN_",ae=`${ce}ZEN_EDITOR_COMPONENT`,de={id:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${s.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:s.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function le(){const e=v.useRef(null),t=d.useDependency(z),n=d.useDependency(T.IEditorService),i=d.useDependency(s.ICommandService);v.useEffect(()=>{const a=e.current;if(!a)return;const l=n.register({editorUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:de,scrollBar:!0,backScrollOffset:100},a),u=new ResizeObserver(()=>{t.setPosition(a.getBoundingClientRect())});return u.observe(a),()=>{l.dispose(),u.unobserve(a)}},[]);function r(){const a=n.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);a==null||a.blur(),i.executeCommand(Z.id)}function o(){const a=n.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);a==null||a.blur(),i.executeCommand(w.id)}const c="univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors";return m.jsxs("div",{className:"univer-absolute univer-inset-0 univer-size-full univer-bg-white dark:!univer-bg-gray-800",children:[m.jsxs("div",{className:"univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",children:[m.jsx("span",{className:k.clsx(c,`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@univerjs/core`),t=require(`@univerjs/docs-ui`),n=require(`@univerjs/engine-render`),r=require(`@univerjs/sheets-ui`),i=require(`@univerjs/ui`),a=require(`@univerjs/sheets`),o=require(`rxjs`),s=require(`@univerjs/design`),c=require(`@univerjs/icons`),l=require(`react`),u=require(`react/jsx-runtime`);const d={id:`zen-editor.command.open-zen-editor`,type:e.CommandType.COMMAND,handler:async n=>{var a;let o=n.get(i.IZenZoneService),s=n.get(t.IEditorService),c=n.get(r.IEditorBridgeService),l=n.get(e.IUniverInstanceService),u=n.get(i.ISidebarService);u.visible&&(u.close(),await(0,e.delayAnimationFrame)()),o.open();let d=s.getEditor(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(d==null)return!1;let f=c.getLatestEditCellState();if(f==null)return!1;let p=(a=f.documentLayoutObject.documentModel)==null?void 0:a.getSnapshot();if(p==null)return!1;l.focusUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY);let{body:m,drawings:h,drawingsOrder:g,tableSource:_,settings:v}=e.Tools.deepClone(p),y={...d.getDocumentData(),body:m,drawings:h,drawingsOrder:g,tableSource:_,settings:v};return d.focus(),d.setDocumentData(y,[{startOffset:0,endOffset:0,collapsed:!0}]),d.clearUndoRedoHistory(),!0}},f={id:`zen-editor.command.cancel-zen-edit`,type:e.CommandType.COMMAND,handler:async t=>{let n=t.get(i.IZenZoneService),a=t.get(r.IEditorBridgeService),o=t.get(e.IUniverInstanceService),s=t.get(i.ISidebarService);s.visible&&(s.close(),await(0,e.delayAnimationFrame)()),n.close();let c=o.getCurrentUnitForType(e.UniverInstanceType.UNIVER_SHEET);return c?(o.focusUnit(c.getUnitId()),a.refreshEditCellState(),!0):!1}},p={id:`zen-editor.command.confirm-zen-edit`,type:e.CommandType.COMMAND,handler:async a=>{let o=a.get(i.IZenZoneService),s=a.get(r.IEditorBridgeService),c=a.get(e.IUniverInstanceService),l=a.get(t.IEditorService),u=a.get(i.ISidebarService);u.visible&&(u.close(),await(0,e.delayAnimationFrame)()),o.close();let d=l.getEditor(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(d==null)return!1;let f=a.get(n.IRenderManagerService),p=c.getCurrentUnitForType(e.UniverInstanceType.UNIVER_SHEET);if(p){var m;let t=p.getUnitId(),n=(m=f.getRenderById(t))==null?void 0:m.with(r.EditingRenderController);if(n){let t=e.Tools.deepClone(d.getDocumentData());t.documentStyle.documentFlavor=e.DocumentFlavor.UNSPECIFIED,n.submitCellData(new e.DocumentDataModel(t))}return c.focusUnit(p.getUnitId()),s.refreshEditCellState(),!0}return!1}};var m=`@univerjs/sheets-zen-editor`,h=`0.18.0`;const g=`sheets-zen-editor.config`;Symbol(g);const _={};function v(e){let t=e.get(r.IEditorBridgeService);return{id:d.id,type:i.MenuItemType.BUTTON,title:`rightClick.zenEditor`,icon:`AmplifyIcon`,hidden$:(0,r.getCurrentExclusiveRangeInterest$)(e),disabled$:t.currentEditCell$.pipe((0,o.switchMap)(t=>(0,r.getCurrentRangeDisable$)(e,{workbookTypes:[a.WorkbookEditablePermission],worksheetTypes:[a.WorksheetEditPermission,a.WorksheetSetCellValuePermission,a.WorksheetSetCellStylePermission],rangeTypes:[a.RangeProtectionPermissionEditPoint]}).pipe((0,o.map)(e=>{var n,r;return e||((n=t==null||(r=t.documentLayoutObject.documentModel)==null||(r=r.getBody())==null||(r=r.customBlocks)==null?void 0:r.length)==null?0:n)>0}))))}}const y={[i.ContextMenuPosition.MAIN_AREA]:{[i.ContextMenuGroup.OTHERS]:{[d.id]:{order:2,menuItemFactory:v}}}};function b(e){"@babel/helpers - typeof";return b=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},b(e)}function x(e,t){if(b(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(b(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function S(e){var t=x(e,`string`);return b(t)==`symbol`?t:t+``}function C(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=class{constructor(){C(this,`_position`,null),C(this,`_position$`,new o.BehaviorSubject(null)),C(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 T=(0,e.createIdentifier)(`univer.sheet-zen-editor-manager.service`),E={id:e.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${e.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:1/0},documentFlavor:e.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function D(){let n=(0,l.useRef)(null),r=(0,i.useDependency)(T),a=(0,i.useDependency)(t.IEditorService),o=(0,i.useDependency)(e.ICommandService);(0,l.useEffect)(()=>{let t=n.current;if(!t)return;let i=a.register({editorUnitId:e.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:E,scrollBar:!0,backScrollOffset:100},t),o=new ResizeObserver(()=>{r.setPosition(t.getBoundingClientRect())});return o.observe(t),()=>{i.dispose(),o.unobserve(t)}},[]);function d(){let t=a.getEditor(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY);t==null||t.blur(),o.executeCommand(f.id)}function m(){let t=a.getEditor(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY);t==null||t.blur(),o.executeCommand(p.id)}let h=`univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors`;return(0,u.jsxs)(`div`,{className:`
2
+ univer-absolute univer-inset-0 univer-size-full univer-bg-white
3
+ dark:!univer-bg-gray-800
4
+ `,children:[(0,u.jsxs)(`div`,{className:`
5
+ univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center
6
+ univer-justify-center
7
+ `,children:[(0,u.jsx)(`span`,{className:(0,s.clsx)(h,`
2
8
  univer-text-red-500
3
9
  hover:univer-text-red-600
4
- `),onClick:r,children:m.jsx(Y,{className:"univer-size-5"})}),m.jsx("span",{className:k.clsx(c,`
10
+ `),onClick:d,children:(0,u.jsx)(c.CloseIcon,{className:`univer-size-5`})}),(0,u.jsx)(`span`,{className:(0,s.clsx)(h,`
5
11
  univer-text-green-500
6
12
  hover:univer-text-green-600
7
- `),onClick:o,children:m.jsx(V,{className:"univer-size-5"})})]}),m.jsx("div",{ref:e,className:"univer-absolute univer-inset-0 univer-size-full"})]})}const ue={id:w.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>K(e),binding:d.KeyCode.ENTER|d.MetaKeys.ALT},ge={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>K(e),binding:d.KeyCode.ESC};function K(e){return e.getContextValue(s.FOCUSING_DOC)&&e.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(s.EDITOR_ACTIVATED)&&!e.getContextValue(s.FOCUSING_EDITOR_STANDALONE)}var he=Object.getOwnPropertyDescriptor,_e=(e,t,n,i)=>{for(var r=i>1?void 0:i?he(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},y=(e,t)=>(n,i)=>t(n,i,e);let R=class extends s.Disposable{constructor(e,t,n,i){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=n,this._shortcutService=i,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ae,le))}_initCommands(){[U,Z,w].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(ee)}_initShortcuts(){[ue,ge].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};R=_e([y(0,d.IZenZoneService),y(1,s.ICommandService),y(2,d.IMenuManagerService),y(3,d.IShortcutService)],R);var ve=Object.getOwnPropertyDescriptor,Ie=(e,t,n,i)=>{for(var r=i>1?void 0:i?ve(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},B=(e,t)=>(n,i)=>t(n,i,e);let M=class extends s.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(b.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:n}=e,i=_.getEditorObject(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);i!=null&&requestIdleCallback(()=>{i.engine.resizeBySize(t,n),this._calculatePagePosition(i),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:n,docBackground:i}=e,r=n==null?void 0:n.getParent(),{width:o,height:c,pageMarginLeft:a,pageMarginTop:l}=t;if(r==null||o===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:u,height:S}=r;let g=0;const I=l;let E=0,O=0,C=Number.POSITIVE_INFINITY;const{scaleX:f,scaleY:D}=n.getAncestorScale();u>(o+a*2)*f?(g=u/2-o*f/2,g/=f,E=(u-a*2)/f,C=0):(g=a,E=o+a*2,C=(E-u/f)/2),S>c?O=(S-l*2)/D:O=c+l*2,n.resize(E,O),t.translate(g,I),i.translate(g,I);const x=n.getViewport(T.VIEWPORT_KEY.VIEW_MAIN);if(C!==Number.POSITIVE_INFINITY&&x!=null){const W=x.transScroll2ViewportScrollValue(C,0).x;x.scrollToBarPos({x:W})}return this}_scrollToTop(){var n;const e=(n=this._renderManagerService.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:n.with(T.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};M=Ie([B(0,z),B(1,L.IRenderManagerService)],M);var fe=Object.getOwnPropertyDescriptor,me=(e,t,n,i)=>{for(var r=i>1?void 0:i?fe(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},A=(e,t)=>(n,i)=>t(n,i,e),p;exports.UniverSheetsZenEditorPlugin=(p=class extends s.Plugin{constructor(t=j,n,i){super(),this._config=t,this._injector=n,this._configService=i;const{menu:r,...o}=s.merge({},j,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(J,o),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[R],[M],[z,{useClass:se}]].forEach(i=>t.add(i))}onReady(){this._injector.get(R)}onSteady(){this._injector.get(M)}},h(p,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),h(p,"packageName",$.name),h(p,"version",$.version),h(p,"type",s.UniverInstanceType.UNIVER_SHEET),p);exports.UniverSheetsZenEditorPlugin=me([A(1,s.Inject(s.Injector)),A(2,s.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=Z;exports.ConfirmZenEditCommand=w;exports.OpenZenEditorCommand=U;
13
+ `),onClick:m,children:(0,u.jsx)(c.CheckMarkIcon,{className:`univer-size-5`})})]}),(0,u.jsx)(`div`,{ref:n,className:`univer-absolute univer-inset-0 univer-size-full`})]})}const O={id:p.id,description:`shortcut.sheet.zen-edit-confirm`,group:`4_sheet-edit`,preconditions:e=>A(e),binding:i.KeyCode.ENTER|i.MetaKeys.ALT},k={id:f.id,description:`shortcut.sheet.zen-edit-cancel`,group:`4_sheet-edit`,preconditions:e=>A(e),binding:i.KeyCode.ESC};function A(t){return t.getContextValue(e.FOCUSING_DOC)&&t.getContextValue(e.FOCUSING_UNIVER_EDITOR)&&t.getContextValue(e.EDITOR_ACTIVATED)&&!t.getContextValue(e.FOCUSING_EDITOR_STANDALONE)}function j(e,t){return function(n,r){t(n,r,e)}}function M(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let N=class extends e.Disposable{constructor(e,t,n,r){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=n,this._shortcutService=r,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(`ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT`,D))}_initCommands(){[d,f,p].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(y)}_initShortcuts(){[O,k].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};N=M([j(0,i.IZenZoneService),j(1,e.ICommandService),j(2,i.IMenuManagerService),j(3,i.IShortcutService)],N);let P=class extends e.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe((0,o.takeUntil)(this.dispose$)).subscribe(t=>{if(t==null)return;let{width:n,height:i}=t,a=(0,r.getEditorObject)(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);a!=null&&requestIdleCallback(()=>{a.engine.resizeBySize(n,i),this._calculatePagePosition(a),this._scrollToTop()})})}_calculatePagePosition(e){let{document:n,scene:r,docBackground:i}=e,a=r==null?void 0:r.getParent(),{width:o,height:s,pageMarginLeft:c,pageMarginTop:l}=n;if(a==null||o===1/0||s===1/0)return;let{width:u,height:d}=a,f=0,p=l,m=0,h=0,g=1/0,{scaleX:_,scaleY:v}=r.getAncestorScale();u>(o+c*2)*_?(f=u/2-o*_/2,f/=_,m=(u-c*2)/_,g=0):(f=c,m=o+c*2,g=(m-u/_)/2),h=d>s?(d-l*2)/v:s+l*2,r.resize(m,h),n.translate(f,p),i.translate(f,p);let y=r.getViewport(t.VIEWPORT_KEY.VIEW_MAIN);if(g!==1/0&&y!=null){let e=y.transScroll2ViewportScrollValue(g,0).x;y.scrollToBarPos({x:e})}return this}_scrollToTop(){var n;let r=(n=this._renderManagerService.getRenderById(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:n.with(t.DocBackScrollRenderController);r&&r.scrollToRange({startOffset:0,endOffset:0})}};P=M([j(0,T),j(1,n.IRenderManagerService)],P);let F=class extends e.Plugin{constructor(t=_,n,r){super(),this._config=t,this._injector=n,this._configService=r;let{menu:i,...a}=(0,e.merge)({},_,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(g,a),this._initializeDependencies(this._injector)}_initializeDependencies(e){[[N],[P],[T,{useClass:w}]].forEach(t=>e.add(t))}onReady(){this._injector.get(N)}onSteady(){this._injector.get(P)}};C(F,`pluginName`,`SHEET_ZEN_EDITOR_PLUGIN`),C(F,`packageName`,m),C(F,`version`,h),C(F,`type`,e.UniverInstanceType.UNIVER_SHEET),F=M([j(1,(0,e.Inject)(e.Injector)),j(2,e.IConfigService)],F),exports.CancelZenEditCommand=f,exports.ConfirmZenEditCommand=p,exports.OpenZenEditorCommand=d,Object.defineProperty(exports,`UniverSheetsZenEditorPlugin`,{enumerable:!0,get:function(){return F}});
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"Editor a pantalla completa"},shortcut:{sheet:{"zen-edit-cancel":"Cancel·la edició Zen","zen-edit-confirm":"Confirma edició Zen"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`Editor a pantalla completa`},shortcut:{sheet:{"zen-edit-cancel":`Cancel·la edició Zen`,"zen-edit-confirm":`Confirma edició Zen`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"Full Screen Editor"},shortcut:{sheet:{"zen-edit-cancel":"Cancel Zen Edit","zen-edit-confirm":"Confirm Zen Edit"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`Full Screen Editor`},shortcut:{sheet:{"zen-edit-cancel":`Cancel Zen Edit`,"zen-edit-confirm":`Confirm Zen Edit`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"Editor a pantalla completa"},shortcut:{sheet:{"zen-edit-cancel":"Cancelar edición Zen","zen-edit-confirm":"Confirmar edición Zen"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`Editor a pantalla completa`},shortcut:{sheet:{"zen-edit-cancel":`Cancelar edición Zen`,"zen-edit-confirm":`Confirmar edición Zen`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"ویرایشگر تمام صفحه"},shortcut:{sheet:{"zen-edit-cancel":"لغو ویرایش Zen","zen-edit-confirm":"تایید ویرایش Zen"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`ویرایشگر تمام صفحه`},shortcut:{sheet:{"zen-edit-cancel":`لغو ویرایش Zen`,"zen-edit-confirm":`تایید ویرایش Zen`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"Éditeur plein écran"},shortcut:{sheet:{"zen-edit-cancel":"Annuler l'édition plein écran","zen-edit-confirm":"Confirmer l'édition plein écran"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`Éditeur plein écran`},shortcut:{sheet:{"zen-edit-cancel":`Annuler l'édition plein écran`,"zen-edit-confirm":`Confirmer l'édition plein écran`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"禅モード"},shortcut:{sheet:{"zen-edit-cancel":"禅モードをキャンセル","zen-edit-confirm":"禅モードに移行"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`禅モード`},shortcut:{sheet:{"zen-edit-cancel":`禅モードをキャンセル`,"zen-edit-confirm":`禅モードに移行`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"젠 에디터"},shortcut:{sheet:{"zen-edit-cancel":"젠 편집 취소","zen-edit-confirm":"젠 편집 확인"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`젠 에디터`},shortcut:{sheet:{"zen-edit-cancel":`젠 편집 취소`,"zen-edit-confirm":`젠 편집 확인`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"Редактор на весь экран"},shortcut:{sheet:{"zen-edit-cancel":"Отменить Zen редактирование","zen-edit-confirm":"Подтвердить Zen редактирование"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`Редактор на весь экран`},shortcut:{sheet:{"zen-edit-cancel":`Отменить Zen редактирование`,"zen-edit-confirm":`Подтвердить Zen редактирование`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"Editor na celú obrazovku"},shortcut:{sheet:{"zen-edit-cancel":"Zrušiť zen úpravu","zen-edit-confirm":"Potvrdiť zen úpravu"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`Editor na celú obrazovku`},shortcut:{sheet:{"zen-edit-cancel":`Zrušiť zen úpravu`,"zen-edit-confirm":`Potvrdiť zen úpravu`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"Chế độ chỉnh sửa Zen"},shortcut:{sheet:{"zen-edit-cancel":"Hủy chỉnh sửa (trạng thái Zen mode)","zen-edit-confirm":"Bỏ chỉnh sửa (trạng thái Zen mode)"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`Chế độ chỉnh sửa Zen`},shortcut:{sheet:{"zen-edit-cancel":`Hủy chỉnh sửa (trạng thái Zen mode)`,"zen-edit-confirm":`Bỏ chỉnh sửa (trạng thái Zen mode)`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"禅模式编辑"},shortcut:{sheet:{"zen-edit-cancel":"取消编辑(禅模式状态)","zen-edit-confirm":"放弃编辑(禅模式状态)"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`禅模式编辑`},shortcut:{sheet:{"zen-edit-cancel":`取消编辑(禅模式状态)`,"zen-edit-confirm":`放弃编辑(禅模式状态)`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={rightClick:{zenEditor:"禪模式編輯"},shortcut:{sheet:{"zen-edit-cancel":"取消編輯(禪模式狀態)","zen-edit-confirm":"放棄編輯(禪模式狀態)"}}};module.exports=e;
1
+ const e={rightClick:{zenEditor:`禪模式編輯`},shortcut:{sheet:{"zen-edit-cancel":`取消編輯(禪模式狀態)`,"zen-edit-confirm":`放棄編輯(禪模式狀態)`}}};module.exports=e;
package/lib/es/facade.js CHANGED
@@ -1,144 +1 @@
1
- import { ICommandService as u, CanceledError as C, IUniverInstanceService as k, RichTextValue as w, DOCS_ZEN_EDITOR_UNIT_ID_KEY as S } from "@univerjs/core";
2
- import { FUniver as f } from "@univerjs/core/facade";
3
- import { RichTextEditingMutation as T } from "@univerjs/docs";
4
- import { IEditorBridgeService as v } from "@univerjs/sheets-ui";
5
- import { OpenZenEditorCommand as l, CancelZenEditCommand as p, ConfirmZenEditCommand as m } from "@univerjs/sheets-zen-editor";
6
- import { FWorkbook as x } from "@univerjs/sheets/facade";
7
- class b extends f {
8
- // eslint-disable-next-line max-lines-per-function
9
- _initSheetZenEditorEvent(i) {
10
- const E = i.get(u);
11
- this.disposeWithMe(
12
- this.registerEventHandler(
13
- this.Event.BeforeSheetEditStart,
14
- () => E.beforeCommandExecuted((e) => {
15
- if (e.id === l.id) {
16
- const t = this.getCommandSheetTarget(e);
17
- if (!t)
18
- return;
19
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: h } = c, r = o.getEditLocation(), n = {
20
- row: r.row,
21
- column: r.column,
22
- eventType: h,
23
- keycode: a,
24
- workbook: s,
25
- worksheet: d,
26
- isZenEditor: !0
27
- };
28
- if (this.fireEvent(this.Event.BeforeSheetEditStart, n), n.cancel)
29
- throw new C();
30
- }
31
- })
32
- )
33
- ), this.disposeWithMe(
34
- this.registerEventHandler(
35
- this.Event.BeforeSheetEditEnd,
36
- () => E.beforeCommandExecuted((e) => {
37
- if (e.id === p.id || e.id === m.id) {
38
- const t = this.getCommandSheetTarget(e);
39
- if (!t)
40
- return;
41
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = i.get(k), a = e.params, { keycode: h, eventType: r } = a, n = o.getEditLocation(), g = {
42
- row: n.row,
43
- column: n.column,
44
- eventType: r,
45
- keycode: h,
46
- workbook: s,
47
- worksheet: d,
48
- isZenEditor: !0,
49
- value: w.create(c.getUnit(S).getSnapshot()),
50
- isConfirm: e.id === m.id
51
- };
52
- if (this.fireEvent(this.Event.BeforeSheetEditEnd, g), g.cancel)
53
- throw new C();
54
- }
55
- })
56
- )
57
- ), this.disposeWithMe(
58
- this.registerEventHandler(
59
- this.Event.SheetEditStarted,
60
- () => E.onCommandExecuted((e) => {
61
- if (e.id === l.id) {
62
- const t = this.getCommandSheetTarget(e);
63
- if (!t)
64
- return;
65
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: h } = c, r = o.getEditLocation(), n = {
66
- row: r.row,
67
- column: r.column,
68
- eventType: h,
69
- keycode: a,
70
- workbook: s,
71
- worksheet: d,
72
- isZenEditor: !0
73
- };
74
- this.fireEvent(this.Event.SheetEditStarted, n);
75
- }
76
- })
77
- )
78
- ), this.disposeWithMe(
79
- this.registerEventHandler(
80
- this.Event.SheetEditEnded,
81
- () => E.onCommandExecuted((e) => {
82
- if (e.id === p.id || e.id === m.id) {
83
- const t = this.getCommandSheetTarget(e);
84
- if (!t)
85
- return;
86
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: h } = c, r = o.getEditLocation(), n = {
87
- row: r.row,
88
- column: r.column,
89
- eventType: h,
90
- keycode: a,
91
- workbook: s,
92
- worksheet: d,
93
- isZenEditor: !0,
94
- isConfirm: e.id === m.id
95
- };
96
- this.fireEvent(this.Event.SheetEditEnded, n);
97
- }
98
- })
99
- )
100
- ), this.disposeWithMe(
101
- this.registerEventHandler(
102
- this.Event.SheetEditChanging,
103
- () => E.onCommandExecuted((e) => {
104
- if (e.id === T.id) {
105
- const t = this.getActiveSheet();
106
- if (!t)
107
- return;
108
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = i.get(k), a = e.params;
109
- if (!o.isVisible().visible) return;
110
- const { unitId: h } = a;
111
- if (h === S) {
112
- const { row: r, column: n } = o.getEditLocation(), g = {
113
- workbook: s,
114
- worksheet: d,
115
- row: r,
116
- column: n,
117
- value: w.create(c.getUnit(S).getSnapshot()),
118
- isZenEditor: !0
119
- };
120
- this.fireEvent(this.Event.SheetEditChanging, g);
121
- }
122
- }
123
- })
124
- )
125
- );
126
- }
127
- /**
128
- * @ignore
129
- */
130
- _initialize(i) {
131
- this._initSheetZenEditorEvent(i);
132
- }
133
- }
134
- f.extend(b);
135
- class y extends x {
136
- startZenEditingAsync() {
137
- return this._injector.get(u).executeCommand(l.id);
138
- }
139
- endZenEditingAsync(i = !0) {
140
- const E = this._injector.get(u);
141
- return i ? E.executeCommand(m.id) : E.executeCommand(p.id);
142
- }
143
- }
144
- x.extend(y);
1
+ import{CanceledError as e,DOCS_ZEN_EDITOR_UNIT_ID_KEY as t,ICommandService as n,IUniverInstanceService as r,RichTextValue as i}from"@univerjs/core";import{FUniver as a}from"@univerjs/core/facade";import{RichTextEditingMutation as o}from"@univerjs/docs";import{IEditorBridgeService as s}from"@univerjs/sheets-ui";import{CancelZenEditCommand as c,ConfirmZenEditCommand as l,OpenZenEditorCommand as u}from"@univerjs/sheets-zen-editor";import{FWorkbook as d}from"@univerjs/sheets/facade";var f=class extends a{_initSheetZenEditorEvent(a){let d=a.get(n);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>d.beforeCommandExecuted(t=>{if(t.id===u.id){let n=this.getCommandSheetTarget(t);if(!n)return;let{workbook:r,worksheet:i}=n,o=a.get(s),{keycode:c,eventType:l}=t.params,u=o.getEditLocation(),d={row:u.row,column:u.column,eventType:l,keycode:c,workbook:r,worksheet:i,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,d),d.cancel)throw new e}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>d.beforeCommandExecuted(n=>{if(n.id===c.id||n.id===l.id){let o=this.getCommandSheetTarget(n);if(!o)return;let{workbook:c,worksheet:u}=o,d=a.get(s),f=a.get(r),{keycode:p,eventType:m}=n.params,h=d.getEditLocation(),g={row:h.row,column:h.column,eventType:m,keycode:p,workbook:c,worksheet:u,isZenEditor:!0,value:i.create(f.getUnit(t).getSnapshot()),isConfirm:n.id===l.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,g),g.cancel)throw new e}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>d.onCommandExecuted(e=>{if(e.id===u.id){let t=this.getCommandSheetTarget(e);if(!t)return;let{workbook:n,worksheet:r}=t,i=a.get(s),{keycode:o,eventType:c}=e.params,l=i.getEditLocation(),u={row:l.row,column:l.column,eventType:c,keycode:o,workbook:n,worksheet:r,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,u)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>d.onCommandExecuted(e=>{if(e.id===c.id||e.id===l.id){let t=this.getCommandSheetTarget(e);if(!t)return;let{workbook:n,worksheet:r}=t,i=a.get(s),{keycode:o,eventType:c}=e.params,u=i.getEditLocation(),d={row:u.row,column:u.column,eventType:c,keycode:o,workbook:n,worksheet:r,isZenEditor:!0,isConfirm:e.id===l.id};this.fireEvent(this.Event.SheetEditEnded,d)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>d.onCommandExecuted(e=>{if(e.id===o.id){let n=this.getActiveSheet();if(!n)return;let{workbook:o,worksheet:c}=n,l=a.get(s),u=a.get(r),d=e.params;if(!l.isVisible().visible)return;let{unitId:f}=d;if(f===t){let{row:e,column:n}=l.getEditLocation(),r={workbook:o,worksheet:c,row:e,column:n,value:i.create(u.getUnit(t).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,r)}}})))}_initialize(e){this._initSheetZenEditorEvent(e)}};a.extend(f);var p=class extends d{startZenEditingAsync(){return this._injector.get(n).executeCommand(u.id)}endZenEditingAsync(e=!0){let t=this._injector.get(n);return e?t.executeCommand(l.id):t.executeCommand(c.id)}};d.extend(p);export{};