我关注了Summernote-rails官方在我的 Rails 元素中添加富文本编辑器。
然后在我的 edit.html.erb 中,我将类 place_editor 添加到我的 text_area:
<%= f.text_area :text, class: "place_editor form-control col-md-7 col-xs-12", rows: "15j ,placeholder: "Text", required: "required"%>
然后 JavaScript 为:
<script type="text/javascript">
$(function() {
$('.place_editor').summernote();
var edit = function () {
$('.click2edit').summernote({ focus: true });
};
$("#edit").click(function () {
$('.click2edit').summernote({ focus: true });
});
$("#save").click(function () {
var aHTML = $('.click2edit').code(); //save HTML If you need(aHTML: array).
$('.click2edit').destroy();
});
// Adding Css to give border to text editor
$(".note-editor").css("border", "solid 1px #e7eaec");
});
</script>
除图标外一切正常。
最佳答案
很简单
只需下载 summernote compile zip file click here .
解压缩文件。复制字体文件夹。将它粘贴到 summernote.css 根目录。请确保您的 summernote.css 文件位于 font 文件夹中。现在使用 Ctrl + F5 刷新浏览器。
关于javascript - 图标不显示与 summernote rails ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36034892/