Summernote - 图像网址而不是base64 MVC [英] Summernote - image url instead of base64 MVC

查看:102
本文介绍了Summernote - 图像网址而不是base64 MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Create.cshtml



< pre> < div  class  =   form-group> 
@ Html.LabelFor(model => model.long_Description,htmlAttributes: new {@class = control-label col-md-4})
< div id = summernote>< / div>
< div class = col- MD-10\" >
@ Html.TextAreaFor(model => model.long_Description, new {@id = long_Description,@ style = display:none; ,@ class = form-control})
@Html .ValidationMessageFor(model => model.long_Description, new {@class = text-danger})
< / DIV>
< / div>
< script type = text / javascript>
$(document).ready(function(){
$(' #summernote')。summernote(
{
tabsize: 2
height: 150
});

var editor = $(' #long_Description')。html();

$(' #summernote ')。html(编辑);

$(' #editorbtn' )。悬停(function(){

var editor = $(' .note-editable')。html();
$(' #long_Description').html(editor);

});

});
< / script>

< input type = submit value = 添加 id = editorbtn class = btn btn-primary />





我尝试了什么:



Summernote编辑器将图像文件编码为Base64。我想知道它是否有选项可以关闭此编码选项并且请改用插入网址方法。我一直在寻找它,但还没有取得很大的成功。

例如,不要存储像...这样的图像。

< img src =    data:image / jpeg; base64,/ 9j / 4AAQSkZJRgABAQAAAQABAAD / 2wCEAAkGBxMSEhUSERMWFRUVERUVEBUWFRUVFRYVFRUWFxUVFRUYHSggGBolGxUVIT ..........> 

it应该是< img src =
/Upload/apple.jpg >

解决方案

(document).ready(function(){


' #summernote')。summernote(
{
tabsize: 2
身高: 150
});

var editor =

' #long_Description')。html();

Create.cshtml

<pre>  <div class="form-group">
        @Html.LabelFor(model => model.long_Description, htmlAttributes: new { @class = "control-label col-md-4" })
        <div id="summernote"></div>
        <div class="col-md-10">
            @Html.TextAreaFor(model => model.long_Description, new { @id = "long_Description", @style = "display:none;", @class = "form-control" })
            @Html.ValidationMessageFor(model => model.long_Description, "", new { @class = "text-danger" })
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#summernote').summernote(
                {
                    tabsize: 2,
                    height: 150
                });

            var editor = $('#long_Description').html();

            $('#summernote').html(editor);

            $('#editorbtn').hover(function () {

                var editor = $('.note-editable').html();
                $('#long_Description').html(editor);

            });

        });
    </script>

 <input type="submit" value="Add" id="editorbtn" class="btn btn-primary" />



What I have tried:

Summernote editor encodes image files into Base64.I wonder if it has a option to turn this encoding option off and use 'inserting url' method instead. I've been looking for it but no great success yet.
For example, instead of storing images like...

<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMSEhUSERMWFRUVERUVEBUWFRUVFRYVFRUWFxUVFRUYHSggGBolGxUVIT..........>

it should be <img src="/Upload/apple.jpg">

解决方案

(document).ready(function () {


('#summernote').summernote( { tabsize: 2, height: 150 }); var editor =


('#long_Description').html();


这篇关于Summernote - 图像网址而不是base64 MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆