@univerjs/sheets-zen-editor 0.15.3 → 0.15.4

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/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.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:m,eventType:h}=E,n=d.getEditLocation(),o={row:n.row,column:n.column,eventType:h,keycode:m,workbook:c,worksheet:a,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,o),o.cancel)throw new r.CanceledError}})),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),m=e.params,{keycode:h,eventType:n}=m,o=d.getEditLocation(),S={row:o.row,column:o.column,eventType:n,keycode:h,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.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:m,eventType:h}=E,n=d.getEditLocation(),o={row:n.row,column:n.column,eventType:h,keycode:m,workbook:c,worksheet:a,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,o)}})),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:m,eventType:h}=E,n=d.getEditLocation(),o={row:n.row,column:n.column,eventType:h,keycode:m,workbook:c,worksheet:a,isZenEditor:!0,isConfirm:e.id===s.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,o)}})),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),m=e.params;if(!d.isVisible().visible)return;const{unitId:h}=m;if(h===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 w 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(w);
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);
@@ -0,0 +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;
package/lib/es/facade.js CHANGED
@@ -1,117 +1,127 @@
1
- import { ICommandService as u, CanceledError as k, IUniverInstanceService as p, RichTextValue as w, DOCS_ZEN_EDITOR_UNIT_ID_KEY as S } from "@univerjs/core";
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
2
  import { FUniver as f } from "@univerjs/core/facade";
3
3
  import { RichTextEditingMutation as T } from "@univerjs/docs";
4
4
  import { IEditorBridgeService as v } from "@univerjs/sheets-ui";
5
- import { OpenZenEditorCommand as l, CancelZenEditCommand as C, ConfirmZenEditCommand as m } from "@univerjs/sheets-zen-editor";
5
+ import { OpenZenEditorCommand as l, CancelZenEditCommand as p, ConfirmZenEditCommand as m } from "@univerjs/sheets-zen-editor";
6
6
  import { FWorkbook as x } from "@univerjs/sheets/facade";
7
7
  class b extends f {
8
8
  // eslint-disable-next-line max-lines-per-function
9
9
  _initSheetZenEditorEvent(i) {
10
- const h = i.get(u);
11
- this.registerEventHandler(
12
- this.Event.BeforeSheetEditStart,
13
- () => h.beforeCommandExecuted((e) => {
14
- if (e.id === l.id) {
15
- const t = this.getCommandSheetTarget(e);
16
- if (!t)
17
- return;
18
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: E } = c, r = o.getEditLocation(), n = {
19
- row: r.row,
20
- column: r.column,
21
- eventType: E,
22
- keycode: a,
23
- workbook: s,
24
- worksheet: d,
25
- isZenEditor: !0
26
- };
27
- if (this.fireEvent(this.Event.BeforeSheetEditStart, n), n.cancel)
28
- throw new k();
29
- }
30
- })
31
- ), this.registerEventHandler(
32
- this.Event.BeforeSheetEditEnd,
33
- () => h.beforeCommandExecuted((e) => {
34
- if (e.id === C.id || e.id === m.id) {
35
- const t = this.getCommandSheetTarget(e);
36
- if (!t)
37
- return;
38
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = i.get(p), a = e.params, { keycode: E, eventType: r } = a, n = o.getEditLocation(), g = {
39
- row: n.row,
40
- column: n.column,
41
- eventType: r,
42
- keycode: E,
43
- workbook: s,
44
- worksheet: d,
45
- isZenEditor: !0,
46
- value: w.create(c.getUnit(S).getSnapshot()),
47
- isConfirm: e.id === m.id
48
- };
49
- if (this.fireEvent(this.Event.BeforeSheetEditEnd, g), g.cancel)
50
- throw new k();
51
- }
52
- })
53
- ), this.registerEventHandler(
54
- this.Event.SheetEditStarted,
55
- () => h.onCommandExecuted((e) => {
56
- if (e.id === l.id) {
57
- const t = this.getCommandSheetTarget(e);
58
- if (!t)
59
- return;
60
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: E } = c, r = o.getEditLocation(), n = {
61
- row: r.row,
62
- column: r.column,
63
- eventType: E,
64
- keycode: a,
65
- workbook: s,
66
- worksheet: d,
67
- isZenEditor: !0
68
- };
69
- this.fireEvent(this.Event.SheetEditStarted, n);
70
- }
71
- })
72
- ), this.registerEventHandler(
73
- this.Event.SheetEditEnded,
74
- () => h.onCommandExecuted((e) => {
75
- if (e.id === C.id || e.id === m.id) {
76
- const t = this.getCommandSheetTarget(e);
77
- if (!t)
78
- return;
79
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: E } = c, r = o.getEditLocation(), n = {
80
- row: r.row,
81
- column: r.column,
82
- eventType: E,
83
- keycode: a,
84
- workbook: s,
85
- worksheet: d,
86
- isZenEditor: !0,
87
- isConfirm: e.id === m.id
88
- };
89
- this.fireEvent(this.Event.SheetEditEnded, n);
90
- }
91
- })
92
- ), this.registerEventHandler(
93
- this.Event.SheetEditChanging,
94
- () => h.onCommandExecuted((e) => {
95
- if (e.id === T.id) {
96
- const t = this.getActiveSheet();
97
- if (!t)
98
- return;
99
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = i.get(p), a = e.params;
100
- if (!o.isVisible().visible) return;
101
- const { unitId: E } = a;
102
- if (E === S) {
103
- const { row: r, column: n } = o.getEditLocation(), g = {
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,
104
24
  workbook: s,
105
25
  worksheet: d,
106
- row: r,
107
- column: n,
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,
108
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,
109
72
  isZenEditor: !0
110
73
  };
111
- this.fireEvent(this.Event.SheetEditChanging, g);
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
+ }
112
122
  }
113
- }
114
- })
123
+ })
124
+ )
115
125
  );
116
126
  }
117
127
  /**
@@ -127,8 +137,8 @@ class y extends x {
127
137
  return this._injector.get(u).executeCommand(l.id);
128
138
  }
129
139
  endZenEditingAsync(i = !0) {
130
- const h = this._injector.get(u);
131
- return i ? h.executeCommand(m.id) : h.executeCommand(C.id);
140
+ const E = this._injector.get(u);
141
+ return i ? E.executeCommand(m.id) : E.executeCommand(p.id);
132
142
  }
133
143
  }
134
144
  x.extend(y);
@@ -0,0 +1,14 @@
1
+ const e = {
2
+ rightClick: {
3
+ zenEditor: "Editor na celú obrazovku"
4
+ },
5
+ shortcut: {
6
+ sheet: {
7
+ "zen-edit-cancel": "Zrušiť zen úpravu",
8
+ "zen-edit-confirm": "Potvrdiť zen úpravu"
9
+ }
10
+ }
11
+ };
12
+ export {
13
+ e as default
14
+ };
package/lib/facade.js CHANGED
@@ -1,117 +1,127 @@
1
- import { ICommandService as u, CanceledError as k, IUniverInstanceService as p, RichTextValue as w, DOCS_ZEN_EDITOR_UNIT_ID_KEY as S } from "@univerjs/core";
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
2
  import { FUniver as f } from "@univerjs/core/facade";
3
3
  import { RichTextEditingMutation as T } from "@univerjs/docs";
4
4
  import { IEditorBridgeService as v } from "@univerjs/sheets-ui";
5
- import { OpenZenEditorCommand as l, CancelZenEditCommand as C, ConfirmZenEditCommand as m } from "@univerjs/sheets-zen-editor";
5
+ import { OpenZenEditorCommand as l, CancelZenEditCommand as p, ConfirmZenEditCommand as m } from "@univerjs/sheets-zen-editor";
6
6
  import { FWorkbook as x } from "@univerjs/sheets/facade";
7
7
  class b extends f {
8
8
  // eslint-disable-next-line max-lines-per-function
9
9
  _initSheetZenEditorEvent(i) {
10
- const h = i.get(u);
11
- this.registerEventHandler(
12
- this.Event.BeforeSheetEditStart,
13
- () => h.beforeCommandExecuted((e) => {
14
- if (e.id === l.id) {
15
- const t = this.getCommandSheetTarget(e);
16
- if (!t)
17
- return;
18
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: E } = c, r = o.getEditLocation(), n = {
19
- row: r.row,
20
- column: r.column,
21
- eventType: E,
22
- keycode: a,
23
- workbook: s,
24
- worksheet: d,
25
- isZenEditor: !0
26
- };
27
- if (this.fireEvent(this.Event.BeforeSheetEditStart, n), n.cancel)
28
- throw new k();
29
- }
30
- })
31
- ), this.registerEventHandler(
32
- this.Event.BeforeSheetEditEnd,
33
- () => h.beforeCommandExecuted((e) => {
34
- if (e.id === C.id || e.id === m.id) {
35
- const t = this.getCommandSheetTarget(e);
36
- if (!t)
37
- return;
38
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = i.get(p), a = e.params, { keycode: E, eventType: r } = a, n = o.getEditLocation(), g = {
39
- row: n.row,
40
- column: n.column,
41
- eventType: r,
42
- keycode: E,
43
- workbook: s,
44
- worksheet: d,
45
- isZenEditor: !0,
46
- value: w.create(c.getUnit(S).getSnapshot()),
47
- isConfirm: e.id === m.id
48
- };
49
- if (this.fireEvent(this.Event.BeforeSheetEditEnd, g), g.cancel)
50
- throw new k();
51
- }
52
- })
53
- ), this.registerEventHandler(
54
- this.Event.SheetEditStarted,
55
- () => h.onCommandExecuted((e) => {
56
- if (e.id === l.id) {
57
- const t = this.getCommandSheetTarget(e);
58
- if (!t)
59
- return;
60
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: E } = c, r = o.getEditLocation(), n = {
61
- row: r.row,
62
- column: r.column,
63
- eventType: E,
64
- keycode: a,
65
- workbook: s,
66
- worksheet: d,
67
- isZenEditor: !0
68
- };
69
- this.fireEvent(this.Event.SheetEditStarted, n);
70
- }
71
- })
72
- ), this.registerEventHandler(
73
- this.Event.SheetEditEnded,
74
- () => h.onCommandExecuted((e) => {
75
- if (e.id === C.id || e.id === m.id) {
76
- const t = this.getCommandSheetTarget(e);
77
- if (!t)
78
- return;
79
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = e.params, { keycode: a, eventType: E } = c, r = o.getEditLocation(), n = {
80
- row: r.row,
81
- column: r.column,
82
- eventType: E,
83
- keycode: a,
84
- workbook: s,
85
- worksheet: d,
86
- isZenEditor: !0,
87
- isConfirm: e.id === m.id
88
- };
89
- this.fireEvent(this.Event.SheetEditEnded, n);
90
- }
91
- })
92
- ), this.registerEventHandler(
93
- this.Event.SheetEditChanging,
94
- () => h.onCommandExecuted((e) => {
95
- if (e.id === T.id) {
96
- const t = this.getActiveSheet();
97
- if (!t)
98
- return;
99
- const { workbook: s, worksheet: d } = t, o = i.get(v), c = i.get(p), a = e.params;
100
- if (!o.isVisible().visible) return;
101
- const { unitId: E } = a;
102
- if (E === S) {
103
- const { row: r, column: n } = o.getEditLocation(), g = {
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,
104
24
  workbook: s,
105
25
  worksheet: d,
106
- row: r,
107
- column: n,
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,
108
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,
109
72
  isZenEditor: !0
110
73
  };
111
- this.fireEvent(this.Event.SheetEditChanging, g);
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
+ }
112
122
  }
113
- }
114
- })
123
+ })
124
+ )
115
125
  );
116
126
  }
117
127
  /**
@@ -127,8 +137,8 @@ class y extends x {
127
137
  return this._injector.get(u).executeCommand(l.id);
128
138
  }
129
139
  endZenEditingAsync(i = !0) {
130
- const h = this._injector.get(u);
131
- return i ? h.executeCommand(m.id) : h.executeCommand(C.id);
140
+ const E = this._injector.get(u);
141
+ return i ? E.executeCommand(m.id) : E.executeCommand(p.id);
132
142
  }
133
143
  }
134
144
  x.extend(y);
@@ -0,0 +1,14 @@
1
+ const e = {
2
+ rightClick: {
3
+ zenEditor: "Editor na celú obrazovku"
4
+ },
5
+ shortcut: {
6
+ sheet: {
7
+ "zen-edit-cancel": "Zrušiť zen úpravu",
8
+ "zen-edit-confirm": "Potvrdiť zen úpravu"
9
+ }
10
+ }
11
+ };
12
+ export {
13
+ e as default
14
+ };
@@ -0,0 +1,3 @@
1
+ import { default as enUS } from './en-US';
2
+ declare const locale: typeof enUS;
3
+ export default locale;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(t,h){typeof exports=="object"&&typeof module<"u"?h(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/docs"),require("@univerjs/sheets-ui"),require("@univerjs/sheets-zen-editor"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/core/facade","@univerjs/docs","@univerjs/sheets-ui","@univerjs/sheets-zen-editor","@univerjs/sheets/facade"],h):(t=typeof globalThis<"u"?globalThis:t||self,h(t.UniverCore,t.UniverCoreFacade,t.UniverDocs,t.UniverSheetsUi,t.UniverSheetsZenEditor,t.UniverSheetsFacade))})(this,(function(t,h,f,S,o,C){"use strict";class l extends h.FUniver{_initSheetZenEditorEvent(n){const u=n.get(t.ICommandService);this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>u.beforeCommandExecuted(e=>{if(e.id===o.OpenZenEditorCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,s=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:m}=v,r=s.getEditLocation(),d={row:r.row,column:r.column,eventType:m,keycode:E,workbook:c,worksheet:a,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,d),d.cancel)throw new t.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>u.beforeCommandExecuted(e=>{if(e.id===o.CancelZenEditCommand.id||e.id===o.ConfirmZenEditCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,s=n.get(S.IEditorBridgeService),v=n.get(t.IUniverInstanceService),E=e.params,{keycode:m,eventType:r}=E,d=s.getEditLocation(),g={row:d.row,column:d.column,eventType:r,keycode:m,workbook:c,worksheet:a,isZenEditor:!0,value:t.RichTextValue.create(v.getUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:e.id===o.ConfirmZenEditCommand.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,g),g.cancel)throw new t.CanceledError}})),this.registerEventHandler(this.Event.SheetEditStarted,()=>u.onCommandExecuted(e=>{if(e.id===o.OpenZenEditorCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,s=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:m}=v,r=s.getEditLocation(),d={row:r.row,column:r.column,eventType:m,keycode:E,workbook:c,worksheet:a,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,d)}})),this.registerEventHandler(this.Event.SheetEditEnded,()=>u.onCommandExecuted(e=>{if(e.id===o.CancelZenEditCommand.id||e.id===o.ConfirmZenEditCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,s=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:m}=v,r=s.getEditLocation(),d={row:r.row,column:r.column,eventType:m,keycode:E,workbook:c,worksheet:a,isZenEditor:!0,isConfirm:e.id===o.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,d)}})),this.registerEventHandler(this.Event.SheetEditChanging,()=>u.onCommandExecuted(e=>{if(e.id===f.RichTextEditingMutation.id){const i=this.getActiveSheet();if(!i)return;const{workbook:c,worksheet:a}=i,s=n.get(S.IEditorBridgeService),v=n.get(t.IUniverInstanceService),E=e.params;if(!s.isVisible().visible)return;const{unitId:m}=E;if(m===t.DOCS_ZEN_EDITOR_UNIT_ID_KEY){const{row:r,column:d}=s.getEditLocation(),g={workbook:c,worksheet:a,row:r,column:d,value:t.RichTextValue.create(v.getUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,g)}}}))}_initialize(n){this._initSheetZenEditorEvent(n)}}h.FUniver.extend(l);class k extends C.FWorkbook{startZenEditingAsync(){return this._injector.get(t.ICommandService).executeCommand(o.OpenZenEditorCommand.id)}endZenEditingAsync(n=!0){const u=this._injector.get(t.ICommandService);return n?u.executeCommand(o.ConfirmZenEditCommand.id):u.executeCommand(o.CancelZenEditCommand.id)}}C.FWorkbook.extend(k)}));
1
+ (function(t,u){typeof exports=="object"&&typeof module<"u"?u(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/docs"),require("@univerjs/sheets-ui"),require("@univerjs/sheets-zen-editor"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/core/facade","@univerjs/docs","@univerjs/sheets-ui","@univerjs/sheets-zen-editor","@univerjs/sheets/facade"],u):(t=typeof globalThis<"u"?globalThis:t||self,u(t.UniverCore,t.UniverCoreFacade,t.UniverDocs,t.UniverSheetsUi,t.UniverSheetsZenEditor,t.UniverSheetsFacade))})(this,(function(t,u,f,S,o,C){"use strict";class p extends u.FUniver{_initSheetZenEditorEvent(n){const m=n.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>m.beforeCommandExecuted(e=>{if(e.id===o.OpenZenEditorCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:h}=v,r=d.getEditLocation(),s={row:r.row,column:r.column,eventType:h,keycode:E,workbook:c,worksheet:a,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,s),s.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>m.beforeCommandExecuted(e=>{if(e.id===o.CancelZenEditCommand.id||e.id===o.ConfirmZenEditCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=n.get(t.IUniverInstanceService),E=e.params,{keycode:h,eventType:r}=E,s=d.getEditLocation(),g={row:s.row,column:s.column,eventType:r,keycode:h,workbook:c,worksheet:a,isZenEditor:!0,value:t.RichTextValue.create(v.getUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:e.id===o.ConfirmZenEditCommand.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,g),g.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>m.onCommandExecuted(e=>{if(e.id===o.OpenZenEditorCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:h}=v,r=d.getEditLocation(),s={row:r.row,column:r.column,eventType:h,keycode:E,workbook:c,worksheet:a,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>m.onCommandExecuted(e=>{if(e.id===o.CancelZenEditCommand.id||e.id===o.ConfirmZenEditCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:h}=v,r=d.getEditLocation(),s={row:r.row,column:r.column,eventType:h,keycode:E,workbook:c,worksheet:a,isZenEditor:!0,isConfirm:e.id===o.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>m.onCommandExecuted(e=>{if(e.id===f.RichTextEditingMutation.id){const i=this.getActiveSheet();if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=n.get(t.IUniverInstanceService),E=e.params;if(!d.isVisible().visible)return;const{unitId:h}=E;if(h===t.DOCS_ZEN_EDITOR_UNIT_ID_KEY){const{row:r,column:s}=d.getEditLocation(),g={workbook:c,worksheet:a,row:r,column:s,value:t.RichTextValue.create(v.getUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,g)}}})))}_initialize(n){this._initSheetZenEditorEvent(n)}}u.FUniver.extend(p);class l extends C.FWorkbook{startZenEditingAsync(){return this._injector.get(t.ICommandService).executeCommand(o.OpenZenEditorCommand.id)}endZenEditingAsync(n=!0){const m=this._injector.get(t.ICommandService);return n?m.executeCommand(o.ConfirmZenEditCommand.id):m.executeCommand(o.CancelZenEditCommand.id)}}C.FWorkbook.extend(l)}));
@@ -0,0 +1 @@
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorSkSK=n())})(this,(function(){"use strict";return{rightClick:{zenEditor:"Editor na celú obrazovku"},shortcut:{sheet:{"zen-edit-cancel":"Zrušiť zen úpravu","zen-edit-confirm":"Potvrdiť zen úpravu"}}}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-zen-editor",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
4
4
  "private": false,
5
5
  "description": "Zen Editor plugin for Univer Sheets.",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -65,14 +65,14 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@univerjs/icons": "^1.1.1",
68
- "@univerjs/core": "0.15.3",
69
- "@univerjs/docs-ui": "0.15.3",
70
- "@univerjs/docs": "0.15.3",
71
- "@univerjs/engine-render": "0.15.3",
72
- "@univerjs/sheets": "0.15.3",
73
- "@univerjs/sheets-ui": "0.15.3",
74
- "@univerjs/ui": "0.15.3",
75
- "@univerjs/design": "0.15.3"
68
+ "@univerjs/core": "0.15.4",
69
+ "@univerjs/docs": "0.15.4",
70
+ "@univerjs/design": "0.15.4",
71
+ "@univerjs/sheets": "0.15.4",
72
+ "@univerjs/docs-ui": "0.15.4",
73
+ "@univerjs/sheets-ui": "0.15.4",
74
+ "@univerjs/ui": "0.15.4",
75
+ "@univerjs/engine-render": "0.15.4"
76
76
  },
77
77
  "devDependencies": {
78
78
  "postcss": "^8.5.6",
@@ -81,8 +81,8 @@
81
81
  "tailwindcss": "3.4.18",
82
82
  "typescript": "^5.9.3",
83
83
  "vite": "^7.3.1",
84
- "vitest": "^4.0.16",
85
- "@univerjs-infra/shared": "0.15.3"
84
+ "vitest": "^4.0.18",
85
+ "@univerjs-infra/shared": "0.15.4"
86
86
  },
87
87
  "scripts": {
88
88
  "test": "vitest run",