redactor2_rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -27
  3. data/lib/redactor2_rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/redactor2_rails/index.js +0 -1
  5. metadata +2 -32
  6. data/vendor/assets/javascripts/redactor2_rails/langs/ar.js +0 -50
  7. data/vendor/assets/javascripts/redactor2_rails/langs/de.js +0 -50
  8. data/vendor/assets/javascripts/redactor2_rails/langs/en.js +0 -50
  9. data/vendor/assets/javascripts/redactor2_rails/langs/es.js +0 -50
  10. data/vendor/assets/javascripts/redactor2_rails/langs/fa.js +0 -50
  11. data/vendor/assets/javascripts/redactor2_rails/langs/fi.js +0 -50
  12. data/vendor/assets/javascripts/redactor2_rails/langs/fr.js +0 -50
  13. data/vendor/assets/javascripts/redactor2_rails/langs/hu.js +0 -50
  14. data/vendor/assets/javascripts/redactor2_rails/langs/it.js +0 -50
  15. data/vendor/assets/javascripts/redactor2_rails/langs/ja.js +0 -50
  16. data/vendor/assets/javascripts/redactor2_rails/langs/ko.js +0 -50
  17. data/vendor/assets/javascripts/redactor2_rails/langs/nl.js +0 -50
  18. data/vendor/assets/javascripts/redactor2_rails/langs/pl.js +0 -50
  19. data/vendor/assets/javascripts/redactor2_rails/langs/pt_br.js +0 -50
  20. data/vendor/assets/javascripts/redactor2_rails/langs/ru.js +0 -50
  21. data/vendor/assets/javascripts/redactor2_rails/langs/sv.js +0 -50
  22. data/vendor/assets/javascripts/redactor2_rails/langs/tr.js +0 -50
  23. data/vendor/assets/javascripts/redactor2_rails/langs/zh_cn.js +0 -52
  24. data/vendor/assets/javascripts/redactor2_rails/langs/zh_tw.js +0 -50
  25. data/vendor/assets/javascripts/redactor2_rails/plugins/clips.js +0 -60
  26. data/vendor/assets/javascripts/redactor2_rails/plugins/fullscreen.js +0 -159
  27. data/vendor/assets/javascripts/redactor2_rails/plugins/source.js +0 -195
  28. data/vendor/assets/javascripts/redactor2_rails/plugins/textdirection.js +0 -36
  29. data/vendor/assets/javascripts/redactor2_rails/plugins.js +0 -4
  30. data/vendor/assets/javascripts/redactor2_rails/redactor.js +0 -9989
  31. data/vendor/assets/javascripts/redactor2_rails/redactor.min.js +0 -13
  32. data/vendor/assets/stylesheets/redactor2_rails/css/redactor.css +0 -931
  33. data/vendor/assets/stylesheets/redactor2_rails/index.css +0 -1
  34. data/vendor/assets/stylesheets/redactor2_rails/plugins/clips.css +0 -10
  35. data/vendor/assets/stylesheets/redactor2_rails/plugins.css +0 -1
@@ -1,159 +0,0 @@
1
- (function($)
2
- {
3
- $.Redactor.prototype.fullscreen = function()
4
- {
5
- return {
6
- langs: {
7
- en: {
8
- "fullscreen": "Fullscreen"
9
- }
10
- },
11
- init: function()
12
- {
13
- this.fullscreen.isOpen = false;
14
-
15
- var button = this.button.add('fullscreen', this.lang.get('fullscreen'));
16
- this.button.addCallback(button, this.fullscreen.toggle);
17
-
18
- if (this.opts.fullscreen)
19
- {
20
- this.fullscreen.toggle();
21
- }
22
-
23
- },
24
- enable: function()
25
- {
26
- this.fullscreen.isOpened = false;
27
- this.button.setActive('fullscreen');
28
- this.fullscreen.isOpen = true;
29
-
30
- if (!this.opts.fullscreen)
31
- {
32
- this.selection.save();
33
- }
34
-
35
- if (this.opts.toolbarExternal)
36
- {
37
- this.fullscreen.toolcss = {};
38
- this.fullscreen.boxcss = {};
39
- this.fullscreen.toolcss.width = this.$toolbar.css('width');
40
- this.fullscreen.toolcss.top = this.$toolbar.css('top');
41
- this.fullscreen.toolcss.position = this.$toolbar.css('position');
42
- this.fullscreen.boxcss.top = this.$box.css('top');
43
- }
44
-
45
- this.fullscreen.height = this.core.editor().height();
46
-
47
- if (this.opts.maxHeight)
48
- {
49
- this.core.editor().css('max-height', '');
50
- }
51
-
52
- if (this.opts.minHeight)
53
- {
54
- this.core.editor().css('min-height', '');
55
- }
56
-
57
- if (!this.$fullscreenPlaceholder)
58
- {
59
- this.$fullscreenPlaceholder = $('<div/>');
60
- }
61
-
62
- this.$fullscreenPlaceholder.insertAfter(this.$box);
63
-
64
- this.core.box().appendTo(document.body);
65
- this.core.box().addClass('redactor-box-fullscreen');
66
-
67
- $('body').addClass('redactor-body-fullscreen');
68
- $('body, html').css('overflow', 'hidden');
69
-
70
- this.fullscreen.resize();
71
-
72
- if (!this.opts.fullscreen)
73
- {
74
- this.selection.restore();
75
- }
76
-
77
- this.toolbar.observeScrollDisable();
78
- $(window).on('resize.redactor-plugin-fullscreen', $.proxy(this.fullscreen.resize, this));
79
- $(document).scrollTop(0, 0);
80
-
81
- var self = this;
82
- setTimeout(function()
83
- {
84
- self.fullscreen.isOpened = true;
85
- }, 10);
86
-
87
- },
88
- disable: function()
89
- {
90
- this.button.setInactive('fullscreen');
91
- this.fullscreen.isOpened = undefined;
92
- this.fullscreen.isOpen = false;
93
- this.selection.save();
94
-
95
- $(window).off('resize.redactor-plugin-fullscreen');
96
- $('body, html').css('overflow', '');
97
-
98
- this.core.box().insertBefore(this.$fullscreenPlaceholder);
99
- this.$fullscreenPlaceholder.remove();
100
-
101
- this.core.box().removeClass('redactor-box-fullscreen').css({ width: 'auto', height: 'auto' });
102
- this.core.box().removeClass('redactor-box-fullscreen');
103
-
104
- if (this.opts.toolbarExternal)
105
- {
106
- this.core.box().css('top', this.fullscreen.boxcss.top);
107
- this.core.toolbar().css({
108
- 'width': this.fullscreen.toolcss.width,
109
- 'top': this.fullscreen.toolcss.top,
110
- 'position': this.fullscreen.toolcss.position
111
- });
112
- }
113
-
114
- if (this.opts.minHeight)
115
- {
116
- this.core.editor().css('minHeight', this.opts.minHeight);
117
- }
118
-
119
- if (this.opts.maxHeight)
120
- {
121
- this.core.editor().css('maxHeight', this.opts.maxHeight);
122
- }
123
-
124
- this.core.editor().css('height', 'auto');
125
- this.selection.restore();
126
- },
127
- toggle: function()
128
- {
129
- return (this.fullscreen.isOpen) ? this.fullscreen.disable() : this.fullscreen.enable();
130
- },
131
- resize: function()
132
- {
133
- if (!this.fullscreen.isOpen)
134
- {
135
- return;
136
- }
137
-
138
- var toolbarHeight = this.button.toolbar().height();
139
- var padding = parseInt(this.core.editor().css('padding-top')) + parseInt(this.core.editor().css('padding-bottom'));
140
- var height = $(window).height() - toolbarHeight - padding;
141
-
142
- this.core.box().width($(window).width()).height(height);
143
-
144
- if (this.opts.toolbarExternal)
145
- {
146
- this.core.toolbar().css({
147
- 'top': '0px',
148
- 'position': 'absolute',
149
- 'width': '100%'
150
- });
151
-
152
- this.core.box().css('top', toolbarHeight + 'px');
153
- }
154
-
155
- this.core.editor().height(height);
156
- }
157
- };
158
- };
159
- })(jQuery);
@@ -1,195 +0,0 @@
1
- (function($)
2
- {
3
- $.Redactor.prototype.source = function()
4
- {
5
- return {
6
- init: function()
7
- {
8
- var button = this.button.addFirst('html', 'HTML');
9
- this.button.addCallback(button, this.source.toggle);
10
-
11
- var style = {
12
- 'width': '100%',
13
- 'margin': '0',
14
- 'background': '#111',
15
- 'box-sizing': 'border-box',
16
- 'color': 'rgba(255, 255, 255, .8)',
17
- 'font-size': '14px',
18
- 'outline': 'none',
19
- 'padding': '16px',
20
- 'line-height': '22px',
21
- 'font-family': 'Menlo, Monaco, Consolas, "Courier New", monospace'
22
- };
23
-
24
- this.source.$textarea = $('<textarea />');
25
- this.source.$textarea.css(style).hide();
26
-
27
- if (this.opts.type === 'textarea')
28
- {
29
- this.core.box().append(this.source.$textarea);
30
- }
31
- else
32
- {
33
- this.core.box().after(this.source.$textarea);
34
- }
35
-
36
- this.core.element().on('destroy.callback.redactor', $.proxy(function()
37
- {
38
- this.source.$textarea.remove();
39
-
40
- }, this));
41
-
42
- },
43
- toggle: function()
44
- {
45
- return (this.source.$textarea.hasClass('open')) ? this.source.hide() : this.source.show();
46
- },
47
- setCaretOnShow: function()
48
- {
49
- this.source.offset = this.offset.get();
50
- var scroll = $(window).scrollTop();
51
-
52
- var width = this.core.editor().innerWidth();
53
- var height = this.core.editor().innerHeight();
54
-
55
- // caret position sync
56
- this.source.start = 0;
57
- this.source.end = 0;
58
- var $editorDiv = $("<div/>").append($.parseHTML(this.core.editor().html(), document, true));
59
- var $selectionMarkers = $editorDiv.find("span.redactor-selection-marker");
60
-
61
- if ($selectionMarkers.length > 0)
62
- {
63
- var editorHtml = $editorDiv.html().replace(/&amp;/g, '&');
64
-
65
- if ($selectionMarkers.length === 1)
66
- {
67
- this.source.start = this.utils.strpos(editorHtml, $editorDiv.find("#selection-marker-1").prop("outerHTML"));
68
- this.source.end = this.source.start;
69
- }
70
- else if ($selectionMarkers.length === 2)
71
- {
72
- this.source.start = this.utils.strpos(editorHtml, $editorDiv.find("#selection-marker-1").prop("outerHTML"));
73
- this.source.end = this.utils.strpos(editorHtml, $editorDiv.find("#selection-marker-2").prop("outerHTML")) - $editorDiv.find("#selection-marker-1").prop("outerHTML").toString().length;
74
- }
75
- }
76
-
77
- },
78
- setCaretOnHide: function(html)
79
- {
80
- this.source.start = this.source.$textarea.get(0).selectionStart;
81
- this.source.end = this.source.$textarea.get(0).selectionEnd;
82
-
83
- // if selection starts from end
84
- if (this.source.start > this.source.end && this.source.end > 0)
85
- {
86
- var tempStart = this.source.end;
87
- var tempEnd = this.source.start;
88
-
89
- this.source.start = tempStart;
90
- this.source.end = tempEnd;
91
- }
92
-
93
- this.source.start = this.source.enlargeOffset(html, this.source.start);
94
- this.source.end = this.source.enlargeOffset(html, this.source.end);
95
-
96
- html = html.substr(0, this.source.start) + this.marker.html(1) + html.substr(this.source.start);
97
-
98
- if (this.source.end > this.source.start)
99
- {
100
- var markerLength = this.marker.html(1).toString().length;
101
-
102
- html = html.substr(0, this.source.end + markerLength) + this.marker.html(2) + html.substr(this.source.end + markerLength);
103
- }
104
-
105
- return html;
106
-
107
- },
108
- hide: function()
109
- {
110
- this.source.$textarea.removeClass('open').hide();
111
- this.source.$textarea.off('.redactor-source');
112
-
113
- var code = this.source.$textarea.val();
114
-
115
- code = this.paragraphize.load(code);
116
- code = this.source.setCaretOnHide(code);
117
-
118
- this.code.start(code);
119
- this.button.enableAll();
120
- this.core.editor().show().focus();
121
- this.selection.restore();
122
- this.code.sync();
123
- },
124
- show: function()
125
- {
126
- this.selection.save();
127
- this.source.setCaretOnShow();
128
-
129
- var height = this.core.editor().innerHeight();
130
- var code = this.code.get();
131
-
132
- code = code.replace(/\n\n\n/g, "\n");
133
- code = code.replace(/\n\n/g, "\n");
134
-
135
- this.core.editor().hide();
136
- this.button.disableAll('html');
137
- this.source.$textarea.val(code).height(height).addClass('open').show();
138
- this.source.$textarea.on('keyup.redactor-source', $.proxy(function()
139
- {
140
- if (this.opts.type === 'textarea')
141
- {
142
- this.core.textarea().val(this.source.$textarea.val());
143
- }
144
-
145
- }, this));
146
-
147
- this.marker.remove();
148
-
149
- $(window).scrollTop(scroll);
150
-
151
- if (this.source.$textarea[0].setSelectionRange)
152
- {
153
- this.source.$textarea[0].setSelectionRange(this.source.start, this.source.end);
154
- }
155
-
156
- this.source.$textarea[0].scrollTop = 0;
157
-
158
- setTimeout($.proxy(function()
159
- {
160
- this.source.$textarea.focus();
161
-
162
- }, this), 0);
163
- },
164
- enlargeOffset: function(html, offset)
165
- {
166
- var htmlLength = html.length;
167
- var c = 0;
168
-
169
- if (html[offset] === '>')
170
- {
171
- c++;
172
- }
173
- else
174
- {
175
- for(var i = offset; i <= htmlLength; i++)
176
- {
177
- c++;
178
-
179
- if (html[i] === '>')
180
- {
181
- break;
182
- }
183
- else if (html[i] === '<' || i === htmlLength)
184
- {
185
- c = 0;
186
- break;
187
- }
188
- }
189
- }
190
-
191
- return offset + c;
192
- }
193
- };
194
- };
195
- })(jQuery);
@@ -1,36 +0,0 @@
1
- (function($)
2
- {
3
- $.Redactor.prototype.textdirection = function()
4
- {
5
- return {
6
- langs: {
7
- en: {
8
- "change-text-direction": "RTL-LTR",
9
- "left-to-right": "Left to Right",
10
- "right-to-left": "Right to Left"
11
- }
12
- },
13
- init: function()
14
- {
15
- var that = this;
16
- var dropdown = {};
17
-
18
- dropdown.ltr = { title: that.lang.get('left-to-right'), func: that.textdirection.setLtr };
19
- dropdown.rtl = { title: that.lang.get('right-to-left'), func: that.textdirection.setRtl };
20
-
21
- var button = this.button.add('textdirection', this.lang.get('change-text-direction'));
22
- this.button.addDropdown(button, dropdown);
23
- },
24
- setRtl: function()
25
- {
26
- this.buffer.set();
27
- this.block.addAttr('dir', 'rtl');
28
- },
29
- setLtr: function()
30
- {
31
- this.buffer.set();
32
- this.block.removeAttr('dir');
33
- }
34
- };
35
- };
36
- })(jQuery);
@@ -1,4 +0,0 @@
1
- //= require ./plugins/clips
2
- //= require ./plugins/fullscreen
3
- //= require ./plugins/source
4
- //= require ./plugins/textdirection