-
Notifications
You must be signed in to change notification settings - Fork 306
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: style settings #1358
Add: style settings #1358
Conversation
Great, but I dislike the placement. There's too much info already so I think this UI should be shown in a modal after pressing a button in the left panel. It will probably allow showing it from the manager too. The current I would also remove "Back to manage". If the user opened the editor from the manager then they can use the back button. Otherwise they can open the manager in a new tab. The "style should be applied" selector is too wide, it should be either auto-sized like it's done in the manager or it shouldn't be a selector, but instead a set of The button to remove a rule should be plain like the The block of included/excluded sites should be somehow grouped, maybe using @narcolepticinsomniac, hopefully you can come up with less technical labels for the inclusion/exclusion. My feeling is to remove |
I agree it'd be better in a modal. Options probably would be too, but that's not really relevant here. Not sure I see the point of removing the manager button either, as it's simply a navigational convenience. Tophf's suggested tweaks for the actual per-style settings UI are all on point. As far as the include/exclude buttons, I'd suggest getting rid of them altogether, and leaving an initial input in its place. These sections could, and probably should, operate the same as regular applies-to widgets. |
Note that this PR adds zero features. I just added the setting page to show them. Those exclusions were implemented in #724 which are actually glob patterns.
IIRC someone had requested a redesign for the editor. Let's handle them in another PR. |
Ok, but... it's going to have to eventually, correct? AFAIK, practically all these per-style settings don't work currently, so I assumed you're getting the UI out of the way first, in order to focus on the rest. If the goal here is to settle on a UI, we need to know the functionality. In terms of user includes/excludes, we have the overly simplified idiot-proof version in the popup, because it's toggle-based, and also because space is limited. If space is not an issue, and we're giving the user proper inputs to craft their own include/exclude rules, then they should work the same way applies-to rules have always worked, and the UI should most likely be the same as well.
Why? This seems like the perfect PR to decide where they should go. |
Yes. I'll start working with priority and inclusion after merging this.
Update URL, dark/light mode, and exclusions are already implemented. These features already work in master.
So we can development other features simultaneously. For example, the priority feature takes 2 hours and the inclusion feature takes 20 days. If we make them in a single PR, we will have to wait 20 days for the priority feature. And I predict that redesigning a UI may take even longer like #636. |
Alright then. Any bickering about the UI can be put off until there's something worth redesigning around anyway. Includes/excludes need to be a more advanced version of these features to warrant their inclusion, IMO. Otherwise, the dumbed-down toggle version is more convenient in the popup. |
"Custom included sites" and "Custom excluded sites" should be somehow grouped. The titles should probably be in bold and maybe inside No need for fully spelled buttons, "Add new inclusion", "Add new exclusion", "Delete". IMO they add an unnecessary cognitive load. Just Actually, why not just use a
For a start it's fine because it a) lists all the sites conveniently and b) allows adding the sites in the same place. |
Textarea should be a better, especially for wrapping long lines. The only issue is that we have to parse textarea into a list when saving and format a list into text when reading. Users will lose some formatting e.g. empty lines. Though I think the pro overcomes the con in this situation? |
We can preserve empty lines, it doesn't cost us anything valuable. |
I mean we can store the text as is internally, and parse it when reading the db. |
stylus/background/style-manager.js Lines 373 to 377 in a59aab7
What about the backend? We will probably need something like: const text = style[prop];
if (new RegExp(`^\s*${escapeRe(rule)}\s*$`).test(text)) {
throw new Error(...);
}
text += `\n${rule}`;
style[prop] = text;
compileExclusion(style);
saveStyle(...); |
By "we can store" I mean in the actual db. When the styles are initialized, the text is converted into a list. The UI here shows the original text. When it's saved, the text will be transformed into a list again, automatically, in styleMan. |
|
Are you working on it or let me fix the CSS later? |
You try it :-) |
@@ -17,6 +17,7 @@ | |||
<script src="content/apply.js"></script> | |||
|
|||
<script src="js/sections-util.js"></script> | |||
<script src="js/event-emitter.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event-emitter.js should be moved inside base.js.
The rest of these added script
and link
should be removed from html, and they should be loaded on demand using require
after the user clicks the button to show the settings in a modal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until we have a build system it's important to keep the amount of files loaded synchronously to a bare minimum that's necessary to show the editor.
Did you tell me to try to fix the CSS or try to revert the tab panel and switch to modal? If it is the latter, next time please explain more details. |
My comment says everything:
There are several problems that need to be fixed in this PR: the bug, the modal, the extra files. The bug will disappear if we revert the changes to UI and re-implement it as a modal. |
Ah, I think I understand: you couldn't reproduce the bug and you've assumed that I'm referring to the way the UI is scrolled in compact mode and so you started to rework it. I'm not sure I see how this is my fault though and we could avoid it altogether if you implemented the UI as a modal like I immediately suggested. |
Don't mind. Let's double check the detail in case the message is too short. I didn't explain what "fix the CSS" is either. |
Fixes #827.
There are some features linked to #827 are closed without implementation. Do you want to create a new meta thread to track them or I will just re-open the old ones?
User inclusion doesn't work either.