alm
Version:
The best IDE for TypeScript
112 lines (111 loc) • 4.43 kB
JavaScript
;
/**
* Use this as a template for creating a new tab type
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/** imports */
var ui = require("../../ui");
var csx = require("../../base/csx");
var React = require("react");
var socketClient_1 = require("../../../socket/socketClient");
var styles = require("../../styles/styles");
var ReactDOM = require("react-dom");
var LiveDemoView = /** @class */ (function (_super) {
__extends(LiveDemoView, _super);
function LiveDemoView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.handleKey = function (e) {
var unicode = e.charCode;
if (String.fromCharCode(unicode).toLowerCase() === "r") {
_this.loadData();
}
};
_this.filter = function () {
// TODO:
};
_this.loadData = function () {
// TODO:
// server.getTopLevelModuleNames({}).then(res => {
// this.setState({files:res.files, selected: null});
// this.filter();
// })
};
/**
* TAB implementation
*/
_this.resize = function () {
// Not needed
};
_this.focus = function () {
ReactDOM.findDOMNode(_this).focus();
};
_this.save = function () {
};
_this.close = function () {
};
_this.gotoPosition = function (position) {
};
_this.search = {
doSearch: function (options) {
_this.setState({ filter: options.query });
},
hideSearch: function () {
_this.setState({ filter: '' });
},
findNext: function (options) {
},
findPrevious: function (options) {
},
replaceNext: function (_a) {
var newText = _a.newText;
},
replacePrevious: function (_a) {
var newText = _a.newText;
},
replaceAll: function (_a) {
var newText = _a.newText;
}
};
return _this;
}
LiveDemoView.prototype.componentDidMount = function () {
/**
* Initial load + load on project change
*/
this.loadData();
this.disposible.add(socketClient_1.cast.liveDemoData.on(function (data) {
// TODO: demo
}));
// Listen to tab events
var api = this.props.api;
this.disposible.add(api.resize.on(this.resize));
this.disposible.add(api.focus.on(this.focus));
this.disposible.add(api.save.on(this.save));
this.disposible.add(api.close.on(this.close));
this.disposible.add(api.gotoPosition.on(this.gotoPosition));
// Listen to search tab events
this.disposible.add(api.search.doSearch.on(this.search.doSearch));
this.disposible.add(api.search.hideSearch.on(this.search.hideSearch));
this.disposible.add(api.search.findNext.on(this.search.findNext));
this.disposible.add(api.search.findPrevious.on(this.search.findPrevious));
this.disposible.add(api.search.replaceNext.on(this.search.replaceNext));
this.disposible.add(api.search.replacePrevious.on(this.search.replacePrevious));
this.disposible.add(api.search.replaceAll.on(this.search.replaceAll));
};
LiveDemoView.prototype.render = function () {
return (React.createElement("div", { tabIndex: 0, style: csx.extend(csx.vertical, csx.flex, csx.newLayerParent, styles.someChildWillScroll, { color: styles.textColor }), onKeyPress: this.handleKey, onFocus: this.props.onFocused },
React.createElement("div", { style: { overflow: 'hidden', padding: '10px', display: 'flex' } })));
};
return LiveDemoView;
}(ui.BaseComponent));
exports.LiveDemoView = LiveDemoView;