Skip to content

Commit 120bd24

Browse files
authored
Merge pull request #72 from solidjs/modderme123-m
Modderme123 m
2 parents 6d21ed1 + e185e20 commit 120bd24

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/components/editor/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ const Editor: Component<Props> = (props) => {
2929

3030
if (props.formatter) {
3131
languages.registerDocumentFormattingEditProvider('typescript', {
32-
provideDocumentFormattingEdits: async (model) => {
32+
async provideDocumentFormattingEdits(model) {
3333
props.formatter!.postMessage({
3434
event: 'FORMAT',
3535
code: model.getValue(),
3636
pos: editor.getPosition(),
3737
});
38+
3839
return new Promise((resolve, reject) => {
3940
props.formatter!.addEventListener(
4041
'message',
@@ -72,11 +73,14 @@ const Editor: Component<Props> = (props) => {
7273
enabled: props.withMinimap,
7374
},
7475
});
76+
7577
editor.onDidChangeModelContent(() => {
7678
props.onDocChange?.(editor.getValue());
7779
});
80+
7881
props.ref?.(editor);
7982
};
83+
8084
// Initialize Monaco
8185
onMount(() => setupEditor());
8286
onCleanup(() => editor?.dispose());
@@ -85,9 +89,11 @@ const Editor: Component<Props> = (props) => {
8589
editor.setModel(model());
8690
liftOff();
8791
});
92+
8893
createEffect(() => {
8994
mEditor.setTheme(props.isDark ? 'vs-dark-plus' : 'vs-light-plus');
9095
});
96+
9197
createEffect(() => {
9298
const fontSize = zoomState.fontSize;
9399
editor.updateOptions({ fontSize });

src/components/editor/setupSolid.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ editor.defineTheme('vs-dark-plus', vsDark as editor.IStandaloneThemeData);
9595
editor.defineTheme('vs-light-plus', vsLight as editor.IStandaloneThemeData);
9696

9797
const hookLanguages = languages.setLanguageConfiguration;
98+
9899
languages.setLanguageConfiguration = (
99100
languageId: string,
100101
configuration: languages.LanguageConfiguration,
@@ -105,8 +106,8 @@ languages.setLanguageConfiguration = (
105106

106107
export async function liftOff(): Promise<void> {
107108
await loadingWasm;
109+
108110
// wireTmGrammars only cares about the language part, but asks for all of monaco
109111
// we fool it by just passing in an object with languages
110-
111112
await wireTmGrammars({ languages } as any, registry, grammars);
112113
}

src/components/preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export const Preview: Component<Props> = (props) => {
192192

193193
onMount(() => {
194194
iframe.srcdoc = html;
195+
iframe.addEventListener('load', attachToIframe);
195196
});
196197

197198
return (
@@ -204,7 +205,6 @@ export const Preview: Component<Props> = (props) => {
204205
title="Solid REPL"
205206
class="overflow-auto p-2 w-full h-full dark:bg-other"
206207
ref={iframe}
207-
onLoad={attachToIframe}
208208
// @ts-ignore
209209
sandbox="allow-popups-to-escape-sandbox allow-scripts allow-popups allow-forms allow-pointer-lock allow-top-navigation allow-modals allow-same-origin"
210210
></iframe>

src/components/repl.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ export const Repl: Component<ReplProps> = (props) => {
316316
fallback={<span>.{tab.type}</span>}
317317
>
318318
<select
319-
class="bg-none p-0"
319+
class="dark:bg-gray-700 bg-none p-0"
320320
value={tab.type}
321-
onChange={(e) => {
321+
onBlur={(e) => {
322322
setEdit(-1);
323323
actions.setTabType(id(tab), e.currentTarget.value);
324324
}}

0 commit comments

Comments
 (0)