Skip to content

Instantly share code, notes, and snippets.

@thomsbg
Created August 23, 2015 22:07
Show Gist options
  • Save thomsbg/98c40ee9f4c015b137c0 to your computer and use it in GitHub Desktop.
Save thomsbg/98c40ee9f4c015b137c0 to your computer and use it in GitHub Desktop.
image quill format
{
type: 'embed',
tag: 'IFRAME',
add: function(node, value) {
node.classList.add('image');
node.setAttribute('data-src', value.src);
node.setAttribute('data-caption', value.caption);
node.setAttribute('src', '/iframe/image.html');
return node;
},
remove: function(node) {
node.classList.remove('m-content-block');
node.classList.remove('image');
node.removeAttribute('data-src');
node.removeAttribute('data-caption');
node.removeAttribute('src');
return node;
},
value: function(node) {
return {
src: node.dataset.src,
caption: node.dataset.caption
};
},
match: function(node) {
return node.tagName === 'IFRAME' && node.classList.contains('image');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment