Twitter
Blog
Notes
News
Images
Videos
Signup
Login
English
English
中文
dreamable
/
RailsNotes
/
9
Table:
RailsNotes
User:
dreamable
Created at: 2020-12-16 23:09:40 UTC
Updated at: 2020-12-16 23:10:15 UTC
Reference:(Table ID 3, Record ID 9)
标题 :
RichText(Quill)
笔记 :
Why Quill?
support math
internal format, not html
Question:
where local image saved?
support image url?
Problem:
can't have two editors on the same page
jquery syntax not work to find body
missing images under packs
import 'quill/dist/quill.snow.css';
https://medium.com/@technoblogueur/rails-6-and-webpacker-what-you-need-to-know-e3534fded7ff
limit size by bootstrap
wrapper by another div, col-10 ok, do not use form-control
math
need kaTex
include js in application.html.erb directly
image with URL
https://github.com/quilljs/quill/issues/2044
new format: image_link
set icons:
https://github.com/quilljs/quill/issues/1099
need to install font-awesome for icons
Guide:
https://github.com/abhinavmathur/quilljs-rails
https://www.kohrvid.com/blog/posts/using-quilljs-with-rails-6
https://medium.com/@technoblogueur/rails-6-and-webpacker-what-you-need-to-know-e3534fded7ff
https://stackoverflow.com/questions/56198624
demo:
https://harlemsquirrel.github.io/jekyll/update/2016/12/11/rails-and-quill.html
Install
yarn add quill
include in application, import css as well.
view:
add hidden_field with class 'rich-text-content',
add a div with id 'editor', wrapped by div with 'col-10' to limit size
in js:
copy content from div with id='editor' to input with class 'rich-text-content', thus save and upload to server
config options and toolbar
support math
include js in application.html.erb directly
image with URL
https://github.com/quilljs/quill/issues/2044
new format: image_link
set icons:
https://github.com/quilljs/quill/issues/1099
min height
https://www.fabiofranchino.com/log/setting-a-minimun-default-height-to-quill-text-area/
.ql-editor{ min-height: 200px; }
Tag: