Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

FireFox bug fixed #27

Open
wants to merge 165 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
8552ce5
Added selection and selected to commands.js for fonts, fontsizes, col…
Jun 22, 2009
1b42e62
Fixed a bug in firefox with backgroundColorSelection
Jun 25, 2009
05ff610
Added some bug fi fixes for firefox and for IE. Added tests for form…
Jun 30, 2009
04521e1
added examples/image.html
Sep 14, 2009
f74be19
updated the description on examples/image.html
Sep 14, 2009
3ed3e7e
added examples/align_selection.html
Sep 14, 2009
f3ec989
added examples/undo_redo.js
Sep 14, 2009
96380e4
added examples/insert_list.html
Sep 14, 2009
902cc15
renamed examples/insert_list.html to examples/list.html and updated t…
Sep 14, 2009
346ec3e
added examples/html.hml
Sep 14, 2009
1c3870c
Updated examples/align_selection.html. The previous way of doing it w…
Sep 15, 2009
e558924
Updated examples/align_selection.html. The previous way of doing it w…
Sep 15, 2009
87697bf
added examples/flash.html
Sep 15, 2009
976d9e0
changed JustifyLaft to JusfityLeft in examples/html.html
Sep 23, 2009
6004a6b
added examples/font-selection.html
Sep 23, 2009
8572988
Minor fixes to make wysihat play nice with IE8
zmack Nov 2, 2009
e27d554
added some forgotten semicolons and parseInt() radixes
Nov 8, 2009
1a3363b
added WysiHat.Commands#queryValueCommandState
Nov 10, 2009
0d611cf
added WysiHat.Commands#getSelectedStyles()
Nov 11, 2009
ddb95f8
removed the ...Selected methods and updated the font_selection example.
Nov 11, 2009
1dc0598
removed deleted methods from the return
Nov 11, 2009
0a175f7
updated the <code> block in examples/font_selection.html
Nov 13, 2009
dc6d377
added WysiHat.Commands#formatblockSelection and examples/heading_sele…
Jan 11, 2010
1a29cfa
rename license filename
josh Feb 3, 2010
d03ebf3
bump copyright
josh Feb 3, 2010
aab2d89
trash website
josh Feb 3, 2010
cde33db
draft 0.2.1 release notes
josh Feb 3, 2010
7267e58
untabify
josh Feb 3, 2010
2f7761f
0.2.1 release
josh Feb 3, 2010
a139d9d
dump iframe support
josh Feb 3, 2010
f1b8268
remove ff start up hack
josh Feb 3, 2010
9d586e3
drop legacy browser support
josh Feb 3, 2010
9d9c833
Set a min height on test editor
josh Feb 3, 2010
7e197df
stop fowarding native events
josh Feb 3, 2010
3483eea
disable wysihat:change event cause its breaking undo/redo
josh Feb 3, 2010
a623870
IE expects "contentEditable"
josh Feb 3, 2010
91e7294
No margin between Ps in IE
josh Feb 3, 2010
762a5a5
disable wysihat:select for now since it breaks double clicking to select
josh Feb 3, 2010
125d509
update pdoc
josh Feb 3, 2010
478d530
update prototype
josh Feb 3, 2010
ac74208
update unittest_js
josh Feb 3, 2010
76e070b
IE conditional for sanitizer tests
josh Feb 3, 2010
484ef26
dump editor tests
josh Feb 3, 2010
fece4b2
dump toolbar tests
josh Feb 3, 2010
3f915e1
unused fixtures
josh Feb 3, 2010
32487db
add iframe removal to changelog
josh Feb 3, 2010
3e60bbd
tset insertHTML
josh Feb 3, 2010
83d0091
simple editor test for bold selection
josh Feb 3, 2010
cdada4c
ujs event observers
josh Feb 4, 2010
6c7ce4b
move button sets into toolbar file
josh Feb 4, 2010
355e1eb
removed callback arg from attach
josh Feb 4, 2010
12427ff
wrap up events in observer class
josh Feb 4, 2010
bdae261
cleanup test editor js
josh Feb 4, 2010
6ede2ac
no iframe to style
josh Feb 4, 2010
cbc863d
add firebug to ie test editor
josh Feb 5, 2010
59024c3
selection tests based off webkit
josh Feb 5, 2010
da86d6b
use range.getNode
josh Feb 5, 2010
0374578
remove custom focus and blur events
josh Feb 8, 2010
21c172f
remove ie paste restore range
josh Feb 8, 2010
15db716
drop unnessary events and implement a generic selection:change
josh Feb 8, 2010
d523e05
generic field:change event
josh Feb 8, 2010
f2bcfa7
remove dom.js meta file
josh Feb 8, 2010
d9bb4eb
remove lang.js meta file
josh Feb 8, 2010
f58c53f
selection requires range
josh Feb 8, 2010
eb9ef3f
commands require selection
josh Feb 8, 2010
47b8b1b
toolbar depends on selection:change event
josh Feb 8, 2010
1425115
previousContents var is dead
josh Feb 8, 2010
b22045c
drop rawContent and setRawContent, just use innerHTML
josh Feb 8, 2010
13164bb
kill debug line
josh Feb 8, 2010
d510ab4
alias toggleList to insertList commands
josh Feb 8, 2010
c6c261a
unordered and order list query state
josh Feb 8, 2010
0e76d2e
import Tim Cameron Ryan's IErange
josh Feb 8, 2010
c3bf719
kill debug lines
josh Feb 8, 2010
e345b78
make getSelection and getRange private
josh Feb 8, 2010
b4d3eaf
kill functional test
josh Feb 8, 2010
fd006a4
ignore invalid command
josh Feb 8, 2010
9312fde
dump sprockwatch
josh Feb 8, 2010
0c23357
test runner doesn't really work
josh Feb 8, 2010
30a55d9
improve getNode detection
josh Feb 8, 2010
15a6942
whitespace!
josh Feb 8, 2010
8ed88c2
missed some tests
josh Feb 9, 2010
cb34a92
compareRanges is unused
josh Feb 9, 2010
833ae6d
inline createRangeFromElement
josh Feb 9, 2010
195a15c
use range api for selectNode in Safari
josh Feb 9, 2010
9ae3a0b
drop webkit only selection test
josh Feb 9, 2010
77e239d
move getNode selection helper to selection instance
josh Feb 9, 2010
e27fd7f
move remaining selection helpers to selection prototype
josh Feb 9, 2010
93ddafa
remove less important examples
josh Feb 10, 2010
36ec272
use function bind
josh Feb 10, 2010
94bc0e0
drop persistence helpers
josh Feb 10, 2010
3b24476
alias commands to $E utility
josh Feb 10, 2010
1737919
feature detection for selection:change event
josh Feb 12, 2010
42cead8
use named function for selection change event
josh Feb 12, 2010
c9df3df
use named function for field changed event handler
josh Feb 12, 2010
2441ac4
nicer styles on editor sandbox
josh Feb 12, 2010
c740de7
fire field changed event on execCommand
josh Feb 12, 2010
62c7352
only fire selection:change when the previous range is different
josh Feb 12, 2010
e495123
onselectionchange event isn't ready till dom load
josh Feb 12, 2010
a6c4612
can't declare a function in a conditional
josh Feb 12, 2010
2bd0dba
reorg dom range and selection files
josh Feb 16, 2010
6cc8b5c
tests for equalRange
josh Feb 16, 2010
8322256
elements after ol and uls should be wrapped in a p
josh Feb 16, 2010
20be930
test range after insertNode
josh Feb 16, 2010
6a92f1b
more sensible range tests
josh Feb 16, 2010
b306ceb
get safari selection prototype with __proto__
josh Feb 17, 2010
850fc25
generate expect html with element builder
josh Feb 17, 2010
23ee545
mark insertNode range test as pending
josh Feb 17, 2010
115d3f7
better range container assertions
josh Feb 17, 2010
11df793
more range tests
josh Feb 17, 2010
e8e8c9e
protect findChildPosition
josh Feb 17, 2010
407a981
disable some tests, i think safari maybe wrong
josh Feb 17, 2010
da40755
clean test editor whitespace
josh Feb 17, 2010
4f7baa7
correct tests that were dependent on whitespace
josh Feb 17, 2010
e754f89
correct some invalid tests
josh Feb 17, 2010
0dccc5c
pending test for toString
josh Feb 17, 2010
77e1b10
fix textrange end point adopt when offset is beyond child nodes
josh Feb 17, 2010
e0c8a24
return false if no lists are selected
josh Feb 18, 2010
316a1c5
evidence
josh Feb 18, 2010
f79aa78
kill ie firebug console
josh Feb 19, 2010
f72cd0b
range from text range
josh Feb 19, 2010
71701c1
Revert "evidence"
josh Apr 12, 2010
1ec048f
Range fixes for IE
sstephenson Apr 12, 2010
68bded3
Merge branch 'master' of github.com:josh/wysihat
sstephenson Apr 12, 2010
26fb52d
Believe it or not, simply accessing a text node's nodeValue property …
sstephenson Apr 14, 2010
9df4ccf
include * to please sizzle
josh May 13, 2010
8029d6f
match contenteditable with empty string
josh May 18, 2010
d1eabfe
new formatter
josh May 24, 2010
cbe349a
new sanitizer
josh May 24, 2010
7436d07
Updated Rakefile so that it would run the test suite. Now to get all …
mscottford May 4, 2010
5ae99d0
Revert "Updated Rakefile so that it would run the test suite. Now to …
josh May 25, 2010
6ff80a6
update vendored code
josh May 25, 2010
78eb09b
rewrite sanitizer tests
josh May 25, 2010
abdd6c0
remove old sanitizer
josh May 25, 2010
43a41dc
fix tests on ie
josh May 25, 2010
9e9db13
remove e shortcut for now
josh May 25, 2010
ee4aff2
fix syntax error
josh May 25, 2010
a313203
port old formatting tests
josh May 25, 2010
bd89203
remove old formatter
josh May 25, 2010
ba57c7c
use get app markup in test editor
josh May 25, 2010
332a272
sanitizer can skip over tags
josh May 25, 2010
4a5bfa3
toggle un/ordered list will effect the entire list
josh May 26, 2010
125cf65
old call to formatHTMLInput
josh May 26, 2010
20cd76f
update examples
josh May 26, 2010
10a9c0e
html5 templates
josh May 26, 2010
cca4864
replace blockquote command with indent and outdent
josh May 26, 2010
d2bbb36
depend on prototype 1.7
josh May 27, 2010
5bd0723
use new prototype 1.7 event helpers
josh May 27, 2010
b0e8fd2
indent selected query method
josh May 27, 2010
3fe11df
initial work on feature detection
josh May 27, 2010
21f638e
unit tests for features
josh May 31, 2010
5ce3e18
fix pdoc comment
josh May 31, 2010
7269c96
cleanup rakefile
josh May 31, 2010
7c0f4d1
fix test building
josh May 31, 2010
646a681
fix unittest loading old prototype
josh May 31, 2010
21681c7
frame loaded event
josh May 31, 2010
6b58671
use onFrameLoaded for feature detection
josh May 31, 2010
c4d58e8
wrong var name
josh May 31, 2010
7142fbd
frameWindow is unused
josh May 31, 2010
c6b92c1
disable feature detection, still reliable
josh May 31, 2010
40f2800
indent selection for FF
josh Jun 1, 2010
4d3809b
Sprockets 2 compatibility
josh Feb 8, 2011
bcdbf03
In FireFox there is a bug that when you type and then click a button …
Feb 28, 2011
ed5503f
Updated the previous fix now its using a build in Prototype function …
Mar 1, 2011
82ca057
implemented the use of h1..h6 and p tags including proper removal of …
Mar 2, 2011
5b86352
fixed indentation of two functions
Mar 2, 2011
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
13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
*0.3*

* Removed iFrame support and transitioned to contentEditable. This drops
support for Firefox 2.

*0.2.1* (February 3, 2010)

* Added Editor#queryValueCommandState for testing custom query commands.

* Added execCommand delegates for fontSelection, fontSizeSelection,
backgroundColorSelection, backgroundColorSelected, alignSelection,
and alignSelected.

*0.2* (March 29, 2009)

* For performance reasons, automatic textarea saving is now disabled by
Expand Down
2 changes: 1 addition & 1 deletion MIT-LICENSE → LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2008 Joshua Peek
Copyright (c) 2010 Joshua Peek

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
11 changes: 5 additions & 6 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ way and leaves the UI design to you.

WysiHat currently supports:

* Microsoft Internet Explorer for Windows, version 6.0 and higher
* Mozilla Firefox 2.0 and higher
* Apple Safari 3.0 and higher
* Opera 9.52 and higher
* Google Chrome
* Microsoft Internet Explorer for Windows, version 7.0
* Mozilla Firefox 3.0
* Apple Safari 4.0
* Google Chrome 4.0

### Dependencies

* Prototype 1.6 or later (http://prototypejs.org/)
* Prototype 1.7 or later (http://prototypejs.org/)

## Documentation

Expand Down
207 changes: 84 additions & 123 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,154 +1,115 @@
require 'rake'
require 'rake/testtask'
require 'rake/clean'
require 'rake/rdoctask'
require 'rake/testtask'

WYSIHAT_ROOT = File.expand_path(File.dirname(__FILE__))
WYSIHAT_SRC_DIR = File.join(WYSIHAT_ROOT, 'src')
WYSIHAT_DIST_DIR = File.join(WYSIHAT_ROOT, 'dist')
WYSIHAT_DOC_DIR = File.join(WYSIHAT_ROOT, 'doc')
WYSIHAT_WEBSITE_DIR = File.join(WYSIHAT_ROOT, 'website')
WYSIHAT_TEST_DIR = File.join(WYSIHAT_ROOT, 'test')
WYSIHAT_TEST_UNIT_DIR = File.join(WYSIHAT_TEST_DIR, 'unit')
WYSIHAT_TMP_DIR = File.join(WYSIHAT_TEST_UNIT_DIR, 'tmp')
CLEAN.include 'test/unit/tmp'
CLOBBER.include 'dist'
CLOBBER.include 'doc'

desc "Update git submodules"
task :update_submodules do
system("git submodule init")
system("git submodule update")
WYSIHAT_ROOT = File.expand_path(File.dirname(__FILE__))
WYSIHAT_SRC_DIR = File.join(WYSIHAT_ROOT, 'src')


# Distribution

file 'dist/prototype.js' => :sprockets do |t|
prototype_src_dir = "#{WYSIHAT_ROOT}/vendor/prototype/src"

secretary = Sprockets::Secretary.new(
:root => prototype_src_dir,
:load_path => [prototype_src_dir],
:source_files => ["prototype.js"]
)

FileUtils.mkdir_p File.dirname(t.name)
secretary.concatenation.save_to(t.name)
end

file 'dist/wysihat.js' => Dir['src/**/*'] + [:sprockets] do |t|
secretary = Sprockets::Secretary.new(
:root => WYSIHAT_SRC_DIR,
:load_path => [WYSIHAT_SRC_DIR],
:source_files => ["wysihat.js"]
)

FileUtils.mkdir_p File.dirname(t.name)
secretary.concatenation.save_to(t.name)
end

task :default => :dist

desc "Builds the distribution."
task :dist => ["sprocketize:prototype", "sprocketize:wysihat"]
task :dist => ['dist/prototype.js', 'dist/wysihat.js']

task :watch do
ENV['WATCH'] = "1"
Rake::Task["sprocketize:wysihat"].invoke
end

namespace :sprocketize do
task :dist_dir do
FileUtils.mkdir_p(WYSIHAT_DIST_DIR)
end
# Documentation

task :wysihat => [:update_submodules, :dist_dir] do
require File.join(WYSIHAT_ROOT, "vendor", "sprockets", "lib", "sprockets")
require File.join(WYSIHAT_ROOT, "vendor", "sprockwatch", "lib", "sprockwatch")
desc "Builds the documentation."
file 'doc' => Dir['src/**/*'] + [:sprockets, :pdoc] do
require 'tempfile'

Tempfile.open('pdoc') do |temp|
secretary = Sprockets::Secretary.new(
:root => File.join(WYSIHAT_ROOT, "src"),
:root => WYSIHAT_SRC_DIR,
:load_path => [WYSIHAT_SRC_DIR],
:source_files => ["wysihat.js"]
:source_files => ["wysihat.js"],
:strip_comments => false
)

save = lambda {
secretary.concatenation.save_to(File.join(WYSIHAT_DIST_DIR, "wysihat.js"))
}

ENV['WATCH'] ? secretary.watch!(&save) : save.call
secretary.concatenation.save_to(temp.path)
PDoc::Runner.new(temp.path, :destination => "#{WYSIHAT_ROOT}/doc").run
end
end

task :prototype => [:update_submodules, :dist_dir] do
require File.join(WYSIHAT_ROOT, "vendor", "sprockets", "lib", "sprockets")

prototype_root = File.join(WYSIHAT_ROOT, "vendor", "prototype")
prototype_src_dir = File.join(prototype_root, 'src')
# Tests

secretary = Sprockets::Secretary.new(
:root => File.join(prototype_root, "src"),
:load_path => [prototype_src_dir],
:source_files => ["prototype.js"]
)
file 'test/unit/tmp/tests' => Dir['test/unit/*.js'] + [:unittest_js, :dist] do
FileUtils.mkdir_p File.dirname('test/unit/tmp/tests')

secretary.concatenation.save_to(File.join(WYSIHAT_DIST_DIR, "prototype.js"))
end
builder = UnittestJS::Builder::SuiteBuilder.new({
:input_dir => "#{WYSIHAT_ROOT}/test/unit",
:assets_dir => "#{WYSIHAT_ROOT}/dist"
})
builder.collect
builder.render
end

desc "Empties the output directory and builds the documentation."
task :doc => 'doc:build'

namespace :doc do
desc "Builds the documentation"
task :build => [:update_submodules, :clean] do
require File.join(WYSIHAT_ROOT, "vendor", "sprockets", "lib", "sprockets")
require File.join(WYSIHAT_ROOT, "vendor", "pdoc", "lib", "pdoc")
require 'tempfile'

Tempfile.open("pdoc") do |temp|
secretary = Sprockets::Secretary.new(
:root => File.join(WYSIHAT_ROOT, "src"),
:load_path => [WYSIHAT_SRC_DIR],
:source_files => ["wysihat.js"],
:strip_comments => false
)

secretary.concatenation.save_to(temp.path)
PDoc::Runner.new(temp.path,
:output => WYSIHAT_DOC_DIR,
:templates => WYSIHAT_WEBSITE_DIR
).run
end
end
desc "Builds the distribution, runs the JavaScript unit tests and collects their results."
task :test => 'test/unit/tmp/tests'

task :publish => :build do
Dir.chdir(WYSIHAT_DOC_DIR) do
system "git init"
system "git add ."
system "git commit -m \"import docs\""
system "git remote add origin [email protected]:josh/wysihat.git"
system "git checkout -b gh-pages"
system "git push -f origin gh-pages"
end
end

desc "Empties documentation directory"
task :clean do
rm_rf WYSIHAT_DOC_DIR
end
# Vendored libs

task :sprockets => 'vendor/sprockets/lib/sprockets.rb' do
$:.unshift File.expand_path('vendor/sprockets/lib', WYSIHAT_ROOT)
require 'sprockets'
end

desc "Builds the distribution, runs the JavaScript unit tests and collects their results."
task :test => ['test:build', 'test:run']

namespace :test do
task :run do
testcases = ENV['TESTCASES']
browsers_to_test = ENV['BROWSERS'] && ENV['BROWSERS'].split(',')
tests_to_run = ENV['TESTS'] && ENV['TESTS'].split(',')
runner = UnittestJS::WEBrickRunner::Runner.new(:test_dir => WYSIHAT_TMP_DIR)

Dir[File.join(WYSIHAT_TMP_DIR, '*_test.html')].each do |file|
file = File.basename(file)
test = file.sub('_test.html', '')
unless tests_to_run && !tests_to_run.include?(test)
runner.add_test(file, testcases)
end
end

UnittestJS::Browser::SUPPORTED.each do |browser|
unless browsers_to_test && !browsers_to_test.include?(browser)
runner.add_browser(browser.to_sym)
end
end

trap('INT') { runner.teardown; exit }
runner.run
end
task :pdoc => 'vendor/pdoc/lib/pdoc.rb' do
$:.unshift File.expand_path('vendor/pdoc/lib', WYSIHAT_ROOT)
require 'pdoc'
end

task :build => [:clean, :dist] do
require File.join(WYSIHAT_ROOT, "vendor", "unittest_js", "lib", "unittest_js")
builder = UnittestJS::Builder::SuiteBuilder.new({
:input_dir => WYSIHAT_TEST_UNIT_DIR,
:assets_dir => WYSIHAT_DIST_DIR
})
selected_tests = (ENV['TESTS'] || '').split(',')
builder.collect(*selected_tests)
builder.render
end
task :unittest_js => 'vendor/unittest_js/lib/unittest_js.rb' do
$:.unshift File.expand_path('vendor/unittest_js/lib', WYSIHAT_ROOT)
require 'unittest_js'
end

task :clean do
require File.join(WYSIHAT_ROOT, "vendor", "unittest_js", "lib", "unittest_js")
UnittestJS::Builder.empty_dir!(WYSIHAT_TMP_DIR)
end
file 'vendor/pdoc/lib/pdoc.rb' do
Rake::Task['update_submodules'].invoke
end

file 'vendor/sprockets/lib/sprockets.rb' do
Rake::Task['update_submodules'].invoke
end

file 'vendor/unittest_js/lib/unittest_js.rb' do
Rake::Task['update_submodules'].invoke
end

task :update_submodules do
system "git submodule init"
system "git submodule update"
end
33 changes: 6 additions & 27 deletions examples/custom_buttons.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
<title>WYSIWYG</title>

<style type="text/css" media="screen">
iframe {
width: 100%;
height: 150px;
border: 1px solid #999;
}

.editor_toolbar .button {
float: left;
margin: 2px 5px;
}

.editor_toolbar .selected {
color: red !important;
}

#error {
font: 18px helvetica, arial, sans-serif;
color: red;
}
</style>
<link rel="stylesheet" href="editor.css" type="text/css" />

<script type="text/javascript" src="../dist/prototype.js"></script>
<script type="text/javascript" src="../dist/wysihat.js"></script>

<script type="text/javascript" charset="utf-8">
Event.observe(window, 'load', function() {
document.on("dom:loaded", function() {
var editor = WysiHat.Editor.attach('content');
var toolbar = new WysiHat.Toolbar(editor);

Expand All @@ -57,7 +36,7 @@
<p>This examples shows how to add custom buttons and actions with the built-in toolbar class.</p>

<code><pre>
Event.observe(window, 'load', function() {
document.on("dom:loaded", function() {
var editor = WysiHat.Editor.attach('content');
var toolbar = new WysiHat.Toolbar(editor);

Expand Down Expand Up @@ -87,7 +66,7 @@
<a class="button underline" href="#"><span>Underline</span></a>
<a class="button em" href="#"><span>Emphasis</span></a>
</div>
<iframe id="content_editor" style="display: none;"> -->
<div id="content_editor" class="editor" contenteditable="true"></div> -->
<textarea id="content"></textarea>
</form>
</body>
Expand Down
Loading