From aa519fc12f38fcabd7c6b3447882fadb86698b9f Mon Sep 17 00:00:00 2001 From: Memiks Date: Fri, 14 Mar 2014 09:33:44 +0100 Subject: [PATCH] Correct path plugins issue when reload wPaint - add default image if no image provided - add option path if plugin path not already start by it. --- src/wPaint.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/wPaint.js b/src/wPaint.js index 9717f6d..f1d5f04 100644 --- a/src/wPaint.js +++ b/src/wPaint.js @@ -562,11 +562,16 @@ // only add unique (new) items (icons) if (!this.$menuHolder.children('.wPaint-menu-icon-name-' + key).length) { - // add the item name, we will need this internally - menu.items[key].name = key; - - // use default img if img not set - menu.items[key].img = _this.wPaint.options.path + (menu.items[key].img || menu.img); + // add the item name, we will need this internally + menu.items[key].name = key; + + // use default img if img not set + if(!menu.items[key].img) { + menu.items[key].img = _this.wPaint.options.path + menu.img; + } else if(menu.items[key].img.indexOf(_this.wPaint.options.path) !== 0) { + // if plugin path does not start by options.path add it + menu.items[key].img = _this.wPaint.options.path + menu.items[key].img; + } // make self invoking to avoid overwrites (itemAppend)(menu.items[key]);