mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-30 15:42:42 +08:00
Fix issues with saving files in web app
Fix several web app UI details
This commit is contained in:
parent
ce6ba0e178
commit
98c3ccbd6e
@ -284,6 +284,7 @@
|
||||
height: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
flex-grow: 1;
|
||||
}
|
||||
.toolbar_wrapper > .toolbar.vertical {
|
||||
width: 40px;
|
||||
|
@ -254,12 +254,15 @@ Object.assign(Blockbench, {
|
||||
} else {
|
||||
|
||||
let a = document.createElement('a');
|
||||
a.target = '_blank'
|
||||
|
||||
if (options.savetype === 'image') {
|
||||
a.href = options.content;
|
||||
|
||||
} else if (options.savetype === 'zip' || options.savetype === 'buffer' || options.savetype === 'binary') {
|
||||
let blob = new Blob(data, {type: "octet/stream"});
|
||||
let blob = options.content instanceof Blob
|
||||
? options.content
|
||||
: new Blob(options.content, {type: "octet/stream"});
|
||||
a.href = window.URL.createObjectURL(blob);
|
||||
|
||||
} else {
|
||||
@ -269,7 +272,12 @@ Object.assign(Blockbench, {
|
||||
a.download = file_name;
|
||||
|
||||
if (Blockbench.browser === 'firefox') document.body.appendChild(a);
|
||||
a.click();
|
||||
var event = document.createEvent("MouseEvents");
|
||||
event.initMouseEvent(
|
||||
"click", true, false, window, 0, 0, 0, 0, 0
|
||||
, false, false, false, false, 0, null
|
||||
);
|
||||
a.dispatchEvent(event);
|
||||
if (Blockbench.browser === 'firefox') document.body.removeChild(a);
|
||||
|
||||
}
|
||||
|
@ -478,8 +478,10 @@ window.Dialog = class Dialog {
|
||||
if (this.width) {
|
||||
jq_dialog.css('width', this.width+'px');
|
||||
}
|
||||
let first_focus = jq_dialog.find('.focusable_input').first();
|
||||
if (first_focus) first_focus.focus();
|
||||
if (!Blockbench.isTouch) {
|
||||
let first_focus = jq_dialog.find('.focusable_input').first();
|
||||
if (first_focus) first_focus.trigger('focus');
|
||||
}
|
||||
|
||||
open_dialog = this.id;
|
||||
open_interface = this;
|
||||
|
@ -119,7 +119,6 @@ class Plugin {
|
||||
})
|
||||
});
|
||||
});
|
||||
return this;
|
||||
}
|
||||
async loadFromFile(file, first) {
|
||||
var scope = this;
|
||||
|
@ -6,7 +6,6 @@ workbox.generateSW({
|
||||
globPatterns: [
|
||||
'./index.html',
|
||||
'./favicon.png',
|
||||
'./service_worker.js',
|
||||
|
||||
'./js/**/*',
|
||||
'./lib/**/*',
|
||||
|
Loading…
Reference in New Issue
Block a user