Re: fireEvent
Yann-Erwan Perio wrote:[color=blue]
> Then try the following hack instead :
>
> if (ord == 13 && editEvent.type == 'keypress') {
> if(editor_obj.t agName.toLowerC ase()=="iframe" ) {
> if (
> (function(){
> var el=editor_obj.c ontentWindow.do cument.selectio n.
> createRange().p arentElement();
> var lc;
> while((lc=el.no deName.toLowerC ase())!="body") {
> if(lc!="p") break;
> el=el.parentNod e;
> }
> return lc=="body";
> })()[/color]
Hmm, that seems to work. But I must admit I'm not exactely a JS guru so
you've got to help me a bit here :)
What are you doing between the
if ((function(){ * })) ??
[color=blue]
> (ugly, eh?)[/color]
Yep :)
I also worked out a hack myself, which is a bit larger but appears to have
the same effect.
--------------------8<--------------------------------------------------
//if enter NOT pressed, reset
if (ord != 13) {
b_PressedBefore = false;
}
//look up which buttons are pressed
var a = document.all["_" +objname+ "_InsertUnorder edList"].className;
var b = document.all["_" +objname+ "_InsertOrdered List"].className;
b_btnDown = true;
c_btnText = 'btnDown'
//if a button is pressed set var
if (a != c_btnText && b != c_btnText) {
b_btnDown = false;
}
//if no buttons are pressed and no shift is pressed
if (ord == 13 && editEvent.type == 'keypress' && !b_btnDown && !shiftKey) {
editEvent.retur nValue = false;
//if enter WAS pressed before insert </p><p>
if (b_PressedBefor e) {
editor_insertHT ML(objname, "</p><p>");
b_PressedBefore = false;
}
//if enter was NOT pressed before insert <br>
else {
editor_insertHT ML(objname, "<br>");
//mark as pressed before
b_PressedBefore = true;
}
return;
}
if (ord == 13 && editEvent.type == 'keypress' && !b_btnDown && shiftKey) {
editEvent.retur nValue = false;
editor_insertHT ML(objname, "</p><p>");
return;
}
------------------------------>8----------------------------------------
I guess this one's quite dirty too :)
--
,_,
(O,O)
( )
---"-"-alex
Yann-Erwan Perio wrote:[color=blue]
> Then try the following hack instead :
>
> if (ord == 13 && editEvent.type == 'keypress') {
> if(editor_obj.t agName.toLowerC ase()=="iframe" ) {
> if (
> (function(){
> var el=editor_obj.c ontentWindow.do cument.selectio n.
> createRange().p arentElement();
> var lc;
> while((lc=el.no deName.toLowerC ase())!="body") {
> if(lc!="p") break;
> el=el.parentNod e;
> }
> return lc=="body";
> })()[/color]
Hmm, that seems to work. But I must admit I'm not exactely a JS guru so
you've got to help me a bit here :)
What are you doing between the
if ((function(){ * })) ??
[color=blue]
> (ugly, eh?)[/color]
Yep :)
I also worked out a hack myself, which is a bit larger but appears to have
the same effect.
--------------------8<--------------------------------------------------
//if enter NOT pressed, reset
if (ord != 13) {
b_PressedBefore = false;
}
//look up which buttons are pressed
var a = document.all["_" +objname+ "_InsertUnorder edList"].className;
var b = document.all["_" +objname+ "_InsertOrdered List"].className;
b_btnDown = true;
c_btnText = 'btnDown'
//if a button is pressed set var
if (a != c_btnText && b != c_btnText) {
b_btnDown = false;
}
//if no buttons are pressed and no shift is pressed
if (ord == 13 && editEvent.type == 'keypress' && !b_btnDown && !shiftKey) {
editEvent.retur nValue = false;
//if enter WAS pressed before insert </p><p>
if (b_PressedBefor e) {
editor_insertHT ML(objname, "</p><p>");
b_PressedBefore = false;
}
//if enter was NOT pressed before insert <br>
else {
editor_insertHT ML(objname, "<br>");
//mark as pressed before
b_PressedBefore = true;
}
return;
}
if (ord == 13 && editEvent.type == 'keypress' && !b_btnDown && shiftKey) {
editEvent.retur nValue = false;
editor_insertHT ML(objname, "</p><p>");
return;
}
------------------------------>8----------------------------------------
I guess this one's quite dirty too :)
--
,_,
(O,O)
( )
---"-"-alex
Comment