Skip to content

Gemfile for proper rake/rdoc versions, gitignore for lockfile #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist/
doc/
test/unit/tmp/*
*.kpf
*.tmproj
*.tmproj
Gemfile.lock
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source :rubygems

gem "rake", "0.8.7"
gem "rdoc"
gem "tilt"
gem "rack"
gem "hike"
gem "treetop"
5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 6 additions & 12 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WysiHat
JQ-WysiHat
=======

#### A WYSIWYG JavaScript framework
Expand All @@ -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

Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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.
37 changes: 12 additions & 25 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'rake'
require 'rake/clean'
require 'rake/rdoctask'
require 'rake/testtask'

CLEAN.include 'test/unit/tmp'
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions examples/custom_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" });

Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions examples/custom_toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion examples/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
margin: 0;
}

.editor_toolbar .toolbar_button {
.editor_toolbar .button {
float: left;
margin: 2px 5px;
}
Expand Down
59 changes: 29 additions & 30 deletions examples/link_selection.html
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
});
Expand All @@ -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>

Expand Down
12 changes: 6 additions & 6 deletions examples/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand All @@ -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",
Expand Down
20 changes: 10 additions & 10 deletions examples/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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;">
Expand Down
Loading