summaryrefslogtreecommitdiff
path: root/doc/bugs
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2007-10-29 17:16:10 -0400
committerJoey Hess <joey@kodama.kitenet.net>2007-10-29 17:16:10 -0400
commit683c1ebb4c510eac5bb2c2b4e85c3f7b5ded3146 (patch)
tree996adc2aaa9adc15ee0e7a6b7e68df2450599dd9 /doc/bugs
parent67acb0463b327156cfc6e0e3450eb87604d854bd (diff)
* Fix some issues with toggles in preview mode.
Diffstat (limited to 'doc/bugs')
-rw-r--r--doc/bugs/bug_when_toggling_in_a_preview_page.mdwn26
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/bugs/bug_when_toggling_in_a_preview_page.mdwn b/doc/bugs/bug_when_toggling_in_a_preview_page.mdwn
index 2d5b881c2..2f1b5f68c 100644
--- a/doc/bugs/bug_when_toggling_in_a_preview_page.mdwn
+++ b/doc/bugs/bug_when_toggling_in_a_preview_page.mdwn
@@ -1,3 +1,29 @@
When toggling an item while being in a web-editing session in the *Preview* frame,
you'll lose the context of the editing session and will be directed to the wiki's
main page instead. --[[tschwinge]]
+
+Making toggles actually work in preview is hard: The toggle plugin uses
+a format hook to add javascript to the page, after htmlscrubber runs. Page
+preview does not currently run the format hook.
+
+I think that is not done because the format hook is supposed to get the
+entire html file contents, including the html head and body elements, and
+in the case of page preview, such a full page is not being generated,
+instead it's just inlining the previewed page into the edit form.
+
+If the format hook were called on this partial data, hooks that looked for
+body tags etc would break. OTOH, if in preview mode it were run on the
+whole edit form page, ones like toc that parse the page would have
+unexpected results, since they would also parse the edit form.
+
+(Also, if format were run in preview mode then plugins like linkmap, which
+generate object files in their format hook, would need to be changed to not
+do this during preview (to avoid preview mode writing files to the wiki).
+So the format hook would need to be passed a flag indicating preview mode.)
+
+So I don't see a good way to call the format hook in preview mode.
+Failing that, the best I can do is make the toggle plugin detect preview
+mode, and generate nonfunctional toggles that warn they're not toggleable
+in preview mode. I've [[done]] that, which also fixes the incidental issue of
+the toggle link pointing to the wrong place, which was due to the use of the
+&lt;base&gt; tag in the preview page template. --[[Joey]]