Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed May 5, 2011
0 parents commit 7d50e00
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
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/).
13 changes: 13 additions & 0 deletions examples/hallo.js
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);
29 changes: 29 additions & 0 deletions examples/test.html
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>
22 changes: 22 additions & 0 deletions hallo.coffee
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)

0 comments on commit 7d50e00

Please sign in to comment.