JSFiddle - React, Tailwind, and code Playground
by hiro14
HTML
<div id='body-text' class='body-text' contenteditable=true data-placeholder='Body Contents'></div>
<div class='modal instagram-modal' show={ instagramModal }>
Embed Instagram
<label>
<input type='text' id='instagram' placeholder='Input Instagram embed code'>
<button id='add'>add</button>
</label>
</div>
CSS
//<blockquote class="instagram-media" data-instgrm-version="7" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"><div style="padding:8px;"> <div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:50.0% 0; text-align:center; width:100%;"> <div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURczMzPf399fX1+bm5mzY9AMAAADiSURBVDjLvZXbEsMgCES5/P8/t9FuRVCRmU73JWlzosgSIIZURCjo/ad+EQJJB4Hv8BFt+IDpQoCx1wjOSBFhh2XssxEIYn3ulI/6MNReE07UIWJEv8UEOWDS88LY97kqyTliJKKtuYBbruAyVh5wOHiXmpi5we58Ek028czwyuQdLKPG1Bkb4NnM+VeAnfHqn1k4+GPT6uGQcvu2h2OVuIf/gWUFyy8OWEpdyZSa3aVCqpVoVvzZZ2VTnn2wU8qzVjDDetO90GSy9mVLqtgYSy231MxrY6I2gGqjrTY0L8fxCxfCBbhWrsYYAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div></div><p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;"><a href="https://www.instagram.com/p/BLIdyMqBECq/" style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none;" target="_blank">渡辺直美さん(@watanabenaomi703)が投稿した写真</a> - <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2016-10-04T07:15:46+00:00">2016 10月 4 12:15午前 PDT</time></p></div></blockquote><script async defer src="//platform.instagram.com/en_US/embeds.js"></script>
JavaScript
var add = document.getElementById('add')
add.onclick = function() {
var input = document.getElementById('instagram')
var embedCode = input.value
var instagram = document.createElement('div')
instagram.setAttribute('id', 'media')
instagram.setAttribute('class', 'media-frame')
instagram.setAttribute('contenteditable', 'false')
instagram.innerHTML = embedCode
var target = document.getElementById('body-text')
target.appendChild(instagram)
var newLine = document.createElement('p')
target.insertBefore(newLine, instagram.nextSibling)
newLine.focus()
input.value = ''
}