Skip to content

Commit

Permalink
Imperavi redactor updated to 10.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Oct 14, 2014
1 parent 6266d83 commit e5eb92e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 24 deletions.
2 changes: 1 addition & 1 deletion ImperaviRedactorWidget.php
Expand Up @@ -9,7 +9,7 @@
* @author Veaceslav Medvedev <slavcopost@gmail.com>
* @author Alexander Makarov <sam@rmcreative.ru>
*
* @version 1.3.1
* @version 1.3.2
*
* @link https://github.com/yiiext/imperavi-redactor-widget
* @link http://imperavi.com/redactor
Expand Down
57 changes: 37 additions & 20 deletions assets/redactor.js
@@ -1,6 +1,6 @@
/*
Redactor v10.0.1
Updated: October 6, 2014
Redactor v10.0.2
Updated: October 12, 2014
http://imperavi.com/redactor/
Expand Down Expand Up @@ -94,7 +94,7 @@

// Functionality
$.Redactor = Redactor;
$.Redactor.VERSION = '10.0.1';
$.Redactor.VERSION = '10.0.2';
$.Redactor.modules = ['core', 'build', 'lang', 'toolbar', 'button', 'dropdown', 'code',
'clean', 'tidy', 'paragraphize', 'tabifier', 'focus', 'placeholder', 'autosave', 'buffer', 'indent', 'alignment', 'paste',
'keydown', 'keyup', 'shortcuts', 'line', 'list', 'block', 'inline', 'insert', 'caret', 'selection', 'observe',
Expand Down Expand Up @@ -3526,22 +3526,20 @@
}
else
{
if (typeof $next[0] == 'undefined')
if ($next.length === 0 && current === false && typeof $next.context != 'undefined')
{
return this.keydown.insertDblBreakLine(e);
}
else
{
return this.keydown.insertBreakLine(e);
}

return this.keydown.insertBreakLine(e);
}
}
else if (this.opts.linebreaks && this.keydown.block)
{
setTimeout($.proxy(this.keydown.replaceDivToBreakLine, this), 1);
}
// paragraphs
else if (!this.opts.linebreaks && this.keydown.block)
else if (!this.opts.linebreaks && this.keydown.block && this.keydown.block.tagName !== 'LI')
{
setTimeout($.proxy(this.keydown.replaceDivToParagraph, this), 1);
}
Expand Down Expand Up @@ -4295,7 +4293,7 @@
var parent = this.selection.getParent();
var $list = $(parent).closest('ol, ul');

if (!this.opts.linebreaks && this.utils.isEmpty($list.find('li').text()))
if (this.utils.isEmpty($list.find('li').text()))
{
var $children = $list.children('li');
$children.find('br').remove();
Expand Down Expand Up @@ -6213,15 +6211,29 @@
}
else
{
document.execCommand('createLink', false, link);

var $a = $(this.selection.getCurrent()).closest('a');
if (target !== '')
if (this.utils.browser('mozilla') && this.link.text === '')
{
$a.attr('target', target);
var $a = $('<a />').attr('href', link).text(text);
if (target !== '') $a.attr('target', target);

this.insert.node($a);
this.selection.selectElement($a);
}
else
{
document.execCommand('createLink', false, link);

var $a = $(this.selection.getCurrent()).closest('a');

$a.removeAttr('style');
if (target !== '') $a.attr('target', target);
$a.removeAttr('style');

if (this.link.text === '')
{
$a.text(text);
this.selection.selectElement($a);
}
}

this.code.sync();
this.core.setCallback('insertedLink', $a);
Expand Down Expand Up @@ -7556,8 +7568,14 @@
removeEmpty: function(i, s)
{
var $s = $(s);

$s.find('.redactor-invisible-space').replaceWith(function()
{
return $(this).contents();
});

if ($s.find('hr, br, img').length !== 0) return;
var text = $.trim($s.text());
if ($s.children('hr, br, img').length !== 0) return;
if (this.utils.isEmpty(text, false))
{
$s.remove();
Expand All @@ -7576,7 +7594,7 @@
},
restoreScroll: function()
{
if (!this.saveScroll && !this.saveBodyScroll) return;
if (typeof this.saveScroll === 'undefined' && typeof this.saveBodyScroll === 'undefined') return;

$(window).scrollTop(this.saveBodyScroll);
this.$editor.scrollTop(this.saveEditorScroll);
Expand Down Expand Up @@ -7652,9 +7670,8 @@

var offset = this.caret.getOffsetOfElement(block);
var text = $.trim($(block).text()).replace(/\n\r\n/g, '');
var len = text.length;

return (offset == len) ? true : false;
return (offset == text.length) ? true : false;
},

// test blocks
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.2
-----

- Imperavi redactor updated to 10.0.2 (samdark)

1.3.1
-----

Expand Down

2 comments on commit e5eb92e

@delighter
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about official port Imperavi redactor for Yii2? :)

@chuprik
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.