').hide().html(items[i][1]);
- li.append(a);
- li.append(div);
- this.clips.template.append(li);
- }
+ li.append(a);
+ li.append(div);
+ this.clips.template.append(li);
+ }
- this.modal.addTemplate('clips', '
' + this.utils.getOuterHtml(this.clips.template) + '');
+ this.modal.addTemplate('clips', '
' + this.utils.getOuterHtml(this.clips.template) + '');
- var button = this.button.add('clips', 'Clips');
- this.button.addCallback(button, this.clips.show);
+ var button = this.button.add('clips', 'Clips');
+ this.button.addCallback(button, this.clips.show);
- },
- show: function()
- {
- this.modal.load('clips', 'Insert Clips', 400);
+ },
+ show: function()
+ {
+ this.modal.load('clips', 'Insert Clips', 400);
- this.modal.createCancelButton();
+ this.modal.createCancelButton();
- $('#redactor-modal-list').find('.redactor-clip-link').each($.proxy(this.clips.load, this));
+ $('#redactor-modal-list').find('.redactor-clip-link').each($.proxy(this.clips.load, this));
- this.selection.save();
- this.modal.show();
- },
- load: function(i,s)
- {
- $(s).on('click', $.proxy(function(e)
+ this.selection.save();
+ this.modal.show();
+ },
+ load: function(i,s)
+ {
+ $(s).on('click', $.proxy(function(e)
+ {
+ e.preventDefault();
+ this.clips.insert($(s).next().html());
+
+ }, this));
+ },
+ insert: function(html)
{
- e.preventDefault();
- this.clips.insert($(s).next().html());
-
- }, this));
- },
- insert: function(html)
- {
- this.selection.restore();
- this.insert.html(html);
- this.modal.close();
- this.observe.load();
- }
+ this.selection.restore();
+ this.insert.html(html);
+ this.modal.close();
+ this.observe.load();
+ }
+ };
};
-};
+})(jQuery);
diff --git a/assets/plugins/counter/counter.js b/assets/plugins/counter/counter.js
index 391c19e..109b630 100644
--- a/assets/plugins/counter/counter.js
+++ b/assets/plugins/counter/counter.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.counter = function()
+ $.Redactor.prototype.counter = function()
{
return {
init: function()
@@ -18,8 +16,8 @@ if (!RedactorPlugins) var RedactorPlugins = {};
var text = html.replace(/<\/(.*?)>/gi, ' ');
text = text.replace(/<(.*?)>/gi, '');
text = text.replace(/\t/gi, '');
- text = text.replace(/\n/gi, '');
- text = text.replace(/\r/gi, '');
+ text = text.replace(/\n/gi, ' ');
+ text = text.replace(/\r/gi, ' ');
text = $.trim(text);
if (text !== '')
diff --git a/assets/plugins/definedlinks/definedlinks.js b/assets/plugins/definedlinks/definedlinks.js
index 962a95d..6c8fe50 100644
--- a/assets/plugins/definedlinks/definedlinks.js
+++ b/assets/plugins/definedlinks/definedlinks.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.definedlinks = function()
+ $.Redactor.prototype.definedlinks = function()
{
return {
init: function()
diff --git a/assets/plugins/filemanager/filemanager.js b/assets/plugins/filemanager/filemanager.js
index 5ba5cf5..fd5b1f4 100644
--- a/assets/plugins/filemanager/filemanager.js
+++ b/assets/plugins/filemanager/filemanager.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.filemanager = function()
+ $.Redactor.prototype.filemanager = function()
{
return {
init: function()
diff --git a/assets/plugins/fontcolor/fontcolor.js b/assets/plugins/fontcolor/fontcolor.js
index b212464..89f0d2a 100755
--- a/assets/plugins/fontcolor/fontcolor.js
+++ b/assets/plugins/fontcolor/fontcolor.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.fontcolor = function()
+ $.Redactor.prototype.fontcolor = function()
{
return {
init: function()
diff --git a/assets/plugins/fontfamily/fontfamily.js b/assets/plugins/fontfamily/fontfamily.js
index c657b0d..0af93db 100755
--- a/assets/plugins/fontfamily/fontfamily.js
+++ b/assets/plugins/fontfamily/fontfamily.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.fontfamily = function()
+ $.Redactor.prototype.fontfamily = function()
{
return {
init: function ()
diff --git a/assets/plugins/fontsize/fontsize.js b/assets/plugins/fontsize/fontsize.js
index 03a5ebf..7b49c0c 100755
--- a/assets/plugins/fontsize/fontsize.js
+++ b/assets/plugins/fontsize/fontsize.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.fontsize = function()
+ $.Redactor.prototype.fontsize = function()
{
return {
init: function()
diff --git a/assets/plugins/fullscreen/fullscreen.js b/assets/plugins/fullscreen/fullscreen.js
index 55175dc..94e5051 100755
--- a/assets/plugins/fullscreen/fullscreen.js
+++ b/assets/plugins/fullscreen/fullscreen.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.fullscreen = function()
+ $.Redactor.prototype.fullscreen = function()
{
return {
init: function()
diff --git a/assets/plugins/imagemanager/imagemanager.js b/assets/plugins/imagemanager/imagemanager.js
index ce0db2e..7dafa5c 100644
--- a/assets/plugins/imagemanager/imagemanager.js
+++ b/assets/plugins/imagemanager/imagemanager.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.imagemanager = function()
+ $.Redactor.prototype.imagemanager = function()
{
return {
init: function()
diff --git a/assets/plugins/limiter/limiter.js b/assets/plugins/limiter/limiter.js
index f767f42..031e52d 100644
--- a/assets/plugins/limiter/limiter.js
+++ b/assets/plugins/limiter/limiter.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.limiter = function()
+ $.Redactor.prototype.limiter = function()
{
return {
init: function()
diff --git a/assets/plugins/table/table.js b/assets/plugins/table/table.js
index aecf951..ea604ce 100644
--- a/assets/plugins/table/table.js
+++ b/assets/plugins/table/table.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.table = function()
+ $.Redactor.prototype.table = function()
{
return {
getTemplate: function()
@@ -17,19 +15,161 @@ if (!RedactorPlugins) var RedactorPlugins = {};
},
init: function()
{
-
var dropdown = {};
- dropdown.insert_table = { title: this.lang.get('insert_table'), func: this.table.show };
- dropdown.insert_row_above = { title: this.lang.get('insert_row_above'), func: this.table.addRowAbove };
- dropdown.insert_row_below = { title: this.lang.get('insert_row_below'), func: this.table.addRowBelow };
- dropdown.insert_column_left = { title: this.lang.get('insert_column_left'), func: this.table.addColumnLeft };
- dropdown.insert_column_right = { title: this.lang.get('insert_column_right'), func: this.table.addColumnRight };
- dropdown.add_head = { title: this.lang.get('add_head'), func: this.table.addHead };
- dropdown.delete_head = { title: this.lang.get('delete_head'), func: this.table.deleteHead };
- dropdown.delete_column = { title: this.lang.get('delete_column'), func: this.table.deleteColumn };
- dropdown.delete_row = { title: this.lang.get('delete_row'), func: this.table.deleteRow };
- dropdown.delete_table = { title: this.lang.get('delete_table'), func: this.table.deleteTable };
+ dropdown.insert_table = {
+ title: this.lang.get('insert_table'),
+ func: this.table.show,
+ observe: {
+ element: 'table',
+ in: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.insert_row_above = {
+ title: this.lang.get('insert_row_above'),
+ func: this.table.addRowAbove,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.insert_row_below = {
+ title: this.lang.get('insert_row_below'),
+ func: this.table.addRowBelow,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.insert_row_below = {
+ title: this.lang.get('insert_row_below'),
+ func: this.table.addRowBelow,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.insert_column_left = {
+ title: this.lang.get('insert_column_left'),
+ func: this.table.addColumnLeft,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.insert_column_right = {
+ title: this.lang.get('insert_column_right'),
+ func: this.table.addColumnRight,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.add_head = {
+ title: this.lang.get('add_head'),
+ func: this.table.addHead,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.delete_head = {
+ title: this.lang.get('delete_head'),
+ func: this.table.deleteHead,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.delete_column = {
+ title: this.lang.get('delete_column'),
+ func: this.table.deleteColumn,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.delete_row = {
+ title: this.lang.get('delete_row'),
+ func: this.table.deleteRow,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
+
+ dropdown.delete_row = {
+ title: this.lang.get('delete_table'),
+ func: this.table.deleteTable,
+ observe: {
+ element: 'table',
+ out: {
+ attr: {
+ 'class': 'redactor-dropdown-link-inactive',
+ 'aria-disabled': true,
+ }
+ }
+ }
+ };
this.observe.addButton('td', 'table');
this.observe.addButton('th', 'table');
@@ -55,6 +195,7 @@ if (!RedactorPlugins) var RedactorPlugins = {};
},
insert: function()
{
+ this.placeholder.remove();
var rows = $('#redactor-table-rows').val(),
columns = $('#redactor-table-columns').val(),
@@ -86,7 +227,6 @@ if (!RedactorPlugins) var RedactorPlugins = {};
$tableBox.append($table);
var html = $tableBox.html();
-
this.modal.close();
this.selection.restore();
@@ -102,13 +242,20 @@ if (!RedactorPlugins) var RedactorPlugins = {};
}
else
{
- this.insert.html(html);
+ this.insert.html(html, false);
}
this.selection.restore();
var table = this.$editor.find('#table' + tableId);
+ var p = table.prev("p");
+
+ if (p.length > 0 && this.utils.isEmpty(p.html()))
+ {
+ p.remove();
+ }
+
if (!this.opts.linebreaks && (this.utils.browser('mozilla') || this.utils.browser('msie')))
{
var $next = table.next();
diff --git a/assets/plugins/textdirection/textdirection.js b/assets/plugins/textdirection/textdirection.js
index be65f18..7999c20 100755
--- a/assets/plugins/textdirection/textdirection.js
+++ b/assets/plugins/textdirection/textdirection.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.textdirection = function()
+ $.Redactor.prototype.textdirection = function()
{
return {
init: function()
diff --git a/assets/plugins/textexpander/textexpander.js b/assets/plugins/textexpander/textexpander.js
index 7d3b30b..a041b90 100644
--- a/assets/plugins/textexpander/textexpander.js
+++ b/assets/plugins/textexpander/textexpander.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.textexpander = function()
+ $.Redactor.prototype.textexpander = function()
{
return {
init: function()
@@ -14,7 +12,7 @@ if (!RedactorPlugins) var RedactorPlugins = {};
var key = e.which;
if (key == this.keyCode.SPACE)
{
- var current = this.selection.getCurrent();
+ var current = this.textexpander.getCurrent();
var cloned = $(current).clone();
var $div = $('
');
@@ -54,6 +52,21 @@ if (!RedactorPlugins) var RedactorPlugins = {};
}, this));
+ },
+ getCurrent: function()
+ {
+ var selection
+ if (window.getSelection) selection = window.getSelection();
+ else if (document.selection && document.selection.type != "Control") selection = document.selection;
+
+ if (this.utils.browser('mozilla'))
+ {
+ return selection.anchorNode.previousSibling;
+ }
+ else
+ {
+ return selection.anchorNode;
+ }
}
};
};
diff --git a/assets/plugins/video/video.js b/assets/plugins/video/video.js
index 389a2f0..d71dec4 100644
--- a/assets/plugins/video/video.js
+++ b/assets/plugins/video/video.js
@@ -1,8 +1,6 @@
-if (!RedactorPlugins) var RedactorPlugins = {};
-
(function($)
{
- RedactorPlugins.video = function()
+ $.Redactor.prototype.video = function()
{
return {
reUrlYoutube: /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig,