tinymce-rails 4.3.13 → 4.4.0

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/Rakefile +1 -2
  3. data/app/assets/source/tinymce/tinymce.js +224 -51
  4. data/lib/tinymce/rails/version.rb +2 -2
  5. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/imagetools/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  10. data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.ie7.min.css +1 -1
  11. data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.min.css +1 -1
  12. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/atomic.js +5 -0
  13. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-atomic.js +1491 -0
  14. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-browser.js +1491 -0
  15. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-demo.js +1491 -0
  16. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-prod.js +1491 -0
  17. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/browser.js +10 -0
  18. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/demo.js +8 -0
  19. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/prod.js +5 -0
  20. data/vendor/assets/javascripts/tinymce/themes/inlite/config/dent/depend.js +21 -0
  21. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/compile/bootstrap.js +1526 -0
  22. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/compile/theme.js +1589 -0
  23. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/inline/theme.js +1674 -0
  24. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/inline/theme.raw.js +1674 -0
  25. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/css/demo.css +25 -0
  26. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/html/demo.html +42 -0
  27. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/js/tinymce/inlite/Demo.js +28 -0
  28. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/Theme.js +143 -0
  29. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Arr.js +22 -0
  30. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Bookmark.js +130 -0
  31. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Unlink.js +84 -0
  32. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Uuid.js +34 -0
  33. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Actions.js +106 -0
  34. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Convert.js +37 -0
  35. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/ElementMatcher.js +47 -0
  36. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Layout.js +95 -0
  37. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Matcher.js +39 -0
  38. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Measure.js +70 -0
  39. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/PredicateId.js +32 -0
  40. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/SelectionMatcher.js +55 -0
  41. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/SkinLoader.js +45 -0
  42. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/UrlType.js +22 -0
  43. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/file/Conversions.js +31 -0
  44. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/file/Picker.js +40 -0
  45. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Buttons.js +80 -0
  46. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Forms.js +102 -0
  47. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Panel.js +216 -0
  48. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Toolbar.js +126 -0
  49. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/alien/ArrTest.js +9 -0
  50. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/alien/UuidTest.js +10 -0
  51. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/ConvertTest.js +12 -0
  52. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/MatcherTest.js +51 -0
  53. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/UrlTypeTest.js +25 -0
  54. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/ThemeTest.js +202 -0
  55. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/alien/BookmarkTest.js +65 -0
  56. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/alien/UnlinkTest.js +38 -0
  57. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/ActionsTest.js +177 -0
  58. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/ElementMatcher.js +69 -0
  59. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/LayoutTest.js +118 -0
  60. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/MeasureTest.js +62 -0
  61. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/PredicateIdTest.js +26 -0
  62. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/SelectionMatcherTest.js +76 -0
  63. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/file/ConversionsTest.js +41 -0
  64. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/file/SelectionMatcher.js +55 -0
  65. data/vendor/assets/javascripts/tinymce/themes/inlite/theme.js +1 -0
  66. data/vendor/assets/javascripts/tinymce/themes/modern/theme.js +1 -1
  67. data/vendor/assets/javascripts/tinymce/tinymce.js +13 -13
  68. metadata +57 -3
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Uuid.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
+ * Generates unique ids this is the same as in core but since
13
+ * it's not exposed as a global we can't access it.
14
+ */
15
+ define("tinymce/inlite/alien/Uuid", [
16
+ ], function() {
17
+ var count = 0;
18
+
19
+ var seed = function () {
20
+ var rnd = function () {
21
+ return Math.round(Math.random() * 0xFFFFFFFF).toString(36);
22
+ };
23
+
24
+ return 's' + Date.now().toString(36) + rnd() + rnd() + rnd();
25
+ };
26
+
27
+ var uuid = function (prefix) {
28
+ return prefix + (count++) + seed();
29
+ };
30
+
31
+ return {
32
+ uuid: uuid
33
+ };
34
+ });
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Actions.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/core/Actions', [
12
+ 'tinymce/inlite/alien/Uuid',
13
+ 'tinymce/inlite/alien/Unlink'
14
+ ], function (Uuid, Unlink) {
15
+ var createTableHtml = function (cols, rows) {
16
+ var x, y, html;
17
+
18
+ html = '<table data-mce-id="mce" style="width: 100%">';
19
+ html += '<tbody>';
20
+
21
+ for (y = 0; y < rows; y++) {
22
+ html += '<tr>';
23
+
24
+ for (x = 0; x < cols; x++) {
25
+ html += '<td><br></td>';
26
+ }
27
+
28
+ html += '</tr>';
29
+ }
30
+
31
+ html += '</tbody>';
32
+ html += '</table>';
33
+
34
+ return html;
35
+ };
36
+
37
+ var getInsertedElement = function (editor) {
38
+ var elms = editor.dom.select('*[data-mce-id]');
39
+ return elms[0];
40
+ };
41
+
42
+ var insertTable = function (editor, cols, rows) {
43
+ editor.undoManager.transact(function () {
44
+ var tableElm, cellElm;
45
+
46
+ editor.insertContent(createTableHtml(cols, rows));
47
+
48
+ tableElm = getInsertedElement(editor);
49
+ tableElm.removeAttribute('data-mce-id');
50
+ cellElm = editor.dom.select('td,th', tableElm);
51
+ editor.selection.setCursorLocation(cellElm[0], 0);
52
+ });
53
+ };
54
+
55
+ var formatBlock = function (editor, formatName) {
56
+ editor.execCommand('FormatBlock', false, formatName);
57
+ };
58
+
59
+ var insertBlob = function (editor, base64, blob) {
60
+ var blobCache, blobInfo;
61
+
62
+ blobCache = editor.editorUpload.blobCache;
63
+ blobInfo = blobCache.create(Uuid.uuid('mceu'), blob, base64);
64
+ blobCache.add(blobInfo);
65
+
66
+ editor.insertContent(editor.dom.createHTML('img', {src: blobInfo.blobUri()}));
67
+ };
68
+
69
+ var collapseSelectionToEnd = function (editor) {
70
+ editor.selection.collapse(false);
71
+ };
72
+
73
+ var unlink = function (editor) {
74
+ editor.focus();
75
+ Unlink.unlinkSelection(editor);
76
+ collapseSelectionToEnd(editor);
77
+ };
78
+
79
+ var changeHref = function (editor, elm, url) {
80
+ editor.focus();
81
+ editor.dom.setAttrib(elm, 'href', url);
82
+ collapseSelectionToEnd(editor);
83
+ };
84
+
85
+ var insertLink = function (editor, url) {
86
+ editor.execCommand('mceInsertLink', false, {href: url});
87
+ collapseSelectionToEnd(editor);
88
+ };
89
+
90
+ var updateOrInsertLink = function (editor, url) {
91
+ var elm = editor.dom.getParent(editor.selection.getStart(), 'a[href]');
92
+ elm ? changeHref(editor, elm, url) : insertLink(editor, url);
93
+ };
94
+
95
+ var createLink = function (editor, url) {
96
+ url.trim().length === 0 ? unlink(editor) : updateOrInsertLink(editor, url);
97
+ };
98
+
99
+ return {
100
+ insertTable: insertTable,
101
+ formatBlock: formatBlock,
102
+ insertBlob: insertBlob,
103
+ createLink: createLink,
104
+ unlink: unlink
105
+ };
106
+ });
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Convert.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/core/Convert', [
12
+ ], function () {
13
+ var fromClientRect = function (clientRect) {
14
+ return {
15
+ x: clientRect.left,
16
+ y: clientRect.top,
17
+ w: clientRect.width,
18
+ h: clientRect.height
19
+ };
20
+ };
21
+
22
+ var toClientRect = function (geomRect) {
23
+ return {
24
+ left: geomRect.x,
25
+ top: geomRect.y,
26
+ width: geomRect.w,
27
+ height: geomRect.h,
28
+ right: geomRect.x + geomRect.w,
29
+ bottom: geomRect.y + geomRect.h
30
+ };
31
+ };
32
+
33
+ return {
34
+ fromClientRect: fromClientRect,
35
+ toClientRect: toClientRect
36
+ };
37
+ });
@@ -0,0 +1,47 @@
1
+ /**
2
+ * ElementMatcher.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/core/ElementMatcher', [
12
+ 'tinymce/inlite/core/Matcher',
13
+ 'tinymce/inlite/core/Measure'
14
+ ], function (Matcher, Measure) {
15
+ // element :: Element, [PredicateId] -> (Editor -> Matcher.result | Null)
16
+ var element = function (element, predicateIds) {
17
+ return function (editor) {
18
+ for (var i = 0; i < predicateIds.length; i++) {
19
+ if (predicateIds[i].predicate(element)) {
20
+ return Matcher.result(predicateIds[i].id, Measure.getElementRect(editor, element));
21
+ }
22
+ }
23
+
24
+ return null;
25
+ };
26
+ };
27
+
28
+ // parent :: [Elements], [PredicateId] -> (Editor -> Matcher.result | Null)
29
+ var parent = function (elements, predicateIds) {
30
+ return function (editor) {
31
+ for (var i = 0; i < elements.length; i++) {
32
+ for (var x = 0; x < predicateIds.length; x++) {
33
+ if (predicateIds[x].predicate(elements[i])) {
34
+ return Matcher.result(predicateIds[x].id, Measure.getElementRect(editor, elements[i]));
35
+ }
36
+ }
37
+ }
38
+
39
+ return null;
40
+ };
41
+ };
42
+
43
+ return {
44
+ element: element,
45
+ parent: parent
46
+ };
47
+ });
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Layout.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/core/Layout', [
12
+ 'global!tinymce.geom.Rect',
13
+ 'tinymce/inlite/core/Convert'
14
+ ], function (Rect, Convert) {
15
+ var result = function (rect, position) {
16
+ return {
17
+ rect: rect,
18
+ position: position
19
+ };
20
+ };
21
+
22
+ var moveTo = function (rect, toRect) {
23
+ return {x: toRect.x, y: toRect.y, w: rect.w, h: rect.h};
24
+ };
25
+
26
+ var calcByPositions = function (testPositions1, testPositions2, targetRect, contentAreaRect, panelRect) {
27
+ var relPos, relRect, outputPanelRect;
28
+
29
+ relPos = Rect.findBestRelativePosition(panelRect, targetRect, contentAreaRect, testPositions1);
30
+ targetRect = Rect.clamp(targetRect, contentAreaRect);
31
+
32
+ if (relPos) {
33
+ relRect = Rect.relativePosition(panelRect, targetRect, relPos);
34
+ outputPanelRect = moveTo(panelRect, relRect);
35
+ return result(outputPanelRect, relPos);
36
+ }
37
+
38
+ targetRect = Rect.intersect(contentAreaRect, targetRect);
39
+ if (targetRect) {
40
+ relPos = Rect.findBestRelativePosition(panelRect, targetRect, contentAreaRect, testPositions2);
41
+ if (relPos) {
42
+ relRect = Rect.relativePosition(panelRect, targetRect, relPos);
43
+ outputPanelRect = moveTo(panelRect, relRect);
44
+ return result(outputPanelRect, relPos);
45
+ }
46
+
47
+ outputPanelRect = moveTo(panelRect, targetRect);
48
+ return result(outputPanelRect, relPos);
49
+ }
50
+
51
+ return null;
52
+ };
53
+
54
+ var calcInsert = function (targetRect, contentAreaRect, panelRect) {
55
+ return calcByPositions(
56
+ ['cr-cl', 'cl-cr'],
57
+ ['bc-tc', 'bl-tl', 'br-tr'],
58
+ targetRect,
59
+ contentAreaRect,
60
+ panelRect
61
+ );
62
+ };
63
+
64
+ var calc = function (targetRect, contentAreaRect, panelRect) {
65
+ return calcByPositions(
66
+ ['tc-bc', 'bc-tc', 'tl-bl', 'bl-tl', 'tr-br', 'br-tr'],
67
+ ['bc-tc', 'bl-tl', 'br-tr'],
68
+ targetRect,
69
+ contentAreaRect,
70
+ panelRect
71
+ );
72
+ };
73
+
74
+ var userConstrain = function (handler, targetRect, contentAreaRect, panelRect) {
75
+ var userConstrainedPanelRect;
76
+
77
+ if (typeof handler === 'function') {
78
+ userConstrainedPanelRect = handler({
79
+ elementRect: Convert.toClientRect(targetRect),
80
+ contentAreaRect: Convert.toClientRect(contentAreaRect),
81
+ panelRect: Convert.toClientRect(panelRect)
82
+ });
83
+
84
+ return Convert.fromClientRect(userConstrainedPanelRect);
85
+ }
86
+
87
+ return panelRect;
88
+ };
89
+
90
+ return {
91
+ calcInsert: calcInsert,
92
+ calc: calc,
93
+ userConstrain: userConstrain
94
+ };
95
+ });
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Matcher.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/core/Matcher', [
12
+ ], function () {
13
+ // result :: String, Rect -> Matcher.result
14
+ var result = function (id, rect) {
15
+ return {
16
+ id: id,
17
+ rect: rect
18
+ };
19
+ };
20
+
21
+ // match :: Editor, [(Editor -> Matcher.result | Null)] -> Matcher.result | Null
22
+ var match = function (editor, matchers) {
23
+ for (var i = 0; i < matchers.length; i++) {
24
+ var f = matchers[i];
25
+ var result = f(editor);
26
+
27
+ if (result) {
28
+ return result;
29
+ }
30
+ }
31
+
32
+ return null;
33
+ };
34
+
35
+ return {
36
+ match: match,
37
+ result: result
38
+ };
39
+ });
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Measure.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/core/Measure', [
12
+ 'global!tinymce.DOM',
13
+ 'global!tinymce.geom.Rect',
14
+ 'tinymce/inlite/core/Convert'
15
+ ], function (DOM, Rect, Convert) {
16
+ var toAbsolute = function (rect) {
17
+ var vp = DOM.getViewPort();
18
+
19
+ return {
20
+ x: rect.x + vp.x,
21
+ y: rect.y + vp.y,
22
+ w: rect.w,
23
+ h: rect.h
24
+ };
25
+ };
26
+
27
+ var getElementRect = function (editor, elm) {
28
+ var pos, targetRect, root;
29
+
30
+ pos = DOM.getPos(editor.getContentAreaContainer());
31
+ targetRect = editor.dom.getRect(elm);
32
+ root = editor.dom.getRoot();
33
+
34
+ // Adjust targetPos for scrolling in the editor
35
+ if (root.nodeName == 'BODY') {
36
+ targetRect.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft;
37
+ targetRect.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop;
38
+ }
39
+
40
+ targetRect.x += pos.x;
41
+ targetRect.y += pos.y;
42
+
43
+ // We need to use these instead of the rect values since the style
44
+ // size properites might not be the same as the real size for a table
45
+ targetRect.w = elm.clientWidth > 0 ? elm.clientWidth : elm.offsetWidth;
46
+ targetRect.h = elm.clientHeight > 0 ? elm.clientHeight : elm.offsetHeight;
47
+
48
+ return targetRect;
49
+ };
50
+
51
+ var getPageAreaRect = function (editor) {
52
+ return DOM.getRect(editor.getElement().ownerDocument.body);
53
+ };
54
+
55
+ var getContentAreaRect = function (editor) {
56
+ return toAbsolute(DOM.getRect(editor.getContentAreaContainer() || editor.getBody()));
57
+ };
58
+
59
+ var getSelectionRect = function (editor) {
60
+ var clientRect = editor.selection.getBoundingClientRect();
61
+ return clientRect ? toAbsolute(Convert.fromClientRect(clientRect)) : null;
62
+ };
63
+
64
+ return {
65
+ getElementRect: getElementRect,
66
+ getPageAreaRect: getPageAreaRect,
67
+ getContentAreaRect: getContentAreaRect,
68
+ getSelectionRect: getSelectionRect
69
+ };
70
+ });
@@ -0,0 +1,32 @@
1
+ /**
2
+ * PredicateId.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/core/PredicateId', [
12
+ 'global!tinymce.util.Tools'
13
+ ], function (Tools) {
14
+ var create = function (id, predicate) {
15
+ return {
16
+ id: id,
17
+ predicate: predicate
18
+ };
19
+ };
20
+
21
+ // fromContextToolbars :: [ContextToolbar] -> [PredicateId]
22
+ var fromContextToolbars = function (toolbars) {
23
+ return Tools.map(toolbars, function (toolbar) {
24
+ return create(toolbar.id, toolbar.predicate);
25
+ });
26
+ };
27
+
28
+ return {
29
+ create: create,
30
+ fromContextToolbars: fromContextToolbars
31
+ };
32
+ });