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,268 +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('textpattern', function(editor) {
|
14
|
-
var isPatternsDirty = true, patterns;
|
15
|
-
|
16
|
-
patterns = editor.settings.textpattern_patterns || [
|
17
|
-
{start: '*', end: '*', format: 'italic'},
|
18
|
-
{start: '**', end: '**', format: 'bold'},
|
19
|
-
{start: '#', format: 'h1'},
|
20
|
-
{start: '##', format: 'h2'},
|
21
|
-
{start: '###', format: 'h3'},
|
22
|
-
{start: '####', format: 'h4'},
|
23
|
-
{start: '#####', format: 'h5'},
|
24
|
-
{start: '######', format: 'h6'},
|
25
|
-
{start: '1. ', cmd: 'InsertOrderedList'},
|
26
|
-
{start: '* ', cmd: 'InsertUnorderedList'},
|
27
|
-
{start: '- ', cmd: 'InsertUnorderedList'}
|
28
|
-
];
|
29
|
-
|
30
|
-
// Returns a sorted patterns list, ordered descending by start length
|
31
|
-
function getPatterns() {
|
32
|
-
if (isPatternsDirty) {
|
33
|
-
patterns.sort(function(a, b) {
|
34
|
-
if (a.start.length > b.start.length) {
|
35
|
-
return -1;
|
36
|
-
}
|
37
|
-
|
38
|
-
if (a.start.length < b.start.length) {
|
39
|
-
return 1;
|
40
|
-
}
|
41
|
-
|
42
|
-
return 0;
|
43
|
-
});
|
44
|
-
|
45
|
-
isPatternsDirty = false;
|
46
|
-
}
|
47
|
-
|
48
|
-
return patterns;
|
49
|
-
}
|
50
|
-
|
51
|
-
// Finds a matching pattern to the specified text
|
52
|
-
function findPattern(text) {
|
53
|
-
var patterns = getPatterns();
|
54
|
-
|
55
|
-
for (var i = 0; i < patterns.length; i++) {
|
56
|
-
if (text.indexOf(patterns[i].start) !== 0) {
|
57
|
-
continue;
|
58
|
-
}
|
59
|
-
|
60
|
-
if (patterns[i].end && text.lastIndexOf(patterns[i].end) != text.length - patterns[i].end.length) {
|
61
|
-
continue;
|
62
|
-
}
|
63
|
-
|
64
|
-
return patterns[i];
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
// Finds the best matching end pattern
|
69
|
-
function findEndPattern(text, offset, delta) {
|
70
|
-
var patterns, pattern, i;
|
71
|
-
|
72
|
-
// Find best matching end
|
73
|
-
patterns = getPatterns();
|
74
|
-
for (i = 0; i < patterns.length; i++) {
|
75
|
-
pattern = patterns[i];
|
76
|
-
if (pattern.end && text.substr(offset - pattern.end.length - delta, pattern.end.length) == pattern.end) {
|
77
|
-
return pattern;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
// Handles inline formats like *abc* and **abc**
|
83
|
-
function applyInlineFormat(space) {
|
84
|
-
var selection, dom, rng, container, offset, startOffset, text, patternRng, pattern, delta, format;
|
85
|
-
|
86
|
-
function splitContainer() {
|
87
|
-
// Split text node and remove start/end from text node
|
88
|
-
container = container.splitText(startOffset);
|
89
|
-
container.splitText(offset - startOffset - delta);
|
90
|
-
container.deleteData(0, pattern.start.length);
|
91
|
-
container.deleteData(container.data.length - pattern.end.length, pattern.end.length);
|
92
|
-
}
|
93
|
-
|
94
|
-
selection = editor.selection;
|
95
|
-
dom = editor.dom;
|
96
|
-
|
97
|
-
if (!selection.isCollapsed()) {
|
98
|
-
return;
|
99
|
-
}
|
100
|
-
|
101
|
-
rng = selection.getRng(true);
|
102
|
-
container = rng.startContainer;
|
103
|
-
offset = rng.startOffset;
|
104
|
-
text = container.data;
|
105
|
-
delta = space ? 1 : 0;
|
106
|
-
|
107
|
-
if (container.nodeType != 3) {
|
108
|
-
return;
|
109
|
-
}
|
110
|
-
|
111
|
-
// Find best matching end
|
112
|
-
pattern = findEndPattern(text, offset, delta);
|
113
|
-
if (!pattern) {
|
114
|
-
return;
|
115
|
-
}
|
116
|
-
|
117
|
-
// Find start of matched pattern
|
118
|
-
// TODO: Might need to improve this if there is nested formats
|
119
|
-
startOffset = Math.max(0, offset - delta);
|
120
|
-
startOffset = text.lastIndexOf(pattern.start, startOffset - pattern.end.length - 1);
|
121
|
-
|
122
|
-
if (startOffset === -1) {
|
123
|
-
return;
|
124
|
-
}
|
125
|
-
|
126
|
-
// Setup a range for the matching word
|
127
|
-
patternRng = dom.createRng();
|
128
|
-
patternRng.setStart(container, startOffset);
|
129
|
-
patternRng.setEnd(container, offset - delta);
|
130
|
-
pattern = findPattern(patternRng.toString());
|
131
|
-
|
132
|
-
if (!pattern || !pattern.end) {
|
133
|
-
return;
|
134
|
-
}
|
135
|
-
|
136
|
-
// If container match doesn't have anything between start/end then do nothing
|
137
|
-
if (container.data.length <= pattern.start.length + pattern.end.length) {
|
138
|
-
return;
|
139
|
-
}
|
140
|
-
|
141
|
-
format = editor.formatter.get(pattern.format);
|
142
|
-
if (format && format[0].inline) {
|
143
|
-
splitContainer();
|
144
|
-
editor.formatter.apply(pattern.format, {}, container);
|
145
|
-
return container;
|
146
|
-
}
|
147
|
-
}
|
148
|
-
|
149
|
-
// Handles block formats like ##abc or 1. abc
|
150
|
-
function applyBlockFormat() {
|
151
|
-
var selection, dom, container, firstTextNode, node, format, textBlockElm, pattern, walker, rng, offset;
|
152
|
-
|
153
|
-
selection = editor.selection;
|
154
|
-
dom = editor.dom;
|
155
|
-
|
156
|
-
if (!selection.isCollapsed()) {
|
157
|
-
return;
|
158
|
-
}
|
159
|
-
|
160
|
-
textBlockElm = dom.getParent(selection.getStart(), 'p');
|
161
|
-
if (textBlockElm) {
|
162
|
-
walker = new tinymce.dom.TreeWalker(textBlockElm, textBlockElm);
|
163
|
-
while ((node = walker.next())) {
|
164
|
-
if (node.nodeType == 3) {
|
165
|
-
firstTextNode = node;
|
166
|
-
break;
|
167
|
-
}
|
168
|
-
}
|
169
|
-
|
170
|
-
if (firstTextNode) {
|
171
|
-
pattern = findPattern(firstTextNode.data);
|
172
|
-
if (!pattern) {
|
173
|
-
return;
|
174
|
-
}
|
175
|
-
|
176
|
-
rng = selection.getRng(true);
|
177
|
-
container = rng.startContainer;
|
178
|
-
offset = rng.startOffset;
|
179
|
-
|
180
|
-
if (firstTextNode == container) {
|
181
|
-
offset = Math.max(0, offset - pattern.start.length);
|
182
|
-
}
|
183
|
-
|
184
|
-
if (tinymce.trim(firstTextNode.data).length == pattern.start.length) {
|
185
|
-
return;
|
186
|
-
}
|
187
|
-
|
188
|
-
if (pattern.format) {
|
189
|
-
format = editor.formatter.get(pattern.format);
|
190
|
-
if (format && format[0].block) {
|
191
|
-
firstTextNode.deleteData(0, pattern.start.length);
|
192
|
-
editor.formatter.apply(pattern.format, {}, firstTextNode);
|
193
|
-
|
194
|
-
rng.setStart(container, offset);
|
195
|
-
rng.collapse(true);
|
196
|
-
selection.setRng(rng);
|
197
|
-
}
|
198
|
-
}
|
199
|
-
|
200
|
-
if (pattern.cmd) {
|
201
|
-
editor.undoManager.transact(function() {
|
202
|
-
firstTextNode.deleteData(0, pattern.start.length);
|
203
|
-
editor.execCommand(pattern.cmd);
|
204
|
-
});
|
205
|
-
}
|
206
|
-
}
|
207
|
-
}
|
208
|
-
}
|
209
|
-
|
210
|
-
function handleEnter() {
|
211
|
-
var rng, wrappedTextNode;
|
212
|
-
|
213
|
-
wrappedTextNode = applyInlineFormat();
|
214
|
-
if (wrappedTextNode) {
|
215
|
-
rng = editor.dom.createRng();
|
216
|
-
rng.setStart(wrappedTextNode, wrappedTextNode.data.length);
|
217
|
-
rng.setEnd(wrappedTextNode, wrappedTextNode.data.length);
|
218
|
-
editor.selection.setRng(rng);
|
219
|
-
}
|
220
|
-
|
221
|
-
applyBlockFormat();
|
222
|
-
}
|
223
|
-
|
224
|
-
function handleSpace() {
|
225
|
-
var wrappedTextNode, lastChar, lastCharNode, rng, dom;
|
226
|
-
|
227
|
-
wrappedTextNode = applyInlineFormat(true);
|
228
|
-
if (wrappedTextNode) {
|
229
|
-
dom = editor.dom;
|
230
|
-
lastChar = wrappedTextNode.data.slice(-1);
|
231
|
-
|
232
|
-
// Move space after the newly formatted node
|
233
|
-
if (/[\u00a0 ]/.test(lastChar)) {
|
234
|
-
wrappedTextNode.deleteData(wrappedTextNode.data.length - 1, 1);
|
235
|
-
lastCharNode = dom.doc.createTextNode(lastChar);
|
236
|
-
|
237
|
-
if (wrappedTextNode.nextSibling) {
|
238
|
-
dom.insertAfter(lastCharNode, wrappedTextNode.nextSibling);
|
239
|
-
} else {
|
240
|
-
wrappedTextNode.parentNode.appendChild(lastCharNode);
|
241
|
-
}
|
242
|
-
|
243
|
-
rng = dom.createRng();
|
244
|
-
rng.setStart(lastCharNode, 1);
|
245
|
-
rng.setEnd(lastCharNode, 1);
|
246
|
-
editor.selection.setRng(rng);
|
247
|
-
}
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
|
-
editor.on('keydown', function(e) {
|
252
|
-
if (e.keyCode == 13 && !tinymce.util.VK.modifierPressed(e)) {
|
253
|
-
handleEnter();
|
254
|
-
}
|
255
|
-
}, true);
|
256
|
-
|
257
|
-
editor.on('keyup', function(e) {
|
258
|
-
if (e.keyCode == 32 && !tinymce.util.VK.modifierPressed(e)) {
|
259
|
-
handleSpace();
|
260
|
-
}
|
261
|
-
});
|
262
|
-
|
263
|
-
this.getPatterns = getPatterns;
|
264
|
-
this.setPatterns = function(newPatterns) {
|
265
|
-
patterns = newPatterns;
|
266
|
-
isPatternsDirty = true;
|
267
|
-
};
|
268
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("textpattern",function(a){function b(){return j&&(i.sort(function(a,b){return a.start.length>b.start.length?-1:a.start.length<b.start.length?1:0}),j=!1),i}function c(a){for(var c=b(),d=0;d<c.length;d++)if(0===a.indexOf(c[d].start)&&(!c[d].end||a.lastIndexOf(c[d].end)==a.length-c[d].end.length))return c[d]}function d(a,c,d){var e,f,g;for(e=b(),g=0;g<e.length;g++)if(f=e[g],f.end&&a.substr(c-f.end.length-d,f.end.length)==f.end)return f}function e(b){function e(){i=i.splitText(k),i.splitText(j-k-o),i.deleteData(0,n.start.length),i.deleteData(i.data.length-n.end.length,n.end.length)}var f,g,h,i,j,k,l,m,n,o,p;return f=a.selection,g=a.dom,f.isCollapsed()&&(h=f.getRng(!0),i=h.startContainer,j=h.startOffset,l=i.data,o=b?1:0,3==i.nodeType&&(n=d(l,j,o),n&&(k=Math.max(0,j-o),k=l.lastIndexOf(n.start,k-n.end.length-1),-1!==k&&(m=g.createRng(),m.setStart(i,k),m.setEnd(i,j-o),n=c(m.toString()),n&&n.end&&!(i.data.length<=n.start.length+n.end.length)))))?(p=a.formatter.get(n.format),p&&p[0].inline?(e(),a.formatter.apply(n.format,{},i),i):void 0):void 0}function f(){var b,d,e,f,g,h,i,j,k,l,m;if(b=a.selection,d=a.dom,b.isCollapsed()&&(i=d.getParent(b.getStart(),"p"))){for(k=new tinymce.dom.TreeWalker(i,i);g=k.next();)if(3==g.nodeType){f=g;break}if(f){if(j=c(f.data),!j)return;if(l=b.getRng(!0),e=l.startContainer,m=l.startOffset,f==e&&(m=Math.max(0,m-j.start.length)),tinymce.trim(f.data).length==j.start.length)return;j.format&&(h=a.formatter.get(j.format),h&&h[0].block&&(f.deleteData(0,j.start.length),a.formatter.apply(j.format,{},f),l.setStart(e,m),l.collapse(!0),b.setRng(l))),j.cmd&&a.undoManager.transact(function(){f.deleteData(0,j.start.length),a.execCommand(j.cmd)})}}}function g(){var b,c;c=e(),c&&(b=a.dom.createRng(),b.setStart(c,c.data.length),b.setEnd(c,c.data.length),a.selection.setRng(b)),f()}function h(){var b,c,d,f,g;b=e(!0),b&&(g=a.dom,c=b.data.slice(-1),/[\u00a0 ]/.test(c)&&(b.deleteData(b.data.length-1,1),d=g.doc.createTextNode(c),b.nextSibling?g.insertAfter(d,b.nextSibling):b.parentNode.appendChild(d),f=g.createRng(),f.setStart(d,1),f.setEnd(d,1),a.selection.setRng(f)))}var i,j=!0;i=a.settings.textpattern_patterns||[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1"},{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:"1. ",cmd:"InsertOrderedList"},{start:"* ",cmd:"InsertUnorderedList"},{start:"- ",cmd:"InsertUnorderedList"}],a.on("keydown",function(a){13!=a.keyCode||tinymce.util.VK.modifierPressed(a)||g()},!0),a.on("keyup",function(a){32!=a.keyCode||tinymce.util.VK.modifierPressed(a)||h()}),this.getPatterns=b,this.setPatterns=function(a){i=a,j=!0}});
|
@@ -1,135 +0,0 @@
|
|
1
|
-
.mce-visualblocks p {
|
2
|
-
padding-top: 10px;
|
3
|
-
border: 1px dashed #BBB;
|
4
|
-
margin-left: 3px;
|
5
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhCQAJAJEAAAAAAP///7u7u////yH5BAEAAAMALAAAAAAJAAkAAAIQnG+CqCN/mlyvsRUpThG6AgA7);
|
6
|
-
}
|
7
|
-
|
8
|
-
.mce-visualblocks h1 {
|
9
|
-
padding-top: 10px;
|
10
|
-
border: 1px dashed #BBB;
|
11
|
-
margin-left: 3px;
|
12
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGu1JuxHoAfRNRW3TWXyF2YiRUAOw==);
|
13
|
-
}
|
14
|
-
|
15
|
-
.mce-visualblocks h2 {
|
16
|
-
padding-top: 10px;
|
17
|
-
border: 1px dashed #BBB;
|
18
|
-
margin-left: 3px;
|
19
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8Hybbx4oOuqgTynJd6bGlWg3DkJzoaUAAAOw==);
|
20
|
-
}
|
21
|
-
|
22
|
-
.mce-visualblocks h3 {
|
23
|
-
padding-top: 10px;
|
24
|
-
border: 1px dashed #BBB;
|
25
|
-
margin-left: 3px;
|
26
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIZjI8Hybbx4oOuqgTynJf2Ln2NOHpQpmhAAQA7);
|
27
|
-
}
|
28
|
-
|
29
|
-
.mce-visualblocks h4 {
|
30
|
-
padding-top: 10px;
|
31
|
-
border: 1px dashed #BBB;
|
32
|
-
margin-left: 3px;
|
33
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxInR0zqeAdhtJlXwV1oCll2HaWgAAOw==);
|
34
|
-
}
|
35
|
-
|
36
|
-
.mce-visualblocks h5 {
|
37
|
-
padding-top: 10px;
|
38
|
-
border: 1px dashed #BBB;
|
39
|
-
margin-left: 3px;
|
40
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjane4iq5GlW05GgIkIZUAAAOw==);
|
41
|
-
}
|
42
|
-
|
43
|
-
.mce-visualblocks h6 {
|
44
|
-
padding-top: 10px;
|
45
|
-
border: 1px dashed #BBB;
|
46
|
-
margin-left: 3px;
|
47
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjan04jep1iZ1XRlAo5bVgAAOw==);
|
48
|
-
}
|
49
|
-
|
50
|
-
.mce-visualblocks div {
|
51
|
-
padding-top: 10px;
|
52
|
-
border: 1px dashed #BBB;
|
53
|
-
margin-left: 3px;
|
54
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhEgAKAIABALu7u////yH5BAEAAAEALAAAAAASAAoAAAIfjI9poI0cgDywrhuxfbrzDEbQM2Ei5aRjmoySW4pAAQA7);
|
55
|
-
}
|
56
|
-
|
57
|
-
.mce-visualblocks section {
|
58
|
-
padding-top: 10px;
|
59
|
-
border: 1px dashed #BBB;
|
60
|
-
margin: 0 0 1em 3px;
|
61
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhKAAKAIABALu7u////yH5BAEAAAEALAAAAAAoAAoAAAI5jI+pywcNY3sBWHdNrplytD2ellDeSVbp+GmWqaDqDMepc8t17Y4vBsK5hDyJMcI6KkuYU+jpjLoKADs=);
|
62
|
-
}
|
63
|
-
|
64
|
-
.mce-visualblocks article {
|
65
|
-
padding-top: 10px;
|
66
|
-
border: 1px dashed #BBB;
|
67
|
-
margin: 0 0 1em 3px;
|
68
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhKgAKAIABALu7u////yH5BAEAAAEALAAAAAAqAAoAAAI6jI+pywkNY3wG0GBvrsd2tXGYSGnfiF7ikpXemTpOiJScasYoDJJrjsG9gkCJ0ag6KhmaIe3pjDYBBQA7);
|
69
|
-
}
|
70
|
-
|
71
|
-
.mce-visualblocks blockquote {
|
72
|
-
padding-top: 10px;
|
73
|
-
border: 1px dashed #BBB;
|
74
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhPgAKAIABALu7u////yH5BAEAAAEALAAAAAA+AAoAAAJPjI+py+0Knpz0xQDyuUhvfoGgIX5iSKZYgq5uNL5q69asZ8s5rrf0yZmpNkJZzFesBTu8TOlDVAabUyatguVhWduud3EyiUk45xhTTgMBBQA7);
|
75
|
-
}
|
76
|
-
|
77
|
-
.mce-visualblocks address {
|
78
|
-
padding-top: 10px;
|
79
|
-
border: 1px dashed #BBB;
|
80
|
-
margin: 0 0 1em 3px;
|
81
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhLQAKAIABALu7u////yH5BAEAAAEALAAAAAAtAAoAAAI/jI+pywwNozSP1gDyyZcjb3UaRpXkWaXmZW4OqKLhBmLs+K263DkJK7OJeifh7FicKD9A1/IpGdKkyFpNmCkAADs=);
|
82
|
-
}
|
83
|
-
|
84
|
-
.mce-visualblocks pre {
|
85
|
-
padding-top: 10px;
|
86
|
-
border: 1px dashed #BBB;
|
87
|
-
margin-left: 3px;
|
88
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhFQAKAIABALu7uwAAACH5BAEAAAEALAAAAAAVAAoAAAIjjI+ZoN0cgDwSmnpz1NCueYERhnibZVKLNnbOq8IvKpJtVQAAOw==);
|
89
|
-
}
|
90
|
-
|
91
|
-
.mce-visualblocks figure {
|
92
|
-
padding-top: 10px;
|
93
|
-
border: 1px dashed #BBB;
|
94
|
-
margin: 0 0 1em 3px;
|
95
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhJAAKAIAAALu7u////yH5BAEAAAEALAAAAAAkAAoAAAI0jI+py+2fwAHUSFvD3RlvG4HIp4nX5JFSpnZUJ6LlrM52OE7uSWosBHScgkSZj7dDKnWAAgA7);
|
96
|
-
}
|
97
|
-
|
98
|
-
.mce-visualblocks hgroup {
|
99
|
-
padding-top: 10px;
|
100
|
-
border: 1px dashed #BBB;
|
101
|
-
margin: 0 0 1em 3px;
|
102
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhJwAKAIABALu7uwAAACH5BAEAAAEALAAAAAAnAAoAAAI3jI+pywYNI3uB0gpsRtt5fFnfNZaVSYJil4Wo03Hv6Z62uOCgiXH1kZIIJ8NiIxRrAZNMZAtQAAA7);
|
103
|
-
}
|
104
|
-
|
105
|
-
.mce-visualblocks aside {
|
106
|
-
padding-top: 10px;
|
107
|
-
border: 1px dashed #BBB;
|
108
|
-
margin: 0 0 1em 3px;
|
109
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhHgAKAIABAKqqqv///yH5BAEAAAEALAAAAAAeAAoAAAItjI+pG8APjZOTzgtqy7I3f1yehmQcFY4WKZbqByutmW4aHUd6vfcVbgudgpYCADs=);
|
110
|
-
}
|
111
|
-
|
112
|
-
.mce-visualblocks figcaption {
|
113
|
-
border: 1px dashed #BBB;
|
114
|
-
}
|
115
|
-
|
116
|
-
.mce-visualblocks ul {
|
117
|
-
padding-top: 10px;
|
118
|
-
border: 1px dashed #BBB;
|
119
|
-
margin: 0 0 1em 3px;
|
120
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDQAKAIAAALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGuYnqUVSjvw26DzzXiqIDlVwAAOw==)
|
121
|
-
}
|
122
|
-
|
123
|
-
.mce-visualblocks ol {
|
124
|
-
padding-top: 10px;
|
125
|
-
border: 1px dashed #BBB;
|
126
|
-
margin: 0 0 1em 3px;
|
127
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybH6HHt0qourxC6CvzXieHyeWQAAOw==);
|
128
|
-
}
|
129
|
-
|
130
|
-
.mce-visualblocks dl {
|
131
|
-
padding-top: 10px;
|
132
|
-
border: 1px dashed #BBB;
|
133
|
-
margin: 0 0 1em 3px;
|
134
|
-
background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybEOnmOvUoWznTqeuEjNSCqeGRUAOw==);
|
135
|
-
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,86 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* plugin.js
|
3
|
-
*
|
4
|
-
* Copyright 2012, 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('visualblocks', function(editor, url) {
|
14
|
-
var cssId, visualBlocksMenuItem, enabled;
|
15
|
-
|
16
|
-
// We don't support older browsers like IE6/7 and they don't provide prototypes for DOM objects
|
17
|
-
if (!window.NodeList) {
|
18
|
-
return;
|
19
|
-
}
|
20
|
-
|
21
|
-
function toggleActiveState() {
|
22
|
-
var self = this;
|
23
|
-
|
24
|
-
self.active(enabled);
|
25
|
-
|
26
|
-
editor.on('VisualBlocks', function() {
|
27
|
-
self.active(editor.dom.hasClass(editor.getBody(), 'mce-visualblocks'));
|
28
|
-
});
|
29
|
-
}
|
30
|
-
|
31
|
-
editor.addCommand('mceVisualBlocks', function() {
|
32
|
-
var dom = editor.dom, linkElm;
|
33
|
-
|
34
|
-
if (!cssId) {
|
35
|
-
cssId = dom.uniqueId();
|
36
|
-
linkElm = dom.create('link', {
|
37
|
-
id: cssId,
|
38
|
-
rel: 'stylesheet',
|
39
|
-
href: url + '/css/visualblocks.css'
|
40
|
-
});
|
41
|
-
|
42
|
-
editor.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);
|
43
|
-
}
|
44
|
-
|
45
|
-
// Toggle on/off visual blocks while computing previews
|
46
|
-
editor.on("PreviewFormats AfterPreviewFormats", function(e) {
|
47
|
-
if (enabled) {
|
48
|
-
dom.toggleClass(editor.getBody(), 'mce-visualblocks', e.type == "afterpreviewformats");
|
49
|
-
}
|
50
|
-
});
|
51
|
-
|
52
|
-
dom.toggleClass(editor.getBody(), 'mce-visualblocks');
|
53
|
-
enabled = editor.dom.hasClass(editor.getBody(), 'mce-visualblocks');
|
54
|
-
|
55
|
-
if (visualBlocksMenuItem) {
|
56
|
-
visualBlocksMenuItem.active(dom.hasClass(editor.getBody(), 'mce-visualblocks'));
|
57
|
-
}
|
58
|
-
|
59
|
-
editor.fire('VisualBlocks');
|
60
|
-
});
|
61
|
-
|
62
|
-
editor.addButton('visualblocks', {
|
63
|
-
title: 'Show blocks',
|
64
|
-
cmd: 'mceVisualBlocks',
|
65
|
-
onPostRender: toggleActiveState
|
66
|
-
});
|
67
|
-
|
68
|
-
editor.addMenuItem('visualblocks', {
|
69
|
-
text: 'Show blocks',
|
70
|
-
cmd: 'mceVisualBlocks',
|
71
|
-
onPostRender: toggleActiveState,
|
72
|
-
selectable: true,
|
73
|
-
context: 'view',
|
74
|
-
prependToContext: true
|
75
|
-
});
|
76
|
-
|
77
|
-
editor.on('init', function() {
|
78
|
-
if (editor.settings.visualblocks_default_state) {
|
79
|
-
editor.execCommand('mceVisualBlocks', false, null, {skip_focus: true});
|
80
|
-
}
|
81
|
-
});
|
82
|
-
|
83
|
-
editor.on('remove', function() {
|
84
|
-
editor.dom.removeClass(editor.getBody(), 'mce-visualblocks');
|
85
|
-
});
|
86
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("visualblocks",function(a,b){function c(){var b=this;b.active(f),a.on("VisualBlocks",function(){b.active(a.dom.hasClass(a.getBody(),"mce-visualblocks"))})}var d,e,f;window.NodeList&&(a.addCommand("mceVisualBlocks",function(){var c,g=a.dom;d||(d=g.uniqueId(),c=g.create("link",{id:d,rel:"stylesheet",href:b+"/css/visualblocks.css"}),a.getDoc().getElementsByTagName("head")[0].appendChild(c)),a.on("PreviewFormats AfterPreviewFormats",function(b){f&&g.toggleClass(a.getBody(),"mce-visualblocks","afterpreviewformats"==b.type)}),g.toggleClass(a.getBody(),"mce-visualblocks"),f=a.dom.hasClass(a.getBody(),"mce-visualblocks"),e&&e.active(g.hasClass(a.getBody(),"mce-visualblocks")),a.fire("VisualBlocks")}),a.addButton("visualblocks",{title:"Show blocks",cmd:"mceVisualBlocks",onPostRender:c}),a.addMenuItem("visualblocks",{text:"Show blocks",cmd:"mceVisualBlocks",onPostRender:c,selectable:!0,context:"view",prependToContext:!0}),a.on("init",function(){a.settings.visualblocks_default_state&&a.execCommand("mceVisualBlocks",!1,null,{skip_focus:!0})}),a.on("remove",function(){a.dom.removeClass(a.getBody(),"mce-visualblocks")}))});
|
@@ -1,88 +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('visualchars', function(editor) {
|
14
|
-
var self = this, state;
|
15
|
-
|
16
|
-
function toggleVisualChars(addBookmark) {
|
17
|
-
var node, nodeList, i, body = editor.getBody(), nodeValue, selection = editor.selection, div, bookmark;
|
18
|
-
|
19
|
-
state = !state;
|
20
|
-
self.state = state;
|
21
|
-
editor.fire('VisualChars', {state: state});
|
22
|
-
|
23
|
-
if (addBookmark) {
|
24
|
-
bookmark = selection.getBookmark();
|
25
|
-
}
|
26
|
-
|
27
|
-
if (state) {
|
28
|
-
nodeList = [];
|
29
|
-
tinymce.walk(body, function(n) {
|
30
|
-
if (n.nodeType == 3 && n.nodeValue && n.nodeValue.indexOf('\u00a0') != -1) {
|
31
|
-
nodeList.push(n);
|
32
|
-
}
|
33
|
-
}, 'childNodes');
|
34
|
-
|
35
|
-
for (i = 0; i < nodeList.length; i++) {
|
36
|
-
nodeValue = nodeList[i].nodeValue;
|
37
|
-
nodeValue = nodeValue.replace(/(\u00a0)/g, '<span data-mce-bogus="1" class="mce-nbsp">$1</span>');
|
38
|
-
|
39
|
-
div = editor.dom.create('div', null, nodeValue);
|
40
|
-
while ((node = div.lastChild)) {
|
41
|
-
editor.dom.insertAfter(node, nodeList[i]);
|
42
|
-
}
|
43
|
-
|
44
|
-
editor.dom.remove(nodeList[i]);
|
45
|
-
}
|
46
|
-
} else {
|
47
|
-
nodeList = editor.dom.select('span.mce-nbsp', body);
|
48
|
-
|
49
|
-
for (i = nodeList.length - 1; i >= 0; i--) {
|
50
|
-
editor.dom.remove(nodeList[i], 1);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
selection.moveToBookmark(bookmark);
|
55
|
-
}
|
56
|
-
|
57
|
-
function toggleActiveState() {
|
58
|
-
var self = this;
|
59
|
-
|
60
|
-
editor.on('VisualChars', function(e) {
|
61
|
-
self.active(e.state);
|
62
|
-
});
|
63
|
-
}
|
64
|
-
|
65
|
-
editor.addCommand('mceVisualChars', toggleVisualChars);
|
66
|
-
|
67
|
-
editor.addButton('visualchars', {
|
68
|
-
title: 'Show invisible characters',
|
69
|
-
cmd: 'mceVisualChars',
|
70
|
-
onPostRender: toggleActiveState
|
71
|
-
});
|
72
|
-
|
73
|
-
editor.addMenuItem('visualchars', {
|
74
|
-
text: 'Show invisible characters',
|
75
|
-
cmd: 'mceVisualChars',
|
76
|
-
onPostRender: toggleActiveState,
|
77
|
-
selectable: true,
|
78
|
-
context: 'view',
|
79
|
-
prependToContext: true
|
80
|
-
});
|
81
|
-
|
82
|
-
editor.on('beforegetcontent', function(e) {
|
83
|
-
if (state && e.format != 'raw' && !e.draft) {
|
84
|
-
state = true;
|
85
|
-
toggleVisualChars(false);
|
86
|
-
}
|
87
|
-
});
|
88
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("visualchars",function(a){function b(b){var c,f,g,h,i,j,k=a.getBody(),l=a.selection;if(d=!d,e.state=d,a.fire("VisualChars",{state:d}),b&&(j=l.getBookmark()),d)for(f=[],tinymce.walk(k,function(a){3==a.nodeType&&a.nodeValue&&-1!=a.nodeValue.indexOf("\xa0")&&f.push(a)},"childNodes"),g=0;g<f.length;g++){for(h=f[g].nodeValue,h=h.replace(/(\u00a0)/g,'<span data-mce-bogus="1" class="mce-nbsp">$1</span>'),i=a.dom.create("div",null,h);c=i.lastChild;)a.dom.insertAfter(c,f[g]);a.dom.remove(f[g])}else for(f=a.dom.select("span.mce-nbsp",k),g=f.length-1;g>=0;g--)a.dom.remove(f[g],1);l.moveToBookmark(j)}function c(){var b=this;a.on("VisualChars",function(a){b.active(a.state)})}var d,e=this;a.addCommand("mceVisualChars",b),a.addButton("visualchars",{title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:c}),a.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:c,selectable:!0,context:"view",prependToContext:!0}),a.on("beforegetcontent",function(a){d&&"raw"!=a.format&&!a.draft&&(d=!0,b(!1))})});
|