-
Notifications
You must be signed in to change notification settings - Fork 308
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
Remove the editor (and the linter) #27
Comments
Greasemonkey uses the Firefox's built-in Scratchpad. Stylus for FF will be able to do it too, arguably, thus removing the need for the built-in editor, but not Stylus for Chrome. Also, Chrome extensions don't have direct access to the real file system but I guess this idea can be implemented by storing css files in a designated subfolder with a predefined name like Anyway, the built-in editor should obviously stay in the Chrome extension, the extra 1MB of js stuff doesn't hurt performance as it's loaded only when you use it. Actually, I have an idea for the built-in editor that would make it much more convenient than an external tool in most common use cases: 1. show it in a dockable sidebar similar to the devtools inspector in the page itself (implementation-wise it could be an iframe to a web_accessible_resource page of the extension or Shadow DOM), 2. implement element-picker (uBlock Origin has a nice one) that can navigate to the matching rule in the style you edit, or add a new rule based on your choice of selector path (like in uBlock), 3. use a single editor code box, of course, 4. add a hotkey/button/toggle to highlight the matching elements in the web page for the rule the text cursor is in, just like devtools does on hover in the Elements inspector. P.S. There's no SQLite dependency and never was. The old Stylish used Chrome's built-in WebSQL, then switched to IndexedDB (which only recently became just as fast, arguably). Currently there's only a WebSQL migration microstub, it was necessary in the original Stylish when users upgrade from an earlier version. It's not really needed in Stylus as it's a new extension so there'll be no need to migrate a WebSQL database. |
Adding extra options in terms of editing styles would be great. Removing the built-in editor would be a drastic and unnecessary move though. As a matter of fact, that would be the type of unilateral decision-making I'd expect to see from the new Stylish devs. Exactly the type of thing we'd be looking to undo. As for integrating an element picker, or an option to access the editor as an iframe/web_accessible_resource page of the extension or Shadow DOM, Freestyler has implemented similar features pretty decently. They were shortsighted in removing a classic manage/edit page instead of leaving it as an option though. For the element picker, they have incorporated Stylebot's UI. It's not bad, but they neglected to remove the automatic All in all, Freestyler's popup and the new Stylish popup are eerily similar. Maybe there's something to that, but that's beside the point. Neither team is trustworthy. Freestyler has added some cool features for editing styles. Stylus could add similar options without gutting the classic manage/edit functionality. Stylebot is open source, and with some fine-tuning, it'd be a good starting point for these features. No need to completely reinvent the wheel. |
@tophf Ah, I've been using Greasemonkey with the external editor option for so long, I didn't even notice the Scratchpad option. The idea with polling Overall, I agree that some of my ideas are probably too radical for this extension 😉. Element picker sounds like it's be hard to get right. It works for uBlock because the resulting selector is inserted in a flat list of selectors. Userstyles can include multiple nested |
Eek, extensions don't have such an API.
Chrome doesn't support |
Welp, with Chrome/WebExtensions API this is impossible to implement, and since that's unlikely to change in the foreseeable future I'm closing this. |
Don't mean to reopen, but I just want to confirm: As of now, there will be no way to edit a style with your own editor/ide? |
Nothing changed since my last message. The only way is to use Mozilla import and export buttons manually. |
Maybe there is a way. See my idea at greasemonkey/greasemonkey#2513. |
No, there's none. Your idea doesn't work. |
I had to try it anyways, and yeah, fetch(chrome.runtime.getURL("file.css")).then(function(res) {
res.text().then(function(css) {
// import css
});
}) Still probably not that great of a UX. |
We can't make the external editor aware of the user pressing the edit button and we can't pass the style text to external editor so there's no sane and usable solution worth trying to implement. |
Well, strictly speaking, there is a workable solution: write a native OS application, which is installed separately and communicates with our extension via chrome.nativeMessaging API to pass the style text to a file and read it back on change, so if anyone is willing to write such an app (at least for Windows OS) we'll add the necessary support code in Stylus. |
I wasn't thinking of making Stylus pass it towards a editor, but more or less, saving the styles individually as a regular |
@ErraticFox, that was also discussed and I don't see how that could be of any use.
Without a native OS connector app it's a dead end. |
Maybe it's possible to intercept the opening of a |
Intercepting won't help because to read the actual contents an extension would still need the permission. Drag'n'dropping is a different case: the file contents may be read from the drop target object but that's just a one-time thing. Anyway, setting the URL is not the problem here, it's just a minor thing. There's no sensible method to use an external editor without writing the native app as I explained above. |
Just to clarify, it's certainly possible to make an imitation of external editor support using file:// URL which is checked for update/changes, but personally I think such UX is embarrassingly lame so I can't get myself motivated to implement it. |
Also, some day Stylus will be able to auto-update styles from arbitrary URLs, including file://, which would provide a solution for the external editor problem without explicit weird hacks. The only remaining problem will be the need to press the update button after each file save. |
To be honest, I really wouldn't mind that. I just simply prefer to be able to use my own editor, even if it's at the cost of pressing another button. |
External editor integration can be followed here; #91 |
Greasemonkey does fine without an built-in editor to and personally, I greatly prefer to use my own editor for editing plain
.css
files in the extension's directory.Benefits would include:
.css
files, so they can work off the same source as what's in a git repostiory.The text was updated successfully, but these errors were encountered: