Closed Bug 100913 Opened 23 years ago Closed 14 years ago

Make a much nicer and customizable (with CSS) source view in Composer

Categories

(SeaMonkey :: Composer, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED EXPIRED

People

(Reporter: glazou, Unassigned)

Details

This TV film I wanted to see last night was so bad that I started re-reading the
list of RFEs we had in mind during our "brainstorming session" some time ago.
And I also started looking at the Source View mode of Composer.
I think that we can, for a low cost, do much better than that (and I have some
ideas about the way we can do it) :

1. user-defined text/font styles for (a) tag names (b) attributes (c) #PCDATA
   (d) comments (e) Processing Instructions (f) Doctype
2. increase/decrease the font size of the view
3. better prettyfying control
4. KEEP SELECTION WHEN SWITCHING TO OR FROM SOURCE VIEW

I am willing to try that in my spare time but I need some input about the way
to currently switch to/from source view, how we generate and reparse the source
view. Other Composer people please ?
This would be great!  (BTW, I think there's already an RFE somewhere for the
more specific task of color syntax highlighting like the browser source view does.)

We use the normal output system (which goes through the nsHTMLContentSerializer)
to generate the html source from the current dom; when going back, I think we
essentially do an InsertHTML of the source we're displaying (with some extra
steps to preserve things like doctype and elements inside the head which aren't
shown in the source view).

I think the browser source view gets the source from cache and then does
something like examine the source and wrap parts of it in span tags which can be
colorized by CSS.  It used to just take the dom tree and apply css rules to make
tag names show up, but that didn't work because the tag names were anonymous
content and therefore not selectable.  Perhaps we can leverage the code that the
current browser source view is using to colorize in order to make tags that the
editor can use in our own source view.

Once we have tags that CSS can bite on, the user can customize them with
userContent.css.

Keeping selection is hard (though I agree it would be wonderful if we could do
it).  The generated html source is just a string which has no direct
relationship to the original dom.  I could see doing some sort of trick, like
sandwiching anything that's currently selected in a special span tag before
calling the serializer, then looping over the source document after it's loaded
and adding to the selection anything within the (now hidden by CSS) special span
tags.  I suppose the only hard part is ensuring that the special tags don't show
up in the source view and that they're removed after we return to normal view
(and on output, of course).
Here are the related bugs already filed:
 Caret placement retained:  #47040
 Color coding like browser: #58730
 Find/Replace work: #76374
 Print: #82239
 Setting font/size: #38981
 Insert/Format menus operate: #41308
 Use Plaintext editor instead of textarea: #38981
The only related bug that matters is bug 38981. We must have a separate text 
editor with full UI and selection before *any* enhancements can be made to 
HTML source. It is currently a very simple kludge: using the <textarea> and is
a dead end. The primary blocker is support for multiple editors on one DOM tree,
which was an sfraser task and thus is now at risk. If someone can take what 
work Simon has for that and finish it, I'd love to work with the resulting 
plain text editor's UI to improve this feature, which obviously people do like.
Target Milestone: --- → Future
Status: NEW → ASSIGNED
removing myself from the cc list
I investigated a little bit how to solve this bug and I now know how (isn't it hard
to write "now know how" for a frog like me :-) ) to do it.

It's not very hard but it is, let's say, micro-surgery.

Will spend some extra cycles on it when I am back in july. I think that it would
be such a visible improvement to the source view that it prolly deserves it.
Assignee: syd → glazman
Status: ASSIGNED → NEW
Summary: [RFE] Make a much nicer and customizable (with CSS) source view in Composer → Make a much nicer and customizable (with CSS) source view in Composer
I'm on it.
Status: NEW → ASSIGNED
Fix attached to bug 47040 and solving also this bug.
Product: Browser → Seamonkey
Assignee: daniel → nobody
Status: ASSIGNED → NEW
QA Contact: sujay → composer
Target Milestone: Future → ---
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.

If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.

Query tag for this change: mass-UNCONFIRM-20090614
Status: NEW → UNCONFIRMED
MASS-CHANGE:
This bug report is registered in the SeaMonkey product, but still has no comment since the inception of the SeaMonkey project 5 years ago.

Because of this, we're resolving the bug as EXPIRED.

If you still can reproduce the bug on SeaMonkey 2 or otherwise think it's still valid, please REOPEN it and if it is a platform or toolkit issue, move it to the according component.

Query tag for this change: EXPIRED-20100420
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → EXPIRED
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.