Skip to content

Commit c8851a4

Browse files
committed
Change to Christian Sterzl's fork
1 parent 997e506 commit c8851a4

33 files changed

+455
-10997
lines changed

README.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ It includes base CSS and HTML for typography, forms, buttons, tables, grids, nav
99

1010
http://twitter.github.com/bootstrap/
1111

12-
Bootstrap Wysihtml5 is a plugin for Bootstrap designed by James Hollingworth. It provides a stylish wysiwyg editor for Bootstrap.
12+
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.
1313

14-
https://github.com/jhollingworth/bootstrap-wysihtml5
14+
https://github.com/Waxolunist/bootstrap3-wysihtml5-bower
1515

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

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

20+
__Latest version with Bootstrap 2 support was `0.3.1.24`. New releases only package Bootstrap 3 support.__
2021

2122
## Rails > 3.1
2223
Include bootstrap-wysihtml5-rails in Gemfile;
@@ -28,31 +29,25 @@ gem 'bootstrap-wysihtml5-rails'
2829
or you can install from latest build;
2930

3031
``` ruby
31-
gem 'bootstrap-wysihtml5-rails', :require => 'bootstrap-wysihtml5-rails',
32-
:git => 'git://github.com/Nerian/bootstrap-wysihtml5-rails.git'
32+
gem 'bootstrap-wysihtml5-rails', :git => 'git://github.com/Nerian/bootstrap-wysihtml5-rails.git'
3333
```
3434

3535
and run bundle install.
3636

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

3939
## Configuration
4040

41-
Bootstrap-wysihtml5 depends on jquery and bootstrap.
41+
Bootstrap-wysihtml5 depends on bootstrap and jQuery.
4242

4343
app/assets/stylesheets/application.css
4444
``` css
4545
*= require bootstrap-wysihtml5
46-
// or
47-
*= require bootstrap-wysihtml5/b3
4846
```
4947

5048
app/assets/javascripts/application.js
5149
```javascript
5250
//= require bootstrap-wysihtml5
53-
// or
54-
//= require bootstrap-wysihtml5/b3
55-
5651

5752
You may include all locales like this:
5853

@@ -85,8 +80,6 @@ Just call wysihtml5() with any selector.
8580

8681
```
8782

88-
A live example: http://jsfiddle.net/5UUrg/
89-
9083
## If using Turbolinks
9184

9285
```

Rakefile

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,31 @@
11
#!/usr/bin/env rake
22
require File.expand_path('../lib/bootstrap-wysihtml5-rails/version', __FILE__)
33

4-
ORIGIN_LIB_PATH = "bootstrap-wysihtml5/lib"
5-
ORIGIN_SRC_PATH = "bootstrap-wysihtml5/src"
6-
DEST_JAVASCRIPT_PATH = "vendor/assets/javascripts/bootstrap-wysihtml5"
7-
DEST_CSS_PATH = "vendor/assets/stylesheets/bootstrap-wysihtml5"
8-
9-
def b2
10-
system("cd bootstrap-wysihtml5 && git checkout master")
11-
12-
system("cp #{ORIGIN_SRC_PATH}/bootstrap-wysihtml5.css #{DEST_CSS_PATH}/core.css")
13-
14-
core_file = File.read("#{ORIGIN_SRC_PATH}/bootstrap-wysihtml5.js")
15-
original_string = /stylesheets: \[".\/lib\/css\/wysiwyg-color.css"\]/
16-
objective_string = "stylesheets: [\"<%= stylesheet_path('bootstrap-wysihtml5/wysiwyg-color.css') %>\"]"
17-
18-
replaced = core_file.gsub(original_string, objective_string)
19-
20-
File.open("#{DEST_JAVASCRIPT_PATH}/core.js.erb", "w") { |file| file.puts replaced }
4+
def copy_locales
5+
Dir['bootstrap-wysihtml5/dist/locales/*'].each do |file|
6+
`cp #{file} vendor/assets/javascripts/bootstrap-wysihtml5/locales/#{File.basename(file).gsub('bootstrap-wysihtml5.', '')}`
7+
end
218
end
229

23-
def b3
24-
system("cd bootstrap-wysihtml5 && git checkout tb3")
25-
26-
system("cp #{ORIGIN_SRC_PATH}/bootstrap-wysihtml5.css #{DEST_CSS_PATH}/core-b3.css")
27-
28-
core_file = File.read("#{ORIGIN_SRC_PATH}/bootstrap-wysihtml5.js")
29-
original_string = /stylesheets: \[".\/lib\/css\/wysiwyg-color.css"\]/
30-
objective_string = "stylesheets: [\"<%= stylesheet_path('bootstrap-wysihtml5/wysiwyg-color.css') %>\"]"
31-
32-
replaced = core_file.gsub(original_string, objective_string)
33-
34-
File.open("#{DEST_JAVASCRIPT_PATH}/core-b3.js.erb", "w") { |file| file.puts replaced }
10+
def copy_javascript
11+
`cp bootstrap-wysihtml5/dist/bootstrap3-wysihtml5.all.min.js vendor/assets/javascripts/bootstrap-wysihtml5/bootstrap3-wysihtml5.js`
3512
end
3613

37-
14+
def copy_css
15+
`cp bootstrap-wysihtml5/dist/bootstrap3-wysihtml5.css vendor/assets/stylesheets/bootstrap-wysihtml5/bootstrap3-wysihtml5.css`
16+
end
3817

3918
desc "Update assets"
4019
task 'update' do
4120
if Dir.exist?('bootstrap-wysihtml5')
4221
system("cd bootstrap-wysihtml5 && git pull && cd ..")
4322
else
44-
system("git clone git://github.com/jhollingworth/bootstrap-wysihtml5.git bootstrap-wysihtml5")
45-
# system("cd bootstrap-wysihtml5 && git remote add b3 [email protected]:artillery/bootstrap-wysihtml5.git")
46-
# system("cd bootstrap-wysihtml5 && git fetch b3")
47-
# system("cd bootstrap-wysihtml5 && git checkout -b tb3 b3/master")
48-
end
49-
50-
Dir.foreach("bootstrap-wysihtml5/src/locales") do |file|
51-
unless file == '.' || file == '..'
52-
abbreviated_file_name = file.gsub('bootstrap-wysihtml5.', '')
53-
system("cp #{ORIGIN_SRC_PATH}/locales/#{file} #{DEST_JAVASCRIPT_PATH}/locales/#{abbreviated_file_name}")
54-
end
23+
system("git clone git://github.com/Waxolunist/bootstrap3-wysihtml5-bower.git bootstrap-wysihtml5")
5524
end
5625

57-
system("cp #{ORIGIN_LIB_PATH}/js/wysihtml5-0.3.0.js #{DEST_JAVASCRIPT_PATH}/wysihtml5.js")
58-
system("cp #{ORIGIN_LIB_PATH}/css/wysiwyg-color.css #{DEST_CSS_PATH}/wysiwyg-color.css")
59-
60-
b2
61-
# b3
62-
63-
# ["#{DEST_JAVASCRIPT_PATH}/core.js.erb", "#{DEST_JAVASCRIPT_PATH}/core-b3.js.erb"].each do |file|
64-
["#{DEST_JAVASCRIPT_PATH}/core.js.erb"].each do |file|
65-
initial = File.read(file)
66-
initial = "//= depend_on_asset \"bootstrap-wysihtml5/wysiwyg-color.css\"\n\n" + initial
67-
File.write(file, initial)
68-
end
26+
copy_locales
27+
copy_javascript
28+
copy_css
6929

7030
system("git status")
7131
end
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module BootstrapWysihtml5Rails
22
module Rails
3-
VERSION = "0.3.1.24"
3+
# Change to follow bootstrap3-wysihtml5-bower version as soon as they we can.
4+
VERSION = "0.3.2.99"
45
end
56
end

testapp/app/assets/javascripts/application.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//= require jquery
1414
//= require jquery_ujs
1515
//= require bootstrap-wysihtml5
16+
//= require bootstrap-wysihtml5/locales
1617
//= require bootstrap
1718
//= require_tree .
1819
//= require_self

testapp/app/assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
*/
1515

1616
@import "bootstrap";
17+
@import "bootstrap/theme"

testapp/app/views/home/index.html.erb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
<h1>Home#index</h1>
22
<p>Find me in app/views/home/index.html.erb</p>
33

4-
<textarea id="some-textarea" style="width: 810px; height: 200px;" placeholder="Enter text ...">
5-
<b>This is some previous text</b>
6-
</textarea>
4+
<div id="some_div">
5+
Hello
6+
</div>
7+
8+
<textarea class="textarea" placeholder="Enter text ..." style='width: 100%;height: 300px'></textarea>
79

810
<script type="text/javascript">
9-
$('#some-textarea').wysihtml5({
10-
"font-styles": true, //Font styling, e.g. h1, h2, etc. Default true
11-
"emphasis": true, //Italics, bold, etc. Default true
12-
"lists": true, //(Un)ordered lists, e.g. Bullets, Numbers. Default true
13-
"html": true, //Button which allows you to edit the generated HTML. Default false
14-
"link": true, //Button to insert a link. Default true
15-
"image": true, //Button to insert an image. Default true,
16-
"color": true //Button to change color of font
17-
});
11+
$('.textarea').wysihtml5({locale: 'es-ES'});
12+
13+
$('#some_div').wysihtml5();
1814
</script>

vendor/assets/javascripts/bootstrap-wysihtml5/b3.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

vendor/assets/javascripts/bootstrap-wysihtml5/bootstrap3-wysihtml5.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)