[Asp.Net Core]

背景

使用 Syncfusion / RichTextEditor 对录入后的信息进行展示:
1. 希望内容高度自适应。
2. 希望禁用原文中的超链接。

 

实现

<div class="form-group row">
    <div class="col-12">
        <label class="font-weight-bold">详细内容</label>
        <div>
            <ej-rte id="Extend" width="100%"allow-editing="false" show-toolbar="false" value="@Model.Extend"></ej-rte>
        </div>
    </div>
</div>

@section Scripts {
    <script>
        $(function () {
            /* Remove ALL Hyperlinks */
            $('#Extend_Iframe').contents().find('a').contents().unwrap();
            /* Refresh Iframe Heights */
            var iframeHeight = $('#Extend_Iframe').contents().height();
            $('#Extend_wrapper').height(iframeHeight + 24);
            $('#Extend_Iframe').height(iframeHeight + 12);
        });
    </script>
}

录入页面

浏览页面

 参考资料

https://help.syncfusion.com/aspnet-core/richtexteditor/working-with-content
http://api.jquery.com/unwrap/

原文地址:https://www.cnblogs.com/jinzesudawei/p/7108718.html