This commit moves url-specific config from its own object to a field in
the existing global user config, as suggested in
https://github.com/tridactyl/tridactyl/pull/999#issuecomment-420616758
This makes url-specific config play nicer with existing config
manipulation tools (e.g. :viewconfig).
`editor()` didn't return anything useful. This partially fixes#1005 by
letting users create commands to automatically delete a the temporary
file after `editor()` finishes.
a0ac1a2 upgraded Tridactyl's dependencies and webpack suddenly started
minifying the files it builds. This makes debugging much harder and thus
needs to be prevented. This is done by setting "mode" to "development"
in the module.exports object in webpack.config.js.
This PR implements site-specific settings. It requires multiple changes
and new features.
First, I needed to create a new value in `window.tri` named
`contentLocation`. This contentLocation object is either a Location or
URL object containing the URL of the currently selected tab of the
currently selected window. This is required because config.get() is not
asynchronous and we probably want to keep it that way, thus we can't
message the content script just to get the current url.
Then, we create a new object, URLCONFIGS, in content.ts. It behaves
exactly the same as USERCONFIG, except it has a level of indirection,
matching url patterns to config objects. This requires creating new
seturl, geturl and unseturl functions which behave mostly the same as
set, get and unset.
Last, we create a `seturl` ex command in order to interact with this new
object.
Using numbers instead of strings made things complicated when dealing
with logging (:set was more complex, :get returned a number instead of a
string...). This commit fixes this.
Note that this commit removes validation for logging levels. This means
that users can now set erroneous logging levels. Fixing this will
require better type info generation in the compiler and will happen in
another commit.
This fixes the pop-in of the un-selected hints after one is selected,
since on completion we're removing all hints instead of just clearing
the filter. It also fixes hints remaining present on SPAs like github,
see #981.
`pick` in `msgsafe.ts` was not type safe and was concealing an error
where HTMLElements don't have a `pick` property. Then
`MsgSafeNode.pick` would have always been absent, which would have
caused `isTextEditable` to fail to detect elements with the ARIA role
of `application`. Using real types throughout allows us to fix this by
iterating over `Element.attributes`, which appears to do the right
thing.