Découvrez les nouveautés de cette version : Fonctionnalités, améliorations et évolutions vous attendent ! 👉 Cliquez ici pour en savoir plus

Modifications pour le document DiagramEditSheet

Modifié par Admin le 19/03/2025 - 19:24

Depuis la version 1.1
modifié par Admin
sur 08/11/2023 - 08:34
Commentaire de modification : Install extension [com.xwiki.diagram:application-diagram/1.19.1]
À la version 5.1
modifié par Admin
sur 24/06/2024 - 15:24
Commentaire de modification : Install extension [com.xwiki.diagram:application-diagram/1.20.4]

Résumé

Détails

XWiki.JavaScriptExtension[1]
Code
... ... @@ -32,16 +32,17 @@
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 + }
35 35   },
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];
45 45   this.changeListener = mxUtils.bind(this, function(sender, eventObject) {
46 46   this.setModified(true);
47 47   });
... ... @@ -78,7 +78,8 @@
78 78  
79 79   var saveBlobAsImageAttachment = function(blob, fileName, documentReference) {
80 80   var attachmentReference = new XWiki.AttachmentReference(fileName, documentReference);
81 - var uploadAttachment = $.proxy(xutils.uploadAttachment, null, blob, attachmentReference);
82 + var uploadMethod = (diagramConfig.isTemporaryUploadSupported) ? xutils.temporaryUploadAttachment : xutils.uploadAttachment;
83 + var uploadAttachment = $.proxy(uploadMethod, null, blob, attachmentReference);
82 82   // Avoid creating too many versions of the attachment. Upload the attachment even if we failed to delete it first.
83 83   return xutils.deleteAttachment(attachmentReference).then(uploadAttachment, uploadAttachment);
84 84   };
... ... @@ -146,8 +146,8 @@
146 146   $(document).on('xwiki:actions:beforeSave', function(event, data) {
147 147   if (!uploadInProgress) {
148 148   uploadInProgress = true;
149 - event.preventDefault();
150 - var saveButton = $('input[name=action_save' + (data && data['continue'] ? 'andcontinue' : '') + ']');
151 + event.stopPropagation();
152 + var saveButton = $(event.target);
151 151   saveButton.prop('disabled', true);
152 152   saveFilesAsImageAttachments().fail(function(e) {
153 153   new XWiki.widgets.Notification(
XWiki.JavaScriptExtension[2]
Code
... ... @@ -904,13 +904,6 @@
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 - //
914 914   // Change the service name in order to disable notifications.
915 915   //
916 916   EditorUi.prototype.getServiceName = function()