summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e51396f)
- Canvas.rootWrapper is no longer a contenteditable so key events
need to be listened to on the document body in case there is no
caret on a canvas (e.g. when selection is made).
- During selection, even inside a single text element, contenteditable
is not used, meaning that during even for such a selection
we need to handle delete/backspace ourselves.
setupEventHandling: function() {
var canvas = this;
setupEventHandling: function() {
var canvas = this;
- this.rootWrapper.on('keyup keydown keypress', function(e) {
- keyboard.handleKey(e, canvas);
+ /* globals document */
+ $(document.body).on('keydown', function(e) {
+ var cursor = canvas.getCursor();
+ if(cursor.isSelecting() || Object.keys(cursor.getPosition()).length) {
+ keyboard.handleKey(e, canvas);
+ }
});
this.rootWrapper.on('mouseup', function() {
});
this.rootWrapper.on('mouseup', function() {
- if(cursor.isSelecting() && !cursor.isSelectingWithinElement()) {
+ if(cursor.isSelecting()) {
event.preventDefault();
var start = cursor.getSelectionStart(),
end = cursor.getSelectionEnd();
event.preventDefault();
var start = cursor.getSelectionStart(),
end = cursor.getSelectionEnd();