Concrete5 Respovsive Images

Permalink
Hi!
Same script works differently when loading responsive images via Ajax in view and edit mode.
In view mode (view.php) all right:
<picture><!--[if IE 9]><video style='display: none;'><![endif]--><!--[if IE 9]></video><![endif]--><img src="src" alt="#"></picture>


but in edit mode it looks different
<img src="src" alt="alt" width="1920" height="1200">



I wrote a small module that demonstrates the problem. What am I doing wrong?
controller.php
<?php
namespace Application\Block\Rit;
use Concrete\Core\Block\BlockController;
use Core;
use File;
use Image;
defined('C5_EXECUTE') or die(_("Access Denied."));
class Controller extends BlockController
{
    protected $btDefaultSet = 'multimedia';
    protected $btSupportsInlineEdit = true;
    protected $btSupportsInlineAdd = true;
    public function getBlockTypeName()
    {
        return t('RIT (Responsive Image Test)');


form.php (edit, add)
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
?>
<!-- Toolbar -->
<ul class="ccm-inline-toolbar">
    <li class="ccm-inline-toolbar-button ccm-inline-toolbar-button-cancel">
        <button class="btn btn-default" onclick="ConcreteEvent.fire('EditModeExitInline')"><?php  echo t('Cancel'); ?></button>
    </li>
    <li style="cursor:help;">
        <span class="fa fa-question-circle">
        </span>
    </li>
    <li class="ccm-inline-toolbar-button ccm-inline-toolbar-button-save">
        <button class="btn btn-primary" onclick="save()"><?php  echo t('Save'); ?></button>
    </li>


view.php
<button class="btn btn-default" onclick="get_responsive_image()"><?php  echo t('Upload'); ?></button>
<div id="rsi_container"></div>
<script>
function get_responsive_image() {
   $.ajax({
     url: "<?=$view->action('get_responsive_image')?>",
     quietMillis: 250,
    success: function(data) {
         $('#rsi_container').append(data['rsi']);
      }
   });
}
</script>