Permalink
Browse files

[FIX] Patching CKeditor (URL dialog)

  • Loading branch information...
1 parent 9fa05ff commit e4ab296ded46de345212084f7108b08e0512f1a4 @jbenito3 jbenito3 committed Apr 13, 2012
Showing with 57 additions and 0 deletions.
  1. +55 −0 indico/htdocs/js/ckeditor/add_url.patch.js
  2. +2 −0 indico/htdocs/js/indico/Core/Components.js
View
55 indico/htdocs/js/ckeditor/add_url.patch.js
@@ -0,0 +1,55 @@
+/***
+ * Pacth for dialog-fix ckeditor problem [ by ticket #4727 ]
+ * http://dev.jqueryui.com/ticket/4727
+ */
+
+$.extend($.ui.dialog.overlay, { create: function(dialog){
+ if (this.instances.length === 0) {
+ // prevent use of anchors and inputs
+ // we use a setTimeout in case the overlay is created from an
+ // event that we're going to be cancelling (see #2804)
+ setTimeout(function() {
+ // handle $(el).dialog().dialog('close') (see #4065)
+ if ($.ui.dialog.overlay.instances.length) {
+ $(document).bind($.ui.dialog.overlay.events, function(event) {
+ var parentDialog = $(event.target).parents('.ui-dialog');
+ if (parentDialog.length > 0) {
+ var parentDialogZIndex = parentDialog.css('zIndex') || 0;
+ return parentDialogZIndex > $.ui.dialog.overlay.maxZ;
+ }
+
+ var aboveOverlay = false;
+ $(event.target).parents().each(function() {
+ var currentZ = $(this).css('zIndex') || 0;
+ if (currentZ > $.ui.dialog.overlay.maxZ) {
+ aboveOverlay = true;
+ return;
+ }
+ });
+
+ return aboveOverlay;
+ });
+ }
+ }, 1);
+
+ // allow closing by pressing the escape key
+ $(document).bind('keydown.dialog-overlay', function(event) {
+ (dialog.options.closeOnEscape && event.keyCode
+ && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event));
+ });
+
+ // handle window resize
+ $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
+ }
+
+ var $el = $('<div></div>').appendTo(document.body)
+ .addClass('ui-widget-overlay').css({
+ width: this.width(),
+ height: this.height()
+ });
+
+ (dialog.options.stackfix && $.fn.stackfix && $el.stackfix());
+
+ this.instances.push($el);
+ return $el;
+}});
View
2 indico/htdocs/js/indico/Core/Components.js
@@ -1,5 +1,7 @@
+include(ScriptRoot + "ckeditor/add_url.patch.js");
include(ScriptRoot + "ckeditor/ckeditor.js");
+
var indicoSource = null;
var indicoRequest = null;
var imageSrc = null;

0 comments on commit e4ab296

Please sign in to comment.