Bugzilla@Mozdev – Bug 26300
%cursor% leaves a space
Last modified: 2017-02-27 14:25:48
You need to log in before you can comment on or make changes to this bug.
I'm using the following SmartTemplate4 to create a template just to define a Google Web Font for my email and place a signature at the bottom. <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> <font style="font-family: 'Roboto', serif"> <p>%cursor%</p> <p>%sig%</p> </font> The %cursor% command, however, results in a blank space being inserted at the top of the email, which propagates as I type causing minor annoyances. Is there any way this space could be removed? The HTML output when I start writing a new email is as follows: (Note the space between the <p> and </p> above Name) <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template"> <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> <font style="font-family: 'Roboto', serif"> <p> </p> <p>Name</p> </font></div> </body> </html>
The space shouldn't matter much once you start typing as it doesn't reallly show up at the end of the line. However your HTML is invalid, you cannot have <p> elements within a <font> tag. instead please use this: <div style="font-family: 'Roboto', serif"> <p>%cursor%</p> <p>%sig%</p> </div> (In reply to comment #0) > I'm using the following SmartTemplate4 to create a template just to define a > Google Web Font for my email and place a signature at the bottom. > > <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> > <font style="font-family: 'Roboto', serif"> > <p>%cursor%</p> > <p>%sig%</p> > </font> > > The %cursor% command, however, results in a blank space being inserted at the > top of the email, which propagates as I type causing minor annoyances. Is there > any way this space could be removed? The HTML output when I start writing a new > email is as follows: (Note the space between the <p> and </p> above Name) > > <html> > <head> > <meta http-equiv="content-type" content="text/html; charset=utf-8"> > </head> > <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> > <div id="smartTemplate4-template"> > <link href="https://fonts.googleapis.com/css?family=Roboto" > rel="stylesheet"> > <font style="font-family: 'Roboto', serif"> > <p> </p> > <p>Name</p> > </font></div> > </body> > </html> >
:-) Thanks for pointing out the error in my HTML code. I've now corrected it. Just to clarify, the space doesn't really matter as long as it ends up at the end of the sentence I'm typing. If, however, I click into the email body field of the Thundebird composition window and then start typing, there are times it ends up at the beginning of the sentence, which causes a funny indent on the first line.
I use this simple template for new messages (dashed lines not included): ============ %cursor% - Shawn ============ These are plain text emails. Smart Template replaces the %cursor% with a space, which looks bad if I end up clicking inside of the email body instead of tabbing to it, because then my email starts with a space.
Created an attachment (id=8273) [details] SmartTemplate 1.5 pre 17 try this version with the global setting "insert space to highlight cursor" disabled. Just tested in plain text mode on Tb 52.0b3
(In reply to comment #4) > Created an attachment (id=8273) [details] [details] > SmartTemplate 1.5 pre 17 > > try this version with the global setting "insert space to highlight cursor" > disabled. Just tested in plain text mode on Tb 52.0b3 > This version does something different altogether. My Compose template reads: <div style="font-family:serif; font-size: 17px;"> <p>%cursor%</p> <p>Reagan</p> (inserted using %sig%) </div> When I open a compose window, however, I see my name on the first line, with the first <p></p> completely ignored.
(In reply to comment #5) > (In reply to comment #4) > This version does something different altogether. My Compose template reads: > > <div style="font-family:serif; font-size: 17px;"> > <p>%cursor%</p> > <p>Reagan</p> (inserted using %sig%) > </div> what's your template? is it this: <div style="font-family:serif; font-size: 17px;"> <p>%cursor%</p> %sig% </div>
That's right. Sorry if I wasn't clear earlier.
(In reply to comment #5) > (In reply to comment #4) > > Created an attachment (id=8273) [details] [details] [details] > > SmartTemplate 1.5 pre 17 > > > > try this version with the global setting "insert space to highlight cursor" > > disabled. Just tested in plain text mode on Tb 52.0b3 > > > > This version does something different altogether. My Compose template reads: > > <div style="font-family:serif; font-size: 17px;"> > <p>%cursor%</p> > <p>Reagan</p> (inserted using %sig%) > </div> > > When I open a compose window, however, I see my name on the first line, with > the first <p></p> completely ignored. > It's a bug in Thunderbird's (Mozilla's) HTML editor, in order to show a completely empty paragraph you must add a <br> inside it (at the end): <div style="font-family:serif; font-size: 17px;"> <p>%cursor%<br></p> %sig% </div> Inadvertently this bug fix (removing the space) makes the paragraph disappear as well. Not sure how to fix this (yet). Apparently it's "Fix one thing for 2 users, break another for 500."
Brilliant! The <br> fixes the problem. Thanks so much for this!
Created an attachment (id=8275) [details] SmartTemplate 1.5 pre 20 I added some code that avoids the edge case you found: if the space (which I have created temporarily replacing the %cursor% tag) is the only thing contained within the <p> tag I will now insert a <br> after it. Once you edit this will look the same as if you were within a <p></p> pair: <p>type text at cursor position<br> </p> in composer (and other email clients) this will look the same as: <p>type text at cursor position</p>
Works like a charm! Thanks so much!