6.0 PasteHTML() command not working right.

  •  04-17-2007, 12:44 PM

    6.0 PasteHTML() command not working right.

    I am using CE to allow my users to create mail-merge letter templates.  To allow the mail-merge, I have some special insertable tags they can use in their templates that get replaced by data from a database.  For example, the tag {LASTNAME} gets replaced, when the letter is printed, by the customer's last name.
     
    Users insert these tags using a custom button on the CE toolbar.  This button executes the following JavaScript code:
     
    var t = document.FormName.txselected="true"Tag.value; var e = CuteEditor_GetEditor(this); e.PasteHTML(t);
     
    (Please note, your editor insists on inserting the text  ="true" into the middle of my code example.  The actual text above should read "var t = document.FormName.txselected="true"Tag.value".  You might want to look into this odd behavior, also. PLEASE NOTE:  I can't actually tell you what the code actually is because your editor keeps corrupting it.  Those spurious ="true" bits of text are being added by your editor!!!  Your editor is also changing the name of my text field.  I won't bother to tell you what it should be, becuase your editor will probably just change it.)
     
    In CE version 5.3, this function worked properly, but in version 6.0, the PasteHTML command not only pastes the value of t, it pastes an additional space character, and overwrites whatever characters are just to the right of the insertion point, be they text or existing HTML tags.
     
    For instance, if I use my custom button to insert the {LASTNAME} tag at the begining of the following line:
     
    is your last name.
     
    The line becomes:
     
    {LASTNAME} s your last name.
     
    Similarly, if I have the following text:
     
    This is a line of text.
     
    This is another line text below an empty line.
     
    And I use my custom button to insert the {LASTNAME} between these two line of text, the result is:
     
    This is a line of text.
    {LASTNAME}This is another line text below an empty line.
     
    The PasteHTML() command, in other words, deletes the underlying <div> or <br /> tag that the pasted text was next to.
     
    This is totally unacceptable behavior that did not exists in version 5.3.  Is this by design (in which case I'll go back to using version 5.3), or is it a bug (in which case I'll wait for a fix)?
     
    Thanks,
     
    James
     
    BTW, thes last few lines a not supposed to be in Courier.  I can't make your editor render them in Verdana.
     
View Complete Thread