Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorHowell committed Jul 26, 2023
1 parent 09ea99b commit 3ff2434
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion resources/dist/components/filament-monaco-editor.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions resources/js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';

global.MonacoEnvironment = {
window.MonacoEnvironment = {
globalAPI: true,
getWorkerUrl: (moduleId, label) => {
if (label === 'html' || label === 'handlebars') {
Expand All @@ -22,7 +22,7 @@ global.MonacoEnvironment = {
return '/editor.worker.js';
},
getWorker: (moduleId, label) => {
return new Worker(global.MonacoEnvironment.getWorkerUrl(moduleId, label));
return new Worker(window.MonacoEnvironment.getWorkerUrl(moduleId, label));
},
};

Expand Down
2 changes: 1 addition & 1 deletion resources/views/monaco-editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ax-load
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('filament-monaco-editor', 'connorhowell/filament-monaco-editor') }}"
x-data="filamentMonacoEditor({
state: $wire.{{ $applyStateBindingModifiers("entangle('{$statePath}')") }},
state: $wire.entangle('{{ $getStatePath() }}'),
theme: '{{ $getTheme() }}',
language: '{{ $getLanguage() }}'
})"
Expand Down
10 changes: 10 additions & 0 deletions src/MonacoEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ class MonacoEditor extends Field

protected string $view = 'filament-monaco-editor::monaco-editor';

public function getLanguage(): string
{
return $this->language;
}

public function getTheme(): string
{
return $this->theme;
}

public function language(string $language): static
{
$this->language = $language;
Expand Down

0 comments on commit 3ff2434

Please sign in to comment.