Comments (4)
I have just cloned your repo and replaced the whole meds.coffee file as follows:
$ ->
$('[data-provider="summernote"]').each ->
$(this).summernote
height: 100
It also worked properly on editing an presisted record and so I could see the multiple text fields held each corresponding attribute value correctly.
If you omit the height option line, summernote editor will not be shown.
Good luck!
from summernote-rails.
In meds.coffee file of your repo, you called summernote editor twice for individual fields.
First call is as follows:
$ ->
$('[data-provider="summernote"]').each ->
$(this).summernote()
Second calls are:
$ ->
# to call summernote editor
summer_note.summernote
summer_note2.summernote
summer_note3.summernote
summer_note4.summernote
summer_note5.summernote
summer_note6.summernote
summer_note7.summernote
# to set options
height:300
codemirror:
lineNumbers: true
tabSize: 2
theme: "solarized light"
Therefore, you must remove code lines for second calls.
If you want to add some options to a certain summernote editor, you must not add as: :summernote
option for corresponding field input in form view file and call summernote editor for it additionally in meds.coffee.
So, you may modify the form view file(edit.html.erb) as follows:
<div class = "container">
<fieldset>
</p><h2>Edit Medicine</h2></p>
<%# if user_signed_in? && current_user.is_admin == true %>
<%= simple_form_for @med, class: "form-horizontal" do |f| %>
<div class="form-group">
<%= f.input :brand_name, required: true %>
</div>
<div class="form-group">
<%= f.input :generic_name, required: true %>
</div>
<div class="form-group">
<%= f.input :description, as: :summernote, :id => 'description' %>
</div>
<div class="form-group">
<%= f.input :reactions, as: :summernote, :id => 'reactions' %>
</div>
<div class="form-group">
<%= f.input :interactions, as: :summernote, :id => 'interactions' %>
</div>
<div class="form-group">
<%= f.input :implementation, as: :summernote, :id => 'implementation' %>
</div>
<div class="form-group">
<%= f.input :availability, as: :summernote, :id => 'availability' %>
</div>
<div class="form-group">
<%= f.input :caution, as: :summernote, :id => 'caution' %>
</div>
<div class="form-group">
<%= f.input :warnings, :id => 'warnings' %>
</div>
<%= f.button :submit, class: "btn btn-primary" %> </div>
<% end %>
<%# end %>
</fieldset>
</div>
(In the above, you could find the absence of as: :summernote
option for f.input :warnings, :id => 'warnings'
)
and also meds.coffee file as follows:
$ ->
$('[data-provider="summernote"]').each ->
$(this).summernote
height:50
summer_note7 = $('#med_warnings')
summer_note7.summernote
# to set options
height:300
codemirror:
lineNumbers: true
tabSize: 2
theme: "solarized light"
(In the above, you could find the additional code line height:50
.)
I wish it helps you. Good luck~
from summernote-rails.
from summernote-rails.
Thank you so much for the thorough explanation! This worked perfectly!! I learned a great deal here.
from summernote-rails.
Related Issues (20)
- integration with active admin give messy buttons HOT 1
- Update with the latest Summernote version HOT 10
- Font Bold/Underline/Italic not working in V0.8.9.2 HOT 9
- There is a bug while deleting image HOT 6
- How can i get a watermark text
- Active Storage example HOT 2
- Documentation or options list?
- Add imageSize75 HOT 5
- Icons not showing HOT 5
- Not loading correctly in production only HOT 9
- Is there a way to put text highlights as hex instead of rgb?
- Does it work with materializecss ?
- Release v0.8.12.0 HOT 2
- Have way to use summernote gem without jquery. I don't like to have the dependency of jquery. HOT 1
- Active storage integration on rails 6 HOT 1
- Default font color HOT 1
- New release v0.8.18 HOT 4
- routing error with summernote.js HOT 1
- Install is all about the 'asset pipeline' which
- Summernote blank when trying to load HTML content HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from summernote-rails.