···
import { getSession, OAuthUserAgent } from "@atcute/oauth-browser-client";
import { remove } from "@mary/exif-rm";
import { useNavigate, useParams } from "@solidjs/router";
7
-
import { createEffect, createSignal, For, onCleanup, Show } from "solid-js";
8
-
import { Editor, editorView } from "../components/editor.jsx";
7
+
import { createEffect, createSignal, For, lazy, onCleanup, Show, Suspense } from "solid-js";
import { agent } from "../components/login.jsx";
import { sessions } from "./account.jsx";
import { Button } from "./button.jsx";
···
import { TextInput } from "./text-input.jsx";
import Tooltip from "./tooltip.jsx";
16
+
const Editor = lazy(() => import("../components/editor.jsx").then((m) => ({ default: m.Editor })));
18
+
export const editorInstance = { view: null as any };
export const [placeholder, setPlaceholder] = createSignal<any>();
export const RecordEditor = (props: { create: boolean; record?: any; refetch?: any }) => {
···
const rkey = formData.get("rkey");
96
-
record = JSON.parse(editorView.state.doc.toString());
98
+
record = JSON.parse(editorInstance.view.state.doc.toString());
···
const editRecord = async (recreate?: boolean) => {
124
-
const record = editorView.state.doc.toString();
126
+
const record = editorInstance.view.state.doc.toString();
const rpc = new Client({ handler: agent()! });
···
const insertTimestamp = () => {
const timestamp = new Date().toISOString();
182
-
editorView.dispatch({
184
+
editorInstance.view.dispatch({
184
-
from: editorView.state.selection.main.head,
186
+
from: editorInstance.view.state.selection.main.head,
insert: `"${timestamp}"`,
···
setError(res.data.error);
241
-
editorView.dispatch({
243
+
editorInstance.view.dispatch({
243
-
from: editorView.state.selection.main.head,
245
+
from: editorInstance.view.state.selection.main.head,
insert: JSON.stringify(res.data.blob, null, 2),
···
<div class="min-h-0 flex-1">
405
-
content={JSON.stringify(
406
-
!props.create ? props.record
407
-
: params.rkey ? placeholder()
408
-
: defaultPlaceholder(),
408
+
<div class="flex h-full items-center justify-center">
409
+
<span class="iconify lucide--loader-circle animate-spin text-xl"></span>
414
+
content={JSON.stringify(
415
+
!props.create ? props.record
416
+
: params.rkey ? placeholder()
417
+
: defaultPlaceholder(),
<div class="flex flex-col gap-2">