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,55 +0,0 @@
1
- /**
2
- * SelectionMatcher.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/SelectionMatcher', [
12
- 'tinymce/inlite/core/Matcher',
13
- 'tinymce/inlite/core/Measure'
14
- ], function (Matcher, Measure) {
15
- // textSelection :: String -> (Editor -> Matcher.result | Null)
16
- var textSelection = function (id) {
17
- return function (editor) {
18
- if (!editor.selection.isCollapsed()) {
19
- return Matcher.result(id, Measure.getSelectionRect(editor));
20
- }
21
-
22
- return null;
23
- };
24
- };
25
-
26
- // emptyTextBlock :: [Elements], String -> (Editor -> Matcher.result | Null)
27
- var emptyTextBlock = function (elements, id) {
28
- return function (editor) {
29
- var i, textBlockElementsMap = editor.schema.getTextBlockElements();
30
-
31
- for (i = 0; i < elements.length; i++) {
32
- if (elements[i].nodeName === 'TABLE') {
33
- return null;
34
- }
35
- }
36
-
37
- for (i = 0; i < elements.length; i++) {
38
- if (elements[i].nodeName in textBlockElementsMap) {
39
- if (editor.dom.isEmpty(elements[i])) {
40
- return Matcher.result(id, Measure.getSelectionRect(editor));
41
- }
42
-
43
- return null;
44
- }
45
- }
46
-
47
- return null;
48
- };
49
- };
50
-
51
- return {
52
- textSelection: textSelection,
53
- emptyTextBlock: emptyTextBlock
54
- };
55
- });
@@ -1,45 +0,0 @@
1
- /**
2
- * SkinLoader.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/SkinLoader', [
12
- 'global!tinymce.EditorManager',
13
- 'global!tinymce.DOM'
14
- ], function (EditorManager, DOM) {
15
- var fireSkinLoaded = function (editor, callback) {
16
- var done = function () {
17
- editor.fire('SkinLoaded');
18
- callback();
19
- };
20
-
21
- if (editor.initialized) {
22
- done();
23
- } else {
24
- editor.on('init', done);
25
- }
26
- };
27
-
28
- var load = function (editor, skin, callback) {
29
- var baseUrl = EditorManager.baseURL;
30
- var skinUrl = baseUrl + '/skins/' + skin;
31
-
32
- var done = function () {
33
- fireSkinLoaded(editor, callback);
34
- };
35
-
36
- DOM.styleSheetLoader.load(skinUrl + '/skin.min.css', done);
37
- editor.contentCSS.push(skinUrl + '/content.inline.min.css');
38
- };
39
-
40
- return {
41
- load: load
42
- };
43
- });
44
-
45
-
@@ -1,27 +0,0 @@
1
- /**
2
- * UrlType.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/UrlType', [
12
- ], function () {
13
- var isDomainLike = function (href) {
14
- return /^www\.|\.(com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil)$/i.test(href.trim());
15
- };
16
-
17
- var isAbsolute = function (href) {
18
- return /^https?:\/\//.test(href.trim());
19
- };
20
-
21
- return {
22
- isDomainLike: isDomainLike,
23
- isAbsolute: isAbsolute
24
- };
25
- });
26
-
27
-
@@ -1,31 +0,0 @@
1
- /**
2
- * Conversions.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/file/Conversions', [
12
- 'global!tinymce.util.Promise'
13
- ], function (Promise) {
14
- var blobToBase64 = function (blob) {
15
- return new Promise(function(resolve) {
16
- var reader = new FileReader();
17
-
18
- reader.onloadend = function() {
19
- resolve(reader.result.split(',')[1]);
20
- };
21
-
22
- reader.readAsDataURL(blob);
23
- });
24
- };
25
-
26
- return {
27
- blobToBase64: blobToBase64
28
- };
29
- });
30
-
31
-
@@ -1,40 +0,0 @@
1
- /**
2
- * Picker.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/file/Picker', [
12
- 'global!tinymce.util.Promise'
13
- ], function (Promise) {
14
- var pickFile = function () {
15
- return new Promise(function (resolve) {
16
- var fileInput;
17
-
18
- fileInput = document.createElement("input");
19
- fileInput.type = "file";
20
- fileInput.style.position = 'fixed';
21
- fileInput.style.left = 0;
22
- fileInput.style.top = 0;
23
- fileInput.style.opacity = 0.001;
24
- document.body.appendChild(fileInput);
25
-
26
- fileInput.onchange = function(e) {
27
- resolve(Array.prototype.slice.call(e.target.files));
28
- };
29
-
30
- fileInput.click();
31
- fileInput.parentNode.removeChild(fileInput);
32
- });
33
- };
34
-
35
- return {
36
- pickFile: pickFile
37
- };
38
- });
39
-
40
-
@@ -1,80 +0,0 @@
1
- /**
2
- * Buttons.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/ui/Buttons', [
12
- 'tinymce/inlite/ui/Panel',
13
- 'tinymce/inlite/file/Conversions',
14
- 'tinymce/inlite/file/Picker',
15
- 'tinymce/inlite/core/Actions'
16
- ], function (Panel, Conversions, Picker, Actions) {
17
- var addHeaderButtons = function (editor) {
18
- var formatBlock = function (name) {
19
- return function () {
20
- Actions.formatBlock(editor, name);
21
- };
22
- };
23
-
24
- for (var i = 1; i < 6; i++) {
25
- var name = 'h' + i;
26
-
27
- editor.addButton(name, {
28
- text: name.toUpperCase(),
29
- tooltip: 'Heading ' + i,
30
- stateSelector: name,
31
- onclick: formatBlock(name),
32
- onPostRender: function () {
33
- // TODO: Remove this hack that produces bold H1-H6 when we have proper icons
34
- var span = this.getEl().firstChild.firstChild;
35
- span.style.fontWeight = 'bold';
36
- }
37
- });
38
- }
39
- };
40
-
41
- var addToEditor = function (editor, panel) {
42
- editor.addButton('quicklink', {
43
- icon: 'link',
44
- tooltip: 'Insert/Edit link',
45
- stateSelector: 'a[href]',
46
- onclick: function () {
47
- panel.showForm(editor, 'quicklink');
48
- }
49
- });
50
-
51
- editor.addButton('quickimage', {
52
- icon: 'image',
53
- tooltip: 'Insert image',
54
- onclick: function () {
55
- Picker.pickFile().then(function (files) {
56
- var blob = files[0];
57
-
58
- Conversions.blobToBase64(blob).then(function (base64) {
59
- Actions.insertBlob(editor, base64, blob);
60
- });
61
- });
62
- }
63
- });
64
-
65
- editor.addButton('quicktable', {
66
- icon: 'table',
67
- tooltip: 'Insert table',
68
- onclick: function () {
69
- panel.hide();
70
- Actions.insertTable(editor, 2, 2);
71
- }
72
- });
73
-
74
- addHeaderButtons(editor);
75
- };
76
-
77
- return {
78
- addToEditor: addToEditor
79
- };
80
- });
@@ -1,102 +0,0 @@
1
- /**
2
- * Forms.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/ui/Forms', [
12
- 'global!tinymce.util.Tools',
13
- 'global!tinymce.ui.Factory',
14
- 'global!tinymce.util.Promise',
15
- 'tinymce/inlite/core/Actions',
16
- 'tinymce/inlite/core/UrlType'
17
- ], function (Tools, Factory, Promise, Actions, UrlType) {
18
- var focusFirstTextBox = function (form) {
19
- form.find('textbox').eq(0).each(function (ctrl) {
20
- ctrl.focus();
21
- });
22
- };
23
-
24
- var createForm = function (name, spec) {
25
- var form = Factory.create(
26
- Tools.extend({
27
- type: 'form',
28
- layout: 'flex',
29
- direction: 'row',
30
- padding: 5,
31
- name: name,
32
- spacing: 3
33
- }, spec)
34
- );
35
-
36
- form.on('show', function () {
37
- focusFirstTextBox(form);
38
- });
39
-
40
- return form;
41
- };
42
-
43
- var toggleVisibility = function (ctrl, state) {
44
- return state ? ctrl.show() : ctrl.hide();
45
- };
46
-
47
- var askAboutPrefix = function (editor, href) {
48
- return new Promise(function (resolve) {
49
- editor.windowManager.confirm(
50
- 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
51
- function (result) {
52
- var output = result === true ? 'http://' + href : href;
53
- resolve(output);
54
- }
55
- );
56
- });
57
- };
58
-
59
- var convertLinkToAbsolute = function (editor, href) {
60
- return !UrlType.isAbsolute(href) && UrlType.isDomainLike(href) ? askAboutPrefix(editor, href) : Promise.resolve(href);
61
- };
62
-
63
- var createQuickLinkForm = function (editor, hide) {
64
- var unlink = function () {
65
- editor.focus();
66
- Actions.unlink(editor);
67
- hide();
68
- };
69
-
70
- return createForm('quicklink', {
71
- items: [
72
- {type: 'button', name: 'unlink', icon: 'unlink', onclick: unlink, tooltip: 'Remove link'},
73
- {type: 'textbox', name: 'linkurl', placeholder: 'Paste or type a link'},
74
- {type: 'button', icon: 'checkmark', subtype: 'primary', tooltip: 'Ok', onclick: 'submit'}
75
- ],
76
- onshow: function () {
77
- var elm, linkurl = '';
78
-
79
- elm = editor.dom.getParent(editor.selection.getStart(), 'a[href]');
80
- if (elm) {
81
- linkurl = editor.dom.getAttrib(elm, 'href');
82
- }
83
-
84
- this.fromJSON({
85
- linkurl: linkurl
86
- });
87
-
88
- toggleVisibility(this.find('#unlink'), elm);
89
- },
90
- onsubmit: function (e) {
91
- convertLinkToAbsolute(editor, e.data.linkurl).then(function (url) {
92
- Actions.createLink(editor, url);
93
- hide();
94
- });
95
- }
96
- });
97
- };
98
-
99
- return {
100
- createQuickLinkForm: createQuickLinkForm
101
- };
102
- });
@@ -1,218 +0,0 @@
1
- /**
2
- * Panel.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/ui/Panel', [
12
- 'global!tinymce.util.Tools',
13
- 'global!tinymce.ui.Factory',
14
- 'global!tinymce.DOM',
15
- 'tinymce/inlite/ui/Toolbar',
16
- 'tinymce/inlite/ui/Forms',
17
- 'tinymce/inlite/core/Measure',
18
- 'tinymce/inlite/core/Layout'
19
- ], function (Tools, Factory, DOM, Toolbar, Forms, Measure, Layout) {
20
- return function () {
21
- var DEFAULT_TEXT_SELECTION_ITEMS = 'bold italic | quicklink h2 h3 blockquote';
22
- var DEFAULT_INSERT_TOOLBAR_ITEMS = 'quickimage quicktable';
23
- var panel, currentRect;
24
-
25
- var createToolbars = function (editor, toolbars) {
26
- return Tools.map(toolbars, function (toolbar) {
27
- return Toolbar.create(editor, toolbar.id, toolbar.items);
28
- });
29
- };
30
-
31
- var getTextSelectionToolbarItems = function (settings) {
32
- var value = settings.selection_toolbar;
33
- return value ? value : DEFAULT_TEXT_SELECTION_ITEMS;
34
- };
35
-
36
- var getInsertToolbarItems = function (settings) {
37
- var value = settings.insert_toolbar;
38
- return value ? value : DEFAULT_INSERT_TOOLBAR_ITEMS;
39
- };
40
-
41
- var create = function (editor, toolbars) {
42
- var items, settings = editor.settings;
43
-
44
- items = createToolbars(editor, toolbars);
45
- items = items.concat([
46
- Toolbar.create(editor, 'text', getTextSelectionToolbarItems(settings)),
47
- Toolbar.create(editor, 'insert', getInsertToolbarItems(settings)),
48
- Forms.createQuickLinkForm(editor, hide)
49
- ]);
50
-
51
- return Factory.create({
52
- type: 'floatpanel',
53
- role: 'dialog',
54
- classes: 'tinymce tinymce-inline arrow',
55
- ariaLabel: 'Inline toolbar',
56
- layout: 'flex',
57
- direction: 'column',
58
- align: 'stretch',
59
- autohide: false,
60
- autofix: true,
61
- fixed: true,
62
- border: 1,
63
- items: items,
64
- oncancel: function() {
65
- editor.focus();
66
- }
67
- });
68
- };
69
-
70
- var showPanel = function (panel) {
71
- if (panel) {
72
- panel.show();
73
- }
74
- };
75
-
76
- var movePanelTo = function (panel, pos) {
77
- panel.moveTo(pos.x, pos.y);
78
- };
79
-
80
- var togglePositionClass = function (panel, relPos) {
81
- relPos = relPos ? relPos.substr(0, 2) : '';
82
-
83
- Tools.each({
84
- t: 'down',
85
- b: 'up',
86
- c: 'center'
87
- }, function(cls, pos) {
88
- panel.classes.toggle('arrow-' + cls, pos === relPos.substr(0, 1));
89
- });
90
-
91
- if (relPos === 'cr') {
92
- panel.classes.toggle('arrow-left', true);
93
- panel.classes.toggle('arrow-right', false);
94
- } else if (relPos === 'cl') {
95
- panel.classes.toggle('arrow-left', true);
96
- panel.classes.toggle('arrow-right', true);
97
- } else {
98
- Tools.each({
99
- l: 'left',
100
- r: 'right'
101
- }, function(cls, pos) {
102
- panel.classes.toggle('arrow-' + cls, pos === relPos.substr(1, 1));
103
- });
104
- }
105
- };
106
-
107
- var showToolbar = function (panel, id) {
108
- var toolbars = panel.items().filter('#' + id);
109
-
110
- if (toolbars.length > 0) {
111
- toolbars[0].show();
112
- panel.reflow();
113
- }
114
- };
115
-
116
- var showPanelAt = function (panel, id, editor, targetRect) {
117
- var contentAreaRect, panelRect, result, userConstainHandler;
118
-
119
- showPanel(panel);
120
- panel.items().hide();
121
- showToolbar(panel, id);
122
-
123
- userConstainHandler = editor.settings.inline_toolbar_position_handler;
124
- contentAreaRect = Measure.getContentAreaRect(editor);
125
- panelRect = DOM.getRect(panel.getEl());
126
-
127
- if (id === 'insert') {
128
- result = Layout.calcInsert(targetRect, contentAreaRect, panelRect);
129
- } else {
130
- result = Layout.calc(targetRect, contentAreaRect, panelRect);
131
- }
132
-
133
- if (result) {
134
- panelRect = result.rect;
135
- currentRect = targetRect;
136
- movePanelTo(panel, Layout.userConstrain(userConstainHandler, targetRect, contentAreaRect, panelRect));
137
-
138
- togglePositionClass(panel, result.position);
139
- } else {
140
- hide(panel);
141
- }
142
- };
143
-
144
- var hasFormVisible = function () {
145
- return panel.items().filter('form:visible').length > 0;
146
- };
147
-
148
- var showForm = function (editor, id) {
149
- if (panel) {
150
- panel.items().hide();
151
- showToolbar(panel, id);
152
-
153
- var contentAreaRect, panelRect, result, userConstainHandler;
154
-
155
- showPanel(panel);
156
- panel.items().hide();
157
- showToolbar(panel, id);
158
-
159
- userConstainHandler = editor.settings.inline_toolbar_position_handler;
160
- contentAreaRect = Measure.getContentAreaRect(editor);
161
- panelRect = DOM.getRect(panel.getEl());
162
-
163
- result = Layout.calc(currentRect, contentAreaRect, panelRect);
164
-
165
- if (result) {
166
- panelRect = result.rect;
167
- movePanelTo(panel, Layout.userConstrain(userConstainHandler, currentRect, contentAreaRect, panelRect));
168
-
169
- togglePositionClass(panel, result.position);
170
- }
171
- }
172
- };
173
-
174
- var show = function (editor, id, targetRect, toolbars) {
175
- if (!panel) {
176
- panel = create(editor, toolbars);
177
- panel.renderTo(document.body).reflow().moveTo(targetRect.x, targetRect.y);
178
- editor.nodeChanged();
179
- }
180
-
181
- showPanelAt(panel, id, editor, targetRect);
182
- };
183
-
184
- var hide = function () {
185
- if (panel) {
186
- panel.hide();
187
- }
188
- };
189
-
190
- var focus = function () {
191
- if (panel) {
192
- panel.find('toolbar:visible').eq(0).each(function (item) {
193
- item.focus(true);
194
- });
195
- }
196
- };
197
-
198
- var remove = function () {
199
- if (panel) {
200
- panel.remove();
201
- panel = null;
202
- }
203
- };
204
-
205
- var inForm = function () {
206
- return panel && panel.visible() && hasFormVisible();
207
- };
208
-
209
- return {
210
- show: show,
211
- showForm: showForm,
212
- inForm: inForm,
213
- hide: hide,
214
- focus: focus,
215
- remove: remove
216
- };
217
- };
218
- });