annex-cms 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/annex/cms.js.coffee +12 -1
- data/app/assets/javascripts/annex/jquery.redactor.clips.js +49 -45
- data/app/assets/javascripts/annex/jquery.redactor.definedlinks.js +50 -0
- data/app/assets/javascripts/annex/jquery.redactor.filemanager.js +59 -0
- data/app/assets/javascripts/annex/jquery.redactor.fontcolor.js +73 -0
- data/app/assets/javascripts/annex/jquery.redactor.fontsize.js +31 -0
- data/app/assets/javascripts/annex/jquery.redactor.fullscreen.js +79 -103
- data/app/assets/javascripts/annex/jquery.redactor.imagemanager.js +54 -0
- data/app/assets/javascripts/annex/jquery.redactor.js +6443 -5869
- data/app/assets/javascripts/annex/jquery.redactor.save.js +52 -53
- data/app/assets/javascripts/annex/jquery.redactor.table.js +330 -0
- data/app/assets/javascripts/annex/jquery.redactor.video.js +70 -0
- data/app/assets/javascripts/annex.js.coffee +9 -2
- data/app/assets/stylesheets/annex/redactor.css.scss +804 -544
- data/app/models/annex/block.rb +5 -0
- data/app/views/annex/_block.html.haml +1 -1
- data/lib/annex/version.rb +1 -1
- data/lib/annex/view_helpers.rb +1 -5
- metadata +9 -3
- data/app/views/annex/_clips.html.haml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dd1aaadb3163699a61419ca7fd4a908081037b9
|
4
|
+
data.tar.gz: 22c3579dc3afb0195f90fbe4e6d096a6c208e017
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c38cd76f107273fe24404e4a1e51644baad9739d8bd1a802109c222230a54ea85c146fb80e14cb91eaab428e3c9fb89bf409c48d3bd9aa093d133db9f525f3d
|
7
|
+
data.tar.gz: 1ae3c1945ba1bca1a2007837ef3a752daf028105616a612abf4569a2092dca44a7a03d11c9c74d6b6e237fab863c555b03e24f9e559cb198903145cd04ab88ed
|
@@ -8,10 +8,21 @@ ready = ->
|
|
8
8
|
|
9
9
|
# on click of .redactor, fire up a redactor instance
|
10
10
|
$("body").on "click", ".redactor", ->
|
11
|
-
unless $(this).hasClass("
|
11
|
+
unless $(this).hasClass("redactor-editor")
|
12
12
|
$(this).redactor
|
13
13
|
focus: true
|
14
|
+
imageUpload: '/annex/upload'
|
15
|
+
imageManagerJson: '/annex/upload/images.json'
|
16
|
+
fileUpload: '/annex/upload'
|
17
|
+
fileManagerJson: '/annex/upload/files.json'
|
14
18
|
plugins: [
|
19
|
+
"definedlinks"
|
20
|
+
"fontsize"
|
21
|
+
"fontcolor"
|
22
|
+
"table"
|
23
|
+
"filemanager"
|
24
|
+
"imagemanager"
|
25
|
+
"video"
|
15
26
|
"clips"
|
16
27
|
"fullscreen"
|
17
28
|
"save"
|
@@ -1,56 +1,60 @@
|
|
1
1
|
if (!RedactorPlugins) var RedactorPlugins = {};
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if ('selectionStart' in el) {
|
8
|
-
pos = el.selectionStart;
|
9
|
-
} else if ('selection' in document) {
|
10
|
-
el.focus();
|
11
|
-
var Sel = document.selection.createRange();
|
12
|
-
var SelLength = document.selection.createRange().text.length;
|
13
|
-
Sel.moveStart('character', -el.value.length);
|
14
|
-
pos = Sel.text.length - SelLength;
|
15
|
-
}
|
16
|
-
return pos;
|
17
|
-
}
|
18
|
-
})(jQuery);
|
19
|
-
|
20
|
-
// When i come back to it, we'll want to use the plugin above to log the cursor position
|
21
|
-
// before the modal is triggered and the position is lost.
|
22
|
-
// $(this).getCursorPosition());
|
23
|
-
|
24
|
-
RedactorPlugins.clips = {
|
25
|
-
init: function()
|
26
|
-
{
|
27
|
-
var callback = $.proxy(function()
|
3
|
+
RedactorPlugins.clips = function()
|
4
|
+
{
|
5
|
+
return {
|
6
|
+
init: function()
|
28
7
|
{
|
29
|
-
|
8
|
+
var items = [
|
9
|
+
['Lorem ipsum...', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.']
|
10
|
+
];
|
11
|
+
|
12
|
+
this.clips.template = $('<ul id="redactor-modal-list">');
|
13
|
+
|
14
|
+
for (var i = 0; i < items.length; i++)
|
30
15
|
{
|
31
|
-
$(
|
32
|
-
|
33
|
-
|
34
|
-
return false;
|
16
|
+
var li = $('<li>');
|
17
|
+
var a = $('<a href="#" class="redactor-clip-link">').text(items[i][0]);
|
18
|
+
var div = $('<div class="redactor-clip">').hide().html(items[i][1]);
|
35
19
|
|
36
|
-
|
37
|
-
|
20
|
+
li.append(a);
|
21
|
+
li.append(div);
|
22
|
+
this.clips.template.append(li);
|
23
|
+
}
|
38
24
|
|
39
|
-
this.
|
40
|
-
|
25
|
+
this.modal.addTemplate('clips', '<section>' + this.utils.getOuterHtml(this.clips.template) + '</section>');
|
26
|
+
|
27
|
+
var button = this.button.add('clips', 'Clips');
|
28
|
+
this.button.addCallback(button, this.clips.show);
|
29
|
+
|
30
|
+
},
|
31
|
+
show: function()
|
32
|
+
{
|
33
|
+
this.modal.load('clips', 'Insert Clips', 400);
|
41
34
|
|
42
|
-
|
35
|
+
this.modal.createCancelButton();
|
43
36
|
|
44
|
-
|
37
|
+
$('#redactor-modal-list').find('.redactor-clip-link').each($.proxy(this.clips.load, this));
|
38
|
+
|
39
|
+
this.selection.save();
|
40
|
+
this.modal.show();
|
41
|
+
},
|
42
|
+
load: function(i,s)
|
43
|
+
{
|
44
|
+
$(s).on('click', $.proxy(function(e)
|
45
|
+
{
|
46
|
+
e.preventDefault();
|
47
|
+
this.clips.insert($(s).next().html());
|
48
|
+
|
49
|
+
}, this));
|
50
|
+
},
|
51
|
+
insert: function(html)
|
45
52
|
{
|
46
|
-
this.
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
this.insertHtml($.trim(html));
|
53
|
-
this.modalClose();
|
54
|
-
}
|
53
|
+
this.selection.restore();
|
54
|
+
this.insert.html(html);
|
55
|
+
this.modal.close();
|
56
|
+
this.observe.load();
|
57
|
+
}
|
58
|
+
};
|
55
59
|
};
|
56
60
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
if (!RedactorPlugins) var RedactorPlugins = {};
|
2
|
+
|
3
|
+
RedactorPlugins.definedlinks = function()
|
4
|
+
{
|
5
|
+
return {
|
6
|
+
init: function()
|
7
|
+
{
|
8
|
+
if (!this.opts.definedLinks) return;
|
9
|
+
|
10
|
+
this.modal.addCallback('link', $.proxy(this.definedlinks.load, this));
|
11
|
+
|
12
|
+
},
|
13
|
+
load: function()
|
14
|
+
{
|
15
|
+
var $select = $('<select id="redactor-defined-links" />');
|
16
|
+
$('#redactor-modal-link-insert').prepend($select);
|
17
|
+
|
18
|
+
this.definedlinks.storage = {};
|
19
|
+
|
20
|
+
$.getJSON(this.opts.definedLinks, $.proxy(function(data)
|
21
|
+
{
|
22
|
+
$.each(data, $.proxy(function(key, val)
|
23
|
+
{
|
24
|
+
this.definedlinks.storage[key] = val;
|
25
|
+
$select.append($('<option>').val(key).html(val.name));
|
26
|
+
|
27
|
+
}, this));
|
28
|
+
|
29
|
+
$select.on('change', $.proxy(this.definedlinks.select, this));
|
30
|
+
|
31
|
+
}, this));
|
32
|
+
|
33
|
+
},
|
34
|
+
select: function(e)
|
35
|
+
{
|
36
|
+
var key = $(e.target).val();
|
37
|
+
var name = '', url = '';
|
38
|
+
if (key !== 0)
|
39
|
+
{
|
40
|
+
name = this.definedlinks.storage[key].name;
|
41
|
+
url = this.definedlinks.storage[key].url;
|
42
|
+
}
|
43
|
+
|
44
|
+
$('#redactor-link-url').val(url);
|
45
|
+
|
46
|
+
var $el = $('#redactor-link-url-text');
|
47
|
+
if ($el.val() === '') $el.val(name);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
};
|
@@ -0,0 +1,59 @@
|
|
1
|
+
if (!RedactorPlugins) var RedactorPlugins = {};
|
2
|
+
|
3
|
+
RedactorPlugins.filemanager = function()
|
4
|
+
{
|
5
|
+
return {
|
6
|
+
init: function()
|
7
|
+
{
|
8
|
+
if (!this.opts.fileManagerJson) return;
|
9
|
+
|
10
|
+
this.modal.addCallback('file', this.filemanager.load);
|
11
|
+
},
|
12
|
+
load: function()
|
13
|
+
{
|
14
|
+
var $modal = this.modal.getModal();
|
15
|
+
|
16
|
+
this.modal.createTabber($modal);
|
17
|
+
this.modal.addTab(1, 'Upload', 'active');
|
18
|
+
this.modal.addTab(2, 'Choose');
|
19
|
+
|
20
|
+
$('#redactor-modal-file-upload-box').addClass('redactor-tab redactor-tab1');
|
21
|
+
|
22
|
+
var $box = $('<div id="redactor-file-manager-box" style="overflow: auto; height: 300px;" class="redactor-tab redactor-tab2">').hide();
|
23
|
+
$modal.append($box);
|
24
|
+
|
25
|
+
|
26
|
+
$.ajax({
|
27
|
+
dataType: "json",
|
28
|
+
cache: false,
|
29
|
+
url: this.opts.fileManagerJson,
|
30
|
+
success: $.proxy(function(data)
|
31
|
+
{
|
32
|
+
var ul = $('<ul id="redactor-modal-list">');
|
33
|
+
$.each(data, $.proxy(function(key, val)
|
34
|
+
{
|
35
|
+
var a = $('<a href="#" title="' + val.title + '" rel="' + val.link + '">' + val.title + ' <span style="font-size: 11px; color: #888;">' + val.name + '</span> <span style="position: absolute; right: 10px; font-size: 11px; color: #888;">(' + val.size + ')</span></a>');
|
36
|
+
var li = $('<li />');
|
37
|
+
|
38
|
+
a.on('click', $.proxy(this.filemanager.insert, this));
|
39
|
+
|
40
|
+
li.append(a);
|
41
|
+
ul.append(li);
|
42
|
+
|
43
|
+
}, this));
|
44
|
+
|
45
|
+
$('#redactor-file-manager-box').append(ul);
|
46
|
+
|
47
|
+
|
48
|
+
}, this)
|
49
|
+
});
|
50
|
+
|
51
|
+
},
|
52
|
+
insert: function(e)
|
53
|
+
{
|
54
|
+
e.preventDefault();
|
55
|
+
|
56
|
+
this.file.insert('<a href="' + $(e.target).attr('rel') + '">' + $(e.target).attr('title') + '</a>');
|
57
|
+
}
|
58
|
+
};
|
59
|
+
};
|
@@ -0,0 +1,73 @@
|
|
1
|
+
if (!RedactorPlugins) var RedactorPlugins = {};
|
2
|
+
|
3
|
+
RedactorPlugins.fontcolor = function()
|
4
|
+
{
|
5
|
+
return {
|
6
|
+
init: function()
|
7
|
+
{
|
8
|
+
var colors = [
|
9
|
+
'#ffffff', '#000000', '#eeece1', '#1f497d', '#4f81bd', '#c0504d', '#9bbb59', '#8064a2', '#4bacc6', '#f79646', '#ffff00',
|
10
|
+
'#f2f2f2', '#7f7f7f', '#ddd9c3', '#c6d9f0', '#dbe5f1', '#f2dcdb', '#ebf1dd', '#e5e0ec', '#dbeef3', '#fdeada', '#fff2ca',
|
11
|
+
'#d8d8d8', '#595959', '#c4bd97', '#8db3e2', '#b8cce4', '#e5b9b7', '#d7e3bc', '#ccc1d9', '#b7dde8', '#fbd5b5', '#ffe694',
|
12
|
+
'#bfbfbf', '#3f3f3f', '#938953', '#548dd4', '#95b3d7', '#d99694', '#c3d69b', '#b2a2c7', '#b7dde8', '#fac08f', '#f2c314',
|
13
|
+
'#a5a5a5', '#262626', '#494429', '#17365d', '#366092', '#953734', '#76923c', '#5f497a', '#92cddc', '#e36c09', '#c09100',
|
14
|
+
'#7f7f7f', '#0c0c0c', '#1d1b10', '#0f243e', '#244061', '#632423', '#4f6128', '#3f3151', '#31859b', '#974806', '#7f6000'
|
15
|
+
];
|
16
|
+
|
17
|
+
var buttons = ['fontcolor', 'backcolor'];
|
18
|
+
|
19
|
+
for (var i = 0; i < 2; i++)
|
20
|
+
{
|
21
|
+
var name = buttons[i];
|
22
|
+
|
23
|
+
var button = this.button.add(name, this.lang.get(name));
|
24
|
+
var $dropdown = this.button.addDropdown(button);
|
25
|
+
|
26
|
+
$dropdown.width(242);
|
27
|
+
this.fontcolor.buildPicker($dropdown, name, colors);
|
28
|
+
|
29
|
+
}
|
30
|
+
},
|
31
|
+
buildPicker: function($dropdown, name, colors)
|
32
|
+
{
|
33
|
+
var rule = (name == 'backcolor') ? 'background-color' : 'color';
|
34
|
+
|
35
|
+
var len = colors.length;
|
36
|
+
var self = this;
|
37
|
+
var func = function(e)
|
38
|
+
{
|
39
|
+
e.preventDefault();
|
40
|
+
self.fontcolor.set($(this).data('rule'), $(this).attr('rel'));
|
41
|
+
};
|
42
|
+
|
43
|
+
for (var z = 0; z < len; z++)
|
44
|
+
{
|
45
|
+
var color = colors[z];
|
46
|
+
|
47
|
+
var $swatch = $('<a rel="' + color + '" data-rule="' + rule +'" href="#" style="float: left; font-size: 0; border: 2px solid #fff; padding: 0; margin: 0; width: 22px; height: 22px;"></a>');
|
48
|
+
$swatch.css('background-color', color);
|
49
|
+
$swatch.on('click', func);
|
50
|
+
|
51
|
+
$dropdown.append($swatch);
|
52
|
+
}
|
53
|
+
|
54
|
+
var $elNone = $('<a href="#" style="display: block; clear: both; padding: 5px; font-size: 12px; line-height: 1;"></a>').html(this.lang.get('none'));
|
55
|
+
$elNone.on('click', $.proxy(function(e)
|
56
|
+
{
|
57
|
+
e.preventDefault();
|
58
|
+
this.fontcolor.remove(rule);
|
59
|
+
|
60
|
+
}, this));
|
61
|
+
|
62
|
+
$dropdown.append($elNone);
|
63
|
+
},
|
64
|
+
set: function(rule, type)
|
65
|
+
{
|
66
|
+
this.inline.format('span', 'style', rule + ': ' + type + ';');
|
67
|
+
},
|
68
|
+
remove: function(rule)
|
69
|
+
{
|
70
|
+
this.inline.removeStyleRule(rule);
|
71
|
+
}
|
72
|
+
};
|
73
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
if (!RedactorPlugins) var RedactorPlugins = {};
|
2
|
+
|
3
|
+
RedactorPlugins.fontsize = function()
|
4
|
+
{
|
5
|
+
return {
|
6
|
+
init: function()
|
7
|
+
{
|
8
|
+
var fonts = [10, 11, 12, 14, 16, 18, 20, 24, 28, 30];
|
9
|
+
var that = this;
|
10
|
+
var dropdown = {};
|
11
|
+
|
12
|
+
$.each(fonts, function(i, s)
|
13
|
+
{
|
14
|
+
dropdown['s' + i] = { title: s + 'px', func: function() { that.fontsize.set(s); } };
|
15
|
+
});
|
16
|
+
|
17
|
+
dropdown.remove = { title: 'Remove Font Size', func: that.fontsize.reset };
|
18
|
+
|
19
|
+
var button = this.button.add('fontsize', 'Change Font Size');
|
20
|
+
this.button.addDropdown(button, dropdown);
|
21
|
+
},
|
22
|
+
set: function(size)
|
23
|
+
{
|
24
|
+
this.inline.format('span', 'style', 'font-size: ' + size + 'px;');
|
25
|
+
},
|
26
|
+
reset: function()
|
27
|
+
{
|
28
|
+
this.inline.removeStyleRule('font-size');
|
29
|
+
}
|
30
|
+
};
|
31
|
+
};
|
@@ -1,142 +1,118 @@
|
|
1
1
|
if (!RedactorPlugins) var RedactorPlugins = {};
|
2
2
|
|
3
|
-
RedactorPlugins.fullscreen =
|
4
|
-
|
5
|
-
{
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
this.buttonSetRight('fullscreen');
|
3
|
+
RedactorPlugins.fullscreen = function()
|
4
|
+
{
|
5
|
+
return {
|
6
|
+
init: function()
|
7
|
+
{
|
8
|
+
this.fullscreen.isOpen = false;
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
toggleFullscreen: function()
|
14
|
-
{
|
15
|
-
var html;
|
10
|
+
var button = this.button.add('fullscreen', 'Fullscreen');
|
11
|
+
this.button.addCallback(button, this.fullscreen.toggle);
|
16
12
|
|
17
|
-
|
13
|
+
if (this.opts.fullscreen) this.fullscreen.toggle();
|
14
|
+
},
|
15
|
+
enable: function()
|
18
16
|
{
|
19
|
-
this.
|
20
|
-
this.
|
21
|
-
this.fullscreen = true;
|
17
|
+
this.button.changeIcon('fullscreen', 'normalscreen');
|
18
|
+
this.button.setActive('fullscreen');
|
19
|
+
this.fullscreen.isOpen = true;
|
22
20
|
|
23
21
|
if (this.opts.toolbarExternal)
|
24
22
|
{
|
25
|
-
this.toolcss = {};
|
26
|
-
this.boxcss = {};
|
27
|
-
this.toolcss.width = this.$toolbar.css('width');
|
28
|
-
this.toolcss.top = this.$toolbar.css('top');
|
29
|
-
this.toolcss.position = this.$toolbar.css('position');
|
30
|
-
this.boxcss.top = this.$box.css('top');
|
23
|
+
this.fullscreen.toolcss = {};
|
24
|
+
this.fullscreen.boxcss = {};
|
25
|
+
this.fullscreen.toolcss.width = this.$toolbar.css('width');
|
26
|
+
this.fullscreen.toolcss.top = this.$toolbar.css('top');
|
27
|
+
this.fullscreen.toolcss.position = this.$toolbar.css('position');
|
28
|
+
this.fullscreen.boxcss.top = this.$box.css('top');
|
31
29
|
}
|
32
30
|
|
33
|
-
this.
|
31
|
+
this.fullscreen.height = this.$editor.height();
|
34
32
|
|
35
33
|
if (this.opts.maxHeight) this.$editor.css('max-height', '');
|
36
|
-
if (this.opts.
|
34
|
+
if (this.opts.minHeight) this.$editor.css('min-height', '');
|
37
35
|
|
38
|
-
this.$
|
39
|
-
|
36
|
+
if (!this.$fullscreenPlaceholder) this.$fullscreenPlaceholder = $('<div/>');
|
37
|
+
this.$fullscreenPlaceholder.insertAfter(this.$box);
|
40
38
|
|
41
|
-
|
39
|
+
this.$box.appendTo(document.body);
|
42
40
|
|
43
|
-
this.
|
44
|
-
$(
|
45
|
-
$(document).scrollTop(0, 0);
|
41
|
+
this.$box.addClass('redactor-box-fullscreen');
|
42
|
+
$('body, html').css('overflow', 'hidden');
|
46
43
|
|
47
|
-
this.
|
48
|
-
this.
|
44
|
+
this.fullscreen.resize();
|
45
|
+
$(window).on('resize.redactor.fullscreen', $.proxy(this.fullscreen.resize, this));
|
46
|
+
$(document).scrollTop(0, 0);
|
49
47
|
|
50
|
-
|
51
|
-
|
48
|
+
this.$editor.focus();
|
49
|
+
this.observe.load();
|
50
|
+
},
|
51
|
+
disable: function()
|
52
52
|
{
|
53
|
-
this.
|
54
|
-
this.
|
55
|
-
this.fullscreen = false;
|
53
|
+
this.button.removeIcon('fullscreen', 'normalscreen');
|
54
|
+
this.button.setInactive('fullscreen');
|
55
|
+
this.fullscreen.isOpen = false;
|
56
56
|
|
57
|
-
$(window).off('resize'
|
57
|
+
$(window).off('resize.redactor.fullscreen');
|
58
58
|
$('body, html').css('overflow', '');
|
59
59
|
|
60
|
-
this.$box.
|
61
|
-
|
62
|
-
if (this.opts.iframe) html = this.$editor.html();
|
60
|
+
this.$box.insertBefore(this.$fullscreenPlaceholder);
|
61
|
+
this.$fullscreenPlaceholder.remove();
|
63
62
|
|
64
|
-
|
65
|
-
else this.sync();
|
63
|
+
this.$box.removeClass('redactor-box-fullscreen').css({ width: 'auto', height: 'auto' });
|
66
64
|
|
67
|
-
|
68
|
-
if (this.opts.autoresize) height = 'auto';
|
69
|
-
if (this.opts.maxHeight) this.$editor.css('max-height', this.opts.maxHeight);
|
65
|
+
this.code.sync();
|
70
66
|
|
71
67
|
if (this.opts.toolbarExternal)
|
72
68
|
{
|
73
|
-
this.$box.css('top', this.boxcss.top);
|
69
|
+
this.$box.css('top', this.fullscreen.boxcss.top);
|
74
70
|
this.$toolbar.css({
|
75
|
-
'width': this.toolcss.width,
|
76
|
-
'top': this.toolcss.top,
|
77
|
-
'position': this.toolcss.position
|
71
|
+
'width': this.fullscreen.toolcss.width,
|
72
|
+
'top': this.fullscreen.toolcss.top,
|
73
|
+
'position': this.fullscreen.toolcss.position
|
78
74
|
});
|
79
75
|
}
|
80
76
|
|
81
|
-
if (
|
82
|
-
|
77
|
+
if (this.opts.minHeight) this.$editor.css('minHeight', this.opts.minHeight);
|
78
|
+
if (this.opts.maxHeight) this.$editor.css('maxHeight', this.opts.maxHeight);
|
83
79
|
|
84
|
-
this.$editor.css('height',
|
85
|
-
this.focus();
|
86
|
-
this.
|
87
|
-
}
|
88
|
-
|
89
|
-
fullscreenIframe: function(html)
|
90
|
-
{
|
91
|
-
this.$editor = this.$frame.contents().find('body');
|
92
|
-
this.$editor.attr({ 'contenteditable': true, 'dir': this.opts.direction });
|
93
|
-
|
94
|
-
// set document & window
|
95
|
-
if (this.$editor[0])
|
80
|
+
this.$editor.css('height', 'auto');
|
81
|
+
this.$editor.focus();
|
82
|
+
this.observe.load();
|
83
|
+
},
|
84
|
+
toggle: function()
|
96
85
|
{
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
if (this.opts.wym) this.$editor.addClass('redactor_editor_wym');
|
108
|
-
},
|
109
|
-
fullScreenResize: function()
|
110
|
-
{
|
111
|
-
if (!this.fullscreen) return false;
|
112
|
-
|
113
|
-
var toolbarHeight = this.$toolbar.height();
|
114
|
-
|
115
|
-
var pad = this.$editor.css('padding-top').replace('px', '');
|
116
|
-
var height = $(window).height() - toolbarHeight;
|
117
|
-
this.$box.width($(window).width() - 2).height(height + toolbarHeight);
|
118
|
-
|
119
|
-
if (this.opts.toolbarExternal)
|
86
|
+
if (this.fullscreen.isOpen)
|
87
|
+
{
|
88
|
+
this.fullscreen.disable();
|
89
|
+
}
|
90
|
+
else
|
91
|
+
{
|
92
|
+
this.fullscreen.enable();
|
93
|
+
}
|
94
|
+
},
|
95
|
+
resize: function()
|
120
96
|
{
|
121
|
-
this
|
122
|
-
'top': '0px',
|
123
|
-
'position': 'absolute',
|
124
|
-
'width': '100%'
|
125
|
-
});
|
97
|
+
if (!this.fullscreen.isOpen) return;
|
126
98
|
|
127
|
-
this.$
|
128
|
-
}
|
99
|
+
var toolbarHeight = this.$toolbar.height();
|
129
100
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
101
|
+
var height = $(window).height() - toolbarHeight;
|
102
|
+
this.$box.width($(window).width() - 2).height(height + toolbarHeight);
|
103
|
+
|
104
|
+
if (this.opts.toolbarExternal)
|
134
105
|
{
|
135
|
-
this.$
|
106
|
+
this.$toolbar.css({
|
107
|
+
'top': '0px',
|
108
|
+
'position': 'absolute',
|
109
|
+
'width': '100%'
|
110
|
+
});
|
136
111
|
|
137
|
-
|
138
|
-
|
112
|
+
this.$box.css('top', toolbarHeight + 'px');
|
113
|
+
}
|
139
114
|
|
140
|
-
|
141
|
-
|
115
|
+
this.$editor.height(height - 14);
|
116
|
+
}
|
117
|
+
};
|
142
118
|
};
|
@@ -0,0 +1,54 @@
|
|
1
|
+
if (!RedactorPlugins) var RedactorPlugins = {};
|
2
|
+
|
3
|
+
RedactorPlugins.imagemanager = function()
|
4
|
+
{
|
5
|
+
return {
|
6
|
+
init: function()
|
7
|
+
{
|
8
|
+
if (!this.opts.imageManagerJson) return;
|
9
|
+
|
10
|
+
this.modal.addCallback('image', this.imagemanager.load);
|
11
|
+
},
|
12
|
+
load: function()
|
13
|
+
{
|
14
|
+
var $modal = this.modal.getModal();
|
15
|
+
|
16
|
+
this.modal.createTabber($modal);
|
17
|
+
this.modal.addTab(1, 'Upload', 'active');
|
18
|
+
this.modal.addTab(2, 'Choose');
|
19
|
+
|
20
|
+
$('#redactor-modal-image-droparea').addClass('redactor-tab redactor-tab1');
|
21
|
+
|
22
|
+
var $box = $('<div id="redactor-image-manager-box" style="overflow: auto; height: 300px;" class="redactor-tab redactor-tab2">').hide();
|
23
|
+
$modal.append($box);
|
24
|
+
|
25
|
+
$.ajax({
|
26
|
+
dataType: "json",
|
27
|
+
cache: false,
|
28
|
+
url: this.opts.imageManagerJson,
|
29
|
+
success: $.proxy(function(data)
|
30
|
+
{
|
31
|
+
$.each(data, $.proxy(function(key, val)
|
32
|
+
{
|
33
|
+
// title
|
34
|
+
var thumbtitle = '';
|
35
|
+
if (typeof val.title !== 'undefined') thumbtitle = val.title;
|
36
|
+
|
37
|
+
var img = $('<img src="' + val.thumb + '" rel="' + val.image + '" title="' + thumbtitle + '" style="width: 100px; height: 75px; cursor: pointer;" />');
|
38
|
+
$('#redactor-image-manager-box').append(img);
|
39
|
+
$(img).click($.proxy(this.imagemanager.insert, this));
|
40
|
+
|
41
|
+
}, this));
|
42
|
+
|
43
|
+
|
44
|
+
}, this)
|
45
|
+
});
|
46
|
+
|
47
|
+
|
48
|
+
},
|
49
|
+
insert: function(e)
|
50
|
+
{
|
51
|
+
this.image.insert('<img src="' + $(e.target).attr('rel') + '" alt="' + $(e.target).attr('title') + '">');
|
52
|
+
}
|
53
|
+
};
|
54
|
+
};
|