Skip to content

Commit b3ccb30

Browse files
committed
1 parent 15c92d8 commit b3ccb30

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

js/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ class PainterroProc {
375375
activate: () => {
376376
if (this.initText) this.wrapper.click();
377377
this.closeActiveTool();
378-
const input = document.getElementById('ptro-file-input');
378+
const input = this.doc.getElementById(this.bar.fileInputId);
379379
input.click();
380380
input.onchange = (event) => {
381381
const files = event.target.files || event.dataTransfer.files;
@@ -481,12 +481,13 @@ class PainterroProc {
481481
this.bar = this.doc.createElement('div');
482482
this.bar.id = `${this.id}-bar`;
483483
this.bar.className = 'ptro-bar ptro-color-main';
484+
this.bar.fileInputId = genId();
484485
this.bar.innerHTML =
485486
`<div>${bar}` +
486487
'<span class="ptro-tool-controls"></span>' +
487488
'<span class="ptro-info"></span>' +
488489
`<span class="ptro-bar-right">${rightBar}</span>` +
489-
'<input id="ptro-file-input" type="file" style="display: none;" accept="image/x-png,image/png,image/gif,image/jpeg" /></div>';
490+
`<input id="${this.bar.fileInputId}" type="file" style="display: none;" accept="image/x-png,image/png,image/gif,image/jpeg" /></div>`;
490491
if (this.isMobile) {
491492
this.bar.style['overflow-x'] = 'auto';
492493
}

js/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export function genId() {
22
let text = 'ptro';
33
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
4-
for (let i = 0; i < 8; i += 1) {
4+
for (let i = 0; i < 20; i += 1) {
55
text += possible.charAt(Math.floor(Math.random() * possible.length));
66
}
77
return text;

0 commit comments

Comments
 (0)