ckeditor - CKEditor 提到 outputTemplate 插入为 HTML 内容
问题描述
我正在使用提及和自动完成插件使用 AJAX GET 方法从数据库中获取数据。我想做的是-从数据库中获取数据,然后将其插入编辑器。我的数据库行包含 html。这是我如何使用 CKeditor 提及的代码-
mentions: [{
feed: function( options, callback ) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if ( xhr.readyState == 4 ) {
if ( xhr.status == 200 ) {
callback( JSON.parse( this.responseText ) );
} else {
callback( [] );
}
}
}
xhr.open( 'GET', 'smart_drug.php?username=' + encodeURIComponent( options.query ) );
xhr.send();
},
itemTemplate: '<li data-id="{id}">' +
'<strong class="username">{d_name}</strong>' +
'<span class="fullname">{d_name}</span>' +
'</li>',
minChars: 0,
outputTemplate: '{body}',
}]
它不呈现 html 代码,只是作为纯文本插入。插入在编辑器上正确显示 HTML 的数据的方法是什么?
解决方案
推荐阅读
- html - 无法在带有刻度符号的垫子上动态应用过滤器(活动/非活动)
- android - 在Rect中改变左边后,笔划的一个边缘更大
- c# - Redis Cache 连接的客户端数量增加
- wordpress - 如何将我的 wordpress 网站迁移到虚拟网站?
- java - How can I put a couple edited class files into a forge mod?
- python - python: plot two bars with the two list values with same x labels
- javascript - 弹出显示错误后,本机应用程序或博览会无法在虚拟设备上运行
- reactjs - React:事件传播的最佳实践(触发父事件,而不是子事件)
- javascript - onClick 的 jQuery 动画不适用于连续点击
- html - 尝试使页面响应时,Div 被切断