]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/atom-space-pen-views/lib/text-editor-view.js
8aecdaf627be0520620dc31cc0db3056c1406496
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
; };
6 _ref
= require('space-pen'), View
= _ref
.View
, $ = _ref
.$;
8 module
.exports
= TextEditorView
= (function(_super
) {
9 __extends(TextEditorView
, _super
);
11 function TextEditorView(params
) {
12 var attributes
, editor
, mini
, name
, placeholderText
, value
;
16 mini
= params
.mini
, placeholderText
= params
.placeholderText
, attributes
= params
.attributes
, editor
= params
.editor
;
17 if (attributes
== null) {
21 attributes
['mini'] = mini
;
23 if (placeholderText
!= null) {
24 attributes
['placeholder-text'] = placeholderText
;
27 this.element
= atom
.views
.getView(editor
);
29 this.element
= document
.createElement('atom-text-editor');
31 for (name
in attributes
) {
32 value
= attributes
[name
];
33 this.element
.setAttribute(name
, value
);
35 if (this.element
.__spacePenView
!= null) {
36 this.element
.__spacePenView
= this;
37 this.element
.__allowViewAccess
= true;
39 TextEditorView
.__super__
.constructor.apply(this, arguments
);
40 this.setModel(this.element
.getModel());
43 TextEditorView
.prototype.setModel = function(model
) {
47 TextEditorView
.prototype.getModel = function() {
51 TextEditorView
.prototype.getText = function() {
52 return this.model
.getText();
55 TextEditorView
.prototype.setText = function(text
) {
56 return this.model
.setText(text
);
59 TextEditorView
.prototype.hasFocus = function() {
60 return this.element
.hasFocus();
63 return TextEditorView
;