Fixes a bug with inserting Media objects to the rich editor in Safari. Closes #1733

This commit is contained in:
alekseybobkov 2016-03-02 21:10:27 -08:00
parent 60e7cfbf49
commit 27c7f4d0b8
2 changed files with 15 additions and 2 deletions

View File

@ -173,7 +173,9 @@ if($item.data('item-type')=='folder'){if(!$item.data('clear-search'))
this.gotoFolder($item.data('path'))
else{this.resetSearch()
this.gotoFolder($item.data('path'),true)}}
else if($item.data('item-type')=='file'){this.$el.trigger('popupcommand',['insert'])}}
else if($item.data('item-type')=='file'){var $html=$(document.documentElement)
if($html.hasClass('safari')&&!$html.hasClass('chrome')){return}
this.$el.trigger('popupcommand',['insert'])}}
MediaManager.prototype.isPreviewSidebarVisible=function(){return!this.$el.find('[data-control="preview-sidebar"]').hasClass('hide')}
MediaManager.prototype.toggleSidebar=function(ev){var isVisible=this.isPreviewSidebarVisible(),$sidebar=this.$el.find('[data-control="preview-sidebar"]'),$button=$(ev.target)
if(!isVisible){$sidebar.removeClass('hide')

View File

@ -414,7 +414,18 @@
}
else if ($item.data('item-type') == 'file') {
// Trigger the Insert popup command if a file item
// was double clicked.
// was double clicked or Enter key was pressed.
var $html = $(document.documentElement)
if ($html.hasClass('safari') && !$html.hasClass('chrome')) {
// Inserting media/link in Safari with Enter key and double click
// is buggy. It causes endless recursion inside the rich editor
// third-party code.
// See https://github.com/octobercms/october/issues/1733
return
}
this.$el.trigger('popupcommand', ['insert'])
}
}