-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.js
72 lines (51 loc) · 1.82 KB
/
plugin.js
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
(function() {
/* jshint scripturl:true */
'use strict';
CKEDITOR.plugins.add('exbutton', {
requires: 'button',
modes: { 'wysiwyg': 1, 'source': 1 },
init: function() {
var buttonProto = CKEDITOR.ui.button.prototype;
buttonProto.getElement = function() {
return CKEDITOR.document.getById(this._.id);
};
buttonProto.getElementLabel = function() {
return CKEDITOR.document.getById(this._.id + '_label');
};
buttonProto.getElementIcon = function() {
return CKEDITOR.document.getById(this._.id + '_icon');
};
buttonProto.setTitle = function(title) {
title = String(title);
if (this._.title === title) {
return false;
}
this._.title = title;
var element = this.getElement();
if (!element) {
return false;
}
var env = CKEDITOR.env;
var titleJs = env.gecko && !env.hc ? '' : ( title || '' ).replace( "'", '' );
element.setAttributes({
'title': title,
'href': "javascript:void('" + titleJs + "')"
});
return true;
};
buttonProto.setLabel = function(label) {
label = String(label);
if (this._.label === label) {
return false;
}
this._.label = label;
var element = this.getElementLabel();
if (!element) {
return false;
}
element.setText(label);
return true;
};
}
});
}());