You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-37Lines changed: 41 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -33,43 +33,35 @@ In the configuration form you can set the Drawio server url; the default is `//e
33
33
34
34
In this form you can also enable the mathematical symbol support for SVG diagrams. The default is disabled because enabling this adds about 170k of Javascript to download, so enable only if you really need it.
35
35
36
+
36
37
## Usage
37
38
38
39
There are three macros that can be used to embed diagrams in wiki pages/issues; use what best fits your needs.
39
40
41
+
40
42
### `drawio` macro
41
-
This macro draws diagrams saved in attachments. This is for compatibility with `0.1.x` versions of the plugin and is now a bit obsolete. To use it:
42
43
43
-
- save your [draw.io] diagram locally and upload it as attachment to a Wiki or issue page.
44
-
- in Wiki (or issue) pages use the `drawio` macro to load the widget, specifying the name of the attachment. For example:
44
+
This macro is now deprecated and not working anymore. Use the `drawio_attach` macro as a direct replacement.
45
45
46
-
```
47
-
{{drawio(activity.xml, options)}}
48
-
```
49
-
- the following macro options are available (default values are shown):
50
-
-``lightbox=false`` : enable lightbox usage
51
-
-``resize=false`` : enable zoom control box
52
-
-``zoom=100`` : initial zoom of diagram (percentage of original diagram)
53
-
-``fit=true`` : fit page width (only if ``resize=false``)
54
-
-``hilight=#0000ff`` : color to hilight hyperlinks
55
-
56
-
With this macro diagrams are drawn using SVG (or maybe Canvas) so they are interactive: they are navigable,
57
-
they respond to ``over`` and ``click`` actions. Hyperlinks can be used to navigate to other items.
58
46
59
-
This macro render diagrams as SVG, so diagrams are interactive and navigable (link can be used to navigate to other pages).
47
+
### `drawio_attach` macro
60
48
61
-
This macro is now obsolete: you can now use SVG diagrams with the other two macros (``drawio_attach`` and ``drawio_dmsf``)
62
-
but you must import the the diagram in the *draw.io editor* and then export as SVG with an included copy of the diagram
63
-
(see the *Export as SVG* function of the *draw.io editor*).
49
+
This macro handles diagrams saved as attachments of issues or wiki pages.
64
50
65
-
### `drawio_attach` macro
66
-
This macro handles diagrams saved as attachments of issues or wiki pages.
51
+
The supported diagrams format are:
52
+
*`xml`: normal diagram source in XML format
53
+
*`png`: PNG image with an embedded XML source of the diagram (PNG+XML)
54
+
*`svg`: SVG image with an embedded XML source of the diagram (SVG+XML)
55
+
56
+
The `xml` format uses a Javascript viewer to render the diagram runtime. It maybe a bit slow, but adds navigation options to the diagram (zoom, page and layer selector).
67
57
68
58
With this macro the attachments are in PNG+XML, a special format consisting in an PNG image of the diagram plus the XML diagram source embeded as a field of the image.
69
59
70
60
With an``.svg`` attachment name extension the image format is handled as SVG+XML; like the PNG+XML, this is an SVG image
71
61
with an embedded XML source of the diagram (the diagram must be created with the *draw.io editor*, normal SVG are displayed but cannot be edited).
72
62
63
+
From version `1.0.0` are also supported diagrams in XML format (as used with the old `drawio` macro).
64
+
73
65
Usage is very simple:
74
66
75
67
-**make sure ``REST`` API are enabled in Redmine global settings**; this **is needed** to be able to save diagrams as attachments. To enable it, go into `Administration` -> `Settings` -> `API` tab and check the `Enable REST web service` flag.
@@ -81,19 +73,30 @@ Usage is very simple:
81
73
82
74
![Diagram placeholder][diagramPlaceholder]
83
75
84
-
Double click on the diagram to start editing with the embedded editor. When you save the the diagram the editor will close, the diagram will be saved in a new attachment and the reference in the wiki/issue page is updated.
76
+
For PNG and SVG diagrams, double click on the diagram to start editing with the embedded editor. When you save the the diagram the editor will close, the diagram will be saved in a new attachment and the reference in the wiki/issue page is updated.
77
+
78
+
For XML diagrams, a toolbar will appear when the mouse enters the diagram area; in the toolbar there is a button for start editing the diagram.
85
79
86
80
The **diagram attachments are versioned** by suffixing the name with a counter. This is necessary because is not possible to update an existing attachment. Moreover, is not possible to delete attachments throught rest API (seems to be possible from Redmine 3.3.0, but I need to experiment), so the old versions of an attachment must be explicitly (manually) deleted from the Redmine web interface.
87
81
88
82
- the following macro options are available (default values are shown):
89
83
-``size=number`` : force image width, in pixels (default, show in original size)
84
+
- only for XML diagrams:
85
+
-``hilight=#0000ff``: color to highlight diagram hyperlinks
86
+
-``tbautohide=true``: if `false` the toolbar is always visibile (if there are buttons), else it will be shown only when the mouse enters the diagram area
87
+
-``lightbox=false``: activates the *LightBox* viewer button in the toolbar
88
+
-``zoom=false``: activates the zoom buttons in the toolbar
89
+
-``page=number``: if not empty a *page selector* will appear in the toolbar (for multi-page diagrams) and the initial page (starting from 0) will be selected
90
+
-``layers``: if set as a list of space separated number of layers, those layer will be activated for default, and a *layer selector* controlo will appear in the toolbar.
90
91
91
92
In the toolbar editor there is a button with icon  that opens a dialog that can be used to insert a macro for a new diagram to be saved as attachment (for lazy people).
92
93
93
94
The dialog can be used also for modifying a macro: simply place the caret (the cursor in the editing area) somewhere in the body of the macro, click the corresponding button in the toolbar, and the dialog will open with fields pre-filled with values from the macro source. When confirming new values, the macro source will be updated.
94
95
96
+
95
97
### `drawio_dmsf` macro
96
-
This macro handles diagrams saved in the [DMSF] repository as PNG+XML or SVG+XML images. The DMSF module must be enabled for the project to be able to use this macro.
98
+
This macro handles diagrams saved in the [DMSF] repository as PNG+XML or SVG+XML images, or as XML documents (from version `1.0.0`). The DMSF module must be enabled for the project to be able to use this macro.
99
+
97
100
Usage is very simple:
98
101
99
102
-**enable the WebDAV functionality of the [DMSF] plugin in ``Read/Write`` mode**; this is necessary to be able to save the diagram from the embedded editor. If you prefer you can disable WebDAV after all editings are done.
@@ -105,21 +108,32 @@ Usage is very simple:
105
108
106
109
![Diagram placeholder][diagramPlaceholder]
107
110
108
-
Double click on the diagram to start editing with the embedded editor. When you save the the diagram the editor will close, the diagram will be saved (versioned) in the specified DMSF documents path for the current project, and the diagram will be automatically updated.
111
+
For PNG and SVG diagrams, double click on the diagram to start editing with the embedded editor. When you save the the diagram the editor will close, the diagram will be saved in a new attachment and the reference in the wiki/issue page is updated.
112
+
113
+
For XML diagrams, a toolbar will appear when the mouse enters the diagram area; in the toolbar there is a button for start editing the diagram.
109
114
110
115
- the following macro options are available (default values are shown):
111
116
-``size=number`` : force image width, in pixels (default, show in original size)
117
+
- only for XML diagrams:
118
+
-``hilight=#0000ff``: color to highlight diagram hyperlinks
119
+
-``tbautohide=true``: if `false` the toolbar is always visibile (if there are buttons), else it will be shown only when the mouse enters the diagram area
120
+
-``lightbox=false``: activates the *LightBox* viewer button in the toolbar
121
+
-``zoom=false``: activates the zoom buttons in the toolbar
122
+
-``page=number``: if not empty a *page selector* will appear in the toolbar (for multi-page diagrams) and the initial page (starting from 0) will be selected
123
+
-``layers``: if set as a list of space separated number of layers, those layer will be activated for default, and a *layer selector* controlo will appear in the toolbar.
112
124
113
125
Like for the ``drawio_attach`` macro, in the toolbar editor there is a button with icon  that opens a dialog that can be used to insert a macro for a new diagram to be saved as [DMSF] document.
114
126
115
127
As for the `drawio_attach` macro, the dialog can be used for updating a macro simply by positioning the editing cursor in the right place and clicking the button.
116
128
117
129
118
130
## Some note on the drawio editor
131
+
119
132
Someone can be concerned about security in sending own diagrams to the [draw.io] site.
120
133
121
134
The diagrams aren't sent to [draw.io] for editing/rendering, but all the operations are done by the browser using only Javascript and HTML5. The only things loaded externally are the scripts and the editor page, when the diagram editor is opened. The diagram source remains local to browser/redmine site.
122
135
136
+
123
137
## Using a personal installation of draw.io
124
138
125
139
If you like, you can configure this plugin to use your own installation of the [draw.io] site.
@@ -163,6 +177,7 @@ However it is possible to use a local installation of the library following thes
163
177
164
178
Once updated the settings, go to a wiki page with a mathematical SVG diagram and you should see the diagram exactly as before. You can check from where the library is downloaded using the browser developer tools.
165
179
180
+
166
181
## Known issues
167
182
168
183
- Diagrams are rendered on the browser so they aren't visible inside a PDF export. As workaround you can print the web page as PDF document (easy with Linux, a bit more problematic in Windows), or export the diagram in PNG format and include it as image.
@@ -171,6 +186,7 @@ Once updated the settings, go to a wiki page with a mathematical SVG diagram and
171
186
172
187
- The ``drawio_attach`` macro doesn't completly work with issue notes: Redmine APIs allow to create new issue notes, but not to change them, so the issue note must be changed manually. As alternative use the ``drawio`` and ``drawio_dmsf`` macros, which work fine.
173
188
189
+
174
190
## TODO
175
191
176
192
- Allow specify diagrams from other other sources:
@@ -186,24 +202,12 @@ Once updated the settings, go to a wiki page with a mathematical SVG diagram and
186
202
+ url of image: the url is generated by the macro (from attachment or [DMSF]), using in a widget may require an AJAX call
187
203
188
204
189
-
## Other works
190
-
If you are using [draw.io] to create *Entity Relationship* database schemas, you may be interested to the [schema2script].
191
-
192
-
This is a Ruby command line tool that parses a [draw.io] ER diagram and produces a DDL script to initialize a database schema.
193
-
194
-
For now only [H2](http://www.h2database.com) and [Oracle](https://www.oracle.com/it/database) SQL dialects are supported, but it will grow in the future.
195
-
196
-
Related to [schema2script] is the [sboot] project, that helps to create a skeleton Java application based on [Spring boot](https://projects.spring.io/spring-boot). It creates entities, repositories ([Hibernate](http://hibernate.org) based for now), DTOs, services, REST interfaces, up to a simple CRUD web interface based on [Thymeleaf](www.thymeleaf.org) or [Angular2](https://angular.io). It also creates some tests, which can be used as a starting point for other, more specific tests.
197
-
198
-
It is in early state but it is promising; with the current version you can create a complete skeleton application starting from an ER schema, which may be a good starting point for more complex applications.
199
-
200
-
201
205
## Contributing
202
206
203
207
Any code contribution is well accepted. There are only a few rules that I would like to be respected to easy merging:
204
208
205
209
- work on ``develop`` branch and leave the ``master`` branch untouched. This is importat to keep the released versions stable.
206
-
- I would prefer comments in the style used by [gitchangelog](https://github.com/vaab/gitchangelog); this will simplify generation of the ``CHANGELOG.md``.
210
+
- I would prefer comments in the style used by [gitchangelog](https://github.com/vaab/gitchangelog); this will simplify generation of the ``CHANGELOG.md``.
207
211
It isn't fundamental, I can edit comments and insert prefixes, or edit manually the ``CHANGELOG.md``, but it would be nice if you can help me.
0 commit comments