Closed
Bug 133598
Opened 23 years ago
Closed 22 years ago
<editor> tag in XUL should support creation of different editors with "editortype" attribute
Categories
(SeaMonkey :: Composer, defect)
SeaMonkey
Composer
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla1.2beta
People
(Reporter: sfraser_bugs, Assigned: cmanske)
References
Details
Attachments
(1 file, 5 obsolete files)
10.10 KB,
patch
|
akkzilla
:
review+
sfraser_bugs
:
superreview+
|
Details | Diff | Splinter Review |
Currently, it's not possible to just put an <editor> tag in your XUL, and have
it automatically work. You have to have a bunch of JS as well that sets
everything up.
With the editor embedding work, we now have the power to make <editor> do the
right thing. With some minor XBL hacking, we can get <editor> to automagically
set up an editor.
Reporter | ||
Comment 1•23 years ago
|
||
I think <editor> is an important enough XUL feature that this should work for 1.0.
Target Milestone: --- → mozilla1.0
Reporter | ||
Comment 2•23 years ago
|
||
First cut at making <editor> work automagically. Note that you should not check
this in without fixing existing <editor> users, and changing the editor
instantiation and ownership by nsEditorShell.
Comment 3•23 years ago
|
||
Comment on attachment 76353 [details] [diff] [review]
<eidtor> XBL goodness
In addition to the comments Simon makes above regarding checking in this patch,
please also remove the tabs.
note: I am setting the needs-work flag because the patch is incomplete.
Attachment #76353 -
Flags: needs-work+
Comment 4•23 years ago
|
||
Please update this bug with an [adt1] - [adt3] impact rating (or take it off the
list if it doesn't even rate adt3.) Thanks!
Reporter | ||
Comment 6•23 years ago
|
||
Pre-sabbatical bug triage. ->saari, for triage.
Assignee: sfraser → saari
Comment 7•23 years ago
|
||
->mjudge
Assignee: saari → mjudge
Target Milestone: mozilla1.0 → mozilla1.2alpha
leaving assigned to me. XBL work is needed here. I will try to find sfrasiers
hack he did before to get this to work.
Status: NEW → ASSIGNED
Reporter | ||
Comment 9•22 years ago
|
||
My hack is attached to this very bug.
Assignee | ||
Comment 10•22 years ago
|
||
I experimented with Simon's XBL code by simply replacing existing "editor"
binding code in general.xml just to prove the concept and it seems to work fine
for getting all the attributes, and getting the nsIEditor/nsIHTMLEditor from
the <editor> element.
Of course this isn't a good thing to do until all the editorShell stuff is
converted and the init code is worked out; e.g., with the new code,
nsIWebProgressListener and command controllers are installed twice.
So would I be correct in assuming that all the initialization that is in
editorShell that isn't already being done in nsEditorSession needs to be moved
into the latter?
Assignee | ||
Comment 11•22 years ago
|
||
Seems like I should take this bug now.
Reporter | ||
Comment 12•22 years ago
|
||
> So would I be correct in assuming that all the initialization that is in
> editorShell that isn't already being done in nsEditorSession needs to be moved
> into the latter?
I'm not sure about 'all'. You'll see that nsEditingSession already does a lot of
stuff: makes controllers, registers load listeners etc.
Be careful about moving nsEditorShell code wholesale into nsEditingSession; that
might not be its rightful new home (talk to akkana about nsEditorShell issues).
Also be sure to keep the stuff in nsEditingSession generic enough that it's not
tied too closely to any one editor type. The plan is that nsEditingSession
should be able to manage different types of editors (say, frameset/html/xml/svg
or whatever). So it's not the job of the nsEditingSession to say whether
specific content can be edited; you'll have to push that burden onto the editors
themselves.
Kin suggested that we register editors with progIDs that say what they can
handle by MIME type (e.g. "@mozilla.org/editor/text/html",
"@mozilla.org/editor/text/plain") or by combination of MIME type and certain
tags ("@mozilla.org/editor/text/html-frameset") or something. However, this
pushes the tag sniffing onto the nsEditingSession; somehow, it still needs to be
told what tags to sniff for.
Assignee | ||
Updated•22 years ago
|
Assignee | ||
Comment 13•22 years ago
|
||
*** Bug 79895 has been marked as a duplicate of this bug. ***
Assignee | ||
Updated•22 years ago
|
Summary: <editor> tag in XUL should just work → <editor> tag in XUL should support creation of different editors with "editortype" attribute
Assignee | ||
Comment 14•22 years ago
|
||
Attachment #76353 -
Attachment is obsolete: true
Assignee | ||
Updated•22 years ago
|
Whiteboard: [FIX IN HAND] need r=,sr=
Target Milestone: mozilla1.2alpha → mozilla1.2beta
Assignee | ||
Updated•22 years ago
|
Blocks: editorshell
Comment 15•22 years ago
|
||
Comment on attachment 102860 [details] [diff] [review]
New editor bindings with support for editortype attribute
it looks like there are tabs in here; also seems to be inconsistent whitespace
(blank lines) between some of the properties
It seems like this can't go in early since you are removing the editorshell
property. This needs to be committed with other patches.
Assignee | ||
Comment 16•22 years ago
|
||
Changed previous XBL to autostart editor only when "editortype" is supplied.
Attachment #102860 -
Attachment is obsolete: true
Comment 17•22 years ago
|
||
Comment on attachment 102938 [details] [diff] [review]
New editor bindings with support for editortype attribute v2
>+ if (this.editorType)
editorType or editortype? (attribute is and should be lower case)
>+ makeEditable(true);
Should be this.makeEditable
>+ <method name="makeEditable">
>+ <parameter name="waitForUrlLoad"/>
>+ <body>
No tabs please! (applies to other examples).
>+ <![CDATA[
>+ try
>+ {
>+ this.editingSession.makeWindowEditable(this.contentWindow, this.editortype, waitForUrlLoad);
>+ }
>+ catch(ex)
>+ {
>+ dump("makeEditable got exception: " + ex + "\n");
>+ }
Do you really want try/catch here (and other examples)?
Caller might prefer to catch exceptions.
>+ <method name="getEditor">
>+ <parameter name="containingWindow"/>
Isn't this always going to be the content window (and other example)?
>+ <property name="editable"
>+ onget="return this.getAttribute('editable');"
>+ onset="this.setAttribute('editable',val); return val;"/>
What does this do? Is this watched by the editor?
>+ <property name="editortype"
>+ onget="return this.getAttribute('editortype');"
>+ onset="this.setAttribute('editortype',val); return val;"/>
Almost the same here, although I see you using the getter.
Assignee | ||
Comment 18•22 years ago
|
||
Neil: oops :(, wrong patch.
Yes, the "editortype" is all lower case.
And "editable" is not supposed to be there (earlier experiment).
Question about try/catch is a good one.
Assignee | ||
Comment 19•22 years ago
|
||
This includes removing editorShell from nsEditorBoxObject, since it is no
longer
needed.
Errors spotted by Neil are correct, but I left in the try/catch pending
opinions
from other reviewers.
Attachment #102938 -
Attachment is obsolete: true
Assignee | ||
Comment 20•22 years ago
|
||
Removing nsIEditorBox will be done in another bug.
I think I finally removed all the tabs!
Attachment #103060 -
Attachment is obsolete: true
Comment 21•22 years ago
|
||
I agree with Neil's suggestion of throwing exceptions and letting the caller
handle error conditions -- assuming that this value can get back to C++ as a
return value and not require C++ exception handling. I'm not clear whether it
works that way or not. If we can't do that, we do need some way of
communicating an error to the caller -- dump(e) alone isn't enough. Charley and
I discussed catching the error and returning true or false; if specific
exception info doesn't get returned, then maybe that's all we can do. Need more
info.
You should probably remove the dump() calls.
+ if (this.editortype)
+ makeEditable(true);
What about Neil's suggestion of this.makeEditable? Does it matter?
Comment 22•22 years ago
|
||
From further discussion on #editor I realized that we need to make the question
really clear:
When calling these interfaces from C++, if an exception is thrown, will it
(a) crash
(b) return the fact that an exception was thrown, but no further info
(c) return info about which exception was thrown
? If (a) or (b), then Charley should catch exceptions, and return true or false
to indicate error or success. If (c), then we should let the exception be
thrown and let the caller handle it.
Reporter | ||
Comment 23•22 years ago
|
||
When calling these interfaces from C++, if an exception is thrown, will it
(a) crash
(b) return the fact that an exception was thrown, but no further info
(c) return info about which exception was thrown
JS exceptions != C++ exceptions
JS exceptions get thrown when XPCOM interface calls return errors. Our C++
never, ever throws exceptions; all the C++ error handling is simply done via
nsresult return values.
As for returning errors from the XBL, JS exceptions are enough. XBL
methods/properties are not callable/accessible from C++.
Assignee | ||
Comment 24•22 years ago
|
||
Simon: I agree. Can you SR this, please?
Now that Simon has confirmed that the try/catch in XBL code is a good thing,
can someone please confirm with an r=?
Reporter | ||
Comment 25•22 years ago
|
||
> Now that Simon has confirmed that the try/catch in XBL code is a good thing,
> can someone please confirm with an r=?
Why would you not want to let exceptions propagate out of the XBL?
Assignee | ||
Comment 26•22 years ago
|
||
Ok, I'll drop the try/catch in getEditor and getHTMLEditor
Comment 27•22 years ago
|
||
Comment on attachment 103221 [details] [diff] [review]
New editor bindings with support for editortype attribute v3
r=akkana with these fixes:
1. this.makeEditable (probably doesn't make a difference but apparently it's
the standard pattern in xbl).
2. Remove the try/catch.
3. Remove the various dump()s.
Attachment #103221 -
Flags: review+
Reporter | ||
Comment 28•22 years ago
|
||
Comment on attachment 103221 [details] [diff] [review]
New editor bindings with support for editortype attribute v3
Address akkana's issues, and sr=sfraser
Attachment #103221 -
Flags: superreview+
Assignee | ||
Comment 29•22 years ago
|
||
This has the changes requested by Akkana.
It also includes changes to nsIEditorBoxObject to remove both editor and
editorShell references. After further discussion, we decided we need to keep
this
object around for awhile, so we should these changes now.
Attachment #103221 -
Attachment is obsolete: true
Comment 30•22 years ago
|
||
Comment on attachment 103752 [details] [diff] [review]
New editor bindings with support for editortype attribute v4
>- <property name="editor"
Wow, we don't need to get the nsIEditor from the box object any more either?
We're sure that no clients will need it? Cool, if so.
It looks like Init now looks like this:
>@@ -98,30 +82,6 @@
> {
> nsresult rv = nsBoxObject::Init(aContent, aPresShell);
> if (NS_FAILED(rv)) return rv;
> return NS_OK;
> }
>
If I'm reading that right, can you change that to
{
return nsBoxObject::Init(aContent, aPresShell);
}
?
Fix that, and r=akkana.
Attachment #103752 -
Flags: review+
Assignee | ||
Comment 31•22 years ago
|
||
doh! Sure is simpler! change to:
return nsBoxObject::Init(aContent, aPresShell);
has been made.
Whiteboard: [FIX IN HAND] need r=,sr= → [FIX IN HAND] need sr=
Reporter | ||
Comment 32•22 years ago
|
||
Comment on attachment 103752 [details] [diff] [review]
New editor bindings with support for editortype attribute v4
sr=sfraser
Attachment #103752 -
Flags: superreview+
Assignee | ||
Updated•22 years ago
|
Whiteboard: [FIX IN HAND] need sr= → [FIX IN HAND] need a=
Assignee | ||
Comment 33•22 years ago
|
||
checked into 1.3a trunk
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Whiteboard: [FIX IN HAND] need a=
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•