add commands
- remove to line start - remove word left - remove word right
This commit is contained in:
parent
e81e2bf2b7
commit
fb49960694
2 changed files with 45 additions and 0 deletions
|
|
@ -242,10 +242,22 @@ canon.addCommand({
|
||||||
name: "backspace",
|
name: "backspace",
|
||||||
exec: function(env, args, request) { env.editor.removeLeft(); }
|
exec: function(env, args, request) { env.editor.removeLeft(); }
|
||||||
});
|
});
|
||||||
|
canon.addCommand({
|
||||||
|
name: "removetolinestart",
|
||||||
|
exec: function(env, args, request) { env.editor.removeToLineStart(); }
|
||||||
|
});
|
||||||
canon.addCommand({
|
canon.addCommand({
|
||||||
name: "removetolineend",
|
name: "removetolineend",
|
||||||
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
|
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
|
||||||
});
|
});
|
||||||
|
canon.addCommand({
|
||||||
|
name: "removewordleft",
|
||||||
|
exec: function(env, args, request) { env.editor.removeWordLeft(); }
|
||||||
|
});
|
||||||
|
canon.addCommand({
|
||||||
|
name: "removewordright",
|
||||||
|
exec: function(env, args, request) { env.editor.removeWordRight(); }
|
||||||
|
});
|
||||||
canon.addCommand({
|
canon.addCommand({
|
||||||
name: "outdent",
|
name: "outdent",
|
||||||
exec: function(env, args, request) { env.editor.blockOutdent(); }
|
exec: function(env, args, request) { env.editor.blockOutdent(); }
|
||||||
|
|
|
||||||
|
|
@ -567,6 +567,39 @@ var Editor =function(renderer, session) {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.removeWordRight = function() {
|
||||||
|
if (this.$readOnly)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (this.selection.isEmpty())
|
||||||
|
this.selection.selectWordRight();
|
||||||
|
|
||||||
|
this.session.remove(this.getSelectionRange());
|
||||||
|
this.clearSelection();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.removeWordLeft = function() {
|
||||||
|
if (this.$readOnly)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (this.selection.isEmpty())
|
||||||
|
this.selection.selectWordLeft();
|
||||||
|
|
||||||
|
this.session.remove(this.getSelectionRange());
|
||||||
|
this.clearSelection();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.removeToLineStart = function() {
|
||||||
|
if (this.$readOnly)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (this.selection.isEmpty())
|
||||||
|
this.selection.selectLineStart();
|
||||||
|
|
||||||
|
this.session.remove(this.getSelectionRange());
|
||||||
|
this.clearSelection();
|
||||||
|
};
|
||||||
|
|
||||||
this.removeToLineEnd = function() {
|
this.removeToLineEnd = function() {
|
||||||
if (this.$readOnly)
|
if (this.$readOnly)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue