Rails 4 WYSIWYG Bootsy not displaying formatting
You need to have something like this, escape html:
<%= f.bootsy_area(:body, class: 'bg-code').html_safe %>
Rails 3 HTML escaping and WYSIWYG Editor - html showing in view
Sounds like you might want to look at sanitize, which has three built in modes and is customizable.
Capable of hosting filter related icons in Wice grid error
Make this small correction -grid(@vendors_grid).each do |g|
and try again. It could be that you are not enumerating over an array, in which case you are not getting back the right object
Basecamp's Trix WYSIWYG editor gem not saving file attachment in Rails 4 app
In this example, I've created a Image
model and controller that has a GET
and POST
method to them. I used refile
to handle the file uploads, but it would work similar with carrierwave
. The idea is to listen on the event trix-attachment-add
and send an XHR POST
to your ImagesController
. From here, you can send a JSON response back to your XHR Request and call JSON.parse
to capture the response text. Trix expects a valid URL to be returned and the attributes set on the attachment. Until this is properly done, it will be in a pending state and not actually save the image and/or caption.
# ImagesController
def create
@image = Image.new(image_params)
@image.save
respond_to do |format|
format.json { render :json => { url: Refile.attachment_url(@image, :image)} }
end
end
# Some Javascript
(function() {
var host, uploadAttachment;
document.addEventListener("trix-attachment-add", function(event) {
var attachment;
attachment = event.attachment;
if (attachment.file) {
return uploadAttachment(attachment);
}
});
host = "/images";
uploadAttachment = function(attachment) {
var file, form, xhr;
file = attachment.file;
form = new FormData;
form.append("Content-Type", file.type);
form.append("image[image]", file);
xhr = new XMLHttpRequest;
xhr.open("POST", host, true);
xhr.upload.onprogress = function(event) {
var progress;
progress = event.loaded / event.total * 100;
return attachment.setUploadProgress(progress);
};
xhr.onload = function() {
var href, url;
url = href = JSON.parse(this.responseText).url;
return attachment.setAttributes({
url: url,
href: href
});
};
return xhr.send(form);
};
}).call(this);
Ruby on Rails: Gem to design emails
ckeditor is one of those that do what you need. Basically, what you are looking for is a WYSIWYG HTML editor and there are quite a few out there.
WYSIWYG recommendations for my Rails app
I'd suggest to use gem ckeditor it's really perfect solution, i used it recently in my Rails 3.2 project
Related Topics
Undefined Method 'Has_Attached_File' with Paperclip 2.3.8 Gem for Rails 2 Using Ruby 1.8.7
Interpolating Regexes into Another Regex
How to Parse Mailbox File in Ruby
Handling Has_One Nested Resource in Rails 3
Can Someone Explain the Following Code to Me
What Is the Directory Structure for Adding Sorbet Rbis to a Gem
How to Display a Regexp Output in an Alphabetical List
Convert String Numbers( in Word Format) to Integer Ruby
Rails 3.2 Force_Ssl Except on Landing Page
Rails Form Data Not Getting Saved to Db
Autocomplete Method Structure in Vim
Ruby Console Input Halting at 1024 Characters
Make User-Inputted Url into External Link in Rails
Parsing Uris That Have Curly Braces, Uri::Invalidurierror: Bad Uri(Is Not Uri)