Keeping last project open
This commit is contained in:
@ -25,13 +25,15 @@
|
||||
onChange?: (value: string) => void;
|
||||
onExecute?: (code: string, source: 'selection' | 'block' | 'document') => void;
|
||||
editorSettings: EditorSettingsStore;
|
||||
mode: 'composition' | 'livecoding';
|
||||
}
|
||||
|
||||
let {
|
||||
value = '',
|
||||
onChange,
|
||||
onExecute,
|
||||
editorSettings
|
||||
editorSettings,
|
||||
mode = 'composition'
|
||||
}: Props = $props();
|
||||
|
||||
let editorContainer: HTMLDivElement;
|
||||
@ -44,6 +46,13 @@
|
||||
function handleExecute() {
|
||||
if (!editorView) return;
|
||||
|
||||
if (mode === 'composition') {
|
||||
const doc = getDocument(editorView.state);
|
||||
flash(editorView, doc.from, doc.to);
|
||||
onExecute?.(doc.text, 'document');
|
||||
return;
|
||||
}
|
||||
|
||||
const selection = getSelection(editorView.state);
|
||||
if (selection.text) {
|
||||
flash(editorView, selection.from, selection.to);
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
onExecute?: (code: string, source: 'selection' | 'block' | 'document') => void;
|
||||
logs?: string[];
|
||||
editorSettings: EditorSettingsStore;
|
||||
mode: 'composition' | 'livecoding';
|
||||
}
|
||||
|
||||
let {
|
||||
@ -17,7 +18,8 @@
|
||||
onChange,
|
||||
onExecute,
|
||||
logs = [],
|
||||
editorSettings
|
||||
editorSettings,
|
||||
mode = 'composition'
|
||||
}: Props = $props();
|
||||
|
||||
let logPanelRef: LogPanel;
|
||||
@ -84,6 +86,7 @@
|
||||
{onChange}
|
||||
{onExecute}
|
||||
{editorSettings}
|
||||
{mode}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user