Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update live_monaco_editor #76

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ defmodule Beacon.LiveAdmin.ComponentEditorLive.FormComponent do
<input type="hidden" name="component[body]" id="component-form_body" value={@changed_body} />
</.form>
</div>
<div class="h-full col-span-full lg:col-span-2">
<div class="col-span-full lg:col-span-2">
<%= template_error(@form[:body]) %>
<div class="py-6 w-full h-full rounded-[1.25rem] lg:rounded-t-[1.25rem] lg:rounded-b-none bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<div class="py-6 w-full rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor path="body" class="col-span-full lg:col-span-2" value={@body} opts={Map.merge(LiveMonacoEditor.default_opts(), %{"language" => "html"})} />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ defmodule Beacon.LiveAdmin.LayoutEditorLive.FormComponent do
<input type="hidden" name="layout[template]" id="layout-form_template" value={@changed_template} />
</.form>
</div>
<div class="h-full col-span-full lg:col-span-2">
<div class="col-span-full lg:col-span-2">
<%= template_error(@form[:template]) %>
<div class="py-6 w-full h-full rounded-[1.25rem] lg:rounded-t-[1.25rem] lg:rounded-b-none bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<div class="py-6 w-full rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor path="template" class="col-span-full lg:col-span-2" value={@template} opts={Map.merge(LiveMonacoEditor.default_opts(), %{"language" => "html"})} />
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions lib/beacon/live_admin/live/layout_editor_live/revisions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ defmodule Beacon.LiveAdmin.LayoutEditorLive.Revisions do
<li>
<h4 class="text-gray-600">Template</h4>
<div class="w-full mt-2">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829] h-[300px]">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor
path={@event.snapshot.id}
class="col-span-full lg:col-span-2"
class="col-span-full lg:col-span-2 max-h-60"
value={template(@event.snapshot.layout)}
opts={Map.merge(LiveMonacoEditor.default_opts(), %{"language" => "html", "readOnly" => "true"})}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ defmodule Beacon.LiveAdmin.PageEditorLive.EventHandlers do
</.form>

<div class="w-full mt-10 space-y-8">
<div class="py-6 h-[500px] lg:h-[calc(100vh_-_349px)] rounded-[1.25rem] lg:rounded-t-[1.25rem] lg:rounded-b-none bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor
path="event_handler_code"
class="col-span-full lg:col-span-2"
Expand Down
4 changes: 2 additions & 2 deletions lib/beacon/live_admin/live/page_editor_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ defmodule Beacon.LiveAdmin.PageEditorLive.FormComponent do
<% end %>
</.form>
</div>
<div class="h-full col-span-full lg:col-span-2">
<div class="col-span-full lg:col-span-2">
<%= template_error(@form[:template]) %>
<div class="py-6 w-full h-full rounded-[1.25rem] lg:rounded-t-[1.25rem] lg:rounded-b-none bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<div class="py-6 w-full rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor path="template" class="col-span-full lg:col-span-2" value={@template} opts={Map.merge(LiveMonacoEditor.default_opts(), %{"language" => @language})} />
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions lib/beacon/live_admin/live/page_editor_live/revisions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ defmodule Beacon.LiveAdmin.PageEditorLive.Revisions do
<li>
<h4 class="text-gray-600">Template</h4>
<div class="w-full mt-2">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829] h-[300px]">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor
path={"template-" <> @event.snapshot.id}
class="col-span-full lg:col-span-2"
class="col-span-full lg:col-span-2 max-h-60"
value={@event.snapshot.page.template}
opts={Map.merge(LiveMonacoEditor.default_opts(), %{"language" => language(@event.snapshot.page.format), "readOnly" => "true"})}
/>
Expand All @@ -133,10 +133,10 @@ defmodule Beacon.LiveAdmin.PageEditorLive.Revisions do
<li>
<h4 class="text-gray-600">Schema</h4>
<div class="w-full mt-2">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829] h-[300px]">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor
path={"schema-" <> @event.snapshot.id}
class="col-span-full lg:col-span-2"
class="col-span-full lg:col-span-2 max-h-60"
value={Jason.encode!(@event.snapshot.page.raw_schema, pretty: true)}
opts={Map.merge(LiveMonacoEditor.default_opts(), %{"language" => "json", "readOnly" => "true"})}
/>
Expand Down
2 changes: 1 addition & 1 deletion lib/beacon/live_admin/live/page_editor_live/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ defmodule Beacon.LiveAdmin.PageEditorLive.Schema do
</.header>

<div class="w-full mt-4 space-y-8">
<div class="py-6 rounded-[1.25rem] min-h-[600px] lg:rounded-t-[1.25rem] lg:rounded-b-none lg:h-[calc(100vh_-_222px)] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor path="raw_schema" class="col-span-full lg:col-span-2" value={@raw_schema} opts={Map.merge(LiveMonacoEditor.default_opts(), %{"language" => "json"})} />
</div>
<.error :for={msg <- Enum.map(@form[:raw_schema].errors, &translate_error/1)}><%= msg %></.error>
Expand Down
2 changes: 1 addition & 1 deletion lib/beacon/live_admin/live/page_editor_live/variants.ex
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ defmodule Beacon.LiveAdmin.PageEditorLive.Variants do
</.form>
<%= template_error(@form[:template]) %>
<div class="w-full mt-10 space-y-8">
<div class="py-6 h-[500px] lg:h-[calc(100vh_-_349px)] rounded-[1.25rem] lg:rounded-t-[1.25rem] lg:rounded-b-none bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<div class="py-6 rounded-[1.25rem] bg-[#0D1829] [&_.monaco-editor-background]:!bg-[#0D1829] [&_.margin]:!bg-[#0D1829]">
<LiveMonacoEditor.code_editor path="variant" class="col-span-full lg:col-span-2" value={@selected.template} opts={Map.merge(LiveMonacoEditor.default_opts(), %{"language" => @language})} />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"heroicons": {:hex, :heroicons, "0.5.3", "ee8ae8335303df3b18f2cc07f46e1cb6e761ba4cf2c901623fbe9a28c0bc51dd", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:phoenix_live_view, ">= 0.18.2", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "a210037e8a09ac17e2a0a0779d729e89c821c944434c3baa7edfc1f5b32f3502"},
"image": {:hex, :image, "0.34.0", "4bd8b5f6b0a979607e56a40996cf5509318b2de32acf6abb1f0c0ab2b48f5e65", [:mix], [{:bumblebee, "~> 0.2", [hex: :bumblebee, repo: "hexpm", optional: true]}, {:evision, "~> 0.1.26", [hex: :evision, repo: "hexpm", optional: true]}, {:exla, "~> 0.5", [hex: :exla, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:kino, "~> 0.7", [hex: :kino, repo: "hexpm", optional: true]}, {:nx, "~> 0.5", [hex: :nx, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.14 or ~> 3.2", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.13", [hex: :plug, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.7", [hex: :sweet_xml, repo: "hexpm", optional: false]}, {:vix, "~> 0.17", [hex: :vix, repo: "hexpm", optional: false]}], "hexpm", "5277d1864bb3fd44db80f6a4f244cf5a5cc5106bdf030931524f59db7080bb9f"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"live_monaco_editor": {:hex, :live_monaco_editor, "0.1.5", "139f24a816d20f1c9ae1753ff8b09d02d2586d2676ab544346c0a6aff8a0ccfc", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.7", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.18", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "803d08d60b4d2d66770ce89ec49d774090a7cdfe1089e3dba72b4a291cc5a8f3"},
"live_monaco_editor": {:hex, :live_monaco_editor, "0.1.6", "8e88a383d7b33f0b3ee04c9c47a5860a67d83256d8656618e7488aab17a17945", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.7", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.18", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "1643e898986bbc988482dac09f23a340f611242108ebbcc6c6df0616df55ba4f"},
"mdex": {:hex, :mdex, "0.1.6", "ce705242117d26fe4c8a3385227ef466154f14d12975930a8f5ad6033d340e92", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "a8c2512748adb826af7c45f754e6350ec632ca69003cc03602cf473dfef1bb14"},
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
"mix_test_watch": {:hex, :mix_test_watch, "1.1.0", "330bb91c8ed271fe408c42d07e0773340a7938d8a0d281d57a14243eae9dc8c3", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "52b6b1c476cbb70fd899ca5394506482f12e5f6b0d6acff9df95c7f1e0812ec3"},
Expand Down
33 changes: 33 additions & 0 deletions priv/static/beacon_live_admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions priv/static/beacon_live_admin.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion priv/static/beacon_live_admin.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion priv/static/beacon_live_admin.min.css.map

Large diffs are not rendered by default.

Loading