Difference between revisions of "DrawioEditor"
(Created page with "https://stackoverflow.com/questions/57714957/drawioeditor-extension-does-not-seem-to-work-in-mediawiki-1-33") |
|||
Line 1: | Line 1: | ||
https://stackoverflow.com/questions/57714957/drawioeditor-extension-does-not-seem-to-work-in-mediawiki-1-33 | The following instruction<ref>Stack Overflow, https://stackoverflow.com/questions/57714957/drawioeditor-extension-does-not-seem-to-work-in-mediawiki-1-33</ref> is an excerpt from Stack Overflow: | ||
If you follow the official MediaWiki "Extension:DrawioEditor" installation instructions (https://www.mediawiki.org/wiki/Extension:DrawioEditor) then it will never work with a greenfield installation. Their single line change requirement in LocalSettings.php is ridiculous. Instead, you need to enable the uploads option and only then will the "Edit" button appear. But to see the diagrams you will also need to enable scalable vector graphics (svg). | |||
Do the following: | |||
Download MediaWiki's DrawioEditor and place its contents into the "extensions/DrawioEditor" directory. | |||
Download Mediwiki's NativeSvgHandler and place its contents into the "extensions/NativeSvgHandler" directory. | |||
Update the LocalSettings.php to include this line (if not already defined): wfLoadExtension( 'NativeSvgHandler' ); | |||
Update the LocalSettings.php to include this line (if not already defined): wfLoadExtension( 'DrawioEditor' ); | |||
Update the LocalSettings.php to include this line (if not already defined): $wgDrawioEditorImageInteractive = true; | |||
chmod & chown & chgrp the extensions/NativeSvgHandler folder similarly as your other extension folders (if using UNIX or a Synology NAS). | |||
chmod & chown & chgrp the extensions/DrawioEditor folder similarly as your other extension folders (if using UNIX or a Synology NAS). | |||
Extend the default FileExtensions array to also include the svg MIME type by adding this line into the LocalSettings.php file if not already set: $wgFileExtensions[] = 'svg'; | |||
Enable uploads within your LocalSettings.php to true: $wgEnableUploads = true;. Without this setting you will NOT see the "Edit" button. | |||
Now refresh the page containing the diagram and you should finally see an "Edit" link in the top right corner of the diagram's bounding box, which you had already correctly defined within the page as {{#drawio:ChartName}}. | |||
NOTE: I should also point out that if you are using a MediaWiki earlier than v1.35, then you will need to set additional settings within LocalSettings.php because v1.35 correctly defaults a lot of the values relating to svg configuration, whereas the earlier MediaWiki versions did not so you may need to explicitly define some of the values with additional config. | |||
NOTE2: Sometimes there is an issue with the text labels NOT appearing in the diagrams (MediaWiki v1.35), but the problem relates to bugs in both MediaWiki and DrawioEditor, so there are three lines of code you need to alter to see the text labels as described here: T271347 which affects these two files under your mediawiki directory: | |||
includes/upload/UploadBase.php | |||
extensions/DrawioEditor/resources/ext.drawioeditor.js | |||
=References= |
Latest revision as of 15:39, 8 June 2021
The following instruction[1] is an excerpt from Stack Overflow:
If you follow the official MediaWiki "Extension:DrawioEditor" installation instructions (https://www.mediawiki.org/wiki/Extension:DrawioEditor) then it will never work with a greenfield installation. Their single line change requirement in LocalSettings.php is ridiculous. Instead, you need to enable the uploads option and only then will the "Edit" button appear. But to see the diagrams you will also need to enable scalable vector graphics (svg).
Do the following:
Download MediaWiki's DrawioEditor and place its contents into the "extensions/DrawioEditor" directory. Download Mediwiki's NativeSvgHandler and place its contents into the "extensions/NativeSvgHandler" directory. Update the LocalSettings.php to include this line (if not already defined): wfLoadExtension( 'NativeSvgHandler' ); Update the LocalSettings.php to include this line (if not already defined): wfLoadExtension( 'DrawioEditor' ); Update the LocalSettings.php to include this line (if not already defined): $wgDrawioEditorImageInteractive = true; chmod & chown & chgrp the extensions/NativeSvgHandler folder similarly as your other extension folders (if using UNIX or a Synology NAS). chmod & chown & chgrp the extensions/DrawioEditor folder similarly as your other extension folders (if using UNIX or a Synology NAS). Extend the default FileExtensions array to also include the svg MIME type by adding this line into the LocalSettings.php file if not already set: $wgFileExtensions[] = 'svg'; Enable uploads within your LocalSettings.php to true: $wgEnableUploads = true;. Without this setting you will NOT see the "Edit" button.
Now refresh the page containing the diagram and you should finally see an "Edit" link in the top right corner of the diagram's bounding box, which you had already correctly defined within the page as
.
NOTE: I should also point out that if you are using a MediaWiki earlier than v1.35, then you will need to set additional settings within LocalSettings.php because v1.35 correctly defaults a lot of the values relating to svg configuration, whereas the earlier MediaWiki versions did not so you may need to explicitly define some of the values with additional config.
NOTE2: Sometimes there is an issue with the text labels NOT appearing in the diagrams (MediaWiki v1.35), but the problem relates to bugs in both MediaWiki and DrawioEditor, so there are three lines of code you need to alter to see the text labels as described here: T271347 which affects these two files under your mediawiki directory:
includes/upload/UploadBase.php extensions/DrawioEditor/resources/ext.drawioeditor.js