diff --git a/src/canvas/view/CanvasView.js b/src/canvas/view/CanvasView.js index 688112b71..a0486342b 100644 --- a/src/canvas/view/CanvasView.js +++ b/src/canvas/view/CanvasView.js @@ -217,8 +217,8 @@ module.exports = Backbone.View.extend({ .${ppfx}plh-image { background: #f5f5f5; border: none; - height: 50px; - width: 50px; + height: 100px; + width: 100px; display: block; outline: 3px solid #ffca6f; cursor: pointer; diff --git a/src/dom_components/model/ComponentImage.js b/src/dom_components/model/ComponentImage.js index 6744681dc..1ef77ed51 100644 --- a/src/dom_components/model/ComponentImage.js +++ b/src/dom_components/model/ComponentImage.js @@ -1,4 +1,7 @@ -var Component = require('./Component'); +import { result } from 'underscore'; +const Component = require('./Component'); +const svgAttrs = + 'xmlns="http://www.w3.org/2000/svg" width="100" viewBox="0 0 24 24" style="fill: rgba(0,0,0,0.15); transform: scale(0.75)"'; module.exports = Component.extend( { @@ -6,7 +9,6 @@ module.exports = Component.extend( ...Component.prototype.defaults, type: 'image', tagName: 'img', - src: '', void: 1, droppable: 0, editable: 1, @@ -14,6 +16,16 @@ module.exports = Component.extend( resizable: { ratioDefault: 1 }, traits: ['alt'], + src: ` + + `, + + // Fallback image in case the src can't be loaded + // If you use SVG, xmlns="http://www.w3.org/2000/svg" is required + fallback: ` + + `, + // File to load asynchronously once the model is rendered file: '' }, @@ -68,6 +80,21 @@ module.exports = Component.extend( return attr; }, + getSrcResult(opt = {}) { + const src = this.get(opt.fallback ? 'fallback' : 'src') || ''; + let result = src; + + if (src && src.substr(0, 4) === '