PDA

View Full Version : HTMLEDITOR - IE



highradius
8 Jul 2013, 6:15 AM
Hi,
i am using extjs3.4 - Ext.form.HtmlEditor - IE
when i type in something and press enter its creating the content in <p> tags.how do i remove these <p> tags on enter press.

in IE : <p>SEG</p><p>SG</p><p>SH</p>
in FF : SEG<br>SG<br>SH.

how can i make it same as FF as i don't want empty line created while Enter Key Press.

IE:
http://i41.tinypic.com/2mh8k61.png

FF:
http://i42.tinypic.com/v623pl.png

mitchellsimoens
10 Jul 2013, 4:17 AM
Looking at the code, if the key is e.ENTER then it looks to try and insert the <br />

highradius
10 Jul 2013, 11:47 PM
yes in firefox and chrome its inserting <br/> but in IE the content is set inside <p></p>.

i need to remove <p> tags on enter key

i tried using this override but not successful...


Ext.form.HtmlEditor.override({
fixKeys : function(){ if(k == e.ENTER){
r = this.getDoc().getSelection();
if(r){
var target = r.anchorNode.parentNode.nodeName.toLowerCase();

if(target == 'P'){
Ext.EventManager.on(doc, 'keyup', this.delP, this);
}
}
}
};
}
}(),
delP : function(){
var doc = this.getDoc();
var target = doc.getElementsByTagName('P')[0];
target.parentNode.replaceChild(doc.createElement('br'),target);
this.iframe.focus();
this.execCmd('selectall');
var r = doc.getElementsByTagName('html')[0].innerHTML;
this.execCmd('InsertHtml',r);
this.iframe.contentWindow.scrollTo(0,1000000);
Ext.EventManager.un(doc, 'keyup', this.delP, this);
}
});

padraig
17 Nov 2014, 3:29 AM
Any fix for this found? i.e. only ever having <br> tags and never <p> tags?