我跟着Summernote-rails
官方在我的rails项目中添加富文本编辑器.
而不是我的edit.html.erb
将class 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>
一切都很好,除了图标
请帮助我.