tinymce-rails 3.4.3.2 → 3.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/assets/vendor/tinymce/plugins/autosave/editor_plugin.js +1 -1
- data/assets/vendor/tinymce/plugins/inlinepopups/editor_plugin.js +4 -1
- data/assets/vendor/tinymce/plugins/lists/editor_plugin.js +180 -99
- data/assets/vendor/tinymce/plugins/media/editor_plugin.js +60 -15
- data/assets/vendor/tinymce/plugins/media/js/media.js +49 -15
- data/assets/vendor/tinymce/plugins/media/langs/en_dlg.js +4 -1
- data/assets/vendor/tinymce/plugins/media/media.htm +91 -6
- data/assets/vendor/tinymce/plugins/style/props.htm +3 -1
- data/assets/vendor/tinymce/plugins/tabfocus/editor_plugin.js +122 -114
- data/assets/vendor/tinymce/plugins/table/editor_plugin.js +1361 -1261
- data/assets/vendor/tinymce/plugins/wordcount/editor_plugin.js +2 -2
- data/assets/vendor/tinymce/themes/advanced/editor_template.js +1 -1
- data/assets/vendor/tinymce/themes/advanced/skins/default/content.css +1 -0
- data/assets/vendor/tinymce/themes/advanced/skins/o2k7/content.css +1 -0
- data/assets/vendor/tinymce/tiny_mce.js +242 -61
- data/lib/tinymce/version.rb +1 -1
- metadata +8 -8
@@ -219,7 +219,10 @@
|
|
219
219
|
t.focus(id);
|
220
220
|
|
221
221
|
if (n.nodeName == 'A' || n.nodeName == 'a') {
|
222
|
-
if (n.className == '
|
222
|
+
if (n.className == 'mceClose') {
|
223
|
+
t.close(null, id);
|
224
|
+
return Event.cancel(e);
|
225
|
+
} else if (n.className == 'mceMax') {
|
223
226
|
w.oldPos = w.element.getXY();
|
224
227
|
w.oldSize = w.element.getSize();
|
225
228
|
|
@@ -18,25 +18,29 @@
|
|
18
18
|
}
|
19
19
|
return e;
|
20
20
|
}
|
21
|
-
|
21
|
+
|
22
22
|
function skipWhitespaceNodesBackwards(e) {
|
23
|
-
return skipWhitespaceNodes(e, function(e) {
|
23
|
+
return skipWhitespaceNodes(e, function(e) {
|
24
|
+
return e.previousSibling;
|
25
|
+
});
|
24
26
|
}
|
25
|
-
|
27
|
+
|
26
28
|
function skipWhitespaceNodesForwards(e) {
|
27
|
-
return skipWhitespaceNodes(e, function(e) {
|
29
|
+
return skipWhitespaceNodes(e, function(e) {
|
30
|
+
return e.nextSibling;
|
31
|
+
});
|
28
32
|
}
|
29
|
-
|
33
|
+
|
30
34
|
function hasParentInList(ed, e, list) {
|
31
35
|
return ed.dom.getParent(e, function(p) {
|
32
36
|
return tinymce.inArray(list, p) !== -1;
|
33
37
|
});
|
34
38
|
}
|
35
|
-
|
39
|
+
|
36
40
|
function isList(e) {
|
37
41
|
return e && (e.tagName === 'OL' || e.tagName === 'UL');
|
38
42
|
}
|
39
|
-
|
43
|
+
|
40
44
|
function splitNestedLists(element, dom) {
|
41
45
|
var tmp, nested, wrapItem;
|
42
46
|
tmp = skipWhitespaceNodesBackwards(element.lastChild);
|
@@ -54,12 +58,12 @@
|
|
54
58
|
}
|
55
59
|
return element;
|
56
60
|
}
|
57
|
-
|
61
|
+
|
58
62
|
function attemptMergeWithAdjacent(e, allowDifferentListStyles, mergeParagraphs) {
|
59
63
|
e = attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs);
|
60
64
|
return attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs);
|
61
65
|
}
|
62
|
-
|
66
|
+
|
63
67
|
function attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs) {
|
64
68
|
var prev = skipWhitespaceNodesBackwards(e.previousSibling);
|
65
69
|
if (prev) {
|
@@ -68,7 +72,7 @@
|
|
68
72
|
return e;
|
69
73
|
}
|
70
74
|
}
|
71
|
-
|
75
|
+
|
72
76
|
function attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs) {
|
73
77
|
var next = skipWhitespaceNodesForwards(e.nextSibling);
|
74
78
|
if (next) {
|
@@ -77,7 +81,7 @@
|
|
77
81
|
return e;
|
78
82
|
}
|
79
83
|
}
|
80
|
-
|
84
|
+
|
81
85
|
function attemptMerge(e1, e2, differentStylesMasterElement, mergeParagraphs) {
|
82
86
|
if (canMerge(e1, e2, !!differentStylesMasterElement, mergeParagraphs)) {
|
83
87
|
return merge(e1, e2, differentStylesMasterElement);
|
@@ -87,7 +91,7 @@
|
|
87
91
|
}
|
88
92
|
return e2;
|
89
93
|
}
|
90
|
-
|
94
|
+
|
91
95
|
function canMerge(e1, e2, allowDifferentListStyles, mergeParagraphs) {
|
92
96
|
if (!e1 || !e2) {
|
93
97
|
return false;
|
@@ -101,17 +105,17 @@
|
|
101
105
|
return false;
|
102
106
|
}
|
103
107
|
}
|
104
|
-
|
108
|
+
|
105
109
|
function isListForIndent(e) {
|
106
110
|
var firstLI = skipWhitespaceNodesForwards(e.firstChild), lastLI = skipWhitespaceNodesBackwards(e.lastChild);
|
107
|
-
return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none'
|
111
|
+
return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI));
|
108
112
|
}
|
109
|
-
|
113
|
+
|
110
114
|
function containsOnlyAList(e) {
|
111
115
|
var firstChild = skipWhitespaceNodesForwards(e.firstChild), lastChild = skipWhitespaceNodesBackwards(e.lastChild);
|
112
116
|
return firstChild && lastChild && firstChild === lastChild && isList(firstChild);
|
113
117
|
}
|
114
|
-
|
118
|
+
|
115
119
|
function merge(e1, e2, masterElement) {
|
116
120
|
var lastOriginal = skipWhitespaceNodesBackwards(e1.lastChild), firstNew = skipWhitespaceNodesForwards(e2.firstChild);
|
117
121
|
if (e1.tagName === 'P') {
|
@@ -127,7 +131,7 @@
|
|
127
131
|
attemptMerge(lastOriginal, firstNew, false);
|
128
132
|
return e1;
|
129
133
|
}
|
130
|
-
|
134
|
+
|
131
135
|
function findItemToOperateOn(e, dom) {
|
132
136
|
var item;
|
133
137
|
if (!dom.is(e, 'li,ol,ul')) {
|
@@ -138,42 +142,95 @@
|
|
138
142
|
}
|
139
143
|
return e;
|
140
144
|
}
|
141
|
-
|
145
|
+
|
142
146
|
tinymce.create('tinymce.plugins.Lists', {
|
143
147
|
init: function(ed, url) {
|
144
|
-
var
|
148
|
+
var LIST_TABBING = 0;
|
149
|
+
var LIST_EMPTY_ITEM = 1;
|
150
|
+
var LIST_ESCAPE = 2;
|
151
|
+
var LIST_UNKNOWN = 3;
|
152
|
+
var state = LIST_UNKNOWN;
|
145
153
|
|
146
|
-
function
|
154
|
+
function isTabInList(e) {
|
147
155
|
return e.keyCode === 9 && (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
|
148
|
-
}
|
156
|
+
}
|
157
|
+
|
158
|
+
function isOnLastListItem() {
|
159
|
+
var li = getLi();
|
160
|
+
var grandParent = li.parentNode.parentNode;
|
161
|
+
var isLastItem = li.parentNode.lastChild === li;
|
162
|
+
return isLastItem && !isNestedList(grandParent) && isEmptyListItem(li);
|
163
|
+
}
|
164
|
+
|
165
|
+
function isNestedList(grandParent) {
|
166
|
+
if (isList(grandParent)) {
|
167
|
+
return grandParent.parentNode && grandParent.parentNode.tagName === 'LI';
|
168
|
+
} else {
|
169
|
+
return grandParent.tagName === 'LI';
|
170
|
+
}
|
171
|
+
}
|
149
172
|
|
150
|
-
function
|
151
|
-
|
152
|
-
|
153
|
-
n = sel.getStart();
|
173
|
+
function isInEmptyListItem() {
|
174
|
+
return ed.selection.isCollapsed() && isEmptyListItem(getLi());
|
175
|
+
}
|
154
176
|
|
155
|
-
|
156
|
-
|
157
|
-
|
177
|
+
function getLi() {
|
178
|
+
var n = ed.selection.getStart();
|
179
|
+
// Get start will return BR if the LI only contains a BR or an empty element as we use these to fix caret position
|
180
|
+
return ((n.tagName == 'BR' || n.tagName == '') && n.parentNode.tagName == 'LI') ? n.parentNode : n;
|
181
|
+
}
|
158
182
|
|
159
|
-
|
160
|
-
|
161
|
-
|
183
|
+
function isEmptyListItem(li) {
|
184
|
+
var numChildren = li.childNodes.length;
|
185
|
+
if (li.tagName === 'LI') {
|
186
|
+
return numChildren == 0 ? true : numChildren == 1 && (li.firstChild.tagName == '' || isEmptyWebKitLi(li) || isEmptyIE9Li(li));
|
162
187
|
}
|
163
|
-
|
188
|
+
return false;
|
189
|
+
}
|
190
|
+
|
191
|
+
function isEmptyWebKitLi(li) {
|
192
|
+
// Check for empty LI or a LI with just a child that is a BR since Gecko and WebKit uses BR elements to place the caret
|
193
|
+
return tinymce.isWebKit && li.firstChild.nodeName == 'BR';
|
194
|
+
}
|
164
195
|
|
165
|
-
function
|
166
|
-
if
|
196
|
+
function isEmptyIE9Li(li) {
|
197
|
+
// only consider this to be last item if there is no list item content or that content is nbsp or space since IE9 creates these
|
198
|
+
var lis = tinymce.grep(li.parentNode.childNodes, function(n) {return n.nodeName == 'LI'});
|
199
|
+
var isLastLi = li == lis[lis.length - 1];
|
200
|
+
var child = li.firstChild;
|
201
|
+
return tinymce.isIE9 && isLastLi && (child.nodeValue == String.fromCharCode(160) || child.nodeValue == String.fromCharCode(32));
|
202
|
+
}
|
203
|
+
|
204
|
+
function isEnter(e) {
|
205
|
+
return e.keyCode === 13;
|
206
|
+
}
|
207
|
+
|
208
|
+
function getListKeyState(e) {
|
209
|
+
if (isTabInList(e)) {
|
210
|
+
return LIST_TABBING;
|
211
|
+
} else if (isEnter(e) && isOnLastListItem()) {
|
212
|
+
return LIST_ESCAPE;
|
213
|
+
} else if (isEnter(e) && isInEmptyListItem()) {
|
214
|
+
return LIST_EMPTY_ITEM;
|
215
|
+
} else {
|
216
|
+
return LIST_UNKNOWN;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
function cancelEnterAndTab(_, e) {
|
221
|
+
if (state == LIST_TABBING || state == LIST_EMPTY_ITEM) {
|
167
222
|
return Event.cancel(e);
|
168
223
|
}
|
169
|
-
}
|
224
|
+
}
|
170
225
|
|
171
226
|
function imageJoiningListItem(ed, e) {
|
227
|
+
var prevSibling;
|
228
|
+
|
172
229
|
if (!tinymce.isGecko)
|
173
230
|
return;
|
174
231
|
|
175
232
|
var n = ed.selection.getStart();
|
176
|
-
if (e.keyCode != 8 || n.tagName !== 'IMG')
|
233
|
+
if (e.keyCode != 8 || n.tagName !== 'IMG')
|
177
234
|
return;
|
178
235
|
|
179
236
|
function lastLI(node) {
|
@@ -195,11 +252,16 @@
|
|
195
252
|
destination.appendChild(parentNode.childNodes[0]);
|
196
253
|
}
|
197
254
|
|
255
|
+
// Check if there is a previous sibling
|
256
|
+
prevSibling = n.parentNode.previousSibling;
|
257
|
+
if (!prevSibling)
|
258
|
+
return;
|
259
|
+
|
198
260
|
var ul;
|
199
|
-
if (
|
200
|
-
ul =
|
201
|
-
else if (
|
202
|
-
ul =
|
261
|
+
if (prevSibling.tagName === 'UL' || prevSibling.tagName === 'OL')
|
262
|
+
ul = prevSibling;
|
263
|
+
else if (prevSibling.previousSibling && (prevSibling.previousSibling.tagName === 'UL' || prevSibling.previousSibling.tagName === 'OL'))
|
264
|
+
ul = prevSibling.previousSibling;
|
203
265
|
else
|
204
266
|
return;
|
205
267
|
|
@@ -221,7 +283,7 @@
|
|
221
283
|
addChildren(clone, li);
|
222
284
|
else
|
223
285
|
li.appendChild(clone);
|
224
|
-
|
286
|
+
|
225
287
|
// remove the old copy of the image
|
226
288
|
n.parentNode.parentNode.removeChild(n.parentNode);
|
227
289
|
|
@@ -229,6 +291,16 @@
|
|
229
291
|
ed.selection.moveToBookmark(bookmark);
|
230
292
|
}
|
231
293
|
|
294
|
+
// fix the cursor position to ensure it is correct in IE
|
295
|
+
function setCursorPositionToOriginalLi(li) {
|
296
|
+
var list = ed.dom.getParent(li, 'ol,ul');
|
297
|
+
if (list != null) {
|
298
|
+
var lastLi = list.lastChild;
|
299
|
+
lastLi.appendChild(ed.getDoc().createElement(''));
|
300
|
+
ed.selection.setCursorLocation(lastLi, 0);
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
232
304
|
this.ed = ed;
|
233
305
|
ed.addCommand('Indent', this.indent, this);
|
234
306
|
ed.addCommand('Outdent', this.outdent, this);
|
@@ -238,72 +310,74 @@
|
|
238
310
|
ed.addCommand('InsertOrderedList', function() {
|
239
311
|
this.applyList('OL', 'UL');
|
240
312
|
}, this);
|
241
|
-
|
313
|
+
|
242
314
|
ed.onInit.add(function() {
|
243
315
|
ed.editorCommands.addCommands({
|
244
316
|
'outdent': function() {
|
245
317
|
var sel = ed.selection, dom = ed.dom;
|
318
|
+
|
246
319
|
function hasStyleIndent(n) {
|
247
320
|
n = dom.getParent(n, dom.isBlock);
|
248
321
|
return n && (parseInt(ed.dom.getStyle(n, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(n, 'padding-left') || 0, 10)) > 0;
|
249
322
|
}
|
323
|
+
|
250
324
|
return hasStyleIndent(sel.getStart()) || hasStyleIndent(sel.getEnd()) || ed.queryCommandState('InsertOrderedList') || ed.queryCommandState('InsertUnorderedList');
|
251
325
|
}
|
252
326
|
}, 'state');
|
253
327
|
});
|
254
|
-
|
328
|
+
|
255
329
|
ed.onKeyUp.add(function(ed, e) {
|
256
|
-
|
257
|
-
if (isTriggerKey(e)) {
|
330
|
+
if (state == LIST_TABBING) {
|
258
331
|
ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);
|
259
332
|
return Event.cancel(e);
|
260
|
-
} else if (
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
n = ed.selection.getStart();
|
267
|
-
if (n && n.tagName === 'LI') {
|
268
|
-
// Fix the caret position on IE since it jumps back up to the previous list item.
|
269
|
-
n = ed.dom.getParent(n, 'ol,ul').nextSibling;
|
270
|
-
if (n && n.tagName === 'P') {
|
271
|
-
if (!n.firstChild) {
|
272
|
-
n.appendChild(ed.getDoc().createTextNode(''));
|
273
|
-
}
|
274
|
-
rng = ed.dom.createRng();
|
275
|
-
rng.setStart(n.firstChild, 1);
|
276
|
-
rng.setEnd(n.firstChild, 1);
|
277
|
-
ed.selection.setRng(rng);
|
278
|
-
}
|
333
|
+
} else if (state == LIST_EMPTY_ITEM) {
|
334
|
+
var li = getLi();
|
335
|
+
var shouldOutdent = ed.settings.list_outdent_on_enter === true || e.shiftKey;
|
336
|
+
ed.execCommand(shouldOutdent ? 'Outdent' : 'Indent', true, null);
|
337
|
+
if (tinymce.isIE) {
|
338
|
+
setCursorPositionToOriginalLi(li);
|
279
339
|
}
|
280
340
|
return Event.cancel(e);
|
341
|
+
} else if (state == LIST_ESCAPE) {
|
342
|
+
if (tinymce.isIE8) {
|
343
|
+
// append a zero sized nbsp so that caret is positioned correctly in IE8 after escaping and applying formatting.
|
344
|
+
// if there is no text then applying formatting for e.g a H1 to the P tag immediately following list after
|
345
|
+
// escaping from it will cause the caret to be positioned on the last li instead of staying the in P tag.
|
346
|
+
var n = ed.getDoc().createTextNode('\uFEFF');
|
347
|
+
ed.selection.getNode().appendChild(n);
|
348
|
+
} else if (tinymce.isIE9) {
|
349
|
+
// IE9 does not escape the list so we use outdent to do this and cancel the default behaviour
|
350
|
+
ed.execCommand('Outdent');
|
351
|
+
return Event.cancel(e);
|
352
|
+
}
|
281
353
|
}
|
282
354
|
});
|
283
|
-
ed.
|
284
|
-
ed.onKeyDown.add(
|
355
|
+
ed.onKeyDown.add(function(_, e) { state = getListKeyState(e); });
|
356
|
+
ed.onKeyDown.add(cancelEnterAndTab);
|
285
357
|
ed.onKeyDown.add(imageJoiningListItem);
|
358
|
+
ed.onKeyPress.add(cancelEnterAndTab);
|
286
359
|
},
|
287
|
-
|
360
|
+
|
288
361
|
applyList: function(targetListType, oppositeListType) {
|
289
362
|
var t = this, ed = t.ed, dom = ed.dom, applied = [], hasSameType = false, hasOppositeType = false, hasNonList = false, actions,
|
290
|
-
|
291
|
-
|
363
|
+
selectedBlocks = ed.selection.getSelectedBlocks();
|
364
|
+
|
292
365
|
function cleanupBr(e) {
|
293
366
|
if (e && e.tagName === 'BR') {
|
294
367
|
dom.remove(e);
|
295
368
|
}
|
296
369
|
}
|
297
|
-
|
370
|
+
|
298
371
|
function makeList(element) {
|
299
372
|
var list = dom.create(targetListType), li;
|
373
|
+
|
300
374
|
function adjustIndentForNewList(element) {
|
301
375
|
// If there's a margin-left, outdent one level to account for the extra list margin.
|
302
376
|
if (element.style.marginLeft || element.style.paddingLeft) {
|
303
377
|
t.adjustPaddingFunction(false)(element);
|
304
378
|
}
|
305
379
|
}
|
306
|
-
|
380
|
+
|
307
381
|
if (element.tagName === 'LI') {
|
308
382
|
// No change required.
|
309
383
|
} else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') {
|
@@ -331,7 +405,7 @@
|
|
331
405
|
attemptMergeWithAdjacent(list, true);
|
332
406
|
applied.push(element);
|
333
407
|
}
|
334
|
-
|
408
|
+
|
335
409
|
function doWrapList(start, end, template) {
|
336
410
|
var li, n = start, tmp, i;
|
337
411
|
while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) {
|
@@ -358,10 +432,11 @@
|
|
358
432
|
}
|
359
433
|
makeList(li);
|
360
434
|
}
|
361
|
-
|
435
|
+
|
362
436
|
function processBrs(element, callback) {
|
363
437
|
var startSection, previousBR, END_TO_START = 3, START_TO_END = 1,
|
364
|
-
|
438
|
+
breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl';
|
439
|
+
|
365
440
|
function isAnyPartSelected(start, end) {
|
366
441
|
var r = dom.createRng(), sel;
|
367
442
|
bookmark.keep = true;
|
@@ -375,12 +450,14 @@
|
|
375
450
|
r.setEndAfter(end);
|
376
451
|
return !(r.compareBoundaryPoints(END_TO_START, sel) > 0 || r.compareBoundaryPoints(START_TO_END, sel) <= 0);
|
377
452
|
}
|
453
|
+
|
378
454
|
function nextLeaf(br) {
|
379
455
|
if (br.nextSibling)
|
380
456
|
return br.nextSibling;
|
381
457
|
if (!dom.isBlock(br.parentNode) && br.parentNode !== dom.getRoot())
|
382
458
|
return nextLeaf(br.parentNode);
|
383
459
|
}
|
460
|
+
|
384
461
|
// Split on BRs within the range and process those.
|
385
462
|
startSection = element.firstChild;
|
386
463
|
// First mark the BRs that have any part of the previous section selected.
|
@@ -415,7 +492,7 @@
|
|
415
492
|
callback(startSection, undefined, previousBR);
|
416
493
|
}
|
417
494
|
}
|
418
|
-
|
495
|
+
|
419
496
|
function wrapList(element) {
|
420
497
|
processBrs(element, function(startSection, br, previousBR) {
|
421
498
|
// Need to indent this part
|
@@ -424,7 +501,7 @@
|
|
424
501
|
cleanupBr(previousBR);
|
425
502
|
});
|
426
503
|
}
|
427
|
-
|
504
|
+
|
428
505
|
function changeList(element) {
|
429
506
|
if (tinymce.inArray(applied, element) !== -1) {
|
430
507
|
return;
|
@@ -436,7 +513,7 @@
|
|
436
513
|
}
|
437
514
|
applied.push(element);
|
438
515
|
}
|
439
|
-
|
516
|
+
|
440
517
|
function convertListItemToParagraph(element) {
|
441
518
|
var child, nextChild, mergedElement, splitLast;
|
442
519
|
if (tinymce.inArray(applied, element) !== -1) {
|
@@ -458,7 +535,7 @@
|
|
458
535
|
if (dom.isBlock(child)) {
|
459
536
|
child = dom.split(child.parentNode, child);
|
460
537
|
splitLast = true;
|
461
|
-
nextChild = child.nextSibling && child.nextSibling.firstChild;
|
538
|
+
nextChild = child.nextSibling && child.nextSibling.firstChild;
|
462
539
|
} else {
|
463
540
|
nextChild = child.nextSibling;
|
464
541
|
if (splitLast && child.tagName === 'BR') {
|
@@ -470,7 +547,7 @@
|
|
470
547
|
}
|
471
548
|
}
|
472
549
|
}
|
473
|
-
|
550
|
+
|
474
551
|
each(selectedBlocks, function(e) {
|
475
552
|
e = findItemToOperateOn(e, dom);
|
476
553
|
if (e.tagName === oppositeListType || (e.tagName === 'LI' && e.parentNode.tagName === oppositeListType)) {
|
@@ -503,23 +580,23 @@
|
|
503
580
|
}
|
504
581
|
this.process(actions);
|
505
582
|
},
|
506
|
-
|
583
|
+
|
507
584
|
indent: function() {
|
508
585
|
var ed = this.ed, dom = ed.dom, indented = [];
|
509
|
-
|
586
|
+
|
510
587
|
function createWrapItem(element) {
|
511
588
|
var wrapItem = dom.create('li', { style: 'list-style-type: none;'});
|
512
589
|
dom.insertAfter(wrapItem, element);
|
513
590
|
return wrapItem;
|
514
591
|
}
|
515
|
-
|
592
|
+
|
516
593
|
function createWrapList(element) {
|
517
594
|
var wrapItem = createWrapItem(element),
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
595
|
+
list = dom.getParent(element, 'ol,ul'),
|
596
|
+
listType = list.tagName,
|
597
|
+
listStyle = dom.getStyle(list, 'list-style-type'),
|
598
|
+
attrs = {},
|
599
|
+
wrapList;
|
523
600
|
if (listStyle !== '') {
|
524
601
|
attrs.style = 'list-style-type: ' + listStyle + ';';
|
525
602
|
}
|
@@ -527,7 +604,7 @@
|
|
527
604
|
wrapItem.appendChild(wrapList);
|
528
605
|
return wrapList;
|
529
606
|
}
|
530
|
-
|
607
|
+
|
531
608
|
function indentLI(element) {
|
532
609
|
if (!hasParentInList(ed, element, indented)) {
|
533
610
|
element = splitNestedLists(element, dom);
|
@@ -538,17 +615,17 @@
|
|
538
615
|
indented.push(element);
|
539
616
|
}
|
540
617
|
}
|
541
|
-
|
618
|
+
|
542
619
|
this.process({
|
543
620
|
'LI': indentLI,
|
544
621
|
defaultAction: this.adjustPaddingFunction(true)
|
545
622
|
});
|
546
|
-
|
623
|
+
|
547
624
|
},
|
548
|
-
|
625
|
+
|
549
626
|
outdent: function() {
|
550
627
|
var t = this, ed = t.ed, dom = ed.dom, outdented = [];
|
551
|
-
|
628
|
+
|
552
629
|
function outdentLI(element) {
|
553
630
|
var listElement, targetParent, align;
|
554
631
|
if (!hasParentInList(ed, element, outdented)) {
|
@@ -577,17 +654,18 @@
|
|
577
654
|
outdented.push(element);
|
578
655
|
}
|
579
656
|
}
|
580
|
-
|
657
|
+
|
581
658
|
this.process({
|
582
659
|
'LI': outdentLI,
|
583
660
|
defaultAction: this.adjustPaddingFunction(false)
|
584
661
|
});
|
585
|
-
|
662
|
+
|
586
663
|
each(outdented, attemptMergeWithAdjacent);
|
587
664
|
},
|
588
|
-
|
665
|
+
|
589
666
|
process: function(actions) {
|
590
667
|
var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r;
|
668
|
+
|
591
669
|
function processElement(element) {
|
592
670
|
dom.removeClass(element, '_mce_act_on');
|
593
671
|
if (!element || element.nodeType !== 1) {
|
@@ -600,13 +678,16 @@
|
|
600
678
|
}
|
601
679
|
action(element);
|
602
680
|
}
|
681
|
+
|
603
682
|
function recurse(element) {
|
604
683
|
t.splitSafeEach(element.childNodes, processElement);
|
605
684
|
}
|
685
|
+
|
606
686
|
function brAtEdgeOfSelection(container, offset) {
|
607
687
|
return offset >= 0 && container.hasChildNodes() && offset < container.childNodes.length &&
|
608
688
|
container.childNodes[offset].tagName === 'BR';
|
609
689
|
}
|
690
|
+
|
610
691
|
selectedBlocks = sel.getSelectedBlocks();
|
611
692
|
if (selectedBlocks.length === 0) {
|
612
693
|
selectedBlocks = [ dom.getRoot() ];
|
@@ -631,7 +712,7 @@
|
|
631
712
|
// Avoids table or image handles being left behind in Firefox.
|
632
713
|
t.ed.execCommand('mceRepaint');
|
633
714
|
},
|
634
|
-
|
715
|
+
|
635
716
|
splitSafeEach: function(elements, f) {
|
636
717
|
if (tinymce.isGecko && (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) ||
|
637
718
|
/Firefox\/3\.[0-4]/.test(navigator.userAgent))) {
|
@@ -640,7 +721,7 @@
|
|
640
721
|
each(elements, f);
|
641
722
|
}
|
642
723
|
},
|
643
|
-
|
724
|
+
|
644
725
|
classBasedEach: function(elements, f) {
|
645
726
|
var dom = this.ed.dom, nodes, element;
|
646
727
|
// Mark nodes
|
@@ -655,7 +736,7 @@
|
|
655
736
|
nodes = dom.select('._mce_act_on');
|
656
737
|
}
|
657
738
|
},
|
658
|
-
|
739
|
+
|
659
740
|
adjustPaddingFunction: function(isIndent) {
|
660
741
|
var indentAmount, indentUnits, ed = this.ed;
|
661
742
|
indentAmount = ed.settings.indentation;
|
@@ -673,7 +754,7 @@
|
|
673
754
|
ed.dom.setStyle(element, 'margin-left', newIndentAmount > 0 ? newIndentAmount + indentUnits : '');
|
674
755
|
};
|
675
756
|
},
|
676
|
-
|
757
|
+
|
677
758
|
getInfo: function() {
|
678
759
|
return {
|
679
760
|
longname : 'Lists',
|