Skip to content

Commit

Permalink
resize hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
gojko committed Feb 3, 2014
1 parent 8e21210 commit 648e6ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ <h2>About</h2>
<li>Does not force any styling (so you can style it any way you want, using normal CSS)</li>
<li>Works well with Bootstrap</li>
<li>Depends only on jQuery</li>
<li>Works well in Chrome - we're busy porting it to other browsers; check back in a few days</li>
</ul>
<li>Tested in Chrome 32, Firefox 26, IE 10, Safari 7, Android Chrome and iOS 7 Safari</li>
</ul>


<h2>Usage</h2>
Expand Down
20 changes: 13 additions & 7 deletions mindmup-editabletable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global $*/
/*global $, window*/
$.fn.editableTableWidget = function (options) {
'use strict';
return $(this).each(function () {
Expand Down Expand Up @@ -47,7 +47,7 @@ $.fn.editableTableWidget = function (options) {
return element.parent().next().children().eq(element.index());
}
return [];
}
};
editor.blur(function () {
setActiveText();
editor.hide();
Expand Down Expand Up @@ -104,15 +104,21 @@ $.fn.editableTableWidget = function (options) {
e.preventDefault();
}
})
.on('click keypress dblclick',function(e) {
showEditor(true);
})
.on('click keypress dblclick', showEditor)
.css('cursor', 'pointer');
$(window).on('resize', function () {
if (editor.is(':visible')) {
editor.offset(active.offset())
.width(active.width())
.height(active.height());
}
});
});

};
$.fn.editableTableWidget.defaultOptions = {
cloneProperties: ['padding','padding-top', 'padding-bottom', 'padding-left', 'padding-right',
cloneProperties: ['padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right',
'text-align', 'font', 'font-size', 'font-family', 'font-weight',
'border', 'border-top','border-bottom', 'border-left', 'border-right'],
'border', 'border-top', 'border-bottom', 'border-left', 'border-right'],
editor: $('<input>')
};

0 comments on commit 648e6ff

Please sign in to comment.