• Stars
    star
    437
  • Rank 99,659 (Top 2 %)
  • Language
    Ruby
  • Created over 12 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WYSIWYG editor for Bootstrap, integrated in Rails assets pipeline

Bootstrap wysihtml5 for Rails

Gem Version

endorse

Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.

http://getbootstrap.com/

Bootstrap Wysihtml5 is a plugin for Bootstrap designed by James Hollingworth. It provides a stylish wysiwyg editor for Bootstrap. We use Christian Sterzl's fork.

https://github.com/bootstrap-wysiwyg/bootstrap3-wysiwyg

bootstrap-wysihtml5-rails project integrates it with Rails 3 assets pipeline.

https://github.com/Nerian/bootstrap-wysihtml5-rails

This repo is only for packaging bootstrap-wysihtml5 into a ruby gem. If yor Pull Request is about changing bootstrap-wysihtml5 (any file in the 'vendor' folder) please create it in their repository, not here.

Latest version with Bootstrap 2 support was 0.3.1.24. New releases only package Bootstrap 3 support.

Rails > 3.1

Include bootstrap-wysihtml5-rails in Gemfile;

gem 'bootstrap-wysihtml5-rails'

or you can install from latest build;

gem 'bootstrap-wysihtml5-rails', github: 'nerian/bootstrap-wysihtml5-rails'

and run bundle install.

This gem doesn't include Bootstrap. You can get Bootstrap here: https://github.com/twbs/bootstrap-sass

Configuration

Bootstrap-wysihtml5 depends on bootstrap and jQuery.

app/assets/stylesheets/application.css

*= require bootstrap-wysihtml5

if you are using SASS: app/assets/stylesheets/application.scss

@import "bootstrap-wysihtml5/bootstrap3-wysihtml5";

app/assets/javascripts/application.js

//= require bootstrap-wysihtml5

You may include all locales like this:

//= require bootstrap-wysihtml5/locales

Or just add the ones that you want

//= require bootstrap-wysihtml5/locales/de-DE
//= require bootstrap-wysihtml5/locales/es-ES

//= require bootstrap-wysihtml5 will embed both wysihtml5x and handlebars. But you can fine tune what you require, like this:

//= require bootstrap-wysihtml5/wysihtml5x-toolbar.js
//= require bootstrap-wysihtml5/handlebars.runtime.min.js

//= require bootstrap-wysihtml5/minimum

You may need to restart your rails server.

Using bootstrap-wysihtml5-rails directly

Just call wysihtml5() with any selector.

<textarea id="some-textarea" class='wysihtml5' placeholder="Enter text ..."></textarea>

<script type="text/javascript">
  $(document).ready(function(){

    $('.wysihtml5').each(function(i, elem) {
      $(elem).wysihtml5();
    });

  })
</script>

Using bootstrap-wysihtml5-rails with simple_form

There is simple_form input which you can apply via as: :wysihtml5 option.

<%= f.input :content, as: :wysihtml5 %>

Or with bootstrap3-wysiwyg options

<%= f.input :content, as: :wysihtml5, wysihtml5: { locale: "es-ES" } %>

If using Turbolinks

$(document).on('page:load', function(){
  window['rangy'].initialized = false
});

Using bootstrap-wysihtml5-rails with Font Awesome

In the case you're not using Glyphicons but Font-Awesome, here is how to make Wysihtml5 use Font-Awesome :

$(elem).wysihtml5({ toolbar:{ "fa": true } });

Passing options

To activate direct html editing and disable blockquote:

  $('.wysihtml5').wysihtml5({'toolbar': {'blockquote': false, 'html': true}})

Toolbal default options are:

toolbar: {
      'font-styles': true,
      'color': false,
      'emphasis': {
        'small': true
      },
      'blockquote': true,
      'lists': true,
      'html': false,
      'link': true,
      'image': true,
      'smallmodals': false
    }

License

Copyright (c) 2012-2014 Gonzalo Rodríguez-Baltanás Díaz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

bootstrap-datepicker-rails

A Datepicker for Twitter Bootstrap, integrated with Rails assets pipeline
Ruby
649
star
2

akephalos2

Akephalos is a full-stack headless browser for integration testing with Capybara
Ruby
26
star
3

bootstrap-typeahead-rails

Bootstrap Typeahead gem for Rails 3 assets pipeline.
Ruby
21
star
4

google-id-token

Ruby
8
star
5

github_subversion_converter

This script allows the replication of any GitHub fake subversion repo to a real subversion repo.
Ruby
5
star
6

concurrency

Ruby
3
star
7

simple-interactors

Ruby
3
star
8

jquery-lotus

Ruby
2
star
9

simple_gemset

Simple Gemset: A generator for a minimal .rvmrc file
Ruby
2
star
10

Goofb

A RoR application that makes downloading all your Facebook albums very easy
Ruby
2
star
11

DPovray---Brb

PDovray stands for Distributed Povray. DPovray is a Ruby application designed to make the use of Povray over a cluster easy.
Ruby
2
star
12

wordcram-mirror

Java
2
star
13

Pugnacious-Juices

A Ruby videogame where two or more fluids battle for dominance
Ruby
2
star
14

Wordcram.rb

A JRuby wrapper for the java word cloud generator Wordcram
Ruby
2
star
15

Mongoid-spork-Rails-app-example

This app demonstrates how to configure a Rails 3 application with Spork and Mongoid
Ruby
2
star
16

Puzzlenode-Problem-11

Problem number 11 for puzzlenode.com
Ruby
1
star
17

s9-e1

Integration Exercise: Java Library Wrapper
Ruby
1
star
18

FooTable-rails

Ruby
1
star
19

html-unit-vendor

HTMLUnit .jars ready to be a submodule in you own projects
1
star
20

s9-e3

1
star
21

Upo-The-Game

Upo The Game it's a 2D space shooter videogame made for the course Project at the Pablo de Olavide University in 2008-2009
Python
1
star
22

Useful-Scripts

A collection of useful scripts
1
star
23

DPovray

A tool for managing a pool of Povray workers
Ruby
1
star
24

Upobook

This is a project for the Advanced Web Programming course. The focus is in the use of Ajax technology. It is an web based IRC.
Ruby
1
star
25

Puzzlenode-Problem-9

Problem number 9 for http://puzzlenode.com
Ruby
1
star
26

BloodChalice

A cooperative roleplaying videogame
Ruby
1
star
27

s9-e2

Challenge Exercise: Exponential Chaos
Ruby
1
star
28

mandragora-website

Ruby
1
star
29

examples-of-the-book-Service-Oriented-Design-with-RoR

examples of the book Service-Oriented Design with RoR
1
star