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,749 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Dialogs.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
|
-
/**
|
12
|
-
* ...
|
13
|
-
*
|
14
|
-
* @class tinymce.tableplugin.Dialogs
|
15
|
-
* @private
|
16
|
-
*/
|
17
|
-
define("tinymce/tableplugin/Dialogs", [
|
18
|
-
"tinymce/util/Tools",
|
19
|
-
"tinymce/Env"
|
20
|
-
], function(Tools, Env) {
|
21
|
-
var each = Tools.each;
|
22
|
-
|
23
|
-
return function(editor) {
|
24
|
-
var self = this;
|
25
|
-
|
26
|
-
function createColorPickAction() {
|
27
|
-
var colorPickerCallback = editor.settings.color_picker_callback;
|
28
|
-
|
29
|
-
if (colorPickerCallback) {
|
30
|
-
return function() {
|
31
|
-
var self = this;
|
32
|
-
|
33
|
-
colorPickerCallback.call(
|
34
|
-
editor,
|
35
|
-
function(value) {
|
36
|
-
self.value(value).fire('change');
|
37
|
-
},
|
38
|
-
self.value()
|
39
|
-
);
|
40
|
-
};
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
function createStyleForm(dom) {
|
45
|
-
return {
|
46
|
-
title: 'Advanced',
|
47
|
-
type: 'form',
|
48
|
-
defaults: {
|
49
|
-
onchange: function() {
|
50
|
-
updateStyle(dom, this.parents().reverse()[0], this.name() == "style");
|
51
|
-
}
|
52
|
-
},
|
53
|
-
items: [
|
54
|
-
{
|
55
|
-
label: 'Style',
|
56
|
-
name: 'style',
|
57
|
-
type: 'textbox'
|
58
|
-
},
|
59
|
-
|
60
|
-
{
|
61
|
-
type: 'form',
|
62
|
-
padding: 0,
|
63
|
-
formItemDefaults: {
|
64
|
-
layout: 'grid',
|
65
|
-
alignH: ['start', 'right']
|
66
|
-
},
|
67
|
-
defaults: {
|
68
|
-
size: 7
|
69
|
-
},
|
70
|
-
items: [
|
71
|
-
{
|
72
|
-
label: 'Border color',
|
73
|
-
type: 'colorbox',
|
74
|
-
name: 'borderColor',
|
75
|
-
onaction: createColorPickAction()
|
76
|
-
},
|
77
|
-
|
78
|
-
{
|
79
|
-
label: 'Background color',
|
80
|
-
type: 'colorbox',
|
81
|
-
name: 'backgroundColor',
|
82
|
-
onaction: createColorPickAction()
|
83
|
-
}
|
84
|
-
]
|
85
|
-
}
|
86
|
-
]
|
87
|
-
};
|
88
|
-
}
|
89
|
-
|
90
|
-
function removePxSuffix(size) {
|
91
|
-
return size ? size.replace(/px$/, '') : "";
|
92
|
-
}
|
93
|
-
|
94
|
-
function addSizeSuffix(size) {
|
95
|
-
if (/^[0-9]+$/.test(size)) {
|
96
|
-
size += "px";
|
97
|
-
}
|
98
|
-
|
99
|
-
return size;
|
100
|
-
}
|
101
|
-
|
102
|
-
function unApplyAlign(elm) {
|
103
|
-
each('left center right'.split(' '), function(name) {
|
104
|
-
editor.formatter.remove('align' + name, {}, elm);
|
105
|
-
});
|
106
|
-
}
|
107
|
-
|
108
|
-
function unApplyVAlign(elm) {
|
109
|
-
each('top middle bottom'.split(' '), function(name) {
|
110
|
-
editor.formatter.remove('valign' + name, {}, elm);
|
111
|
-
});
|
112
|
-
}
|
113
|
-
|
114
|
-
function buildListItems(inputList, itemCallback, startItems) {
|
115
|
-
function appendItems(values, output) {
|
116
|
-
output = output || [];
|
117
|
-
|
118
|
-
Tools.each(values, function(item) {
|
119
|
-
var menuItem = {text: item.text || item.title};
|
120
|
-
|
121
|
-
if (item.menu) {
|
122
|
-
menuItem.menu = appendItems(item.menu);
|
123
|
-
} else {
|
124
|
-
menuItem.value = item.value;
|
125
|
-
|
126
|
-
if (itemCallback) {
|
127
|
-
itemCallback(menuItem);
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
output.push(menuItem);
|
132
|
-
});
|
133
|
-
|
134
|
-
return output;
|
135
|
-
}
|
136
|
-
|
137
|
-
return appendItems(inputList, startItems || []);
|
138
|
-
}
|
139
|
-
|
140
|
-
function updateStyle(dom, win, isStyleCtrl) {
|
141
|
-
var data = win.toJSON();
|
142
|
-
var css = dom.parseStyle(data.style);
|
143
|
-
|
144
|
-
if (isStyleCtrl) {
|
145
|
-
win.find('#borderColor').value(css["border-color"] || '')[0].fire('change');
|
146
|
-
win.find('#backgroundColor').value(css["background-color"] || '')[0].fire('change');
|
147
|
-
} else {
|
148
|
-
css["border-color"] = data.borderColor;
|
149
|
-
css["background-color"] = data.backgroundColor;
|
150
|
-
}
|
151
|
-
|
152
|
-
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
153
|
-
}
|
154
|
-
|
155
|
-
function appendStylesToData(dom, data, elm) {
|
156
|
-
var css = dom.parseStyle(dom.getAttrib(elm, 'style'));
|
157
|
-
|
158
|
-
if (css["border-color"]) {
|
159
|
-
data.borderColor = css["border-color"];
|
160
|
-
}
|
161
|
-
|
162
|
-
if (css["background-color"]) {
|
163
|
-
data.backgroundColor = css["background-color"];
|
164
|
-
}
|
165
|
-
|
166
|
-
data.style = dom.serializeStyle(css);
|
167
|
-
}
|
168
|
-
|
169
|
-
self.tableProps = function() {
|
170
|
-
self.table(true);
|
171
|
-
};
|
172
|
-
|
173
|
-
self.table = function(isProps) {
|
174
|
-
var dom = editor.dom, tableElm, colsCtrl, rowsCtrl, classListCtrl, data = {}, generalTableForm;
|
175
|
-
|
176
|
-
function onSubmitTableForm() {
|
177
|
-
var captionElm;
|
178
|
-
|
179
|
-
updateStyle(dom, this);
|
180
|
-
data = Tools.extend(data, this.toJSON());
|
181
|
-
|
182
|
-
Tools.each('backgroundColor borderColor'.split(' '), function(name) {
|
183
|
-
delete data[name];
|
184
|
-
});
|
185
|
-
|
186
|
-
if (data["class"] === false) {
|
187
|
-
delete data["class"];
|
188
|
-
}
|
189
|
-
|
190
|
-
editor.undoManager.transact(function() {
|
191
|
-
if (!tableElm) {
|
192
|
-
tableElm = editor.plugins.table.insertTable(data.cols || 1, data.rows || 1);
|
193
|
-
}
|
194
|
-
|
195
|
-
editor.dom.setAttribs(tableElm, {
|
196
|
-
cellspacing: data.cellspacing,
|
197
|
-
cellpadding: data.cellpadding,
|
198
|
-
border: data.border,
|
199
|
-
style: data.style,
|
200
|
-
'class': data['class']
|
201
|
-
});
|
202
|
-
|
203
|
-
if (dom.getAttrib(tableElm, 'width')) {
|
204
|
-
dom.setAttrib(tableElm, 'width', removePxSuffix(data.width));
|
205
|
-
} else {
|
206
|
-
dom.setStyle(tableElm, 'width', addSizeSuffix(data.width));
|
207
|
-
}
|
208
|
-
|
209
|
-
dom.setStyle(tableElm, 'height', addSizeSuffix(data.height));
|
210
|
-
|
211
|
-
// Toggle caption on/off
|
212
|
-
captionElm = dom.select('caption', tableElm)[0];
|
213
|
-
|
214
|
-
if (captionElm && !data.caption) {
|
215
|
-
dom.remove(captionElm);
|
216
|
-
}
|
217
|
-
|
218
|
-
if (!captionElm && data.caption) {
|
219
|
-
captionElm = dom.create('caption');
|
220
|
-
captionElm.innerHTML = !Env.ie ? '<br data-mce-bogus="1"/>' : '\u00a0';
|
221
|
-
tableElm.insertBefore(captionElm, tableElm.firstChild);
|
222
|
-
}
|
223
|
-
|
224
|
-
unApplyAlign(tableElm);
|
225
|
-
if (data.align) {
|
226
|
-
editor.formatter.apply('align' + data.align, {}, tableElm);
|
227
|
-
}
|
228
|
-
|
229
|
-
editor.focus();
|
230
|
-
editor.addVisual();
|
231
|
-
});
|
232
|
-
}
|
233
|
-
|
234
|
-
if (isProps === true) {
|
235
|
-
tableElm = dom.getParent(editor.selection.getStart(), 'table');
|
236
|
-
|
237
|
-
if (tableElm) {
|
238
|
-
data = {
|
239
|
-
width: removePxSuffix(dom.getStyle(tableElm, 'width') || dom.getAttrib(tableElm, 'width')),
|
240
|
-
height: removePxSuffix(dom.getStyle(tableElm, 'height') || dom.getAttrib(tableElm, 'height')),
|
241
|
-
cellspacing: tableElm ? dom.getAttrib(tableElm, 'cellspacing') : '',
|
242
|
-
cellpadding: tableElm ? dom.getAttrib(tableElm, 'cellpadding') : '',
|
243
|
-
border: tableElm ? dom.getAttrib(tableElm, 'border') : '',
|
244
|
-
caption: !!dom.select('caption', tableElm)[0],
|
245
|
-
'class': dom.getAttrib(tableElm, 'class')
|
246
|
-
};
|
247
|
-
|
248
|
-
each('left center right'.split(' '), function(name) {
|
249
|
-
if (editor.formatter.matchNode(tableElm, 'align' + name)) {
|
250
|
-
data.align = name;
|
251
|
-
}
|
252
|
-
});
|
253
|
-
}
|
254
|
-
} else {
|
255
|
-
colsCtrl = {label: 'Cols', name: 'cols'};
|
256
|
-
rowsCtrl = {label: 'Rows', name: 'rows'};
|
257
|
-
}
|
258
|
-
|
259
|
-
if (editor.settings.table_class_list) {
|
260
|
-
if (data["class"]) {
|
261
|
-
data["class"] = data["class"].replace(/\s*mce\-item\-table\s*/g, '');
|
262
|
-
}
|
263
|
-
|
264
|
-
classListCtrl = {
|
265
|
-
name: 'class',
|
266
|
-
type: 'listbox',
|
267
|
-
label: 'Class',
|
268
|
-
values: buildListItems(
|
269
|
-
editor.settings.table_class_list,
|
270
|
-
function(item) {
|
271
|
-
if (item.value) {
|
272
|
-
item.textStyle = function() {
|
273
|
-
return editor.formatter.getCssText({block: 'table', classes: [item.value]});
|
274
|
-
};
|
275
|
-
}
|
276
|
-
}
|
277
|
-
)
|
278
|
-
};
|
279
|
-
}
|
280
|
-
|
281
|
-
generalTableForm = {
|
282
|
-
type: 'form',
|
283
|
-
layout: 'flex',
|
284
|
-
direction: 'column',
|
285
|
-
labelGapCalc: 'children',
|
286
|
-
padding: 0,
|
287
|
-
items: [
|
288
|
-
{
|
289
|
-
type: 'form',
|
290
|
-
labelGapCalc: false,
|
291
|
-
padding: 0,
|
292
|
-
layout: 'grid',
|
293
|
-
columns: 2,
|
294
|
-
defaults: {
|
295
|
-
type: 'textbox',
|
296
|
-
maxWidth: 50
|
297
|
-
},
|
298
|
-
items: [
|
299
|
-
colsCtrl,
|
300
|
-
rowsCtrl,
|
301
|
-
{label: 'Width', name: 'width'},
|
302
|
-
{label: 'Height', name: 'height'},
|
303
|
-
{label: 'Cell spacing', name: 'cellspacing'},
|
304
|
-
{label: 'Cell padding', name: 'cellpadding'},
|
305
|
-
{label: 'Border', name: 'border'},
|
306
|
-
{label: 'Caption', name: 'caption', type: 'checkbox'}
|
307
|
-
]
|
308
|
-
},
|
309
|
-
|
310
|
-
{
|
311
|
-
label: 'Alignment',
|
312
|
-
name: 'align',
|
313
|
-
type: 'listbox',
|
314
|
-
text: 'None',
|
315
|
-
values: [
|
316
|
-
{text: 'None', value: ''},
|
317
|
-
{text: 'Left', value: 'left'},
|
318
|
-
{text: 'Center', value: 'center'},
|
319
|
-
{text: 'Right', value: 'right'}
|
320
|
-
]
|
321
|
-
},
|
322
|
-
|
323
|
-
classListCtrl
|
324
|
-
]
|
325
|
-
};
|
326
|
-
|
327
|
-
if (editor.settings.table_advtab !== false) {
|
328
|
-
appendStylesToData(dom, data, tableElm);
|
329
|
-
|
330
|
-
editor.windowManager.open({
|
331
|
-
title: "Table properties",
|
332
|
-
data: data,
|
333
|
-
bodyType: 'tabpanel',
|
334
|
-
body: [
|
335
|
-
{
|
336
|
-
title: 'General',
|
337
|
-
type: 'form',
|
338
|
-
items: generalTableForm
|
339
|
-
},
|
340
|
-
createStyleForm(dom)
|
341
|
-
],
|
342
|
-
|
343
|
-
onsubmit: onSubmitTableForm
|
344
|
-
});
|
345
|
-
} else {
|
346
|
-
editor.windowManager.open({
|
347
|
-
title: "Table properties",
|
348
|
-
data: data,
|
349
|
-
body: generalTableForm,
|
350
|
-
onsubmit: onSubmitTableForm
|
351
|
-
});
|
352
|
-
}
|
353
|
-
};
|
354
|
-
|
355
|
-
self.merge = function(grid, cell) {
|
356
|
-
editor.windowManager.open({
|
357
|
-
title: "Merge cells",
|
358
|
-
body: [
|
359
|
-
{label: 'Cols', name: 'cols', type: 'textbox', value: '1', size: 10},
|
360
|
-
{label: 'Rows', name: 'rows', type: 'textbox', value: '1', size: 10}
|
361
|
-
],
|
362
|
-
onsubmit: function() {
|
363
|
-
var data = this.toJSON();
|
364
|
-
|
365
|
-
editor.undoManager.transact(function() {
|
366
|
-
grid.merge(cell, data.cols, data.rows);
|
367
|
-
});
|
368
|
-
}
|
369
|
-
});
|
370
|
-
};
|
371
|
-
|
372
|
-
self.cell = function() {
|
373
|
-
var dom = editor.dom, cellElm, data, classListCtrl, cells = [];
|
374
|
-
|
375
|
-
function onSubmitCellForm() {
|
376
|
-
updateStyle(dom, this);
|
377
|
-
data = Tools.extend(data, this.toJSON());
|
378
|
-
|
379
|
-
editor.undoManager.transact(function() {
|
380
|
-
each(cells, function(cellElm) {
|
381
|
-
editor.dom.setAttribs(cellElm, {
|
382
|
-
scope: data.scope,
|
383
|
-
style: data.style,
|
384
|
-
'class': data['class']
|
385
|
-
});
|
386
|
-
|
387
|
-
editor.dom.setStyles(cellElm, {
|
388
|
-
width: addSizeSuffix(data.width),
|
389
|
-
height: addSizeSuffix(data.height)
|
390
|
-
});
|
391
|
-
|
392
|
-
// Switch cell type
|
393
|
-
if (data.type && cellElm.nodeName.toLowerCase() != data.type) {
|
394
|
-
cellElm = dom.rename(cellElm, data.type);
|
395
|
-
}
|
396
|
-
|
397
|
-
// Apply/remove alignment
|
398
|
-
unApplyAlign(cellElm);
|
399
|
-
if (data.align) {
|
400
|
-
editor.formatter.apply('align' + data.align, {}, cellElm);
|
401
|
-
}
|
402
|
-
|
403
|
-
// Apply/remove vertical alignment
|
404
|
-
unApplyVAlign(cellElm);
|
405
|
-
if (data.valign) {
|
406
|
-
editor.formatter.apply('valign' + data.valign, {}, cellElm);
|
407
|
-
}
|
408
|
-
});
|
409
|
-
|
410
|
-
editor.focus();
|
411
|
-
});
|
412
|
-
}
|
413
|
-
|
414
|
-
// Get selected cells or the current cell
|
415
|
-
cells = editor.dom.select('td.mce-item-selected,th.mce-item-selected');
|
416
|
-
cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
|
417
|
-
if (!cells.length && cellElm) {
|
418
|
-
cells.push(cellElm);
|
419
|
-
}
|
420
|
-
|
421
|
-
cellElm = cellElm || cells[0];
|
422
|
-
|
423
|
-
if (!cellElm) {
|
424
|
-
// If this element is null, return now to avoid crashing.
|
425
|
-
return;
|
426
|
-
}
|
427
|
-
|
428
|
-
data = {
|
429
|
-
width: removePxSuffix(dom.getStyle(cellElm, 'width') || dom.getAttrib(cellElm, 'width')),
|
430
|
-
height: removePxSuffix(dom.getStyle(cellElm, 'height') || dom.getAttrib(cellElm, 'height')),
|
431
|
-
scope: dom.getAttrib(cellElm, 'scope'),
|
432
|
-
'class': dom.getAttrib(cellElm, 'class')
|
433
|
-
};
|
434
|
-
|
435
|
-
data.type = cellElm.nodeName.toLowerCase();
|
436
|
-
|
437
|
-
each('left center right'.split(' '), function(name) {
|
438
|
-
if (editor.formatter.matchNode(cellElm, 'align' + name)) {
|
439
|
-
data.align = name;
|
440
|
-
}
|
441
|
-
});
|
442
|
-
|
443
|
-
each('top middle bottom'.split(' '), function(name) {
|
444
|
-
if (editor.formatter.matchNode(cellElm, 'valign' + name)) {
|
445
|
-
data.valign = name;
|
446
|
-
}
|
447
|
-
});
|
448
|
-
|
449
|
-
if (editor.settings.table_cell_class_list) {
|
450
|
-
classListCtrl = {
|
451
|
-
name: 'class',
|
452
|
-
type: 'listbox',
|
453
|
-
label: 'Class',
|
454
|
-
values: buildListItems(
|
455
|
-
editor.settings.table_cell_class_list,
|
456
|
-
function(item) {
|
457
|
-
if (item.value) {
|
458
|
-
item.textStyle = function() {
|
459
|
-
return editor.formatter.getCssText({block: 'td', classes: [item.value]});
|
460
|
-
};
|
461
|
-
}
|
462
|
-
}
|
463
|
-
)
|
464
|
-
};
|
465
|
-
}
|
466
|
-
|
467
|
-
var generalCellForm = {
|
468
|
-
type: 'form',
|
469
|
-
layout: 'flex',
|
470
|
-
direction: 'column',
|
471
|
-
labelGapCalc: 'children',
|
472
|
-
padding: 0,
|
473
|
-
items: [
|
474
|
-
{
|
475
|
-
type: 'form',
|
476
|
-
layout: 'grid',
|
477
|
-
columns: 2,
|
478
|
-
labelGapCalc: false,
|
479
|
-
padding: 0,
|
480
|
-
defaults: {
|
481
|
-
type: 'textbox',
|
482
|
-
maxWidth: 50
|
483
|
-
},
|
484
|
-
items: [
|
485
|
-
{label: 'Width', name: 'width'},
|
486
|
-
{label: 'Height', name: 'height'},
|
487
|
-
{
|
488
|
-
label: 'Cell type',
|
489
|
-
name: 'type',
|
490
|
-
type: 'listbox',
|
491
|
-
text: 'None',
|
492
|
-
minWidth: 90,
|
493
|
-
maxWidth: null,
|
494
|
-
values: [
|
495
|
-
{text: 'Cell', value: 'td'},
|
496
|
-
{text: 'Header cell', value: 'th'}
|
497
|
-
]
|
498
|
-
},
|
499
|
-
{
|
500
|
-
label: 'Scope',
|
501
|
-
name: 'scope',
|
502
|
-
type: 'listbox',
|
503
|
-
text: 'None',
|
504
|
-
minWidth: 90,
|
505
|
-
maxWidth: null,
|
506
|
-
values: [
|
507
|
-
{text: 'None', value: ''},
|
508
|
-
{text: 'Row', value: 'row'},
|
509
|
-
{text: 'Column', value: 'col'},
|
510
|
-
{text: 'Row group', value: 'rowgroup'},
|
511
|
-
{text: 'Column group', value: 'colgroup'}
|
512
|
-
]
|
513
|
-
},
|
514
|
-
{
|
515
|
-
label: 'H Align',
|
516
|
-
name: 'align',
|
517
|
-
type: 'listbox',
|
518
|
-
text: 'None',
|
519
|
-
minWidth: 90,
|
520
|
-
maxWidth: null,
|
521
|
-
values: [
|
522
|
-
{text: 'None', value: ''},
|
523
|
-
{text: 'Left', value: 'left'},
|
524
|
-
{text: 'Center', value: 'center'},
|
525
|
-
{text: 'Right', value: 'right'}
|
526
|
-
]
|
527
|
-
},
|
528
|
-
{
|
529
|
-
label: 'V Align',
|
530
|
-
name: 'valign',
|
531
|
-
type: 'listbox',
|
532
|
-
text: 'None',
|
533
|
-
minWidth: 90,
|
534
|
-
maxWidth: null,
|
535
|
-
values: [
|
536
|
-
{text: 'None', value: ''},
|
537
|
-
{text: 'Top', value: 'top'},
|
538
|
-
{text: 'Middle', value: 'middle'},
|
539
|
-
{text: 'Bottom', value: 'bottom'}
|
540
|
-
]
|
541
|
-
}
|
542
|
-
]
|
543
|
-
},
|
544
|
-
|
545
|
-
classListCtrl
|
546
|
-
]
|
547
|
-
};
|
548
|
-
|
549
|
-
if (editor.settings.table_cell_advtab !== false) {
|
550
|
-
appendStylesToData(dom, data, cellElm);
|
551
|
-
|
552
|
-
editor.windowManager.open({
|
553
|
-
title: "Cell properties",
|
554
|
-
bodyType: 'tabpanel',
|
555
|
-
data: data,
|
556
|
-
body: [
|
557
|
-
{
|
558
|
-
title: 'General',
|
559
|
-
type: 'form',
|
560
|
-
items: generalCellForm
|
561
|
-
},
|
562
|
-
|
563
|
-
createStyleForm(dom)
|
564
|
-
],
|
565
|
-
|
566
|
-
onsubmit: onSubmitCellForm
|
567
|
-
});
|
568
|
-
} else {
|
569
|
-
editor.windowManager.open({
|
570
|
-
title: "Cell properties",
|
571
|
-
data: data,
|
572
|
-
body: generalCellForm,
|
573
|
-
onsubmit: onSubmitCellForm
|
574
|
-
});
|
575
|
-
}
|
576
|
-
};
|
577
|
-
|
578
|
-
self.row = function() {
|
579
|
-
var dom = editor.dom, tableElm, cellElm, rowElm, classListCtrl, data, rows = [], generalRowForm;
|
580
|
-
|
581
|
-
function onSubmitRowForm() {
|
582
|
-
var tableElm, oldParentElm, parentElm;
|
583
|
-
|
584
|
-
updateStyle(dom, this);
|
585
|
-
data = Tools.extend(data, this.toJSON());
|
586
|
-
|
587
|
-
editor.undoManager.transact(function() {
|
588
|
-
var toType = data.type;
|
589
|
-
|
590
|
-
each(rows, function(rowElm) {
|
591
|
-
editor.dom.setAttribs(rowElm, {
|
592
|
-
scope: data.scope,
|
593
|
-
style: data.style,
|
594
|
-
'class': data['class']
|
595
|
-
});
|
596
|
-
|
597
|
-
editor.dom.setStyles(rowElm, {
|
598
|
-
height: addSizeSuffix(data.height)
|
599
|
-
});
|
600
|
-
|
601
|
-
if (toType != rowElm.parentNode.nodeName.toLowerCase()) {
|
602
|
-
tableElm = dom.getParent(rowElm, 'table');
|
603
|
-
|
604
|
-
oldParentElm = rowElm.parentNode;
|
605
|
-
parentElm = dom.select(toType, tableElm)[0];
|
606
|
-
if (!parentElm) {
|
607
|
-
parentElm = dom.create(toType);
|
608
|
-
if (tableElm.firstChild) {
|
609
|
-
tableElm.insertBefore(parentElm, tableElm.firstChild);
|
610
|
-
} else {
|
611
|
-
tableElm.appendChild(parentElm);
|
612
|
-
}
|
613
|
-
}
|
614
|
-
|
615
|
-
parentElm.appendChild(rowElm);
|
616
|
-
|
617
|
-
if (!oldParentElm.hasChildNodes()) {
|
618
|
-
dom.remove(oldParentElm);
|
619
|
-
}
|
620
|
-
}
|
621
|
-
|
622
|
-
// Apply/remove alignment
|
623
|
-
unApplyAlign(rowElm);
|
624
|
-
if (data.align) {
|
625
|
-
editor.formatter.apply('align' + data.align, {}, rowElm);
|
626
|
-
}
|
627
|
-
});
|
628
|
-
|
629
|
-
editor.focus();
|
630
|
-
});
|
631
|
-
}
|
632
|
-
|
633
|
-
tableElm = editor.dom.getParent(editor.selection.getStart(), 'table');
|
634
|
-
cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
|
635
|
-
|
636
|
-
each(tableElm.rows, function(row) {
|
637
|
-
each(row.cells, function(cell) {
|
638
|
-
if (dom.hasClass(cell, 'mce-item-selected') || cell == cellElm) {
|
639
|
-
rows.push(row);
|
640
|
-
return false;
|
641
|
-
}
|
642
|
-
});
|
643
|
-
});
|
644
|
-
|
645
|
-
rowElm = rows[0];
|
646
|
-
if (!rowElm) {
|
647
|
-
// If this element is null, return now to avoid crashing.
|
648
|
-
return;
|
649
|
-
}
|
650
|
-
|
651
|
-
data = {
|
652
|
-
height: removePxSuffix(dom.getStyle(rowElm, 'height') || dom.getAttrib(rowElm, 'height')),
|
653
|
-
scope: dom.getAttrib(rowElm, 'scope'),
|
654
|
-
'class': dom.getAttrib(rowElm, 'class')
|
655
|
-
};
|
656
|
-
|
657
|
-
data.type = rowElm.parentNode.nodeName.toLowerCase();
|
658
|
-
|
659
|
-
each('left center right'.split(' '), function(name) {
|
660
|
-
if (editor.formatter.matchNode(rowElm, 'align' + name)) {
|
661
|
-
data.align = name;
|
662
|
-
}
|
663
|
-
});
|
664
|
-
|
665
|
-
if (editor.settings.table_row_class_list) {
|
666
|
-
classListCtrl = {
|
667
|
-
name: 'class',
|
668
|
-
type: 'listbox',
|
669
|
-
label: 'Class',
|
670
|
-
values: buildListItems(
|
671
|
-
editor.settings.table_row_class_list,
|
672
|
-
function(item) {
|
673
|
-
if (item.value) {
|
674
|
-
item.textStyle = function() {
|
675
|
-
return editor.formatter.getCssText({block: 'tr', classes: [item.value]});
|
676
|
-
};
|
677
|
-
}
|
678
|
-
}
|
679
|
-
)
|
680
|
-
};
|
681
|
-
}
|
682
|
-
|
683
|
-
generalRowForm = {
|
684
|
-
type: 'form',
|
685
|
-
columns: 2,
|
686
|
-
padding: 0,
|
687
|
-
defaults: {
|
688
|
-
type: 'textbox'
|
689
|
-
},
|
690
|
-
items: [
|
691
|
-
{
|
692
|
-
type: 'listbox',
|
693
|
-
name: 'type',
|
694
|
-
label: 'Row type',
|
695
|
-
text: 'None',
|
696
|
-
maxWidth: null,
|
697
|
-
values: [
|
698
|
-
{text: 'Header', value: 'thead'},
|
699
|
-
{text: 'Body', value: 'tbody'},
|
700
|
-
{text: 'Footer', value: 'tfoot'}
|
701
|
-
]
|
702
|
-
},
|
703
|
-
{
|
704
|
-
type: 'listbox',
|
705
|
-
name: 'align',
|
706
|
-
label: 'Alignment',
|
707
|
-
text: 'None',
|
708
|
-
maxWidth: null,
|
709
|
-
values: [
|
710
|
-
{text: 'None', value: ''},
|
711
|
-
{text: 'Left', value: 'left'},
|
712
|
-
{text: 'Center', value: 'center'},
|
713
|
-
{text: 'Right', value: 'right'}
|
714
|
-
]
|
715
|
-
},
|
716
|
-
{label: 'Height', name: 'height'},
|
717
|
-
classListCtrl
|
718
|
-
]
|
719
|
-
};
|
720
|
-
|
721
|
-
if (editor.settings.table_row_advtab !== false) {
|
722
|
-
appendStylesToData(dom, data, rowElm);
|
723
|
-
|
724
|
-
editor.windowManager.open({
|
725
|
-
title: "Row properties",
|
726
|
-
data: data,
|
727
|
-
bodyType: 'tabpanel',
|
728
|
-
body: [
|
729
|
-
{
|
730
|
-
title: 'General',
|
731
|
-
type: 'form',
|
732
|
-
items: generalRowForm
|
733
|
-
},
|
734
|
-
createStyleForm(dom)
|
735
|
-
],
|
736
|
-
|
737
|
-
onsubmit: onSubmitRowForm
|
738
|
-
});
|
739
|
-
} else {
|
740
|
-
editor.windowManager.open({
|
741
|
-
title: "Row properties",
|
742
|
-
data: data,
|
743
|
-
body: generalRowForm,
|
744
|
-
onsubmit: onSubmitRowForm
|
745
|
-
});
|
746
|
-
}
|
747
|
-
};
|
748
|
-
};
|
749
|
-
});
|