Strip non-essential plugins and hide nav/sidebar UI
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
37
src/App.tsx
37
src/App.tsx
@@ -1,9 +1,6 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
App as ReactEditorApp,
|
||||
blocksPlugin,
|
||||
outlinePlugin,
|
||||
} from "@reacteditor/core";
|
||||
import { useCallback, useMemo, useRef, useState } from "react";
|
||||
import { App as ReactEditorApp } from "@reacteditor/core";
|
||||
import "@reacteditor/core/react-editor.css";
|
||||
import createTailwindCdnPlugin from "@reacteditor/plugin-tailwind-cdn";
|
||||
import { mediaPlugin } from "@reacteditor/plugin-media";
|
||||
import "@reacteditor/plugin-media/styles.css";
|
||||
@@ -42,12 +39,6 @@ export default function App() {
|
||||
latestDataRef.current = data;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const onPop = () => setCurrentPath(readPathname());
|
||||
window.addEventListener("popstate", onPop);
|
||||
return () => window.removeEventListener("popstate", onPop);
|
||||
}, []);
|
||||
|
||||
const config = useMemo(
|
||||
() =>
|
||||
createConfig({
|
||||
@@ -70,26 +61,7 @@ export default function App() {
|
||||
}, []);
|
||||
|
||||
const plugins = useMemo(
|
||||
() => [
|
||||
aiPlugin({
|
||||
api: "https://www.frontend-ai.com/cloud/api/chat",
|
||||
headers: { "X-Api-Key": AI_API_KEY },
|
||||
getCurrentRoute: () => ({ path: window.location.pathname }),
|
||||
onFinish: (output: any) => {
|
||||
if (output?.finishReason === "stop") {
|
||||
console.log(output);
|
||||
handlePublish(latestDataRef.current, currentPath);
|
||||
}
|
||||
},
|
||||
}),
|
||||
createTailwindCdnPlugin(),
|
||||
blocksPlugin(),
|
||||
outlinePlugin(),
|
||||
mediaPlugin({
|
||||
adapter: frontendAiMediaAdapter,
|
||||
showSearch: true,
|
||||
}),
|
||||
],
|
||||
() => [createTailwindCdnPlugin()],
|
||||
[pages, currentPath, handlePublish],
|
||||
);
|
||||
|
||||
@@ -102,6 +74,7 @@ export default function App() {
|
||||
currentPath={currentPath}
|
||||
plugins={plugins}
|
||||
iframe={{ enabled: true }}
|
||||
ui={{ navBarVisible: false, leftSideBarVisible: false }}
|
||||
onPublish={handlePublish}
|
||||
onChange={handleChange}
|
||||
overrides={{
|
||||
|
||||
Reference in New Issue
Block a user