From 0e301382e55c9546ae5e8b1697d5d7af8efefb0d Mon Sep 17 00:00:00 2001 From: Ivan Borshchov Date: Fri, 23 Apr 2021 12:30:30 +0300 Subject: [PATCH] #128 remove initialisation for unused options, it tried to get element by undefined --- build/index.html | 14 +++++++------- js/inserter.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/index.html b/build/index.html index c0697e0..56d9166 100644 --- a/build/index.html +++ b/build/index.html @@ -110,18 +110,18 @@ //availableEraserWidths: [1,2,4,8,16,64], //availableFontSizes: [1,2,4,8,16,64], //availableArrowLengths: [10,20,30,40,50,60], - // how_to_paste_actions: ['paste_over', 'replace_all'], - saveHandler: (saver, done) => { - console.log('saving', saver.getWidth(), saver.getHeight()) - console.log('hasAlphaChannel', saver.hasAlphaChannel()) + how_to_paste_actions: ['paste_over', 'replace_all'], + //saveHandler: (saver, done) => { + // console.log('saving', saver.getWidth(), saver.getHeight()) + // console.log('hasAlphaChannel', saver.hasAlphaChannel()) // console.log('Base64', saver.asDataURL()) - done(true); - } + // done(true); + //} //toolbarPosition: 'top', // fixMobilePageReloader: false, // defaultTool: 'line', //hiddenTools: ['line'] - }).show('https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Gutenberg.jpg/300px-Gutenberg.jpg?12') + }).show() const ctx = window.p.ctx; // ctx.beginPath(); diff --git a/js/inserter.js b/js/inserter.js index e6cb883..0219f88 100644 --- a/js/inserter.js +++ b/js/inserter.js @@ -151,7 +151,7 @@ export default class Inserter { this.cancelChoosing(); this.img = null; this.mimetype = null; // mime of pending image - Object.keys(this.pasteOptions).forEach((k) => { + this.getAvailableOptions().forEach((k) => { const o = this.pasteOptions[k]; this.main.doc.getElementById(o.id).onclick = () => { if (this.loading) {