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,400 +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('link', function(editor) {
|
14
|
-
function createLinkList(callback) {
|
15
|
-
return function() {
|
16
|
-
var linkList = editor.settings.link_list;
|
17
|
-
|
18
|
-
if (typeof(linkList) == "string") {
|
19
|
-
tinymce.util.XHR.send({
|
20
|
-
url: linkList,
|
21
|
-
success: function(text) {
|
22
|
-
callback(tinymce.util.JSON.parse(text));
|
23
|
-
}
|
24
|
-
});
|
25
|
-
} else if (typeof(linkList) == "function") {
|
26
|
-
linkList(callback);
|
27
|
-
} else {
|
28
|
-
callback(linkList);
|
29
|
-
}
|
30
|
-
};
|
31
|
-
}
|
32
|
-
|
33
|
-
function buildListItems(inputList, itemCallback, startItems) {
|
34
|
-
function appendItems(values, output) {
|
35
|
-
output = output || [];
|
36
|
-
|
37
|
-
tinymce.each(values, function(item) {
|
38
|
-
var menuItem = {text: item.text || item.title};
|
39
|
-
|
40
|
-
if (item.menu) {
|
41
|
-
menuItem.menu = appendItems(item.menu);
|
42
|
-
} else {
|
43
|
-
menuItem.value = item.value;
|
44
|
-
|
45
|
-
if (itemCallback) {
|
46
|
-
itemCallback(menuItem);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
output.push(menuItem);
|
51
|
-
});
|
52
|
-
|
53
|
-
return output;
|
54
|
-
}
|
55
|
-
|
56
|
-
return appendItems(inputList, startItems || []);
|
57
|
-
}
|
58
|
-
|
59
|
-
function showDialog(linkList) {
|
60
|
-
var data = {}, selection = editor.selection, dom = editor.dom, selectedElm, anchorElm, initialText;
|
61
|
-
var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
|
62
|
-
|
63
|
-
function linkListChangeHandler(e) {
|
64
|
-
var textCtrl = win.find('#text');
|
65
|
-
|
66
|
-
if (!textCtrl.value() || (e.lastControl && textCtrl.value() == e.lastControl.text())) {
|
67
|
-
textCtrl.value(e.control.text());
|
68
|
-
}
|
69
|
-
|
70
|
-
win.find('#href').value(e.control.value());
|
71
|
-
}
|
72
|
-
|
73
|
-
function buildAnchorListControl(url) {
|
74
|
-
var anchorList = [];
|
75
|
-
|
76
|
-
tinymce.each(editor.dom.select('a:not([href])'), function(anchor) {
|
77
|
-
var id = anchor.name || anchor.id;
|
78
|
-
|
79
|
-
if (id) {
|
80
|
-
anchorList.push({
|
81
|
-
text: id,
|
82
|
-
value: '#' + id,
|
83
|
-
selected: url.indexOf('#' + id) != -1
|
84
|
-
});
|
85
|
-
}
|
86
|
-
});
|
87
|
-
|
88
|
-
if (anchorList.length) {
|
89
|
-
anchorList.unshift({text: 'None', value: ''});
|
90
|
-
|
91
|
-
return {
|
92
|
-
name: 'anchor',
|
93
|
-
type: 'listbox',
|
94
|
-
label: 'Anchors',
|
95
|
-
values: anchorList,
|
96
|
-
onselect: linkListChangeHandler
|
97
|
-
};
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
function updateText() {
|
102
|
-
if (!initialText && data.text.length === 0 && onlyText) {
|
103
|
-
this.parent().parent().find('#text')[0].value(this.value());
|
104
|
-
}
|
105
|
-
}
|
106
|
-
|
107
|
-
function urlChange(e) {
|
108
|
-
var meta = e.meta || {};
|
109
|
-
|
110
|
-
if (linkListCtrl) {
|
111
|
-
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
|
112
|
-
}
|
113
|
-
|
114
|
-
tinymce.each(e.meta, function(value, key) {
|
115
|
-
win.find('#' + key).value(value);
|
116
|
-
});
|
117
|
-
|
118
|
-
if (!meta.text) {
|
119
|
-
updateText.call(this);
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
function isOnlyTextSelected(anchorElm) {
|
124
|
-
var html = selection.getContent();
|
125
|
-
|
126
|
-
// Partial html and not a fully selected anchor element
|
127
|
-
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') == -1)) {
|
128
|
-
return false;
|
129
|
-
}
|
130
|
-
|
131
|
-
if (anchorElm) {
|
132
|
-
var nodes = anchorElm.childNodes, i;
|
133
|
-
|
134
|
-
if (nodes.length === 0) {
|
135
|
-
return false;
|
136
|
-
}
|
137
|
-
|
138
|
-
for (i = nodes.length - 1; i >= 0; i--) {
|
139
|
-
if (nodes[i].nodeType != 3) {
|
140
|
-
return false;
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
return true;
|
146
|
-
}
|
147
|
-
|
148
|
-
selectedElm = selection.getNode();
|
149
|
-
anchorElm = dom.getParent(selectedElm, 'a[href]');
|
150
|
-
onlyText = isOnlyTextSelected();
|
151
|
-
|
152
|
-
data.text = initialText = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({format: 'text'});
|
153
|
-
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
|
154
|
-
|
155
|
-
if ((value = dom.getAttrib(anchorElm, 'target'))) {
|
156
|
-
data.target = value;
|
157
|
-
} else if (editor.settings.default_link_target) {
|
158
|
-
data.target = editor.settings.default_link_target;
|
159
|
-
}
|
160
|
-
|
161
|
-
if ((value = dom.getAttrib(anchorElm, 'rel'))) {
|
162
|
-
data.rel = value;
|
163
|
-
}
|
164
|
-
|
165
|
-
if ((value = dom.getAttrib(anchorElm, 'class'))) {
|
166
|
-
data['class'] = value;
|
167
|
-
}
|
168
|
-
|
169
|
-
if ((value = dom.getAttrib(anchorElm, 'title'))) {
|
170
|
-
data.title = value;
|
171
|
-
}
|
172
|
-
|
173
|
-
if (onlyText) {
|
174
|
-
textListCtrl = {
|
175
|
-
name: 'text',
|
176
|
-
type: 'textbox',
|
177
|
-
size: 40,
|
178
|
-
label: 'Text to display',
|
179
|
-
onchange: function() {
|
180
|
-
data.text = this.value();
|
181
|
-
}
|
182
|
-
};
|
183
|
-
}
|
184
|
-
|
185
|
-
if (linkList) {
|
186
|
-
linkListCtrl = {
|
187
|
-
type: 'listbox',
|
188
|
-
label: 'Link list',
|
189
|
-
values: buildListItems(
|
190
|
-
linkList,
|
191
|
-
function(item) {
|
192
|
-
item.value = editor.convertURL(item.value || item.url, 'href');
|
193
|
-
},
|
194
|
-
[{text: 'None', value: ''}]
|
195
|
-
),
|
196
|
-
onselect: linkListChangeHandler,
|
197
|
-
value: editor.convertURL(data.href, 'href'),
|
198
|
-
onPostRender: function() {
|
199
|
-
linkListCtrl = this;
|
200
|
-
}
|
201
|
-
};
|
202
|
-
}
|
203
|
-
|
204
|
-
if (editor.settings.target_list !== false) {
|
205
|
-
if (!editor.settings.target_list) {
|
206
|
-
editor.settings.target_list = [
|
207
|
-
{text: 'None', value: ''},
|
208
|
-
{text: 'New window', value: '_blank'}
|
209
|
-
];
|
210
|
-
}
|
211
|
-
|
212
|
-
targetListCtrl = {
|
213
|
-
name: 'target',
|
214
|
-
type: 'listbox',
|
215
|
-
label: 'Target',
|
216
|
-
values: buildListItems(editor.settings.target_list)
|
217
|
-
};
|
218
|
-
}
|
219
|
-
|
220
|
-
if (editor.settings.rel_list) {
|
221
|
-
relListCtrl = {
|
222
|
-
name: 'rel',
|
223
|
-
type: 'listbox',
|
224
|
-
label: 'Rel',
|
225
|
-
values: buildListItems(editor.settings.rel_list)
|
226
|
-
};
|
227
|
-
}
|
228
|
-
|
229
|
-
if (editor.settings.link_class_list) {
|
230
|
-
classListCtrl = {
|
231
|
-
name: 'class',
|
232
|
-
type: 'listbox',
|
233
|
-
label: 'Class',
|
234
|
-
values: buildListItems(
|
235
|
-
editor.settings.link_class_list,
|
236
|
-
function(item) {
|
237
|
-
if (item.value) {
|
238
|
-
item.textStyle = function() {
|
239
|
-
return editor.formatter.getCssText({inline: 'a', classes: [item.value]});
|
240
|
-
};
|
241
|
-
}
|
242
|
-
}
|
243
|
-
)
|
244
|
-
};
|
245
|
-
}
|
246
|
-
|
247
|
-
if (editor.settings.link_title !== false) {
|
248
|
-
linkTitleCtrl = {
|
249
|
-
name: 'title',
|
250
|
-
type: 'textbox',
|
251
|
-
label: 'Title',
|
252
|
-
value: data.title
|
253
|
-
};
|
254
|
-
}
|
255
|
-
|
256
|
-
win = editor.windowManager.open({
|
257
|
-
title: 'Insert link',
|
258
|
-
data: data,
|
259
|
-
body: [
|
260
|
-
{
|
261
|
-
name: 'href',
|
262
|
-
type: 'filepicker',
|
263
|
-
filetype: 'file',
|
264
|
-
size: 40,
|
265
|
-
autofocus: true,
|
266
|
-
label: 'Url',
|
267
|
-
onchange: urlChange,
|
268
|
-
onkeyup: updateText
|
269
|
-
},
|
270
|
-
textListCtrl,
|
271
|
-
linkTitleCtrl,
|
272
|
-
buildAnchorListControl(data.href),
|
273
|
-
linkListCtrl,
|
274
|
-
relListCtrl,
|
275
|
-
targetListCtrl,
|
276
|
-
classListCtrl
|
277
|
-
],
|
278
|
-
onSubmit: function(e) {
|
279
|
-
var href;
|
280
|
-
|
281
|
-
data = tinymce.extend(data, e.data);
|
282
|
-
href = data.href;
|
283
|
-
|
284
|
-
// Delay confirm since onSubmit will move focus
|
285
|
-
function delayedConfirm(message, callback) {
|
286
|
-
var rng = editor.selection.getRng();
|
287
|
-
|
288
|
-
window.setTimeout(function() {
|
289
|
-
editor.windowManager.confirm(message, function(state) {
|
290
|
-
editor.selection.setRng(rng);
|
291
|
-
callback(state);
|
292
|
-
});
|
293
|
-
}, 0);
|
294
|
-
}
|
295
|
-
|
296
|
-
function insertLink() {
|
297
|
-
var linkAttrs = {
|
298
|
-
href: href,
|
299
|
-
target: data.target ? data.target : null,
|
300
|
-
rel: data.rel ? data.rel : null,
|
301
|
-
"class": data["class"] ? data["class"] : null,
|
302
|
-
title: data.title ? data.title : null
|
303
|
-
};
|
304
|
-
|
305
|
-
if (anchorElm) {
|
306
|
-
editor.focus();
|
307
|
-
|
308
|
-
if (onlyText && data.text != initialText) {
|
309
|
-
if ("innerText" in anchorElm) {
|
310
|
-
anchorElm.innerText = data.text;
|
311
|
-
} else {
|
312
|
-
anchorElm.textContent = data.text;
|
313
|
-
}
|
314
|
-
}
|
315
|
-
|
316
|
-
dom.setAttribs(anchorElm, linkAttrs);
|
317
|
-
|
318
|
-
selection.select(anchorElm);
|
319
|
-
editor.undoManager.add();
|
320
|
-
} else {
|
321
|
-
if (onlyText) {
|
322
|
-
editor.insertContent(dom.createHTML('a', linkAttrs, dom.encode(data.text)));
|
323
|
-
} else {
|
324
|
-
editor.execCommand('mceInsertLink', false, linkAttrs);
|
325
|
-
}
|
326
|
-
}
|
327
|
-
}
|
328
|
-
|
329
|
-
if (!href) {
|
330
|
-
editor.execCommand('unlink');
|
331
|
-
return;
|
332
|
-
}
|
333
|
-
|
334
|
-
// Is email and not //user@domain.com
|
335
|
-
if (href.indexOf('@') > 0 && href.indexOf('//') == -1 && href.indexOf('mailto:') == -1) {
|
336
|
-
delayedConfirm(
|
337
|
-
'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',
|
338
|
-
function(state) {
|
339
|
-
if (state) {
|
340
|
-
href = 'mailto:' + href;
|
341
|
-
}
|
342
|
-
|
343
|
-
insertLink();
|
344
|
-
}
|
345
|
-
);
|
346
|
-
|
347
|
-
return;
|
348
|
-
}
|
349
|
-
|
350
|
-
// Is www. prefixed
|
351
|
-
if (/^\s*www\./i.test(href)) {
|
352
|
-
delayedConfirm(
|
353
|
-
'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
|
354
|
-
function(state) {
|
355
|
-
if (state) {
|
356
|
-
href = 'http://' + href;
|
357
|
-
}
|
358
|
-
|
359
|
-
insertLink();
|
360
|
-
}
|
361
|
-
);
|
362
|
-
|
363
|
-
return;
|
364
|
-
}
|
365
|
-
|
366
|
-
insertLink();
|
367
|
-
}
|
368
|
-
});
|
369
|
-
}
|
370
|
-
|
371
|
-
editor.addButton('link', {
|
372
|
-
icon: 'link',
|
373
|
-
tooltip: 'Insert/edit link',
|
374
|
-
shortcut: 'Ctrl+K',
|
375
|
-
onclick: createLinkList(showDialog),
|
376
|
-
stateSelector: 'a[href]'
|
377
|
-
});
|
378
|
-
|
379
|
-
editor.addButton('unlink', {
|
380
|
-
icon: 'unlink',
|
381
|
-
tooltip: 'Remove link',
|
382
|
-
cmd: 'unlink',
|
383
|
-
stateSelector: 'a[href]'
|
384
|
-
});
|
385
|
-
|
386
|
-
editor.addShortcut('Ctrl+K', '', createLinkList(showDialog));
|
387
|
-
editor.addCommand('mceLink', createLinkList(showDialog));
|
388
|
-
|
389
|
-
this.showDialog = showDialog;
|
390
|
-
|
391
|
-
editor.addMenuItem('link', {
|
392
|
-
icon: 'link',
|
393
|
-
text: 'Insert link',
|
394
|
-
shortcut: 'Ctrl+K',
|
395
|
-
onclick: createLinkList(showDialog),
|
396
|
-
stateSelector: 'a[href]',
|
397
|
-
context: 'insert',
|
398
|
-
prependToContext: true
|
399
|
-
});
|
400
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("link",function(a){function b(b){return function(){var c=a.settings.link_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 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&&b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){function d(a){var b=l.find("#text");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),l.find("#href").value(a.control.value())}function e(b){var c=[];return tinymce.each(a.dom.select("a:not([href])"),function(a){var d=a.name||a.id;d&&c.push({text:d,value:"#"+d,selected:-1!=b.indexOf("#"+d)})}),c.length?(c.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:c,onselect:d}):void 0}function f(){!k&&0===u.text.length&&m&&this.parent().parent().find("#text")[0].value(this.value())}function g(b){var c=b.meta||{};o&&o.value(a.convertURL(this.value(),"href")),tinymce.each(b.meta,function(a,b){l.find("#"+b).value(a)}),c.text||f.call(this)}function h(a){var b=v.getContent();if(/</.test(b)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(b)||-1==b.indexOf("href=")))return!1;if(a){var c,d=a.childNodes;if(0===d.length)return!1;for(c=d.length-1;c>=0;c--)if(3!=d[c].nodeType)return!1}return!0}var i,j,k,l,m,n,o,p,q,r,s,t,u={},v=a.selection,w=a.dom;i=v.getNode(),j=w.getParent(i,"a[href]"),m=h(),u.text=k=j?j.innerText||j.textContent:v.getContent({format:"text"}),u.href=j?w.getAttrib(j,"href"):"",(t=w.getAttrib(j,"target"))?u.target=t:a.settings.default_link_target&&(u.target=a.settings.default_link_target),(t=w.getAttrib(j,"rel"))&&(u.rel=t),(t=w.getAttrib(j,"class"))&&(u["class"]=t),(t=w.getAttrib(j,"title"))&&(u.title=t),m&&(n={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){u.text=this.value()}}),b&&(o={type:"listbox",label:"Link list",values:c(b,function(b){b.value=a.convertURL(b.value||b.url,"href")},[{text:"None",value:""}]),onselect:d,value:a.convertURL(u.href,"href"),onPostRender:function(){o=this}}),a.settings.target_list!==!1&&(a.settings.target_list||(a.settings.target_list=[{text:"None",value:""},{text:"New window",value:"_blank"}]),q={name:"target",type:"listbox",label:"Target",values:c(a.settings.target_list)}),a.settings.rel_list&&(p={name:"rel",type:"listbox",label:"Rel",values:c(a.settings.rel_list)}),a.settings.link_class_list&&(r={name:"class",type:"listbox",label:"Class",values:c(a.settings.link_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"a",classes:[b.value]})})})}),a.settings.link_title!==!1&&(s={name:"title",type:"textbox",label:"Title",value:u.title}),l=a.windowManager.open({title:"Insert link",data:u,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:g,onkeyup:f},n,s,e(u.href),o,p,q,r],onSubmit:function(b){function c(b,c){var d=a.selection.getRng();window.setTimeout(function(){a.windowManager.confirm(b,function(b){a.selection.setRng(d),c(b)})},0)}function d(){var b={href:e,target:u.target?u.target:null,rel:u.rel?u.rel:null,"class":u["class"]?u["class"]:null,title:u.title?u.title:null};j?(a.focus(),m&&u.text!=k&&("innerText"in j?j.innerText=u.text:j.textContent=u.text),w.setAttribs(j,b),v.select(j),a.undoManager.add()):m?a.insertContent(w.createHTML("a",b,w.encode(u.text))):a.execCommand("mceInsertLink",!1,b)}var e;return u=tinymce.extend(u,b.data),(e=u.href)?e.indexOf("@")>0&&-1==e.indexOf("//")&&-1==e.indexOf("mailto:")?void c("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(a){a&&(e="mailto:"+e),d()}):/^\s*www\./i.test(e)?void c("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(a){a&&(e="http://"+e),d()}):void d():void a.execCommand("unlink")}})}a.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Ctrl+K",onclick:b(d),stateSelector:"a[href]"}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"}),a.addShortcut("Ctrl+K","",b(d)),a.addCommand("mceLink",b(d)),this.showDialog=d,a.addMenuItem("link",{icon:"link",text:"Insert link",shortcut:"Ctrl+K",onclick:b(d),stateSelector:"a[href]",context:"insert",prependToContext:!0})});
|