1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-28 17:20:13 +02:00

Merge branch 'master' into assets

This commit is contained in:
Kushagra Gour
2024-02-09 14:28:10 +05:30
20 changed files with 620 additions and 94 deletions

View File

@@ -37,19 +37,23 @@ export default class AddLibrary extends Component {
}
textareaBlurHandler(e, textarea) {
const target = e ? e.target : textarea;
const data = { js: this.state.js, css: this.state.css };
const type = target.dataset.lang;
if (type === 'js') {
data.js = target.value || '';
this.setState({
js: target.value || ''
js: data.js
});
} else {
data.css = target.value || '';
this.setState({
css: target.value || ''
css: data.css
});
}
// trackEvent('ui', 'addLibrarySelect', target.selectedOptions[0].label);
this.props.onChange({ js: this.state.js, css: this.state.css });
this.props.onChange(data);
}
suggestionSelectHandler(value) {
const textarea = value.match(/\.js$/)

View File

@@ -187,8 +187,9 @@ export default class CodeEditor extends Component {
showErrors(errors) {
if (this.props.type === 'codemirror') {
errors.forEach(function(error) {
this.instance.operation(function() {
const editor = this.instance;
errors.forEach(function (error) {
editor.operation(function () {
var n = document.createElement('div');
n.setAttribute('data-title', error.message);
n.classList.add('gutter-error-marker');
@@ -235,11 +236,11 @@ export default class CodeEditor extends Component {
if (!monacoDepsDeferred) {
monacoDepsDeferred = deferred();
loadCss({ url: 'lib/monaco/monaco.css', id: 'monaco-css' });
import(/* webpackChunkName: "monaco" */ '../lib/monaco/monaco.bundle.js').then(
() => {
monacoDepsDeferred.resolve();
}
);
import(
/* webpackChunkName: "monaco" */ '../lib/monaco/monaco.bundle.js'
).then(() => {
monacoDepsDeferred.resolve();
});
}
return monacoDepsDeferred.promise;
}
@@ -311,23 +312,23 @@ export default class CodeEditor extends Component {
// cursorScrollMargin: '20', has issue with scrolling
profile: options.profile || '',
extraKeys: {
Up: function(editor) {
Up: function (editor) {
// Stop up/down keys default behavior when saveditempane is open
// if (isSavedItemsPaneOpen) {
// return;
// }
CodeMirror.commands.goLineUp(editor);
},
Down: function(editor) {
Down: function (editor) {
// if (isSavedItemsPaneOpen) {
// return;
// }
CodeMirror.commands.goLineDown(editor);
},
'Shift-Tab': function(editor) {
'Shift-Tab': function (editor) {
CodeMirror.commands.indentAuto(editor);
},
'Shift-Ctrl-F': function(editor) {
'Shift-Ctrl-F': function (editor) {
if (options.prettier) {
prettify({
content: editor.getValue(),
@@ -336,7 +337,7 @@ export default class CodeEditor extends Component {
}
trackEvent('ui', 'prettifyKeyboardShortcut');
},
Tab: function(editor) {
Tab: function (editor) {
if (options.emmet) {
const didEmmetWork = editor.execCommand(
'emmetExpandAbbreviation'
@@ -344,18 +345,18 @@ export default class CodeEditor extends Component {
if (didEmmetWork === true) {
return;
}
const input = $('[data-setting=indentWith]:checked');
if (
!editor.somethingSelected() &&
(!prefs.indentWith || prefs.indentWith === 'spaces')
) {
// softtabs adds spaces. This is required because by default tab key will put tab, but we want
// to indent with spaces if `spaces` is preferred mode of indentation.
// `somethingSelected` needs to be checked otherwise, all selected code is replaced with softtab.
CodeMirror.commands.insertSoftTab(editor);
} else {
CodeMirror.commands.defaultTab(editor);
}
}
const input = $('[data-setting=indentWith]:checked');
if (
!editor.somethingSelected() &&
(!prefs.indentWith || prefs.indentWith === 'spaces')
) {
// softtabs adds spaces. This is required because by default tab key will put tab, but we want
// to indent with spaces if `spaces` is preferred mode of indentation.
// `somethingSelected` needs to be checked otherwise, all selected code is replaced with softtab.
CodeMirror.commands.insertSoftTab(editor);
} else {
CodeMirror.commands.defaultTab(editor);
}
},
Enter: 'emmetInsertLineBreak'

View File

@@ -15,6 +15,7 @@ import { Console } from './Console';
import CssSettingsModal from './CssSettingsModal';
import { PreviewDimension } from './PreviewDimension.jsx';
import Modal from './Modal.jsx';
import { LocalStorageKeys } from '../constants.js';
const minCodeWrapSize = 33;
/* global htmlCodeEl
@@ -24,7 +25,9 @@ export default class ContentWrap extends Component {
constructor(props) {
super(props);
this.state = {
isConsoleOpen: false,
isConsoleOpen:
window.localStorage.getItem(LocalStorageKeys.WAS_CONSOLE_OPEN) ===
'true',
isCssSettingsModalOpen: false,
isPreviewNotWorkingModalVisible: false,
logs: []
@@ -574,8 +577,10 @@ export default class ContentWrap extends Component {
}
toggleConsole() {
this.setState({ isConsoleOpen: !this.state.isConsoleOpen });
const newValue = !this.state.isConsoleOpen;
this.setState({ isConsoleOpen: newValue });
trackEvent('ui', 'consoleToggle');
window.localStorage.setItem(LocalStorageKeys.WAS_CONSOLE_OPEN, newValue);
}
consoleHeaderDblClickHandler(e) {
if (!e.target.classList.contains('js-console__header')) {

View File

@@ -114,6 +114,38 @@ export function Notifications(props) {
return (
<div>
<h1>Whats new?</h1>
<Notification version="5.2.0" {...props}>
<li>
<strong>Improvement</strong>: Atomic CSS (Atomizer) has been updated
to latest version. Now you can do things like Grid and more!
</li>
<li>
<strong>Improvement</strong>: Atomic CSS config can now be written
with unquoted keys too. No need to have a valid JSON syntax.
</li>
</Notification>
<Notification version="5.1.1" {...props}>
<NotificationItem type="bug">
Detached preview now renders correctly.
</NotificationItem>
</Notification>
<Notification version="5.1.0" {...props}>
<NotificationItem type="interface">
Console's open state is preserved across refreshes.
</NotificationItem>
<NotificationItem type="bug">
Error highlighting fixed in JS pane when using Codemirror editor.
Thanks
<ThanksTo url="https://github.com/nhogle" name="@nhogle" />
</NotificationItem>
<NotificationItem type="bug">
Tab key not working in JS pane is fixed. Thanks
<ThanksTo url="https://github.com/nhogle" name="@nhogle" />
</NotificationItem>
<NotificationItem type="bug">
3rd party libraries not updating sometimes is fixed.
</NotificationItem>
</Notification>
<Notification version="5.0.3" {...props}>
<li>
⬆️ Popular libraries updated to latest versions. Thanks

View File

@@ -389,10 +389,15 @@ export default class Settings extends Component {
onChange={e => this.updateSetting(e, 'lang')}
>
<option value="en">English</option>
<option value="ja">日本語</option>
<option value="hi">ि</option>
<option value="sa">Sanskrit</option>
<option value="es">Español (España)</option>
<option value="zh-Hans">中文(简体)</option>
<option value="sa" disabled="disabled">
Sanskrit (Coming soon)
</option>
<option value="zh-Hans" disabled="disabled">
中文(简体) (coming soon)
</option>
</select>
</label>
</div>

View File

@@ -69,17 +69,14 @@ import { commandPaletteService } from '../commandPaletteService';
import { I18nProvider } from '@lingui/react';
import { Assets } from './Assets.jsx';
import { LocalStorageKeys } from '../constants.js';
if (module.hot) {
require('preact/debug');
}
const LocalStorageKeys = {
LOGIN_AND_SAVE_MESSAGE_SEEN: 'loginAndsaveMessageSeen',
ASKED_TO_IMPORT_CREATIONS: 'askedToImportCreations'
};
const UNSAVED_WARNING_COUNT = 15;
const version = '5.0.3';
const version = '5.2.0';
// Read forced settings as query parameters
window.forcedSettings = {};