Commit 788df37455f93c2a8fd158a90187a889600c7d5e
Merge branch 'ww' into 'main'
fix: page size not change on platform happend change See merge request huang/thingskit-drawio!53
Showing
7 changed files
with
40 additions
and
26 deletions
... | ... | @@ -32,7 +32,7 @@ const GLOBAL_PLATFORM_INFO = (() => { |
32 | 32 | * @description user info |
33 | 33 | * @type {{JWT_TOKEN: {value: string}}} |
34 | 34 | */ |
35 | - const common = ls.get(GLOBAL_PLATFORM_INFO_KEY) | |
35 | + const common = ls.get(GLOBAL_PLATFORM_INFO_KEY) || {} | |
36 | 36 | return common |
37 | 37 | })() |
38 | 38 | ... | ... |
... | ... | @@ -4241,8 +4241,6 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { |
4241 | 4241 | const pageSizeControl = PageSetupDialog.getFormats |
4242 | 4242 | PageSetupDialog.getFormats = function () { |
4243 | 4243 | if (platform === 'phone') { |
4244 | - pageFormat.width = 415 | |
4245 | - pageFormat.height = 737 | |
4246 | 4244 | return [ |
4247 | 4245 | { key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667) }, |
4248 | 4246 | { key: 'iPhone 8 Plus', title: 'iPhone 8 Plus', format: new mxRectangle(0, 0, 415, 737) }, |
... | ... | @@ -4260,8 +4258,6 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { |
4260 | 4258 | { key: 'custom', title: mxResources.get('custom'), format: null } |
4261 | 4259 | ] |
4262 | 4260 | } |
4263 | - pageFormat.width = 1920 | |
4264 | - pageFormat.height = 1080 | |
4265 | 4261 | return pageSizeControl.apply(this, arguments) |
4266 | 4262 | } |
4267 | 4263 | Editor.configurationName = response.configurationName + ".drawio"; |
... | ... | @@ -5051,9 +5047,8 @@ App.prototype.updateButtonContainer = function () { |
5051 | 5047 | mxUtils.write(this.importButton, '导入'); |
5052 | 5048 | mxEvent.addListener(this.importButton, 'click', mxUtils.bind(this, function () { |
5053 | 5049 | this.currentFile.ui.actions.get('open').funct() |
5054 | - console.log(this) | |
5055 | 5050 | })); |
5056 | - // this.leftContainer.appendChild(this.importButton); | |
5051 | + this.leftContainer.appendChild(this.importButton); | |
5057 | 5052 | |
5058 | 5053 | // TODO thingsKit 导出案例 |
5059 | 5054 | this.exportButton = document.createElement('div'); |
... | ... | @@ -5083,7 +5078,7 @@ App.prototype.updateButtonContainer = function () { |
5083 | 5078 | |
5084 | 5079 | savefiles(this.currentFile.data, '未命名.xml') |
5085 | 5080 | })); |
5086 | - // this.leftContainer.appendChild(this.exportButton); | |
5081 | + this.leftContainer.appendChild(this.exportButton); | |
5087 | 5082 | |
5088 | 5083 | // TODO thingsKit 锁定 / 解锁 按钮 |
5089 | 5084 | this.lockButton = document.createElement('div'); |
... | ... | @@ -5162,12 +5157,14 @@ App.prototype.updateButtonContainer = function () { |
5162 | 5157 | //Fetch notifications |
5163 | 5158 | if (urlParams['extAuth'] != '1') //Disable notification with external auth (e.g, Teams app) |
5164 | 5159 | { |
5165 | - this.fetchAndShowNotification('online', this.mode); | |
5160 | + // TODO thingskit close notify bell | |
5161 | + // this.fetchAndShowNotification('online', this.mode); | |
5166 | 5162 | } |
5167 | 5163 | } |
5168 | 5164 | else if (urlParams['notif'] != null) //Notif for embed mode |
5169 | 5165 | { |
5170 | - this.fetchAndShowNotification(urlParams['notif']); | |
5166 | + // TODO thingskit close notify bell | |
5167 | + // this.fetchAndShowNotification(urlParams['notif']); | |
5171 | 5168 | } |
5172 | 5169 | } else { |
5173 | 5170 | if (!hasSavePermission()) { | ... | ... |
... | ... | @@ -11719,18 +11719,29 @@ |
11719 | 11719 | }); |
11720 | 11720 | |
11721 | 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 | 11747 | else | ... | ... |
... | ... | @@ -147,8 +147,7 @@ LocalFile.prototype.saveFile = function (title, revision, success, error, useCur |
147 | 147 | // Updates data after changing file name |
148 | 148 | if (!useCurrentData) { |
149 | 149 | this.updateFileData(); |
150 | - } | |
151 | - | |
150 | + } | |
152 | 151 | var binary = this.ui.useCanvasForExport && /(\.png)$/i.test(this.getTitle()); |
153 | 152 | this.setShadowModified(false); |
154 | 153 | var savedData = this.getData(); |
... | ... | @@ -163,6 +162,12 @@ LocalFile.prototype.saveFile = function (title, revision, success, error, useCur |
163 | 162 | }); |
164 | 163 | |
165 | 164 | var doSave = mxUtils.bind(this, function (data) { |
165 | + if(!this.fileHandle) { | |
166 | + this.fileHandle = { | |
167 | + kind: 'file', | |
168 | + name: '未命名.xml' | |
169 | + } | |
170 | + } | |
166 | 171 | if (this.fileHandle != null) { |
167 | 172 | // Sets shadow modified state during save |
168 | 173 | if (!this.savingFile) { | ... | ... |
... | ... | @@ -58,7 +58,8 @@ Draw.loadPlugin(function(ui) |
58 | 58 | macroData.diagramDisplayName = data.title; |
59 | 59 | |
60 | 60 | //Fetch notifications |
61 | - ui.fetchAndShowNotification('conf'); | |
61 | + // TODO thingskit close notify bell | |
62 | + // ui.fetchAndShowNotification('conf'); | |
62 | 63 | } |
63 | 64 | } |
64 | 65 | catch (e) | ... | ... |