forked from bergie/hallo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7d50e00
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Hallo - contentEditable for jQuery UI | ||
===================================== | ||
|
||
Hallo is a very simple in-place rich text editor for web pages. It uses jQuery UI and the HTML5 contentEditable functionality to edit web content. | ||
|
||
The widget has been written as a simple and liberally licensed alternative to more popular editors like Aloha. | ||
|
||
## Licensing | ||
|
||
Hallo is free software available under the [MIT license](http://en.wikipedia.org/wiki/MIT_License). | ||
|
||
## Contributing | ||
|
||
Hallo is written in [CoffeeScript](http://jashkenas.github.com/coffee-script/), a simple language that compiles into JavaScript. To generate the JavaScript code from Hallo sources, run: | ||
|
||
$ coffee -c -o examples hallo.coffee | ||
|
||
Hallo development is coordinated using Git. Just fork the Hallo repository on GitHub and [send pull requests](http://help.github.com/pull-requests/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(function() { | ||
(function(jQuery) { | ||
return jQuery.widget("IKS.hallo", { | ||
options: { | ||
editable: true | ||
}, | ||
_create: function() {}, | ||
_init: function() { | ||
return this.element.attr("contentEditable", this.options.editable); | ||
} | ||
}); | ||
})(jQuery); | ||
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<html> | ||
<head> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script> | ||
<script src="hallo.js"></script> | ||
<title>Hallo example</title> | ||
</head> | ||
<body> | ||
<h1 class="editable">Foo bar</h1> | ||
<div class="editable"> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. | ||
</p> | ||
<p> | ||
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. | ||
</p> | ||
</div> | ||
<button id="enable">Enable</button> | ||
<button id="disable">Disable</button> | ||
<script> | ||
jQuery('#enable').click(function() { | ||
jQuery('.editable').hallo(); | ||
}); | ||
jQuery('#disable').click(function() { | ||
jQuery('.editable').hallo({editable: false}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Hallo - a rich text editing jQuery UI widget | ||
# (c) 2011 Henri Bergius, IKS Consortium | ||
# Hallo may be freely distributed under the MIT license | ||
((jQuery) -> | ||
# Hallo provides a jQuery UI widget `hallo`. Usage: | ||
# | ||
# jQuery('p').hallo(); | ||
# | ||
# Getting out of the editing state: | ||
# | ||
# jQuery('p').hallo({editable: false}); | ||
jQuery.widget "IKS.hallo", | ||
options: | ||
editable: true | ||
|
||
# Called once for each element | ||
_create: -> | ||
|
||
# Called per each invokation | ||
_init: -> | ||
@element.attr "contentEditable", @options.editable | ||
)(jQuery) |