issue 597: Fixed a bug for hyperlink feature of DrEditor

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9943 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-12-13 02:25:58 +00:00
parent 3bdda13056
commit 45c8f98d5b

View file

@ -3131,7 +3131,9 @@ xe.XE_EditingArea_WYSIWYG = jQuery.Class({
this.getDocument().body.style.cursor = "text"; this.getDocument().body.style.cursor = "text";
if(jQuery.browser.msie){ if(jQuery.browser.msie){
jQuery(this.doc).bind('keydown', jQuery.fnBind( jQuery(this.doc)
.unbind('keydown.ea')
.bind('keydown.ea', jQuery.fnBind(
function(weEvent){ function(weEvent){
if(this.doc.selection.type.toLowerCase() == 'control' && weEvent.keyCode == 8) { if(this.doc.selection.type.toLowerCase() == 'control' && weEvent.keyCode == 8) {
this.oApp.exec("EXECCOMMAND", ['delete', false, false]); this.oApp.exec("EXECCOMMAND", ['delete', false, false]);
@ -3139,14 +3141,16 @@ xe.XE_EditingArea_WYSIWYG = jQuery.Class({
} }
} }
, this)); , this));
jQuery(this.doc.body).bind('mousedown', jQuery.fnBind( jQuery(this.doc.body)
.unbind('mousedown.ea')
.bind('mousedown.ea', jQuery.fnBind(
function(weEvent){ function(weEvent){
this._oIERange = null; this._oIERange = null;
this._bIERangeReset = true; this._bIERangeReset = true;
} }
, this)); , this))
/* .unbind('beforedeactivate.ea')
jQuery(this.doc.body).bind('beforedeactivate', jQuery.fnBind( .bind('beforedeactivate.ea', jQuery.fnBind(
function(weEvent){ function(weEvent){
// without this, cursor won't make it inside a table. // without this, cursor won't make it inside a table.
// mousedown(_oIERange gets reset) -> beforedeactivate(gets fired for table) -> RESTORE_IE_SELECTION // mousedown(_oIERange gets reset) -> beforedeactivate(gets fired for table) -> RESTORE_IE_SELECTION
@ -3160,9 +3164,9 @@ xe.XE_EditingArea_WYSIWYG = jQuery.Class({
this._oIERange = tmpRange; this._oIERange = tmpRange;
} }
} }
, this)); , this))
*/ .unbind('mouseup.ea')
jQuery(this.doc.body).bind('mouseup', jQuery.fnBind( .bind('mouseup.ea', jQuery.fnBind(
function(weEvent){ function(weEvent){
this._bIERangeReset = false; this._bIERangeReset = false;
} }
@ -5572,124 +5576,6 @@ xe.XE_XHTMLFormatter = $.Class({
// center, font, b, i, s, strike // center, font, b, i, s, strike
})(jQuery); })(jQuery);
/**
* Support XE extensions
* @author gony
*/
xe.XE_Extension = jQuery.Class({
name : "XE_Extension",
seq : '',
$init : function(elAppContainer, editor_sequence) {
this.seq = editor_sequence;
this._assignHTMLObjects(elAppContainer);
},
_assignHTMLObjects : function(elAppContainer) {
this.elDropdownLayer = jQuery('DIV.xpress_xeditor_extension_layer', elAppContainer).get(0);
},
_removeAttrs : function(sContent) {
return sContent;
},
_addEvent : function() {
if (this.oApp.getEditingMode() != 'WYSIWYG') return;
var doc = this.oApp.getWYSIWYGDocument();
var seq = this.seq;
var fn = function(){
var obj = jQuery(this);
var comp = obj.attr('editor_component');
if (comp && jQuery.isFunction(openComponent)) {
editorPrevNode = obj.get(0);
openComponent(comp, seq);
}
};
jQuery('img,div[editor_component]', doc).each(function(){
var obj = jQuery(this);
if(this.nodeName == 'IMG' && !obj.attr('editor_component')) obj.attr('editor_component','image_link')
if(!obj.attr('xeHandled')) {
obj.attr('xeHandled','YES');
obj.dblclick(fn);
}
});
},
$ON_MSG_APP_READY : function() {
this.oApp.exec('REGISTER_UI_EVENT', ['extension', 'click', 'TOGGLE_EXTENSION_LAYER']);
},
$ON_TOGGLE_EXTENSION_LAYER : function() {
this.oApp.exec('TOGGLE_TOOLBAR_ACTIVE_LAYER', [this.elDropdownLayer]);
},
$ON_CHANGE_EDITING_MODE : function(mode) {
var self = this;
setTimeout(function(){ self._addEvent(); }, 100);
},
$ON_PASTE_HTML : function() {
var self = this;
setTimeout(function(){ self._addEvent(); }, 100);
},
$ON_LOAD_IR_FIELD : function() {
var self = this;
setTimeout(function(){ self._addEvent(); }, 100);
},
$ON_SET_IR : function() {
var self = this;
setTimeout(function(){ self._addEvent(); }, 100);
}
});
/**
* Auto saving
* @author gony
*/
xe.XE_AutoSave = jQuery.Class({
name : "XE_AutoSave",
form : null,
textarea : null,
$init : function(oIRTextarea, elAppContainer) {
this.form = oIRTextarea.form;
this.textarea = oIRTextarea;
this._assignHTMLObjects(elAppContainer);
},
_assignHTMLObjects : function(elAppContainer) {
this.welMessageBox = jQuery('autosave_message');
},
$ON_MSG_APP_READY : function() {
var elTitle = jQuery(this.form._saved_doc_title);
var elContent = jQuery(this.form._saved_doc_content);
var title = jQuery.trim(elTitle.val());
var content = jQuery.trim(elContent.val());
if (title || content) {
if (confirm(this.form._saved_doc_message.value)) {
jQuery(this.form.title).val(title);
this.oApp.setIR(content);
} else {
editorRemoveSavedDoc();
}
}
editorEnableAutoSave(this.form, jQuery(this.form).attr("editor_sequence"));
// register hotkey
this.oApp.exec('REGISTER_HOTKEY', ['ctrl+shift+s','AUTO_SAVE']);
},
$ON_AUTO_SAVE : function() {
_editorAutoSave();
}
});
/** /**
* Format Block plugin * Format Block plugin
* @author gony * @author gony