RealRaven2000 / SmartTemplates

Thunderbird Add-on: SmartTemplates
http://smarttemplates.quickfolders.org/
Other
25 stars 15 forks source link

Insert Snippet: support inserting contents of a CSS file as style block #238

Closed RealRaven2000 closed 1 year ago

RealRaven2000 commented 1 year ago

When inserting a smart snippet into the email, it would be great if we could insert a css file within a style block - not just a HTML file / fragment. This would make it easier to inject styles into a written email "after the fact".

Once a style sheet is loaded the code should be injected into a new

<style> .. </style>

block. This is the same way as the %style()% command works when it is called from within a html template.

RealRaven2000 commented 1 year ago

Test version below. This will insert the <style> block as expected plus a comment above that lists the name of the CSS file (without path)

smartTemplate-fx-3.17pre33.zip

to install this version, download the zip file and drag it into Thunderbird Add-ons Manager (don't extract contents to install).

You can then insert a CSS block via fragments and selecting "style sheets" from the file selection dialog.

image

it's not 100% perfect yet, Thunderbird seems to mess up a little when this is inserted into an empty paragraph, but it definitely inserts the style block. As example that "does something" here is a css file to insert as Fragment (css file inside archive as Github doesn't support css attachments):

smartbox.zip

Code inserted:

<!-- smartbox.css -->
          <style>
            #smartTemplate4-template {
  margin-left: 1em; 
  max-width: 1100px; 
  padding: 0.2em 1em; 
  border: 1px solid rgba(120,120,120,0.5); 
  border-radius: 0.5em;
  box-shadow: 5px 5px 5px rgba(80,80,80,0.2);
}
</style>
RealRaven2000 commented 1 year ago

Implemented in v3.17 released 04/May/2023