@univerjs/drawing-ui 1.0.0-beta.0 → 1.0.0-beta.2

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 (86) hide show
  1. package/lib/cjs/index.js +115 -58
  2. package/lib/cjs/locale/ar-SA.js +1 -19
  3. package/lib/cjs/locale/ca-ES.js +1 -19
  4. package/lib/cjs/locale/de-DE.js +1 -19
  5. package/lib/cjs/locale/en-US.js +1 -19
  6. package/lib/cjs/locale/es-ES.js +1 -19
  7. package/lib/cjs/locale/fa-IR.js +1 -19
  8. package/lib/cjs/locale/fr-FR.js +1 -19
  9. package/lib/cjs/locale/id-ID.js +1 -19
  10. package/lib/cjs/locale/it-IT.js +1 -19
  11. package/lib/cjs/locale/ja-JP.js +1 -19
  12. package/lib/cjs/locale/ko-KR.js +1 -19
  13. package/lib/cjs/locale/pl-PL.js +1 -19
  14. package/lib/cjs/locale/pt-BR.js +1 -19
  15. package/lib/cjs/locale/ru-RU.js +1 -19
  16. package/lib/cjs/locale/sk-SK.js +1 -19
  17. package/lib/cjs/locale/vi-VN.js +1 -19
  18. package/lib/cjs/locale/zh-CN.js +1 -19
  19. package/lib/cjs/locale/zh-HK.js +1 -19
  20. package/lib/cjs/locale/zh-TW.js +1 -19
  21. package/lib/es/index.js +118 -61
  22. package/lib/es/locale/ar-SA.js +1 -19
  23. package/lib/es/locale/ca-ES.js +1 -19
  24. package/lib/es/locale/de-DE.js +1 -19
  25. package/lib/es/locale/en-US.js +1 -19
  26. package/lib/es/locale/es-ES.js +1 -19
  27. package/lib/es/locale/fa-IR.js +1 -19
  28. package/lib/es/locale/fr-FR.js +1 -19
  29. package/lib/es/locale/id-ID.js +1 -19
  30. package/lib/es/locale/it-IT.js +1 -19
  31. package/lib/es/locale/ja-JP.js +1 -19
  32. package/lib/es/locale/ko-KR.js +1 -19
  33. package/lib/es/locale/pl-PL.js +1 -19
  34. package/lib/es/locale/pt-BR.js +1 -19
  35. package/lib/es/locale/ru-RU.js +1 -19
  36. package/lib/es/locale/sk-SK.js +1 -19
  37. package/lib/es/locale/vi-VN.js +1 -19
  38. package/lib/es/locale/zh-CN.js +1 -19
  39. package/lib/es/locale/zh-HK.js +1 -19
  40. package/lib/es/locale/zh-TW.js +1 -19
  41. package/lib/index.css +32 -10
  42. package/lib/index.js +118 -61
  43. package/lib/locale/ar-SA.js +1 -19
  44. package/lib/locale/ca-ES.js +1 -19
  45. package/lib/locale/de-DE.js +1 -19
  46. package/lib/locale/en-US.js +1 -19
  47. package/lib/locale/es-ES.js +1 -19
  48. package/lib/locale/fa-IR.js +1 -19
  49. package/lib/locale/fr-FR.js +1 -19
  50. package/lib/locale/id-ID.js +1 -19
  51. package/lib/locale/it-IT.js +1 -19
  52. package/lib/locale/ja-JP.js +1 -19
  53. package/lib/locale/ko-KR.js +1 -19
  54. package/lib/locale/pl-PL.js +1 -19
  55. package/lib/locale/pt-BR.js +1 -19
  56. package/lib/locale/ru-RU.js +1 -19
  57. package/lib/locale/sk-SK.js +1 -19
  58. package/lib/locale/vi-VN.js +1 -19
  59. package/lib/locale/zh-CN.js +1 -19
  60. package/lib/locale/zh-HK.js +1 -19
  61. package/lib/locale/zh-TW.js +1 -19
  62. package/lib/types/commands/operations/image-crop.operation.d.ts +4 -2
  63. package/lib/types/controllers/image-cropper.controller.d.ts +11 -2
  64. package/lib/types/locale/en-US.d.ts +0 -18
  65. package/lib/types/views/image-popup-menu/ImagePopupMenu.d.ts +1 -0
  66. package/lib/umd/index.js +2 -2
  67. package/lib/umd/locale/ar-SA.js +1 -1
  68. package/lib/umd/locale/ca-ES.js +1 -1
  69. package/lib/umd/locale/de-DE.js +1 -1
  70. package/lib/umd/locale/en-US.js +1 -1
  71. package/lib/umd/locale/es-ES.js +1 -1
  72. package/lib/umd/locale/fa-IR.js +1 -1
  73. package/lib/umd/locale/fr-FR.js +1 -1
  74. package/lib/umd/locale/id-ID.js +1 -1
  75. package/lib/umd/locale/it-IT.js +1 -1
  76. package/lib/umd/locale/ja-JP.js +1 -1
  77. package/lib/umd/locale/ko-KR.js +1 -1
  78. package/lib/umd/locale/pl-PL.js +1 -1
  79. package/lib/umd/locale/pt-BR.js +1 -1
  80. package/lib/umd/locale/ru-RU.js +1 -1
  81. package/lib/umd/locale/sk-SK.js +1 -1
  82. package/lib/umd/locale/vi-VN.js +1 -1
  83. package/lib/umd/locale/zh-CN.js +1 -1
  84. package/lib/umd/locale/zh-HK.js +1 -1
  85. package/lib/umd/locale/zh-TW.js +1 -1
  86. package/package.json +8 -8
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "Nessun oggetto selezionato"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "Testo a capo",
92
- wrappingStyle: "Stile a capo",
93
91
  square: "Quadrato",
94
92
  topAndBottom: "Superiore e inferiore",
95
93
  inline: "In linea con il testo",
96
94
  behindText: "Dietro il testo",
97
- inFrontText: "Davanti al testo",
98
- wrapText: "Testo a capo",
99
- bothSide: "Entrambi i lati",
100
- leftOnly: "Solo sinistra",
101
- rightOnly: "Solo destra",
102
- distanceFromText: "Distanza dal testo",
103
- top: "Superiore(px)",
104
- left: "Sinistra(px)",
105
- bottom: "Inferiore(px)",
106
- right: "Destra(px)"
107
- },
108
- "image-popup": {
109
- replace: "Sostituisci",
110
- delete: "Elimina",
111
- edit: "Modifica",
112
- crop: "Ritaglia",
113
- reset: "Reimposta dimensione"
95
+ inFrontText: "Davanti al testo"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "選択されたオブジェクトがありません"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "文字列の折り返し",
92
- wrappingStyle: "折り返しのスタイル",
93
91
  square: "四角形",
94
92
  topAndBottom: "上下",
95
93
  inline: "行内",
96
94
  behindText: "文字列の背面",
97
- inFrontText: "文字列の前面",
98
- wrapText: "文字列の折り返し",
99
- bothSide: "両側",
100
- leftOnly: "左のみ",
101
- rightOnly: "右のみ",
102
- distanceFromText: "文字列からの距離",
103
- top: "上(px)",
104
- left: "左(px)",
105
- bottom: "下(px)",
106
- right: "右(px)"
107
- },
108
- "image-popup": {
109
- replace: "置換",
110
- delete: "削除",
111
- edit: "編集",
112
- crop: "トリミング",
113
- reset: "サイズをリセット"
95
+ inFrontText: "文字列の前面"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "선택된 객체가 없습니다"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "텍스트 감싸기",
92
- wrappingStyle: "감싸기 스타일",
93
91
  square: "사각형",
94
92
  topAndBottom: "위아래",
95
93
  inline: "텍스트와 같은 줄",
96
94
  behindText: "텍스트 뒤",
97
- inFrontText: "텍스트 앞",
98
- wrapText: "텍스트 감싸기",
99
- bothSide: "양쪽",
100
- leftOnly: "왼쪽만",
101
- rightOnly: "오른쪽만",
102
- distanceFromText: "텍스트와 거리",
103
- top: "위(px)",
104
- left: "왼쪽(px)",
105
- bottom: "아래(px)",
106
- right: "오른쪽(px)"
107
- },
108
- "image-popup": {
109
- replace: "교체",
110
- delete: "삭제",
111
- edit: "편집",
112
- crop: "자르기",
113
- reset: "크기 초기화"
95
+ inFrontText: "텍스트 앞"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "Brak zaznaczonego obiektu"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "Zawijanie tekstu",
92
- wrappingStyle: "Styl zawijania",
93
91
  square: "Kwadrat",
94
92
  topAndBottom: "Góra i dół",
95
93
  inline: "W linii z tekstem",
96
94
  behindText: "Za tekstem",
97
- inFrontText: "Przed tekstem",
98
- wrapText: "Zawijaj tekst",
99
- bothSide: "Obie strony",
100
- leftOnly: "Tylko lewa",
101
- rightOnly: "Tylko prawa",
102
- distanceFromText: "Odległość od tekstu",
103
- top: "Góra(px)",
104
- left: "Lewo(px)",
105
- bottom: "Dół(px)",
106
- right: "Prawo(px)"
107
- },
108
- "image-popup": {
109
- replace: "Zamień",
110
- delete: "Usuń",
111
- edit: "Edytuj",
112
- crop: "Przytnij",
113
- reset: "Resetuj rozmiar"
95
+ inFrontText: "Przed tekstem"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "Nenhum objeto selecionado"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "Quebra de texto",
92
- wrappingStyle: "Estilo de quebra",
93
91
  square: "Quadrado",
94
92
  topAndBottom: "Superior e inferior",
95
93
  inline: "Em linha com o texto",
96
94
  behindText: "Atrás do texto",
97
- inFrontText: "À frente do texto",
98
- wrapText: "Quebrar texto automaticamente",
99
- bothSide: "Ambos os lados",
100
- leftOnly: "Somente esquerda",
101
- rightOnly: "Somente direita",
102
- distanceFromText: "Distância do texto",
103
- top: "Superior(px)",
104
- left: "Esquerda(px)",
105
- bottom: "Inferior(px)",
106
- right: "Direita(px)"
107
- },
108
- "image-popup": {
109
- replace: "Substituir",
110
- delete: "Excluir",
111
- edit: "Editar",
112
- crop: "Cortar",
113
- reset: "Redefinir tamanho"
95
+ inFrontText: "À frente do texto"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "Нет выбранных объектов"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "Обтекание текстом",
92
- wrappingStyle: "Стиль обтекания",
93
91
  square: "Вокруг рамки",
94
92
  topAndBottom: "Сверху и снизу",
95
93
  inline: "В тексте",
96
94
  behindText: "За текстом",
97
- inFrontText: "Перед текстом",
98
- wrapText: "Обтекание",
99
- bothSide: "С обеих сторон",
100
- leftOnly: "Только слева",
101
- rightOnly: "Только справа",
102
- distanceFromText: "Расстояние от текста",
103
- top: "Сверху (пкс)",
104
- left: "Слева (пкс)",
105
- bottom: "Снизу (пкс)",
106
- right: "Справа (пкс)"
107
- },
108
- "image-popup": {
109
- replace: "Заменить",
110
- delete: "Удалить",
111
- edit: "Редактировать",
112
- crop: "Обрезать",
113
- reset: "Сбросить размер"
95
+ inFrontText: "Перед текстом"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "Nie je vybraný žiadny objekt"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "Obtekanie textu",
92
- wrappingStyle: "Štýl obtekania",
93
91
  square: "Obdĺžnikové",
94
92
  topAndBottom: "Hore a dole",
95
93
  inline: "V riadku s textom",
96
94
  behindText: "Za textom",
97
- inFrontText: "Pred textom",
98
- wrapText: "Obtekať text",
99
- bothSide: "Obe strany",
100
- leftOnly: "Len ľavá",
101
- rightOnly: "Len pravá",
102
- distanceFromText: "Vzdialenosť od textu",
103
- top: "Hore (px)",
104
- left: "Vľavo (px)",
105
- bottom: "Dole (px)",
106
- right: "Vpravo (px)"
107
- },
108
- "image-popup": {
109
- replace: "Nahradiť",
110
- delete: "Odstrániť",
111
- edit: "Upraviť",
112
- crop: "Orezať",
113
- reset: "Obnoviť veľkosť"
95
+ inFrontText: "Pred textom"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "Không có đối tượng nào được chọn"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "Bố cục văn bản",
92
- wrappingStyle: "Kiểu bố cục",
93
91
  square: "Vuông",
94
92
  topAndBottom: "Trên và dưới",
95
93
  inline: "Cùng dòng với văn bản",
96
94
  behindText: "Phía sau văn bản",
97
- inFrontText: "Phía trước văn bản",
98
- wrapText: "Bọc văn bản",
99
- bothSide: "Cả hai bên",
100
- leftOnly: "Chỉ bên trái",
101
- rightOnly: "Chỉ bên phải",
102
- distanceFromText: "Khoảng cách từ văn bản",
103
- top: "Trên (px)",
104
- left: "Trái (px)",
105
- bottom: "Dưới (px)",
106
- right: "Phải (px)"
107
- },
108
- "image-popup": {
109
- replace: "Thay thế",
110
- delete: "Xóa",
111
- edit: "Chỉnh sửa",
112
- crop: "Cắt",
113
- reset: "Đặt lại kích thước"
95
+ inFrontText: "Phía trước văn bản"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "未选中任何对象"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "文字环绕",
92
- wrappingStyle: "环绕方式",
93
91
  square: "四周型",
94
92
  topAndBottom: "上下型",
95
93
  inline: "嵌入型",
96
94
  behindText: "衬于文字下方",
97
- inFrontText: "浮于文字上方",
98
- wrapText: "自动换行",
99
- bothSide: "两侧",
100
- leftOnly: "左侧",
101
- rightOnly: "右侧",
102
- distanceFromText: "距正文",
103
- top: "上(px)",
104
- left: "左(px)",
105
- bottom: "下(px)",
106
- right: "右(px)"
107
- },
108
- "image-popup": {
109
- replace: "替换",
110
- delete: "删除",
111
- edit: "编辑",
112
- crop: "裁剪",
113
- reset: "重置大小"
95
+ inFrontText: "浮于文字上方"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "未選取任何物件"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "文繞圖",
92
- wrappingStyle: "文繞圖方式",
93
91
  square: "矩形",
94
92
  topAndBottom: "上及下",
95
93
  inline: "與文字排列",
96
94
  behindText: "文字在前",
97
- inFrontText: "文字在後",
98
- wrapText: "自動換行",
99
- bothSide: "兩側",
100
- leftOnly: "僅左側",
101
- rightOnly: "僅右側",
102
- distanceFromText: "與文字距離",
103
- top: "上(px)",
104
- left: "左(px)",
105
- bottom: "下(px)",
106
- right: "右(px)"
107
- },
108
- "image-popup": {
109
- replace: "替換",
110
- delete: "刪除",
111
- edit: "編輯",
112
- crop: "裁切",
113
- reset: "重置大小"
95
+ inFrontText: "文字在後"
114
96
  }
115
97
  } };
116
98
 
@@ -88,29 +88,11 @@ const locale = { "drawing-ui": {
88
88
  null: "未選取任何物件"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "文繞圖",
92
- wrappingStyle: "文繞圖方式",
93
91
  square: "矩形",
94
92
  topAndBottom: "上及下",
95
93
  inline: "與文字排列",
96
94
  behindText: "文字在前",
97
- inFrontText: "文字在後",
98
- wrapText: "自動換行",
99
- bothSide: "兩側",
100
- leftOnly: "僅左側",
101
- rightOnly: "僅右側",
102
- distanceFromText: "與文字距離",
103
- top: "上(px)",
104
- left: "左(px)",
105
- bottom: "下(px)",
106
- right: "右(px)"
107
- },
108
- "image-popup": {
109
- replace: "替換",
110
- delete: "刪除",
111
- edit: "編輯",
112
- crop: "裁切",
113
- reset: "重置大小"
95
+ inFrontText: "文字在後"
114
96
  }
115
97
  } };
116
98
 
@@ -15,9 +15,11 @@
15
15
  */
16
16
  import type { IDrawingSearch, IOperation } from '@univerjs/core';
17
17
  export declare const OpenImageCropOperation: IOperation<IDrawingSearch>;
18
- export declare const CloseImageCropOperation: IOperation<{
18
+ export interface ICloseImageCropOperationParams {
19
19
  isAuto?: boolean;
20
- }>;
20
+ isCancel?: boolean;
21
+ }
22
+ export declare const CloseImageCropOperation: IOperation<ICloseImageCropOperationParams>;
21
23
  export declare enum CropType {
22
24
  FREE = "0",
23
25
  R1_1 = "1",
@@ -16,7 +16,7 @@
16
16
  import { Disposable, ICommandService, IUniverInstanceService, LocaleService } from '@univerjs/core';
17
17
  import { IDrawingManagerService } from '@univerjs/drawing';
18
18
  import { IRenderManagerService } from '@univerjs/engine-render';
19
- import { IMessageService } from '@univerjs/ui';
19
+ import { ILayoutService, IMessageService, IShortcutService } from '@univerjs/ui';
20
20
  export declare class ImageCropperController extends Disposable {
21
21
  private readonly _commandService;
22
22
  private readonly _drawingManagerService;
@@ -24,8 +24,14 @@ export declare class ImageCropperController extends Disposable {
24
24
  private _univerInstanceService;
25
25
  private readonly _messageService;
26
26
  private readonly _localeService;
27
+ private readonly _shortcutService;
28
+ private readonly _layoutService;
27
29
  private _sceneListenerOnImageMap;
28
- constructor(_commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService);
30
+ private readonly _cropShortcutDisposables;
31
+ private readonly _cropSnapshots;
32
+ private _pendingCropSnapshot;
33
+ private _activeCropSession;
34
+ constructor(_commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService, _shortcutService: IShortcutService, _layoutService: ILayoutService);
29
35
  private _init;
30
36
  private _initAutoCrop;
31
37
  private _calculateSrcRectByRatio;
@@ -34,6 +40,9 @@ export declare class ImageCropperController extends Disposable {
34
40
  private _searchCropObject;
35
41
  private _initCloseCrop;
36
42
  private _getApplyObjectByCropObject;
43
+ private _captureCropSnapshot;
44
+ private _restoreCropSnapshot;
45
+ private _registerCropShortcuts;
37
46
  private _addListenerOnImage;
38
47
  private _addHoverForImageCopper;
39
48
  private _endCropListener;
@@ -104,30 +104,12 @@ declare const locale: {
104
104
  };
105
105
  null: string;
106
106
  };
107
- 'image-popup': {
108
- replace: string;
109
- delete: string;
110
- edit: string;
111
- crop: string;
112
- reset: string;
113
- };
114
107
  'image-text-wrap': {
115
- title: string;
116
- wrappingStyle: string;
117
108
  square: string;
118
109
  topAndBottom: string;
119
110
  inline: string;
120
111
  behindText: string;
121
112
  inFrontText: string;
122
- wrapText: string;
123
- bothSide: string;
124
- leftOnly: string;
125
- rightOnly: string;
126
- distanceFromText: string;
127
- top: string;
128
- left: string;
129
- bottom: string;
130
- right: string;
131
113
  };
132
114
  };
133
115
  };
@@ -22,6 +22,7 @@ export interface IImagePopupMenuItem {
22
22
  type?: 'button' | 'select';
23
23
  value?: string;
24
24
  options?: Array<{
25
+ icon?: string;
25
26
  label: unknown;
26
27
  value: string;
27
28
  }>;