diff --git a/package.json b/package.json index eac5c5f..47f7ad3 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@radix-ui/react-switch": "^1.2.5", "@radix-ui/react-tabs": "^1.1.12", "@radix-ui/react-tooltip": "^1.2.7", - "@reacteditor/core": "0.0.10", + "@reacteditor/core": "0.0.12", "@reacteditor/field-google-fonts": "^0.0.1", "@reacteditor/field-shopify": "^0.0.1", "@reacteditor/plugin-ai": "^0.0.4", diff --git a/src/App.tsx b/src/App.tsx index 0a5322b..3f71fd7 100644 --- a/src/App.tsx +++ b/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={{ diff --git a/yarn.lock b/yarn.lock index bfb34be..4671849 100644 --- a/yarn.lock +++ b/yarn.lock @@ -981,10 +981,10 @@ resolved "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.1.1.tgz#78244efe12930c56fd255d7923865857c41ac8cb" integrity sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw== -"@reacteditor/core@0.0.10": - version "0.0.10" - resolved "https://registry.yarnpkg.com/@reacteditor/core/-/core-0.0.10.tgz#7396295389f8f97d26e700a8dec9a8f56b9add31" - integrity sha512-/GZy27jN9rZZYy5YiapmCo1cr3F4tjiWLTsbsgFj22MG0ZIp6xN7qlB8Yhzfkp3UzJRPTuggXq/l5T5I2lgq9Q== +"@reacteditor/core@0.0.12": + version "0.0.12" + resolved "https://registry.yarnpkg.com/@reacteditor/core/-/core-0.0.12.tgz#682b660abc5dd74e805eb959aa9e983efe9ff74f" + integrity sha512-kgdVkz4/27t67+yFvu9aElN85O2XLfFWTp05gRDXlWCjy7ChBx5t0N7Q7ogMP7kw4ckoBh3aNtB1Nl0lfW/vkg== dependencies: "@base-ui/react" "^1.4.1" "@dnd-kit/abstract" "0.4.0"