Skip to content

Commit

Permalink
Imperavi redactor updated to 10.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Oct 7, 2015
1 parent ef0aded commit 7fa41ce
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 33 deletions.
68 changes: 38 additions & 30 deletions assets/redactor.js
@@ -1,6 +1,6 @@
/*
Redactor 10.2.4
Updated: September 25, 2015
Redactor 10.2.5
Updated: October 1, 2015
http://imperavi.com/redactor/
Expand Down Expand Up @@ -92,7 +92,7 @@

// Functionality
$.Redactor = Redactor;
$.Redactor.VERSION = '10.2.4';
$.Redactor.VERSION = '10.2.5';
$.Redactor.modules = ['alignment', 'autosave', 'block', 'buffer', 'build', 'button',
'caret', 'clean', 'code', 'core', 'dropdown', 'file', 'focus',
'image', 'indent', 'inline', 'insert', 'keydown', 'keyup',
Expand Down Expand Up @@ -720,7 +720,6 @@
return;
}


var block = this.block.blocks[0];
if (block === false) return;

Expand Down Expand Up @@ -789,6 +788,7 @@
setMultiple: function(tag)
{
var block = this.block.blocks[0];

var isContainerTable = (this.block.containerTag == 'TD' || this.block.containerTag == 'TH');

if (block !== false && this.block.blocksSize === 1)
Expand Down Expand Up @@ -1241,6 +1241,8 @@
build: function()
{
return {
focused: false,
blured: true,
run: function()
{
this.build.createContainerBox();
Expand Down Expand Up @@ -1432,7 +1434,13 @@
// focus
this.$editor.on('focus.redactor', $.proxy(function(e)
{
if ($.isFunction(this.opts.focusCallback)) this.core.setCallback('focus', e);
if ($.isFunction(this.opts.focusCallback))
{
this.core.setCallback('focus', e);
}

this.build.focused = true;
this.build.blured = false;

if (this.selection.getCurrent() === false)
{
Expand All @@ -1458,7 +1466,13 @@
}

this.utils.disableSelectAll();
if ($.isFunction(this.opts.blurCallback)) this.core.setCallback('blur', e);
if (!this.build.blured && $.isFunction(this.opts.blurCallback))
{
this.core.setCallback('blur', e);
}

this.build.focused = false;
this.build.blured = true;

}, this));

Expand Down Expand Up @@ -1958,7 +1972,7 @@
var node, offset = 0;
var walker = document.createTreeWalker(this.$editor[0], NodeFilter.SHOW_TEXT, null, null);

while (node == walker.nextNode())
while (node = walker.nextNode())
{
offset += node.nodeValue.length;
if (offset > start)
Expand Down Expand Up @@ -2621,6 +2635,8 @@
getPlainText: function(html, paragraphize)
{
html = this.clean.getTextFromHtml(html);
html = html.replace(/\n\s*\n/g, "\n");
html = html.replace(/\n\n/g, "\n");
html = html.replace(/\n/g, '<br />');

if (this.opts.paragraphize && typeof paragraphize == 'undefined' && !this.utils.browser('mozilla'))
Expand Down Expand Up @@ -2883,7 +2899,7 @@
var html = this.$editor.html();

// is there a need to synchronize
if (this.code.syncCode && this.code.syncCode == html)
if (this.code.syncCode && this.code.syncCode == html || (this.start && html == '' ))
{
// do not sync
return;
Expand Down Expand Up @@ -3625,13 +3641,7 @@
},
isFocused: function()
{
var focusNode = document.getSelection().focusNode;
if (focusNode === null) return false;

if (this.opts.linebreaks && $(focusNode.parentNode).hasClass('redactor-linebreaks')) return true;
else if (!this.utils.isRedactorParent(focusNode.parentNode)) return false;

return this.$editor.is(':focus');
return this.$editor[0] === document.activeElement;
}
};
},
Expand Down Expand Up @@ -4856,6 +4866,7 @@
{
node = node[0] || node;

var offset = this.caret.getOffset();
var html = this.utils.getOuterHtml(node);
html = this.clean.setVerified(html);

Expand All @@ -4875,6 +4886,8 @@
this.range.collapse(false);
this.selection.addRange();

this.caret.setOffset(offset);

return node;
},
nodeToPoint: function(node, x, y)
Expand Down Expand Up @@ -5544,7 +5557,9 @@
space.innerHTML = '&#x200b;';

$(br1).after(space);
this.caret.setAfter(space);

this.range.setStartAfter(space);
this.range.setEndAfter(space);
$(space).remove();
}
else
Expand All @@ -5555,7 +5570,6 @@
var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);

}
}

Expand Down Expand Up @@ -5970,6 +5984,7 @@
// mailto
if (link.search('@') != -1 && /(http|ftp|https):\/\//i.test(link) === false)
{
link = link.replace('mailto:', '');
link = 'mailto:' + link;
}
// url, not anchor
Expand Down Expand Up @@ -7292,19 +7307,18 @@
else
{
// bootstrap modal
if ($('.modal-body:visible').length > 0)
var $visibleModals = $('.modal-body:visible');
if ($visibleModals.length > 0)
{

$('.modal.in .modal-body:visible').append(this.$pasteBox);
$visibleModals.append(this.$pasteBox);
}
else
{
$('body').append(this.$pasteBox);
}

}

this.$pasteBox.focus();
this.$pasteBox.get(0).focus();
},
insert: function(html)
{
Expand Down Expand Up @@ -7538,17 +7552,11 @@

var blocks = [];
nodes = (typeof nodes == 'undefined') ? this.selection.getNodes() : nodes;

$.each(nodes, $.proxy(function(i,node)
{
var parent = $(node).parent();
if (i === 0 && this.utils.isBlock(parent))
{
this.selection.lastBlock = parent[0];
blocks.push(parent[0]);
}
else if (this.utils.isBlock(node))
if (this.utils.isBlock(node))
{
this.selection.lastBlock = node;
blocks.push(node);
}

Expand Down
6 changes: 3 additions & 3 deletions assets/redactor.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions changelog.md
@@ -1,6 +1,11 @@
Changelog
=========

1.3.17
------

- Imperavi redactor updated to 10.2.5 (samdark)

1.3.16
------

Expand Down

0 comments on commit 7fa41ce

Please sign in to comment.