├── .gitignore ├── .settings └── .gitignore ├── Gemfile ├── Gemfile.lock ├── LICENCE ├── Rakefile ├── VERSION ├── component.json ├── dist ├── bootstrap-wysihtml5-0.0.2.css ├── bootstrap-wysihtml5-0.0.2.js └── bootstrap-wysihtml5-0.0.2.min.js ├── index.html ├── lib ├── css │ ├── bootstrap-responsive.css │ ├── bootstrap-responsive.min.css │ ├── bootstrap.css │ ├── bootstrap.min.css │ ├── prettify.css │ └── wysiwyg-color.css ├── img │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png └── js │ ├── bootstrap-button.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.7.2.min.js │ ├── prettify.js │ ├── wysihtml5-0.3.0.js │ └── wysihtml5-0.3.0.min.js ├── readme.textile ├── src ├── bootstrap-wysihtml5.css ├── bootstrap-wysihtml5.js └── locales │ ├── bootstrap-wysihtml5.ar-AR.js │ ├── bootstrap-wysihtml5.bg-BG.js │ ├── bootstrap-wysihtml5.ca-CT.js │ ├── bootstrap-wysihtml5.cs-CZ.js │ ├── bootstrap-wysihtml5.da-DK.js │ ├── bootstrap-wysihtml5.de-DE.js │ ├── bootstrap-wysihtml5.el-GR.js │ ├── bootstrap-wysihtml5.es-AR.js │ ├── bootstrap-wysihtml5.es-ES.js │ ├── bootstrap-wysihtml5.fr-FR.js │ ├── bootstrap-wysihtml5.hr-HR.js │ ├── bootstrap-wysihtml5.it-IT.js │ ├── bootstrap-wysihtml5.ja-JP.js │ ├── bootstrap-wysihtml5.ko-KR.js │ ├── bootstrap-wysihtml5.lt-LT.js │ ├── bootstrap-wysihtml5.mo-MD.js │ ├── bootstrap-wysihtml5.nb-NB.js │ ├── bootstrap-wysihtml5.nl-NL.js │ ├── bootstrap-wysihtml5.pl-PL.js │ ├── bootstrap-wysihtml5.pt-BR.js │ ├── bootstrap-wysihtml5.ru-RU.js │ ├── bootstrap-wysihtml5.sk-SK.js │ ├── bootstrap-wysihtml5.sv-SE.js │ ├── bootstrap-wysihtml5.tr-TR.js │ ├── bootstrap-wysihtml5.ua-UA.js │ ├── bootstrap-wysihtml5.zh-CN.js │ └── bootstrap-wysihtml5.zh-TW.js └── test ├── README ├── bootstrap_wysihtml5 └── parserRules_test.js ├── browser_test.js ├── editor_test.js ├── incompatible_test.js ├── index.html ├── lib ├── support └── html_equal.js └── undo_manager_test.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .c9revisions 3 | /*.project 4 | -------------------------------------------------------------------------------- /.settings/.gitignore: -------------------------------------------------------------------------------- 1 | /*.jsdtscope 2 | /*.eclipse.wst.jsdt.ui.superType.container 3 | /*.eclipse.wst.jsdt.ui.superType.name 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rake' 4 | gem 'therubyracer' 5 | gem 'uglifier' -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | execjs (1.3.0) 5 | multi_json (~> 1.0) 6 | libv8 (3.3.10.4) 7 | multi_json (1.1.0) 8 | rake (0.9.2.2) 9 | therubyracer (0.9.10) 10 | libv8 (~> 3.3.10) 11 | uglifier (1.2.3) 12 | execjs (>= 0.3.0) 13 | multi_json (>= 1.0.2) 14 | 15 | PLATFORMS 16 | ruby 17 | 18 | DEPENDENCIES 19 | rake 20 | therubyracer 21 | uglifier 22 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012 JFHollingworth LTD 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bundler' 3 | require 'fileutils' 4 | begin 5 | Bundler.setup(:default, :development) 6 | rescue Bundler::BundlerError => e 7 | $stderr.puts e.message 8 | $stderr.puts "Run `bundle install` to install missing gems" 9 | exit e.status_code 10 | end 11 | 12 | ROOT = File.dirname(__FILE__) 13 | 14 | require 'rake' 15 | require 'uglifier' 16 | 17 | task :default do 18 | version = File.open(File.join(ROOT, 'VERSION')).read 19 | output_path = File.join(ROOT, "dist") 20 | 21 | js_input_path = File.join('src', 'bootstrap-wysihtml5.js') 22 | css_input_path = File.join('src', 'bootstrap-wysihtml5.css') 23 | 24 | js_output_path = File.join(output_path, "bootstrap-wysihtml5-#{version}.js") 25 | minified_js_output_path = File.join(output_path, "bootstrap-wysihtml5-#{version}.min.js") 26 | css_output_path = File.join(output_path, "bootstrap-wysihtml5-#{version}.css") 27 | 28 | minified_js = Uglifier.compile(File.read(js_input_path)) 29 | 30 | File.open(minified_js_output_path, 'w') { |f| f.write(minified_js) } 31 | File.open(js_output_path, 'w') { |f| f.write(File.read(js_input_path)) } 32 | File.open(css_output_path, 'w') { |f| f.write(File.read(css_input_path)) } 33 | end 34 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.0.2 -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap-wysihtml5", 3 | "version": "0.1.0", 4 | "main": ["src/bootstrap-wysihtml5.css", "src/bootstrap-wysihtml5.js"], 5 | "dependencies": { 6 | "wysihtml5": "~0.3.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /dist/bootstrap-wysihtml5-0.0.2.css: -------------------------------------------------------------------------------- 1 | ul.wysihtml5-toolbar { 2 | margin: 0; 3 | padding: 0; 4 | display: block; 5 | } 6 | 7 | ul.wysihtml5-toolbar::after { 8 | clear: both; 9 | display: table; 10 | content: ""; 11 | } 12 | 13 | ul.wysihtml5-toolbar > li { 14 | float: left; 15 | display: list-item; 16 | list-style: none; 17 | margin: 0 5px 10px 0; 18 | } 19 | 20 | ul.wysihtml5-toolbar a[data-wysihtml5-command=bold] { 21 | font-weight: bold; 22 | } 23 | 24 | ul.wysihtml5-toolbar a[data-wysihtml5-command=italic] { 25 | font-style: italic; 26 | } 27 | 28 | ul.wysihtml5-toolbar a[data-wysihtml5-command=underline] { 29 | text-decoration: underline; 30 | } 31 | 32 | ul.wysihtml5-toolbar a.btn.wysihtml5-command-active { 33 | background-image: none; 34 | -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05); 35 | -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05); 36 | box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05); 37 | background-color: #E6E6E6; 38 | background-color: #D9D9D9; 39 | outline: 0; 40 | } 41 | 42 | ul.wysihtml5-commands-disabled .dropdown-menu { 43 | display: none !important; 44 | } 45 | 46 | ul.wysihtml5-toolbar div.wysihtml5-colors { 47 | display:block; 48 | width: 50px; 49 | height: 20px; 50 | margin-top: 2px; 51 | margin-left: 5px; 52 | position: absolute; 53 | pointer-events: none; 54 | } 55 | 56 | ul.wysihtml5-toolbar a.wysihtml5-colors-title { 57 | padding-left: 70px; 58 | } 59 | 60 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="black"] { 61 | background: black !important; 62 | } 63 | 64 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="silver"] { 65 | background: silver !important; 66 | } 67 | 68 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="gray"] { 69 | background: gray !important; 70 | } 71 | 72 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="maroon"] { 73 | background: maroon !important; 74 | } 75 | 76 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="red"] { 77 | background: red !important; 78 | } 79 | 80 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="purple"] { 81 | background: purple !important; 82 | } 83 | 84 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="green"] { 85 | background: green !important; 86 | } 87 | 88 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="olive"] { 89 | background: olive !important; 90 | } 91 | 92 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="navy"] { 93 | background: navy !important; 94 | } 95 | 96 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="blue"] { 97 | background: blue !important; 98 | } 99 | 100 | ul.wysihtml5-toolbar div[data-wysihtml5-command-value="orange"] { 101 | background: orange !important; 102 | } 103 | -------------------------------------------------------------------------------- /dist/bootstrap-wysihtml5-0.0.2.js: -------------------------------------------------------------------------------- 1 | !function($, wysi) { 2 | "use strict"; 3 | 4 | var templates = function(key, locale) { 5 | 6 | var tpl = { 7 | "font-styles": 8 | "
52 | bootstrap-wysihtml5 is a javascript plugin that makes it easy to create simple, beautiful wysiwyg editors with the help of wysihtml5 and Twitter Bootstrap 53 |
54 | 55 |56 | View project on Github 57 |
58 |64 |
$('.textarea').wysihtml5();65 | 66 | 67 |
69 |
35 | 36 | 39 |40 | 41 | You can get the html generated by getting the value of the text area, e.g. 42 | 43 |
44 | $('#some-textarea').val(); 45 |46 | 47 | h1. Advanced 48 | 49 | h2. Options 50 | 51 | An options object can be passed in to .wysihtml5() to configure the editor: 52 | 53 |
54 | $('#some-textarea').wysihtml5({someOption: 23, ...}) 55 |56 | 57 | h3. Buttons 58 | 59 | To override which buttons to show, set the appropriate flags: 60 | 61 |
62 | $('#some-textarea').wysihtml5({ 63 | "font-styles": true, //Font styling, e.g. h1, h2, etc. Default true 64 | "emphasis": true, //Italics, bold, etc. Default true 65 | "lists": true, //(Un)ordered lists, e.g. Bullets, Numbers. Default true 66 | "html": false, //Button which allows you to edit the generated HTML. Default false 67 | "link": true, //Button to insert a link. Default true 68 | "image": true, //Button to insert an image. Default true, 69 | "color": false //Button to change color of font 70 | }); 71 |72 | 73 | h3. Custom Templates for Toolbar Buttons 74 | 75 | To define custom templates for buttons, you can submit a customTemplates hash with the new definitions. Each entry should be a function which expects 'locale' and optional 'options' to manage the translations. 76 | 77 | For example, the default template used for the editHtml mode button looks like this (with size fetched from the optional 'options') 78 | 79 |
80 |
90 | var myCustomTemplates = { 91 | html : function(locale) { 92 | return "