-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
…ime of scroll calculations
Also, context menu on images works in OS X now, because there is no error modal anymore. |
Hi @warabe, I don't think we would take this until it works on all platforms but you're welcome to list the extension for OSX only. |
Extension is something completely different: I wrote it first as a quick fix, it only works on OSX and substitutes the modal window (which is bad for UX, I believe). Just disregard it. :) After writing the extension I wasn't satisfied with it, so I tried to implement it in the core; that's what the request is about. The changes I'm proposing work on all platforms, I tested it under OS X and Windows XP in a Virtual Box machine. |
@warabe, here's an approach that I think would be cleaner:
What this doesn't give us is the ability to create custom editors that replace the default text editor, with full integration with Brackets' unsaved-changes tracking, undo, etc. In general, that runs contrary to the Brackets philosophy of code-first with visual widgets shown within the code view, but I could still imagine cases where that's what an extension would want. That seems a lot less urgent, though, and to do it cleanly probably requires a new implementation of Document to remove the dependency on CodeMirror (see CodeMirror document linking research). So I think it's fair to avoid tackling that area for now, and focus on read-only viewers. (cc @njx, @gruehle in case you're interested in any of the architectural discussion here) |
Actually, thinking further... one refinement to the above proposal: In this new, alternate doOpen() codepath, generate a special "read-only" flavor of Document (e.g. a subclass). This would not be backed by a CodeMirror instance, could never have unsaved changes, and would assert / throw errors when any text-related APIs are called. But it would be a valid, fairly safe standin that we could return from getCurrentDocument() and other such places. That also gives us a cleaner path forward to a future where custom viewers might allow editing too. |
@warabe closing this for now. Thanks for getting the discussion going! We talked this over in our architecture weekly today and feel like the approach outlined above is sound. Let us know if you're interested in working on that. (I've linked this to the image preview user story so the notes don't get lost). |
@peterflynn I'm going to work on that for sure, most likely this week; I'm probably going to need some help—I'll open a new request as soon as I'm close to the outlined approach. |
Ignore the above reference, I accidentally typed the wrong issue number. |
@warabe Are you working on this? I have some interest in this extension story (albeit not for images). |
@eugeneo Not right now, but you can review the pull request. |
Hi!
It's not a final pull request, but I wanted to start a discussion about the feature. I've implemented the image preview in Brackets, but I don't like the way it's currently done. That's how it works:
Now, the emphasised part is something I strongly dislike, but I couldn't find a way around it. Opening an image as a document feels like a natural way of doing this (that's how it's done in Espresso.app, for example); opening a modal for image file types, while a viable alternative, feels inconsistent in terms of user experience and blocks the UI.
As for the current architecture, Brackets is strongly tied to CodeMirror and there is no way of consistently working with the document area without using at least the wrapper (which is understandable, Brackets being a text editor and all). It would be perfect to have not just an Editor class, but a Viewer class with custom templates (somewhat like I did it in this fork) as well, and an ability to switch between the two depending on a file type, but I'm not familiar with Brackets well enough to even know if it's needed and supported by the core team, so I did what I did.
Currently, there's a few things I certainly need to do with this request before making it suitable for merging:
But before doing all this I need to make sure somebody actually needs this, and maybe somebody from the core team could help out with Editor/Viewer (or at least discuss this in detail) and the status bar.
The ugly architecture aside, it works as intended on both platforms: shows an image preview and dimensions in the status bar. It could be a start, I guess.
Regards,
Ed.