Skip to content

Instantly share code, notes, and snippets.

@sawyerh
Created February 10, 2016 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sawyerh/f232ac295d4e2aea50bb to your computer and use it in GitHub Desktop.
Save sawyerh/f232ac295d4e2aea50bb to your computer and use it in GitHub Desktop.
var attrs = imageNode.attrs;
attrs.src = 'http://example.com/image.jpg';
var replacement = imageNode.type.create(attrs);
editor.tr.replaceWith(pos.from, pos.to, replacement).apply();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment