magicpen-media
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -26,2 +26,4 @@ /*global URL, Blob, btoa*/ | ||
var height = options.height || 0; | ||
var alt = options.alt; | ||
var title = options.title; | ||
@@ -36,2 +38,5 @@ this.alt({ | ||
src = media; | ||
if (typeof title === 'undefined' && !/^data:/.test(media)) { | ||
title = media; | ||
} | ||
} else if (typeof URL !== 'undefined' && typeof URL.createObjectURL === 'function' && typeof Blob !== 'undefined') { | ||
@@ -50,2 +55,11 @@ src = URL.createObjectURL(new Blob([media], { type: sanitizeContentType(contentType) })); | ||
var attributes = [ 'src="' + entitify(src) + '"' ]; | ||
if (typeof alt !== 'undefined') { | ||
attributes.push('alt="' + entitify(String(alt)) + '"'); | ||
} | ||
if (typeof title !== 'undefined') { | ||
attributes.push('title="' + entitify(String(title)) + '"'); | ||
} | ||
var styleProperties = []; | ||
@@ -58,4 +72,7 @@ if (width) { | ||
} | ||
if (styleProperties.length) { | ||
attributes.push('style="' + entitify(styleProperties.join('; ')) + '"'); | ||
} | ||
var attributeStr = (styleProperties.length ? ' style="' + entitify(styleProperties.join('; ')) + '"' : '') + ' src="' + entitify(src) + '"'; | ||
var attributeStr = attributes.length ? ' ' + attributes.join(' ') : ''; | ||
if (!majorContentType || majorContentType === 'image') { | ||
@@ -62,0 +79,0 @@ return '<img' + attributeStr + '>'; |
{ | ||
"name": "magicpen-media", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Add media support to magicpen (images, audio, video)", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
471051
13290