chrome open file working again

main
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 { #textpath-panel {
display: none; 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 data-action="clear" id="tool_clear" class="menu_item">New Document</div>
<div id="tool_open" class="menu_item"> <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> Open SVG... <span class="shortcut" style="display: none;">⌘O</span>
</div> </div>
<div id="tool_import" class="menu_item"> <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> Place Image... <span class="shortcut" style="display: none;">⌘K</span>
</div> </div>
<div data-action="save" id="tool_save" class="menu_item">Save Image... <span class="shortcut">⌘S</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(){ MD.Import = function(){
const workarea = document.getElementById("workarea"); const workarea = document.getElementById("workarea");
const $importInput = $('#tool_import + input'); const $importInput = $('#tool_import input');
const $openInput = $('#tool_open + input'); const $openInput = $('#tool_open input');
$('#tool_import').on("click", place); $importInput.on("change", importImage);
$('#tool_open').on("click", open); $openInput.on("change", openImage);
$importInput.change(importImage);
$openInput.change(openImage);
function importImage(e){ function importImage(e){
$('#menu_bar').removeClass('active')
if (!window.FileReader) return; if (!window.FileReader) return;
//e.stopPropagation(); //e.stopPropagation();
//e.preventDefault(); //e.preventDefault();
@ -90,6 +88,7 @@ MD.Import = function(){
} }
function openImage(e){ function openImage(e){
$('#menu_bar').removeClass('active')
const f = this; const f = this;
if(f.files.length === 1) { if(f.files.length === 1) {
svgCanvas.clear(); svgCanvas.clear();
@ -124,7 +123,6 @@ MD.Import = function(){
} }
function open(){ function open(){
console.log("open")
$openInput.trigger("click"); $openInput.trigger("click");
} }