add editor getSelectedText method
This commit is contained in:
parent
a44cbdc5c2
commit
3b5d742feb
2 changed files with 12 additions and 14 deletions
|
|
@ -739,25 +739,24 @@ var Editor = function(renderer, session) {
|
|||
this.renderer.updateFull();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the string of text currently highlighted.
|
||||
* @returns {String}
|
||||
**/
|
||||
this.getSelectedText = function() {
|
||||
return this.session.getTextRange(this.getSelectionRange());
|
||||
};
|
||||
|
||||
/**
|
||||
* Emitted when text is copied.
|
||||
* @event copy
|
||||
* @param {String} text The copied text
|
||||
*
|
||||
*
|
||||
**/
|
||||
/**
|
||||
*
|
||||
* Returns the string of text currently highlighted.
|
||||
* @returns {String}
|
||||
**/
|
||||
|
||||
this.getCopyText = function() {
|
||||
var text = "";
|
||||
if (!this.selection.isEmpty())
|
||||
text = this.session.getTextRange(this.getSelectionRange());
|
||||
|
||||
this._emit("copy", text);
|
||||
var text = this.getSelectedText();
|
||||
this._signal("copy", text);
|
||||
return text;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ var Editor = require("./editor").Editor;
|
|||
this.multiSelect.toSingleRange();
|
||||
};
|
||||
|
||||
this.getCopyText = function() {
|
||||
this.getSelectedText = function() {
|
||||
var text = "";
|
||||
if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
|
||||
var ranges = this.multiSelect.rangeList.ranges;
|
||||
|
|
@ -534,7 +534,6 @@ var Editor = require("./editor").Editor;
|
|||
} else if (!this.selection.isEmpty()) {
|
||||
text = this.session.getTextRange(this.getSelectionRange());
|
||||
}
|
||||
this._signal("copy", text);
|
||||
return text;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue