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
|
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
|
-
+
-
-
+
+
+
-
+
+
+
+
-
+
-
-
+
+
+
-
+
+
+
+
|
// Page to test v3 http://www.imathas.com/editordemo/demo.html
if (typeof tinymce !== "undefined" && tinymce.majorVersion && tinymce.majorVersion >= 3 && tinymce.majorVersion <= 5) {
//console.log("Have TinyMCE");
let TinyOnEditor = function(event, editor = null) {
let xEditorAdd = editor || event.editor;
let bIsAdded = false;
if ( tinymce.majorVersion >= 4 ){
if (tinymce.majorVersion >= 4) {
let aBtn = ["toolbar3", "toolbar2", "toolbar1", "toolbar"];
let nBtn = aBtn.length;
let iBtn = 0;
for (let eBtn of aBtn){
if ((!bIsAdded && typeof xEditorAdd.settings[eBtn] !== "undefined") || iBtn == nBtn){
for (let eBtn of aBtn) {
if (!bIsAdded && (typeof xEditorAdd.settings[eBtn] !== "undefined" || iBtn == nBtn)) {
bIsAdded = true;
if (typeof xEditorAdd.settings[eBtn] !== "undefined") {
xEditorAdd.settings[eBtn] = (xEditorAdd.settings[eBtn] + " Grammalecte").trim()
xEditorAdd.settings[eBtn] = (xEditorAdd.settings[eBtn] + " Grammalecte").trim();
} else {
xEditorAdd.settings[eBtn] = "Grammalecte";
}
}
iBtn++;
}
} else if ( tinymce.majorVersion >= 3 ){
} else if (tinymce.majorVersion >= 3) {
let aBtn = ["theme_advanced_buttons3", "theme_advanced_buttons2", "theme_advanced_buttons1"];
let nBtn = aBtn.length;
let iBtn = 0;
for (let eBtn of aBtn){
if ((!bIsAdded && typeof xEditorAdd.settings[eBtn] !== "undefined") || iBtn == nBtn){
for (let eBtn of aBtn) {
if (!bIsAdded && (typeof xEditorAdd.settings[eBtn] !== "undefined" || iBtn == nBtn)) {
bIsAdded = true;
if (typeof xEditorAdd.settings[eBtn] !== "undefined") {
xEditorAdd.settings[eBtn] = (xEditorAdd.settings[eBtn] + ",Grammalecte").trim()
xEditorAdd.settings[eBtn] = (xEditorAdd.settings[eBtn] + ",Grammalecte").trim();
} else {
xEditorAdd.settings[eBtn] = "Grammalecte";
}
}
iBtn++;
}
}
xEditorAdd.addButton("Grammalecte", {
text: "",
|