2018-02-07 18:06:07 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
2016-06-23 22:29:55 +00:00
|
|
|
import CodeMirror from 'codemirror';
|
2016-09-07 19:05:25 +00:00
|
|
|
import beautifyJS from 'js-beautify';
|
2016-07-13 23:52:50 +00:00
|
|
|
import 'codemirror/mode/css/css';
|
2016-06-23 22:29:55 +00:00
|
|
|
import 'codemirror/addon/selection/active-line';
|
2016-07-12 21:38:24 +00:00
|
|
|
import 'codemirror/addon/lint/lint';
|
|
|
|
import 'codemirror/addon/lint/javascript-lint';
|
2016-07-13 23:52:50 +00:00
|
|
|
import 'codemirror/addon/lint/css-lint';
|
|
|
|
import 'codemirror/addon/lint/html-lint';
|
2017-07-17 20:07:59 +00:00
|
|
|
import 'codemirror/addon/fold/brace-fold';
|
|
|
|
import 'codemirror/addon/fold/comment-fold';
|
|
|
|
import 'codemirror/addon/fold/foldcode';
|
|
|
|
import 'codemirror/addon/fold/foldgutter';
|
|
|
|
import 'codemirror/addon/fold/indent-fold';
|
2016-07-21 18:33:23 +00:00
|
|
|
import 'codemirror/addon/comment/comment';
|
|
|
|
import 'codemirror/keymap/sublime';
|
2017-06-06 19:20:21 +00:00
|
|
|
import 'codemirror/addon/search/searchcursor';
|
|
|
|
import 'codemirror/addon/search/matchesonscrollbar';
|
|
|
|
import 'codemirror/addon/search/match-highlighter';
|
2016-08-05 20:58:59 +00:00
|
|
|
import 'codemirror/addon/search/jump-to-line';
|
2017-06-06 19:20:21 +00:00
|
|
|
|
2016-07-12 21:38:24 +00:00
|
|
|
import { JSHINT } from 'jshint';
|
2016-07-13 23:52:50 +00:00
|
|
|
import { CSSLint } from 'csslint';
|
|
|
|
import { HTMLHint } from 'htmlhint';
|
2016-09-07 20:33:01 +00:00
|
|
|
import InlineSVG from 'react-inlinesvg';
|
|
|
|
import classNames from 'classnames';
|
2016-10-19 17:29:02 +00:00
|
|
|
import { debounce } from 'lodash';
|
2017-02-22 19:29:35 +00:00
|
|
|
import '../../../utils/htmlmixed';
|
|
|
|
import '../../../utils/p5-javascript';
|
2016-11-09 17:52:14 +00:00
|
|
|
import Timer from '../components/Timer';
|
2017-02-22 19:29:35 +00:00
|
|
|
import EditorAccessibility from '../components/EditorAccessibility';
|
2017-06-06 19:20:21 +00:00
|
|
|
import {
|
|
|
|
metaKey,
|
|
|
|
} from '../../../utils/metaKey';
|
|
|
|
|
|
|
|
import search from '../../../utils/codemirror-search';
|
|
|
|
|
|
|
|
search(CodeMirror);
|
2017-02-22 19:29:35 +00:00
|
|
|
|
|
|
|
const beautifyCSS = beautifyJS.css;
|
|
|
|
const beautifyHTML = beautifyJS.html;
|
|
|
|
|
|
|
|
window.JSHINT = JSHINT;
|
|
|
|
window.CSSLint = CSSLint;
|
|
|
|
window.HTMLHint = HTMLHint;
|
2016-06-23 22:29:55 +00:00
|
|
|
|
2017-02-22 19:29:35 +00:00
|
|
|
const beepUrl = require('../../../sounds/audioAlert.mp3');
|
|
|
|
const unsavedChangesDotUrl = require('../../../images/unsaved-changes-dot.svg');
|
2016-12-19 22:07:04 +00:00
|
|
|
const rightArrowUrl = require('../../../images/right-arrow.svg');
|
|
|
|
const leftArrowUrl = require('../../../images/left-arrow.svg');
|
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
class Editor extends React.Component {
|
2016-09-07 20:41:56 +00:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.tidyCode = this.tidyCode.bind(this);
|
2017-07-26 19:17:05 +00:00
|
|
|
|
|
|
|
this.updateLintingMessageAccessibility = debounce((annotations) => {
|
|
|
|
this.props.clearLintMessage();
|
|
|
|
annotations.forEach((x) => {
|
|
|
|
if (x.from.line > -1) {
|
|
|
|
this.props.updateLintMessage(x.severity, (x.from.line + 1), x.message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (this.props.lintMessages.length > 0 && this.props.lintWarning) {
|
|
|
|
this.beep.play();
|
|
|
|
}
|
|
|
|
}, 2000);
|
2017-09-01 16:40:15 +00:00
|
|
|
this.showFind = this.showFind.bind(this);
|
2017-09-14 20:58:59 +00:00
|
|
|
this.findNext = this.findNext.bind(this);
|
|
|
|
this.findPrev = this.findPrev.bind(this);
|
2016-09-07 20:41:56 +00:00
|
|
|
}
|
2017-10-12 19:38:02 +00:00
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
componentDidMount() {
|
2016-08-15 15:51:11 +00:00
|
|
|
this.beep = new Audio(beepUrl);
|
2016-09-12 05:31:30 +00:00
|
|
|
this.widgets = [];
|
2017-02-22 19:29:35 +00:00
|
|
|
this._cm = CodeMirror(this.codemirrorContainer, { // eslint-disable-line
|
2016-09-20 15:51:09 +00:00
|
|
|
theme: `p5-${this.props.theme}`,
|
2016-06-23 22:29:55 +00:00
|
|
|
lineNumbers: true,
|
|
|
|
styleActiveLine: true,
|
2016-07-13 15:59:47 +00:00
|
|
|
inputStyle: 'contenteditable',
|
2016-10-05 16:26:49 +00:00
|
|
|
lineWrapping: false,
|
|
|
|
fixedGutter: false,
|
2017-07-17 20:07:59 +00:00
|
|
|
foldGutter: true,
|
2017-07-18 19:57:40 +00:00
|
|
|
foldOptions: { widget: '\u2026' },
|
2017-10-12 20:19:18 +00:00
|
|
|
gutters: ['CodeMirror-foldgutter', 'CodeMirror-lint-markers'],
|
2016-08-05 20:58:59 +00:00
|
|
|
keyMap: 'sublime',
|
2017-06-06 19:20:21 +00:00
|
|
|
highlightSelectionMatches: true, // highlight current search match
|
2016-08-05 20:58:59 +00:00
|
|
|
lint: {
|
2017-07-26 19:17:05 +00:00
|
|
|
onUpdateLinting: ((annotations) => {
|
|
|
|
this.props.hideRuntimeErrorWarning();
|
|
|
|
this.updateLintingMessageAccessibility(annotations);
|
|
|
|
}),
|
2016-12-13 21:59:47 +00:00
|
|
|
options: {
|
2017-02-22 19:29:35 +00:00
|
|
|
'asi': true,
|
|
|
|
'eqeqeq': false,
|
2017-09-14 18:32:43 +00:00
|
|
|
'-W041': false,
|
|
|
|
'esversion': 6
|
2016-12-13 21:59:47 +00:00
|
|
|
}
|
2016-08-05 20:58:59 +00:00
|
|
|
}
|
2016-06-23 22:29:55 +00:00
|
|
|
});
|
2016-09-20 22:27:10 +00:00
|
|
|
|
2017-02-17 18:30:33 +00:00
|
|
|
this._cm.setOption('extraKeys', {
|
2017-06-06 19:20:21 +00:00
|
|
|
[`${metaKey}-Enter`]: () => null,
|
|
|
|
[`Shift-${metaKey}-Enter`]: () => null,
|
|
|
|
[`${metaKey}-F`]: 'findPersistent',
|
|
|
|
[`${metaKey}-G`]: 'findNext',
|
|
|
|
[`Shift-${metaKey}-G`]: 'findPrev',
|
2017-02-17 18:30:33 +00:00
|
|
|
});
|
|
|
|
|
2016-12-07 02:33:12 +00:00
|
|
|
this.initializeDocuments(this.props.files);
|
|
|
|
this._cm.swapDoc(this._docs[this.props.file.id]);
|
|
|
|
|
2016-10-19 17:29:02 +00:00
|
|
|
this._cm.on('change', debounce(() => {
|
2016-09-20 22:27:10 +00:00
|
|
|
this.props.setUnsavedChanges(true);
|
2016-07-08 19:58:49 +00:00
|
|
|
this.props.updateFileContent(this.props.file.name, this._cm.getValue());
|
2016-10-04 19:35:23 +00:00
|
|
|
if (this.props.autorefresh && this.props.isPlaying) {
|
|
|
|
this.props.startRefreshSketch();
|
2017-02-17 21:04:47 +00:00
|
|
|
this.props.clearConsole();
|
2016-10-04 19:35:23 +00:00
|
|
|
}
|
2016-10-19 17:29:02 +00:00
|
|
|
}, 400));
|
2016-09-20 22:27:10 +00:00
|
|
|
|
2016-08-05 20:58:59 +00:00
|
|
|
this._cm.on('keyup', () => {
|
2016-08-25 16:32:06 +00:00
|
|
|
const temp = `line ${parseInt((this._cm.getCursor().line) + 1, 10)}`;
|
|
|
|
document.getElementById('current-line').innerHTML = temp;
|
2016-08-05 20:58:59 +00:00
|
|
|
});
|
2016-09-07 16:16:26 +00:00
|
|
|
|
|
|
|
this._cm.on('keydown', (_cm, e) => {
|
2016-10-19 22:35:59 +00:00
|
|
|
// 9 === Tab
|
|
|
|
if (e.keyCode === 9 && e.shiftKey) {
|
2016-09-07 20:41:56 +00:00
|
|
|
this.tidyCode();
|
2016-09-07 16:16:26 +00:00
|
|
|
}
|
|
|
|
});
|
2016-09-20 22:27:10 +00:00
|
|
|
|
|
|
|
this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`;
|
|
|
|
this._cm.setOption('indentWithTabs', this.props.isTabIndent);
|
|
|
|
this._cm.setOption('tabSize', this.props.indentationAmount);
|
2017-09-01 16:40:15 +00:00
|
|
|
|
|
|
|
this.props.provideController({
|
|
|
|
tidyCode: this.tidyCode,
|
2017-09-14 20:58:59 +00:00
|
|
|
showFind: this.showFind,
|
|
|
|
findNext: this.findNext,
|
|
|
|
findPrev: this.findPrev
|
2017-09-01 16:40:15 +00:00
|
|
|
});
|
2016-06-23 22:29:55 +00:00
|
|
|
}
|
|
|
|
|
2016-12-07 02:33:12 +00:00
|
|
|
componentWillUpdate(nextProps) {
|
|
|
|
// check if files have changed
|
|
|
|
if (this.props.files[0].id !== nextProps.files[0].id) {
|
|
|
|
// then need to make CodeMirror documents
|
|
|
|
this.initializeDocuments(nextProps.files);
|
|
|
|
}
|
2016-12-09 21:27:10 +00:00
|
|
|
if (this.props.files.length !== nextProps.files.length) {
|
|
|
|
this.initializeDocuments(nextProps.files);
|
|
|
|
}
|
2016-12-07 02:33:12 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
componentDidUpdate(prevProps) {
|
2016-07-08 19:58:49 +00:00
|
|
|
if (this.props.file.content !== prevProps.file.content &&
|
|
|
|
this.props.file.content !== this._cm.getValue()) {
|
2016-12-07 02:33:12 +00:00
|
|
|
const oldDoc = this._cm.swapDoc(this._docs[this.props.file.id]);
|
|
|
|
this._docs[prevProps.file.id] = oldDoc;
|
|
|
|
this._cm.focus();
|
2016-11-08 18:30:41 +00:00
|
|
|
if (!prevProps.unsavedChanges) {
|
|
|
|
setTimeout(() => this.props.setUnsavedChanges(false), 400);
|
|
|
|
}
|
2016-06-23 22:29:55 +00:00
|
|
|
}
|
|
|
|
if (this.props.fontSize !== prevProps.fontSize) {
|
|
|
|
this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`;
|
|
|
|
}
|
2016-07-06 15:27:39 +00:00
|
|
|
if (this.props.indentationAmount !== prevProps.indentationAmount) {
|
|
|
|
this._cm.setOption('tabSize', this.props.indentationAmount);
|
|
|
|
}
|
2016-07-11 03:11:06 +00:00
|
|
|
if (this.props.isTabIndent !== prevProps.isTabIndent) {
|
|
|
|
this._cm.setOption('indentWithTabs', this.props.isTabIndent);
|
|
|
|
}
|
2016-09-20 15:51:09 +00:00
|
|
|
if (this.props.theme !== prevProps.theme) {
|
|
|
|
this._cm.setOption('theme', `p5-${this.props.theme}`);
|
|
|
|
}
|
2017-07-26 18:46:59 +00:00
|
|
|
|
|
|
|
if (prevProps.consoleEvents !== this.props.consoleEvents) {
|
|
|
|
this.props.showRuntimeErrorWarning();
|
|
|
|
}
|
2018-02-16 16:56:44 +00:00
|
|
|
for (let i = 0; i < this._cm.lineCount(); i += 1) {
|
2017-07-17 21:27:21 +00:00
|
|
|
this._cm.removeLineClass(i, 'background', 'line-runtime-error');
|
|
|
|
}
|
2017-07-26 18:46:59 +00:00
|
|
|
if (this.props.runtimeErrorWarningVisible) {
|
|
|
|
this.props.consoleEvents.forEach((consoleEvent) => {
|
|
|
|
if (consoleEvent.method === 'error') {
|
2018-02-08 22:40:21 +00:00
|
|
|
if (consoleEvent.arguments.indexOf(')') > -1) {
|
|
|
|
const n = consoleEvent.arguments.replace(')', '').split(' ');
|
|
|
|
const lineNumber = parseInt(n[n.length - 1], 10) - 1;
|
|
|
|
this._cm.addLineClass(lineNumber, 'background', 'line-runtime-error');
|
|
|
|
}
|
2017-07-26 18:46:59 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-06-23 22:29:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
this._cm = null;
|
2017-09-01 16:40:15 +00:00
|
|
|
this.props.provideController(null);
|
2016-06-23 22:29:55 +00:00
|
|
|
}
|
|
|
|
|
2016-12-07 02:33:12 +00:00
|
|
|
getFileMode(fileName) {
|
|
|
|
let mode;
|
|
|
|
if (fileName.match(/.+\.js$/i)) {
|
2016-12-13 21:59:47 +00:00
|
|
|
mode = 'javascript';
|
2016-12-07 02:33:12 +00:00
|
|
|
} else if (fileName.match(/.+\.css$/i)) {
|
|
|
|
mode = 'css';
|
|
|
|
} else if (fileName.match(/.+\.html$/i)) {
|
|
|
|
mode = 'htmlmixed';
|
|
|
|
} else if (fileName.match(/.+\.json$/i)) {
|
|
|
|
mode = 'application/json';
|
|
|
|
} else {
|
|
|
|
mode = 'text/plain';
|
|
|
|
}
|
|
|
|
return mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
initializeDocuments(files) {
|
|
|
|
this._docs = {};
|
2017-02-22 19:29:35 +00:00
|
|
|
files.forEach((file) => {
|
2016-12-07 22:15:10 +00:00
|
|
|
if (file.name !== 'root') {
|
2016-12-07 02:33:12 +00:00
|
|
|
this._docs[file.id] = CodeMirror.Doc(file.content, this.getFileMode(file.name)); // eslint-disable-line
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-09-07 20:41:56 +00:00
|
|
|
tidyCode() {
|
|
|
|
const beautifyOptions = {
|
|
|
|
indent_size: this.props.indentationAmount,
|
|
|
|
indent_with_tabs: this.props.isTabIndent
|
|
|
|
};
|
|
|
|
|
|
|
|
const mode = this._cm.getOption('mode');
|
|
|
|
if (mode === 'javascript') {
|
|
|
|
this._cm.doc.setValue(beautifyJS(this._cm.doc.getValue(), beautifyOptions));
|
|
|
|
} else if (mode === 'css') {
|
|
|
|
this._cm.doc.setValue(beautifyCSS(this._cm.doc.getValue(), beautifyOptions));
|
|
|
|
} else if (mode === 'htmlmixed') {
|
|
|
|
this._cm.doc.setValue(beautifyHTML(this._cm.doc.getValue(), beautifyOptions));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-01 16:40:15 +00:00
|
|
|
showFind() {
|
2017-09-14 20:58:59 +00:00
|
|
|
this._cm.execCommand('findPersistent');
|
|
|
|
}
|
|
|
|
|
|
|
|
findNext() {
|
|
|
|
this._cm.focus();
|
|
|
|
this._cm.execCommand('findNext');
|
|
|
|
}
|
|
|
|
|
|
|
|
findPrev() {
|
|
|
|
this._cm.focus();
|
|
|
|
this._cm.execCommand('findPrev');
|
2017-09-01 16:40:15 +00:00
|
|
|
}
|
|
|
|
|
2017-01-09 17:47:32 +00:00
|
|
|
toggleEditorOptions() {
|
|
|
|
if (this.props.editorOptionsVisible) {
|
|
|
|
this.props.closeEditorOptions();
|
|
|
|
} else {
|
2017-02-22 19:29:35 +00:00
|
|
|
this.optionsButton.focus();
|
2017-01-09 17:47:32 +00:00
|
|
|
this.props.showEditorOptions();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
_cm: CodeMirror.Editor
|
|
|
|
|
|
|
|
render() {
|
2016-09-07 20:33:01 +00:00
|
|
|
const editorSectionClass = classNames({
|
2017-02-22 19:29:35 +00:00
|
|
|
'editor': true,
|
2016-12-19 22:07:04 +00:00
|
|
|
'sidebar--contracted': !this.props.isExpanded,
|
2016-09-07 20:33:01 +00:00
|
|
|
'editor--options': this.props.editorOptionsVisible
|
|
|
|
});
|
|
|
|
|
2016-08-05 20:58:59 +00:00
|
|
|
return (
|
2016-09-07 16:16:26 +00:00
|
|
|
<section
|
|
|
|
title="code editor"
|
|
|
|
role="main"
|
2016-09-07 20:33:01 +00:00
|
|
|
className={editorSectionClass}
|
2016-09-07 16:16:26 +00:00
|
|
|
>
|
2017-01-05 19:40:04 +00:00
|
|
|
<header className="editor__header">
|
|
|
|
<button
|
|
|
|
aria-label="collapse file navigation"
|
|
|
|
className="sidebar__contract"
|
|
|
|
onClick={this.props.collapseSidebar}
|
|
|
|
>
|
|
|
|
<InlineSVG src={leftArrowUrl} />
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
aria-label="expand file navigation"
|
|
|
|
className="sidebar__expand"
|
|
|
|
onClick={this.props.expandSidebar}
|
|
|
|
>
|
|
|
|
<InlineSVG src={rightArrowUrl} />
|
|
|
|
</button>
|
|
|
|
<div className="editor__file-name">
|
2017-01-06 18:08:03 +00:00
|
|
|
<span>
|
|
|
|
{this.props.file.name}
|
|
|
|
{this.props.unsavedChanges ? <InlineSVG src={unsavedChangesDotUrl} /> : null}
|
|
|
|
</span>
|
2017-01-05 19:40:04 +00:00
|
|
|
<Timer
|
|
|
|
projectSavedTime={this.props.projectSavedTime}
|
2017-01-13 16:55:13 +00:00
|
|
|
isUserOwner={this.props.isUserOwner}
|
2017-01-05 19:40:04 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</header>
|
2017-02-22 19:29:35 +00:00
|
|
|
<div ref={(element) => { this.codemirrorContainer = element; }} className="editor-holder" tabIndex="0">
|
2016-08-12 01:26:49 +00:00
|
|
|
</div>
|
|
|
|
<EditorAccessibility
|
|
|
|
lintMessages={this.props.lintMessages}
|
|
|
|
/>
|
2016-08-12 18:19:23 +00:00
|
|
|
</section>
|
2016-08-05 20:58:59 +00:00
|
|
|
);
|
2016-06-23 22:29:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-27 20:03:22 +00:00
|
|
|
Editor.propTypes = {
|
2016-08-11 18:09:59 +00:00
|
|
|
lintWarning: PropTypes.bool.isRequired,
|
2017-02-22 19:29:35 +00:00
|
|
|
lintMessages: PropTypes.arrayOf(PropTypes.shape({
|
|
|
|
severity: PropTypes.string.isRequired,
|
|
|
|
line: PropTypes.number.isRequired,
|
|
|
|
message: PropTypes.string.isRequired,
|
|
|
|
id: PropTypes.number.isRequired
|
|
|
|
})).isRequired,
|
2017-07-17 21:27:21 +00:00
|
|
|
consoleEvents: PropTypes.arrayOf(PropTypes.shape({
|
|
|
|
method: PropTypes.string.isRequired,
|
|
|
|
args: PropTypes.arrayOf(PropTypes.string)
|
|
|
|
})),
|
2016-08-11 17:24:02 +00:00
|
|
|
updateLintMessage: PropTypes.func.isRequired,
|
|
|
|
clearLintMessage: PropTypes.func.isRequired,
|
2016-07-11 02:52:48 +00:00
|
|
|
indentationAmount: PropTypes.number.isRequired,
|
2016-07-12 03:40:30 +00:00
|
|
|
isTabIndent: PropTypes.bool.isRequired,
|
|
|
|
updateFileContent: PropTypes.func.isRequired,
|
|
|
|
fontSize: PropTypes.number.isRequired,
|
2016-07-08 19:58:49 +00:00
|
|
|
file: PropTypes.shape({
|
|
|
|
name: PropTypes.string.isRequired,
|
2016-12-07 02:33:12 +00:00
|
|
|
content: PropTypes.string.isRequired,
|
|
|
|
id: PropTypes.string.isRequired
|
2017-02-22 19:29:35 +00:00
|
|
|
}).isRequired,
|
2016-09-07 20:33:01 +00:00
|
|
|
editorOptionsVisible: PropTypes.bool.isRequired,
|
|
|
|
showEditorOptions: PropTypes.func.isRequired,
|
2016-09-07 21:47:22 +00:00
|
|
|
closeEditorOptions: PropTypes.func.isRequired,
|
2016-09-20 15:51:09 +00:00
|
|
|
setUnsavedChanges: PropTypes.func.isRequired,
|
2016-09-29 04:54:35 +00:00
|
|
|
startRefreshSketch: PropTypes.func.isRequired,
|
|
|
|
autorefresh: PropTypes.bool.isRequired,
|
2016-09-22 21:17:24 +00:00
|
|
|
isPlaying: PropTypes.bool.isRequired,
|
2016-09-29 04:54:35 +00:00
|
|
|
theme: PropTypes.string.isRequired,
|
2016-11-09 17:52:14 +00:00
|
|
|
unsavedChanges: PropTypes.bool.isRequired,
|
2016-12-07 02:33:12 +00:00
|
|
|
projectSavedTime: PropTypes.string.isRequired,
|
2017-02-22 19:29:35 +00:00
|
|
|
files: PropTypes.arrayOf(PropTypes.shape({
|
|
|
|
id: PropTypes.string.isRequired,
|
|
|
|
name: PropTypes.string.isRequired,
|
|
|
|
content: PropTypes.string.isRequired
|
|
|
|
})).isRequired,
|
2016-12-19 22:07:04 +00:00
|
|
|
isExpanded: PropTypes.bool.isRequired,
|
|
|
|
collapseSidebar: PropTypes.func.isRequired,
|
2017-01-13 16:55:13 +00:00
|
|
|
expandSidebar: PropTypes.func.isRequired,
|
2017-02-17 21:04:47 +00:00
|
|
|
isUserOwner: PropTypes.bool,
|
2017-07-26 18:46:59 +00:00
|
|
|
clearConsole: PropTypes.func.isRequired,
|
|
|
|
showRuntimeErrorWarning: PropTypes.func.isRequired,
|
|
|
|
hideRuntimeErrorWarning: PropTypes.func.isRequired,
|
|
|
|
runtimeErrorWarningVisible: PropTypes.bool.isRequired,
|
2017-09-01 16:40:15 +00:00
|
|
|
provideController: PropTypes.func.isRequired
|
2016-06-27 20:03:22 +00:00
|
|
|
};
|
|
|
|
|
2017-02-22 19:29:35 +00:00
|
|
|
Editor.defaultProps = {
|
2017-07-17 21:27:21 +00:00
|
|
|
isUserOwner: false,
|
2017-07-26 18:46:59 +00:00
|
|
|
consoleEvents: [],
|
2017-02-22 19:29:35 +00:00
|
|
|
};
|
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
export default Editor;
|