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,7 +32,7 @@ const GLOBAL_PLATFORM_INFO = (() => { | ||
32 | * @description user info | 32 | * @description user info |
33 | * @type {{JWT_TOKEN: {value: string}}} | 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 | return common | 36 | return common |
37 | })() | 37 | })() |
38 | 38 |
@@ -4241,8 +4241,6 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | @@ -4241,8 +4241,6 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | ||
4241 | const pageSizeControl = PageSetupDialog.getFormats | 4241 | const pageSizeControl = PageSetupDialog.getFormats |
4242 | PageSetupDialog.getFormats = function () { | 4242 | PageSetupDialog.getFormats = function () { |
4243 | if (platform === 'phone') { | 4243 | if (platform === 'phone') { |
4244 | - pageFormat.width = 415 | ||
4245 | - pageFormat.height = 737 | ||
4246 | return [ | 4244 | return [ |
4247 | { key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667) }, | 4245 | { key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667) }, |
4248 | { key: 'iPhone 8 Plus', title: 'iPhone 8 Plus', format: new mxRectangle(0, 0, 415, 737) }, | 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,8 +4258,6 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | ||
4260 | { key: 'custom', title: mxResources.get('custom'), format: null } | 4258 | { key: 'custom', title: mxResources.get('custom'), format: null } |
4261 | ] | 4259 | ] |
4262 | } | 4260 | } |
4263 | - pageFormat.width = 1920 | ||
4264 | - pageFormat.height = 1080 | ||
4265 | return pageSizeControl.apply(this, arguments) | 4261 | return pageSizeControl.apply(this, arguments) |
4266 | } | 4262 | } |
4267 | Editor.configurationName = response.configurationName + ".drawio"; | 4263 | Editor.configurationName = response.configurationName + ".drawio"; |
@@ -5051,9 +5047,8 @@ App.prototype.updateButtonContainer = function () { | @@ -5051,9 +5047,8 @@ App.prototype.updateButtonContainer = function () { | ||
5051 | mxUtils.write(this.importButton, '导入'); | 5047 | mxUtils.write(this.importButton, '导入'); |
5052 | mxEvent.addListener(this.importButton, 'click', mxUtils.bind(this, function () { | 5048 | mxEvent.addListener(this.importButton, 'click', mxUtils.bind(this, function () { |
5053 | this.currentFile.ui.actions.get('open').funct() | 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 | // TODO thingsKit 导出案例 | 5053 | // TODO thingsKit 导出案例 |
5059 | this.exportButton = document.createElement('div'); | 5054 | this.exportButton = document.createElement('div'); |
@@ -5083,7 +5078,7 @@ App.prototype.updateButtonContainer = function () { | @@ -5083,7 +5078,7 @@ App.prototype.updateButtonContainer = function () { | ||
5083 | 5078 | ||
5084 | savefiles(this.currentFile.data, '未命名.xml') | 5079 | savefiles(this.currentFile.data, '未命名.xml') |
5085 | })); | 5080 | })); |
5086 | - // this.leftContainer.appendChild(this.exportButton); | 5081 | + this.leftContainer.appendChild(this.exportButton); |
5087 | 5082 | ||
5088 | // TODO thingsKit 锁定 / 解锁 按钮 | 5083 | // TODO thingsKit 锁定 / 解锁 按钮 |
5089 | this.lockButton = document.createElement('div'); | 5084 | this.lockButton = document.createElement('div'); |
@@ -5162,12 +5157,14 @@ App.prototype.updateButtonContainer = function () { | @@ -5162,12 +5157,14 @@ App.prototype.updateButtonContainer = function () { | ||
5162 | //Fetch notifications | 5157 | //Fetch notifications |
5163 | if (urlParams['extAuth'] != '1') //Disable notification with external auth (e.g, Teams app) | 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 | else if (urlParams['notif'] != null) //Notif for embed mode | 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 | } else { | 5169 | } else { |
5173 | if (!hasSavePermission()) { | 5170 | if (!hasSavePermission()) { |
@@ -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) { |
@@ -58,7 +58,8 @@ Draw.loadPlugin(function(ui) | @@ -58,7 +58,8 @@ Draw.loadPlugin(function(ui) | ||
58 | macroData.diagramDisplayName = data.title; | 58 | macroData.diagramDisplayName = data.title; |
59 | 59 | ||
60 | //Fetch notifications | 60 | //Fetch notifications |
61 | - ui.fetchAndShowNotification('conf'); | 61 | + // TODO thingskit close notify bell |
62 | + // ui.fetchAndShowNotification('conf'); | ||
62 | } | 63 | } |
63 | } | 64 | } |
64 | catch (e) | 65 | catch (e) |