Skip to content

Commit

Permalink
Fixed issue where ImageFixtures could not accept src values as data URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyjb committed Jul 27, 2018
1 parent 33f0f28 commit 2671637
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
14 changes: 10 additions & 4 deletions build/content-edit.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/content-edit.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/content-edit.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ContentEdit",
"description": "A JavaScript library that provides a set of classes for building content-editable HTML elements.",
"version": "1.3.2",
"version": "1.3.3",
"keywords": [
"wysiwyg",
"inline",
Expand Down
10 changes: 8 additions & 2 deletions src/scripts/images.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ class ContentEdit.ImageFixture extends ContentEdit.Element

# Remove any existing background image from the style attribute
style = if @_attributes['style'] then @_attributes['style'] else ''
style = style.replace(/background-image:.+?(;|$)/i, '')
styleElm = document.createElement('div')
styleElm.setAttribute('style', style.trim())
styleElm.backgroundImage = null
style = styleElm.getAttribute('style')

# Set the background image for the element
style = [style.trim(), "background-image:url('#{ @src() }');"].join(' ')
Expand Down Expand Up @@ -294,7 +297,10 @@ class ContentEdit.ImageFixture extends ContentEdit.Element
if @_attributes['style']
# Remove any existing background image from the style attribute
style = if @_attributes['style'] then @_attributes['style'] else ''
style = style.replace(/background-image:.+?(;|$)/i, '')
styleElm = document.createElement('div')
styleElm.setAttribute('style', style.trim())
styleElm.backgroundImage = null
style = styleElm.getAttribute('style')

# Set the background image for the element
style = [
Expand Down

0 comments on commit 2671637

Please sign in to comment.