tinymce-rails 4.4.1 → 4.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +406 -197
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
  5. data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -1
  10. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  12. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/themes/inlite/theme.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/tinymce.js +14 -13
  15. metadata +2 -55
  16. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/atomic.js +0 -5
  17. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-atomic.js +0 -1491
  18. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-browser.js +0 -1491
  19. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-demo.js +0 -1491
  20. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-prod.js +0 -1491
  21. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/browser.js +0 -10
  22. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/demo.js +0 -8
  23. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/prod.js +0 -5
  24. data/vendor/assets/javascripts/tinymce/themes/inlite/config/dent/depend.js +0 -21
  25. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/compile/bootstrap.js +0 -1526
  26. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/compile/theme.js +0 -1594
  27. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/inline/theme.js +0 -1679
  28. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/inline/theme.raw.js +0 -1679
  29. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/css/demo.css +0 -25
  30. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/html/demo.html +0 -69
  31. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/js/tinymce/inlite/Demo.js +0 -28
  32. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/Theme.js +0 -150
  33. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Arr.js +0 -22
  34. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Bookmark.js +0 -130
  35. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Unlink.js +0 -84
  36. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Uuid.js +0 -34
  37. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Actions.js +0 -106
  38. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Convert.js +0 -37
  39. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/ElementMatcher.js +0 -47
  40. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Layout.js +0 -95
  41. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Matcher.js +0 -39
  42. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Measure.js +0 -61
  43. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/PredicateId.js +0 -32
  44. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/SelectionMatcher.js +0 -55
  45. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/SkinLoader.js +0 -45
  46. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/UrlType.js +0 -27
  47. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/file/Conversions.js +0 -31
  48. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/file/Picker.js +0 -40
  49. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Buttons.js +0 -80
  50. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Forms.js +0 -102
  51. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Panel.js +0 -218
  52. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Toolbar.js +0 -126
  53. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/alien/ArrTest.js +0 -9
  54. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/alien/UuidTest.js +0 -10
  55. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/ConvertTest.js +0 -12
  56. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/MatcherTest.js +0 -51
  57. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/UrlTypeTest.js +0 -33
  58. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/ThemeTest.js +0 -202
  59. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/alien/BookmarkTest.js +0 -65
  60. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/alien/UnlinkTest.js +0 -38
  61. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/ActionsTest.js +0 -177
  62. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/ElementMatcher.js +0 -69
  63. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/LayoutTest.js +0 -118
  64. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/MeasureTest.js +0 -62
  65. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/PredicateIdTest.js +0 -26
  66. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/SelectionMatcherTest.js +0 -76
  67. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/file/ConversionsTest.js +0 -41
  68. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/file/SelectionMatcher.js +0 -55
@@ -1,25 +0,0 @@
1
- blockquote {
2
- border-left: 3px solid rgba(0,0,0,.8);
3
- padding-left: 20px;
4
- margin: 0;
5
- }
6
-
7
- .mce-edit-focus {
8
- outline: 1px solid blue;
9
- }
10
-
11
- .tinymce {
12
- margin: 10px;
13
- padding: 10px;
14
- overflow: auto;
15
- border: 1px solid gray;
16
- }
17
-
18
- table, td {
19
- border: 1px dashed gray;
20
- }
21
-
22
- /*.mce-tinymce-inline {
23
- transition: left 50ms ease-in-out, top 50ms ease-in-out;
24
- }
25
- */
@@ -1,69 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>inlite-theme Demo Page</title>
5
- <link href="../css/demo.css" rel="stylesheet">
6
- <script src="../../../../../tinymce.dev.js"></script>
7
- <script src="../../../config/bolt/bootstrap-demo.js"></script>
8
- <script>
9
- ephox.bolt.module.api.main('tinymce/inlite/Demo');
10
- </script>
11
- </head>
12
-
13
- <body>
14
- <h2>inlite-theme Demo Page</h2>
15
- <div id="ephox-ui">
16
- <div class="tinymce" style="width: 900px; min-height: 100px">
17
- <p>
18
- <img src="https://www.tinymce.com/images/glyph-tinymce@2x.png" style="width: 100px; float: right">
19
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ultricies posuere felis sed interdum. Quisque nec diam
20
- nec purus gravida dapibus
21
- </p>
22
- <p>
23
- eget non <a href="http://www.tinymce.com">nulla</a>. Ut eu vestibulum libero. Vestibulum pretium est vitae metus auctor, quis fermentum mi
24
- luctus. Fusce aliquet tincidunt massa vitae scelerisque. Vivamus in tellus risus. Mauris auctor metus ut gravida feugiat.
25
- Nunc consequat urna eu augue commodo, eget malesuada odio fringilla. Morbi vitae turpis in elit laoreet malesuada a nec massa.
26
- </p>
27
- <table>
28
- <tbody>
29
- <tr>
30
- <td>Lorem ipsum dolor sit amet</td>
31
- <td>Lorem ipsum dolor sit amet</td>
32
- </tr>
33
- <tr>
34
- <td>Vivamus in tellus risus</td>
35
- <td>Vivamus in tellus risus</td>
36
- </tr>
37
- </tbody>
38
- </table>
39
- </div>
40
-
41
- <div style="height: 3000px"></div>
42
-
43
- <div class="tinymce" style="width: 900px; min-height: 100px; margin: 20px; border: 20px solid black; padding: 20px">
44
- <p>
45
- <img src="https://www.tinymce.com/images/glyph-tinymce@2x.png" style="width: 100px; float: right">
46
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ultricies posuere felis sed interdum. Quisque nec diam
47
- nec purus gravida dapibus
48
- </p>
49
- <p>
50
- eget non <a href="http://www.tinymce.com">nulla</a>. Ut eu vestibulum libero. Vestibulum pretium est vitae metus auctor, quis fermentum mi
51
- luctus. Fusce aliquet tincidunt massa vitae scelerisque. Vivamus in tellus risus. Mauris auctor metus ut gravida feugiat.
52
- Nunc consequat urna eu augue commodo, eget malesuada odio fringilla. Morbi vitae turpis in elit laoreet malesuada a nec massa.
53
- </p>
54
- <table>
55
- <tbody>
56
- <tr>
57
- <td>Lorem ipsum dolor sit amet</td>
58
- <td>Lorem ipsum dolor sit amet</td>
59
- </tr>
60
- <tr>
61
- <td>Vivamus in tellus risus</td>
62
- <td>Vivamus in tellus risus</td>
63
- </tr>
64
- </tbody>
65
- </table>
66
- </div>
67
- </div>
68
- </body>
69
- </html>
@@ -1,28 +0,0 @@
1
- /**
2
- * Demo.js
3
- *
4
- * Released under LGPL License.
5
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
6
- *
7
- * License: http://www.tinymce.com/license
8
- * Contributing: http://www.tinymce.com/contributing
9
- */
10
-
11
- /*eslint no-console:0 */
12
-
13
- define('tinymce/inlite/Demo', [
14
- 'tinymce/inlite/Theme',
15
- 'global!tinymce'
16
- ], function(Theme, tinymce) {
17
- tinymce.init({
18
- selector: 'div.tinymce',
19
- theme: 'inlite',
20
- plugins: 'image table link paste contextmenu textpattern autolink',
21
- insert_toolbar: 'quickimage quicktable',
22
- selection_toolbar: 'bold italic | quicklink h2 h3 blockquote',
23
- inline: true,
24
- paste_data_images: true
25
- });
26
-
27
- return function() {};
28
- });
@@ -1,150 +0,0 @@
1
- /**
2
- * Theme.js
3
- *
4
- * Released under LGPL License.
5
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
6
- *
7
- * License: http://www.tinymce.com/license
8
- * Contributing: http://www.tinymce.com/contributing
9
- */
10
-
11
- define('tinymce/inlite/Theme', [
12
- 'global!tinymce.ThemeManager',
13
- 'global!tinymce.util.Delay',
14
- 'tinymce/inlite/ui/Panel',
15
- 'tinymce/inlite/ui/Buttons',
16
- 'tinymce/inlite/core/SkinLoader',
17
- 'tinymce/inlite/core/SelectionMatcher',
18
- 'tinymce/inlite/core/ElementMatcher',
19
- 'tinymce/inlite/core/Matcher',
20
- 'tinymce/inlite/alien/Arr',
21
- 'tinymce/inlite/core/PredicateId'
22
- ], function(ThemeManager, Delay, Panel, Buttons, SkinLoader, SelectionMatcher, ElementMatcher, Matcher, Arr, PredicateId) {
23
- var getSelectionElements = function (editor) {
24
- var node = editor.selection.getNode();
25
- var elms = editor.dom.getParents(node);
26
- return elms;
27
- };
28
-
29
- var createToolbar = function (editor, selector, id, items) {
30
- var selectorPredicate = function (elm) {
31
- return editor.dom.is(elm, selector);
32
- };
33
-
34
- return {
35
- predicate: selectorPredicate,
36
- id: id,
37
- items: items
38
- };
39
- };
40
-
41
- var getToolbars = function (editor) {
42
- var contextToolbars = editor.contextToolbars;
43
-
44
- return Arr.flatten([
45
- contextToolbars ? contextToolbars : [],
46
- createToolbar(editor, 'img', 'image', 'alignleft aligncenter alignright')
47
- ]);
48
- };
49
-
50
- var findMatchResult = function (editor, toolbars) {
51
- var result, elements, contextToolbarsPredicateIds;
52
-
53
- elements = getSelectionElements(editor);
54
- contextToolbarsPredicateIds = PredicateId.fromContextToolbars(toolbars);
55
-
56
- result = Matcher.match(editor, [
57
- ElementMatcher.element(elements[0], contextToolbarsPredicateIds),
58
- SelectionMatcher.textSelection('text'),
59
- SelectionMatcher.emptyTextBlock(elements, 'insert'),
60
- ElementMatcher.parent(elements, contextToolbarsPredicateIds)
61
- ]);
62
-
63
- return result && result.rect ? result : null;
64
- };
65
-
66
- var togglePanel = function (editor, panel) {
67
- var toggle = function () {
68
- var toolbars = getToolbars(editor);
69
- var result = findMatchResult(editor, toolbars);
70
-
71
- if (result) {
72
- panel.show(editor, result.id, result.rect, toolbars);
73
- } else {
74
- panel.hide();
75
- }
76
- };
77
-
78
- return function () {
79
- if (!editor.removed) {
80
- toggle();
81
- }
82
- };
83
- };
84
-
85
- var ignoreWhenFormIsVisible = function (panel, f) {
86
- return function () {
87
- if (!panel.inForm()) {
88
- f();
89
- }
90
- };
91
- };
92
-
93
- var bindContextualToolbarsEvents = function (editor, panel) {
94
- var throttledTogglePanel = Delay.throttle(togglePanel(editor, panel), 0);
95
- var throttledTogglePanelWhenNotInForm = Delay.throttle(ignoreWhenFormIsVisible(panel, togglePanel(editor, panel)), 0);
96
-
97
- editor.on('blur hide ObjectResizeStart', panel.hide);
98
- editor.on('click', throttledTogglePanel);
99
- editor.on('nodeChange mouseup', throttledTogglePanelWhenNotInForm);
100
- editor.on('ResizeEditor ResizeWindow keyup', throttledTogglePanel);
101
- editor.on('remove', panel.remove);
102
-
103
- editor.shortcuts.add('Alt+F10', '', panel.focus);
104
- };
105
-
106
- var overrideLinkShortcut = function (editor, panel) {
107
- editor.shortcuts.remove('meta+k');
108
- editor.shortcuts.add('meta+k', '', function () {
109
- var toolbars = getToolbars(editor);
110
- var result = result = Matcher.match(editor, [
111
- SelectionMatcher.textSelection('quicklink')
112
- ]);
113
-
114
- if (result) {
115
- panel.show(editor, result.id, result.rect, toolbars);
116
- }
117
- });
118
- };
119
-
120
- var renderInlineUI = function (editor, panel) {
121
- var skinName = editor.settings.skin || 'lightgray';
122
-
123
- SkinLoader.load(editor, skinName, function () {
124
- bindContextualToolbarsEvents(editor, panel);
125
- overrideLinkShortcut(editor, panel);
126
- });
127
-
128
- return {};
129
- };
130
-
131
- var fail = function (message) {
132
- throw new Error(message);
133
- };
134
-
135
- ThemeManager.add('inlite', function (editor) {
136
- var panel = new Panel();
137
-
138
- Buttons.addToEditor(editor, panel);
139
-
140
- var renderUI = function () {
141
- return editor.inline ? renderInlineUI(editor, panel) : fail('inlite theme only supports inline mode.');
142
- };
143
-
144
- return {
145
- renderUI: renderUI
146
- };
147
- });
148
-
149
- return function() {};
150
- });
@@ -1,22 +0,0 @@
1
- /**
2
- * Arr.js
3
- *
4
- * Released under LGPL License.
5
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
6
- *
7
- * License: http://www.tinymce.com/license
8
- * Contributing: http://www.tinymce.com/contributing
9
- */
10
-
11
- define('tinymce/inlite/alien/Arr', [
12
- ], function () {
13
- var flatten = function (arr) {
14
- return arr.reduce(function (results, item) {
15
- return Array.isArray(item) ? results.concat(flatten(item)) : results.concat(item);
16
- }, []);
17
- };
18
-
19
- return {
20
- flatten: flatten
21
- };
22
- });
@@ -1,130 +0,0 @@
1
- /**
2
- * Bookmark.js
3
- *
4
- * Released under LGPL License.
5
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
6
- *
7
- * License: http://www.tinymce.com/license
8
- * Contributing: http://www.tinymce.com/contributing
9
- */
10
-
11
- define('tinymce/inlite/alien/Bookmark', [
12
- ], function () {
13
- /**
14
- * Returns a range bookmark. This will convert indexed bookmarks into temporary span elements with
15
- * index 0 so that they can be restored properly after the DOM has been modified. Text bookmarks will not have spans
16
- * added to them since they can be restored after a dom operation.
17
- *
18
- * So this: <p><b>|</b><b>|</b></p>
19
- * becomes: <p><b><span data-mce-type="bookmark">|</span></b><b data-mce-type="bookmark">|</span></b></p>
20
- *
21
- * @param {DOMRange} rng DOM Range to get bookmark on.
22
- * @return {Object} Bookmark object.
23
- */
24
- var create = function (dom, rng) {
25
- var bookmark = {};
26
-
27
- function setupEndPoint(start) {
28
- var offsetNode, container, offset;
29
-
30
- container = rng[start ? 'startContainer' : 'endContainer'];
31
- offset = rng[start ? 'startOffset' : 'endOffset'];
32
-
33
- if (container.nodeType == 1) {
34
- offsetNode = dom.create('span', {'data-mce-type': 'bookmark'});
35
-
36
- if (container.hasChildNodes()) {
37
- offset = Math.min(offset, container.childNodes.length - 1);
38
-
39
- if (start) {
40
- container.insertBefore(offsetNode, container.childNodes[offset]);
41
- } else {
42
- dom.insertAfter(offsetNode, container.childNodes[offset]);
43
- }
44
- } else {
45
- container.appendChild(offsetNode);
46
- }
47
-
48
- container = offsetNode;
49
- offset = 0;
50
- }
51
-
52
- bookmark[start ? 'startContainer' : 'endContainer'] = container;
53
- bookmark[start ? 'startOffset' : 'endOffset'] = offset;
54
- }
55
-
56
- setupEndPoint(true);
57
-
58
- if (!rng.collapsed) {
59
- setupEndPoint();
60
- }
61
-
62
- return bookmark;
63
- };
64
-
65
- /**
66
- * Moves the selection to the current bookmark and removes any selection container wrappers.
67
- *
68
- * @param {Object} bookmark Bookmark object to move selection to.
69
- */
70
- var resolve = function (dom, bookmark) {
71
- function restoreEndPoint(start) {
72
- var container, offset, node;
73
-
74
- function nodeIndex(container) {
75
- var node = container.parentNode.firstChild, idx = 0;
76
-
77
- while (node) {
78
- if (node == container) {
79
- return idx;
80
- }
81
-
82
- // Skip data-mce-type=bookmark nodes
83
- if (node.nodeType != 1 || node.getAttribute('data-mce-type') != 'bookmark') {
84
- idx++;
85
- }
86
-
87
- node = node.nextSibling;
88
- }
89
-
90
- return -1;
91
- }
92
-
93
- container = node = bookmark[start ? 'startContainer' : 'endContainer'];
94
- offset = bookmark[start ? 'startOffset' : 'endOffset'];
95
-
96
- if (!container) {
97
- return;
98
- }
99
-
100
- if (container.nodeType == 1) {
101
- offset = nodeIndex(container);
102
- container = container.parentNode;
103
- dom.remove(node);
104
- }
105
-
106
- bookmark[start ? 'startContainer' : 'endContainer'] = container;
107
- bookmark[start ? 'startOffset' : 'endOffset'] = offset;
108
- }
109
-
110
- restoreEndPoint(true);
111
- restoreEndPoint();
112
-
113
- var rng = dom.createRng();
114
-
115
- rng.setStart(bookmark.startContainer, bookmark.startOffset);
116
-
117
- if (bookmark.endContainer) {
118
- rng.setEnd(bookmark.endContainer, bookmark.endOffset);
119
- }
120
-
121
- return rng;
122
- };
123
-
124
- return {
125
- create: create,
126
- resolve: resolve
127
- };
128
- });
129
-
130
-
@@ -1,84 +0,0 @@
1
- /**
2
- * Unlink.js
3
- *
4
- * Released under LGPL License.
5
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
6
- *
7
- * License: http://www.tinymce.com/license
8
- * Contributing: http://www.tinymce.com/contributing
9
- */
10
-
11
- /**
12
- * Unlink implementation that doesn't leave partial links for example it would produce:
13
- * a[b<a href="x">c]d</a>e -> a[bc]de
14
- * instead of:
15
- * a[b<a href="x">c]d</a>e -> a[bc]<a href="x">d</a>e
16
- */
17
- define("tinymce/inlite/alien/Unlink", [
18
- 'tinymce/inlite/alien/Bookmark',
19
- 'global!tinymce.util.Tools',
20
- 'global!tinymce.dom.TreeWalker',
21
- 'global!tinymce.dom.RangeUtils'
22
- ], function (Bookmark, Tools, TreeWalker, RangeUtils) {
23
- var getSelectedElements = function (rootElm, startNode, endNode) {
24
- var walker, node, elms = [];
25
-
26
- walker = new TreeWalker(startNode, rootElm);
27
- for (node = startNode; node; node = walker.next()) {
28
- if (node.nodeType === 1) {
29
- elms.push(node);
30
- }
31
-
32
- if (node === endNode) {
33
- break;
34
- }
35
- }
36
-
37
- return elms;
38
- };
39
-
40
- var unwrapElements = function (editor, elms) {
41
- var bookmark, dom, selection;
42
-
43
- dom = editor.dom;
44
- selection = editor.selection;
45
- bookmark = Bookmark.create(dom, selection.getRng());
46
-
47
- Tools.each(elms, function (elm) {
48
- editor.dom.remove(elm, true);
49
- });
50
-
51
- selection.setRng(Bookmark.resolve(dom, bookmark));
52
- };
53
-
54
- var isLink = function (elm) {
55
- return elm.nodeName === 'A' && elm.hasAttribute('href');
56
- };
57
-
58
- var getParentAnchorOrSelf = function (dom, elm) {
59
- var anchorElm = dom.getParent(elm, isLink);
60
- return anchorElm ? anchorElm : elm;
61
- };
62
-
63
- var getSelectedAnchors = function (editor) {
64
- var startElm, endElm, rootElm, anchorElms, selection, dom, rng;
65
-
66
- selection = editor.selection;
67
- dom = editor.dom;
68
- rng = selection.getRng();
69
- startElm = getParentAnchorOrSelf(dom, RangeUtils.getNode(rng.startContainer, rng.startOffset));
70
- endElm = RangeUtils.getNode(rng.endContainer, rng.endOffset);
71
- rootElm = editor.getBody();
72
- anchorElms = Tools.grep(getSelectedElements(rootElm, startElm, endElm), isLink);
73
-
74
- return anchorElms;
75
- };
76
-
77
- var unlinkSelection = function (editor) {
78
- unwrapElements(editor, getSelectedAnchors(editor));
79
- };
80
-
81
- return {
82
- unlinkSelection: unlinkSelection
83
- };
84
- });