1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-06-09 19:24:58 +02:00

minor fixes

This commit is contained in:
Kushagra Gour 2018-06-07 10:21:39 +05:30
parent 359b270295
commit 36e148d359
3 changed files with 21 additions and 19 deletions

View File

@ -152,10 +152,10 @@ export default class ContentWrap extends Component {
var blobjs = new Blob([js], { type: 'text/plain;charset=UTF-8' }); var blobjs = new Blob([js], { type: 'text/plain;charset=UTF-8' });
// Track if people have written code. // Track if people have written code.
// if (!trackEvent.hasTrackedCode && (html || css || js)) { if (!trackEvent.hasTrackedCode && (html || css || js)) {
// trackEvent('fn', 'hasCode'); trackEvent('fn', 'hasCode');
// trackEvent.hasTrackedCode = true; trackEvent.hasTrackedCode = true;
// } }
if (shouldInlineJs) { if (shouldInlineJs) {
if (this.detachedWindow) { if (this.detachedWindow) {
@ -194,11 +194,11 @@ export default class ContentWrap extends Component {
* @param {boolean} isManual Is this a manual preview request from user? * @param {boolean} isManual Is this a manual preview request from user?
*/ */
setPreviewContent(isForced, isManual) { setPreviewContent(isForced, isManual) {
if (!this.prefs.autoPreview && !isManual) { if (!this.props.prefs.autoPreview && !isManual) {
// return; return;
} }
if (!this.prefs.preserveConsoleLogs) { if (!this.props.prefs.preserveConsoleLogs) {
this.clearConsole(); this.clearConsole();
} }
@ -318,7 +318,7 @@ export default class ContentWrap extends Component {
this.cm[type].setOption('tabSize', +prefs.indentSize); this.cm[type].setOption('tabSize', +prefs.indentSize);
this.cm[type].setOption('theme', prefs.editorTheme); this.cm[type].setOption('theme', prefs.editorTheme);
// this.cm[type].setOption('keyMap', prefs.keymap); this.cm[type].setOption('keyMap', prefs.keymap);
this.cm[type].setOption('lineWrapping', prefs.lineWrap); this.cm[type].setOption('lineWrapping', prefs.lineWrap);
this.cm[type].refresh(); this.cm[type].refresh();
}); });
@ -634,6 +634,7 @@ export default class ContentWrap extends Component {
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'], gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
noAutocomplete: true, noAutocomplete: true,
matchTags: { bothTags: true } matchTags: { bothTags: true }
// emmet: true
}} }}
onChange={this.onHtmlCodeChange.bind(this)} onChange={this.onHtmlCodeChange.bind(this)}
onCreation={el => (this.cm.html = el)} onCreation={el => (this.cm.html = el)}
@ -691,14 +692,13 @@ export default class ContentWrap extends Component {
'error-gutter', 'error-gutter',
'CodeMirror-linenumbers', 'CodeMirror-linenumbers',
'CodeMirror-foldgutter' 'CodeMirror-foldgutter'
], ]
noAutocomplete: true
// emmet: true // emmet: true
}} }}
onChange={this.onCssCodeChange.bind(this)} onChange={this.onCssCodeChange.bind(this)}
onCreation={el => (this.cm.css = el)} onCreation={el => (this.cm.css = el)}
/> />
{/* Inlet(scope.cm.css); */}
</div> </div>
<div <div
data-code-wrap-id="2" data-code-wrap-id="2"
@ -741,12 +741,12 @@ export default class ContentWrap extends Component {
'error-gutter', 'error-gutter',
'CodeMirror-linenumbers', 'CodeMirror-linenumbers',
'CodeMirror-foldgutter' 'CodeMirror-foldgutter'
], ]
noAutocomplete: true
}} }}
onChange={this.onJsCodeChange.bind(this)} onChange={this.onJsCodeChange.bind(this)}
onCreation={el => (this.cm.js = el)} onCreation={el => (this.cm.js = el)}
/> />
{/* Inlet(scope.cm.js); */}
</div> </div>
</SplitPane> </SplitPane>
<div class="demo-side" id="js-demo-side"> <div class="demo-side" id="js-demo-side">

View File

@ -51,7 +51,7 @@ export default class UserCodeMirror extends Component {
matchBrackets: true, matchBrackets: true,
matchTags: options.matchTags || false, matchTags: options.matchTags || false,
tabMode: 'indent', tabMode: 'indent',
// keyMap: 'sublime', keyMap: 'sublime',
theme: 'monokai', theme: 'monokai',
lint: !!options.lint, lint: !!options.lint,
tabSize: 2, tabSize: 2,

View File

@ -112,9 +112,9 @@ export default class App extends Component {
} }
}); });
} else { } else {
// User is signed out.
this.setState({ user: undefined }); this.setState({ user: undefined });
delete window.user; delete window.user;
// User is signed out.
} }
this.updateProfileUi(); this.updateProfileUi();
}); });
@ -293,7 +293,6 @@ export default class App extends Component {
// setTimeout(() => $('#js-saved-items-wrap').style.overflowY = 'auto', 1000); // setTimeout(() => $('#js-saved-items-wrap').style.overflowY = 'auto', 1000);
} }
toggleSavedItemsPane(shouldOpen) { toggleSavedItemsPane(shouldOpen) {
// const savedItemsPane = $('#js-saved-items-pane');
this.setState({ isSavedItemPaneOpen: !this.state.isSavedItemPaneOpen }); this.setState({ isSavedItemPaneOpen: !this.state.isSavedItemPaneOpen });
if (this.state.isSavedItemPaneOpen) { if (this.state.isSavedItemPaneOpen) {
@ -366,7 +365,6 @@ export default class App extends Component {
}); });
this.populateItemsInSavedPane(items); this.populateItemsInSavedPane(items);
}); });
// this.setState({ isSavedItemPaneOpen: true });
} }
openAddLibrary() { openAddLibrary() {
this.setState({ isAddLibraryModalOpen: true }); this.setState({ isAddLibraryModalOpen: true });
@ -464,7 +462,7 @@ export default class App extends Component {
this.setState({ this.setState({
currentItem: { ...this.state.currentItem } currentItem: { ...this.state.currentItem }
}); });
// this.contentWrap.setPreviewContent(true); this.contentWrap.setPreviewContent(true);
alertsService.add('Libraries updated.'); alertsService.add('Libraries updated.');
} }
updateExternalLibCount() { updateExternalLibCount() {
@ -748,6 +746,10 @@ export default class App extends Component {
this.createNewItem(); this.createNewItem();
} }
} }
openBtnClickHandler() {
trackEvent('ui', 'openBtnClick');
this.openSavedItemsPane();
}
detachedPreviewBtnHandler() { detachedPreviewBtnHandler() {
trackEvent('ui', 'detachPreviewBtnClick'); trackEvent('ui', 'detachPreviewBtnClick');
@ -760,7 +762,7 @@ export default class App extends Component {
<div class="main-container"> <div class="main-container">
<MainHeader <MainHeader
externalLibCount={this.state.externalLibCount} externalLibCount={this.state.externalLibCount}
openBtnHandler={this.openSavedItemsPane.bind(this)} openBtnHandler={this.openBtnClickHandler.bind(this)}
newBtnHandler={this.newBtnClickHandler.bind(this)} newBtnHandler={this.newBtnClickHandler.bind(this)}
saveBtnHandler={this.saveBtnClickHandler.bind(this)} saveBtnHandler={this.saveBtnClickHandler.bind(this)}
loginBtnHandler={this.loginBtnClickHandler.bind(this)} loginBtnHandler={this.loginBtnClickHandler.bind(this)}