Skip to content

Commit 8670e13

Browse files
committed
Release v0.2.0
1 parent 3273f31 commit 8670e13

File tree

6 files changed

+60
-42
lines changed

6 files changed

+60
-42
lines changed

Changelog.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
# v0.2.0 (2013-31-03)
2+
3+
#### Breaking Changes:
4+
5+
- API change: create instances of EditableJS [65](https://github.com/upfrontIO/Editable.JS/pull/65)
6+
17

28
# v0.1.2 (2014-03-07)
39

410
- [Add selection methods](https://github.com/upfrontIO/Editable.JS/pull/64)
5-
- New Selection methods:
6-
#collapseAtBeginning()
11+
- New Selection methods:
12+
#collapseAtBeginning()
713
#collapseAtEnd()
8-
- New Cursor and Selection method:
14+
- New Cursor and Selection method:
915
#setVisibleSelection() (alias for #setSelection())
1016

1117
# v0.1.1 (2014-01-24)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "EditableJS",
3-
"version": "0.1.2",
3+
"version": "0.2.0",
44
"homepage": "https://github.com/upfrontIO/Editable.JS",
55
"authors": [
66
"Matteo Agosti<[email protected]>",

editable.js

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,7 +3634,7 @@ var string = (function() {
36343634
})();
36353635

36363636
/**
3637-
* The Core module provides the Editable singleton that defines the Editable.JS
3637+
* The Core module provides the Editable class that defines the Editable.JS
36383638
* API and is the main entry point for Editable.JS.
36393639
* It also provides the cursor module for cross-browser cursors, and the dom
36403640
* submodule.
@@ -3643,13 +3643,12 @@ var string = (function() {
36433643
*/
36443644

36453645
/**
3646-
* Singleton for the Editable.JS API that is externally visible.
3646+
* Constructor for the Editable.JS API that is externally visible.
36473647
* Note that the Editable literal is defined
36483648
* first in editable.prefix in order for it to be the only externally visible
36493649
* variable.
36503650
*
36513651
* @class Editable
3652-
* @static
36533652
*/
36543653
Editable = function(userConfig) {
36553654
this.config = $.extend(true, {}, config, userConfig);
@@ -3678,7 +3677,6 @@ window.Editable = Editable;
36783677
* array of HTMLElement or a query selector representing the target where
36793678
* the API should be added on.
36803679
* @param {Object} [elementConfiguration={}] Configuration options override.
3681-
* @static
36823680
* @chainable
36833681
*/
36843682
Editable.prototype.add = function(target, elementConfiguration) {
@@ -3699,7 +3697,6 @@ Editable.prototype.add = function(target, elementConfiguration) {
36993697
* @param {HTMLElement|Array(HTMLElement)|String} target A HTMLElement, an
37003698
* array of HTMLElement or a query selector representing the target where
37013699
* the API should be removed from.
3702-
* @static
37033700
* @chainable
37043701
*/
37053702
Editable.prototype.remove = function(target) {
@@ -3717,11 +3714,11 @@ Editable.prototype.remove = function(target) {
37173714
* @method disable
37183715
* @param { jQuery element | undefined } target editable root element(s)
37193716
* If no param is specified all editables are disabled.
3720-
* @static
37213717
* @chainable
37223718
*/
37233719
Editable.prototype.disable = function($elem) {
3724-
$elem = $elem || $('.' + config.editableClass);
3720+
var body = this.win.document.body;
3721+
$elem = $elem || $('.' + config.editableClass, body);
37253722
$elem
37263723
.removeAttr('contenteditable')
37273724
.removeClass(config.editableClass)
@@ -3731,27 +3728,58 @@ Editable.prototype.disable = function($elem) {
37313728
};
37323729

37333730

3731+
37343732
/**
37353733
* Adds the Editable.JS API to the given target elements.
37363734
*
37373735
* @method enable
37383736
* @param { jQuery element | undefined } target editable root element(s)
37393737
* If no param is specified all editables marked as disabled are enabled.
3740-
* @static
37413738
* @chainable
37423739
*/
3743-
Editable.prototype.enable = function($elem) {
3744-
$elem = $elem || $('.' + config.editableDisabledClass);
3740+
Editable.prototype.enable = function($elem, normalize) {
3741+
var body = this.win.document.body;
3742+
$elem = $elem || $('.' + config.editableDisabledClass, body);
37453743
$elem
37463744
.attr('contenteditable', true)
37473745
.removeClass(config.editableDisabledClass)
37483746
.addClass(config.editableClass);
37493747

3750-
$elem.each(function(index, el) {
3751-
content.normalizeTags(el);
3752-
content.normalizeSpaces(el);
3753-
});
3748+
if (normalize) {
3749+
$elem.each(function(index, el) {
3750+
content.normalizeTags(el);
3751+
content.normalizeSpaces(el);
3752+
});
3753+
}
3754+
3755+
return this;
3756+
};
3757+
3758+
/**
3759+
* Temporarily disable an editable.
3760+
* Can be used to prevent text selction while dragging an element
3761+
* for example.
3762+
*
3763+
* @method suspend
3764+
* @param jQuery object
3765+
*/
3766+
Editable.prototype.suspend = function($elem) {
3767+
var body = this.win.document.body;
3768+
$elem = $elem || $('.' + config.editableClass, body);
3769+
$elem.removeAttr('contenteditable');
3770+
return this;
3771+
};
37543772

3773+
/**
3774+
* Reverse the effects of suspend()
3775+
*
3776+
* @method continue
3777+
* @param jQuery object
3778+
*/
3779+
Editable.prototype.continue = function($elem) {
3780+
var body = this.win.document.body;
3781+
$elem = $elem || $('.' + config.editableClass, body);
3782+
$elem.attr('contenteditable', true);
37553783
return this;
37563784
};
37573785

@@ -3760,7 +3788,6 @@ Editable.prototype.enable = function($elem) {
37603788
*
37613789
* @method createCursor
37623790
* @param position 'beginning', 'end', 'before', 'after'
3763-
* @static
37643791
*/
37653792
Editable.prototype.createCursor = function(element, position) {
37663793
var cursor;
@@ -3857,7 +3884,6 @@ Editable.prototype.unload = function() {
38573884
* @method focus
38583885
* @param {Function} handler The callback to execute in response to the
38593886
* event.
3860-
* @static
38613887
* @chainable
38623888
*/
38633889
Editable.prototype.focus = function(handler) {
@@ -3871,7 +3897,6 @@ Editable.prototype.focus = function(handler) {
38713897
* @method blur
38723898
* @param {Function} handler The callback to execute in response to the
38733899
* event.
3874-
* @static
38753900
* @chainable
38763901
*/
38773902
Editable.prototype.blur = function(handler) {
@@ -3885,7 +3910,6 @@ Editable.prototype.blur = function(handler) {
38853910
* @method flow
38863911
* @param {Function} handler The callback to execute in response to the
38873912
* event.
3888-
* @static
38893913
* @chainable
38903914
*/
38913915
Editable.prototype.flow = function(handler) {
@@ -3899,7 +3923,6 @@ Editable.prototype.flow = function(handler) {
38993923
* @method selection
39003924
* @param {Function} handler The callback to execute in response to the
39013925
* event.
3902-
* @static
39033926
* @chainable
39043927
*/
39053928
Editable.prototype.selection = function(handler) {
@@ -3913,7 +3936,6 @@ Editable.prototype.selection = function(handler) {
39133936
* @method cursor
39143937
* @param {Function} handler The callback to execute in response to the
39153938
* event.
3916-
* @static
39173939
* @chainable
39183940
*/
39193941
Editable.prototype.cursor = function(handler) {
@@ -3927,7 +3949,6 @@ Editable.prototype.cursor = function(handler) {
39273949
* @method newline
39283950
* @param {Function} handler The callback to execute in response to the
39293951
* event.
3930-
* @static
39313952
* @chainable
39323953
*/
39333954
Editable.prototype.newline = function(handler) {
@@ -3941,7 +3962,6 @@ Editable.prototype.newline = function(handler) {
39413962
* @method insert
39423963
* @param {Function} handler The callback to execute in response to the
39433964
* event.
3944-
* @static
39453965
* @chainable
39463966
*/
39473967
Editable.prototype.insert = function(handler) {
@@ -3955,7 +3975,6 @@ Editable.prototype.insert = function(handler) {
39553975
* @method split
39563976
* @param {Function} handler The callback to execute in response to the
39573977
* event.
3958-
* @static
39593978
* @chainable
39603979
*/
39613980
Editable.prototype.split = function(handler) {
@@ -3969,7 +3988,6 @@ Editable.prototype.split = function(handler) {
39693988
* @method merge
39703989
* @param {Function} handler The callback to execute in response to the
39713990
* event.
3972-
* @static
39733991
* @chainable
39743992
*/
39753993
Editable.prototype.merge = function(handler) {
@@ -3983,7 +4001,6 @@ Editable.prototype.merge = function(handler) {
39834001
* @method empty
39844002
* @param {Function} handler The callback to execute in response to the
39854003
* event.
3986-
* @static
39874004
* @chainable
39884005
*/
39894006
Editable.prototype.empty = function(handler) {
@@ -3997,7 +4014,6 @@ Editable.prototype.empty = function(handler) {
39974014
* @method switch
39984015
* @param {Function} handler The callback to execute in response to the
39994016
* event.
4000-
* @static
40014017
* @chainable
40024018
*/
40034019
Editable.prototype['switch'] = function(handler) {
@@ -4011,7 +4027,6 @@ Editable.prototype['switch'] = function(handler) {
40114027
* @method move
40124028
* @param {Function} handler The callback to execute in response to the
40134029
* event.
4014-
* @static
40154030
* @chainable
40164031
*/
40174032
Editable.prototype.move = function(handler) {
@@ -4025,7 +4040,6 @@ Editable.prototype.move = function(handler) {
40254040
* @method clipboard
40264041
* @param {Function} handler The callback to execute in response to the
40274042
* event.
4028-
* @static
40294043
* @chainable
40304044
*/
40314045
Editable.prototype.clipboard = function(handler) {
@@ -4627,10 +4641,9 @@ var createDefaultBehavior = function(editable) {
46274641
var selectionWatcher = editable.dispatcher.selectionWatcher;
46284642

46294643
/**
4630-
* Singleton for the behavior module.
4644+
* Factory for the default behavior.
46314645
* Provides default behavior of the Editable.JS API.
46324646
*
4633-
* @class Behavior
46344647
* @static
46354648
*/
46364649
return {
@@ -5490,7 +5503,6 @@ Keyboard.key = Keyboard.prototype.key;
54905503
var parser = (function() {
54915504
/**
54925505
* Singleton that provides DOM lookup helpers.
5493-
* @class Parser
54945506
* @static
54955507
*/
54965508
return {

editable.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "EditableJS",
3-
"version": "0.1.2",
3+
"version": "0.2.0",
44
"repository": {
55
"type": "git",
66
"url": "git://github.com/upfrontIO/Editable.JS.git"

src/core.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* The Core module provides the Editable singleton that defines the Editable.JS
2+
* The Core module provides the Editable class that defines the Editable.JS
33
* API and is the main entry point for Editable.JS.
44
* It also provides the cursor module for cross-browser cursors, and the dom
55
* submodule.
@@ -8,7 +8,7 @@
88
*/
99

1010
/**
11-
* Singleton for the Editable.JS API that is externally visible.
11+
* Constructor for the Editable.JS API that is externally visible.
1212
* Note that the Editable literal is defined
1313
* first in editable.prefix in order for it to be the only externally visible
1414
* variable.
@@ -144,7 +144,7 @@ Editable.prototype.suspend = function($elem) {
144144
Editable.prototype.continue = function($elem) {
145145
var body = this.win.document.body;
146146
$elem = $elem || $('.' + config.editableClass, body);
147-
$elem.attr('contenteditable', true)
147+
$elem.attr('contenteditable', true);
148148
return this;
149149
};
150150

0 commit comments

Comments
 (0)