File tree Expand file tree Collapse file tree 2 files changed +25
-18
lines changed Expand file tree Collapse file tree 2 files changed +25
-18
lines changed Original file line number Diff line number Diff line change @@ -53,19 +53,26 @@ 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>' ) . on ( 'click' , function ( e ) {
57- e . preventDefault ( ) ;
58- newDiagramForm ( ) . dialog ( {
59- title : LANG . plugins . drawio . createLink ,
60- width : 600 ,
61- appendTo : '.dokuwiki' ,
62- modal : true ,
63- open : function ( ) {
64- const ns = isMMPage ? jQuery ( '.panelHeader h3 strong' ) . html ( ) : jQuery ( '#media__ns' ) . html ( ) ;
65- jQuery ( '#drawio__current-ns' ) . text ( ns ) ;
66- }
56+ const $createLink = jQuery ( '<a href="#">' + LANG . plugins . drawio . createLink + '</a>' )
57+ . on ( 'click' , function ( e ) {
58+ e . preventDefault ( ) ;
59+ e . stopPropagation ( ) ;
60+ newDiagramForm ( ) . dialog ( {
61+ title : LANG . plugins . drawio . createLink ,
62+ width : 600 ,
63+ appendTo : '.dokuwiki' ,
64+ modal : true ,
65+ open : function ( ) {
66+ const ns = isMMPage ? jQuery ( '.panelHeader h3 strong' ) . text ( ) : jQuery ( '#media__ns' ) . text ( ) ;
67+ jQuery ( '#drawio__current-ns' ) . text ( ns ) ;
68+ } ,
69+ close : function ( ) {
70+ // do not reuse the dialog
71+ // https://stackoverflow.com/a/2864783
72+ jQuery ( this ) . dialog ( 'destroy' ) . remove ( ) ;
73+ }
74+ } ) ;
6775 } ) ;
68- } ) ;
6976 $mm_tree . prepend ( $createLink ) ;
7077
7178 // attach edit button to detail view of SVG files
Original file line number Diff line number Diff line change 55 */
66function newDiagramForm ( ) {
77 const $createForm = jQuery (
8- '<form style="padding: 0.5em;" >' +
9- '<div >' + LANG . plugins . drawio . createIntro + ' <strong><span id="drawio__current-ns">' +
10- '</strong></span></div >' +
11- '<input type="text" name="drawio-create-filename" id="drawio__create-filename" />' +
12- '<button id="drawio__create">' + LANG . plugins . drawio . createButton + '</button>' +
13- '</form>'
8+ '<div>< form>' +
9+ '<p >' + LANG . plugins . drawio . createIntro + ' <strong><span id="drawio__current-ns">' +
10+ '</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>' +
13+ '</form></div> '
1414 ) ;
1515
1616 jQuery ( $createForm ) . on ( 'submit' , createDiagram ) ;
You can’t perform that action at this time.
0 commit comments