1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522 | 1×
1×
1×
1×
3825×
3825×
3825×
3825×
3825×
1×
2191×
1×
1801×
1801×
480×
1×
1463×
1×
2191×
2191×
2191×
2191×
2191×
41629×
41629×
3718×
57×
57×
57×
57×
397×
57×
57×
57×
57×
57×
57×
218×
57×
57×
1125×
1125×
1×
1124×
1124×
6797×
1124×
1124×
1124×
160×
160×
1×
159×
159×
1236×
159×
159×
159×
151×
151×
1×
150×
150×
1157×
150×
150×
150×
150×
1056×
1056×
1×
1055×
1055×
157×
157×
180×
180×
79×
79×
79×
79×
45×
45×
78×
78×
78×
78×
2191×
80×
1×
10×
10×
51×
10×
1×
212×
212×
212×
212×
285×
285×
9×
7×
9×
9×
8×
8×
8×
8×
8×
8×
5×
3×
8×
1×
1×
9×
9×
7×
9×
9×
8×
8×
8×
8×
8×
8×
8×
5×
3×
8×
1×
1×
9×
14×
14×
22×
22×
14×
14×
14×
14×
14×
14×
8×
8×
14×
1×
16×
1×
79×
79×
79×
1×
79×
79×
79×
1×
45×
45×
45×
1×
78×
78×
78×
1×
180×
180×
1×
179×
1×
157×
157×
1×
156×
1×
78×
78×
78×
1×
3296×
1×
2259×
1124×
1124×
1124×
2259×
159×
159×
159×
2259×
150×
150×
150×
2259×
1055×
1055×
1055×
2259×
234×
234×
234×
2259×
179×
179×
179×
2259×
79×
79×
79×
2259×
79×
79×
79×
2259×
45×
45×
45×
2259×
78×
78×
78×
2259×
57×
57×
57×
2259×
57×
57×
57×
2259×
1×
1827×
4×
1827×
1×
1827×
1×
1827×
4×
1827×
1827×
1827×
1827×
1×
22968×
41×
30×
11×
1×
1914×
1914×
22968×
1×
3825×
3825×
3825×
3825×
3825×
3825×
1×
10×
1×
1×
1837×
1837×
1837×
1837×
1837×
1×
1837×
1837×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "../base/enum", "../base/util", "../base/constant", "../base/classes", "../base/util", "../models/items", "../base/util"], function (require, exports, ej2_base_1, enum_1, util_1, events, classes, util_2, model, util_3) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DropDownButtons = (function () {
function DropDownButtons(parent, serviceLocator) {
this.parent = parent;
this.locator = serviceLocator;
this.i10n = serviceLocator.getService('rteLocale');
this.renderFactory = this.locator.getService('rendererFactory');
this.addEventListener();
}
DropDownButtons.prototype.initializeInstance = function () {
this.toolbarRenderer = this.renderFactory.getRenderer(enum_1.RenderType.Toolbar);
};
DropDownButtons.prototype.beforeRender = function (args) {
var item = args.item;
if (item.cssClass) {
ej2_base_1.addClass([args.element], item.cssClass);
}
};
DropDownButtons.prototype.dropdownContent = function (width, type, content) {
return ('<span style="display: inline-flex;' + 'width:' + ((type === 'quick') ? 'auto' : width) + '" >' +
'<span class="e-rte-dropdown-btn-text">' + content + '</span></span>');
};
DropDownButtons.prototype.renderDropDowns = function (args) {
var _this = this;
this.initializeInstance();
var type = args.containerType;
var tbElement = args.container;
model.templateItems.forEach(function (item) {
var targetElement = undefined;
if (util_1.getIndex(item, args.items) !== -1) {
switch (item) {
case 'numberformatlist': {
targetElement = ej2_base_1.select('#' + _this.parent.getID() + '_' + type + '_NumberFormatList', tbElement);
Iif (ej2_base_1.isNullOrUndefined(targetElement) || targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
var formatOLItem = _this.parent.numberFormatList.types.slice();
formatOLItem.forEach(function (item) {
Object.defineProperties(item, {
command: { value: 'Lists', enumerable: true }, subCommand: { value: 'NumberFormatList', enumerable: true }
});
});
_this.numberFormatListDropDown = _this.toolbarRenderer.renderListDropDown({
cssClass: 'e-order-list' + ' ' + classes.CLS_RTE_ELEMENTS + ' ' + classes.CLS_ICONS,
itemName: 'NumberFormatList', items: formatOLItem, element: targetElement
});
break;
}
case 'bulletformatlist': {
targetElement = ej2_base_1.select('#' + _this.parent.getID() + '_' + type + '_BulletFormatList', tbElement);
Iif (ej2_base_1.isNullOrUndefined(targetElement) || targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
var formatULItem = _this.parent.bulletFormatList.types.slice();
formatULItem.forEach(function (item) {
Object.defineProperties(item, {
command: { value: 'Lists', enumerable: true }, subCommand: { value: 'BulletFormatList', enumerable: true }
});
});
_this.bulletFormatListDropDown = _this.toolbarRenderer.renderListDropDown({
cssClass: 'e-unorder-list' + ' ' + classes.CLS_RTE_ELEMENTS + ' ' + classes.CLS_ICONS,
itemName: 'BulletFormatList', items: formatULItem, element: targetElement
});
break;
}
case 'formats': {
targetElement = ej2_base_1.select('#' + _this.parent.getID() + '_' + type + '_Formats', tbElement);
if (ej2_base_1.isNullOrUndefined(targetElement) || targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
var formatItem = _this.parent.format.types.slice();
formatItem.forEach(function (item) {
Object.defineProperties(item, {
command: { value: 'Formats', enumerable: true }, subCommand: { value: item.value, enumerable: true }
});
});
var formatContent = ej2_base_1.isNullOrUndefined(_this.parent.format.default) ? formatItem[0].text :
_this.parent.format.default;
_this.formatDropDown = _this.toolbarRenderer.renderDropDownButton({
iconCss: ((type === 'quick') ? 'e-formats e-icons' : ''),
content: _this.dropdownContent(_this.parent.format.width, type, ((type === 'quick') ? '' : util_2.getDropDownValue(formatItem, formatContent, 'text', 'text'))),
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_FORMATS_TB_BTN,
itemName: 'Formats', items: formatItem, element: targetElement
});
break;
}
case 'fontname': {
targetElement = ej2_base_1.select('#' + _this.parent.getID() + '_' + type + '_FontName', tbElement);
if (ej2_base_1.isNullOrUndefined(targetElement) || targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
var fontItem = _this.parent.fontFamily.items.slice();
fontItem.forEach(function (item) {
Object.defineProperties(item, {
command: { value: 'Font', enumerable: true }, subCommand: { value: 'FontName', enumerable: true }
});
});
var fontNameContent = ej2_base_1.isNullOrUndefined(_this.parent.fontFamily.default) ? fontItem.length === 0 ? '' : fontItem[0].text :
_this.parent.fontFamily.default;
_this.fontNameDropDown = _this.toolbarRenderer.renderDropDownButton({
iconCss: ((type === 'quick') ? 'e-font-name e-icons' : ''),
content: _this.dropdownContent(_this.parent.fontFamily.width, type, ((fontItem.length === 0) ? _this.i10n.getConstant('fontName') : (type === 'quick') ? '' : (util_2.getDropDownValue(fontItem, fontNameContent, 'text', 'text') === 'Default' ? _this.i10n.getConstant('fontName') : util_2.getDropDownValue(fontItem, fontNameContent, 'text', 'text')))),
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_FONT_NAME_TB_BTN,
itemName: 'FontName', items: fontItem, element: targetElement
});
break;
}
case 'fontsize': {
targetElement = ej2_base_1.select('#' + _this.parent.getID() + '_' + type + '_FontSize', tbElement);
if (ej2_base_1.isNullOrUndefined(targetElement) || targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
var fontsize = !ej2_base_1.isNullOrUndefined(_this.fontSizeDropDown) &&
!ej2_base_1.isNullOrUndefined(_this.fontSizeDropDown.items) && _this.fontSizeDropDown.items.length > 0 ?
_this.fontSizeDropDown.items : JSON.parse(JSON.stringify(_this.parent.fontSize.items.slice()));
fontsize.forEach(function (item) {
Object.defineProperties(item, {
command: { value: 'Font', enumerable: true }, subCommand: { value: 'FontSize', enumerable: true }
});
});
var fontSizeContent = ej2_base_1.isNullOrUndefined(_this.parent.fontSize.default) ? fontsize.length === 0 ? '' : fontsize[0].text :
_this.parent.fontSize.default;
var fontSizeDropDownContent = ((fontSizeContent === 'Default') ? util_2.getDropDownValue(fontsize, fontSizeContent.replace(/\s/g, ''), 'text', 'text') : util_2.getDropDownValue(fontsize, fontSizeContent.replace(/\s/g, ''), 'value', 'text'));
_this.fontSizeDropDown = _this.toolbarRenderer.renderDropDownButton({
content: _this.dropdownContent(_this.parent.fontSize.width, type, fontsize.length === 0 ? _this.i10n.getConstant('fontSize') : (util_2.getFormattedFontSize((fontSizeDropDownContent === 'Default') ? _this.i10n.getConstant('fontSize') : fontSizeDropDownContent))),
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_FONT_SIZE_TB_BTN,
itemName: 'FontSize', items: fontsize, element: targetElement
});
break;
}
case 'alignments':
targetElement = ej2_base_1.select('#' + _this.parent.getID() + '_' + type + '_Alignments', tbElement);
if (ej2_base_1.isNullOrUndefined(targetElement) || targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
_this.alignDropDown = _this.toolbarRenderer.renderDropDownButton({
iconCss: 'e-justify-left e-icons',
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_ALIGN_TB_BTN,
itemName: 'Alignments', items: model.alignmentItems, element: targetElement
});
break;
case 'align':
case 'videoalign':
_this.renderAlignmentDropDown(type, tbElement, targetElement, item);
break;
case 'display':
case 'audiolayoutoption':
case 'videolayoutoption':
_this.renderDisplayDropDown(type, tbElement, targetElement, item);
break;
case 'tablerows':
_this.rowDropDown(type, tbElement, targetElement);
break;
case 'tablecolumns':
_this.columnDropDown(type, tbElement, targetElement);
break;
case 'tablecell':
_this.cellDropDown(type, tbElement, targetElement);
break;
case 'tablecellverticalalign':
_this.verticalAlignDropDown(type, tbElement, targetElement);
break;
case 'styles':
_this.tableStylesDropDown(type, tbElement, targetElement);
break;
}
}
});
if (this.parent.inlineMode.enable) {
this.setCssClass({ cssClass: this.parent.getCssClass() });
}
};
DropDownButtons.prototype.getUpdateItems = function (items, value) {
var dropDownItems = items.slice();
dropDownItems.forEach(function (item) {
Object.defineProperties(item, {
command: { value: (value === 'Format' ? 'Formats' : 'Font'), enumerable: true },
subCommand: { value: (value === 'Format' ? item.value : value), enumerable: true }
});
});
return dropDownItems;
};
DropDownButtons.prototype.onPropertyChanged = function (model) {
var newProp = model.newProp;
var type;
var content;
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
var prop = _a[_i];
switch (prop) {
case 'fontFamily':
if (this.fontNameDropDown) {
for (var _b = 0, _c = Object.keys(newProp.fontFamily); _b < _c.length; _b++) {
var fontFamily = _c[_b];
switch (fontFamily) {
case 'default':
case 'width': {
var fontItems = this.fontNameDropDown.items;
type = !ej2_base_1.isNullOrUndefined(ej2_base_1.closest(this.fontNameDropDown.element, '.' + classes.CLS_QUICK_TB)) ?
'quick' : 'toolbar';
var fontNameContent = ej2_base_1.isNullOrUndefined(this.parent.fontFamily.default) ? fontItems[0].text :
this.parent.fontFamily.default;
content = this.dropdownContent(this.parent.fontFamily.width, type, ((type === 'quick') ? '' : (util_2.getDropDownValue(fontItems, fontNameContent, 'text', 'text')) === 'Default' ? this.i10n.getConstant('fontName') : util_2.getDropDownValue(fontItems, fontNameContent, 'text', 'text')));
this.fontNameDropDown.setProperties({ content: content });
if (!ej2_base_1.isNullOrUndefined(this.parent.fontFamily.default)) {
this.getEditNode().style.fontFamily = this.parent.fontFamily.default;
}
else {
this.getEditNode().style.removeProperty('font-family');
}
break;
}
case 'items':
this.fontNameDropDown.setProperties({
items: this.getUpdateItems(newProp.fontFamily.items, 'FontName')
});
break;
}
}
}
break;
case 'fontSize':
if (this.fontSizeDropDown) {
for (var _d = 0, _e = Object.keys(newProp.fontSize); _d < _e.length; _d++) {
var fontSize = _e[_d];
switch (fontSize) {
case 'default':
case 'width': {
var fontsize = this.fontSizeDropDown.items;
type = !ej2_base_1.isNullOrUndefined(ej2_base_1.closest(this.fontSizeDropDown.element, '.' + classes.CLS_QUICK_TB)) ? 'quick' : 'toolbar';
var fontSizeContent = ej2_base_1.isNullOrUndefined(this.parent.fontSize.default) ? fontsize[0].text :
this.parent.fontSize.default;
var fontSizeDropDownContent = ((fontSizeContent === 'Default') ? util_2.getDropDownValue(fontsize, fontSizeContent.replace(/\s/g, ''), 'text', 'text') : util_2.getDropDownValue(fontsize, fontSizeContent.replace(/\s/g, ''), 'value', 'text'));
content = this.dropdownContent(this.parent.fontSize.width, type, util_2.getFormattedFontSize((fontSizeDropDownContent === 'Default') ? this.i10n.getConstant('fontSize') : fontSizeDropDownContent));
this.fontSizeDropDown.setProperties({ content: content });
if (!ej2_base_1.isNullOrUndefined(this.parent.fontSize.default)) {
this.getEditNode().style.fontSize = this.parent.fontSize.default;
}
else {
this.getEditNode().style.removeProperty('font-size');
}
break;
}
case 'items':
this.fontSizeDropDown.setProperties({
items: this.getUpdateItems(newProp.fontSize.items, 'FontSize')
});
break;
}
}
}
break;
case 'format':
Eif (this.formatDropDown) {
for (var _f = 0, _g = Object.keys(newProp.format); _f < _g.length; _f++) {
var format = _g[_f];
switch (format) {
case 'default':
case 'width': {
var formatItems = this.formatDropDown.items;
type = !ej2_base_1.isNullOrUndefined(ej2_base_1.closest(this.formatDropDown.element, '.' + classes.CLS_QUICK_TB)) ? 'quick' : 'toolbar';
var formatContent = ej2_base_1.isNullOrUndefined(this.parent.format.default) ? formatItems[0].text :
this.parent.format.default;
content = this.dropdownContent(this.parent.format.width, type, ((type === 'quick') ? '' : util_2.getDropDownValue(formatItems, formatContent, 'text', 'text')));
this.formatDropDown.setProperties({ content: content });
break;
}
case 'types':
this.formatDropDown.setProperties({
items: this.getUpdateItems(newProp.format.types, 'Format')
});
break;
}
}
}
break;
}
}
};
DropDownButtons.prototype.getEditNode = function () {
return this.parent.contentModule.getEditPanel();
};
DropDownButtons.prototype.rowDropDown = function (type, tbElement, targetElement) {
targetElement = ej2_base_1.select('#' + this.parent.getID() + '_' + type + '_TableRows', tbElement);
Iif (targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
this.tableRowsDropDown = this.toolbarRenderer.renderDropDownButton({
iconCss: 'e-table-rows e-icons',
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_QUICK_DROPDOWN,
itemName: 'TableRows',
items: model.tableRowsItems,
element: targetElement
});
};
DropDownButtons.prototype.columnDropDown = function (type, tbElement, targetElement) {
targetElement = ej2_base_1.select('#' + this.parent.getID() + '_' + type + '_TableColumns', tbElement);
Iif (targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
this.tableColumnsDropDown = this.toolbarRenderer.renderDropDownButton({
iconCss: 'e-table-columns e-icons',
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_QUICK_DROPDOWN,
itemName: 'TableColumns',
items: model.tableColumnsItems,
element: targetElement
});
};
DropDownButtons.prototype.cellDropDown = function (type, tbElement, targetElement) {
targetElement = ej2_base_1.select('#' + this.parent.getID() + '_' + type + '_TableCell', tbElement);
Iif (targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
this.tableCellDropDown = this.toolbarRenderer.renderDropDownButton({
iconCss: 'e-table-cell e-icons',
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_QUICK_DROPDOWN,
itemName: 'TableCell',
items: model.tableCellItems,
element: targetElement
});
};
DropDownButtons.prototype.verticalAlignDropDown = function (type, tbElement, targetElement) {
targetElement = ej2_base_1.select('#' + this.parent.getID() + '_' + type + '_TableCellVerticalAlign', tbElement);
Iif (targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
this.tableCellVerticalAlignDropDown = this.toolbarRenderer.renderDropDownButton({
iconCss: 'e-table-cell-ver-align e-icons',
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_QUICK_DROPDOWN,
itemName: 'TableCellVerticalAlign',
items: model.TableCellVerticalAlignItems,
element: targetElement
});
};
DropDownButtons.prototype.renderDisplayDropDown = function (type, tbElement, targetElement, item) {
targetElement = ej2_base_1.select('#' + this.parent.getID() + '_' + type + (item === 'display' ? '_Display' : item === 'videolayoutoption' ? '_VideoLayoutOption' : '_AudioLayoutOption'), tbElement);
if (targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
this.displayDropDown = this.toolbarRenderer.renderDropDownButton({
iconCss: item === 'display' ? 'e-display e-icons' : item === 'videolayoutoption' ? 'e-video-display e-icons' : 'e-audio-display e-icons',
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_QUICK_DROPDOWN,
itemName: item === 'display' ? 'Display' : item === 'videolayoutoption' ? 'VideoLayoutOption' : 'AudioLayoutOption',
items: item === 'display' ? model.imageDisplayItems : item === 'videolayoutoption' ? model.videoLayoutOptionItems : model.audioLayoutOptionItems,
element: targetElement
});
};
DropDownButtons.prototype.renderAlignmentDropDown = function (type, tbElement, targetElement, item) {
targetElement = ej2_base_1.select('#' + this.parent.getID() + '_' + type + (item === 'align' ? '_Align' : '_VideoAlign'), tbElement);
if (targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
this.imageAlignDropDown = this.toolbarRenderer.renderDropDownButton({
iconCss: 'e-justify-left e-icons',
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ICONS + ' ' + classes.CLS_QUICK_DROPDOWN,
itemName: item === 'align' ? 'Align' : 'VideoAlign',
items: item === 'align' ? model.imageAlignItems : model.videoAlignItems,
element: targetElement
});
};
DropDownButtons.prototype.tableStylesDropDown = function (type, tbElement, targetElement) {
targetElement = ej2_base_1.select('#' + this.parent.getID() + '_' + type + '_Styles', tbElement);
Iif (targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
return;
}
this.imageAlignDropDown = this.toolbarRenderer.renderDropDownButton({
iconCss: 'e-style e-icons',
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ICONS + ' ' + classes.CLS_QUICK_DROPDOWN,
itemName: 'Styles',
items: this.parent.tableSettings.styles,
element: targetElement
});
};
DropDownButtons.prototype.removeDropDownClasses = function (target) {
ej2_base_1.removeClass([target], [
classes.CLS_DROPDOWN_BTN,
classes.CLS_DROPDOWN_POPUP,
classes.CLS_DROPDOWN_ICONS,
classes.CLS_DROPDOWN_ITEMS
]);
};
DropDownButtons.prototype.destroyDropDowns = function () {
if (this.formatDropDown) {
this.removeDropDownClasses(this.formatDropDown.element);
this.formatDropDown.destroy();
this.formatDropDown = null;
}
if (this.fontNameDropDown) {
this.removeDropDownClasses(this.fontNameDropDown.element);
this.fontNameDropDown.destroy();
this.fontNameDropDown = null;
}
if (this.fontSizeDropDown) {
this.removeDropDownClasses(this.fontSizeDropDown.element);
this.fontSizeDropDown.destroy();
this.fontSizeDropDown = null;
}
if (this.alignDropDown) {
this.removeDropDownClasses(this.alignDropDown.element);
this.alignDropDown.destroy();
this.alignDropDown = null;
}
if (this.imageAlignDropDown) {
this.removeDropDownClasses(this.imageAlignDropDown.element);
this.imageAlignDropDown.destroy();
this.imageAlignDropDown = null;
}
if (this.displayDropDown) {
this.removeDropDownClasses(this.displayDropDown.element);
this.displayDropDown.destroy();
this.displayDropDown = null;
}
if (this.tableRowsDropDown) {
this.removeDropDownClasses(this.tableRowsDropDown.element);
this.tableRowsDropDown.destroy();
this.tableRowsDropDown = null;
}
if (this.tableColumnsDropDown) {
this.removeDropDownClasses(this.tableColumnsDropDown.element);
this.tableColumnsDropDown.destroy();
this.tableColumnsDropDown = null;
}
if (this.tableCellDropDown) {
this.removeDropDownClasses(this.tableCellDropDown.element);
this.tableCellDropDown.destroy();
this.tableCellDropDown = null;
}
if (this.tableCellVerticalAlignDropDown) {
this.removeDropDownClasses(this.tableCellVerticalAlignDropDown.element);
this.tableCellVerticalAlignDropDown.destroy();
this.tableCellVerticalAlignDropDown = null;
}
if (this.numberFormatListDropDown) {
this.removeDropDownClasses(this.numberFormatListDropDown.element);
this.numberFormatListDropDown.destroy();
this.numberFormatListDropDown = null;
}
if (this.bulletFormatListDropDown) {
this.removeDropDownClasses(this.bulletFormatListDropDown.element);
this.bulletFormatListDropDown.destroy();
this.bulletFormatListDropDown = null;
}
this.toolbarRenderer = null;
};
DropDownButtons.prototype.setRtl = function (args) {
if (this.formatDropDown) {
this.formatDropDown.setProperties({ enableRtl: args.enableRtl });
}
if (this.fontNameDropDown) {
this.fontNameDropDown.setProperties({ enableRtl: args.enableRtl });
}
if (this.fontSizeDropDown) {
this.fontSizeDropDown.setProperties({ enableRtl: args.enableRtl });
}
if (this.alignDropDown) {
this.alignDropDown.setProperties({ enableRtl: args.enableRtl });
}
Iif (this.imageAlignDropDown) {
this.imageAlignDropDown.setProperties({ enableRtl: args.enableRtl });
}
Iif (this.displayDropDown) {
this.displayDropDown.setProperties({ enableRtl: args.enableRtl });
}
Iif (this.numberFormatListDropDown) {
this.numberFormatListDropDown.setProperties({ enableRtl: args.enableRtl });
}
Iif (this.bulletFormatListDropDown) {
this.bulletFormatListDropDown.setProperties({ enableRtl: args.enableRtl });
}
};
DropDownButtons.prototype.updateCss = function (dropDownObj, e) {
if (dropDownObj && e.cssClass) {
if (ej2_base_1.isNullOrUndefined(e.oldCssClass)) {
dropDownObj.setProperties({ cssClass: (dropDownObj.cssClass + ' ' + e.cssClass).trim() });
}
else {
dropDownObj.setProperties({ cssClass: (dropDownObj.cssClass.replace(e.oldCssClass, '').trim() + ' ' + e.cssClass).trim() });
}
}
};
DropDownButtons.prototype.setCssClass = function (e) {
var dropDownObj = [
this.formatDropDown, this.fontNameDropDown, this.fontSizeDropDown, this.alignDropDown, this.imageAlignDropDown,
this.displayDropDown, this.numberFormatListDropDown, this.bulletFormatListDropDown, this.tableRowsDropDown,
this.tableColumnsDropDown, this.tableCellDropDown, this.tableCellVerticalAlignDropDown
];
for (var i = 0; i < dropDownObj.length; i++) {
this.updateCss(dropDownObj[i], e);
}
};
DropDownButtons.prototype.addEventListener = function () {
Iif (this.parent.isDestroyed) {
return;
}
this.parent.on(events.beforeDropDownItemRender, this.beforeRender, this);
this.parent.on(events.iframeMouseDown, this.onIframeMouseDown, this);
this.parent.on(events.rtlMode, this.setRtl, this);
this.parent.on(events.modelChanged, this.onPropertyChanged, this);
this.parent.on(events.bindCssClass, this.setCssClass, this);
};
DropDownButtons.prototype.onIframeMouseDown = function () {
if (!ej2_base_1.isNullOrUndefined(this.parent.getToolbarElement()) && (this.parent.getToolbarElement().querySelectorAll('.e-rte-dropdown-btn[aria-expanded="true"]').length > 0 || this.parent.getToolbarElement().querySelectorAll('.e-dropdown-btn.e-rte-inline-dropdown[aria-expanded="true"]').length > 0)) {
util_3.dispatchEvent(document, 'mousedown');
}
};
DropDownButtons.prototype.removeEventListener = function () {
this.parent.off(events.iframeMouseDown, this.onIframeMouseDown);
this.parent.off(events.rtlMode, this.setRtl);
this.parent.off(events.beforeDropDownItemRender, this.beforeRender);
this.parent.off(events.modelChanged, this.onPropertyChanged);
this.parent.off(events.bindCssClass, this.setCssClass);
};
DropDownButtons.prototype.destroy = function () {
this.removeEventListener();
this.destroyDropDowns();
};
return DropDownButtons;
}());
exports.DropDownButtons = DropDownButtons;
});
|