From efa3f1963ffb78740294c542a006ecf46c666950 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 4 Sep 2017 15:05:11 +0200 Subject: [PATCH] Update assets after render --- index.html | 16 ++++++++++++++++ src/asset_manager/index.js | 9 +++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 807ff6780..ff73abd82 100755 --- a/index.html +++ b/index.html @@ -1310,6 +1310,22 @@ }); */ + var am = editor.AssetManager; + + am.addType('svg-icon', { + // `value` is for example the argument passed in `am.add(VALUE);` + isType(value) { + // The condition is intentionally simple + if (value.substring(0, 5) == ' { this.getAll().reset(assets); } + this.lastLoad = assets; return assets; }, @@ -325,8 +326,12 @@ module.exports = () => { postRender(editorView) { c.dropzone && fu.initDropzone(editorView); - // Leave it here for custom types - assets.add(c.assets, {silent: 1}); + // Reset assets for custom types + const last = this.lastLoad; + const assets = last.length ? last : c.assets; + const all = this.getAll(); + all.reset(); + all.add(assets, {silent: 1}); }, /**