Skip to content

Commit 4e87b75

Browse files
committed
Rename plugin to diagrams
1 parent c20ca1a commit 4e87b75

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

action.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
class action_plugin_drawio extends DokuWiki_Action_Plugin
3+
class action_plugin_diagrams extends DokuWiki_Action_Plugin
44
{
55

66
/**
@@ -47,7 +47,7 @@ public function checkConf(Doku_Event $event)
4747
*/
4848
public function handleAjax(Doku_Event $event)
4949
{
50-
if ($event->data !== 'plugin_drawio') return;
50+
if ($event->data !== 'plugin_diagrams') return;
5151
$event->preventDefault();
5252
$event->stopPropagation();
5353

lang/de/lang.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
$lang['js']['createButton'] = 'Erstellen';
66
$lang['js']['createLink'] = 'Diagramm erstellen';
7-
$lang['js']['createIntro'] = 'draw.io Diagramm im aktuellen Namensraum erstellen:';
7+
$lang['js']['createIntro'] = 'Diagramm im aktuellen Namensraum erstellen:';
88
$lang['js']['editButton'] = 'Diagramm editieren';
99
$lang['js']['errorInvalidId'] = 'Name ist leer oder enthält ungültige Zeichen!';
1010
$lang['js']['errorSaving'] = 'Fehler beim Speichern';

lang/en/lang.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
$lang['js']['createButton'] = 'Create';
66
$lang['js']['createLink'] = 'Create a diagram';
7-
$lang['js']['createIntro'] = 'Create draw.io diagram in current namespace';
7+
$lang['js']['createIntro'] = 'Create a diagram in current namespace';
88
$lang['js']['editButton'] = 'Edit diagram';
99
$lang['js']['errorInvalidId'] = 'Name is empty or contains invalid characters!';
1010
$lang['js']['errorSaving'] = 'Saving failed';

plugin.info.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
base drawio
1+
base diagrams
22
author Innovakom + CosmoCode
33
44
date 2021-01-05
5-
name Draw.io plugin
5+
name Diagrams plugin
66
desc Embed diagrams.net editor (formerly draw.io)
77
url https://innovakom.de

script.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jQuery(function () {
1212
}).toArray();
1313

1414
let ajaxData = {};
15-
ajaxData['call'] = 'plugin_drawio';
15+
ajaxData['call'] = 'plugin_diagrams';
1616
ajaxData['images'] = imageIds;
1717

1818
// callback to attach buttons to editable diagrams
@@ -53,18 +53,18 @@ jQuery(function () {
5353

5454
/* in the namespace tree add a link to create a new diagram */
5555
const $mm_tree = jQuery("#media__tree");
56-
const $createLink = jQuery('<a href="#">' + LANG.plugins.drawio.createLink + '</a>')
56+
const $createLink = jQuery('<a href="#">' + LANG.plugins.diagrams.createLink + '</a>')
5757
.on('click', function (e) {
5858
e.preventDefault();
5959
e.stopPropagation();
6060
newDiagramForm().dialog({
61-
title: LANG.plugins.drawio.createLink,
61+
title: LANG.plugins.diagrams.createLink,
6262
width: 600,
6363
appendTo: '.dokuwiki',
6464
modal: true,
6565
open: function () {
6666
const ns = isMMPage ? jQuery('.panelHeader h3 strong').text() : jQuery('#media__ns').text();
67-
jQuery('#drawio__current-ns').text(ns);
67+
jQuery('#diagrams__current-ns').text(ns);
6868
},
6969
close: function () {
7070
// do not reuse the dialog
@@ -98,7 +98,7 @@ jQuery(function () {
9898
// disconnect now so we don't observe the mutation we are about to trigger
9999
observer.disconnect();
100100
// FIXME why do they multiply when non-svg link is clicked before?!!!
101-
if ($actionsList.find('button.drawio-btn').length === 0) {
101+
if ($actionsList.find('button.diagrams-btn').length === 0) {
102102
$actionsList.append(editDiagramButton($svgLink.html()));
103103
}
104104
}

script/elements.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
function newDiagramForm() {
77
const $createForm = jQuery(
88
'<div><form>' +
9-
'<p>' + LANG.plugins.drawio.createIntro + ' <strong><span id="drawio__current-ns">' +
9+
'<p>' + LANG.plugins.diagrams.createIntro + ' <strong><span id="diagrams__current-ns">' +
1010
'</strong></span></p>' +
11-
'<input type="text" class="edit" name="drawio-create-filename" id="drawio__create-filename" />' +
12-
'<button id="drawio__create" class="edit">' + LANG.plugins.drawio.createButton + '</button>' +
11+
'<input type="text" class="edit" name="diagrams-create-filename" id="diagrams__create-filename" />' +
12+
'<button id="diagrams__create" class="edit">' + LANG.plugins.diagrams.createButton + '</button>' +
1313
'</form></div>'
1414
);
1515

@@ -26,11 +26,11 @@ function newDiagramForm() {
2626
function createDiagram(event) {
2727
event.preventDefault();
2828

29-
const ns = jQuery('#drawio__current-ns').html();
30-
const id = jQuery('#drawio__create-filename').val();
29+
const ns = jQuery('#diagrams__current-ns').html();
30+
const id = jQuery('#diagrams__create-filename').val();
3131

3232
if (!validId(id)) {
33-
alert(LANG.plugins.drawio.errorInvalidId);
33+
alert(LANG.plugins.diagrams.errorInvalidId);
3434
return;
3535
}
3636

@@ -46,9 +46,9 @@ function createDiagram(event) {
4646
*/
4747
function editDiagramButton(fullId) {
4848
const $editButton = jQuery(
49-
'<button type="submit" class="drawio-btn" data-id="' +
49+
'<button type="submit" class="diagrams-btn" data-id="' +
5050
fullId +
51-
'">' + LANG.plugins.drawio.editButton + '</button>'
51+
'">' + LANG.plugins.diagrams.editButton + '</button>'
5252
);
5353
jQuery( $editButton ).on( 'click', {fullId: fullId}, launchEditor );
5454

@@ -60,9 +60,9 @@ function editDiagramButton(fullId) {
6060
*/
6161
const launchEditor = function(event) {
6262
const fullId = event.data.fullId;
63-
if (!jQuery('#drawio-frame')[0]) {
64-
jQuery('body').append('<iframe id="drawio-frame" style="border: 0;position: fixed; top: 0; left: 0; right:0; bottom: 0; width:100%; height:100%; z-index: 9999;"></iframe>');
63+
if (!jQuery('#diagrams-frame')[0]) {
64+
jQuery('body').append('<iframe id="diagrams-frame" style="border: 0;position: fixed; top: 0; left: 0; right:0; bottom: 0; width:100%; height:100%; z-index: 9999;"></iframe>');
6565
jQuery(window).on('message', {fullId: fullId}, handleServiceMessages);
66-
jQuery('#drawio-frame').attr('src', serviceUrl);
66+
jQuery('#diagrams-frame').attr('src', serviceUrl);
6767
}
6868
};

script/service.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ const handleServiceMessages = function( event ) {
99
const {ns, id} = splitFullId(fullId);
1010

1111
const msg = JSON.parse( event.originalEvent.data );
12-
const drawio = jQuery( '#drawio-frame' )[0].contentWindow;
12+
const diagrams = jQuery( '#diagrams-frame' )[0].contentWindow;
1313
if( msg.event === 'init' ) {
1414
// try loading existing diagram file
1515
jQuery.get(DOKU_BASE + 'lib/exe/fetch.php?media=' + fullId, function (data) {
16-
drawio.postMessage(JSON.stringify({action: 'load', xml: data}), '*');
16+
diagrams.postMessage(JSON.stringify({action: 'load', xml: data}), '*');
1717
}, 'text')
1818
.fail(function () { // catch 404, file does not yet exist locally
19-
drawio.postMessage(JSON.stringify({action: 'load', xml: ''}), '*');
19+
diagrams.postMessage(JSON.stringify({action: 'load', xml: ''}), '*');
2020
});
2121
} else if ( msg.event === 'save' ) {
22-
drawio.postMessage(
23-
JSON.stringify( {action: 'export', format: 'xmlsvg', spin: LANG.plugins.drawio.saving } ),
22+
diagrams.postMessage(
23+
JSON.stringify( {action: 'export', format: 'xmlsvg', spin: LANG.plugins.diagrams.saving } ),
2424
'*'
2525
);
2626
} else if ( msg.event === 'export' ) {
2727
if ( msg.format !== 'svg' ) {
28-
alert( LANG.plugins.drawio.errorUnsupportedFormat );
28+
alert( LANG.plugins.diagrams.errorUnsupportedFormat );
2929
} else {
3030
const datastr = doctypeXML + '\n' +
3131
decodeURIComponent( atob( msg.data.split( ',' )[1] ).split( '' ).map( function( c ) {
@@ -34,7 +34,7 @@ const handleServiceMessages = function( event ) {
3434
jQuery.post( getLocalDiagramUrl(ns, id), datastr )
3535
.done( function() {
3636
jQuery( window ).off( 'message', {fullId: fullId}, handleServiceMessages );
37-
jQuery( '#drawio-frame' ).remove();
37+
jQuery( '#diagrams-frame' ).remove();
3838
const url = new URL(location.href);
3939
// media manager window should show current namespace
4040
url.searchParams.set('ns', ns);
@@ -43,11 +43,11 @@ const handleServiceMessages = function( event ) {
4343
}, 200 );
4444
})
4545
.fail( function() {
46-
alert( LANG.plugins.drawio.errorSaving );
46+
alert( LANG.plugins.diagrams.errorSaving );
4747
});
4848
}
4949
} else if( msg.event === 'exit' ) {
5050
jQuery( window ).off( 'message', {fullId: fullId}, handleServiceMessages );
51-
jQuery( '#drawio-frame' ).remove();
51+
jQuery( '#diagrams-frame' ).remove();
5252
}
5353
};

0 commit comments

Comments
 (0)