-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Current Status of WebExtension conversion
I have made significant progress on the WebExtension rewrite. See the webExt branch. I was able to re-implement most of the core features - including keyword handling and shortcut handling inside the compose window - as pure WebExtension code. I do not see any showstoppers to finish the conversion. \o/
- Why convert to WebExtension technology?
- Required UI changes
- What Experiment code is still used and how to move forward?
- What about Scripts?
Why convert to WebExtension technology?
Just like Firefox, Thunderbird supports the WebExtension technology, which provides stable APIs for Add-ons. Quicktext is not yet a pure WebExtension and does not use these stable APIs, but instead uses old code which has full access to the users computer. This old code needs to be updated whenever Thunderbird changes. Keeping up with Thunderbird is a time-consuming task and the reason, why Quicktext is mostly not compatible with Thunderbird Beta/Daily and often not directly compatible with new versions of Thunderbird. Since the Thunderbird team plans to switch to monthly releases, this will become an even greater issue.
After Quicktext has been converted to a pure WebExtension and no longer uses any "legacy" code (a.k.a. Experiments), the work needed to maintain Quicktext will be reduced significantly. This will allow me to spend my time on implementing new features.
Required UI changes
There will be one change in the WebExtension version of Quicktext, which is a compromise: No more toolbar. Maybe in a distant future, there will be ways to add UI elements to the composer, and we can add something useful again. For now, the WebExtension rewrite will use an action button:
The context menu exists as well:
What Experiment code is still used and how to move forward?
The WebExtension development branch is still using some Experiment code, but I think we can get rid of all of it. But that will cause a change in behavior. I will use this issue as a public discussion platform regarding these changes:
getQuicktextFilePaths() and readTextFile()
The add-on reads templates from the user's profile folder. That has to change, and I will store templates in local storage. "Global" templates can be provisioned using the managed storage. Alternatively, templates can be provisioned via HTTP(S) imports on startup (the URL can be provisioned via managed storage).
readBinaryFile
This is used to read and include images in templates. My proposal is to let users import images into Quicktext (store the image source in local storage / local IndexDB) and let templates reference images by an identifier.
pickFile()
WebExtension can open FilePickers, but only from a web page using <input type="file" />. However, Quicktext also has two menu entries to include local text/html files. I need to make the menu open a small popup, where the user is prompted to click on the "open file" button.
Completed in 30d6966
LegacyPrefs API
I still include the LegacyPrefs API to allow admins to provision overrides for defaultImport and templateFolder, both will be dropped in favor of managed storage.
Completed in eed5161
Action Items (no showstoppers, just a lot of work)
- Store templates in local storage and allow admins to provision templates via managed storage.
- Drop LegacyPrefs API after managed storage is fully implemented
- Write WebExtension replacement for pickFile()
- Use only WebExtension code to manipulate composer
- Separate add-on into 3 parts: XUL settings dialog, Webextension composer handling, Toolbar Experiment
- Move Toolbar Experiment into its own add-on or find ways to solve it as a content script
- Rewrite settings dialog as HTML.
- Use a WYSIWYG editor for templates in new settings window.
- File bug with Thunderbird to open menu typed action buttons via shortcut for keyboard-only navigation.
- Add option to import images and store them in a local database and use IDs to reference them in templates.
What about Scripts?
The WebExtension version of Quicktext will not be able to support scripts as before. Currently, its scripts have full system access and just like any Experiment add-on, they may break between Thunderbird updates.
Quicktext may support WebExtension scripts (which will be enough for most of the things you want to do), but has to use an unsafe-eval directive, which prevents it from being hosted on ATN. The only other solution I came up with are companion add-ons:
- WebExtension are extremely simple (2 files in a zip)
- they are able to communicate with other add-ons
- a script tag could include an add-on id, and a set of parameters
- Quicktext sends a message to the other add-on, that add-on is performing the required logic and returns the string which should be used
- The companion add-on may even use Experiments on its own, to do things WebExtensions cannot do
- We could work on a Community Script add-on (which does not necessarily need to be maintained by me), which is either available here or on ATN, which includes a bunch of scripts and is a boilerplate for users who need their own scripts
What do you think?


