Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thunderbird 115 has issues with inserting templates when the cursor is at the end of a font tag directly before a hidden line break #377

Closed
BT-Justice opened this issue Sep 11, 2023 · 27 comments

Comments

@BT-Justice
Copy link

I have a client I do computer work for who uses this extension. Since the upgrade to Thunderbird 115, it doesn't seem to be working well. When he types up an email and goes to QuickText to select a signature, it will not go into the message body. If he selects a signature before typing, it seems to work, but (as a test) clicking to add another signature doesn't work.

@jobisoft
Copy link
Owner

It works here. I would need a step by step description of what the user is doing and what happens (or not). Errors logged to the console would be helpful.

Also please try in a fresh profile with a test template.

@BT-Justice
Copy link
Author

BT-Justice commented Sep 11, 2023

He has a group called Signatures with the signatures in HTML within that group as templates. This makes a button called Signatures he clicks on whenever he types his message or reply. When he clicks the button and selects a signature, nothing gets inserted. Instead, the cursor where he wants the signature inserted disappears. When I click on the message body where the cursor was, it has moved up a line.

This has worked fine in the past and this is how he has done it for a couple of years now at least.

[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIHTMLEditor.insertHTML]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://quicktext/content/quicktext.js :: insertBody :: line 530" data: no] quicktext.js:530:22
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsICommandController.getCommandStateWithParams]
goUpdateCommandState chrome://messenger/content/messengercompose/ComposerCommands.js:210
goUpdateComposerMenuItems chrome://messenger/content/messengercompose/ComposerCommands.js:281
oncommandupdate chrome://messenger/content/messengercompose/messengercompose.xhtml:1
observe chrome://messenger/content/messengercompose/editor.js:224
ComposerCommands.js:257:13
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsICommandController.getCommandStateWithParams]
goUpdateCommandState chrome://messenger/content/messengercompose/ComposerCommands.js:210
goUpdateComposerMenuItems chrome://messenger/content/messengercompose/ComposerCommands.js:281
oncommandupdate chrome://messenger/content/messengercompose/messengercompose.xhtml:1
observe chrome://messenger/content/messengercompose/editor.js:224
ComposerCommands.js:257:13

@jobisoft
Copy link
Owner

jobisoft commented Sep 12, 2023

Can you send me the template in question? If it includes confidential information, please send it to my email directly. But I need a template - when imported into a fresh profile - triggers the bug reproducibly.

@BT-Justice
Copy link
Author

Email sent from the user affected.

@jobisoft
Copy link
Owner

jobisoft commented Sep 13, 2023

I still cannot reproduce it :-( All your signatures work. I opened a new email, typed something into the composer and then was able to insert all his signatures one after the other.

Please create a new Thunderbird Test-Profile, import the templates + scripts and try it in the new profile.

@SamuelPlentz
Copy link
Contributor

Steps for Troubleshooting:
https://github.com/jobisoft/quicktext/wiki/Troubleshooting

@EcovoyCan
Copy link

I have a similar issue. When I insert a template inside the body before other contents or in the title, all works fine, but when I try to insert a template at the bottom of the body, it doesn't work. I now work around this by typing a dot or dash and then moving cursor right before this character before inserting my template. This is a new issue that just started for me after installing TB 115.

@BT-Justice
Copy link
Author

BT-Justice commented Sep 13, 2023

Created a fresh profile. Added one email account. Installed QuickText and ReplyWithHeader add-ons. Same error. Tried again without installing ReplyWithHeader. Same error.

NOW though if I insert a signature in a new mail and immediately try to insert a signature after that first signature, I can keep adding them. BUT, if I hit enter to make a new line, I cannot insert any signatures. Weird.

So type a new message, hit ENTER twice, and try to insert the HTML signature. It won't insert anything.

Start a new email but don't type anything yet, click on the message body, insert HTML signature, and now it will insert and keep inserting as long as the ENTER key is not pressed.

@jobisoft
Copy link
Owner

Start a new email but don't type anything yet, click on the message body, insert HTML signature, and now it will insert and keep inserting as long as the ENTER key is not pressed.

I was able to reproduce the effect after hitting ENTER. Will investigate.

@jobisoft
Copy link
Owner

jobisoft commented Sep 14, 2023

The WebExtension version of QT has the same issue, so it is caused by the editor itself. We have to find a way around this bug.

Can you confirm it is triggered by <font>...</font> tags in the template? In my tests, I could make the issue go away by using style attributes and CSS to set the font instead of font tags.

If not, please reduce the offending templates until you could identify the part of the template, which is causing this for you.

@jobisoft
Copy link
Owner

Please also check if the template is syntactically correct. In the test templates I received, some font tags have not been closed and that caused additional issues.

@ViperGeek
Copy link

ViperGeek commented Sep 15, 2023

While not a fan of this issue's title, I recently upgraded to TB 115.2.2 (from 102) and lost the ability to insert HTML QuickText after any text written in an e-mail. Inserting the QT as the only text in an HTML reply works fine, as does inserting plain text below written plain text, but not below other rich (HTML) text.

My QT HTML is pretty boring:

<pre>---
Dave Dugal                                 Support: +1-408-555-1212
Principal Security Engineer                Direct:  +1-978-555-1212
</pre>

@jobisoft
Copy link
Owner

jobisoft commented Sep 16, 2023

What happens if you add a p-tag around it? Or a div-tag?

<p>
<pre>---
Dave Dugal                                 Support: +1-408-555-1212
Principal Security Engineer                Direct:  +1-978-555-1212
</pre>
</p>

@jobisoft
Copy link
Owner

@ViperGeek : I do not seem to be able to reproduce your issue. Please create a dedicated issue with steps to reproduce (as detailed as possible)

@SamuelPlentz
Copy link
Contributor

I improved the steps for Troubleshooting here:
https://github.com/jobisoft/quicktext/wiki/Troubleshooting

I added the following and I think its relevant for all of you. @BT-Justice @EcovoyCan @ViperGeek

5. Reduce as far as possible

If there is a problem inserting a large Quicktext template into a long email, try to reduce the problem as much as possible.

  • Check whether the problem still occurs when you shorten the Quicktext template (create a test template). How can you shorten the Quicktext template as much as possible so that the problem still occurs?
  • Check if the problem still occurs when you shorten the email. How can you shorten the email as much as possible (recipient, message, subject etc.) so that the problem still occurs? Does the problem even occur with a blank email?

6. Create an issue

[...]

  • Include a reduced and anonymized test template that you can reproduce the problem with (see step 5).
  • Include a reduced and anonymized email that you can reproduce the problem with (see step 5). Send the email source code before applying the template by first clicking save in the compose window. Then navigate to the email draft, select the email, click on "more" and "view source code". Probably only the message part between <html> and </html> is relevant.

@ViperGeek
Copy link

@ViperGeek : I do not seem to be able to reproduce your issue. Please create a dedicated issue with steps to reproduce (as detailed as possible)

#378

Thanks!

@BT-Justice
Copy link
Author

@jobisoft I updated the HTML, and it still will not work after typing a message, hitting enter twice, and then trying to insert a HTML signature from QuickText. I am sure it is something with the new Thunderbird 115 SuperNova version as everything worked fine for years. Apparently, you cannot revert to an older version of Thunderbird after upgrading to SuperNova.

@SamuelPlentz Thanks for your concern, but we are past the user error stage so no longer relevant to me. A bug has been discovered.

Here is an example of the HTML code used for one of the signatures which worked fine for years that has been anonymized (this clipboard will delete after 10/16/2023):

https://cl1p.net/QTSig

@BT-Justice BT-Justice changed the title Doesn't Work Thunderbird 115.X SuperNova Broke QuickTet HTML Signatures Sep 16, 2023
@BT-Justice BT-Justice changed the title Thunderbird 115.X SuperNova Broke QuickTet HTML Signatures Thunderbird 115.X SuperNova Broke QuickText HTML Signatures Sep 16, 2023
@jobisoft
Copy link
Owner

@jobisoft I updated the HTML, and it still will not work after typing a message.

What does the updated HTML template look like?

@SamuelPlentz Thanks for your concern, but we are past the user error stage so no longer relevant to me. A bug has been discovered.

It is undoubtably due to changes in the editor code (which is not Thunderbird code by the way, but code inherited from Firefox). But not all templates are broken, and we need to find out what tags/html is triggering this error.

So please do follow Samuel's advice and reduce your templates to the point where it works again, so we can identify the offending elements.

@jobisoft jobisoft changed the title Thunderbird 115.X SuperNova Broke QuickText HTML Signatures Thunderbird 115 has issues with some templates Sep 16, 2023
@BT-Justice
Copy link
Author

BT-Justice commented Sep 16, 2023

@jobisoft All of the ones for my client do not work AFTER he types a message, hits ENTER twice, and then tries to insert a signature. They all work if he clicks the message body before typing a reply, inserts a signature, goes to the start of the signature, hits enter twice, goes back up, changes his font and size, and types his message.

Reducing the HTML code doesn't make them start working again. I took them all the way down to just having
for new lines as the only HTML code, and it still doesn't work. The only thing that works is making them TEXT signatures instead of HTML signatures. As text, they work fine after typing a message, hitting ENTER twice, and selecting a signature to insert.

The only fix I have for my client who needs his signatures to work for his business was to add:

<br>
<br>

...above the same HTML signatures. He can now type a message and at the end of his message, just select the HTML signature he wants which creates the signature 2 lines below his message as it used to be or insert the signature first then type a reply above the signature:

https://cl1p.net/QTSigBrBr

@jobisoft
Copy link
Owner

@jobisoft All of the ones for my client do not work AFTER he types a message, hits ENTER twice, and then tries to insert a signature. They all work if he clicks the message body before typing a reply, inserts a signature, goes to the start of the signature, hits enter twice, goes back up, changes his font and size, and types his message.

My current understanding is: QT fails, if the existing message in the composer before the cursor has a font tag. See #378

The only fix I have for my client who needs his signatures to work for his business was to add:

<br>
<br>

...above the same HTML signatures. He can now type a message and at the end of his message, just select the HTML signature he wants which creates the signature 2 lines below his message as it used to be or insert the signature first then type a reply above the signature

This still fails for me from time to time.

@BT-Justice
Copy link
Author

@jobisoft My "fix" only works if you either do it right at the end of the last sentence typed or insert the signature in the message body before typing anything.

@jobisoft
Copy link
Owner

Understood.

Can you try if removing all font tags (select all and set as "Variable Width" font) before inserting a signature also fixes the issue (not as a workaround, but as the cause identification)?

@jobisoft
Copy link
Owner

jobisoft commented Sep 16, 2023

I investigated in more detail what exactly is the offending situation: If the cursor is before a hidden br at the end of a font tag. You can play around with this using my HTML Source Editor:
https://addons.thunderbird.net/addon/html-source-editor/

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>

<body>
    <p>
        <font face="Comic Sans MS">ff34534534</font>
    </p>
    <p>
        <font face="Comic Sans MS">zuof<br></font>
    </p>

</body>

</html>

If you save this html and then move the cursor to the end of the text, you will end up behind "zouf". The br is hidden, you cannot get on the next line. So the cursor is before the br.

Inserting templates will fail.

Any of the following will make inserting templates work again:

  • remove the trailing br from the message (using the html source editor)
  • move the cursor between o and f of zouf

While it is tedious to remove trailing br's from the message before inserting templates, it may be a simple workaround to simply add a space wherever you currently are with your cursor (and where you want to add the template) and then go back one char to the left (so the space is behind the cursor) and then add the template.

Can you help me and play with your templates and the html source editor to confirm my findings? I will try to automate the removal of trailing br's before adding the template.

@jobisoft jobisoft changed the title Thunderbird 115 has issues with some templates Thunderbird 115 has issues with inserting templates when the cursor is at the end of a font tag directly before a hidden line break Sep 16, 2023
@ViperGeek
Copy link

ViperGeek commented Sep 16, 2023

Confirmed! <Enter><Space><Left Arrow><QuickText Insert> works every time.

Deleting the trailing <br> is less useful, since QuickText ends up inserting the text at the end of the line, rather than on a new line.

@jobisoft
Copy link
Owner

jobisoft commented Sep 16, 2023

If you are on a new line, you need to remove all font tags from that line. This is the bad situation:

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>

<body>
    <p>
        <font face="Comic Sans MS">ff34534534</font>
    </p>
    <p>
        <font face="Comic Sans MS">zuof<br></font>
    </p>
    <p>
        <font face="Comic Sans MS"><br></font>
    </p>
</body>

</html>

This is the fixed one:

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>

<body>
    <p>
        <font face="Comic Sans MS">ff34534534</font>
    </p>
    <p>
        <font face="Comic Sans MS">zuof<br></font>
    </p>
    <p>
       <br>
    </p>
</body>

</html>

It does need the <br> inside the <p></p>. Otherwise, the entire <p> becomes hidden, and the cursor will be behind "zouf" again, before the hidden <br> there, and it will again not work.

@craigs100
Copy link

Since the recent upgrade in Mint Cinnamon to TB115.3.1 QuickText requires that I hit return and create as many new lines as the signature needs before it will insert. Very annoying. It won't just insert itself and move other content down.

@jobisoft
Copy link
Owner

jobisoft commented Oct 8, 2023

I filed a Thunderbird bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1857788

@jobisoft jobisoft closed this as completed Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants