suneditor 2.45.0 → 2.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/suneditor.min.js +2 -2
- package/package.json +5 -4
- package/src/lang/fa.d.ts +5 -0
- package/src/lang/fa.js +188 -0
- package/src/lang/tr.d.ts +5 -0
- package/src/lang/tr.js +191 -0
- package/src/lib/constructor.js +11 -1
- package/src/lib/context.js +2 -1
- package/src/lib/core.d.ts +34 -1
- package/src/lib/core.js +477 -266
- package/src/lib/util.js +104 -36
- package/src/plugins/dialog/audio.js +3 -1
- package/src/plugins/dialog/image.js +12 -1
- package/src/plugins/dialog/video.js +4 -2
- package/src/plugins/modules/_anchor.js +1 -1
- package/src/plugins/modules/resizing.js +206 -199
|
@@ -77,30 +77,30 @@
|
|
|
77
77
|
center: icons.align_center
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
/** resize controller, button */
|
|
82
82
|
let resize_div_container = this.setController_resize(core);
|
|
83
83
|
context.resizing.resizeContainer = resize_div_container;
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
context.resizing.resizeDiv = resize_div_container.querySelector('.se-modal-resize');
|
|
86
86
|
context.resizing.resizeDot = resize_div_container.querySelector('.se-resize-dot');
|
|
87
87
|
context.resizing.resizeDisplay = resize_div_container.querySelector('.se-resize-display');
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
let resize_button = this.setController_button(core);
|
|
90
90
|
context.resizing.resizeButton = resize_button;
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
let resize_handles = context.resizing.resizeHandles = context.resizing.resizeDot.querySelectorAll('span');
|
|
93
93
|
context.resizing.resizeButtonGroup = resize_button.querySelector('._se_resizing_btn_group');
|
|
94
94
|
context.resizing.rotationButtons = resize_button.querySelectorAll('._se_resizing_btn_group ._se_rotation');
|
|
95
95
|
context.resizing.percentageButtons = resize_button.querySelectorAll('._se_resizing_btn_group ._se_percentage');
|
|
96
|
-
|
|
96
|
+
|
|
97
97
|
context.resizing.alignMenu = resize_button.querySelector('.se-resizing-align-list');
|
|
98
98
|
context.resizing.alignMenuList = context.resizing.alignMenu.querySelectorAll('button');
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
context.resizing.alignButton = resize_button.querySelector('._se_resizing_align_button');
|
|
101
101
|
context.resizing.autoSizeButton = resize_button.querySelector('._se_resizing_btn_group ._se_auto_size');
|
|
102
102
|
context.resizing.captionButton = resize_button.querySelector('._se_resizing_caption_button');
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
/** add event listeners */
|
|
105
105
|
resize_div_container.addEventListener('mousedown', function (e) { e.preventDefault(); });
|
|
106
106
|
resize_handles[0].addEventListener('mousedown', this.onMouseDown_resize_handle.bind(core));
|
|
@@ -112,128 +112,128 @@
|
|
|
112
112
|
resize_handles[6].addEventListener('mousedown', this.onMouseDown_resize_handle.bind(core));
|
|
113
113
|
resize_handles[7].addEventListener('mousedown', this.onMouseDown_resize_handle.bind(core));
|
|
114
114
|
resize_button.addEventListener('click', this.onClick_resizeButton.bind(core));
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
/** append html */
|
|
117
117
|
context.element.relative.appendChild(resize_div_container);
|
|
118
118
|
context.element.relative.appendChild(resize_button);
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
/** empty memory */
|
|
121
121
|
resize_div_container = null, resize_button = null, resize_handles = null;
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
/** resize controller, button (image, iframe, video) */
|
|
125
125
|
setController_resize: function (core) {
|
|
126
126
|
const resize_container = core.util.createElement('DIV');
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
resize_container.className = 'se-controller se-resizing-container';
|
|
129
129
|
resize_container.style.display = 'none';
|
|
130
130
|
resize_container.innerHTML = '' +
|
|
131
131
|
'<div class="se-modal-resize"></div>' +
|
|
132
132
|
'<div class="se-resize-dot">' +
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
133
|
+
'<span class="tl"></span>' +
|
|
134
|
+
'<span class="tr"></span>' +
|
|
135
|
+
'<span class="bl"></span>' +
|
|
136
|
+
'<span class="br"></span>' +
|
|
137
|
+
'<span class="lw"></span>' +
|
|
138
|
+
'<span class="th"></span>' +
|
|
139
|
+
'<span class="rw"></span>' +
|
|
140
|
+
'<span class="bh"></span>' +
|
|
141
|
+
'<div class="se-resize-display"></div>' +
|
|
142
142
|
'</div>';
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
return resize_container;
|
|
145
145
|
},
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
setController_button: function (core) {
|
|
148
148
|
const lang = core.lang;
|
|
149
149
|
const icons = core.icons;
|
|
150
150
|
const resize_button = core.util.createElement("DIV");
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
resize_button.className = "se-controller se-controller-resizing";
|
|
153
153
|
resize_button.innerHTML = '' +
|
|
154
154
|
'<div class="se-arrow se-arrow-up"></div>' +
|
|
155
155
|
'<div class="se-btn-group _se_resizing_btn_group">' +
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
156
|
+
'<button type="button" data-command="percent" data-value="1" class="se-tooltip _se_percentage">' +
|
|
157
|
+
'<span>100%</span>' +
|
|
158
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.resize100 + '</span></span>' +
|
|
159
|
+
'</button>' +
|
|
160
|
+
'<button type="button" data-command="percent" data-value="0.75" class="se-tooltip _se_percentage">' +
|
|
161
|
+
'<span>75%</span>' +
|
|
162
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.resize75 + '</span></span>' +
|
|
163
|
+
'</button>' +
|
|
164
|
+
'<button type="button" data-command="percent" data-value="0.5" class="se-tooltip _se_percentage">' +
|
|
165
|
+
'<span>50%</span>' +
|
|
166
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.resize50 + '</span></span>' +
|
|
167
|
+
'</button>' +
|
|
168
|
+
'<button type="button" data-command="auto" class="se-btn se-tooltip _se_auto_size">' +
|
|
169
|
+
icons.auto_size +
|
|
170
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.autoSize + '</span></span>' +
|
|
171
|
+
'</button>' +
|
|
172
|
+
'<button type="button" data-command="rotate" data-value="-90" class="se-btn se-tooltip _se_rotation">' +
|
|
173
|
+
icons.rotate_left +
|
|
174
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.rotateLeft + '</span></span>' +
|
|
175
|
+
'</button>' +
|
|
176
|
+
'<button type="button" data-command="rotate" data-value="90" class="se-btn se-tooltip _se_rotation">' +
|
|
177
|
+
icons.rotate_right +
|
|
178
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.rotateRight + '</span></span>' +
|
|
179
|
+
'</button>' +
|
|
180
180
|
'</div>' +
|
|
181
181
|
'<div class="se-btn-group" style="padding-top: 0;">' +
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
182
|
+
'<button type="button" data-command="mirror" data-value="h" class="se-btn se-tooltip">' +
|
|
183
|
+
icons.mirror_horizontal +
|
|
184
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.mirrorHorizontal + '</span></span>' +
|
|
185
|
+
'</button>' +
|
|
186
|
+
'<button type="button" data-command="mirror" data-value="v" class="se-btn se-tooltip">' +
|
|
187
|
+
icons.mirror_vertical +
|
|
188
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.mirrorVertical + '</span></span>' +
|
|
189
|
+
'</button>' +
|
|
190
|
+
'<button type="button" data-command="onalign" class="se-btn se-tooltip _se_resizing_align_button">' +
|
|
191
|
+
icons.align_justify +
|
|
192
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.toolbar.align + '</span></span>' +
|
|
193
|
+
'</button>' +
|
|
194
|
+
'<div class="se-btn-group-sub sun-editor-common se-list-layer se-resizing-align-list">' +
|
|
195
|
+
'<div class="se-list-inner">' +
|
|
196
|
+
'<ul class="se-list-basic">' +
|
|
197
|
+
'<li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="basic">' +
|
|
198
|
+
icons.align_justify +
|
|
199
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.dialogBox.basic + '</span></span>' +
|
|
200
|
+
'</button></li>' +
|
|
201
|
+
'<li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="left">' +
|
|
202
|
+
icons.align_left +
|
|
203
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.dialogBox.left + '</span></span>' +
|
|
204
|
+
'</button></li>' +
|
|
205
|
+
'<li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="center">' +
|
|
206
|
+
icons.align_center +
|
|
207
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.dialogBox.center + '</span></span>' +
|
|
208
|
+
'</button></li>' +
|
|
209
|
+
'<li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="right">' +
|
|
210
|
+
icons.align_right +
|
|
211
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.dialogBox.right + '</span></span>' +
|
|
212
|
+
'</button></li>' +
|
|
213
|
+
'</ul>' +
|
|
214
|
+
'</div>' +
|
|
215
|
+
'</div>' +
|
|
216
|
+
'<button type="button" data-command="caption" class="se-btn se-tooltip _se_resizing_caption_button">' +
|
|
217
|
+
icons.caption +
|
|
218
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.dialogBox.caption + '</span></span>' +
|
|
219
|
+
'</button>' +
|
|
220
|
+
'<button type="button" data-command="revert" class="se-btn se-tooltip">' +
|
|
221
|
+
icons.revert +
|
|
222
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.dialogBox.revertButton + '</span></span>' +
|
|
223
|
+
'</button>' +
|
|
224
|
+
'<button type="button" data-command="update" class="se-btn se-tooltip">' +
|
|
225
|
+
icons.modify +
|
|
226
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.edit + '</span></span>' +
|
|
227
|
+
'</button>' +
|
|
228
|
+
'<button type="button" data-command="delete" class="se-btn se-tooltip">' +
|
|
229
|
+
icons.delete +
|
|
230
|
+
'<span class="se-tooltip-inner"><span class="se-tooltip-text">' + lang.controller.remove + '</span></span>' +
|
|
231
|
+
'</button>' +
|
|
232
232
|
'</div>';
|
|
233
|
-
|
|
233
|
+
|
|
234
234
|
return resize_button;
|
|
235
235
|
},
|
|
236
|
-
|
|
236
|
+
|
|
237
237
|
/**
|
|
238
238
|
* @description Gets the width size
|
|
239
239
|
* @param {Object} contextPlugin context object of plugin (core.context[plugin])
|
|
@@ -246,12 +246,12 @@
|
|
|
246
246
|
if (!element) element = contextPlugin._element;
|
|
247
247
|
if (!cover) cover = contextPlugin._cover;
|
|
248
248
|
if (!container) container = contextPlugin._container;
|
|
249
|
-
|
|
249
|
+
|
|
250
250
|
if (!element) return '';
|
|
251
|
-
|
|
251
|
+
|
|
252
252
|
return !/%$/.test(element.style.width) ? element.style.width : ((container && this.util.getNumber(container.style.width, 2)) || 100) + '%';
|
|
253
253
|
},
|
|
254
|
-
|
|
254
|
+
|
|
255
255
|
/**
|
|
256
256
|
* @description Gets the height size
|
|
257
257
|
* @param {Object} contextPlugin context object of plugin (core.context[plugin])
|
|
@@ -264,9 +264,9 @@
|
|
|
264
264
|
if (!element) element = contextPlugin._element;
|
|
265
265
|
if (!cover) cover = contextPlugin._cover;
|
|
266
266
|
if (!container) container = contextPlugin._container;
|
|
267
|
-
|
|
267
|
+
|
|
268
268
|
if (!container || !cover) return (element && element.style.height) || '';
|
|
269
|
-
|
|
269
|
+
|
|
270
270
|
return this.util.getNumber(cover.style.paddingBottom, 0) > 0 && !this.context.resizing._rotateVertical ? cover.style.height : (!/%$/.test(element.style.height) || !/%$/.test(element.style.width) ? element.style.height : ((container && this.util.getNumber(container.style.height, 2)) || 100) + '%');
|
|
271
271
|
},
|
|
272
272
|
|
|
@@ -278,27 +278,27 @@
|
|
|
278
278
|
_module_setModifyInputSize: function (contextPlugin, pluginObj) {
|
|
279
279
|
const percentageRotation = contextPlugin._onlyPercentage && this.context.resizing._rotateVertical;
|
|
280
280
|
contextPlugin.proportion.checked = contextPlugin._proportionChecked = contextPlugin._element.getAttribute('data-proportion') !== 'false';
|
|
281
|
-
|
|
281
|
+
|
|
282
282
|
let x = percentageRotation ? '' : this.plugins.resizing._module_getSizeX.call(this, contextPlugin);
|
|
283
283
|
if (x === contextPlugin._defaultSizeX) x = '';
|
|
284
284
|
if (contextPlugin._onlyPercentage) x = this.util.getNumber(x, 2);
|
|
285
285
|
contextPlugin.inputX.value = x;
|
|
286
286
|
pluginObj.setInputSize.call(this, 'x');
|
|
287
|
-
|
|
287
|
+
|
|
288
288
|
if (!contextPlugin._onlyPercentage) {
|
|
289
289
|
let y = percentageRotation ? '' : this.plugins.resizing._module_getSizeY.call(this, contextPlugin);
|
|
290
290
|
if (y === contextPlugin._defaultSizeY) y = '';
|
|
291
291
|
if (contextPlugin._onlyPercentage) y = this.util.getNumber(y, 2);
|
|
292
292
|
contextPlugin.inputY.value = y;
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
|
|
295
295
|
contextPlugin.inputX.disabled = percentageRotation ? true : false;
|
|
296
296
|
contextPlugin.inputY.disabled = percentageRotation ? true : false;
|
|
297
297
|
contextPlugin.proportion.disabled = percentageRotation ? true : false;
|
|
298
|
-
|
|
298
|
+
|
|
299
299
|
pluginObj.setRatio.call(this);
|
|
300
300
|
},
|
|
301
|
-
|
|
301
|
+
|
|
302
302
|
/**
|
|
303
303
|
* @description It is called in "setInputSize" (input tag keyupEvent),
|
|
304
304
|
* checks the value entered in the input tag,
|
|
@@ -311,15 +311,15 @@
|
|
|
311
311
|
if (xy === 'x' && contextPlugin.inputX.value > 100) contextPlugin.inputX.value = 100;
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
|
|
315
315
|
if (contextPlugin.proportion.checked && contextPlugin._ratio && /\d/.test(contextPlugin.inputX.value) && /\d/.test(contextPlugin.inputY.value)) {
|
|
316
316
|
const xUnit = contextPlugin.inputX.value.replace(/\d+|\./g, '') || contextPlugin.sizeUnit;
|
|
317
317
|
const yUnit = contextPlugin.inputY.value.replace(/\d+|\./g, '') || contextPlugin.sizeUnit;
|
|
318
|
-
|
|
318
|
+
|
|
319
319
|
if (xUnit !== yUnit) return;
|
|
320
|
-
|
|
320
|
+
|
|
321
321
|
const dec = xUnit === '%' ? 2 : 0;
|
|
322
|
-
|
|
322
|
+
|
|
323
323
|
if (xy === 'x') {
|
|
324
324
|
contextPlugin.inputY.value = this.util.getNumber(contextPlugin._ratioY * this.util.getNumber(contextPlugin.inputX.value, dec), dec) + yUnit;
|
|
325
325
|
} else {
|
|
@@ -327,7 +327,7 @@
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
},
|
|
330
|
-
|
|
330
|
+
|
|
331
331
|
/**
|
|
332
332
|
* @description It is called in "setRatio" (input and proportionCheck tags changeEvent),
|
|
333
333
|
* checks the value of the input tag, calculates the ratio, and resets it in the input tag.
|
|
@@ -336,17 +336,17 @@
|
|
|
336
336
|
_module_setRatio: function (contextPlugin) {
|
|
337
337
|
const xValue = contextPlugin.inputX.value;
|
|
338
338
|
const yValue = contextPlugin.inputY.value;
|
|
339
|
-
|
|
339
|
+
|
|
340
340
|
if (contextPlugin.proportion.checked && /\d+/.test(xValue) && /\d+/.test(yValue)) {
|
|
341
341
|
const xUnit = xValue.replace(/\d+|\./g, '') || contextPlugin.sizeUnit;
|
|
342
342
|
const yUnit = yValue.replace(/\d+|\./g, '') || contextPlugin.sizeUnit;
|
|
343
|
-
|
|
343
|
+
|
|
344
344
|
if (xUnit !== yUnit) {
|
|
345
345
|
contextPlugin._ratio = false;
|
|
346
346
|
} else if (!contextPlugin._ratio) {
|
|
347
347
|
const x = this.util.getNumber(xValue, 0);
|
|
348
348
|
const y = this.util.getNumber(yValue, 0);
|
|
349
|
-
|
|
349
|
+
|
|
350
350
|
contextPlugin._ratio = true;
|
|
351
351
|
contextPlugin._ratioX = x / y;
|
|
352
352
|
contextPlugin._ratioY = y / x;
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
contextPlugin._ratio = false;
|
|
356
356
|
}
|
|
357
357
|
},
|
|
358
|
-
|
|
358
|
+
|
|
359
359
|
/**
|
|
360
360
|
* @description Revert size of element to origin size (plugin._origin_w, plugin._origin_h)
|
|
361
361
|
* @param {Object} contextPlugin context object of plugin (core.context[plugin])
|
|
@@ -368,7 +368,7 @@
|
|
|
368
368
|
contextPlugin.inputY.value = contextPlugin._origin_h;
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
|
-
|
|
371
|
+
|
|
372
372
|
/**
|
|
373
373
|
* @description Save the size data (element.setAttribute("data-size"))
|
|
374
374
|
* Used at the "setSize" method
|
|
@@ -377,10 +377,13 @@
|
|
|
377
377
|
_module_saveCurrentSize: function (contextPlugin) {
|
|
378
378
|
const x = this.plugins.resizing._module_getSizeX.call(this, contextPlugin);
|
|
379
379
|
const y = this.plugins.resizing._module_getSizeY.call(this, contextPlugin);
|
|
380
|
+
// add too width, height attribute
|
|
381
|
+
contextPlugin._element.setAttribute('width', x.replace('px', ''));
|
|
382
|
+
contextPlugin._element.setAttribute('height', y.replace('px', ''));
|
|
380
383
|
contextPlugin._element.setAttribute('data-size', x + ',' + y);
|
|
381
384
|
if (!!contextPlugin._videoRatio) contextPlugin._videoRatio = y;
|
|
382
385
|
},
|
|
383
|
-
|
|
386
|
+
|
|
384
387
|
/**
|
|
385
388
|
* @description Call the resizing module
|
|
386
389
|
* @param {Element} targetElement Resizing target element
|
|
@@ -391,38 +394,38 @@
|
|
|
391
394
|
const contextResizing = this.context.resizing;
|
|
392
395
|
const contextPlugin = this.context[plugin];
|
|
393
396
|
contextResizing._resize_plugin = plugin;
|
|
394
|
-
|
|
397
|
+
|
|
395
398
|
const resizeContainer = contextResizing.resizeContainer;
|
|
396
399
|
const resizeDiv = contextResizing.resizeDiv;
|
|
397
400
|
const offset = this.util.getOffset(targetElement, this.context.element.wysiwygFrame);
|
|
398
|
-
|
|
401
|
+
|
|
399
402
|
const isVertical = contextResizing._rotateVertical = /^(90|270)$/.test(Math.abs(targetElement.getAttribute('data-rotate')).toString());
|
|
400
|
-
|
|
403
|
+
|
|
401
404
|
const w = isVertical ? targetElement.offsetHeight : targetElement.offsetWidth;
|
|
402
405
|
const h = isVertical ? targetElement.offsetWidth : targetElement.offsetHeight;
|
|
403
406
|
const t = offset.top;
|
|
404
407
|
const l = offset.left - this.context.element.wysiwygFrame.scrollLeft;
|
|
405
|
-
|
|
408
|
+
|
|
406
409
|
resizeContainer.style.top = t + 'px';
|
|
407
410
|
resizeContainer.style.left = l + 'px';
|
|
408
411
|
resizeContainer.style.width = w + 'px';
|
|
409
412
|
resizeContainer.style.height = h + 'px';
|
|
410
|
-
|
|
413
|
+
|
|
411
414
|
resizeDiv.style.top = '0px';
|
|
412
415
|
resizeDiv.style.left = '0px';
|
|
413
416
|
resizeDiv.style.width = w + 'px';
|
|
414
417
|
resizeDiv.style.height = h + 'px';
|
|
415
|
-
|
|
418
|
+
|
|
416
419
|
let align = targetElement.getAttribute('data-align') || 'basic';
|
|
417
420
|
align = align === 'none' ? 'basic' : align;
|
|
418
|
-
|
|
421
|
+
|
|
419
422
|
// text
|
|
420
423
|
const container = this.util.getParentElement(targetElement, this.util.isComponent);
|
|
421
424
|
const cover = this.util.getParentElement(targetElement, 'FIGURE');
|
|
422
425
|
const displayX = this.plugins.resizing._module_getSizeX.call(this, contextPlugin, targetElement, cover, container) || 'auto';
|
|
423
426
|
const displayY = contextPlugin._onlyPercentage && plugin === 'image' ? '' : ', ' + (this.plugins.resizing._module_getSizeY.call(this, contextPlugin, targetElement, cover, container) || 'auto');
|
|
424
427
|
this.util.changeTxt(contextResizing.resizeDisplay, this.lang.dialogBox[align] + ' (' + displayX + displayY + ')');
|
|
425
|
-
|
|
428
|
+
|
|
426
429
|
// resizing display
|
|
427
430
|
contextResizing.resizeButtonGroup.style.display = contextPlugin._resizing ? '' : 'none';
|
|
428
431
|
const resizeDotShow = contextPlugin._resizing && !contextPlugin._resizeDotHide && !contextPlugin._onlyPercentage ? 'flex' : 'none';
|
|
@@ -430,12 +433,12 @@
|
|
|
430
433
|
for (let i = 0, len = resizeHandles.length; i < len; i++) {
|
|
431
434
|
resizeHandles[i].style.display = resizeDotShow;
|
|
432
435
|
}
|
|
433
|
-
|
|
436
|
+
|
|
434
437
|
if (contextPlugin._resizing) {
|
|
435
438
|
const rotations = contextResizing.rotationButtons;
|
|
436
439
|
rotations[0].style.display = rotations[1].style.display = contextPlugin._rotation ? '' : 'none';
|
|
437
440
|
}
|
|
438
|
-
|
|
441
|
+
|
|
439
442
|
// align icon
|
|
440
443
|
if (contextPlugin._alignHide) {
|
|
441
444
|
contextResizing.alignButton.style.display = 'none';
|
|
@@ -448,7 +451,7 @@
|
|
|
448
451
|
else this.util.removeClass(alignList[i], 'on');
|
|
449
452
|
}
|
|
450
453
|
}
|
|
451
|
-
|
|
454
|
+
|
|
452
455
|
// percentage active
|
|
453
456
|
const pButtons = contextResizing.percentageButtons;
|
|
454
457
|
const value = /%$/.test(targetElement.style.width) && /%$/.test(container.style.width) ? (this.util.getNumber(container.style.width, 0) / 100) + '' : '' ;
|
|
@@ -459,7 +462,7 @@
|
|
|
459
462
|
this.util.removeClass(pButtons[i], 'active');
|
|
460
463
|
}
|
|
461
464
|
}
|
|
462
|
-
|
|
465
|
+
|
|
463
466
|
// caption display, active
|
|
464
467
|
if (!contextPlugin._captionShow) {
|
|
465
468
|
contextResizing.captionButton.style.display = 'none';
|
|
@@ -483,16 +486,20 @@
|
|
|
483
486
|
}
|
|
484
487
|
|
|
485
488
|
this.setControllerPosition(contextResizing.resizeButton, resizeContainer, 'bottom', addOffset);
|
|
486
|
-
|
|
489
|
+
const onControlsOff = function () {
|
|
490
|
+
this.util.setDisabledButtons.call(this.util, false, this.resizingDisabledButtons);
|
|
491
|
+
this.history._resetCachingButton();
|
|
492
|
+
};
|
|
493
|
+
this.controllersOn(resizeContainer, contextResizing.resizeButton, onControlsOff.bind(this), targetElement, plugin);
|
|
487
494
|
this.util.setDisabledButtons(true, this.resizingDisabledButtons);
|
|
488
|
-
|
|
495
|
+
|
|
489
496
|
contextResizing._resize_w = w;
|
|
490
497
|
contextResizing._resize_h = h;
|
|
491
|
-
|
|
498
|
+
|
|
492
499
|
const originSize = (targetElement.getAttribute('origin-size') || '').split(',');
|
|
493
500
|
contextResizing._origin_w = originSize[0] || targetElement.naturalWidth;
|
|
494
501
|
contextResizing._origin_h = originSize[1] || targetElement.naturalHeight;
|
|
495
|
-
|
|
502
|
+
|
|
496
503
|
return {
|
|
497
504
|
w: w,
|
|
498
505
|
h: h,
|
|
@@ -500,7 +507,7 @@
|
|
|
500
507
|
l: l
|
|
501
508
|
};
|
|
502
509
|
},
|
|
503
|
-
|
|
510
|
+
|
|
504
511
|
_closeAlignMenu: null,
|
|
505
512
|
|
|
506
513
|
/**
|
|
@@ -512,17 +519,17 @@
|
|
|
512
519
|
this.context.resizing.alignMenu.style.top = (alignButton.offsetTop + alignButton.offsetHeight) + 'px';
|
|
513
520
|
this.context.resizing.alignMenu.style.left = (alignButton.offsetLeft - alignButton.offsetWidth / 2) + 'px';
|
|
514
521
|
this.context.resizing.alignMenu.style.display = 'block';
|
|
515
|
-
|
|
522
|
+
|
|
516
523
|
this.plugins.resizing._closeAlignMenu = function () {
|
|
517
524
|
this.util.removeClass(this.context.resizing.alignButton, 'on');
|
|
518
525
|
this.context.resizing.alignMenu.style.display = 'none';
|
|
519
526
|
this.removeDocEvent('click', this.plugins.resizing._closeAlignMenu);
|
|
520
527
|
this.plugins.resizing._closeAlignMenu = null;
|
|
521
528
|
}.bind(this);
|
|
522
|
-
|
|
529
|
+
|
|
523
530
|
this.addDocEvent('click', this.plugins.resizing._closeAlignMenu);
|
|
524
531
|
},
|
|
525
|
-
|
|
532
|
+
|
|
526
533
|
/**
|
|
527
534
|
* @description Click event of resizing toolbar
|
|
528
535
|
* Performs the action of the clicked toolbar button.
|
|
@@ -530,26 +537,26 @@
|
|
|
530
537
|
*/
|
|
531
538
|
onClick_resizeButton: function (e) {
|
|
532
539
|
e.stopPropagation();
|
|
533
|
-
|
|
540
|
+
|
|
534
541
|
const target = e.target;
|
|
535
542
|
const command = target.getAttribute('data-command') || target.parentNode.getAttribute('data-command');
|
|
536
|
-
|
|
543
|
+
|
|
537
544
|
if (!command) return;
|
|
538
|
-
|
|
545
|
+
|
|
539
546
|
const value = target.getAttribute('data-value') || target.parentNode.getAttribute('data-value');
|
|
540
|
-
|
|
547
|
+
|
|
541
548
|
const pluginName = this.context.resizing._resize_plugin;
|
|
542
549
|
const currentContext = this.context[pluginName];
|
|
543
550
|
const contextEl = currentContext._element;
|
|
544
551
|
const currentModule = this.plugins[pluginName];
|
|
545
|
-
|
|
552
|
+
|
|
546
553
|
e.preventDefault();
|
|
547
|
-
|
|
554
|
+
|
|
548
555
|
if (typeof this.plugins.resizing._closeAlignMenu === 'function') {
|
|
549
556
|
this.plugins.resizing._closeAlignMenu();
|
|
550
557
|
if (command === 'onalign') return;
|
|
551
558
|
}
|
|
552
|
-
|
|
559
|
+
|
|
553
560
|
switch (command) {
|
|
554
561
|
case 'auto':
|
|
555
562
|
this.plugins.resizing.resetTransform.call(this, contextEl);
|
|
@@ -562,7 +569,7 @@
|
|
|
562
569
|
const percentage = contextEl.getAttribute('data-percentage');
|
|
563
570
|
if (percentage) percentY = percentage.split(',')[1];
|
|
564
571
|
}
|
|
565
|
-
|
|
572
|
+
|
|
566
573
|
this.plugins.resizing.resetTransform.call(this, contextEl);
|
|
567
574
|
currentModule.setPercentSize.call(this, (value * 100), (this.util.getNumber(percentY, 0) === null || !/%$/.test(percentY)) ? '' : percentY);
|
|
568
575
|
this.selectComponent(contextEl, pluginName);
|
|
@@ -571,27 +578,27 @@
|
|
|
571
578
|
const r = contextEl.getAttribute('data-rotate') || '0';
|
|
572
579
|
let x = contextEl.getAttribute('data-rotateX') || '';
|
|
573
580
|
let y = contextEl.getAttribute('data-rotateY') || '';
|
|
574
|
-
|
|
581
|
+
|
|
575
582
|
if ((value === 'h' && !this.context.resizing._rotateVertical) || (value === 'v' && this.context.resizing._rotateVertical)) {
|
|
576
583
|
y = y ? '' : '180';
|
|
577
584
|
} else {
|
|
578
585
|
x = x ? '' : '180';
|
|
579
586
|
}
|
|
580
|
-
|
|
587
|
+
|
|
581
588
|
contextEl.setAttribute('data-rotateX', x);
|
|
582
589
|
contextEl.setAttribute('data-rotateY', y);
|
|
583
|
-
|
|
590
|
+
|
|
584
591
|
this.plugins.resizing._setTransForm(contextEl, r, x, y);
|
|
585
592
|
break;
|
|
586
593
|
case 'rotate':
|
|
587
594
|
const contextResizing = this.context.resizing;
|
|
588
595
|
const slope = (contextEl.getAttribute('data-rotate') * 1) + (value * 1);
|
|
589
596
|
const deg = this._w.Math.abs(slope) >= 360 ? 0 : slope;
|
|
590
|
-
|
|
597
|
+
|
|
591
598
|
contextEl.setAttribute('data-rotate', deg);
|
|
592
599
|
contextResizing._rotateVertical = /^(90|270)$/.test(this._w.Math.abs(deg).toString());
|
|
593
600
|
this.plugins.resizing.setTransformSize.call(this, contextEl, null, null);
|
|
594
|
-
|
|
601
|
+
|
|
595
602
|
this.selectComponent(contextEl, pluginName);
|
|
596
603
|
break;
|
|
597
604
|
case 'onalign':
|
|
@@ -606,26 +613,26 @@
|
|
|
606
613
|
const caption = !currentContext._captionChecked;
|
|
607
614
|
currentModule.openModify.call(this, true);
|
|
608
615
|
currentContext._captionChecked = currentContext.captionCheckEl.checked = caption;
|
|
609
|
-
|
|
616
|
+
|
|
610
617
|
currentModule.update_image.call(this, false, false, false);
|
|
611
|
-
|
|
618
|
+
|
|
612
619
|
if (caption) {
|
|
613
620
|
const captionText = this.util.getChildElement(currentContext._caption, function (current) {
|
|
614
621
|
return current.nodeType === 3;
|
|
615
622
|
});
|
|
616
|
-
|
|
623
|
+
|
|
617
624
|
if (!captionText) {
|
|
618
625
|
currentContext._caption.focus();
|
|
619
626
|
} else {
|
|
620
627
|
this.setRange(captionText, 0, captionText, captionText.textContent.length);
|
|
621
628
|
}
|
|
622
|
-
|
|
629
|
+
|
|
623
630
|
this.controllersOff();
|
|
624
631
|
} else {
|
|
625
632
|
this.selectComponent(contextEl, pluginName);
|
|
626
633
|
currentModule.openModify.call(this, true);
|
|
627
634
|
}
|
|
628
|
-
|
|
635
|
+
|
|
629
636
|
break;
|
|
630
637
|
case 'revert':
|
|
631
638
|
currentModule.setOriginSize.call(this);
|
|
@@ -639,11 +646,11 @@
|
|
|
639
646
|
currentModule.destroy.call(this);
|
|
640
647
|
break;
|
|
641
648
|
}
|
|
642
|
-
|
|
649
|
+
|
|
643
650
|
// history stack
|
|
644
651
|
this.history.push(false);
|
|
645
652
|
},
|
|
646
|
-
|
|
653
|
+
|
|
647
654
|
/**
|
|
648
655
|
* @description Initialize the transform style (rotation) of the element.
|
|
649
656
|
* @param {Element} element Target element
|
|
@@ -651,17 +658,17 @@
|
|
|
651
658
|
resetTransform: function (element) {
|
|
652
659
|
const size = (element.getAttribute('data-size') || element.getAttribute('data-origin') || '').split(',');
|
|
653
660
|
this.context.resizing._rotateVertical = false;
|
|
654
|
-
|
|
661
|
+
|
|
655
662
|
element.style.maxWidth = '';
|
|
656
663
|
element.style.transform = '';
|
|
657
664
|
element.style.transformOrigin = '';
|
|
658
665
|
element.setAttribute('data-rotate', '');
|
|
659
666
|
element.setAttribute('data-rotateX', '');
|
|
660
667
|
element.setAttribute('data-rotateY', '');
|
|
661
|
-
|
|
668
|
+
|
|
662
669
|
this.plugins[this.context.resizing._resize_plugin].setSize.call(this, size[0] ? size[0] : 'auto', size[1] ? size[1] : '', true);
|
|
663
670
|
},
|
|
664
|
-
|
|
671
|
+
|
|
665
672
|
/**
|
|
666
673
|
* @description Set the transform style (rotation) of the element.
|
|
667
674
|
* @param {Element} element Target element
|
|
@@ -673,7 +680,7 @@
|
|
|
673
680
|
const isVertical = this.context.resizing._rotateVertical;
|
|
674
681
|
const deg = element.getAttribute('data-rotate') * 1;
|
|
675
682
|
let transOrigin = '';
|
|
676
|
-
|
|
683
|
+
|
|
677
684
|
if (percentage && !isVertical) {
|
|
678
685
|
percentage = percentage.split(',');
|
|
679
686
|
if (percentage[0] === 'auto' && percentage[1] === 'auto') {
|
|
@@ -683,41 +690,41 @@
|
|
|
683
690
|
}
|
|
684
691
|
} else {
|
|
685
692
|
const cover = this.util.getParentElement(element, 'FIGURE');
|
|
686
|
-
|
|
693
|
+
|
|
687
694
|
const offsetW = width || element.offsetWidth;
|
|
688
695
|
const offsetH = height || element.offsetHeight;
|
|
689
696
|
const w = (isVertical ? offsetH : offsetW) + 'px';
|
|
690
697
|
const h = (isVertical ? offsetW : offsetH) + 'px';
|
|
691
|
-
|
|
698
|
+
|
|
692
699
|
this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this);
|
|
693
700
|
this.plugins[this.context.resizing._resize_plugin].setSize.call(this, offsetW + 'px', offsetH + 'px', true);
|
|
694
|
-
|
|
701
|
+
|
|
695
702
|
cover.style.width = w;
|
|
696
703
|
cover.style.height = (!!this.context[this.context.resizing._resize_plugin]._caption ? '' : h);
|
|
697
|
-
|
|
704
|
+
|
|
698
705
|
if (isVertical) {
|
|
699
|
-
let transW = (offsetW/2) + 'px ' + (offsetW/2) + 'px 0';
|
|
700
|
-
let transH = (offsetH/2) + 'px ' + (offsetH/2) + 'px 0';
|
|
706
|
+
let transW = (offsetW / 2) + 'px ' + (offsetW / 2) + 'px 0';
|
|
707
|
+
let transH = (offsetH / 2) + 'px ' + (offsetH / 2) + 'px 0';
|
|
701
708
|
transOrigin = deg === 90 || deg === -270 ? transH : transW;
|
|
702
709
|
}
|
|
703
710
|
}
|
|
704
|
-
|
|
711
|
+
|
|
705
712
|
element.style.transformOrigin = transOrigin;
|
|
706
713
|
this.plugins.resizing._setTransForm(element, deg.toString(), element.getAttribute('data-rotateX') || '', element.getAttribute('data-rotateY') || '');
|
|
707
|
-
|
|
714
|
+
|
|
708
715
|
if (isVertical) element.style.maxWidth = 'none';
|
|
709
716
|
else element.style.maxWidth = '';
|
|
710
|
-
|
|
717
|
+
|
|
711
718
|
this.plugins.resizing.setCaptionPosition.call(this, element);
|
|
712
719
|
},
|
|
713
|
-
|
|
720
|
+
|
|
714
721
|
_setTransForm: function (element, r, x, y) {
|
|
715
722
|
let width = (element.offsetWidth - element.offsetHeight) * (/-/.test(r) ? 1 : -1);
|
|
716
723
|
let translate = '';
|
|
717
|
-
|
|
724
|
+
|
|
718
725
|
if (/[1-9]/.test(r) && (x || y)) {
|
|
719
726
|
translate = x ? 'Y' : 'X';
|
|
720
|
-
|
|
727
|
+
|
|
721
728
|
switch (r) {
|
|
722
729
|
case '90':
|
|
723
730
|
translate = x && y ? 'X' : y ? translate : '';
|
|
@@ -737,14 +744,14 @@
|
|
|
737
744
|
translate = '';
|
|
738
745
|
}
|
|
739
746
|
}
|
|
740
|
-
|
|
747
|
+
|
|
741
748
|
if (r % 180 === 0) {
|
|
742
749
|
element.style.maxWidth = '';
|
|
743
750
|
}
|
|
744
|
-
|
|
751
|
+
|
|
745
752
|
element.style.transform = 'rotate(' + r + 'deg)' + (x ? ' rotateX(' + x + 'deg)' : '') + (y ? ' rotateY(' + y + 'deg)' : '') + (translate ? ' translate' + translate + '(' + width + 'px)' : '');
|
|
746
753
|
},
|
|
747
|
-
|
|
754
|
+
|
|
748
755
|
/**
|
|
749
756
|
* @description The position of the caption is set automatically.
|
|
750
757
|
* @param {Element} element Target element (not caption element)
|
|
@@ -755,7 +762,7 @@
|
|
|
755
762
|
figcaption.style.marginTop = (this.context.resizing._rotateVertical ? element.offsetWidth - element.offsetHeight : 0) + 'px';
|
|
756
763
|
}
|
|
757
764
|
},
|
|
758
|
-
|
|
765
|
+
|
|
759
766
|
/**
|
|
760
767
|
* @description Mouse down event of resize handles
|
|
761
768
|
* @param {MouseEvent} e Event object
|
|
@@ -763,26 +770,26 @@
|
|
|
763
770
|
onMouseDown_resize_handle: function (e) {
|
|
764
771
|
e.stopPropagation();
|
|
765
772
|
e.preventDefault();
|
|
766
|
-
|
|
773
|
+
|
|
767
774
|
const contextResizing = this.context.resizing;
|
|
768
775
|
const direction = contextResizing._resize_direction = e.target.classList[0];
|
|
769
|
-
|
|
776
|
+
|
|
770
777
|
contextResizing._resizeClientX = e.clientX;
|
|
771
778
|
contextResizing._resizeClientY = e.clientY;
|
|
772
779
|
this.context.element.resizeBackground.style.display = 'block';
|
|
773
780
|
contextResizing.resizeButton.style.display = 'none';
|
|
774
781
|
contextResizing.resizeDiv.style.float = /l/.test(direction) ? 'right' : /r/.test(direction) ? 'left' : 'none';
|
|
775
|
-
|
|
782
|
+
|
|
776
783
|
const closureFunc_bind = function closureFunc(e) {
|
|
777
784
|
if (e.type === 'keydown' && e.keyCode !== 27) return;
|
|
778
|
-
|
|
785
|
+
|
|
779
786
|
const change = contextResizing._isChange;
|
|
780
787
|
contextResizing._isChange = false;
|
|
781
|
-
|
|
788
|
+
|
|
782
789
|
this.removeDocEvent('mousemove', resizing_element_bind);
|
|
783
790
|
this.removeDocEvent('mouseup', closureFunc_bind);
|
|
784
791
|
this.removeDocEvent('keydown', closureFunc_bind);
|
|
785
|
-
|
|
792
|
+
|
|
786
793
|
if (e.type === 'keydown') {
|
|
787
794
|
this.controllersOff();
|
|
788
795
|
this.context.element.resizeBackground.style.display = 'none';
|
|
@@ -794,13 +801,13 @@
|
|
|
794
801
|
if (change) this.history.push(false);
|
|
795
802
|
}
|
|
796
803
|
}.bind(this);
|
|
797
|
-
|
|
804
|
+
|
|
798
805
|
const resizing_element_bind = this.plugins.resizing.resizing_element.bind(this, contextResizing, direction, this.context[contextResizing._resize_plugin]);
|
|
799
806
|
this.addDocEvent('mousemove', resizing_element_bind);
|
|
800
807
|
this.addDocEvent('mouseup', closureFunc_bind);
|
|
801
808
|
this.addDocEvent('keydown', closureFunc_bind);
|
|
802
809
|
},
|
|
803
|
-
|
|
810
|
+
|
|
804
811
|
/**
|
|
805
812
|
* @description Mouse move event after call "onMouseDown_resize_handle" of resize handles
|
|
806
813
|
* The size of the module's "div" is adjusted according to the mouse move event.
|
|
@@ -812,22 +819,22 @@
|
|
|
812
819
|
resizing_element: function (contextResizing, direction, plugin, e) {
|
|
813
820
|
const clientX = e.clientX;
|
|
814
821
|
const clientY = e.clientY;
|
|
815
|
-
|
|
822
|
+
|
|
816
823
|
let resultW = plugin._element_w;
|
|
817
824
|
let resultH = plugin._element_h;
|
|
818
|
-
|
|
825
|
+
|
|
819
826
|
const w = plugin._element_w + (/r/.test(direction) ? clientX - contextResizing._resizeClientX : contextResizing._resizeClientX - clientX);
|
|
820
827
|
const h = plugin._element_h + (/b/.test(direction) ? clientY - contextResizing._resizeClientY : contextResizing._resizeClientY - clientY);
|
|
821
828
|
const wh = ((plugin._element_h / plugin._element_w) * w);
|
|
822
|
-
|
|
829
|
+
|
|
823
830
|
if (/t/.test(direction)) contextResizing.resizeDiv.style.top = (plugin._element_h - (/h/.test(direction) ? h : wh)) + 'px';
|
|
824
831
|
if (/l/.test(direction)) contextResizing.resizeDiv.style.left = (plugin._element_w - w) + 'px';
|
|
825
|
-
|
|
832
|
+
|
|
826
833
|
if (/r|l/.test(direction)) {
|
|
827
834
|
contextResizing.resizeDiv.style.width = w + 'px';
|
|
828
835
|
resultW = w;
|
|
829
836
|
}
|
|
830
|
-
|
|
837
|
+
|
|
831
838
|
if (/^(t|b)[^h]$/.test(direction)) {
|
|
832
839
|
contextResizing.resizeDiv.style.height = wh + 'px';
|
|
833
840
|
resultH = wh;
|
|
@@ -836,13 +843,13 @@
|
|
|
836
843
|
contextResizing.resizeDiv.style.height = h + 'px';
|
|
837
844
|
resultH = h;
|
|
838
845
|
}
|
|
839
|
-
|
|
846
|
+
|
|
840
847
|
contextResizing._resize_w = resultW;
|
|
841
848
|
contextResizing._resize_h = resultH;
|
|
842
849
|
this.util.changeTxt(contextResizing.resizeDisplay, this._w.Math.round(resultW) + ' x ' + this._w.Math.round(resultH));
|
|
843
850
|
contextResizing._isChange = true;
|
|
844
851
|
},
|
|
845
|
-
|
|
852
|
+
|
|
846
853
|
/**
|
|
847
854
|
* @description Resize the element to the size of the "div" adjusted in the "resizing_element" method.
|
|
848
855
|
* Called at the mouse-up event registered in "onMouseDown_resize_handle".
|
|
@@ -852,20 +859,20 @@
|
|
|
852
859
|
const isVertical = this.context.resizing._rotateVertical;
|
|
853
860
|
this.controllersOff();
|
|
854
861
|
this.context.element.resizeBackground.style.display = 'none';
|
|
855
|
-
|
|
862
|
+
|
|
856
863
|
let w = this._w.Math.round(isVertical ? this.context.resizing._resize_h : this.context.resizing._resize_w);
|
|
857
864
|
let h = this._w.Math.round(isVertical ? this.context.resizing._resize_w : this.context.resizing._resize_h);
|
|
858
|
-
|
|
865
|
+
|
|
859
866
|
if (!isVertical && !/%$/.test(w)) {
|
|
860
867
|
const padding = 16;
|
|
861
868
|
const limit = this.context.element.wysiwygFrame.clientWidth - (padding * 2) - 2;
|
|
862
|
-
|
|
869
|
+
|
|
863
870
|
if (this.util.getNumber(w, 0) > limit) {
|
|
864
871
|
h = this._w.Math.round((h / w) * limit);
|
|
865
872
|
w = limit;
|
|
866
873
|
}
|
|
867
874
|
}
|
|
868
|
-
|
|
875
|
+
|
|
869
876
|
const pluginName = this.context.resizing._resize_plugin;
|
|
870
877
|
this.plugins[pluginName].setSize.call(this, w, h, false, direction);
|
|
871
878
|
if (isVertical) this.plugins.resizing.setTransformSize.call(this, this.context[this.context.resizing._resize_plugin]._element, w, h);
|