Closed
Bug 757016
Opened 13 years ago
Closed 11 years ago
API for changing editor styling after initialization
Categories
(DevTools :: Source Editor, defect, P3)
DevTools
Source Editor
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: Honza, Unassigned)
References
Details
(Whiteboard: [sourceeditor])
Attachments
(1 file)
(deleted),
patch
|
rcampbell
:
review+
Honza
:
feedback+
|
Details | Diff | Splinter Review |
Sometimes it's useful to have API that allow to access the underlying document used for SourceEditor rendering. The document is hidden within an iframe (there are actually two iframes) Having a reference to the document can be useful e.g. for dynamic CSS style modification and/or for dynamic DOM modifications. Here is a possible workaround: var doc = this.editor._view._frameDocument; Both, _view and _frameDocument fields are private so, not safe to use. Better would be? var doc = this.editor.getViewDocument(); Honza
Comment 1•13 years ago
|
||
Why would we need to allow direct access to the DOM of the editor? Can you please list some use-cases? For styling Orion already allows theme CSS changes on-the-fly - we just need to enable them from within the Source Editor component. My main concern with giving so much power at once is that it's a footgun. Very easy to break things and it's impossible for us to maintain backwards compatibility - it would be an unsupported API. The editor is entirely responsible for the DOM of its iframe and any unexpected changes we make there can cause breakage. We need a strong case to allow such API.
Comment 2•12 years ago
|
||
Since Orion upstream no longer provides at TextView level support for changing the styling of the editor after initialization, I would like to implement this capability in the Source Editor. This would solve the need you have, without allowing direct access to the DOM of the editor and avoiding potential breakage. (slightly morphing this bug into a valid use case we have discussed. If this not OK for you, please let me know!)
Assignee: nobody → mihai.sucan
Status: NEW → ASSIGNED
Depends on: 759351
OS: Windows Vista → All
Hardware: x86 → All
Summary: Public API for accessing SourceEditor document → API for changing editor styling after initialization
Updated•12 years ago
|
Priority: -- → P3
Comment 3•12 years ago
|
||
Moving to Source Editor component. Filter on CHELICERAE.
Component: Developer Tools → Developer Tools: Source Editor
Comment 4•12 years ago
|
||
This is the proposed patch. It cleans-up how we handle stylesheets in the Source Editor and it brings new APIs to change the theme and for adding custom stylesheets into the editor view, without breaking anything. Honza: please let me know if this kind of API is sufficient for styling needs, for Firebug's use cases. Also, please note bug 760825 which adds new API specific for easy/quick changing of the editor font size - IIRC you needed something like that. Looking forward for comments. Thank you!
Attachment #646098 -
Flags: review?(rcampbell)
Attachment #646098 -
Flags: feedback?(odvarko)
Updated•12 years ago
|
Reporter | ||
Comment 5•12 years ago
|
||
Comment on attachment 646098 [details] [diff] [review] proposed patch (In reply to Mihai Sucan [:msucan] from comment #4) > Honza: please let me know if this kind of API is sufficient for styling > needs, for Firebug's use cases. If I understand correctly CSS customization (on top of the current theme) would be done through SourceEditor.setStylesheets (list of URIs to stylesheets or direct strings). It sounds good to me (I didn't test it). One of the first Firebug usage of the API would be customizing the color syntax. > Also, please note bug 760825 which adds new > API specific for easy/quick changing of the editor font size - IIRC you > needed something like that. Yes, exactly. I'll post related comment to that bug report. Thanks Mihai! Honza
Attachment #646098 -
Flags: feedback?(odvarko) → feedback+
Comment 6•12 years ago
|
||
(In reply to Jan Honza Odvarko from comment #5) > Comment on attachment 646098 [details] [diff] [review] > proposed patch > > (In reply to Mihai Sucan [:msucan] from comment #4) > > Honza: please let me know if this kind of API is sufficient for styling > > needs, for Firebug's use cases. > If I understand correctly CSS customization (on top of the current theme) > would be done through SourceEditor.setStylesheets (list of URIs to > stylesheets or direct strings). It sounds good to me (I didn't test it). That is correct. Thanks for the f+!
Comment 7•12 years ago
|
||
Comment on attachment 646098 [details] [diff] [review] proposed patch + setStylesheets: function SE_setStylesheets(aStylesheets) is that really the best way to do this?
Comment 8•12 years ago
|
||
Comment on attachment 646098 [details] [diff] [review] proposed patch in + setStylesheets: function SE_setStylesheets(aStylesheets) + if (/^[a-z]+:\/\/[^\n\r]+$/.test(aStyle) || /^data:.+/.test(aStyle)) { document your regexes. These could also be put in a constants so that's a bit more readable.
Attachment #646098 -
Flags: review?(rcampbell) → review+
Comment 10•11 years ago
|
||
This was requested for firebug. It seemed like a useful API to allow the editor component users to change editor styling. Does Honza still want to use our editor component? Is this an API he still needs? Feel free to WONTFIX this bug if you believe we don't need this kind of APIs.
Assignee: mihai.sucan → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(mihai.sucan)
Updated•11 years ago
|
Flags: needinfo?(odvarko)
Reporter | ||
Comment 11•11 years ago
|
||
(In reply to Mihai Sucan [:msucan] from comment #10) > Does Honza still want to use our editor component? Is this an API he still needs? Firebug doesn't need this anymore. The next major version of Firebug (in alpha at this moment) is based on Code Mirror (CM embedded in Firebug package). Thanks Honza
Flags: needinfo?(odvarko)
Comment 12•11 years ago
|
||
Thanks!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•