samwilson / diagrams-extension

A MediaWiki extension that displays GraphViz, Mscgen, PlantUML, and Mermaid diagrams in wiki pages.
https://www.mediawiki.org/wiki/Extension:Diagrams
GNU General Public License v2.0
8 stars 12 forks source link

Fixes edit preview issues (might also fix #32) #62

Closed YOUR1 closed 1 year ago

YOUR1 commented 2 years ago

The $isPreview variable would always be false; event though I was previewing the edit I made.

Thus; a relative but simple fix is by using the EditPageGetPreviewContent hook and setting the newly added variable $isPreviewing to true whenever the edit is being previewed.

YOUR1 commented 2 years ago

Checks are not related to my PR. Error: composer/installers contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe.

samwilson commented 2 years ago

I've updated composer.json, so after merging master this should be okay.

But I'm not quite sure. Why is $parserOptions->getIsPreview() not working here? It feels like this fix of using the other hook to set the preview state is relying on the order of the hook execution, which is something we're meant to avoid I think.