Skip to content

Commit

Permalink
Implement remove all widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsanjose committed Jul 16, 2012
1 parent b46d27e commit 8fea909
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ define(function (require, exports, module) {
CodeMirror.commands.delCharRight(instance);
}
},
"Esc": function (instance) {
self.removeAllInlineWidgets();
},
"Shift-Delete": "cut",
"Ctrl-Insert": "copy",
"Shift-Insert": "paste"
Expand Down Expand Up @@ -837,6 +840,18 @@ define(function (require, exports, module) {
this._fireWidgetOffsetTopChanged(pos.line);
};

/**
* Removes all inline widgets
*/
Editor.prototype.removeAllInlineWidgets = function () {
// copy the array because _removeInlineWidgetInternal will modifying the original
var widgets = [].concat(this.getInlineWidgets());

widgets.forEach(function (widget) {
this.removeInlineWidget(widget);
}, this);
};

/**
* Removes the given inline widget.
* @param {number} inlineWidget The widget to remove.
Expand Down

0 comments on commit 8fea909

Please sign in to comment.