chrome open file working again

master
Mark MacKay 2021-10-09 16:50:08 -05:00
parent d2eac1a0e9
commit 856e919925
3 changed files with 8 additions and 14 deletions

View File

@ -76,8 +76,4 @@
#textpath-panel {
display: none;
}
.text-path #textpath-panel {
display: block;
}

View File

@ -77,12 +77,12 @@
<div data-action="clear" id="tool_clear" class="menu_item">New Document</div>
<div id="tool_open" class="menu_item">
<input type="file" accept="image/svg+xml" />
<input type="file" accept="image/svg+xml" id="tool_open_input" />
Open SVG... <span class="shortcut" style="display: none;">⌘O</span>
</div>
<div id="tool_import" class="menu_item">
<input type="file" accept="image/*" />
<input type="file" accept="image/*" id="tool_import_input" />
Place Image... <span class="shortcut" style="display: none;">⌘K</span>
</div>
<div data-action="save" id="tool_save" class="menu_item">Save Image... <span class="shortcut">⌘S</span></div>

View File

@ -1,15 +1,13 @@
MD.Import = function(){
const workarea = document.getElementById("workarea");
const $importInput = $('#tool_import + input');
const $openInput = $('#tool_open + input');
const $importInput = $('#tool_import input');
const $openInput = $('#tool_open input');
$('#tool_import').on("click", place);
$('#tool_open').on("click", open);
$importInput.change(importImage);
$openInput.change(openImage);
$importInput.on("change", importImage);
$openInput.on("change", openImage);
function importImage(e){
$('#menu_bar').removeClass('active')
if (!window.FileReader) return;
//e.stopPropagation();
//e.preventDefault();
@ -90,6 +88,7 @@ MD.Import = function(){
}
function openImage(e){
$('#menu_bar').removeClass('active')
const f = this;
if(f.files.length === 1) {
svgCanvas.clear();
@ -124,7 +123,6 @@ MD.Import = function(){
}
function open(){
console.log("open")
$openInput.trigger("click");
}