Rails 4 Wysiwyg Bootsy Not Displaying Formatting

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



Leave a reply



Submit