SVG Macro
Allows displaying and editing of SVG using svg-edit |
Type | XAR |
Category | |
Developed by | Ludovic Dubost, xwiki:XWiki.jirutka |
Active Installs | 40 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
This macro uses SVG Edit Project.
Example
If you copy/paste this example you should see an SVG Drawing below and you can edit it by clicking on the edit icon:
<svg width="640" height="480" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Layer 1</title>
<rect transform="rotate(29.0349, 399.602, 239.6)" stroke-width="5" stroke="#000000" fill="#0000ff" id="svg_1" height="213.948426" width="324.49861" y="132.625181" x="237.349801"/>
<text x="374.6" y="242.1" id="svg_2" fill="#000000" stroke="#000000" stroke-width="0" font-size="24" font-family="serif" text-anchor="middle" xml:space="preserve" transform="matrix(1, 0, 0, 1, 27, 10)">This is an SVG Drawing</text>
</g>
</svg>
{{/svg}}
Result
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.
You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:
- Log in the wiki with a user having Administration rights
- Go to the Administration page and select the Import category
- Follow the on-screen instructions to upload the downloaded XAR
- Click on the uploaded XAR and follow the instructions
- You'll also need to install all dependent Extensions that are not already installed in your wiki
Import in an XWiki 2.x installation. Visit the XWiki.SVGMacro page to see a demo.
XWiki Enterprise Manager Specific Notes
- With XEM running XWiki 2.0 and 2.1 you will need to install it in both the Main Wiki and the Wiki you want to use it on.
- With XWiki 2.2 and later you can only install it in the Wiki you want to use it on.
Release Notes
v1.4
- Upgraded to svg-edit 2.7.1
- Imported the code on github in: https://github.com/xwiki-contrib/macro-svg
v1.3
- Remove useless menu items from SVG Edit (open and export).
- Modified to use image size from the SVG tag by default, when no width or height parameters are set; thus canvas size can be adjusted from SVG Edit.
v1.2
- Updated to SVG Edit version 4.6 and refactored JS macro.
- Added confirmation dialog to save image before closing editor.
- Disabled closing editor by clicking on overlay (use close button).
v1.1
Fixed the wrong macro scope (from current user to current wiki), plus minor cleanup.
v1.0
It uses the XWiki SVG Plugin which uses FOP to render the SVG to images. On certain platforms there might be slight differences in rendering depending on the way FONTs are rendered.
This version is based on SVG Edit 2.4 for the editing which is supported by browsers supporting SVG.