在你的 Gemfile
gem 'wysiwyg-rails'
在 application.css
/*
*= require froala_editor.min.css
*= require froala_style.min.css
*= require font-awesome
*= require plugins/code_view.min.css
*= require plugins/draggable.min.css
*= require plugins/file.min.css
*= require plugins/table.min.css
*= require plugins/video.min.css
*= require plugins/colors.min.css
*= require plugins/image.min.css
*= require plugins/image_manager.min.css
*= require plugins/line_breaker.min.css
*= require plugins/quick_insert.min.css
*/
在 application.js 中
//= require froala_editor.min.js
//= require plugins/align.min.js
//= require plugins/code_beautifier.min.js
//= require plugins/code_view.min.js
//= require plugins/draggable.min.js
//= require plugins/entities.min.js
//= require plugins/file.min.js
//= require plugins/font_size.min.js
//= require plugins/font_family.min.js
//= require plugins/image.min.js
//= require plugins/image_manager.min.js
//= require plugins/inline_style.min.js
//= require plugins/line_breaker.min.js
//= require plugins/link.min.js
//= require plugins/lists.min.js
//= require plugins/paragraph_format.min.js
//= require plugins/paragraph_style.min.js
//= require plugins/quick_insert.min.js
//= require plugins/table.min.js
//= require plugins/video.min.js
//= require plugins/colors.min.js
//= require plugins/quote.min.js
然后试试你的代码
$('#edit').froalaEditor({
toolbarButtons: ['fullscreen', 'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize', '|', 'color', 'emoticons', 'inlineStyle', 'paragraphStyle', '|', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', '-', 'insertLink', 'insertImage', 'insertVideo', 'insertTable', '|', 'quote', 'insertHR', 'undo', 'redo', 'clearFormatting', 'selectAll', 'html'],
imageResizeWithPercent: true,
imageDefaultWidth: 70,
imageInsertButtons: ['imageByURL']
});
希望这对你有用。