Permalink
Browse files

Merge nhowell into this fork, update the Gemfile

  • Loading branch information...
2 parents 054d451 + 2bc5346 commit c6ce22c6818ea4aa5bfc910a0674acff90b1f887 @mixonic committed Jan 12, 2012
Showing with 9,302 additions and 2,155 deletions.
  1. +3 −3 .gitmodules
  2. +4 −0 Gemfile
  3. +3 −2 LICENSE
  4. +6 −12 README.markdown
  5. +12 −25 Rakefile
  6. +5 −5 examples/custom_buttons.html
  7. +2 −2 examples/custom_toolbar.html
  8. +1 −1 examples/editor.css
  9. +29 −30 examples/link_selection.html
  10. +6 −6 examples/list.html
  11. +10 −10 examples/simple.html
  12. +28 −48 src/wysihat.js
  13. +2 −2 src/wysihat/commands.js
  14. +10 −10 src/wysihat/dom/bookmark.js
  15. +1 −1 src/wysihat/dom/range.js
  16. +5 −5 src/wysihat/dom/selection.js
  17. +10 −5 src/wysihat/editor.js
  18. +3 −3 src/wysihat/events/frame_loaded.js
  19. +4 −4 src/wysihat/events/selection_change.js
  20. +19 −18 src/wysihat/formatting.js
  21. +18 −0 src/wysihat/header.js
  22. +10 −9 src/wysihat/toolbar.js
  23. +26 −36 test/editor.html
  24. +6 −7 test/unit/editor_test.js
  25. +24 −15 test/unit/formatting_test.js
  26. +7 −5 test/unit/templates/default.erb
  27. +0 −154 vendor/jquery/jquery-1.4.2.min.js
  28. +9,046 −0 vendor/jquery/jquery-1.6.4.js
  29. +1 −0 vendor/pdoc
  30. +1 −0 vendor/sprockets
  31. +0 −4 vendor/sprockets/.gitignore
  32. +0 −22 vendor/sprockets/CHANGELOG
  33. +0 −20 vendor/sprockets/LICENSE
  34. +0 −230 vendor/sprockets/README.markdown
  35. +0 −19 vendor/sprockets/Rakefile
  36. +0 −54 vendor/sprockets/bin/sprocketize
  37. +0 −127 vendor/sprockets/ext/nph-sprockets.cgi
  38. +0 −42 vendor/sprockets/lib/sprockets.rb
  39. +0 −44 vendor/sprockets/lib/sprockets/concatenation.rb
  40. +0 −52 vendor/sprockets/lib/sprockets/environment.rb
  41. +0 −5 vendor/sprockets/lib/sprockets/error.rb
  42. +0 −37 vendor/sprockets/lib/sprockets/pathname.rb
  43. +0 −91 vendor/sprockets/lib/sprockets/preprocessor.rb
  44. +0 −107 vendor/sprockets/lib/sprockets/secretary.rb
  45. +0 −77 vendor/sprockets/lib/sprockets/server.rb
  46. +0 −54 vendor/sprockets/lib/sprockets/source_file.rb
  47. +0 −82 vendor/sprockets/lib/sprockets/source_line.rb
  48. +0 −9 vendor/sprockets/lib/sprockets/version.rb
  49. +0 −15 vendor/sprockets/sprockets.gemspec
  50. +0 −1 vendor/sprockets/test/fixtures/assets/images/script_with_assets/one.png
  51. +0 −1 vendor/sprockets/test/fixtures/assets/images/script_with_assets/two.png
  52. +0 −1 vendor/sprockets/test/fixtures/assets/stylesheets/script_with_assets.css
  53. +0 −1 vendor/sprockets/test/fixtures/constants.yml
  54. +0 −8 ...res/double_slash_comments_that_are_not_requires_should_be_ignored_when_strip_comments_is_false.js
  55. +0 −2 ...rockets/test/fixtures/double_slash_comments_that_are_not_requires_should_be_removed_by_default.js
  56. +0 −4 vendor/sprockets/test/fixtures/multiline_comments_should_be_removed_by_default.js
  57. +0 −5 .../sprockets/test/fixtures/requiring_a_file_after_it_has_already_been_required_should_do_nothing.js
  58. +0 −1 vendor/sprockets/test/fixtures/requiring_a_file_that_does_not_exist_should_raise_an_error.js
  59. +0 −3 ...est/fixtures/requiring_a_single_file_should_replace_the_require_comment_with_the_file_contents.js
  60. +0 −1 vendor/sprockets/test/fixtures/requiring_the_current_file_should_do_nothing.js
  61. +0 −3 vendor/sprockets/test/fixtures/src/constants.yml
  62. +0 −1 vendor/sprockets/test/fixtures/src/foo.js
  63. +0 −4 vendor/sprockets/test/fixtures/src/foo/bar.js
  64. +0 −1 vendor/sprockets/test/fixtures/src/foo/foo.js
  65. +0 −3 vendor/sprockets/test/fixtures/src/script_with_assets.js
  66. +0 −13 vendor/sprockets/test/fixtures/src/script_with_comments.js
  67. +0 −36 vendor/sprockets/test/test_concatenation.rb
  68. +0 −64 vendor/sprockets/test/test_environment.rb
  69. +0 −55 vendor/sprockets/test/test_helper.rb
  70. +0 −43 vendor/sprockets/test/test_pathname.rb
  71. +0 −107 vendor/sprockets/test/test_preprocessor.rb
  72. +0 −89 vendor/sprockets/test/test_secretary.rb
  73. +0 −76 vendor/sprockets/test/test_server.rb
  74. +0 −34 vendor/sprockets/test/test_source_file.rb
  75. +0 −89 vendor/sprockets/test/test_source_line.rb
View
@@ -1,9 +1,9 @@
-[submodule "pdoc"]
+[submodule "vendor/pdoc"]
path = vendor/pdoc
url = git://github.com/tobie/pdoc.git
-[submodule "sprockets"]
+[submodule "vendor/sprockets"]
path = vendor/sprockets
url = git://github.com/sstephenson/sprockets.git
-[submodule "unittest_js"]
+[submodule "vendor/unittest_js"]
path = vendor/unittest_js
url = git://github.com/tobie/unittest_js.git
View
@@ -2,3 +2,7 @@ source :rubygems
gem "rake", "0.8.7"
gem "rdoc"
+gem "tilt"
+gem "rack"
+gem "hike"
+gem "treetop"
View
@@ -1,9 +1,10 @@
-Original Wysihat code:
Copyright (c) 2010 Joshua Peek
-Modified jq-wysihat code:
+Modified JQ-WysiHat code:
Copyright (c) 2010 Scott Williams
+Further modified JQ-WysiHat code:
+Copyright (c) 2011 Nicholas Howell
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,4 +1,4 @@
-WysiHat
+JQ-WysiHat
=======
#### A WYSIWYG JavaScript framework
@@ -7,7 +7,7 @@ JQ-WysiHat is a WYSIWYG JavaScript framework that provides an extensible
foundation to design your own rich text editor. WysiHat stays out of your
way and leaves the UI design to you.
-The original version of WysiHat was designed to run on Prototype. This fork of it was ported to run on jQuery (used against 1.4.2).
+The original version of WysiHat was designed to run on Prototype. This fork of it was ported to run on jQuery (used against 1.6.4).
### Support platforms
@@ -20,14 +20,12 @@ JQ-WysiHat currently supports:
### Dependencies
-* jQuery 1.4.2 or later (http://jquery.com/) although older versions will probably work fine, they just haven't been tested.
+* jQuery 1.6.4 or later (http://jquery.com/) although older versions will probably work fine, they just haven't been tested.
## Documentation
Code is documented inline with PDoc (http://pdoc.org/).
-The generated HTML documentation can be found on the `gh-pages` branch or viewed online at (http://josh.github.com/wysihat/).
-
### Examples
Several examples can be found under `examples/` to get you started.
@@ -38,10 +36,6 @@ The easiest way is to simply call:
This adds some commonly used buttons to the toolbar and gets you going.
-### Downloading
-
-Once I get closer to a 'stable' version I'll tag a release and add it here. However, in day to day use I haven't had any major troubles with it.
-
### Building from source
You can build the latest version of JQ-WysiHat from source by running
@@ -53,11 +47,11 @@ the project from source. It is not required to run the code.
Check out the original WysiHat source with
- $ git clone git://github.com/josh/wysihat.git
+ $ git clone git://github.com/37signals/wysihat.git
And the fork with
- $ git clone git://github.com/swilliams/jq-wysihat.git
+ $ git clone git://github.com/nhowell/jq-wysihat.git
Then
@@ -69,4 +63,4 @@ GitHub pull requests are welcome.
## License
-jq-WysiHat is released under the MIT license.
+JQ-WysiHat is released under the MIT license.
View
@@ -1,6 +1,5 @@
require 'rake'
require 'rake/clean'
-require 'rake/rdoctask'
require 'rake/testtask'
CLEAN.include 'test/unit/tmp'
@@ -13,34 +12,26 @@ WYSIHAT_SRC_DIR = File.join(WYSIHAT_ROOT, 'src')
# Distribution
-file 'dist/jquery-1.4.2.min.js' => :sprockets do |t|
+file 'dist/jquery.js' => :sprockets do |t|
jquery_src_dir = "#{WYSIHAT_ROOT}/vendor/jquery"
- secretary = Sprockets::Secretary.new(
- :root => jquery_src_dir,
- :load_path => [jquery_src_dir],
- :source_files => ["jquery-1.4.2.min.js"]
- )
-
+ env = Sprockets::Environment.new
+ env.prepend_path jquery_src_dir
FileUtils.mkdir_p File.dirname(t.name)
- secretary.concatenation.save_to(t.name)
+ File.open(t.name, 'w') {|f| f.write(env['jquery-1.6.4.js'].to_s) }
end
file 'dist/jq-wysihat.js' => Dir['src/**/*'] + [:sprockets] do |t|
- secretary = Sprockets::Secretary.new(
- :root => WYSIHAT_SRC_DIR,
- :load_path => [WYSIHAT_SRC_DIR],
- :source_files => ["wysihat.js"]
- )
-
+ env = Sprockets::Environment.new
+ env.prepend_path WYSIHAT_SRC_DIR
FileUtils.mkdir_p File.dirname(t.name)
- secretary.concatenation.save_to(t.name)
+ File.open(t.name, 'w') {|f| f.write(env['wysihat.js'].to_s) }
end
task :default => :dist
desc "Builds the distribution."
-task :dist => ['dist/jquery-1.4.2.min.js', 'dist/jq-wysihat.js']
+task :dist => ['dist/jquery.js', 'dist/jq-wysihat.js']
# Documentation
@@ -50,14 +41,10 @@ file 'doc' => Dir['src/**/*'] + [:sprockets, :pdoc] do
require 'tempfile'
Tempfile.open('pdoc') do |temp|
- secretary = Sprockets::Secretary.new(
- :root => WYSIHAT_SRC_DIR,
- :load_path => [WYSIHAT_SRC_DIR],
- :source_files => ["wysihat.js"],
- :strip_comments => false
- )
-
- secretary.concatenation.save_to(temp.path)
+ env = Sprockets::Environment.new
+ env.prepend_path WYSIHAT_SRC_DIR
+ File.open(temp.path, 'w') {|f| f.write(env['wysihat.js'].to_s) }
+
PDoc::Runner.new(temp.path, :destination => "#{WYSIHAT_ROOT}/doc").run
end
end
@@ -5,14 +5,14 @@
<link rel="stylesheet" href="editor.css" type="text/css" />
- <script type="text/javascript" src="../dist/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="../dist/jquery.js"></script>
<script type="text/javascript" src="../dist/jq-wysihat.js"></script>
<script type="text/javascript" charset="utf-8">
- $(document).ready(function() {
+ $(function() {
var editor = WysiHat.Editor.attach($('#content'));
var toolbar = new WysiHat.Toolbar(editor);
- toolbar.initialize(editor);
+ toolbar.initialize(editor);
toolbar.addButton({ name: 'bold', label: "Strong" });
@@ -37,10 +37,10 @@
<p>This examples shows how to add custom buttons and actions with the built-in toolbar class.</p>
<code><pre>
- $(document).ready(function() {
+ $(document).ready(function() {
var editor = WysiHat.Editor.attach($('#content'));
var toolbar = new WysiHat.Toolbar(editor);
- toolbar.initialize(editor);
+ toolbar.initialize(editor);
// The name will be used for the div class and the command to execute
// The label is the text you see for the button.
@@ -5,11 +5,11 @@
<link rel="stylesheet" href="editor.css" type="text/css" />
- <script type="text/javascript" src="../dist/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="../dist/jquery.js"></script>
<script type="text/javascript" src="../dist/jq-wysihat.js"></script>
<script type="text/javascript" charset="utf-8">
- $(document).ready(function() {
+ $(function() {
var editor = WysiHat.Editor.attach($("#content"));
var boldButton = $('.editor_toolbar .bold').first();
View
@@ -13,7 +13,7 @@
margin: 0;
}
-.editor_toolbar .toolbar_button {
+.editor_toolbar .button {
float: left;
margin: 2px 5px;
}
@@ -5,27 +5,27 @@
<link rel="stylesheet" href="editor.css" type="text/css" />
- <script type="text/javascript" src="../dist/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="../dist/jquery.js"></script>
<script type="text/javascript" src="../dist/jq-wysihat.js"></script>
<script type="text/javascript" charset="utf-8">
- WysiHat.Commands.promptLinkSelection = function() {
- if (this.linkSelected()) {
- if (confirm("Remove link?"))
- this.unlinkSelection();
- } else {
- var value = prompt("Enter a URL", "http://www.google.com/");
- if (value)
- this.linkSelection(value);
+ $(function() {
+ var editor;
+
+ WysiHat.Commands.promptLinkSelection = function() {
+ if (this.linkSelected()) {
+ if (confirm("Remove link?"))
+ this.unlinkSelection();
+ } else {
+ var value = prompt("Enter a URL", "http://www.google.com/");
+ if (value)
+ this.linkSelection(value);
+ }
}
- }
- $(document).ready(function() {
- var editor = WysiHat.Editor.attach($('#content'));
- var toolbar = new WysiHat.Toolbar(editor);
- toolbar.initialize(editor);
+ editor = $('#content').wysihat();
- toolbar.addButton({
+ editor.toolbar.addButton({
label: "Link",
handler: function(editor) { return editor.promptLinkSelection(); }
});
@@ -42,27 +42,26 @@
<p>This example shows you how to create a simple UI for linking and unlinking selections</p>
<code><pre>
- WysiHat.Commands.promptLinkSelection = function() {
- if (this.linkSelected()) {
- if (confirm("Remove link?"))
- this.unlinkSelection();
- } else {
- var value = prompt("Enter a URL", "http://www.google.com/");
- if (value)
- this.linkSelection(value);
+ $(function() {
+ var editor;
+
+ WysiHat.Commands.promptLinkSelection = function() {
+ if (this.linkSelected()) {
+ if (confirm("Remove link?"))
+ this.unlinkSelection();
+ } else {
+ var value = prompt("Enter a URL", "http://www.google.com/");
+ if (value)
+ this.linkSelection(value);
+ }
}
- }
- $(document).ready(function() {
- var editor = WysiHat.Editor.attach($('#content'));
- var toolbar = new WysiHat.Toolbar(editor);
- toolbar.initialize(editor);
+ editor = $('#content').wysihat();
- toolbar.addButton({
+ editor.toolbar.addButton({
label: "Link",
handler: function(editor) { return editor.promptLinkSelection(); }
});
-
});
</pre></code>
View
@@ -5,15 +5,15 @@
<link rel="stylesheet" href="editor.css" type="text/css" />
- <script type="text/javascript" src="../dist/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="../dist/jquery.js"></script>
<script type="text/javascript" src="../dist/jq-wysihat.js"></script>
<script type="text/javascript" charset="utf-8">
- $(document).ready(function() {
- var editor = WysiHat.Editor.attach($('#content'));
+ $(function() {
+ var editor = WysiHat.Editor.attach($('#content'));
var toolbar = new WysiHat.Toolbar(editor);
- toolbar.initialize(editor);
-
+ toolbar.initialize(editor);
+
toolbar.addButton({
label: "Ordered List",
handler: function(editor) { return editor.toggleOrderedList(); }
@@ -39,7 +39,7 @@
$(document).ready(function() {
var editor = WysiHat.Editor.attach('content');
var toolbar = new WysiHat.Toolbar(editor);
- toolbar.initialize(editor);
+ toolbar.initialize(editor);
toolbar.addButton({
label: "Ordered List",
View
@@ -5,16 +5,16 @@
<link rel="stylesheet" href="editor.css" type="text/css" />
- <script type="text/javascript" src="../dist/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="../dist/jquery.js"></script>
<script type="text/javascript" src="../dist/jq-wysihat.js"></script>
<script type="text/javascript" charset="utf-8">
+ $(function() {
+ $('#content').wysihat();
- $(function() {
- $('#content').wysihat();
- $('#error').hide();
- });
-
+ // Hide our error message if the editor loads fine
+ $('#error').hide();
+ });
</script>
</head>
@@ -24,10 +24,10 @@
<p>This is a simple example of how easy it is to get up and running with WysiHat.</p>
<code><pre>
- // Replaces the textarea 'content' with the wysiwyg editor on load using the jQuery plugin model.
- $(function() {
- $('#content').wysihat();
- });
+ // Replaces the textarea 'content' with the wysiwyg editor on load using the jQuery plugin model.
+ $(function() {
+ $('#content').wysihat();
+ });
</pre></code>
<form action="#" method="post" style="width: 500px;">
Oops, something went wrong.

0 comments on commit c6ce22c

Please sign in to comment.