Modifications pour le document DiagramEditSheet
Modifié par Admin le 19/03/2025 - 19:24
Résumé
-
Objets (2 modifications, 0 ajouts, 0 suppressions)
Détails
- XWiki.JavaScriptExtension[1]
-
- Code
-
... ... @@ -32,17 +32,16 @@ 32 32 }, 33 33 setData: function(data) { 34 34 this.input.val(data); 35 - let pages = this.ui.getPagesForXml(data); 36 - if (pages.length > 0) { 37 - this.ui.pages = this.ui.getPagesForXml(data); 38 - } 39 39 }, 36 + // We overwrite the base implementation because we don't want to support files that contain multiple diagrams. 37 + updateFileData: function() { 38 + this.setData(mxUtils.getPrettyXml(this.ui.editor.getGraphXml(true, true))); 39 + }, 40 40 open: function() { 41 41 var graphXML = this.getData() || '<mxGraphModel/>'; 42 42 var graphNode = mxUtils.parseXml(graphXML).documentElement; 43 43 graphNode.fromStorage = true; 44 44 this.ui.editor.setGraphXml(graphNode); 45 - this.ui.currentPage = this.ui.pages[0]; 46 46 this.changeListener = mxUtils.bind(this, function(sender, eventObject) { 47 47 this.setModified(true); 48 48 }); ... ... @@ -79,8 +79,7 @@ 79 79 80 80 var saveBlobAsImageAttachment = function(blob, fileName, documentReference) { 81 81 var attachmentReference = new XWiki.AttachmentReference(fileName, documentReference); 82 - var uploadMethod = (diagramConfig.isTemporaryUploadSupported) ? xutils.temporaryUploadAttachment : xutils.uploadAttachment; 83 - var uploadAttachment = $.proxy(uploadMethod, null, blob, attachmentReference); 81 + var uploadAttachment = $.proxy(xutils.uploadAttachment, null, blob, attachmentReference); 84 84 // Avoid creating too many versions of the attachment. Upload the attachment even if we failed to delete it first. 85 85 return xutils.deleteAttachment(attachmentReference).then(uploadAttachment, uploadAttachment); 86 86 }; ... ... @@ -148,8 +148,8 @@ 148 148 $(document).on('xwiki:actions:beforeSave', function(event, data) { 149 149 if (!uploadInProgress) { 150 150 uploadInProgress = true; 151 - event. stopPropagation();152 - var saveButton = $(eve nt.target);149 + event.preventDefault(); 150 + var saveButton = $('input[name=action_save' + (data && data['continue'] ? 'andcontinue' : '') + ']'); 153 153 saveButton.prop('disabled', true); 154 154 saveFilesAsImageAttachments().fail(function(e) { 155 155 new XWiki.widgets.Notification(
- XWiki.JavaScriptExtension[2]
-
- Code
-
... ... @@ -904,6 +904,13 @@ 904 904 }; 905 905 906 906 // 907 + // Disable the tabbed UI (setting urlParams['pages'] to '0' is not enough..) 908 + // 909 + EditorUi.prototype.initPages = function() { 910 + // Do nothing. 911 + }; 912 + 913 + // 907 907 // Change the service name in order to disable notifications. 908 908 // 909 909 EditorUi.prototype.getServiceName = function()