Browse Source

Update assets after render

pull/281/head
Artur Arseniev 9 years ago
parent
commit
efa3f1963f
  1. 16
      index.html
  2. 9
      src/asset_manager/index.js

16
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) == '<svg ') {
return {
type: 'svg-icon',
svgContent: value
};
}
}
})
// Store and load events
editor.on('storage:load', function(e) {
console.log('LOAD ', e);

9
src/asset_manager/index.js

@ -233,6 +233,7 @@ module.exports = () => {
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});
},
/**

Loading…
Cancel
Save