Commit 6077395a7c95e4a337474ad2cb8712b339d8153a
1 parent
96545af7
fix: DEFECT-944 can not save after import && export
Showing
4 changed files
with
33 additions
and
18 deletions
@@ -5050,10 +5050,9 @@ App.prototype.updateButtonContainer = function () { | @@ -5050,10 +5050,9 @@ App.prototype.updateButtonContainer = function () { | ||
5050 | this.importButton.setAttribute('id', 'thingskitImportButton'); | 5050 | this.importButton.setAttribute('id', 'thingskitImportButton'); |
5051 | mxUtils.write(this.importButton, '导入'); | 5051 | mxUtils.write(this.importButton, '导入'); |
5052 | mxEvent.addListener(this.importButton, 'click', mxUtils.bind(this, function () { | 5052 | mxEvent.addListener(this.importButton, 'click', mxUtils.bind(this, function () { |
5053 | - this.currentFile.ui.actions.get('open').funct() | ||
5054 | - console.log(this) | 5053 | + this.currentFile.ui.actions.get('open').funct() |
5055 | })); | 5054 | })); |
5056 | - // this.leftContainer.appendChild(this.importButton); | 5055 | + this.leftContainer.appendChild(this.importButton); |
5057 | 5056 | ||
5058 | // TODO thingsKit 导出案例 | 5057 | // TODO thingsKit 导出案例 |
5059 | this.exportButton = document.createElement('div'); | 5058 | this.exportButton = document.createElement('div'); |
@@ -5083,7 +5082,7 @@ App.prototype.updateButtonContainer = function () { | @@ -5083,7 +5082,7 @@ App.prototype.updateButtonContainer = function () { | ||
5083 | 5082 | ||
5084 | savefiles(this.currentFile.data, '未命名.xml') | 5083 | savefiles(this.currentFile.data, '未命名.xml') |
5085 | })); | 5084 | })); |
5086 | - // this.leftContainer.appendChild(this.exportButton); | 5085 | + this.leftContainer.appendChild(this.exportButton); |
5087 | 5086 | ||
5088 | // TODO thingsKit 锁定 / 解锁 按钮 | 5087 | // TODO thingsKit 锁定 / 解锁 按钮 |
5089 | this.lockButton = document.createElement('div'); | 5088 | this.lockButton = document.createElement('div'); |
@@ -13297,4 +13297,4 @@ var ConnectionPointsDialog = function(editorUi, cell) | @@ -13297,4 +13297,4 @@ var ConnectionPointsDialog = function(editorUi, cell) | ||
13297 | this.destroy = destroy; | 13297 | this.destroy = destroy; |
13298 | 13298 | ||
13299 | this.container = div; | 13299 | this.container = div; |
13300 | -}; | ||
13300 | +}; |
@@ -11719,18 +11719,29 @@ | @@ -11719,18 +11719,29 @@ | ||
11719 | }); | 11719 | }); |
11720 | 11720 | ||
11721 | window.openFile.setData(data, name); | 11721 | window.openFile.setData(data, name); |
11722 | - window.openWindow(this.getUrl(), null, mxUtils.bind(this, function() | 11722 | + |
11723 | + // window.openWindow(this.getUrl(), null, mxUtils.bind(this, function() | ||
11724 | + // { | ||
11725 | + // if (currentFile != null && currentFile.isModified()) | ||
11726 | + // { | ||
11727 | + // this.confirm(mxResources.get('allChangesLost'), null, fn, | ||
11728 | + // mxResources.get('cancel'), mxResources.get('discardChanges')); | ||
11729 | + // } | ||
11730 | + // else | ||
11731 | + // { | ||
11732 | + // fn(); | ||
11733 | + // } | ||
11734 | + // })); | ||
11735 | + // TODO Thingskit不打开浏览器tab标签 | ||
11736 | + if (currentFile != null && currentFile.isModified()) | ||
11723 | { | 11737 | { |
11724 | - if (currentFile != null && currentFile.isModified()) | ||
11725 | - { | ||
11726 | - this.confirm(mxResources.get('allChangesLost'), null, fn, | ||
11727 | - mxResources.get('cancel'), mxResources.get('discardChanges')); | ||
11728 | - } | ||
11729 | - else | ||
11730 | - { | ||
11731 | - fn(); | ||
11732 | - } | ||
11733 | - })); | 11738 | + this.confirm(mxResources.get('allChangesLost'), null, fn, |
11739 | + mxResources.get('cancel'), mxResources.get('discardChanges')); | ||
11740 | + } | ||
11741 | + else | ||
11742 | + { | ||
11743 | + fn(); | ||
11744 | + } | ||
11734 | } | 11745 | } |
11735 | } | 11746 | } |
11736 | else | 11747 | else |
@@ -147,8 +147,7 @@ LocalFile.prototype.saveFile = function (title, revision, success, error, useCur | @@ -147,8 +147,7 @@ LocalFile.prototype.saveFile = function (title, revision, success, error, useCur | ||
147 | // Updates data after changing file name | 147 | // Updates data after changing file name |
148 | if (!useCurrentData) { | 148 | if (!useCurrentData) { |
149 | this.updateFileData(); | 149 | this.updateFileData(); |
150 | - } | ||
151 | - | 150 | + } |
152 | var binary = this.ui.useCanvasForExport && /(\.png)$/i.test(this.getTitle()); | 151 | var binary = this.ui.useCanvasForExport && /(\.png)$/i.test(this.getTitle()); |
153 | this.setShadowModified(false); | 152 | this.setShadowModified(false); |
154 | var savedData = this.getData(); | 153 | var savedData = this.getData(); |
@@ -163,6 +162,12 @@ LocalFile.prototype.saveFile = function (title, revision, success, error, useCur | @@ -163,6 +162,12 @@ LocalFile.prototype.saveFile = function (title, revision, success, error, useCur | ||
163 | }); | 162 | }); |
164 | 163 | ||
165 | var doSave = mxUtils.bind(this, function (data) { | 164 | var doSave = mxUtils.bind(this, function (data) { |
165 | + if(!this.fileHandle) { | ||
166 | + this.fileHandle = { | ||
167 | + kind: 'file', | ||
168 | + name: '未命名.xml' | ||
169 | + } | ||
170 | + } | ||
166 | if (this.fileHandle != null) { | 171 | if (this.fileHandle != null) { |
167 | // Sets shadow modified state during save | 172 | // Sets shadow modified state during save |
168 | if (!this.savingFile) { | 173 | if (!this.savingFile) { |