kopia lustrzana https://github.com/c9/core
convert paste into command
rodzic
68a6a14d90
commit
a7033da975
|
@ -423,6 +423,12 @@ exports.commands = [{
|
||||||
exec: function() {},
|
exec: function() {},
|
||||||
passEvent: true,
|
passEvent: true,
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
}, {
|
||||||
|
name: "copy",
|
||||||
|
exec: function(editor) {
|
||||||
|
// placeholder for replay macro
|
||||||
|
},
|
||||||
|
readOnly: true
|
||||||
},
|
},
|
||||||
|
|
||||||
// commands disabled in readOnly mode
|
// commands disabled in readOnly mode
|
||||||
|
@ -439,6 +445,12 @@ exports.commands = [{
|
||||||
},
|
},
|
||||||
scrollIntoView: "cursor",
|
scrollIntoView: "cursor",
|
||||||
multiSelectAction: "forEach"
|
multiSelectAction: "forEach"
|
||||||
|
}, {
|
||||||
|
name: "paste",
|
||||||
|
exec: function(editor, text) {
|
||||||
|
editor.$handlePaste(text);
|
||||||
|
},
|
||||||
|
scrollIntoView: "cursor"
|
||||||
}, {
|
}, {
|
||||||
name: "removeline",
|
name: "removeline",
|
||||||
bindKey: bindKey("Ctrl-D", "Command-D"),
|
bindKey: bindKey("Ctrl-D", "Command-D"),
|
||||||
|
|
|
@ -903,10 +903,10 @@ var Editor = function(renderer, session) {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.onPaste = function(text) {
|
this.onPaste = function(text) {
|
||||||
// todo this should change when paste becomes a command
|
this.commands.exec("paste", this, text);
|
||||||
if (this.$readOnly)
|
};
|
||||||
return;
|
|
||||||
|
this.$handlePaste = function(text) {
|
||||||
var e = {text: text};
|
var e = {text: text};
|
||||||
this._signal("paste", e);
|
this._signal("paste", e);
|
||||||
text = e.text;
|
text = e.text;
|
||||||
|
@ -927,7 +927,6 @@ var Editor = function(renderer, session) {
|
||||||
this.session.insert(range.start, lines[i]);
|
this.session.insert(range.start, lines[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.renderer.scrollCursorIntoView();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.execCommand = function(command, args) {
|
this.execCommand = function(command, args) {
|
||||||
|
|
Ładowanie…
Reference in New Issue