mirador_rails 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/app/controllers/mirador_rails/locales_controller.rb +10 -0
- data/config/routes.rb +7 -0
- data/lib/mirador_rails/exceptions.rb +6 -0
- data/lib/mirador_rails/locale.rb +24 -0
- data/lib/mirador_rails/version.rb +1 -1
- data/lib/mirador_rails.rb +9 -2
- data/mirador_rails.gemspec +3 -0
- data/tasks/mirador_rails.rake +44 -10
- data/vendor/assets/images/border_type_4.png +0 -0
- data/vendor/assets/images/border_type_5.png +0 -0
- data/vendor/assets/javascripts/mirador/mirador.js.erb +20105 -0
- data/vendor/assets/javascripts/mirador.js +4 -1
- data/vendor/assets/locales/de/translation.json +3 -0
- data/vendor/assets/locales/en/translation.json +11 -7
- data/vendor/assets/locales/ko/translation.json +18 -9
- data/vendor/assets/stylesheets/enhancements.scss +36 -0
- data/vendor/assets/stylesheets/mirador-combined.css +1488 -1642
- data/vendor/assets/stylesheets/mirador.css +1 -0
- metadata +52 -174
- data/vendor/assets/javascripts/mirador.min.js +0 -89
- data/vendor/assets/javascripts/mirador.min.js.map +0 -1
- data/vendor/assets/plugins/plugins/advlist/plugin.js +0 -97
- data/vendor/assets/plugins/plugins/advlist/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/anchor/plugin.js +0 -45
- data/vendor/assets/plugins/plugins/anchor/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/autolink/plugin.js +0 -194
- data/vendor/assets/plugins/plugins/autolink/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/autoresize/plugin.js +0 -152
- data/vendor/assets/plugins/plugins/autoresize/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/autosave/plugin.js +0 -165
- data/vendor/assets/plugins/plugins/autosave/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/bbcode/plugin.js +0 -123
- data/vendor/assets/plugins/plugins/bbcode/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/charmap/plugin.js +0 -370
- data/vendor/assets/plugins/plugins/charmap/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/code/plugin.js +0 -60
- data/vendor/assets/plugins/plugins/code/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/colorpicker/plugin.js +0 -112
- data/vendor/assets/plugins/plugins/colorpicker/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/compat3x/css/dialog.css +0 -118
- data/vendor/assets/plugins/plugins/compat3x/img/buttons.png +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/icons.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/items.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/menu_arrow.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/menu_check.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/progress.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/tabs.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/plugin.js +0 -297
- data/vendor/assets/plugins/plugins/compat3x/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/compat3x/tiny_mce_popup.js +0 -542
- data/vendor/assets/plugins/plugins/compat3x/utils/editable_selects.js +0 -70
- data/vendor/assets/plugins/plugins/compat3x/utils/form_utils.js +0 -210
- data/vendor/assets/plugins/plugins/compat3x/utils/mctabs.js +0 -164
- data/vendor/assets/plugins/plugins/compat3x/utils/validate.js +0 -252
- data/vendor/assets/plugins/plugins/contextmenu/plugin.js +0 -87
- data/vendor/assets/plugins/plugins/contextmenu/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/directionality/plugin.js +0 -64
- data/vendor/assets/plugins/plugins/directionality/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/plugin.js +0 -65
- data/vendor/assets/plugins/plugins/emoticons/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/example/dialog.html +0 -8
- data/vendor/assets/plugins/plugins/example/plugin.js +0 -68
- data/vendor/assets/plugins/plugins/example/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/example_dependency/plugin.js +0 -22
- data/vendor/assets/plugins/plugins/example_dependency/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/fullpage/plugin.js +0 -490
- data/vendor/assets/plugins/plugins/fullpage/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/fullscreen/plugin.js +0 -136
- data/vendor/assets/plugins/plugins/fullscreen/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/hr/plugin.js +0 -30
- data/vendor/assets/plugins/plugins/hr/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/image/plugin.js +0 -439
- data/vendor/assets/plugins/plugins/image/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/importcss/plugin.js +0 -195
- data/vendor/assets/plugins/plugins/importcss/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/insertdatetime/plugin.js +0 -121
- data/vendor/assets/plugins/plugins/insertdatetime/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/layer/plugin.js +0 -225
- data/vendor/assets/plugins/plugins/layer/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/legacyoutput/plugin.js +0 -211
- data/vendor/assets/plugins/plugins/legacyoutput/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/link/plugin.js +0 -400
- data/vendor/assets/plugins/plugins/link/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/lists/plugin.js +0 -791
- data/vendor/assets/plugins/plugins/lists/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/media/moxieplayer.swf +0 -0
- data/vendor/assets/plugins/plugins/media/plugin.js +0 -774
- data/vendor/assets/plugins/plugins/media/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/nonbreaking/plugin.js +0 -53
- data/vendor/assets/plugins/plugins/nonbreaking/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/noneditable/plugin.js +0 -540
- data/vendor/assets/plugins/plugins/noneditable/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/pagebreak/plugin.js +0 -88
- data/vendor/assets/plugins/plugins/pagebreak/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/paste/classes/Clipboard.js +0 -634
- data/vendor/assets/plugins/plugins/paste/classes/Plugin.js +0 -110
- data/vendor/assets/plugins/plugins/paste/classes/Quirks.js +0 -159
- data/vendor/assets/plugins/plugins/paste/classes/Utils.js +0 -130
- data/vendor/assets/plugins/plugins/paste/classes/WordFilter.js +0 -493
- data/vendor/assets/plugins/plugins/paste/plugin.dev.js +0 -120
- data/vendor/assets/plugins/plugins/paste/plugin.js +0 -1625
- data/vendor/assets/plugins/plugins/paste/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/preview/plugin.js +0 -88
- data/vendor/assets/plugins/plugins/preview/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/print/plugin.js +0 -32
- data/vendor/assets/plugins/plugins/print/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/save/plugin.js +0 -94
- data/vendor/assets/plugins/plugins/save/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/searchreplace/plugin.js +0 -594
- data/vendor/assets/plugins/plugins/searchreplace/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/spellchecker/classes/DomTextMatcher.js +0 -470
- data/vendor/assets/plugins/plugins/spellchecker/classes/Plugin.js +0 -436
- data/vendor/assets/plugins/plugins/spellchecker/plugin.dev.js +0 -117
- data/vendor/assets/plugins/plugins/spellchecker/plugin.js +0 -996
- data/vendor/assets/plugins/plugins/spellchecker/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/tabfocus/plugin.js +0 -120
- data/vendor/assets/plugins/plugins/tabfocus/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/table/classes/CellSelection.js +0 -176
- data/vendor/assets/plugins/plugins/table/classes/Dialogs.js +0 -749
- data/vendor/assets/plugins/plugins/table/classes/Plugin.js +0 -422
- data/vendor/assets/plugins/plugins/table/classes/Quirks.js +0 -372
- data/vendor/assets/plugins/plugins/table/classes/TableGrid.js +0 -864
- data/vendor/assets/plugins/plugins/table/plugin.dev.js +0 -118
- data/vendor/assets/plugins/plugins/table/plugin.js +0 -2680
- data/vendor/assets/plugins/plugins/table/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/template/plugin.js +0 -262
- data/vendor/assets/plugins/plugins/template/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/textcolor/plugin.js +0 -272
- data/vendor/assets/plugins/plugins/textcolor/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/textpattern/plugin.js +0 -268
- data/vendor/assets/plugins/plugins/textpattern/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/visualblocks/css/visualblocks.css +0 -135
- data/vendor/assets/plugins/plugins/visualblocks/img/address.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/article.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/aside.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/blockquote.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/div.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/dl.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/figure.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h1.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h2.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h3.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h4.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h5.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h6.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/hgroup.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/ol.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/p.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/pre.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/section.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/ul.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/plugin.js +0 -86
- data/vendor/assets/plugins/plugins/visualblocks/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/visualchars/plugin.js +0 -88
- data/vendor/assets/plugins/plugins/visualchars/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/wordcount/plugin.js +0 -69
- data/vendor/assets/plugins/plugins/wordcount/plugin.min.js +0 -1
- data/vendor/assets/skins/skins/lightgray/content.inline.min.css +0 -1
- data/vendor/assets/skins/skins/lightgray/content.min.css +0 -1
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.svg +0 -62
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce.eot +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce.svg +0 -63
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce.woff +0 -0
- data/vendor/assets/skins/skins/lightgray/img/anchor.gif +0 -0
- data/vendor/assets/skins/skins/lightgray/img/loader.gif +0 -0
- data/vendor/assets/skins/skins/lightgray/img/object.gif +0 -0
- data/vendor/assets/skins/skins/lightgray/img/trans.gif +0 -0
- data/vendor/assets/skins/skins/lightgray/skin.ie7.min.css +0 -1
- data/vendor/assets/skins/skins/lightgray/skin.min.css +0 -1
- data/vendor/assets/themes/themes/modern/theme.js +0 -617
- data/vendor/assets/themes/themes/modern/theme.min.js +0 -1
@@ -1,439 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* plugin.js
|
3
|
-
*
|
4
|
-
* Copyright, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://www.tinymce.com/license
|
8
|
-
* Contributing: http://www.tinymce.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
/*global tinymce:true */
|
12
|
-
|
13
|
-
tinymce.PluginManager.add('image', function(editor) {
|
14
|
-
function getImageSize(url, callback) {
|
15
|
-
var img = document.createElement('img');
|
16
|
-
|
17
|
-
function done(width, height) {
|
18
|
-
if (img.parentNode) {
|
19
|
-
img.parentNode.removeChild(img);
|
20
|
-
}
|
21
|
-
|
22
|
-
callback({width: width, height: height});
|
23
|
-
}
|
24
|
-
|
25
|
-
img.onload = function() {
|
26
|
-
done(img.clientWidth, img.clientHeight);
|
27
|
-
};
|
28
|
-
|
29
|
-
img.onerror = function() {
|
30
|
-
done();
|
31
|
-
};
|
32
|
-
|
33
|
-
var style = img.style;
|
34
|
-
style.visibility = 'hidden';
|
35
|
-
style.position = 'fixed';
|
36
|
-
style.bottom = style.left = 0;
|
37
|
-
style.width = style.height = 'auto';
|
38
|
-
|
39
|
-
document.body.appendChild(img);
|
40
|
-
img.src = url;
|
41
|
-
}
|
42
|
-
|
43
|
-
function buildListItems(inputList, itemCallback, startItems) {
|
44
|
-
function appendItems(values, output) {
|
45
|
-
output = output || [];
|
46
|
-
|
47
|
-
tinymce.each(values, function(item) {
|
48
|
-
var menuItem = {text: item.text || item.title};
|
49
|
-
|
50
|
-
if (item.menu) {
|
51
|
-
menuItem.menu = appendItems(item.menu);
|
52
|
-
} else {
|
53
|
-
menuItem.value = item.value;
|
54
|
-
itemCallback(menuItem);
|
55
|
-
}
|
56
|
-
|
57
|
-
output.push(menuItem);
|
58
|
-
});
|
59
|
-
|
60
|
-
return output;
|
61
|
-
}
|
62
|
-
|
63
|
-
return appendItems(inputList, startItems || []);
|
64
|
-
}
|
65
|
-
|
66
|
-
function createImageList(callback) {
|
67
|
-
return function() {
|
68
|
-
var imageList = editor.settings.image_list;
|
69
|
-
|
70
|
-
if (typeof(imageList) == "string") {
|
71
|
-
tinymce.util.XHR.send({
|
72
|
-
url: imageList,
|
73
|
-
success: function(text) {
|
74
|
-
callback(tinymce.util.JSON.parse(text));
|
75
|
-
}
|
76
|
-
});
|
77
|
-
} else if (typeof(imageList) == "function") {
|
78
|
-
imageList(callback);
|
79
|
-
} else {
|
80
|
-
callback(imageList);
|
81
|
-
}
|
82
|
-
};
|
83
|
-
}
|
84
|
-
|
85
|
-
function showDialog(imageList) {
|
86
|
-
var win, data = {}, dom = editor.dom, imgElm = editor.selection.getNode();
|
87
|
-
var width, height, imageListCtrl, classListCtrl, imageDimensions = editor.settings.image_dimensions !== false;
|
88
|
-
|
89
|
-
function recalcSize() {
|
90
|
-
var widthCtrl, heightCtrl, newWidth, newHeight;
|
91
|
-
|
92
|
-
widthCtrl = win.find('#width')[0];
|
93
|
-
heightCtrl = win.find('#height')[0];
|
94
|
-
|
95
|
-
if (!widthCtrl || !heightCtrl) {
|
96
|
-
return;
|
97
|
-
}
|
98
|
-
|
99
|
-
newWidth = widthCtrl.value();
|
100
|
-
newHeight = heightCtrl.value();
|
101
|
-
|
102
|
-
if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
|
103
|
-
if (width != newWidth) {
|
104
|
-
newHeight = Math.round((newWidth / width) * newHeight);
|
105
|
-
heightCtrl.value(newHeight);
|
106
|
-
} else {
|
107
|
-
newWidth = Math.round((newHeight / height) * newWidth);
|
108
|
-
widthCtrl.value(newWidth);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
width = newWidth;
|
113
|
-
height = newHeight;
|
114
|
-
}
|
115
|
-
|
116
|
-
function onSubmitForm() {
|
117
|
-
function waitLoad(imgElm) {
|
118
|
-
function selectImage() {
|
119
|
-
imgElm.onload = imgElm.onerror = null;
|
120
|
-
|
121
|
-
if (editor.selection) {
|
122
|
-
editor.selection.select(imgElm);
|
123
|
-
editor.nodeChanged();
|
124
|
-
}
|
125
|
-
}
|
126
|
-
|
127
|
-
imgElm.onload = function() {
|
128
|
-
if (!data.width && !data.height && imageDimensions) {
|
129
|
-
dom.setAttribs(imgElm, {
|
130
|
-
width: imgElm.clientWidth,
|
131
|
-
height: imgElm.clientHeight
|
132
|
-
});
|
133
|
-
}
|
134
|
-
|
135
|
-
selectImage();
|
136
|
-
};
|
137
|
-
|
138
|
-
imgElm.onerror = selectImage;
|
139
|
-
}
|
140
|
-
|
141
|
-
updateStyle();
|
142
|
-
recalcSize();
|
143
|
-
|
144
|
-
data = tinymce.extend(data, win.toJSON());
|
145
|
-
|
146
|
-
if (!data.alt) {
|
147
|
-
data.alt = '';
|
148
|
-
}
|
149
|
-
|
150
|
-
if (data.width === '') {
|
151
|
-
data.width = null;
|
152
|
-
}
|
153
|
-
|
154
|
-
if (data.height === '') {
|
155
|
-
data.height = null;
|
156
|
-
}
|
157
|
-
|
158
|
-
if (!data.style) {
|
159
|
-
data.style = null;
|
160
|
-
}
|
161
|
-
|
162
|
-
// Setup new data excluding style properties
|
163
|
-
data = {
|
164
|
-
src: data.src,
|
165
|
-
alt: data.alt,
|
166
|
-
width: data.width,
|
167
|
-
height: data.height,
|
168
|
-
style: data.style,
|
169
|
-
"class": data["class"]
|
170
|
-
};
|
171
|
-
|
172
|
-
editor.undoManager.transact(function() {
|
173
|
-
if (!data.src) {
|
174
|
-
if (imgElm) {
|
175
|
-
dom.remove(imgElm);
|
176
|
-
editor.focus();
|
177
|
-
editor.nodeChanged();
|
178
|
-
}
|
179
|
-
|
180
|
-
return;
|
181
|
-
}
|
182
|
-
|
183
|
-
if (!imgElm) {
|
184
|
-
data.id = '__mcenew';
|
185
|
-
editor.focus();
|
186
|
-
editor.selection.setContent(dom.createHTML('img', data));
|
187
|
-
imgElm = dom.get('__mcenew');
|
188
|
-
dom.setAttrib(imgElm, 'id', null);
|
189
|
-
} else {
|
190
|
-
dom.setAttribs(imgElm, data);
|
191
|
-
}
|
192
|
-
|
193
|
-
waitLoad(imgElm);
|
194
|
-
});
|
195
|
-
}
|
196
|
-
|
197
|
-
function removePixelSuffix(value) {
|
198
|
-
if (value) {
|
199
|
-
value = value.replace(/px$/, '');
|
200
|
-
}
|
201
|
-
|
202
|
-
return value;
|
203
|
-
}
|
204
|
-
|
205
|
-
function srcChange(e) {
|
206
|
-
var meta = e.meta || {};
|
207
|
-
|
208
|
-
if (imageListCtrl) {
|
209
|
-
imageListCtrl.value(editor.convertURL(this.value(), 'src'));
|
210
|
-
}
|
211
|
-
|
212
|
-
tinymce.each(meta, function(value, key) {
|
213
|
-
win.find('#' + key).value(value);
|
214
|
-
});
|
215
|
-
|
216
|
-
if (!meta.width && !meta.height) {
|
217
|
-
var srcURL = this.value(),
|
218
|
-
absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i'),
|
219
|
-
baseURL = editor.settings.document_base_url;
|
220
|
-
|
221
|
-
//Pattern test the src url and make sure we haven't already prepended the url
|
222
|
-
if (baseURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, baseURL.length) !== baseURL) {
|
223
|
-
this.value(baseURL + srcURL);
|
224
|
-
}
|
225
|
-
|
226
|
-
getImageSize(this.value(), function(data) {
|
227
|
-
if (data.width && data.height && imageDimensions) {
|
228
|
-
width = data.width;
|
229
|
-
height = data.height;
|
230
|
-
|
231
|
-
win.find('#width').value(width);
|
232
|
-
win.find('#height').value(height);
|
233
|
-
}
|
234
|
-
});
|
235
|
-
}
|
236
|
-
}
|
237
|
-
|
238
|
-
width = dom.getAttrib(imgElm, 'width');
|
239
|
-
height = dom.getAttrib(imgElm, 'height');
|
240
|
-
|
241
|
-
if (imgElm.nodeName == 'IMG' && !imgElm.getAttribute('data-mce-object') && !imgElm.getAttribute('data-mce-placeholder')) {
|
242
|
-
data = {
|
243
|
-
src: dom.getAttrib(imgElm, 'src'),
|
244
|
-
alt: dom.getAttrib(imgElm, 'alt'),
|
245
|
-
"class": dom.getAttrib(imgElm, 'class'),
|
246
|
-
width: width,
|
247
|
-
height: height
|
248
|
-
};
|
249
|
-
} else {
|
250
|
-
imgElm = null;
|
251
|
-
}
|
252
|
-
|
253
|
-
if (imageList) {
|
254
|
-
imageListCtrl = {
|
255
|
-
type: 'listbox',
|
256
|
-
label: 'Image list',
|
257
|
-
values: buildListItems(
|
258
|
-
imageList,
|
259
|
-
function(item) {
|
260
|
-
item.value = editor.convertURL(item.value || item.url, 'src');
|
261
|
-
},
|
262
|
-
[{text: 'None', value: ''}]
|
263
|
-
),
|
264
|
-
value: data.src && editor.convertURL(data.src, 'src'),
|
265
|
-
onselect: function(e) {
|
266
|
-
var altCtrl = win.find('#alt');
|
267
|
-
|
268
|
-
if (!altCtrl.value() || (e.lastControl && altCtrl.value() == e.lastControl.text())) {
|
269
|
-
altCtrl.value(e.control.text());
|
270
|
-
}
|
271
|
-
|
272
|
-
win.find('#src').value(e.control.value()).fire('change');
|
273
|
-
},
|
274
|
-
onPostRender: function() {
|
275
|
-
imageListCtrl = this;
|
276
|
-
}
|
277
|
-
};
|
278
|
-
}
|
279
|
-
|
280
|
-
if (editor.settings.image_class_list) {
|
281
|
-
classListCtrl = {
|
282
|
-
name: 'class',
|
283
|
-
type: 'listbox',
|
284
|
-
label: 'Class',
|
285
|
-
values: buildListItems(
|
286
|
-
editor.settings.image_class_list,
|
287
|
-
function(item) {
|
288
|
-
if (item.value) {
|
289
|
-
item.textStyle = function() {
|
290
|
-
return editor.formatter.getCssText({inline: 'img', classes: [item.value]});
|
291
|
-
};
|
292
|
-
}
|
293
|
-
}
|
294
|
-
)
|
295
|
-
};
|
296
|
-
}
|
297
|
-
|
298
|
-
// General settings shared between simple and advanced dialogs
|
299
|
-
var generalFormItems = [
|
300
|
-
{
|
301
|
-
name: 'src',
|
302
|
-
type: 'filepicker',
|
303
|
-
filetype: 'image',
|
304
|
-
label: 'Source',
|
305
|
-
autofocus: true,
|
306
|
-
onchange: srcChange
|
307
|
-
},
|
308
|
-
imageListCtrl
|
309
|
-
];
|
310
|
-
|
311
|
-
if (editor.settings.image_description !== false) {
|
312
|
-
generalFormItems.push({name: 'alt', type: 'textbox', label: 'Image description'});
|
313
|
-
}
|
314
|
-
|
315
|
-
if (imageDimensions) {
|
316
|
-
generalFormItems.push({
|
317
|
-
type: 'container',
|
318
|
-
label: 'Dimensions',
|
319
|
-
layout: 'flex',
|
320
|
-
direction: 'row',
|
321
|
-
align: 'center',
|
322
|
-
spacing: 5,
|
323
|
-
items: [
|
324
|
-
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width'},
|
325
|
-
{type: 'label', text: 'x'},
|
326
|
-
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height'},
|
327
|
-
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
|
328
|
-
]
|
329
|
-
});
|
330
|
-
}
|
331
|
-
|
332
|
-
generalFormItems.push(classListCtrl);
|
333
|
-
|
334
|
-
function updateStyle() {
|
335
|
-
function addPixelSuffix(value) {
|
336
|
-
if (value.length > 0 && /^[0-9]+$/.test(value)) {
|
337
|
-
value += 'px';
|
338
|
-
}
|
339
|
-
|
340
|
-
return value;
|
341
|
-
}
|
342
|
-
|
343
|
-
if (!editor.settings.image_advtab) {
|
344
|
-
return;
|
345
|
-
}
|
346
|
-
|
347
|
-
var data = win.toJSON();
|
348
|
-
var css = dom.parseStyle(data.style);
|
349
|
-
|
350
|
-
delete css.margin;
|
351
|
-
css['margin-top'] = css['margin-bottom'] = addPixelSuffix(data.vspace);
|
352
|
-
css['margin-left'] = css['margin-right'] = addPixelSuffix(data.hspace);
|
353
|
-
css['border-width'] = addPixelSuffix(data.border);
|
354
|
-
|
355
|
-
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
356
|
-
}
|
357
|
-
|
358
|
-
if (editor.settings.image_advtab) {
|
359
|
-
// Parse styles from img
|
360
|
-
if (imgElm) {
|
361
|
-
data.hspace = removePixelSuffix(imgElm.style.marginLeft || imgElm.style.marginRight);
|
362
|
-
data.vspace = removePixelSuffix(imgElm.style.marginTop || imgElm.style.marginBottom);
|
363
|
-
data.border = removePixelSuffix(imgElm.style.borderWidth);
|
364
|
-
data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style')));
|
365
|
-
}
|
366
|
-
|
367
|
-
// Advanced dialog shows general+advanced tabs
|
368
|
-
win = editor.windowManager.open({
|
369
|
-
title: 'Insert/edit image',
|
370
|
-
data: data,
|
371
|
-
bodyType: 'tabpanel',
|
372
|
-
body: [
|
373
|
-
{
|
374
|
-
title: 'General',
|
375
|
-
type: 'form',
|
376
|
-
items: generalFormItems
|
377
|
-
},
|
378
|
-
|
379
|
-
{
|
380
|
-
title: 'Advanced',
|
381
|
-
type: 'form',
|
382
|
-
pack: 'start',
|
383
|
-
items: [
|
384
|
-
{
|
385
|
-
label: 'Style',
|
386
|
-
name: 'style',
|
387
|
-
type: 'textbox'
|
388
|
-
},
|
389
|
-
{
|
390
|
-
type: 'form',
|
391
|
-
layout: 'grid',
|
392
|
-
packV: 'start',
|
393
|
-
columns: 2,
|
394
|
-
padding: 0,
|
395
|
-
alignH: ['left', 'right'],
|
396
|
-
defaults: {
|
397
|
-
type: 'textbox',
|
398
|
-
maxWidth: 50,
|
399
|
-
onchange: updateStyle
|
400
|
-
},
|
401
|
-
items: [
|
402
|
-
{label: 'Vertical space', name: 'vspace'},
|
403
|
-
{label: 'Horizontal space', name: 'hspace'},
|
404
|
-
{label: 'Border', name: 'border'}
|
405
|
-
]
|
406
|
-
}
|
407
|
-
]
|
408
|
-
}
|
409
|
-
],
|
410
|
-
onSubmit: onSubmitForm
|
411
|
-
});
|
412
|
-
} else {
|
413
|
-
// Simple default dialog
|
414
|
-
win = editor.windowManager.open({
|
415
|
-
title: 'Insert/edit image',
|
416
|
-
data: data,
|
417
|
-
body: generalFormItems,
|
418
|
-
onSubmit: onSubmitForm
|
419
|
-
});
|
420
|
-
}
|
421
|
-
}
|
422
|
-
|
423
|
-
editor.addButton('image', {
|
424
|
-
icon: 'image',
|
425
|
-
tooltip: 'Insert/edit image',
|
426
|
-
onclick: createImageList(showDialog),
|
427
|
-
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])'
|
428
|
-
});
|
429
|
-
|
430
|
-
editor.addMenuItem('image', {
|
431
|
-
icon: 'image',
|
432
|
-
text: 'Insert image',
|
433
|
-
onclick: createImageList(showDialog),
|
434
|
-
context: 'insert',
|
435
|
-
prependToContext: true
|
436
|
-
});
|
437
|
-
|
438
|
-
editor.addCommand('mceImage', createImageList(showDialog));
|
439
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode&&d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()};var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d),d.src=a}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function e(d){function e(){var a,b,c,d;a=j.find("#width")[0],b=j.find("#height")[0],a&&b&&(c=a.value(),d=b.value(),j.find("#constrain")[0].checked()&&k&&l&&c&&d&&(k!=c?(d=Math.round(c/k*d),b.value(d)):(c=Math.round(d/l*c),a.value(c))),k=c,l=d)}function f(){function b(b){function c(){b.onload=b.onerror=null,a.selection&&(a.selection.select(b),a.nodeChanged())}b.onload=function(){o.width||o.height||!r||p.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),c()},b.onerror=c}i(),e(),o=tinymce.extend(o,j.toJSON()),o.alt||(o.alt=""),""===o.width&&(o.width=null),""===o.height&&(o.height=null),o.style||(o.style=null),o={src:o.src,alt:o.alt,width:o.width,height:o.height,style:o.style,"class":o["class"]},a.undoManager.transact(function(){return o.src?(q?p.setAttribs(q,o):(o.id="__mcenew",a.focus(),a.selection.setContent(p.createHTML("img",o)),q=p.get("__mcenew"),p.setAttrib(q,"id",null)),void b(q)):void(q&&(p.remove(q),a.focus(),a.nodeChanged()))})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(c){var d=c.meta||{};if(m&&m.value(a.convertURL(this.value(),"src")),tinymce.each(d,function(a,b){j.find("#"+b).value(a)}),!d.width&&!d.height){var e=this.value(),f=new RegExp("^(?:[a-z]+:)?//","i"),g=a.settings.document_base_url;g&&!f.test(e)&&e.substring(0,g.length)!==g&&this.value(g+e),b(this.value(),function(a){a.width&&a.height&&r&&(k=a.width,l=a.height,j.find("#width").value(k),j.find("#height").value(l))})}}function i(){function b(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}if(a.settings.image_advtab){var c=j.toJSON(),d=p.parseStyle(c.style);delete d.margin,d["margin-top"]=d["margin-bottom"]=b(c.vspace),d["margin-left"]=d["margin-right"]=b(c.hspace),d["border-width"]=b(c.border),j.find("#style").value(p.serializeStyle(p.parseStyle(p.serializeStyle(d))))}}var j,k,l,m,n,o={},p=a.dom,q=a.selection.getNode(),r=a.settings.image_dimensions!==!1;k=p.getAttrib(q,"width"),l=p.getAttrib(q,"height"),"IMG"!=q.nodeName||q.getAttribute("data-mce-object")||q.getAttribute("data-mce-placeholder")?q=null:o={src:p.getAttrib(q,"src"),alt:p.getAttrib(q,"alt"),"class":p.getAttrib(q,"class"),width:k,height:l},d&&(m={type:"listbox",label:"Image list",values:c(d,function(b){b.value=a.convertURL(b.value||b.url,"src")},[{text:"None",value:""}]),value:o.src&&a.convertURL(o.src,"src"),onselect:function(a){var b=j.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),j.find("#src").value(a.control.value()).fire("change")},onPostRender:function(){m=this}}),a.settings.image_class_list&&(n={name:"class",type:"listbox",label:"Class",values:c(a.settings.image_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"img",classes:[b.value]})})})});var s=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},m];a.settings.image_description!==!1&&s.push({name:"alt",type:"textbox",label:"Image description"}),r&&s.push({type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),s.push(n),a.settings.image_advtab?(q&&(o.hspace=g(q.style.marginLeft||q.style.marginRight),o.vspace=g(q.style.marginTop||q.style.marginBottom),o.border=g(q.style.borderWidth),o.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(q,"style")))),j=a.windowManager.open({title:"Insert/edit image",data:o,bodyType:"tabpanel",body:[{title:"General",type:"form",items:s},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox"},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:i},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):j=a.windowManager.open({title:"Insert/edit image",data:o,body:s,onSubmit:f})}a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:d(e),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"}),a.addMenuItem("image",{icon:"image",text:"Insert image",onclick:d(e),context:"insert",prependToContext:!0}),a.addCommand("mceImage",d(e))});
|
@@ -1,195 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* plugin.js
|
3
|
-
*
|
4
|
-
* Copyright, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://www.tinymce.com/license
|
8
|
-
* Contributing: http://www.tinymce.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
/*global tinymce:true */
|
12
|
-
|
13
|
-
tinymce.PluginManager.add('importcss', function(editor) {
|
14
|
-
var self = this, each = tinymce.each;
|
15
|
-
|
16
|
-
function compileFilter(filter) {
|
17
|
-
if (typeof(filter) == "string") {
|
18
|
-
return function(value) {
|
19
|
-
return value.indexOf(filter) !== -1;
|
20
|
-
};
|
21
|
-
} else if (filter instanceof RegExp) {
|
22
|
-
return function(value) {
|
23
|
-
return filter.test(value);
|
24
|
-
};
|
25
|
-
}
|
26
|
-
|
27
|
-
return filter;
|
28
|
-
}
|
29
|
-
|
30
|
-
function getSelectors(doc, fileFilter) {
|
31
|
-
var selectors = [], contentCSSUrls = {};
|
32
|
-
|
33
|
-
function append(styleSheet, imported) {
|
34
|
-
var href = styleSheet.href, rules;
|
35
|
-
|
36
|
-
if (!href || !fileFilter(href, imported)) {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
|
40
|
-
each(styleSheet.imports, function(styleSheet) {
|
41
|
-
append(styleSheet, true);
|
42
|
-
});
|
43
|
-
|
44
|
-
try {
|
45
|
-
rules = styleSheet.cssRules || styleSheet.rules;
|
46
|
-
} catch (e) {
|
47
|
-
// Firefox fails on rules to remote domain for example:
|
48
|
-
// @import url(//fonts.googleapis.com/css?family=Pathway+Gothic+One);
|
49
|
-
}
|
50
|
-
|
51
|
-
each(rules, function(cssRule) {
|
52
|
-
if (cssRule.styleSheet) {
|
53
|
-
append(cssRule.styleSheet, true);
|
54
|
-
} else if (cssRule.selectorText) {
|
55
|
-
each(cssRule.selectorText.split(','), function(selector) {
|
56
|
-
selectors.push(tinymce.trim(selector));
|
57
|
-
});
|
58
|
-
}
|
59
|
-
});
|
60
|
-
}
|
61
|
-
|
62
|
-
each(editor.contentCSS, function(url) {
|
63
|
-
contentCSSUrls[url] = true;
|
64
|
-
});
|
65
|
-
|
66
|
-
if (!fileFilter) {
|
67
|
-
fileFilter = function(href, imported) {
|
68
|
-
return imported || contentCSSUrls[href];
|
69
|
-
};
|
70
|
-
}
|
71
|
-
|
72
|
-
try {
|
73
|
-
each(doc.styleSheets, function(styleSheet) {
|
74
|
-
append(styleSheet);
|
75
|
-
});
|
76
|
-
} catch (e) {}
|
77
|
-
|
78
|
-
return selectors;
|
79
|
-
}
|
80
|
-
|
81
|
-
function convertSelectorToFormat(selectorText) {
|
82
|
-
var format;
|
83
|
-
|
84
|
-
// Parse simple element.class1, .class1
|
85
|
-
var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
|
86
|
-
if (!selector) {
|
87
|
-
return;
|
88
|
-
}
|
89
|
-
|
90
|
-
var elementName = selector[1];
|
91
|
-
var classes = selector[2].substr(1).split('.').join(' ');
|
92
|
-
var inlineSelectorElements = tinymce.makeMap('a,img');
|
93
|
-
|
94
|
-
// element.class - Produce block formats
|
95
|
-
if (selector[1]) {
|
96
|
-
format = {
|
97
|
-
title: selectorText
|
98
|
-
};
|
99
|
-
|
100
|
-
if (editor.schema.getTextBlockElements()[elementName]) {
|
101
|
-
// Text block format ex: h1.class1
|
102
|
-
format.block = elementName;
|
103
|
-
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
|
104
|
-
// Block elements such as table.class and special inline elements such as a.class or img.class
|
105
|
-
format.selector = elementName;
|
106
|
-
} else {
|
107
|
-
// Inline format strong.class1
|
108
|
-
format.inline = elementName;
|
109
|
-
}
|
110
|
-
} else if (selector[2]) {
|
111
|
-
// .class - Produce inline span with classes
|
112
|
-
format = {
|
113
|
-
inline: 'span',
|
114
|
-
title: selectorText.substr(1),
|
115
|
-
classes: classes
|
116
|
-
};
|
117
|
-
}
|
118
|
-
|
119
|
-
// Append to or override class attribute
|
120
|
-
if (editor.settings.importcss_merge_classes !== false) {
|
121
|
-
format.classes = classes;
|
122
|
-
} else {
|
123
|
-
format.attributes = {"class": classes};
|
124
|
-
}
|
125
|
-
|
126
|
-
return format;
|
127
|
-
}
|
128
|
-
|
129
|
-
editor.on('renderFormatsMenu', function(e) {
|
130
|
-
var settings = editor.settings, selectors = {};
|
131
|
-
var selectorConverter = settings.importcss_selector_converter || convertSelectorToFormat;
|
132
|
-
var selectorFilter = compileFilter(settings.importcss_selector_filter), ctrl = e.control;
|
133
|
-
|
134
|
-
if (!editor.settings.importcss_append) {
|
135
|
-
ctrl.items().remove();
|
136
|
-
}
|
137
|
-
|
138
|
-
// Setup new groups collection by cloning the configured one
|
139
|
-
var groups = [];
|
140
|
-
tinymce.each(settings.importcss_groups, function(group) {
|
141
|
-
group = tinymce.extend({}, group);
|
142
|
-
group.filter = compileFilter(group.filter);
|
143
|
-
groups.push(group);
|
144
|
-
});
|
145
|
-
|
146
|
-
each(getSelectors(e.doc || editor.getDoc(), compileFilter(settings.importcss_file_filter)), function(selector) {
|
147
|
-
if (selector.indexOf('.mce-') === -1) {
|
148
|
-
if (!selectors[selector] && (!selectorFilter || selectorFilter(selector))) {
|
149
|
-
var format = selectorConverter.call(self, selector), menu;
|
150
|
-
|
151
|
-
if (format) {
|
152
|
-
var formatName = format.name || tinymce.DOM.uniqueId();
|
153
|
-
|
154
|
-
if (groups) {
|
155
|
-
for (var i = 0; i < groups.length; i++) {
|
156
|
-
if (!groups[i].filter || groups[i].filter(selector)) {
|
157
|
-
if (!groups[i].item) {
|
158
|
-
groups[i].item = {text: groups[i].title, menu: []};
|
159
|
-
}
|
160
|
-
|
161
|
-
menu = groups[i].item.menu;
|
162
|
-
break;
|
163
|
-
}
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
editor.formatter.register(formatName, format);
|
168
|
-
|
169
|
-
var menuItem = tinymce.extend({}, ctrl.settings.itemDefaults, {
|
170
|
-
text: format.title,
|
171
|
-
format: formatName
|
172
|
-
});
|
173
|
-
|
174
|
-
if (menu) {
|
175
|
-
menu.push(menuItem);
|
176
|
-
} else {
|
177
|
-
ctrl.add(menuItem);
|
178
|
-
}
|
179
|
-
}
|
180
|
-
|
181
|
-
selectors[selector] = true;
|
182
|
-
}
|
183
|
-
}
|
184
|
-
});
|
185
|
-
|
186
|
-
each(groups, function(group) {
|
187
|
-
ctrl.add(group.item);
|
188
|
-
});
|
189
|
-
|
190
|
-
e.control.renderNew();
|
191
|
-
});
|
192
|
-
|
193
|
-
// Expose default convertSelectorToFormat implementation
|
194
|
-
self.convertSelectorToFormat = convertSelectorToFormat;
|
195
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("importcss",function(a){function b(a){return"string"==typeof a?function(b){return-1!==b.indexOf(a)}:a instanceof RegExp?function(b){return a.test(b)}:a}function c(b,c){function d(a,b){var g,h=a.href;if(h&&c(h,b)){f(a.imports,function(a){d(a,!0)});try{g=a.cssRules||a.rules}catch(i){}f(g,function(a){a.styleSheet?d(a.styleSheet,!0):a.selectorText&&f(a.selectorText.split(","),function(a){e.push(tinymce.trim(a))})})}}var e=[],g={};f(a.contentCSS,function(a){g[a]=!0}),c||(c=function(a,b){return b||g[a]});try{f(b.styleSheets,function(a){d(a)})}catch(h){}return e}function d(b){var c,d=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(b);if(d){var e=d[1],f=d[2].substr(1).split(".").join(" "),g=tinymce.makeMap("a,img");return d[1]?(c={title:b},a.schema.getTextBlockElements()[e]?c.block=e:a.schema.getBlockElements()[e]||g[e.toLowerCase()]?c.selector=e:c.inline=e):d[2]&&(c={inline:"span",title:b.substr(1),classes:f}),a.settings.importcss_merge_classes!==!1?c.classes=f:c.attributes={"class":f},c}}var e=this,f=tinymce.each;a.on("renderFormatsMenu",function(g){var h=a.settings,i={},j=h.importcss_selector_converter||d,k=b(h.importcss_selector_filter),l=g.control;a.settings.importcss_append||l.items().remove();var m=[];tinymce.each(h.importcss_groups,function(a){a=tinymce.extend({},a),a.filter=b(a.filter),m.push(a)}),f(c(g.doc||a.getDoc(),b(h.importcss_file_filter)),function(b){if(-1===b.indexOf(".mce-")&&!i[b]&&(!k||k(b))){var c,d=j.call(e,b);if(d){var f=d.name||tinymce.DOM.uniqueId();if(m)for(var g=0;g<m.length;g++)if(!m[g].filter||m[g].filter(b)){m[g].item||(m[g].item={text:m[g].title,menu:[]}),c=m[g].item.menu;break}a.formatter.register(f,d);var h=tinymce.extend({},l.settings.itemDefaults,{text:d.title,format:f});c?c.push(h):l.add(h)}i[b]=!0}}),f(m,function(a){l.add(a.item)}),g.control.renderNew()}),e.convertSelectorToFormat=d});
|