[RFE] Insert Table of Contents

RESOLVED FIXED in mozilla1.3alpha

Status

SeaMonkey
Composer
P5
enhancement
RESOLVED FIXED
15 years ago
13 years ago

People

(Reporter: imran.geriskovan, Assigned: glazou)

Tracking

Trunk
mozilla1.3alpha

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fix i n hand, needs r=, needs sr=)

Attachments

(2 attachments, 2 obsolete attachments)

(Reporter)

Description

15 years ago
"Insert Table of Contents" menu item is needed in composer.

Composer may construct a set of links for headings found in the document.

Comment 1

15 years ago
No dupe found

==> NEW
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Insert Table of Contents → [RFE] Insert Table of Contents

Updated

15 years ago
Severity: normal → enhancement
(Assignee)

Comment 2

15 years ago
Easy :-) Install the Extensions PlaceHolder XPI for Composer first, and then
TOCMaker 1.0 XPI from , both available from
http://cascades.mozdev.org/installation.html

Enjoy :-)

(Assignee)

Comment 3

15 years ago
getting
Assignee: syd → glazman
(Assignee)

Comment 4

15 years ago
Created attachment 104753 [details] [diff] [review]
patch #1
(Assignee)

Updated

15 years ago
Status: NEW → ASSIGNED
Priority: -- → P5
Whiteboard: fix i n hand, needs r=, needs sr=
Target Milestone: --- → mozilla1.3alpha

Comment 5

15 years ago
Glazman: I editing www.mozilla.org and had some JS errors when using the dialog.
(Assignee)

Comment 6

15 years ago
Created attachment 106900 [details] [diff] [review]
new patch to resolve recent conflicts

Charley, I don't see any error on the JS console ; I am using a very recent
build and the latest patch.
Attachment #104753 - Attachment is obsolete: true
(Assignee)

Comment 7

15 years ago
Comment on attachment 106900 [details] [diff] [review]
new patch to resolve recent conflicts

Charley, can you re-review please ?
Attachment #106900 - Flags: review?(cmanske)

Comment 8

15 years ago
Comment on attachment 106900 [details] [diff] [review]
new patch to resolve recent conflicts

very cool feature!
Attachment #106900 - Flags: review?(cmanske) → review+
(Assignee)

Comment 9

15 years ago
Comment on attachment 106900 [details] [diff] [review]
new patch to resolve recent conflicts

Peterv: do you think you can sr it before monday ? Tree closes next week and
we'd really like this to go in before the closure. Thanks!
Attachment #106900 - Flags: superreview?(peterv)
Comment on attachment 106900 [details] [diff] [review]
new patch to resolve recent conflicts

I'll attach the patch with my comments in them.
Attachment #106900 - Flags: superreview?(peterv) → superreview-
Created attachment 107873 [details] [diff] [review]
Comments on the patch
(Assignee)

Comment 12

15 years ago
Comment on attachment 107873 [details] [diff] [review]
Comments on the patch

>>+  // we need an array to store all TOC entries we find in the document
>>+  var tocArray = new Array();
>
>Can't you do everything in one pass, instead of filling an array and
>then looping over the items in the array?

I want to avoid that because the TOC can be inserted in the middle
of an element that has to be listed in the TOC. In that case, the
insertion of the TOC splits the element in two but only one TOC
entry should be generated.
The TOC can also count the list items in the document (although it's
an edge case) and since it inserts LI... I could tweak the filter
but is it really worth the case?

>>+  var nodeList = theDocument.documentElement.getElementsByTagName("a");
>>+  for (var j = nodeList.length-1; j >= 0; --j) {
>>+    var anchor = nodeList.item(j);
>>+    if (anchor.nodeName.toLowerCase() == "a"
>>+        && anchor.hasAttribute("name")
>>+        && anchor.hasAttribute("class")
>>+        && anchor.getAttribute("class").substr(0, 6) == "mozToc") {
>>+      anchor.parentNode.removeChild(anchor);
>>+    }
>
>A tree walker would be nice here

Why not. Btw, the test
|anchor.nodeName.toLowerCase() == "a"| is redundant with
the call to |getElementsByTagName()| above...
(Assignee)

Comment 13

15 years ago
Created attachment 107896 [details] [diff] [review]
In answer to peterv's review.
(Assignee)

Updated

15 years ago
Attachment #106900 - Attachment is obsolete: true
Comment on attachment 107896 [details] [diff] [review]
In answer to peterv's review.

+function BuildTOC(update)
+{

+      var classArray = node.getAttribute("class").split(" ");
+      for (var j = 0; j < classArray.length; j++) {

++j

+      var commentText = "mozToc ";
+      for (var j = 0; j < 6; j++) {

++j

Index: ui/composer/content/editorOverlay.xul
===================================================================
RCS file: /cvsroot/mozilla/editor/ui/composer/content/editorOverlay.xul,v
retrieving revision 1.220
diff -u -r1.220 editorOverlay.xul
--- ui/composer/content/editorOverlay.xul	12 Nov 2002 22:52:54 -0000     
1.220
+++ ui/composer/content/editorOverlay.xul	2 Dec 2002 13:02:28 -0000
@@ -305,6 +305,9 @@
	   <menuitem id="menu_newBlankPage" label="&newBlankPageCmd.label;" 
		     accesskey="&newBlankPage.accesskey;"
key="key_newBlankPage"
		     command="cmd_newEditor"/>
+	   <menuitem id="XXXXmenu_newEditorTemplate"
+		     label="New from template"
+		     oncommand="NewEditorFromTemplate()"/>

Undo this change.
With the lengths of the consts as const, sr=peterv.
Attachment #107896 - Flags: superreview+
(Assignee)

Comment 15

15 years ago
Checked in (trunk). Ô joy, ô happiness.
Thanks to peterv for fast reviews.
Status: ASSIGNED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.