Avoid reload message.
Users have complained about needing to reload pages containing
graphs after editing the graphs (associated message: “Graph image
source changed. Reload page to display updated graph image”).
This behavior is a result of:
- graph images are created by a parser hook function which...
- uses the ImageMap extension to render graph images as HTML
which...
- requires that graph images have been uploaded prior to
rendering which...
- causes an *exception if the upload is done from within a parser
hook function so...
- the upload is done as a separate step after parsing is complete
which...
- requires the page reload to see the graph image rendered by
ImageMap
*The exception (“invalid marker” from the StripState class)
is due to a recursive call to Parser::parse.
After further investigation I found that a file upload can occur
within the context of a parser hook function but not page
creation (the latter is what causes the exception described
above). I found that by creating a dummy file page before
entering the parsing code I could upload the “real” graph images
associated with parsed wiki text on top of the dummy and thus
avoid the exception.
I am using this pre-initialized dummy file page technique to
avoid the reload message. The one case when the message still
appears is when creating more than one new graph and then doing
an edit preview (rather than saving immediately). In this case,
the first new graph is rendered immediately but the subsequent
new graphs result in the reload message.
Change-Id: Ie77e9a04b6353f74081550281bb252ae1f00a298