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 | 1×
1×
1×
1×
1844×
1844×
1×
1844×
1844×
1844×
1844×
1×
1211×
5×
1206×
1205×
1205×
855×
1206×
33×
1×
1×
1206×
76×
1206×
1206×
1×
281×
281×
225×
225×
27×
27×
198×
281×
1×
30×
30×
30×
1×
1823×
1823×
1823×
1823×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "../base/constant"], function (require, exports, ej2_base_1, events) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ToolbarAction = (function () {
function ToolbarAction(parent) {
this.parent = parent;
this.addEventListener();
}
ToolbarAction.prototype.addEventListener = function () {
this.parent.on(events.toolbarClick, this.toolbarClick, this);
this.parent.on(events.dropDownSelect, this.dropDownSelect, this);
this.parent.on(events.colorPickerChanged, this.renderSelection, this);
this.parent.on(events.destroy, this.removeEventListener, this);
};
ToolbarAction.prototype.toolbarClick = function (args) {
if (ej2_base_1.isNullOrUndefined(args.item)) {
return;
}
if (!ej2_base_1.isNullOrUndefined(args.item.controlParent)) {
var activeEle = args.item.controlParent
.activeEle;
if (activeEle) {
activeEle.tabIndex = -1;
}
}
if (args.item.command === 'NumberFormatList' || args.item.command === 'BulletFormatList') {
if (args.originalEvent.target.classList.contains('e-order-list') || args.originalEvent.target.classList.contains('e-unorder-list')) {
args.item.command = 'Lists';
args.item.subCommand = args.item.subCommand === 'NumberFormatList' ? 'OL' : 'UL';
}
}
if (args.item.command === 'Lists') {
Iif (args.originalEvent.target.classList.contains('e-caret') &&
(args.originalEvent.target.parentElement.classList.contains('e-rte-bulletformatlist-dropdown') || args.originalEvent.target.parentElement.classList.contains('e-rte-numberformatlist-dropdown'))) {
return;
}
}
this.parent.notify(events.htmlToolbarClick, args);
this.parent.notify(events.markdownToolbarClick, args);
};
ToolbarAction.prototype.dropDownSelect = function (e) {
this.parent.notify(events.selectionRestore, {});
if (!(document.body.contains(document.body.querySelector('.e-rte-quick-toolbar'))
&& e.item && (e.item.command === 'Images' || e.item.command === 'Audios' || e.item.command === 'Videos' ||
e.item.command === 'VideoLayoutOption' || e.item.command === 'Display' || e.item.command === 'Table'))) {
var value = e.item.controlParent && this.parent.quickToolbarModule && this.parent.quickToolbarModule.tableQTBar
&& this.parent.quickToolbarModule.tableQTBar.element.contains(e.item.controlParent.element) ? 'Table' : null;
if (e.item.command === 'Lists') {
var listItem = { listStyle: e.item.value, listImage: e.item.listImage, type: e.item.subCommand };
this.parent.formatter.process(this.parent, e, e.originalEvent, listItem);
}
else {
this.parent.formatter.process(this.parent, e, e.originalEvent, value);
}
}
this.parent.notify(events.selectionSave, {});
};
ToolbarAction.prototype.renderSelection = function (args) {
this.parent.notify(events.selectionRestore, {});
this.parent.formatter.process(this.parent, args, args.originalEvent, null);
this.parent.notify(events.selectionSave, {});
};
ToolbarAction.prototype.removeEventListener = function () {
this.parent.off(events.toolbarClick, this.toolbarClick);
this.parent.off(events.dropDownSelect, this.dropDownSelect);
this.parent.off(events.colorPickerChanged, this.renderSelection);
this.parent.off(events.destroy, this.removeEventListener);
};
return ToolbarAction;
}());
exports.ToolbarAction = ToolbarAction;
});
|