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

Add "Smart Snippets": smart fragments that can be inserted from Composer. #28

Closed
RealRaven2000 opened this issue Dec 16, 2019 · 9 comments

Comments

@RealRaven2000
Copy link
Owner

This was first suggested in a comment on #24 (changing the template from composer). The commenter @GrantHorizons references the (now defunct) quicktext Add-on, which seems to have added toolbar items with menus. I haven't used it personally so I am not to sure about this UI.

I have 248 templates in QT, and in around 21 categories - which makes for a busy toolbar row of dropdowns! MANY are only used rarely, but they're long so it's useful to have them pre-done. I use maybe 20-30 daily.
SmartTemplate with it's more advanced functionality and active support would be an ideal candidate to implement QT into.
I'd want the "shortcut keys" of QT too, as I know that saves a LOT of time. Depending on what I want to insert, a single keystroke/tab inserts any of 36 templates instantly. Nice!
From there, a drop-down menu to choose from, with sub-menus, would be great. If that menu could also be activated optionally by a %menu% for example built in to a template, that would be nice, although it's important to be able to insert a template anytime anywhere. I often use different signatures depending on who, subject, status etc of the subject.

For the moment let's only put down the requirements, without specifying the exact UI:

  • support selecting html / text snippets, these can be stored as separate files
  • make sure they are resolved (any contained SmartTemplate4 variables will be converted immediately) and inserted at the current cursor position in composer
  • somehow manage snippets so that many different ones (more than 100) can be easily added without overwhelming the user.

Note: the current file template management UI is a little lacking as you can only add single files, it would be better if that could add multiple files or support drop and drag. It may not be a good idea to use the current paradigm (account dropdown) for managing smart snippets.

@RealRaven2000
Copy link
Owner Author

As a minimal first implementation I could implement a single new item in the context menu of Composer: "insert snippet..." could just simply open a file picker in a configurable location and allow the user to select a html / txt file with a snippet which will be resolved "smartly" and inserted at cursor location.

This would be a good test bed for a more structured UI (possibly with categorized lists) at a later stage.

@GrantHorizons
Copy link

[quote] ""insert snippet..." could just simply open a file picker in a configurable location and allow the user to select a html / txt file with a snippet which will be resolved "smartly" and inserted at cursor location." [/quote]

That would be a great start!
Re your comment on not knowing QuickText - it's not quite defunct though the author has abandoned it and opened the code to edit. Not sure the exact license but it's now "out there". No idea whether there will be continued development or just die.
UI: just a toolbar row of drop downs in the Compose window of Thunderbird. All info / templates is stored in a templates.xml file. Scripts in scripts.xml file.
Hope that helps!

@RealRaven2000 RealRaven2000 changed the title Add "Smart Snippets": smartTemplate fragements that can be inserted from Composer. Add "Smart Snippets": smart fragments that can be inserted from Composer. Dec 16, 2019
@RealRaven2000
Copy link
Owner Author

Re your comment on not knowing QuickText - it's not quite defunct though the author has abandoned it and opened the code to edit. Not sure the exact license but it's now "out there". No idea whether there will be continued development or just die.

it depends - if it was monetized then there is a chance that the author is actually working on a conversion for Thunderbird 68 or even later - the future way would be "mail extensions" (which is a Thunderbird specific rebranding for Firefox/Chrome's "web extensions") - heavily regulated sandboxed Add-ons that are not allowed any access to Mozilla's internal functions especially: XPCOM, global variables in any window, modification of the Application UI via XUL overlays, no xbl bindings, no access to any operating system functions such as the file open dialog.

That's pretty much 98% of the code of SmartTemplate4. This code would have to be replaced with APIs which will be specifically written for Add-ons (I am still a little incredulous to whether Thunderbird will be able to find enough developer and resources to finance this)

For the moment we are still allowed to use legacy code with a hack that allows packaging our "dinosaur" code including XUL overlays into a manifest file, and that's what I did with all my Add-ons kicking the can down the road. IN my defense there simply aren't any sufficient APIs for all the functionality I am offering, so there will be a lot of politics necessary to put this into place until the release of Thunderbird 78 in 2020. IT's more likely that we will still have some sort of hybrid or run our code as "web experiment" using the old technologu (provided that this will still be allowed at that stage)

SO overall, it's still Work In Progress, partly kicking the can down the road; there is a group of currently 8 Add-on devs meeting every 2 weeks for developing a strategy forward - we have started with a wx conversion for a minor Addon (EditEmailSubject) to get the process started and formalized.

UI: just a toolbar row of drop downs in the Compose window of Thunderbird. All info / templates is stored in a templates.xml file. Scripts in scripts.xml file.

If I understand correctly: this is a separate toolbar, with multiple dropdowns representing separate lists of quicktext snippets. There is no UI for configuring these actual lists, this is done by editing some background files? Are all snippets of a single dropdown in a file or even everything in the same file?

how do you edit a single snippet?

@GrantHorizons
Copy link

GrantHorizons commented Dec 17, 2019 via email

@GrantHorizons
Copy link

qt1

qt2

@RealRaven2000
Copy link
Owner Author

RealRaven2000 commented Dec 17, 2019

I see it's a complicated User Interface which allows you to do everything from within Thunderbird. I will probably have to make it a lot more simplified / less comfortable because this looks like several weeks of development which I just don't have right now. As a bare minimum I want to discuss:

  • Categories - once we have more than 15 Smart Snippets, a flat list just becomes messy. I experience that already now with the write / reply dropdowns as they can potentially become very long and cumbersome to navigate. Ideally I would like to end up with a hierarchy of 1 category level within the dropdown which will be submenus which then can contain the snippets - a single dropdown menu like that is easy to build. The hard thing is creating a simple UI for the users to manage this. Creating a tree control like in quicktext is difficult. Maybe having 2 separate listboxes instead would be a lot easier.
  • Editing in the Add-on vs. external templates. Ultimately I would like to have in-App editing (The Smarttemplate settings window already has this, with the variables tab to insert Smart variables, which is kind of self documenting) but it is complicated to program. The question is whether a simple file selection tool might be good enough. I always like to edit HTML snippets with syntax highlighting in my beloved notepad++ editor and do not want to reinvent the wheel for this. Additionally the selection text vs html could simply be done by choosing an appropriate file type.
  • If I choose snippets as files, should they all be in the same (parent) folder, or should it be unstructured and allow including them from anywhere?

@GrantHorizons
Copy link

FWIW;
1: Perhaps the current person "in charge" of Quicktext would be interested in sharing code? Failing that KISS is always good.
2: I think to start a file selection tool is fine. TBH I do much of my templating in Dreamweaver to start with because it's dead easy, then copy it into QuickText.
3: Snippets as files: default to a pre-selected, but allow anywhere.

@RealRaven2000
Copy link
Owner Author

Please check #142 - there is an early prototype (for Thunderbird 78 and later) there

@RealRaven2000
Copy link
Owner Author

Latest versions to try out for Tb68-91 can be found here: #142 (comment)

  • fixed some layout problems with the snippet icon in composer (tb68)
  • added update of snippets menu items in composer after configuring new menu items (Tb68 only last Composer, in Tb78 and later for all composer windows)
  • added localization
  • added restrictions / explanations for users with Standard license and users without licenses
  • added a feature comparison chart to the support site
  • fixed display of trial date on license tab in settings
  • improvements for templates with tables that do not contain %cursor% (see issue If no %cursor% is entered, HTML template may be truncated / reformatted at the end #149)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants