]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/atom-space-pen-views/lib/text-editor-view.js
e957a2bf041230fd6a7f9ee7efb253972a438d88
[rbdr/dotfiles] / atom / packages / ex-mode / node_modules / atom-space-pen-views / lib / text-editor-view.js
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) {
12 var attributes, mini, name, placeholderText, value;
13 if (params == null) {
14 params = {};
15 }
16 mini = params.mini, placeholderText = params.placeholderText, attributes = params.attributes;
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 }
26 this.element = document.createElement('atom-text-editor');
27 for (name in attributes) {
28 value = attributes[name];
29 this.element.setAttribute(name, value);
30 }
31 if (this.element.__spacePenView != null) {
32 this.element.__spacePenView = this;
33 this.element.__allowViewAccess = true;
34 }
35 TextEditorView.__super__.constructor.apply(this, arguments);
36 this.setModel(this.element.getModel());
37 }
38
39 TextEditorView.prototype.setModel = function(model) {
40 this.model = model;
41 };
42
43 TextEditorView.prototype.getModel = function() {
44 return this.model;
45 };
46
47 TextEditorView.prototype.getText = function() {
48 return this.model.getText();
49 };
50
51 TextEditorView.prototype.setText = function(text) {
52 return this.model.setText(text);
53 };
54
55 TextEditorView.prototype.hasFocus = function() {
56 return this.element.hasFocus();
57 };
58
59 return TextEditorView;
60
61 })(View);
62
63 }).call(this);