]> git.r.bdr.sh - rbdr/dotfiles/blame - atom/packages/ex-mode/node_modules/atom-space-pen-views/lib/text-editor-view.js
Merge remote-tracking branch 'origin/master'
[rbdr/dotfiles] / atom / packages / ex-mode / node_modules / atom-space-pen-views / lib / text-editor-view.js
CommitLineData
24c7594d
BB
1(function() {
2 var $, TextEditorView, View, _ref,
3 __hasProp = {}.hasOwnProperty,
4 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
5
6 _ref = require('space-pen'), View = _ref.View, $ = _ref.$;
7
8 module.exports = TextEditorView = (function(_super) {
9 __extends(TextEditorView, _super);
10
11 function TextEditorView(params) {
455f099b 12 var attributes, editor, mini, name, placeholderText, value;
24c7594d
BB
13 if (params == null) {
14 params = {};
15 }
455f099b 16 mini = params.mini, placeholderText = params.placeholderText, attributes = params.attributes, editor = params.editor;
24c7594d
BB
17 if (attributes == null) {
18 attributes = {};
19 }
20 if (mini != null) {
21 attributes['mini'] = mini;
22 }
23 if (placeholderText != null) {
24 attributes['placeholder-text'] = placeholderText;
25 }
455f099b
BB
26 if (editor != null) {
27 this.element = atom.views.getView(editor);
28 } else {
29 this.element = document.createElement('atom-text-editor');
30 }
24c7594d
BB
31 for (name in attributes) {
32 value = attributes[name];
33 this.element.setAttribute(name, value);
34 }
35 if (this.element.__spacePenView != null) {
36 this.element.__spacePenView = this;
37 this.element.__allowViewAccess = true;
38 }
39 TextEditorView.__super__.constructor.apply(this, arguments);
40 this.setModel(this.element.getModel());
41 }
42
43 TextEditorView.prototype.setModel = function(model) {
44 this.model = model;
45 };
46
47 TextEditorView.prototype.getModel = function() {
48 return this.model;
49 };
50
51 TextEditorView.prototype.getText = function() {
52 return this.model.getText();
53 };
54
55 TextEditorView.prototype.setText = function(text) {
56 return this.model.setText(text);
57 };
58
59 TextEditorView.prototype.hasFocus = function() {
60 return this.element.hasFocus();
61 };
62
63 return TextEditorView;
64
65 })(View);
66
67}).call(this);