summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
032212c)
(cherry picked from commit
31f486a)
};
// todo: whileRemoveWholetext
var keyEventHandlers = [
};
// todo: whileRemoveWholetext
var keyEventHandlers = [
+ { // ctrl+x - prevented (?)
applies: function(e, s) {
return e.ctrlKey &&
e.key === KEYS.X &&
applies: function(e, s) {
return e.ctrlKey &&
e.key === KEYS.X &&
+ { // backspace removing the last character in a span
applies: function(e, s) {
return s.type === 'caret' &&
s.element.wlxmlNode.parent().is({tagName: 'span'}) &&
applies: function(e, s) {
return s.type === 'caret' &&
s.element.wlxmlNode.parent().is({tagName: 'span'}) &&
{caretTo: params.ret ? params.ret.previousLen : (prevTextNode ? prevTextNode.getText().length : 0)});
}
},
{caretTo: params.ret ? params.ret.previousLen : (prevTextNode ? prevTextNode.getText().length : 0)});
}
},
+ { // backspace/delete through an edge (behaves weirdly at spans)
applies: function(e, s) {
return s.type === 'caret' && (
(s.isAtBeginning() && e.key === KEYS.BACKSPACE) ||
applies: function(e, s) {
return s.type === 'caret' && (
(s.isAtBeginning() && e.key === KEYS.BACKSPACE) ||
if(e.key === KEYS.BACKSPACE) {
direction = 'above';
caretTo = 'end';
if(e.key === KEYS.BACKSPACE) {
direction = 'above';
caretTo = 'end';
- cursorAtOperationEdge = s.isAtBeginning();
+ cursorAtOperationEdge = s.isAtBeginning(); // always true?
element = s.element;
}
else {
direction = 'below';
caretTo = 'start';
element = s.element;
}
else {
direction = 'below';
caretTo = 'start';
- cursorAtOperationEdge = s.isAtEnd();
+ cursorAtOperationEdge = s.isAtEnd(); // always true?
element = cursorAtOperationEdge && s.canvas.getNearestTextElement(direction, s.element);
}
element = cursorAtOperationEdge && s.canvas.getNearestTextElement(direction, s.element);
}
+ { // backspace/delete last character in a node - why is it needed?
applies: function(e,s) {
return s.type === 'caret' && s.element.getText().length === 1 && (e.key === KEYS.BACKSPACE || e.key === KEYS.DELETE);
},
applies: function(e,s) {
return s.type === 'caret' && s.element.getText().length === 1 && (e.key === KEYS.BACKSPACE || e.key === KEYS.DELETE);
},
+ { // enter on an empty list item - creates paragraph after list
applies: function(e, s) {
var parent = s.element && s.element.wlxmlNode.parent(),
parentIsItem = parent && parent.is('item'),
applies: function(e, s) {
var parent = s.element && s.element.wlxmlNode.parent(),
parentIsItem = parent && parent.is('item'),
+ { // enter - split node
applies: function(e, s) {
return s.type === 'caret' && e.key === KEYS.ENTER && !s.element.parent().isRootElement();
},
applies: function(e, s) {
return s.type === 'caret' && e.key === KEYS.ENTER && !s.element.parent().isRootElement();
},
s.canvas.setCurrentElement(utils.getElementForNode(goto), gotoOptions);
}
},
s.canvas.setCurrentElement(utils.getElementForNode(goto), gotoOptions);
}
},
+ { // enter - new paragraph after image/video
applies: function (e, s) {
return s.type === 'nodeSelection' && e.key === KEYS.ENTER && !s.element.isRootElement();
},
applies: function (e, s) {
return s.type === 'nodeSelection' && e.key === KEYS.ENTER && !s.element.isRootElement();
},