Giter Site home page Giter Site logo

cosmocode / dokuwiki-plugin-diagrams Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 5.0 559 KB

Integration with diagrams.net

Home Page: https://www.dokuwiki.org/plugin:diagrams

License: GNU General Public License v2.0

PHP 46.61% JavaScript 51.87% Less 1.52%

dokuwiki-plugin-diagrams's Introduction

diagrams Plugin for DokuWiki

Integration of diagrams.net. Create and edit diagrams in DokuWiki.

All documentation for this plugin can be found at
https://www.dokuwiki.org/plugin:diagrams

If you install this plugin manually, make sure it is installed in
lib/plugins/diagrams/ - if the folder is called different it
will not work!

Please refer to http://www.dokuwiki.org/plugins for additional info
on how to install plugins in DokuWiki.

----
Copyright (C) CosmoCode GmbH <[email protected]>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

See the COPYING file in your DokuWiki folder for details

dokuwiki-plugin-diagrams's People

Contributors

alexgearbox avatar annda avatar githubkoma avatar schplurtz avatar splitbrain avatar tictactoe101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dokuwiki-plugin-diagrams's Issues

Buttons in one row

The "Open", "Download PNG", "Download SVG" and "Edit" buttons take up too much space (height) below the diagrams. I think it would be significantly better if the buttons were in one row. A setting or an option of which buttons are displayed would also be very welcome.

Open Links in Top Window

With the current version links are opened only in one frame. I went back several commits and ended up with this one: 2aa4335 .
Is it possible that this change prevents the links from opening in top window?

Multiline support of diagrams in PDF

If a diagram, which is created by the diagrams plugin, contains a text element with several lines, there is a problem when generating PDF files with the dw2pdf plugin:
There, only the first line with three attached dots is output then.

Example:
A diagram with this text:
image

becomes:
image

(I've put the same issue at the both plugins dw2pdf and diagrams)

Regards
Juergen

SVG are not displayed, due to nocache parameter

Issue: after adding a diagram to a page, the diagram is not rendered, only the Edit diagram button appear.

  • Browser inspector indicates a 404 on the svg url: /dokuwiki/lib/exe/fetch.php/mypage/mydiagram.svg&cache=nocache
  • Removing "&cache=nocache" laed to a valid url.
  • I temporarily tweaked lib/plugins/diagrams/syntax.php in order to change the link, but I guess this issue should be further investigated

Google Fonts Loading Problem using SVG/Diagram

Copied from: dokuwiki/dokuwiki#3709 (comment)

I'm testing RC2 (Igor) and comparing functionality to Hogfather on IIS (both on Win 10)

Trying to load an SVG image created using the diagrams plugin (I am using the most current (April '22) version on both hogfather and igor.

Using the default docuwiki template for both Igor and Hogfather.

Added the following items to \conf\meta.html:

  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Architects+Daughter&family=Roboto&family=Roboto+Flex:[email protected]&family=Source+Code+Pro&display=swap" rel="stylesheet">

Trying to render an SVG file which references the external Google font "Architects Daughter".

Because the problem occurs on Igor and NOT on Hogfather, I'm recording an issue here.

More information:

fetch.php attempts to retrieve the SVG document and the following error is thrown in the "Developer tools" Issues log:

Refused to load the font 'data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAMAIAAAwBAT1MvMoWwV7IAAGWAAAAAYGNtYXDPBugkAABl4AAAARxnYXNwAAAAEAAAkvgAAAAIZ2x5Zv2v7C0AAADMAABb/GhlYWQC0dksAABfqAAAADZoaGVhCEMEFgAAZVwAAAAkaG10eN2yH1kAAF/gAAAFfGxvY2GKxKMcAABc6AAAAsBtYXhwAa4AzAAAXMgAAAAgbmFtZUarZSoAAGcEAAAlEHBvc3QANIw5AACMFAAABuNwcmVwaAaMhQAAZvwAAAAHAAIAFv/5AHwDhQAKABMAADcyFhUGBwYiJicmEwYQByM0NxI1PyoTCyUGDhUFC1sGD0MIDkMQCSgIAQgKGQNhGv2rLWebAS1pAAIANgHqANcC+wALABcAABM3JzQ3FxUXDgEjIic3JzQ3FxUXDgEjIpIBASQREAMZBSRcAQEkEBEEGAUkAlIcKVMREMciAw...V4DFRjb21tYWFjY2VudAx0Y29tbWFhY2NlbnQGVGNhcm9uBFRiYXIEdGJhcgZVdGlsZGUGdXRpbGRlB1VtYWNyb24HdW1hY3JvbgZVYnJldmUGdWJyZXZlBVVyaW5nBXVyaW5nDVVodW5nYXJ1bWxhdXQNdWh1bmdhcnVtbGF1dAdVb2dvbmVrB3VvZ29uZWsLV2NpcmN1bWZsZXgLd2NpcmN1bWZsZXgLWWNpcmN1bWZsZXgLeWNpcmN1bWZsZXgGWmFjdXRlBnphY3V0ZQpaZG90YWNjZW50Cnpkb3RhY2NlbnQHQUVhY3V0ZQdhZWFjdXRlC09zbGFzaGFjdXRlC29zbGFzaGFjdXRlDFNjb21tYWFjY2VudAxzY29tbWFhY2NlbnQGV2dyYXZlBndncmF2ZQZXYWN1dGUGd2FjdXRlCVdkaWVyZXNpcwl3ZGllcmVzaXMGWWdyYXZlBnlncmF2ZQRFdXJvC2NvbW1hYWNjZW50AAABAAH//wAP' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

I've set the CORS setting to be * in the configuration. With or without the "*", the same error appears.

The issue that I'm seeing is that the FONT does not render properly within the SVG image but the SVG vectors and shading does render properly.

This is an example SVG which demonstrates the problem:

test

Steps to reproduce:

  1. Position the attached test file into the \data\media directory as 'test.svg'
  2. Access the image through the media manager and view it using 'edit diagram' function.

The image should appear properly as
image

Attempt to insert that image on a test page '{{ :test.svg |}}' and the following will appear:
image

Thank you

From Andreas:

dokuwiki/dokuwiki#3709 (comment)

Diagrams jump on section highlight

When hovering over the edit buttons, the diagrams in the section are reloaded and rerendered. That causes extreme reflow and repeated requests.

Can't save diagrams to a dokuwiki page

Hello! I'm running a self-hosted diagrams.net (draw.io) webapp with apache tomcat + apache2 server on a local network. In my dokuwiki, everything works fine, but I can't save diagrams created via "diagrams" plugin. There is no save button on the right side of diagrams editor, only "share" button. "Diagrams" webapp proposes me to save my diagram to a cloud service or to my computer, but I can't save it to my dokuwiki page for some reason :( Am I missing something?

My setup:

  • Operating system: Ubuntu 22.04.2 LTS
  • Apache 2 server with DokuWiki installed.
  • Tomcat server that runs as www-data user with draw.io (diagrams) webapp installed on it.

Apache 2 is configured to run only in local network (ip range). Cross domain requests allowed in Apache 2 (tomcat serves apps via a different port than Apache 2).

DokuWiki is available at a local ip address. Draw.io webapp is available at the same ip address, but with a :8080 added at the end.

Maybe I have to set permissions somewhere else?

save-dialog01
save-dialog02

Cannot save changes

After updating the diagrams (2023-08-09), I realized that I cannot save changes made to diagrams created in the past. But it is possible to save changes made to newly created diagram.

Thanks.

Link targets cannot be set when on DokuWiki master

Although stable and master have the same jQuery version, this simple code no longer works with current master (a9e0708e3513a197e4d966f7c0b93b2379807a14)

jQuery('object.diagrams-svg').each( function() {
    jQuery(this.contentDocument).find('svg').find('a').attr('target', '_parent');
});

contentDocument is null

"Saving failed" error message but the edited diagram is updated

Sometimes after hitting Save in the online editor an alert with the message 'Saving failed' is displayed.

The user is not redirected back to the wiki, or more specifically the iframe is not removed. However, the recent edits are properly saved in the SVG file.

Saving for non-admin users still broken

#18 fixed the problem of creating new diagrams for non-admin users. However when trying to edit an existing digram the problem still exists. The edit button is shown correctly, the draw.io editor opens correctly but the change is never written back. A quick look at the network traffic showed a 200 from the upload process, so I'm not sure what went wrong. It does work fine for admin users.

Encoding issues

Sometimes the umlauts on the page are broken after saving a diagram. Any idea?

Did not occur without the diagrams plugin.

Link in media manager not easy to detect

Hello,

I've installed the plugin in our dokuwiki farm. I think that it is not easy to detect the link to create a new diagram. Maybe this one can be highlighted a little better?

grafik

Thank you in advance.
Kind regards
proxymus

File name format or extension error:

Hi,

I get this error if want to open draw.io or create a new chart.
File name format or extension error: should be filename.extension (availible extension :png)

How can I solve this problem?
Thx for the help.

bad data uri ""

If I click OK without having created a diagram before (via Diagramm editieren) I get the errors bad data uri "" and Failed to handle action: save after saving the page.

Could we hide the OK button in this case?

image

image

ACL Problems

The documentation says "Edit buttons are available in two places:
in the fullscreen media manager in the View tab, which is displayed when an image is selected
on a wiki page with an embedded diagram (only if the user has upload permissions for the given diagram file)."

While the first is ok I find the second to be true only when logged in as admin.

In addition I am not able to create a diagram as user with the media manager popup. No error is produced, only the file is not created.

ACL are set on the namespace. I do not know how to set a permission on a mediafile, but I guess namespace is what is meant.

On the other hand, I am allowed to change/upload the diagram file via the full screen media manager.

I would guess my ACL is corrupted, but as both ways should yield identical results, there also might be something wrong with the ACL checks in the code.

Move Support

It seems that when diagrams managed SVGs are moved with the move plugin, references to them are not updated. I'm actually a bit surprised since I thought it's reusing standard image syntax.

Non admin users cannot save their diagrams

I recently installed the diagrams plugin on my dokuwiki website. I tested it myself and everything works fine for me (as admin). However, regular users of the website cannot save their diagrams.

More precisely, after saving their diagram, regular users return to the media manager window where there is no .svg file saved. It seems there is a permission issue for them to save the file. However, I checked the ACL and the regular users should have all access (they can edit, modify and save files outside of the diagrams extension).

Is this a known issue ? Could there be a reason for such behaviour ? I do not have the impression to have missed anything during the installation...

Thank you !

Link opens in object container instead of page

Hi !
First of all thanks a lot for this plugin.

The issue : when I set a shape as a link, and then click it, the document opens in the container inside the page.
Could the default target be set to "_parent" or "_top" ?

Perhaps somewhat related to #5 ?

Thanks !

Error "Call to undefined function sexplode()" in embed mode

Using the new embed mode brings the following error message:

Error: Call to undefined function sexplode()
An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the diagrams plugin.

The log file gives out the following details:

2023-05-17 13:21:33
Error: Call to undefined function sexplode()
/var/www/html/wiki/lib/plugins/diagrams/syntax/embed.php(27)
#0 /var/www/html/wiki/inc/parser/handler.php(279): syntax_plugin_diagrams_embed->handle('<diagram><svg x...', 5, 27, Object(Doku_Handler))
#1 /var/www/html/wiki/inc/Parsing/Lexer/Lexer.php(270): Doku_Handler->plugin('<diagram><svg x...', 5, 27, 'diagrams_embed')
#2 /var/www/html/wiki/inc/Parsing/Lexer/Lexer.php(197): dokuwiki\Parsing\Lexer\Lexer->invokeHandler('<diagram><svg x...', 5, 27)
#3 /var/www/html/wiki/inc/Parsing/Lexer/Lexer.php(147): dokuwiki\Parsing\Lexer\Lexer->dispatchTokens('', '<diagram><svg x...', '_plugin_diagram...', 27, 27)
#4 /var/www/html/wiki/inc/Parsing/Parser.php(109): dokuwiki\Parsing\Lexer\Lexer->parse('\n\n')
#5 /var/www/html/wiki/inc/parserutils.php(223): dokuwiki\Parsing\Parser->parse('\n====== Spielpl...')
#6 /var/www/html/wiki/inc/Ui/PageView.php(56): p_get_instructions('====== Spielpla...')
#7 /var/www/html/wiki/inc/Action/Preview.php(29): dokuwiki\Ui\PageView->show()
#8 /var/www/html/wiki/inc/template.php(100): dokuwiki\Action\Preview->tplContent()
#9 [internal function]: tpl_content_core('preview')
#10 /var/www/html/wiki/inc/Extension/Event.php(133): call_user_func_array('tpl_content_cor...', Array)
#11 /var/www/html/wiki/inc/Extension/Event.php(199): dokuwiki\Extension\Event->trigger('tpl_content_cor...', true)
#12 /var/www/html/wiki/inc/template.php(85): dokuwiki\Extension\Event::createAndTrigger('TPL_ACT_RENDER', 'preview', 'tpl_content_cor...')
#13 /var/www/html/wiki/lib/tpl/bootstrap3/main.php(117): tpl_content(false)
#14 /var/www/html/wiki/inc/actions.php(27): include('/var/www/html/w...')
#15 /var/www/html/wiki/doku.php(126): act_dispatch()
#16 {main}

Best regards
Juergen

Custom links break javascript

Hi,

I have created diagrams in our wiki that use custom links to other wiki pages. All URLs to these wiki pages should open a new window:
image

Now I have the following problem: When I click on the first link, the corresponding wiki page opens as desired. If I click on a second link, the corresponding wiki page opens, but can no longer be edited, for example. All functions that use javascript are no longer available, and initially this is also no longer the case for other wiki pages.

Therefore I would like to ask for support.

Regards Juergen

Older diagrams display a warning in PDFs created with dw2pdf plugin

If you create a PDF from a wiki page using the dw2pdf plugin and not the Print to PDF functionality of your browser, some diagrams will show the text Viewer does not support full SVG 1.1 in the image.

Any diagrams created or edited with the current version will not have this problem. So until we have a sensible solution for fixing those older files, the workaround is to edit and save the diagram.

PNG is not used in PDF with pngcache active (and generated with dw2pdf plugin)

Issue Description

I've noticed that in my installation, PDFs generated by the dw2pdf plugin do not use the PNG cache file but embed the SVG file instead. I would expect with the pngcache option enabled the PNG cache file is used.

OS: Ubuntu 20.04 LTS
PHP: 7.4.3-4ubuntu2.20
DokuWiki: 2024-02-06a "Kaos"

According to the web server log, PNG generation was triggered successfully

POST /my-wiki/lib/exe/ajax.php?call=plugin_diagrams_savecache&sectok=XXXX HTTP/2.0

and beyond the actual diagram file

/data/media/demo/test/test-diagram.svg

a cache file with an identical timestamp has been created

/data/cache/X/XXXX.diagrams.png

However, these cache files are not used to render the PDF files.

Graphics are not shown

Hi,

if the diagram becomes too complex, some graphic elements embedded are only partially displayed.

When one opens the diagram editor, all elements are shown. And if one exports the graphic from within the editor as an SVG file, this file also is correct. So inside the SVG file, nothing is lost.

So what can I do?

Best regards
Juergen

Create Dialog should check for existing name

Currently it's possible to accidentally overwrite an existing diagram by typing the same name into the "Create Diagram" dialog form. The form should check if the resulting ID already exists and show an error if so. We probably need to do an AJAX roundtrip for that.

Modify link to button and make it available on toolbar

Hello,

Thanks for this great plugin !

The present link Create diagram is not so visible. I searched for a while to find out. Could you please modify it to button and make it available on the toolbar to ease user's experience ?

Layer support

Is it possible to implement support for layers, i.e., giving the person embedding the diagram the chance to choose the layers they want to have displayed? Or would this come with #33?
This would greatly enhance usability of diagrams in dokuwiki, as it would prevent generating multiple media files with basically the same content but just with different layers activated.
Unfortunately, I'm not a coder, just (hopefully) politely asking whether somebody is working on that already or whether it could be planned for a future release.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.