diff --git a/docs/app/portal/page.tsx b/docs/app/portal/page.tsx deleted file mode 100644 index c93f41baff..0000000000 --- a/docs/app/portal/page.tsx +++ /dev/null @@ -1,19 +0,0 @@ -"use client"; - -import { useSession } from "@/util/auth-client"; - -// Just shows session info -export default function Me() { - const { data: session } = useSession(); - - if (!session) { - return
Not authenticated
; - } - - return ( -
-

Welcome {session.user.name}

-
{JSON.stringify(session, null, 2)}
-
- ); -} diff --git a/docs/components/pages/thanks/index.tsx b/docs/components/pages/thanks/index.tsx deleted file mode 100644 index b30478a231..0000000000 --- a/docs/components/pages/thanks/index.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function Thanks() { - return
Thanks
; -} diff --git a/examples/.eslintrc.js b/examples/.eslintrc.js new file mode 100644 index 0000000000..c78910b8b6 --- /dev/null +++ b/examples/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ["../.eslintrc.js"], + rules: { + "import/extensions": "off", + }, +}; diff --git a/examples/01-basic/01-minimal/main.tsx b/examples/01-basic/01-minimal/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/01-minimal/main.tsx +++ b/examples/01-basic/01-minimal/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/01-minimal/App.tsx b/examples/01-basic/01-minimal/src/App.tsx similarity index 100% rename from examples/01-basic/01-minimal/App.tsx rename to examples/01-basic/01-minimal/src/App.tsx diff --git a/examples/01-basic/02-block-objects/main.tsx b/examples/01-basic/02-block-objects/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/02-block-objects/main.tsx +++ b/examples/01-basic/02-block-objects/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/02-block-objects/App.tsx b/examples/01-basic/02-block-objects/src/App.tsx similarity index 100% rename from examples/01-basic/02-block-objects/App.tsx rename to examples/01-basic/02-block-objects/src/App.tsx diff --git a/examples/01-basic/02-block-objects/styles.css b/examples/01-basic/02-block-objects/src/styles.css similarity index 100% rename from examples/01-basic/02-block-objects/styles.css rename to examples/01-basic/02-block-objects/src/styles.css diff --git a/examples/01-basic/03-multi-column/main.tsx b/examples/01-basic/03-multi-column/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/03-multi-column/main.tsx +++ b/examples/01-basic/03-multi-column/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/03-multi-column/App.tsx b/examples/01-basic/03-multi-column/src/App.tsx similarity index 100% rename from examples/01-basic/03-multi-column/App.tsx rename to examples/01-basic/03-multi-column/src/App.tsx diff --git a/examples/01-basic/04-default-blocks/main.tsx b/examples/01-basic/04-default-blocks/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/04-default-blocks/main.tsx +++ b/examples/01-basic/04-default-blocks/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/04-default-blocks/App.tsx b/examples/01-basic/04-default-blocks/src/App.tsx similarity index 100% rename from examples/01-basic/04-default-blocks/App.tsx rename to examples/01-basic/04-default-blocks/src/App.tsx diff --git a/examples/01-basic/05-removing-default-blocks/main.tsx b/examples/01-basic/05-removing-default-blocks/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/05-removing-default-blocks/main.tsx +++ b/examples/01-basic/05-removing-default-blocks/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/05-removing-default-blocks/App.tsx b/examples/01-basic/05-removing-default-blocks/src/App.tsx similarity index 100% rename from examples/01-basic/05-removing-default-blocks/App.tsx rename to examples/01-basic/05-removing-default-blocks/src/App.tsx diff --git a/examples/01-basic/06-block-manipulation/main.tsx b/examples/01-basic/06-block-manipulation/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/06-block-manipulation/main.tsx +++ b/examples/01-basic/06-block-manipulation/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/06-block-manipulation/App.tsx b/examples/01-basic/06-block-manipulation/src/App.tsx similarity index 100% rename from examples/01-basic/06-block-manipulation/App.tsx rename to examples/01-basic/06-block-manipulation/src/App.tsx diff --git a/examples/01-basic/06-block-manipulation/styles.css b/examples/01-basic/06-block-manipulation/src/styles.css similarity index 100% rename from examples/01-basic/06-block-manipulation/styles.css rename to examples/01-basic/06-block-manipulation/src/styles.css diff --git a/examples/01-basic/07-selection-blocks/main.tsx b/examples/01-basic/07-selection-blocks/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/07-selection-blocks/main.tsx +++ b/examples/01-basic/07-selection-blocks/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/07-selection-blocks/App.tsx b/examples/01-basic/07-selection-blocks/src/App.tsx similarity index 100% rename from examples/01-basic/07-selection-blocks/App.tsx rename to examples/01-basic/07-selection-blocks/src/App.tsx diff --git a/examples/01-basic/07-selection-blocks/styles.css b/examples/01-basic/07-selection-blocks/src/styles.css similarity index 100% rename from examples/01-basic/07-selection-blocks/styles.css rename to examples/01-basic/07-selection-blocks/src/styles.css diff --git a/examples/01-basic/08-ariakit/main.tsx b/examples/01-basic/08-ariakit/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/08-ariakit/main.tsx +++ b/examples/01-basic/08-ariakit/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/08-ariakit/App.tsx b/examples/01-basic/08-ariakit/src/App.tsx similarity index 100% rename from examples/01-basic/08-ariakit/App.tsx rename to examples/01-basic/08-ariakit/src/App.tsx diff --git a/examples/01-basic/09-shadcn/main.tsx b/examples/01-basic/09-shadcn/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/09-shadcn/main.tsx +++ b/examples/01-basic/09-shadcn/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/09-shadcn/App.tsx b/examples/01-basic/09-shadcn/src/App.tsx similarity index 100% rename from examples/01-basic/09-shadcn/App.tsx rename to examples/01-basic/09-shadcn/src/App.tsx diff --git a/examples/01-basic/10-localization/main.tsx b/examples/01-basic/10-localization/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/10-localization/main.tsx +++ b/examples/01-basic/10-localization/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/10-localization/App.tsx b/examples/01-basic/10-localization/src/App.tsx similarity index 100% rename from examples/01-basic/10-localization/App.tsx rename to examples/01-basic/10-localization/src/App.tsx diff --git a/examples/01-basic/11-custom-placeholder/main.tsx b/examples/01-basic/11-custom-placeholder/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/11-custom-placeholder/main.tsx +++ b/examples/01-basic/11-custom-placeholder/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/11-custom-placeholder/App.tsx b/examples/01-basic/11-custom-placeholder/src/App.tsx similarity index 100% rename from examples/01-basic/11-custom-placeholder/App.tsx rename to examples/01-basic/11-custom-placeholder/src/App.tsx diff --git a/examples/01-basic/12-multi-editor/main.tsx b/examples/01-basic/12-multi-editor/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/12-multi-editor/main.tsx +++ b/examples/01-basic/12-multi-editor/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/12-multi-editor/App.tsx b/examples/01-basic/12-multi-editor/src/App.tsx similarity index 100% rename from examples/01-basic/12-multi-editor/App.tsx rename to examples/01-basic/12-multi-editor/src/App.tsx diff --git a/examples/01-basic/13-custom-paste-handler/main.tsx b/examples/01-basic/13-custom-paste-handler/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/13-custom-paste-handler/main.tsx +++ b/examples/01-basic/13-custom-paste-handler/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/13-custom-paste-handler/App.tsx b/examples/01-basic/13-custom-paste-handler/src/App.tsx similarity index 100% rename from examples/01-basic/13-custom-paste-handler/App.tsx rename to examples/01-basic/13-custom-paste-handler/src/App.tsx diff --git a/examples/01-basic/13-custom-paste-handler/styles.css b/examples/01-basic/13-custom-paste-handler/src/styles.css similarity index 100% rename from examples/01-basic/13-custom-paste-handler/styles.css rename to examples/01-basic/13-custom-paste-handler/src/styles.css diff --git a/examples/01-basic/testing/main.tsx b/examples/01-basic/testing/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/01-basic/testing/main.tsx +++ b/examples/01-basic/testing/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/01-basic/testing/App.tsx b/examples/01-basic/testing/src/App.tsx similarity index 100% rename from examples/01-basic/testing/App.tsx rename to examples/01-basic/testing/src/App.tsx diff --git a/examples/02-backend/01-file-uploading/main.tsx b/examples/02-backend/01-file-uploading/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/02-backend/01-file-uploading/main.tsx +++ b/examples/02-backend/01-file-uploading/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/02-backend/01-file-uploading/App.tsx b/examples/02-backend/01-file-uploading/src/App.tsx similarity index 100% rename from examples/02-backend/01-file-uploading/App.tsx rename to examples/02-backend/01-file-uploading/src/App.tsx diff --git a/examples/02-backend/02-saving-loading/main.tsx b/examples/02-backend/02-saving-loading/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/02-backend/02-saving-loading/main.tsx +++ b/examples/02-backend/02-saving-loading/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/02-backend/02-saving-loading/App.tsx b/examples/02-backend/02-saving-loading/src/App.tsx similarity index 100% rename from examples/02-backend/02-saving-loading/App.tsx rename to examples/02-backend/02-saving-loading/src/App.tsx diff --git a/examples/02-backend/03-s3/main.tsx b/examples/02-backend/03-s3/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/02-backend/03-s3/main.tsx +++ b/examples/02-backend/03-s3/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/02-backend/03-s3/App.tsx b/examples/02-backend/03-s3/src/App.tsx similarity index 100% rename from examples/02-backend/03-s3/App.tsx rename to examples/02-backend/03-s3/src/App.tsx diff --git a/examples/02-backend/04-rendering-static-documents/main.tsx b/examples/02-backend/04-rendering-static-documents/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/02-backend/04-rendering-static-documents/main.tsx +++ b/examples/02-backend/04-rendering-static-documents/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/02-backend/04-rendering-static-documents/App.tsx b/examples/02-backend/04-rendering-static-documents/src/App.tsx similarity index 100% rename from examples/02-backend/04-rendering-static-documents/App.tsx rename to examples/02-backend/04-rendering-static-documents/src/App.tsx diff --git a/examples/03-ui-components/01-ui-elements-remove/main.tsx b/examples/03-ui-components/01-ui-elements-remove/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/01-ui-elements-remove/main.tsx +++ b/examples/03-ui-components/01-ui-elements-remove/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/01-ui-elements-remove/App.tsx b/examples/03-ui-components/01-ui-elements-remove/src/App.tsx similarity index 100% rename from examples/03-ui-components/01-ui-elements-remove/App.tsx rename to examples/03-ui-components/01-ui-elements-remove/src/App.tsx diff --git a/examples/03-ui-components/02-formatting-toolbar-buttons/main.tsx b/examples/03-ui-components/02-formatting-toolbar-buttons/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/02-formatting-toolbar-buttons/main.tsx +++ b/examples/03-ui-components/02-formatting-toolbar-buttons/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/02-formatting-toolbar-buttons/App.tsx b/examples/03-ui-components/02-formatting-toolbar-buttons/src/App.tsx similarity index 98% rename from examples/03-ui-components/02-formatting-toolbar-buttons/App.tsx rename to examples/03-ui-components/02-formatting-toolbar-buttons/src/App.tsx index aa8e5b9f92..92c4b48073 100644 --- a/examples/03-ui-components/02-formatting-toolbar-buttons/App.tsx +++ b/examples/03-ui-components/02-formatting-toolbar-buttons/src/App.tsx @@ -16,7 +16,7 @@ import { useCreateBlockNote, } from "@blocknote/react"; -import { BlueButton } from "./BlueButton.js"; +import { BlueButton } from "./BlueButton"; export default function App() { // Creates a new editor instance. diff --git a/examples/03-ui-components/02-formatting-toolbar-buttons/BlueButton.tsx b/examples/03-ui-components/02-formatting-toolbar-buttons/src/BlueButton.tsx similarity index 100% rename from examples/03-ui-components/02-formatting-toolbar-buttons/BlueButton.tsx rename to examples/03-ui-components/02-formatting-toolbar-buttons/src/BlueButton.tsx diff --git a/examples/03-ui-components/03-formatting-toolbar-block-type-items/main.tsx b/examples/03-ui-components/03-formatting-toolbar-block-type-items/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/03-formatting-toolbar-block-type-items/main.tsx +++ b/examples/03-ui-components/03-formatting-toolbar-block-type-items/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/03-formatting-toolbar-block-type-items/Alert.tsx b/examples/03-ui-components/03-formatting-toolbar-block-type-items/src/Alert.tsx similarity index 100% rename from examples/03-ui-components/03-formatting-toolbar-block-type-items/Alert.tsx rename to examples/03-ui-components/03-formatting-toolbar-block-type-items/src/Alert.tsx diff --git a/examples/03-ui-components/03-formatting-toolbar-block-type-items/App.tsx b/examples/03-ui-components/03-formatting-toolbar-block-type-items/src/App.tsx similarity index 98% rename from examples/03-ui-components/03-formatting-toolbar-block-type-items/App.tsx rename to examples/03-ui-components/03-formatting-toolbar-block-type-items/src/App.tsx index e46bbeb631..299a942376 100644 --- a/examples/03-ui-components/03-formatting-toolbar-block-type-items/App.tsx +++ b/examples/03-ui-components/03-formatting-toolbar-block-type-items/src/App.tsx @@ -11,7 +11,7 @@ import { } from "@blocknote/react"; import { RiAlertFill } from "react-icons/ri"; -import { Alert } from "./Alert.js"; +import { Alert } from "./Alert"; // Our schema with block specs, which contain the configs and implementations for // blocks that we want our editor to use. diff --git a/examples/03-ui-components/03-formatting-toolbar-block-type-items/styles.css b/examples/03-ui-components/03-formatting-toolbar-block-type-items/src/styles.css similarity index 100% rename from examples/03-ui-components/03-formatting-toolbar-block-type-items/styles.css rename to examples/03-ui-components/03-formatting-toolbar-block-type-items/src/styles.css diff --git a/examples/03-ui-components/04-side-menu-buttons/main.tsx b/examples/03-ui-components/04-side-menu-buttons/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/04-side-menu-buttons/main.tsx +++ b/examples/03-ui-components/04-side-menu-buttons/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/04-side-menu-buttons/App.tsx b/examples/03-ui-components/04-side-menu-buttons/src/App.tsx similarity index 94% rename from examples/03-ui-components/04-side-menu-buttons/App.tsx rename to examples/03-ui-components/04-side-menu-buttons/src/App.tsx index 445b2daba9..8661c08baa 100644 --- a/examples/03-ui-components/04-side-menu-buttons/App.tsx +++ b/examples/03-ui-components/04-side-menu-buttons/src/App.tsx @@ -8,7 +8,7 @@ import { useCreateBlockNote, } from "@blocknote/react"; -import { RemoveBlockButton } from "./RemoveBlockButton.js"; +import { RemoveBlockButton } from "./RemoveBlockButton"; export default function App() { // Creates a new editor instance. diff --git a/examples/03-ui-components/04-side-menu-buttons/RemoveBlockButton.tsx b/examples/03-ui-components/04-side-menu-buttons/src/RemoveBlockButton.tsx similarity index 100% rename from examples/03-ui-components/04-side-menu-buttons/RemoveBlockButton.tsx rename to examples/03-ui-components/04-side-menu-buttons/src/RemoveBlockButton.tsx diff --git a/examples/03-ui-components/05-side-menu-drag-handle-items/main.tsx b/examples/03-ui-components/05-side-menu-drag-handle-items/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/05-side-menu-drag-handle-items/main.tsx +++ b/examples/03-ui-components/05-side-menu-drag-handle-items/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/05-side-menu-drag-handle-items/App.tsx b/examples/03-ui-components/05-side-menu-drag-handle-items/src/App.tsx similarity index 96% rename from examples/03-ui-components/05-side-menu-drag-handle-items/App.tsx rename to examples/03-ui-components/05-side-menu-drag-handle-items/src/App.tsx index d469349206..88d82aad2d 100644 --- a/examples/03-ui-components/05-side-menu-drag-handle-items/App.tsx +++ b/examples/03-ui-components/05-side-menu-drag-handle-items/src/App.tsx @@ -11,7 +11,7 @@ import { useCreateBlockNote, } from "@blocknote/react"; -import { ResetBlockTypeItem } from "./ResetBlockTypeItem.js"; +import { ResetBlockTypeItem } from "./ResetBlockTypeItem"; // To avoid rendering issues, it's good practice to define your custom drag // handle menu in a separate component, instead of inline within the `sideMenu` diff --git a/examples/03-ui-components/05-side-menu-drag-handle-items/ResetBlockTypeItem.tsx b/examples/03-ui-components/05-side-menu-drag-handle-items/src/ResetBlockTypeItem.tsx similarity index 100% rename from examples/03-ui-components/05-side-menu-drag-handle-items/ResetBlockTypeItem.tsx rename to examples/03-ui-components/05-side-menu-drag-handle-items/src/ResetBlockTypeItem.tsx diff --git a/examples/03-ui-components/06-suggestion-menus-slash-menu-items/main.tsx b/examples/03-ui-components/06-suggestion-menus-slash-menu-items/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/06-suggestion-menus-slash-menu-items/main.tsx +++ b/examples/03-ui-components/06-suggestion-menus-slash-menu-items/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/06-suggestion-menus-slash-menu-items/App.tsx b/examples/03-ui-components/06-suggestion-menus-slash-menu-items/src/App.tsx similarity index 100% rename from examples/03-ui-components/06-suggestion-menus-slash-menu-items/App.tsx rename to examples/03-ui-components/06-suggestion-menus-slash-menu-items/src/App.tsx diff --git a/examples/03-ui-components/07-suggestion-menus-slash-menu-component/main.tsx b/examples/03-ui-components/07-suggestion-menus-slash-menu-component/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/07-suggestion-menus-slash-menu-component/main.tsx +++ b/examples/03-ui-components/07-suggestion-menus-slash-menu-component/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/07-suggestion-menus-slash-menu-component/App.tsx b/examples/03-ui-components/07-suggestion-menus-slash-menu-component/src/App.tsx similarity index 100% rename from examples/03-ui-components/07-suggestion-menus-slash-menu-component/App.tsx rename to examples/03-ui-components/07-suggestion-menus-slash-menu-component/src/App.tsx diff --git a/examples/03-ui-components/07-suggestion-menus-slash-menu-component/styles.css b/examples/03-ui-components/07-suggestion-menus-slash-menu-component/src/styles.css similarity index 100% rename from examples/03-ui-components/07-suggestion-menus-slash-menu-component/styles.css rename to examples/03-ui-components/07-suggestion-menus-slash-menu-component/src/styles.css diff --git a/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/main.tsx b/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/main.tsx +++ b/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/App.tsx b/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/src/App.tsx similarity index 100% rename from examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/App.tsx rename to examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/src/App.tsx diff --git a/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/main.tsx b/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/main.tsx +++ b/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/App.tsx b/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/src/App.tsx similarity index 100% rename from examples/03-ui-components/09-suggestion-menus-emoji-picker-component/App.tsx rename to examples/03-ui-components/09-suggestion-menus-emoji-picker-component/src/App.tsx diff --git a/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/styles.css b/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/src/styles.css similarity index 100% rename from examples/03-ui-components/09-suggestion-menus-emoji-picker-component/styles.css rename to examples/03-ui-components/09-suggestion-menus-emoji-picker-component/src/styles.css diff --git a/examples/03-ui-components/10-suggestion-menus-grid-mentions/main.tsx b/examples/03-ui-components/10-suggestion-menus-grid-mentions/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/10-suggestion-menus-grid-mentions/main.tsx +++ b/examples/03-ui-components/10-suggestion-menus-grid-mentions/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/10-suggestion-menus-grid-mentions/App.tsx b/examples/03-ui-components/10-suggestion-menus-grid-mentions/src/App.tsx similarity index 98% rename from examples/03-ui-components/10-suggestion-menus-grid-mentions/App.tsx rename to examples/03-ui-components/10-suggestion-menus-grid-mentions/src/App.tsx index 38c62d9730..333c645135 100644 --- a/examples/03-ui-components/10-suggestion-menus-grid-mentions/App.tsx +++ b/examples/03-ui-components/10-suggestion-menus-grid-mentions/src/App.tsx @@ -12,7 +12,7 @@ import { useCreateBlockNote, } from "@blocknote/react"; -import { Mention } from "./Mention.js"; +import { Mention } from "./Mention"; // Our schema with inline content specs, which contain the configs and // implementations for inline content that we want our editor to use. diff --git a/examples/03-ui-components/10-suggestion-menus-grid-mentions/Mention.tsx b/examples/03-ui-components/10-suggestion-menus-grid-mentions/src/Mention.tsx similarity index 100% rename from examples/03-ui-components/10-suggestion-menus-grid-mentions/Mention.tsx rename to examples/03-ui-components/10-suggestion-menus-grid-mentions/src/Mention.tsx diff --git a/examples/03-ui-components/11-uppy-file-panel/main.tsx b/examples/03-ui-components/11-uppy-file-panel/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/11-uppy-file-panel/main.tsx +++ b/examples/03-ui-components/11-uppy-file-panel/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/11-uppy-file-panel/App.tsx b/examples/03-ui-components/11-uppy-file-panel/src/App.tsx similarity index 92% rename from examples/03-ui-components/11-uppy-file-panel/App.tsx rename to examples/03-ui-components/11-uppy-file-panel/src/App.tsx index 466c5e024c..8f4ed37a5b 100644 --- a/examples/03-ui-components/11-uppy-file-panel/App.tsx +++ b/examples/03-ui-components/11-uppy-file-panel/src/App.tsx @@ -9,8 +9,8 @@ import { useCreateBlockNote, } from "@blocknote/react"; -import { FileReplaceButton } from "./FileReplaceButton.js"; -import { uploadFile, UppyFilePanel } from "./UppyFilePanel.js"; +import { FileReplaceButton } from "./FileReplaceButton"; +import { uploadFile, UppyFilePanel } from "./UppyFilePanel"; export default function App() { // Creates a new editor instance. diff --git a/examples/03-ui-components/11-uppy-file-panel/FileReplaceButton.tsx b/examples/03-ui-components/11-uppy-file-panel/src/FileReplaceButton.tsx similarity index 97% rename from examples/03-ui-components/11-uppy-file-panel/FileReplaceButton.tsx rename to examples/03-ui-components/11-uppy-file-panel/src/FileReplaceButton.tsx index e498b374cf..48e32a2b01 100644 --- a/examples/03-ui-components/11-uppy-file-panel/FileReplaceButton.tsx +++ b/examples/03-ui-components/11-uppy-file-panel/src/FileReplaceButton.tsx @@ -14,7 +14,7 @@ import { useEffect, useState } from "react"; import { RiImageEditFill } from "react-icons/ri"; -import { UppyFilePanel } from "./UppyFilePanel.js"; +import { UppyFilePanel } from "./UppyFilePanel"; // Copied with minor changes from: // https://github.com/TypeCellOS/BlockNote/blob/main/packages/react/src/components/FormattingToolbar/DefaultButtons/FileReplaceButton.tsx diff --git a/examples/03-ui-components/11-uppy-file-panel/UppyFilePanel.tsx b/examples/03-ui-components/11-uppy-file-panel/src/UppyFilePanel.tsx similarity index 100% rename from examples/03-ui-components/11-uppy-file-panel/UppyFilePanel.tsx rename to examples/03-ui-components/11-uppy-file-panel/src/UppyFilePanel.tsx diff --git a/examples/03-ui-components/12-static-formatting-toolbar/main.tsx b/examples/03-ui-components/12-static-formatting-toolbar/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/12-static-formatting-toolbar/main.tsx +++ b/examples/03-ui-components/12-static-formatting-toolbar/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/12-static-formatting-toolbar/App.tsx b/examples/03-ui-components/12-static-formatting-toolbar/src/App.tsx similarity index 100% rename from examples/03-ui-components/12-static-formatting-toolbar/App.tsx rename to examples/03-ui-components/12-static-formatting-toolbar/src/App.tsx diff --git a/examples/03-ui-components/12-static-formatting-toolbar/style.css b/examples/03-ui-components/12-static-formatting-toolbar/src/style.css similarity index 100% rename from examples/03-ui-components/12-static-formatting-toolbar/style.css rename to examples/03-ui-components/12-static-formatting-toolbar/src/style.css diff --git a/examples/03-ui-components/13-custom-ui/main.tsx b/examples/03-ui-components/13-custom-ui/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/13-custom-ui/main.tsx +++ b/examples/03-ui-components/13-custom-ui/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/13-custom-ui/App.tsx b/examples/03-ui-components/13-custom-ui/src/App.tsx similarity index 94% rename from examples/03-ui-components/13-custom-ui/App.tsx rename to examples/03-ui-components/13-custom-ui/src/App.tsx index d35ee2380a..4fe6427ded 100644 --- a/examples/03-ui-components/13-custom-ui/App.tsx +++ b/examples/03-ui-components/13-custom-ui/src/App.tsx @@ -11,10 +11,10 @@ import "@blocknote/react/style.css"; import { createTheme, ThemeProvider, useMediaQuery } from "@mui/material"; import { useMemo } from "react"; -import { schema } from "./schema.js"; -import { CustomMUIFormattingToolbar } from "./MUIFormattingToolbar.js"; -import { CustomMUISideMenu } from "./MUISideMenu.js"; -import { MUISuggestionMenu } from "./MUISuggestionMenu.js"; +import { schema } from "./schema"; +import { CustomMUIFormattingToolbar } from "./MUIFormattingToolbar"; +import { CustomMUISideMenu } from "./MUISideMenu"; +import { MUISuggestionMenu } from "./MUISuggestionMenu"; import "./style.css"; diff --git a/examples/03-ui-components/13-custom-ui/MUIFormattingToolbar.tsx b/examples/03-ui-components/13-custom-ui/src/MUIFormattingToolbar.tsx similarity index 99% rename from examples/03-ui-components/13-custom-ui/MUIFormattingToolbar.tsx rename to examples/03-ui-components/13-custom-ui/src/MUIFormattingToolbar.tsx index d1afb85a52..1abb598933 100644 --- a/examples/03-ui-components/13-custom-ui/MUIFormattingToolbar.tsx +++ b/examples/03-ui-components/13-custom-ui/src/MUIFormattingToolbar.tsx @@ -42,7 +42,7 @@ import { ReactNode, } from "react"; -import { TextBlockSchema } from "./schema.js"; +import { TextBlockSchema } from "./schema"; // This replaces the generic Mantine `ToolbarSelect` component with a simplified // MUI version: diff --git a/examples/03-ui-components/13-custom-ui/MUISideMenu.tsx b/examples/03-ui-components/13-custom-ui/src/MUISideMenu.tsx similarity index 99% rename from examples/03-ui-components/13-custom-ui/MUISideMenu.tsx rename to examples/03-ui-components/13-custom-ui/src/MUISideMenu.tsx index cafd4628a6..8f42580c1f 100644 --- a/examples/03-ui-components/13-custom-ui/MUISideMenu.tsx +++ b/examples/03-ui-components/13-custom-ui/src/MUISideMenu.tsx @@ -11,7 +11,7 @@ import { } from "@mui/material"; import { MouseEvent, ReactNode, useCallback, useMemo, useState } from "react"; -import { TextBlockSchema } from "./schema.js"; +import { TextBlockSchema } from "./schema"; // This replaces the default `RemoveBlockItem` component with a simplified // MUI version: diff --git a/examples/03-ui-components/13-custom-ui/MUISuggestionMenu.tsx b/examples/03-ui-components/13-custom-ui/src/MUISuggestionMenu.tsx similarity index 99% rename from examples/03-ui-components/13-custom-ui/MUISuggestionMenu.tsx rename to examples/03-ui-components/13-custom-ui/src/MUISuggestionMenu.tsx index 9532992ec8..13b7efedf1 100644 --- a/examples/03-ui-components/13-custom-ui/MUISuggestionMenu.tsx +++ b/examples/03-ui-components/13-custom-ui/src/MUISuggestionMenu.tsx @@ -16,7 +16,7 @@ import { } from "@mui/material"; import { useEffect, useMemo, useRef } from "react"; -import { TextBlockSchema } from "./schema.js"; +import { TextBlockSchema } from "./schema"; // If you want to change the items in a Suggestion Menu, like the Slash Menu, // you don't need to modify any of the components in this file. Instead, you diff --git a/examples/03-ui-components/13-custom-ui/schema.ts b/examples/03-ui-components/13-custom-ui/src/schema.ts similarity index 100% rename from examples/03-ui-components/13-custom-ui/schema.ts rename to examples/03-ui-components/13-custom-ui/src/schema.ts diff --git a/examples/03-ui-components/13-custom-ui/style.css b/examples/03-ui-components/13-custom-ui/src/style.css similarity index 100% rename from examples/03-ui-components/13-custom-ui/style.css rename to examples/03-ui-components/13-custom-ui/src/style.css diff --git a/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/main.tsx b/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/main.tsx +++ b/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/App.tsx b/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/src/App.tsx similarity index 100% rename from examples/03-ui-components/14-experimental-mobile-formatting-toolbar/App.tsx rename to examples/03-ui-components/14-experimental-mobile-formatting-toolbar/src/App.tsx diff --git a/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/style.css b/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/src/style.css similarity index 100% rename from examples/03-ui-components/14-experimental-mobile-formatting-toolbar/style.css rename to examples/03-ui-components/14-experimental-mobile-formatting-toolbar/src/style.css diff --git a/examples/03-ui-components/15-advanced-tables/main.tsx b/examples/03-ui-components/15-advanced-tables/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/15-advanced-tables/main.tsx +++ b/examples/03-ui-components/15-advanced-tables/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/15-advanced-tables/App.tsx b/examples/03-ui-components/15-advanced-tables/src/App.tsx similarity index 100% rename from examples/03-ui-components/15-advanced-tables/App.tsx rename to examples/03-ui-components/15-advanced-tables/src/App.tsx diff --git a/examples/03-ui-components/link-toolbar-buttons/main.tsx b/examples/03-ui-components/link-toolbar-buttons/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/03-ui-components/link-toolbar-buttons/main.tsx +++ b/examples/03-ui-components/link-toolbar-buttons/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/03-ui-components/link-toolbar-buttons/AlertButton.tsx b/examples/03-ui-components/link-toolbar-buttons/src/AlertButton.tsx similarity index 100% rename from examples/03-ui-components/link-toolbar-buttons/AlertButton.tsx rename to examples/03-ui-components/link-toolbar-buttons/src/AlertButton.tsx diff --git a/examples/03-ui-components/link-toolbar-buttons/App.tsx b/examples/03-ui-components/link-toolbar-buttons/src/App.tsx similarity index 96% rename from examples/03-ui-components/link-toolbar-buttons/App.tsx rename to examples/03-ui-components/link-toolbar-buttons/src/App.tsx index 27a3fdb1e8..23e9902f85 100644 --- a/examples/03-ui-components/link-toolbar-buttons/App.tsx +++ b/examples/03-ui-components/link-toolbar-buttons/src/App.tsx @@ -7,7 +7,7 @@ import { useCreateBlockNote, } from "@blocknote/react"; -import { AlertButton } from "./AlertButton.js"; +import { AlertButton } from "./AlertButton"; export default function App() { // Creates a new editor instance. diff --git a/examples/04-theming/01-theming-dom-attributes/main.tsx b/examples/04-theming/01-theming-dom-attributes/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/04-theming/01-theming-dom-attributes/main.tsx +++ b/examples/04-theming/01-theming-dom-attributes/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/04-theming/01-theming-dom-attributes/App.tsx b/examples/04-theming/01-theming-dom-attributes/src/App.tsx similarity index 100% rename from examples/04-theming/01-theming-dom-attributes/App.tsx rename to examples/04-theming/01-theming-dom-attributes/src/App.tsx diff --git a/examples/04-theming/01-theming-dom-attributes/styles.css b/examples/04-theming/01-theming-dom-attributes/src/styles.css similarity index 100% rename from examples/04-theming/01-theming-dom-attributes/styles.css rename to examples/04-theming/01-theming-dom-attributes/src/styles.css diff --git a/examples/04-theming/02-changing-font/main.tsx b/examples/04-theming/02-changing-font/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/04-theming/02-changing-font/main.tsx +++ b/examples/04-theming/02-changing-font/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/04-theming/02-changing-font/App.tsx b/examples/04-theming/02-changing-font/src/App.tsx similarity index 100% rename from examples/04-theming/02-changing-font/App.tsx rename to examples/04-theming/02-changing-font/src/App.tsx diff --git a/examples/04-theming/02-changing-font/styles.css b/examples/04-theming/02-changing-font/src/styles.css similarity index 100% rename from examples/04-theming/02-changing-font/styles.css rename to examples/04-theming/02-changing-font/src/styles.css diff --git a/examples/04-theming/03-theming-css/main.tsx b/examples/04-theming/03-theming-css/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/04-theming/03-theming-css/main.tsx +++ b/examples/04-theming/03-theming-css/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/04-theming/03-theming-css/App.tsx b/examples/04-theming/03-theming-css/src/App.tsx similarity index 100% rename from examples/04-theming/03-theming-css/App.tsx rename to examples/04-theming/03-theming-css/src/App.tsx diff --git a/examples/04-theming/03-theming-css/styles.css b/examples/04-theming/03-theming-css/src/styles.css similarity index 100% rename from examples/04-theming/03-theming-css/styles.css rename to examples/04-theming/03-theming-css/src/styles.css diff --git a/examples/04-theming/04-theming-css-variables/main.tsx b/examples/04-theming/04-theming-css-variables/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/04-theming/04-theming-css-variables/main.tsx +++ b/examples/04-theming/04-theming-css-variables/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/04-theming/04-theming-css-variables/App.tsx b/examples/04-theming/04-theming-css-variables/src/App.tsx similarity index 100% rename from examples/04-theming/04-theming-css-variables/App.tsx rename to examples/04-theming/04-theming-css-variables/src/App.tsx diff --git a/examples/04-theming/04-theming-css-variables/styles.css b/examples/04-theming/04-theming-css-variables/src/styles.css similarity index 100% rename from examples/04-theming/04-theming-css-variables/styles.css rename to examples/04-theming/04-theming-css-variables/src/styles.css diff --git a/examples/04-theming/05-theming-css-variables-code/main.tsx b/examples/04-theming/05-theming-css-variables-code/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/04-theming/05-theming-css-variables-code/main.tsx +++ b/examples/04-theming/05-theming-css-variables-code/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/04-theming/05-theming-css-variables-code/App.tsx b/examples/04-theming/05-theming-css-variables-code/src/App.tsx similarity index 100% rename from examples/04-theming/05-theming-css-variables-code/App.tsx rename to examples/04-theming/05-theming-css-variables-code/src/App.tsx diff --git a/examples/04-theming/06-code-block/main.tsx b/examples/04-theming/06-code-block/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/04-theming/06-code-block/main.tsx +++ b/examples/04-theming/06-code-block/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/04-theming/06-code-block/App.tsx b/examples/04-theming/06-code-block/src/App.tsx similarity index 100% rename from examples/04-theming/06-code-block/App.tsx rename to examples/04-theming/06-code-block/src/App.tsx diff --git a/examples/04-theming/07-custom-code-block/README.md b/examples/04-theming/07-custom-code-block/README.md index 5401f022e7..016adf56e5 100644 --- a/examples/04-theming/07-custom-code-block/README.md +++ b/examples/04-theming/07-custom-code-block/README.md @@ -17,7 +17,7 @@ This will generate a `shiki.bundle.ts` file that you can use to create a syntax Like this: ```ts -import { createHighlighter } from "./shiki.bundle.js"; +import { createHighlighter } from "./shiki.bundle"; export default function App() { // Creates a new editor instance. diff --git a/examples/04-theming/07-custom-code-block/main.tsx b/examples/04-theming/07-custom-code-block/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/04-theming/07-custom-code-block/main.tsx +++ b/examples/04-theming/07-custom-code-block/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/04-theming/07-custom-code-block/App.tsx b/examples/04-theming/07-custom-code-block/src/App.tsx similarity index 97% rename from examples/04-theming/07-custom-code-block/App.tsx rename to examples/04-theming/07-custom-code-block/src/App.tsx index d6677aa707..e237854175 100644 --- a/examples/04-theming/07-custom-code-block/App.tsx +++ b/examples/04-theming/07-custom-code-block/src/App.tsx @@ -3,7 +3,7 @@ import { BlockNoteView } from "@blocknote/mantine"; import "@blocknote/mantine/style.css"; import { useCreateBlockNote } from "@blocknote/react"; // Bundle created from `npx shiki-codegen --langs typescript,javascript,react --themes light-plus,dark-plus --engine javascript --precompiled ./shiki.bundle.ts` -import { createHighlighter } from "./shiki.bundle.js"; +import { createHighlighter } from "./shiki.bundle"; export default function App() { // Creates a new editor instance. diff --git a/examples/04-theming/07-custom-code-block/shiki.bundle.ts b/examples/04-theming/07-custom-code-block/src/shiki.bundle.ts similarity index 100% rename from examples/04-theming/07-custom-code-block/shiki.bundle.ts rename to examples/04-theming/07-custom-code-block/src/shiki.bundle.ts diff --git a/examples/05-interoperability/01-converting-blocks-to-html/main.tsx b/examples/05-interoperability/01-converting-blocks-to-html/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/05-interoperability/01-converting-blocks-to-html/main.tsx +++ b/examples/05-interoperability/01-converting-blocks-to-html/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/05-interoperability/01-converting-blocks-to-html/App.tsx b/examples/05-interoperability/01-converting-blocks-to-html/src/App.tsx similarity index 100% rename from examples/05-interoperability/01-converting-blocks-to-html/App.tsx rename to examples/05-interoperability/01-converting-blocks-to-html/src/App.tsx diff --git a/examples/05-interoperability/01-converting-blocks-to-html/styles.css b/examples/05-interoperability/01-converting-blocks-to-html/src/styles.css similarity index 100% rename from examples/05-interoperability/01-converting-blocks-to-html/styles.css rename to examples/05-interoperability/01-converting-blocks-to-html/src/styles.css diff --git a/examples/05-interoperability/02-converting-blocks-from-html/main.tsx b/examples/05-interoperability/02-converting-blocks-from-html/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/05-interoperability/02-converting-blocks-from-html/main.tsx +++ b/examples/05-interoperability/02-converting-blocks-from-html/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/05-interoperability/02-converting-blocks-from-html/App.tsx b/examples/05-interoperability/02-converting-blocks-from-html/src/App.tsx similarity index 100% rename from examples/05-interoperability/02-converting-blocks-from-html/App.tsx rename to examples/05-interoperability/02-converting-blocks-from-html/src/App.tsx diff --git a/examples/05-interoperability/02-converting-blocks-from-html/styles.css b/examples/05-interoperability/02-converting-blocks-from-html/src/styles.css similarity index 100% rename from examples/05-interoperability/02-converting-blocks-from-html/styles.css rename to examples/05-interoperability/02-converting-blocks-from-html/src/styles.css diff --git a/examples/05-interoperability/03-converting-blocks-to-md/main.tsx b/examples/05-interoperability/03-converting-blocks-to-md/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/05-interoperability/03-converting-blocks-to-md/main.tsx +++ b/examples/05-interoperability/03-converting-blocks-to-md/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/05-interoperability/03-converting-blocks-to-md/App.tsx b/examples/05-interoperability/03-converting-blocks-to-md/src/App.tsx similarity index 100% rename from examples/05-interoperability/03-converting-blocks-to-md/App.tsx rename to examples/05-interoperability/03-converting-blocks-to-md/src/App.tsx diff --git a/examples/05-interoperability/03-converting-blocks-to-md/styles.css b/examples/05-interoperability/03-converting-blocks-to-md/src/styles.css similarity index 100% rename from examples/05-interoperability/03-converting-blocks-to-md/styles.css rename to examples/05-interoperability/03-converting-blocks-to-md/src/styles.css diff --git a/examples/05-interoperability/04-converting-blocks-from-md/main.tsx b/examples/05-interoperability/04-converting-blocks-from-md/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/05-interoperability/04-converting-blocks-from-md/main.tsx +++ b/examples/05-interoperability/04-converting-blocks-from-md/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/05-interoperability/04-converting-blocks-from-md/App.tsx b/examples/05-interoperability/04-converting-blocks-from-md/src/App.tsx similarity index 100% rename from examples/05-interoperability/04-converting-blocks-from-md/App.tsx rename to examples/05-interoperability/04-converting-blocks-from-md/src/App.tsx diff --git a/examples/05-interoperability/04-converting-blocks-from-md/styles.css b/examples/05-interoperability/04-converting-blocks-from-md/src/styles.css similarity index 100% rename from examples/05-interoperability/04-converting-blocks-from-md/styles.css rename to examples/05-interoperability/04-converting-blocks-from-md/src/styles.css diff --git a/examples/05-interoperability/05-converting-blocks-to-pdf/main.tsx b/examples/05-interoperability/05-converting-blocks-to-pdf/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/05-interoperability/05-converting-blocks-to-pdf/main.tsx +++ b/examples/05-interoperability/05-converting-blocks-to-pdf/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/05-interoperability/05-converting-blocks-to-pdf/App.tsx b/examples/05-interoperability/05-converting-blocks-to-pdf/src/App.tsx similarity index 100% rename from examples/05-interoperability/05-converting-blocks-to-pdf/App.tsx rename to examples/05-interoperability/05-converting-blocks-to-pdf/src/App.tsx diff --git a/examples/05-interoperability/05-converting-blocks-to-pdf/styles.css b/examples/05-interoperability/05-converting-blocks-to-pdf/src/styles.css similarity index 100% rename from examples/05-interoperability/05-converting-blocks-to-pdf/styles.css rename to examples/05-interoperability/05-converting-blocks-to-pdf/src/styles.css diff --git a/examples/05-interoperability/06-converting-blocks-to-docx/main.tsx b/examples/05-interoperability/06-converting-blocks-to-docx/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/05-interoperability/06-converting-blocks-to-docx/main.tsx +++ b/examples/05-interoperability/06-converting-blocks-to-docx/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/05-interoperability/06-converting-blocks-to-docx/App.tsx b/examples/05-interoperability/06-converting-blocks-to-docx/src/App.tsx similarity index 100% rename from examples/05-interoperability/06-converting-blocks-to-docx/App.tsx rename to examples/05-interoperability/06-converting-blocks-to-docx/src/App.tsx diff --git a/examples/05-interoperability/06-converting-blocks-to-docx/styles.css b/examples/05-interoperability/06-converting-blocks-to-docx/src/styles.css similarity index 100% rename from examples/05-interoperability/06-converting-blocks-to-docx/styles.css rename to examples/05-interoperability/06-converting-blocks-to-docx/src/styles.css diff --git a/examples/05-interoperability/07-converting-blocks-to-odt/main.tsx b/examples/05-interoperability/07-converting-blocks-to-odt/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/05-interoperability/07-converting-blocks-to-odt/main.tsx +++ b/examples/05-interoperability/07-converting-blocks-to-odt/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/05-interoperability/07-converting-blocks-to-odt/App.tsx b/examples/05-interoperability/07-converting-blocks-to-odt/src/App.tsx similarity index 100% rename from examples/05-interoperability/07-converting-blocks-to-odt/App.tsx rename to examples/05-interoperability/07-converting-blocks-to-odt/src/App.tsx diff --git a/examples/05-interoperability/07-converting-blocks-to-odt/styles.css b/examples/05-interoperability/07-converting-blocks-to-odt/src/styles.css similarity index 100% rename from examples/05-interoperability/07-converting-blocks-to-odt/styles.css rename to examples/05-interoperability/07-converting-blocks-to-odt/src/styles.css diff --git a/examples/06-custom-schema/01-alert-block/main.tsx b/examples/06-custom-schema/01-alert-block/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/06-custom-schema/01-alert-block/main.tsx +++ b/examples/06-custom-schema/01-alert-block/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/06-custom-schema/01-alert-block/Alert.tsx b/examples/06-custom-schema/01-alert-block/src/Alert.tsx similarity index 100% rename from examples/06-custom-schema/01-alert-block/Alert.tsx rename to examples/06-custom-schema/01-alert-block/src/Alert.tsx diff --git a/examples/06-custom-schema/01-alert-block/App.tsx b/examples/06-custom-schema/01-alert-block/src/App.tsx similarity index 96% rename from examples/06-custom-schema/01-alert-block/App.tsx rename to examples/06-custom-schema/01-alert-block/src/App.tsx index f6e8ba15c3..16950d9ecc 100644 --- a/examples/06-custom-schema/01-alert-block/App.tsx +++ b/examples/06-custom-schema/01-alert-block/src/App.tsx @@ -4,7 +4,7 @@ import { BlockNoteView } from "@blocknote/mantine"; import "@blocknote/mantine/style.css"; import { useCreateBlockNote } from "@blocknote/react"; -import { Alert } from "./Alert.js"; +import { Alert } from "./Alert"; // Our schema with block specs, which contain the configs and implementations for // blocks that we want our editor to use. diff --git a/examples/06-custom-schema/01-alert-block/styles.css b/examples/06-custom-schema/01-alert-block/src/styles.css similarity index 100% rename from examples/06-custom-schema/01-alert-block/styles.css rename to examples/06-custom-schema/01-alert-block/src/styles.css diff --git a/examples/06-custom-schema/02-suggestion-menus-mentions/main.tsx b/examples/06-custom-schema/02-suggestion-menus-mentions/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/06-custom-schema/02-suggestion-menus-mentions/main.tsx +++ b/examples/06-custom-schema/02-suggestion-menus-mentions/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/06-custom-schema/02-suggestion-menus-mentions/App.tsx b/examples/06-custom-schema/02-suggestion-menus-mentions/src/App.tsx similarity index 98% rename from examples/06-custom-schema/02-suggestion-menus-mentions/App.tsx rename to examples/06-custom-schema/02-suggestion-menus-mentions/src/App.tsx index 599950419b..82bbccdf59 100644 --- a/examples/06-custom-schema/02-suggestion-menus-mentions/App.tsx +++ b/examples/06-custom-schema/02-suggestion-menus-mentions/src/App.tsx @@ -12,7 +12,7 @@ import { useCreateBlockNote, } from "@blocknote/react"; -import { Mention } from "./Mention.js"; +import { Mention } from "./Mention"; // Our schema with inline content specs, which contain the configs and // implementations for inline content that we want our editor to use. diff --git a/examples/06-custom-schema/02-suggestion-menus-mentions/Mention.tsx b/examples/06-custom-schema/02-suggestion-menus-mentions/src/Mention.tsx similarity index 100% rename from examples/06-custom-schema/02-suggestion-menus-mentions/Mention.tsx rename to examples/06-custom-schema/02-suggestion-menus-mentions/src/Mention.tsx diff --git a/examples/06-custom-schema/03-font-style/main.tsx b/examples/06-custom-schema/03-font-style/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/06-custom-schema/03-font-style/main.tsx +++ b/examples/06-custom-schema/03-font-style/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/06-custom-schema/03-font-style/App.tsx b/examples/06-custom-schema/03-font-style/src/App.tsx similarity index 99% rename from examples/06-custom-schema/03-font-style/App.tsx rename to examples/06-custom-schema/03-font-style/src/App.tsx index ecd08a6846..4cae9935b1 100644 --- a/examples/06-custom-schema/03-font-style/App.tsx +++ b/examples/06-custom-schema/03-font-style/src/App.tsx @@ -21,7 +21,7 @@ import { import { RiText } from "react-icons/ri"; -import { Font } from "./Font.js"; +import { Font } from "./Font"; // Our schema with style specs, which contain the configs and implementations for styles // that we want our editor to use. diff --git a/examples/06-custom-schema/03-font-style/Font.tsx b/examples/06-custom-schema/03-font-style/src/Font.tsx similarity index 100% rename from examples/06-custom-schema/03-font-style/Font.tsx rename to examples/06-custom-schema/03-font-style/src/Font.tsx diff --git a/examples/06-custom-schema/04-pdf-file-block/main.tsx b/examples/06-custom-schema/04-pdf-file-block/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/06-custom-schema/04-pdf-file-block/main.tsx +++ b/examples/06-custom-schema/04-pdf-file-block/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/06-custom-schema/04-pdf-file-block/App.tsx b/examples/06-custom-schema/04-pdf-file-block/src/App.tsx similarity index 98% rename from examples/06-custom-schema/04-pdf-file-block/App.tsx rename to examples/06-custom-schema/04-pdf-file-block/src/App.tsx index 94b3567cbe..e202bf469b 100644 --- a/examples/06-custom-schema/04-pdf-file-block/App.tsx +++ b/examples/06-custom-schema/04-pdf-file-block/src/App.tsx @@ -15,7 +15,7 @@ import { import { RiFilePdfFill } from "react-icons/ri"; -import { PDF } from "./PDF.js"; +import { PDF } from "./PDF"; // Our schema with block specs, which contain the configs and implementations for blocks // that we want our editor to use. diff --git a/examples/06-custom-schema/04-pdf-file-block/PDF.tsx b/examples/06-custom-schema/04-pdf-file-block/src/PDF.tsx similarity index 100% rename from examples/06-custom-schema/04-pdf-file-block/PDF.tsx rename to examples/06-custom-schema/04-pdf-file-block/src/PDF.tsx diff --git a/examples/06-custom-schema/04-pdf-file-block/styles.css b/examples/06-custom-schema/04-pdf-file-block/src/styles.css similarity index 100% rename from examples/06-custom-schema/04-pdf-file-block/styles.css rename to examples/06-custom-schema/04-pdf-file-block/src/styles.css diff --git a/examples/06-custom-schema/05-alert-block-full-ux/main.tsx b/examples/06-custom-schema/05-alert-block-full-ux/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/06-custom-schema/05-alert-block-full-ux/main.tsx +++ b/examples/06-custom-schema/05-alert-block-full-ux/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/06-custom-schema/05-alert-block-full-ux/Alert.tsx b/examples/06-custom-schema/05-alert-block-full-ux/src/Alert.tsx similarity index 100% rename from examples/06-custom-schema/05-alert-block-full-ux/Alert.tsx rename to examples/06-custom-schema/05-alert-block-full-ux/src/Alert.tsx diff --git a/examples/06-custom-schema/05-alert-block-full-ux/App.tsx b/examples/06-custom-schema/05-alert-block-full-ux/src/App.tsx similarity index 99% rename from examples/06-custom-schema/05-alert-block-full-ux/App.tsx rename to examples/06-custom-schema/05-alert-block-full-ux/src/App.tsx index 9e72f9904a..a3a2969d36 100644 --- a/examples/06-custom-schema/05-alert-block-full-ux/App.tsx +++ b/examples/06-custom-schema/05-alert-block-full-ux/src/App.tsx @@ -18,7 +18,7 @@ import { } from "@blocknote/react"; import { RiAlertFill } from "react-icons/ri"; -import { Alert } from "./Alert.js"; +import { Alert } from "./Alert"; // Our schema with block specs, which contain the configs and implementations for // blocks that we want our editor to use. diff --git a/examples/06-custom-schema/05-alert-block-full-ux/styles.css b/examples/06-custom-schema/05-alert-block-full-ux/src/styles.css similarity index 100% rename from examples/06-custom-schema/05-alert-block-full-ux/styles.css rename to examples/06-custom-schema/05-alert-block-full-ux/src/styles.css diff --git a/examples/06-custom-schema/react-custom-blocks/main.tsx b/examples/06-custom-schema/react-custom-blocks/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/06-custom-schema/react-custom-blocks/main.tsx +++ b/examples/06-custom-schema/react-custom-blocks/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/06-custom-schema/react-custom-blocks/App.tsx b/examples/06-custom-schema/react-custom-blocks/src/App.tsx similarity index 100% rename from examples/06-custom-schema/react-custom-blocks/App.tsx rename to examples/06-custom-schema/react-custom-blocks/src/App.tsx diff --git a/examples/06-custom-schema/react-custom-blocks/styles.css b/examples/06-custom-schema/react-custom-blocks/src/styles.css similarity index 100% rename from examples/06-custom-schema/react-custom-blocks/styles.css rename to examples/06-custom-schema/react-custom-blocks/src/styles.css diff --git a/examples/06-custom-schema/react-custom-inline-content/main.tsx b/examples/06-custom-schema/react-custom-inline-content/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/06-custom-schema/react-custom-inline-content/main.tsx +++ b/examples/06-custom-schema/react-custom-inline-content/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/06-custom-schema/react-custom-inline-content/App.tsx b/examples/06-custom-schema/react-custom-inline-content/src/App.tsx similarity index 100% rename from examples/06-custom-schema/react-custom-inline-content/App.tsx rename to examples/06-custom-schema/react-custom-inline-content/src/App.tsx diff --git a/examples/06-custom-schema/react-custom-styles/main.tsx b/examples/06-custom-schema/react-custom-styles/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/06-custom-schema/react-custom-styles/main.tsx +++ b/examples/06-custom-schema/react-custom-styles/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/06-custom-schema/react-custom-styles/App.tsx b/examples/06-custom-schema/react-custom-styles/src/App.tsx similarity index 100% rename from examples/06-custom-schema/react-custom-styles/App.tsx rename to examples/06-custom-schema/react-custom-styles/src/App.tsx diff --git a/examples/07-collaboration/01-partykit/main.tsx b/examples/07-collaboration/01-partykit/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/07-collaboration/01-partykit/main.tsx +++ b/examples/07-collaboration/01-partykit/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/07-collaboration/01-partykit/App.tsx b/examples/07-collaboration/01-partykit/src/App.tsx similarity index 100% rename from examples/07-collaboration/01-partykit/App.tsx rename to examples/07-collaboration/01-partykit/src/App.tsx diff --git a/examples/07-collaboration/02-liveblocks/main.tsx b/examples/07-collaboration/02-liveblocks/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/07-collaboration/02-liveblocks/main.tsx +++ b/examples/07-collaboration/02-liveblocks/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/07-collaboration/02-liveblocks/App.tsx b/examples/07-collaboration/02-liveblocks/src/App.tsx similarity index 95% rename from examples/07-collaboration/02-liveblocks/App.tsx rename to examples/07-collaboration/02-liveblocks/src/App.tsx index 00083b961f..e523e79dd2 100644 --- a/examples/07-collaboration/02-liveblocks/App.tsx +++ b/examples/07-collaboration/02-liveblocks/src/App.tsx @@ -9,7 +9,7 @@ import "@liveblocks/react-ui/styles.css"; import "@liveblocks/react-ui/styles/dark/media-query.css"; import "@liveblocks/react-tiptap/styles.css"; -import { Editor } from "./Editor.js"; +import { Editor } from "./Editor"; import "./globals.css"; import "./styles.css"; diff --git a/examples/07-collaboration/02-liveblocks/Editor.tsx b/examples/07-collaboration/02-liveblocks/src/Editor.tsx similarity index 93% rename from examples/07-collaboration/02-liveblocks/Editor.tsx rename to examples/07-collaboration/02-liveblocks/src/Editor.tsx index ac78050fa9..2c6da47379 100644 --- a/examples/07-collaboration/02-liveblocks/Editor.tsx +++ b/examples/07-collaboration/02-liveblocks/src/Editor.tsx @@ -4,7 +4,7 @@ import { BlockNoteView } from "@blocknote/mantine"; import "@blocknote/mantine/style.css"; import { useCreateBlockNoteWithLiveblocks } from "@liveblocks/react-blocknote"; -import { Threads } from "./Threads.js"; +import { Threads } from "./Threads"; export function Editor() { const editor = useCreateBlockNoteWithLiveblocks( diff --git a/examples/07-collaboration/02-liveblocks/Threads.tsx b/examples/07-collaboration/02-liveblocks/src/Threads.tsx similarity index 100% rename from examples/07-collaboration/02-liveblocks/Threads.tsx rename to examples/07-collaboration/02-liveblocks/src/Threads.tsx diff --git a/examples/07-collaboration/02-liveblocks/globals.css b/examples/07-collaboration/02-liveblocks/src/globals.css similarity index 100% rename from examples/07-collaboration/02-liveblocks/globals.css rename to examples/07-collaboration/02-liveblocks/src/globals.css diff --git a/examples/07-collaboration/02-liveblocks/styles.css b/examples/07-collaboration/02-liveblocks/src/styles.css similarity index 100% rename from examples/07-collaboration/02-liveblocks/styles.css rename to examples/07-collaboration/02-liveblocks/src/styles.css diff --git a/examples/07-collaboration/03-y-sweet/main.tsx b/examples/07-collaboration/03-y-sweet/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/07-collaboration/03-y-sweet/main.tsx +++ b/examples/07-collaboration/03-y-sweet/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/07-collaboration/03-y-sweet/App.tsx b/examples/07-collaboration/03-y-sweet/src/App.tsx similarity index 100% rename from examples/07-collaboration/03-y-sweet/App.tsx rename to examples/07-collaboration/03-y-sweet/src/App.tsx diff --git a/examples/07-collaboration/04-comments/main.tsx b/examples/07-collaboration/04-comments/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/07-collaboration/04-comments/main.tsx +++ b/examples/07-collaboration/04-comments/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/07-collaboration/04-comments/App.tsx b/examples/07-collaboration/04-comments/src/App.tsx similarity index 98% rename from examples/07-collaboration/04-comments/App.tsx rename to examples/07-collaboration/04-comments/src/App.tsx index 7b3c98de9d..bd11b2539e 100644 --- a/examples/07-collaboration/04-comments/App.tsx +++ b/examples/07-collaboration/04-comments/src/App.tsx @@ -10,8 +10,8 @@ import { useCreateBlockNote } from "@blocknote/react"; import { YDocProvider, useYDoc, useYjsProvider } from "@y-sweet/react"; import { useMemo, useState } from "react"; -import { SettingsSelect } from "./SettingsSelect.js"; -import { HARDCODED_USERS, MyUserType, getRandomColor } from "./userdata.js"; +import { SettingsSelect } from "./SettingsSelect"; +import { HARDCODED_USERS, MyUserType, getRandomColor } from "./userdata"; import "./style.css"; diff --git a/examples/07-collaboration/04-comments/SettingsSelect.tsx b/examples/07-collaboration/04-comments/src/SettingsSelect.tsx similarity index 100% rename from examples/07-collaboration/04-comments/SettingsSelect.tsx rename to examples/07-collaboration/04-comments/src/SettingsSelect.tsx diff --git a/examples/07-collaboration/04-comments/style.css b/examples/07-collaboration/04-comments/src/style.css similarity index 100% rename from examples/07-collaboration/04-comments/style.css rename to examples/07-collaboration/04-comments/src/style.css diff --git a/examples/07-collaboration/04-comments/userdata.ts b/examples/07-collaboration/04-comments/src/userdata.ts similarity index 100% rename from examples/07-collaboration/04-comments/userdata.ts rename to examples/07-collaboration/04-comments/src/userdata.ts diff --git a/examples/07-collaboration/05-comments-with-sidebar/main.tsx b/examples/07-collaboration/05-comments-with-sidebar/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/07-collaboration/05-comments-with-sidebar/main.tsx +++ b/examples/07-collaboration/05-comments-with-sidebar/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/07-collaboration/05-comments-with-sidebar/App.tsx b/examples/07-collaboration/05-comments-with-sidebar/src/App.tsx similarity index 99% rename from examples/07-collaboration/05-comments-with-sidebar/App.tsx rename to examples/07-collaboration/05-comments-with-sidebar/src/App.tsx index 8089a292e7..ed7bf38473 100644 --- a/examples/07-collaboration/05-comments-with-sidebar/App.tsx +++ b/examples/07-collaboration/05-comments-with-sidebar/src/App.tsx @@ -15,8 +15,8 @@ import { import { YDocProvider, useYDoc, useYjsProvider } from "@y-sweet/react"; import { useMemo, useState } from "react"; -import { SettingsSelect } from "./SettingsSelect.js"; -import { HARDCODED_USERS, MyUserType, getRandomColor } from "./userdata.js"; +import { SettingsSelect } from "./SettingsSelect"; +import { HARDCODED_USERS, MyUserType, getRandomColor } from "./userdata"; import "./style.css"; diff --git a/examples/07-collaboration/05-comments-with-sidebar/SettingsSelect.tsx b/examples/07-collaboration/05-comments-with-sidebar/src/SettingsSelect.tsx similarity index 100% rename from examples/07-collaboration/05-comments-with-sidebar/SettingsSelect.tsx rename to examples/07-collaboration/05-comments-with-sidebar/src/SettingsSelect.tsx diff --git a/examples/07-collaboration/05-comments-with-sidebar/style.css b/examples/07-collaboration/05-comments-with-sidebar/src/style.css similarity index 100% rename from examples/07-collaboration/05-comments-with-sidebar/style.css rename to examples/07-collaboration/05-comments-with-sidebar/src/style.css diff --git a/examples/07-collaboration/05-comments-with-sidebar/userdata.ts b/examples/07-collaboration/05-comments-with-sidebar/src/userdata.ts similarity index 100% rename from examples/07-collaboration/05-comments-with-sidebar/userdata.ts rename to examples/07-collaboration/05-comments-with-sidebar/src/userdata.ts diff --git a/examples/07-collaboration/06-ghost-writer/main.tsx b/examples/07-collaboration/06-ghost-writer/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/07-collaboration/06-ghost-writer/main.tsx +++ b/examples/07-collaboration/06-ghost-writer/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/07-collaboration/07-forking/main.tsx b/examples/07-collaboration/07-forking/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/07-collaboration/07-forking/main.tsx +++ b/examples/07-collaboration/07-forking/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/08-extensions/01-tiptap-arrow-conversion/main.tsx b/examples/08-extensions/01-tiptap-arrow-conversion/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/08-extensions/01-tiptap-arrow-conversion/main.tsx +++ b/examples/08-extensions/01-tiptap-arrow-conversion/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/08-extensions/01-tiptap-arrow-conversion/App.tsx b/examples/08-extensions/01-tiptap-arrow-conversion/src/App.tsx similarity index 98% rename from examples/08-extensions/01-tiptap-arrow-conversion/App.tsx rename to examples/08-extensions/01-tiptap-arrow-conversion/src/App.tsx index dfe1bb6e71..3fbe199ec4 100644 --- a/examples/08-extensions/01-tiptap-arrow-conversion/App.tsx +++ b/examples/08-extensions/01-tiptap-arrow-conversion/src/App.tsx @@ -3,7 +3,7 @@ import { useCreateBlockNote } from "@blocknote/react"; import { BlockNoteView } from "@blocknote/mantine"; import "@blocknote/mantine/style.css"; -import { ArrowConversionExtension } from "./ArrowConversionExtension.js"; +import { ArrowConversionExtension } from "./ArrowConversionExtension"; export default function App() { // Creates a new editor instance. diff --git a/examples/08-extensions/01-tiptap-arrow-conversion/ArrowConversionExtension.ts b/examples/08-extensions/01-tiptap-arrow-conversion/src/ArrowConversionExtension.ts similarity index 100% rename from examples/08-extensions/01-tiptap-arrow-conversion/ArrowConversionExtension.ts rename to examples/08-extensions/01-tiptap-arrow-conversion/src/ArrowConversionExtension.ts diff --git a/examples/09-ai/01-minimal/main.tsx b/examples/09-ai/01-minimal/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/09-ai/01-minimal/main.tsx +++ b/examples/09-ai/01-minimal/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/09-ai/01-minimal/App.tsx b/examples/09-ai/01-minimal/src/App.tsx similarity index 99% rename from examples/09-ai/01-minimal/App.tsx rename to examples/09-ai/01-minimal/src/App.tsx index 3305386186..9f56576e67 100644 --- a/examples/09-ai/01-minimal/App.tsx +++ b/examples/09-ai/01-minimal/src/App.tsx @@ -21,7 +21,8 @@ import { } from "@blocknote/xl-ai"; import { en as aiEn } from "@blocknote/xl-ai/locales"; import "@blocknote/xl-ai/style.css"; -import { getEnv } from "./getEnv.js"; + +import { getEnv } from "./getEnv"; // Optional: proxy requests through the `@blocknote/xl-ai-server` proxy server // so that we don't have to expose our API keys to the client diff --git a/examples/09-ai/01-minimal/getEnv.ts b/examples/09-ai/01-minimal/src/getEnv.ts similarity index 100% rename from examples/09-ai/01-minimal/getEnv.ts rename to examples/09-ai/01-minimal/src/getEnv.ts diff --git a/examples/09-ai/02-playground/main.tsx b/examples/09-ai/02-playground/main.tsx index 6284417d60..677c7f7eed 100644 --- a/examples/09-ai/02-playground/main.tsx +++ b/examples/09-ai/02-playground/main.tsx @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY import React from "react"; import { createRoot } from "react-dom/client"; -import App from "./App.jsx"; +import App from "./src/App.jsx"; const root = createRoot(document.getElementById("root")!); root.render( diff --git a/examples/09-ai/02-playground/App.tsx b/examples/09-ai/02-playground/src/App.tsx similarity index 98% rename from examples/09-ai/02-playground/App.tsx rename to examples/09-ai/02-playground/src/App.tsx index ba165abb0b..44321e3cf6 100644 --- a/examples/09-ai/02-playground/App.tsx +++ b/examples/09-ai/02-playground/src/App.tsx @@ -7,7 +7,6 @@ import { BlockNoteEditor, filterSuggestionItems } from "@blocknote/core"; import "@blocknote/core/fonts/inter.css"; import { en } from "@blocknote/core/locales"; import { BlockNoteView } from "@blocknote/mantine"; -import "@mantine/core/styles.css"; import "@blocknote/mantine/style.css"; import { FormattingToolbar, @@ -29,13 +28,14 @@ import { import { en as aiEn } from "@blocknote/xl-ai/locales"; import "@blocknote/xl-ai/style.css"; import { Fieldset, MantineProvider, Switch } from "@mantine/core"; - +import "@mantine/core/styles.css"; import { LanguageModelV1 } from "ai"; import { useEffect, useMemo, useState } from "react"; import { useStore } from "zustand"; -import { BasicAutocomplete } from "./AutoComplete.js"; -import RadioGroupComponent from "./components/RadioGroupComponent.js"; -import { getEnv } from "./getEnv.js"; + +import { BasicAutocomplete } from "./AutoComplete"; +import RadioGroupComponent from "./components/RadioGroupComponent"; +import { getEnv } from "./getEnv"; // Optional: proxy requests through the `@blocknote/xl-ai-server` proxy server // so that we don't have to expose our API keys to the client const client = createBlockNoteAIClient({ diff --git a/examples/09-ai/02-playground/AutoComplete.tsx b/examples/09-ai/02-playground/src/AutoComplete.tsx similarity index 95% rename from examples/09-ai/02-playground/AutoComplete.tsx rename to examples/09-ai/02-playground/src/AutoComplete.tsx index 8503c91f1d..ffa968d811 100644 --- a/examples/09-ai/02-playground/AutoComplete.tsx +++ b/examples/09-ai/02-playground/src/AutoComplete.tsx @@ -1,5 +1,5 @@ import { Combobox, TextInput, useCombobox } from "@mantine/core"; -import { AI_MODELS } from "./data/aimodels.js"; +import { AI_MODELS } from "./data/aimodels"; // https://mantine.dev/combobox/?e=BasicAutocomplete // This is used for the AI Model selector in the example @@ -31,7 +31,8 @@ export function BasicAutocomplete(props: { combobox.closeDropdown(); }} store={combobox} - withinPortal={false}> + withinPortal={false} + > = ({ {items.map((item) => ( - // TODO: doesn't work well with our mantive version or styles + // TODO: doesn't work well with our mantine version or styles // + +You'll need something like [ngrok](https://ngrok.com/) to expose your local server to the internet. + +```bash +ngrok http http://localhost:3000 +``` + +You'll need the webhook to point to ngrok like so: + +``` +https://0000-00-00-000-00.ngrok-free.app/api/auth/polar/webhooks +``` + +With this webhook pointing to your local server, you should be able to test payments. + +### Email sending + +Note, this is not required, if email sending is not configured, the app will log the email it would send to the console. Often this is more convenient for development. + +To test email sending, you can set the following environment variables: + +```bash +SMTP_HOST= +SMTP_USER= +SMTP_PASS= +SMTP_PORT= +SMTP_SECURE=false +``` + +When configured, you'll be able to send emails to the email address you've configured. + +To setup with protonmail, you'll need to go to and create a new SMTP submission token. + +You'll need to set the following environment variables: + +```bash +SMTP_HOST=smtp.protonmail.com +SMTP_USER=my.email@protonmail.com +SMTP_PASS=my-smtp-token +SMTP_PORT=587 +SMTP_SECURE=false +``` diff --git a/fumadocs/README.md b/fumadocs/README.md new file mode 100644 index 0000000000..ec0577e219 --- /dev/null +++ b/fumadocs/README.md @@ -0,0 +1,21 @@ +# BlockNote Docs + +This is the code for the [BlockNote documentation website](https://www.blocknotejs.org). + +If you're looking to work on BlockNote itself, check the [`packages`](/packages/) folder. + +## Getting Started + +First, run `npm run build` in the repository root. + +Next, run the development server: + +```bash +npm run dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +## Merging + +Open a pull request to the [BlockNote GitHub repo](https://github.com/TypeCellOS/BlockNote). Pull requests will automatically be deployed to a preview environment. diff --git a/fumadocs/app/(home)/layout.tsx b/fumadocs/app/(home)/layout.tsx new file mode 100644 index 0000000000..1dd4684d0c --- /dev/null +++ b/fumadocs/app/(home)/layout.tsx @@ -0,0 +1,7 @@ +import type { ReactNode } from 'react'; +import { HomeLayout } from 'fumadocs-ui/layouts/home'; +import { baseOptions } from '@/app/layout.config'; + +export default function Layout({ children }: { children: ReactNode }) { + return {children}; +} diff --git a/fumadocs/app/(home)/page.tsx b/fumadocs/app/(home)/page.tsx new file mode 100644 index 0000000000..fd5381ae59 --- /dev/null +++ b/fumadocs/app/(home)/page.tsx @@ -0,0 +1,27 @@ +import Link from "next/link"; + +export default function HomePage() { + return ( +
+

Hello World

+

+ You can open{" "} + + /docs + {" "} + and see the documentation. +

+

+ You can open{" "} + + /examples + {" "} + and see the examples. +

+
+ ); +} diff --git a/fumadocs/app/api/auth/[...all]/route.ts b/fumadocs/app/api/auth/[...all]/route.ts new file mode 100644 index 0000000000..ff0686abed --- /dev/null +++ b/fumadocs/app/api/auth/[...all]/route.ts @@ -0,0 +1,4 @@ +import { auth } from "../../../../auth"; +import { toNextJsHandler } from "better-auth/next-js"; + +export const { POST, GET } = toNextJsHandler(auth); diff --git a/fumadocs/app/api/og/route.tsx b/fumadocs/app/api/og/route.tsx new file mode 100644 index 0000000000..3d9811ce1a --- /dev/null +++ b/fumadocs/app/api/og/route.tsx @@ -0,0 +1,110 @@ +import { ImageResponse } from "next/og"; + +export const runtime = "edge"; + +export async function GET(request: Request) { + try { + const fontData = await fetch( + new URL("../../../assets/fonts/Gilroy-Regular.ttf", import.meta.url), + ).then((res) => res.arrayBuffer()); + + const { searchParams } = new URL(request.url); + let title = searchParams.get("title"); + if (title && title.length > 100) { + title = title.slice(0, 99) + "…"; + } + + const bannerSVG = ( + + + + + + + + + + + ); + + const bannerWithTitle = (title: string) => ( +
+ {bannerSVG} +
+ {title} +
+
+ ); + + const banner = ( +
+ {bannerSVG} +
+ ); + + return new ImageResponse(title ? bannerWithTitle(title) : banner, { + width: 1200, + height: 630, + fonts: [ + { + name: "Gilroy", + data: fontData, + style: "normal", + }, + ], + }); + } catch (e) { + return new Response(`Failed to generate the image`, { + status: 500, + }); + } +} diff --git a/fumadocs/app/api/search/route.ts b/fumadocs/app/api/search/route.ts new file mode 100644 index 0000000000..57efff4713 --- /dev/null +++ b/fumadocs/app/api/search/route.ts @@ -0,0 +1,4 @@ +import { source } from "@/lib/source/docs"; +import { createFromSource } from "fumadocs-core/search/server"; + +export const { GET } = createFromSource(source); diff --git a/fumadocs/app/docs/[[...slug]]/page.tsx b/fumadocs/app/docs/[[...slug]]/page.tsx new file mode 100644 index 0000000000..7b74b214aa --- /dev/null +++ b/fumadocs/app/docs/[[...slug]]/page.tsx @@ -0,0 +1,28 @@ +import { DocPage } from "@/components/DocPage"; +import { source } from "@/lib/source/docs"; +import { notFound } from "next/navigation"; + +export default async function Page(props: { + params: Promise<{ slug?: string[] }>; +}) { + return ; +} + +export async function generateStaticParams() { + return source.generateParams(); +} + +export async function generateMetadata(props: { + params: Promise<{ slug?: string[] }>; +}) { + const params = await props.params; + const page = source.getPage(params.slug); + if (!page) { + notFound(); + } + + return { + title: page.data.title, + description: page.data.description, + }; +} diff --git a/fumadocs/app/docs/layout.tsx b/fumadocs/app/docs/layout.tsx new file mode 100644 index 0000000000..99c480d446 --- /dev/null +++ b/fumadocs/app/docs/layout.tsx @@ -0,0 +1,12 @@ +import { DocsLayout } from "fumadocs-ui/layouts/notebook"; +import type { ReactNode } from "react"; +import { baseOptions } from "@/app/layout.config"; +import { source } from "@/lib/source/docs"; + +export default function Layout({ children }: { children: ReactNode }) { + return ( + + {children} + + ); +} diff --git a/fumadocs/app/examples/[[...slug]]/page.tsx b/fumadocs/app/examples/[[...slug]]/page.tsx new file mode 100644 index 0000000000..12e564fda3 --- /dev/null +++ b/fumadocs/app/examples/[[...slug]]/page.tsx @@ -0,0 +1,28 @@ +import { DocPage } from "@/components/DocPage"; +import { source } from "@/lib/source/examples"; +import { notFound } from "next/navigation"; + +export default async function Page(props: { + params: Promise<{ slug?: string[] }>; +}) { + return ; +} + +export async function generateStaticParams() { + return source.generateParams(); +} + +export async function generateMetadata(props: { + params: Promise<{ slug?: string[] }>; +}) { + const params = await props.params; + const page = source.getPage(params.slug); + if (!page) { + notFound(); + } + + return { + title: page.data.title, + description: page.data.description, + }; +} diff --git a/fumadocs/app/examples/layout.tsx b/fumadocs/app/examples/layout.tsx new file mode 100644 index 0000000000..3251979b20 --- /dev/null +++ b/fumadocs/app/examples/layout.tsx @@ -0,0 +1,12 @@ +import { DocsLayout } from "fumadocs-ui/layouts/notebook"; +import type { ReactNode } from "react"; +import { baseOptions } from "@/app/layout.config"; +import { source } from "@/lib/source/examples"; + +export default function Layout({ children }: { children: ReactNode }) { + return ( + + {children} + + ); +} diff --git a/fumadocs/app/global-error.tsx b/fumadocs/app/global-error.tsx new file mode 100644 index 0000000000..9bda5feef0 --- /dev/null +++ b/fumadocs/app/global-error.tsx @@ -0,0 +1,23 @@ +"use client"; + +import * as Sentry from "@sentry/nextjs"; +import NextError from "next/error"; +import { useEffect } from "react"; + +export default function GlobalError({ error }: { error: Error & { digest?: string } }) { + useEffect(() => { + Sentry.captureException(error); + }, [error]); + + return ( + + + {/* `NextError` is the default Next.js error page component. Its type + definition requires a `statusCode` prop. However, since the App Router + does not expose status codes for errors, we simply pass 0 to render a + generic error message. */} + + + + ); +} \ No newline at end of file diff --git a/fumadocs/app/global.css b/fumadocs/app/global.css new file mode 100644 index 0000000000..49609ad1dc --- /dev/null +++ b/fumadocs/app/global.css @@ -0,0 +1,7 @@ +@import "tailwindcss"; +@import "fumadocs-ui/css/vitepress.css"; +@import "fumadocs-ui/css/preset.css"; + +@source "."; +@source "../components"; +@source "../content"; diff --git a/fumadocs/app/layout.config.tsx b/fumadocs/app/layout.config.tsx new file mode 100644 index 0000000000..d9232620a2 --- /dev/null +++ b/fumadocs/app/layout.config.tsx @@ -0,0 +1,121 @@ +import { AuthNavButton } from "@/components/AuthNavButton"; +import { ThemedImage } from "@/components/ThemedImage"; +import type { DocsLayoutProps } from "fumadocs-ui/layouts/notebook"; +import { FaBook, FaCode, FaDiscord, FaGithub, FaUser } from "react-icons/fa"; + +/** + * Shared layout configurations + * + * you can customise layouts individually from: + * Home Layout: app/(home)/layout.tsx + * Docs Layout: app/docs/layout.tsx + */ +export const baseOptions: Partial = { + nav: { + title: ( + <> + + + ), + }, + links: [ + // { + // type: "menu", + // icon: , + // text: "Profile", + // items: [ + // { + // text: "Getting Started", + // description: "Learn to use Fumadocs", + // url: "/docs", + // }, + // ], + // }, + { + text: "Docs", + url: "/docs", + active: "nested-url", + }, + { + text: "Examples", + url: "/examples", + active: "nested-url", + }, + { + text: "Pricing", + url: "/pricing", + active: "url", + }, + { + text: "About", + url: "/about", + active: "url", + }, + { + type: "icon", + icon: , + text: "Discord", + url: "https://discord.gg/Qc2QTTH5dF", + }, + { + type: "icon", + icon: , + text: "GitHub", + url: "https://github.com/TypeCellOS/BlockNote", + }, + + { + type: "custom", + // only displayed on navbar, not mobile menu + on: "nav", + children: , + }, + ], + sidebar: { + // footer:
THIS IS A FOOTER
, + tabs: [ + { + icon: ( + + ), + title: "Documentation", + description: "Learn how to use BlockNote", + url: "/docs", + }, + { + icon: ( + + ), + title: "Examples", + description: "See BlockNote in action", + url: "/examples", + }, + ], + }, +}; diff --git a/fumadocs/app/layout.tsx b/fumadocs/app/layout.tsx new file mode 100644 index 0000000000..078215a5c7 --- /dev/null +++ b/fumadocs/app/layout.tsx @@ -0,0 +1,24 @@ +import "./global.css"; +import { RootProvider } from "fumadocs-ui/provider"; +import { Metadata } from "next"; +import { Inter } from "next/font/google"; +import type { ReactNode } from "react"; + +const inter = Inter({ + subsets: ["latin"], +}); + +export const metadata: Metadata = { + title: "BlockNote", + description: "BlockNote is a rich text editor for the web.", +}; + +export default function Layout({ children }: { children: ReactNode }) { + return ( + + + {children as any} + + + ); +} diff --git a/fumadocs/app/llms-full.txt/route.ts b/fumadocs/app/llms-full.txt/route.ts new file mode 100644 index 0000000000..781c05727d --- /dev/null +++ b/fumadocs/app/llms-full.txt/route.ts @@ -0,0 +1,15 @@ +import { source } from "@/lib/source/docs"; +import { source as sourceExamples } from "@/lib/source/examples"; +import { getLLMText } from "@/lib/get-llm-text"; + +export const revalidate = false; + +export async function GET() { + const scan = source + .getPages() + .concat(sourceExamples.getPages()) + .map(getLLMText); + const scanned = await Promise.all(scan); + + return new Response(scanned.join("\n\n")); +} diff --git a/fumadocs/app/llms.txt/route.ts b/fumadocs/app/llms.txt/route.ts new file mode 100644 index 0000000000..24fc409d0b --- /dev/null +++ b/fumadocs/app/llms.txt/route.ts @@ -0,0 +1,32 @@ +import { source } from "@/lib/source/docs"; + +export const revalidate = false; + +export async function GET() { + const scanned: string[] = []; + scanned.push(`# BlockNote + +> BlockNote is a React-based notion-style rich text editor, based on Prosemirror and Tiptap. + +Important Notes: + - It has an opinionated approach to building a rich text editor, and a much simpler API than either Tiptap or Prosemirror, so while it may be based on them, their APIs are not compatible and rarely exposed. + - BlockNote uses it's own document model for reading, editing and saving documents. It is called BlockNote JSON and information can be found in the Document Structure page. + +# Docs + `); + const map = new Map(); + + for (const page of source.getPages()) { + const dir = page.slugs[0]; + const list = map.get(dir) ?? []; + list.push(`- [${page.data.title}](${page.url}): ${page.data.description}`); + map.set(dir, list); + } + + for (const [key, value] of map) { + scanned.push(`## ${key}`); + scanned.push(value.join("\n")); + } + + return new Response(scanned.join("\n\n")); +} diff --git a/fumadocs/app/pricing/layout.tsx b/fumadocs/app/pricing/layout.tsx new file mode 100644 index 0000000000..e0f4458b9e --- /dev/null +++ b/fumadocs/app/pricing/layout.tsx @@ -0,0 +1,7 @@ +import { HomeLayout } from "fumadocs-ui/layouts/home"; +import type { ReactNode } from "react"; +import { baseOptions } from "@/app/layout.config"; + +export default function Layout({ children }: { children: ReactNode }) { + return {children}; +} diff --git a/fumadocs/app/pricing/page.tsx b/fumadocs/app/pricing/page.tsx new file mode 100644 index 0000000000..dcb69b4599 --- /dev/null +++ b/fumadocs/app/pricing/page.tsx @@ -0,0 +1,90 @@ +import { SectionSubHeader } from "@/components/pages/landing/shared/Headings"; +import { FAQ } from "@/components/pages/pricing/faq"; +import { Tiers, Tier } from "@/components/pages/pricing/tiers"; + +const tiers: Tier[] = [ + // { + // id: "tier-free", + // title: "Community", + // description: "Everything necessary to get started for individuals and non-commercial projects.", + // price: "Free", + // features: [ + // "Use BlockNote for free (open source license)", + // "Community Discord for help & feedback", + // ], + // href: "/docs/", + // }, + { + id: "starter", + mostPopular: false, + title: "Starter", + description: + "Best for companies and organizations building products with BlockNote.", + price: { month: 90, year: 24 }, + features: [ + "Access to all Pro Examples", + "Prioritized Bug Reports on GitHub", + "Keep the open source library running and maintained", + "XL packages available for open source projects under AGPL-3.0", + ], + }, + { + id: "business", + title: "Business", + mostPopular: true, + description: "Best for companies that want a direct line to the team.", + price: { month: 390, year: 48 }, + features: [ + "Commercial license for XL packages:", + "XL: Multi-column layouts", + "XL: Export to PDF, Docx", + "Access to all Pro Examples", + "Prioritized Bug Reports on GitHub", + "Keep the open source library running and maintained", + "Logo on our website and repositories", + "Access to a private Discord channel with the maintainers", + "Up to 2 hours of individual support per month", + ], + }, + { + id: "enterprise", + title: "Enterprise", + description: + "Collaborate directly with the BlockNote team on integrating and extending the editor.", + price: "Tailored pricing", + features: [ + "Access to all Pro Examples", + "Prioritized Bug Reports and Feature Requests on GitHub", + "Keep the open source library running and maintained", + "Access to a private Discord or Slack channel with the maintainers", + "Guidance on integrating BlockNote into your project", + "Development of BlockNote features required for your organization", + "Dedicated consulting and support", + ], + href: "/about/", + }, +]; + +export default function Pricing() { + return ( +
+
+

+ BlockNote Pro +

+ Upgrade your BlockNote experience +

+ Your subscription helps maintain and develop BlockNote while giving + you access to direct support, priority features, and Pro Examples. +

+ +

+ Thanks for checking out BlockNote Pro!
BlockNote is free and + open source software that organizations of all sizes are using to add + polished editing experiences to their apps. +

+ +
+
+ ); +} diff --git a/fumadocs/app/signin/layout.tsx b/fumadocs/app/signin/layout.tsx new file mode 100644 index 0000000000..e0f4458b9e --- /dev/null +++ b/fumadocs/app/signin/layout.tsx @@ -0,0 +1,7 @@ +import { HomeLayout } from "fumadocs-ui/layouts/home"; +import type { ReactNode } from "react"; +import { baseOptions } from "@/app/layout.config"; + +export default function Layout({ children }: { children: ReactNode }) { + return {children}; +} diff --git a/fumadocs/app/signin/page.tsx b/fumadocs/app/signin/page.tsx new file mode 100644 index 0000000000..c05d02000a --- /dev/null +++ b/fumadocs/app/signin/page.tsx @@ -0,0 +1,20 @@ +import { Metadata } from "next"; +import dynamic from "next/dynamic"; +import { Suspense } from "react"; + +export const metadata: Metadata = { + title: "Login", +}; + +// dynamic import because we use search params in the client component +const AuthenticationPage = dynamic( + () => import("../../components/AuthenticationPage"), +); + +export default function Register() { + return ( + + + + ); +} diff --git a/fumadocs/app/signin/password/layout.tsx b/fumadocs/app/signin/password/layout.tsx new file mode 100644 index 0000000000..e0f4458b9e --- /dev/null +++ b/fumadocs/app/signin/password/layout.tsx @@ -0,0 +1,7 @@ +import { HomeLayout } from "fumadocs-ui/layouts/home"; +import type { ReactNode } from "react"; +import { baseOptions } from "@/app/layout.config"; + +export default function Layout({ children }: { children: ReactNode }) { + return {children}; +} diff --git a/fumadocs/app/signin/password/page.tsx b/fumadocs/app/signin/password/page.tsx new file mode 100644 index 0000000000..f03a0c7436 --- /dev/null +++ b/fumadocs/app/signin/password/page.tsx @@ -0,0 +1,20 @@ +import { Metadata } from "next"; +import { Suspense } from "react"; +import dynamic from "next/dynamic"; + +export const metadata: Metadata = { + title: "Password Login", +}; + +// dynamic import because we use search params in the client component +const AuthenticationPage = dynamic( + () => import("../../../components/AuthenticationPage"), +); + +export default function Register() { + return ( + + + + ); +} diff --git a/fumadocs/app/signup/layout.tsx b/fumadocs/app/signup/layout.tsx new file mode 100644 index 0000000000..e0f4458b9e --- /dev/null +++ b/fumadocs/app/signup/layout.tsx @@ -0,0 +1,7 @@ +import { HomeLayout } from "fumadocs-ui/layouts/home"; +import type { ReactNode } from "react"; +import { baseOptions } from "@/app/layout.config"; + +export default function Layout({ children }: { children: ReactNode }) { + return {children}; +} diff --git a/fumadocs/app/signup/page.tsx b/fumadocs/app/signup/page.tsx new file mode 100644 index 0000000000..ca5495f0a1 --- /dev/null +++ b/fumadocs/app/signup/page.tsx @@ -0,0 +1,20 @@ +import { Metadata } from "next"; +import { Suspense } from "react"; +import dynamic from "next/dynamic"; + +// dynamic import because we use search params in the client component +const AuthenticationPage = dynamic( + () => import("../../components/AuthenticationPage"), +); + +export const metadata: Metadata = { + title: "Sign-up", +}; + +export default function Register() { + return ( + + + + ); +} diff --git a/fumadocs/app/thanks/layout.tsx b/fumadocs/app/thanks/layout.tsx new file mode 100644 index 0000000000..e0f4458b9e --- /dev/null +++ b/fumadocs/app/thanks/layout.tsx @@ -0,0 +1,7 @@ +import { HomeLayout } from "fumadocs-ui/layouts/home"; +import type { ReactNode } from "react"; +import { baseOptions } from "@/app/layout.config"; + +export default function Layout({ children }: { children: ReactNode }) { + return {children}; +} diff --git a/fumadocs/app/thanks/page.tsx b/fumadocs/app/thanks/page.tsx new file mode 100644 index 0000000000..8c2c6d0d52 --- /dev/null +++ b/fumadocs/app/thanks/page.tsx @@ -0,0 +1,40 @@ +import { source } from "@/lib/source/pages"; +import { getMDXComponents } from "@/util/mdx-components"; +import { DocsBody, DocsDescription, DocsTitle } from "fumadocs-ui/page"; +import { notFound } from "next/navigation"; + +export default async function Page() { + const page = source.getPage(["thanks"]); + if (!page) { + notFound(); + } + const MDXContent = page.data.body; + + return ( +
+ {page.data.title} + + {page.data.description} + + + + +
+ ); +} + +export async function generateStaticParams() { + return source.generateParams(); +} + +export async function generateMetadata() { + const page = source.getPage(["thanks"]); + if (!page) { + notFound(); + } + + return { + title: page.data.title, + description: page.data.description, + }; +} diff --git a/fumadocs/assets/fonts/Gilroy-Bold.ttf b/fumadocs/assets/fonts/Gilroy-Bold.ttf new file mode 100644 index 0000000000..1aea716b2e Binary files /dev/null and b/fumadocs/assets/fonts/Gilroy-Bold.ttf differ diff --git a/fumadocs/assets/fonts/Gilroy-ExtraBold.ttf b/fumadocs/assets/fonts/Gilroy-ExtraBold.ttf new file mode 100644 index 0000000000..01eb343222 Binary files /dev/null and b/fumadocs/assets/fonts/Gilroy-ExtraBold.ttf differ diff --git a/fumadocs/assets/fonts/Gilroy-Medium.ttf b/fumadocs/assets/fonts/Gilroy-Medium.ttf new file mode 100644 index 0000000000..06d6a9431c Binary files /dev/null and b/fumadocs/assets/fonts/Gilroy-Medium.ttf differ diff --git a/fumadocs/assets/fonts/Gilroy-Regular.ttf b/fumadocs/assets/fonts/Gilroy-Regular.ttf new file mode 100644 index 0000000000..ad17f71cbe Binary files /dev/null and b/fumadocs/assets/fonts/Gilroy-Regular.ttf differ diff --git a/fumadocs/assets/fonts/Gilroy-SemiBold.ttf b/fumadocs/assets/fonts/Gilroy-SemiBold.ttf new file mode 100644 index 0000000000..cb3cbb610e Binary files /dev/null and b/fumadocs/assets/fonts/Gilroy-SemiBold.ttf differ diff --git a/fumadocs/assets/fonts/gilroy-bold.woff2 b/fumadocs/assets/fonts/gilroy-bold.woff2 new file mode 100644 index 0000000000..46cdafb26b Binary files /dev/null and b/fumadocs/assets/fonts/gilroy-bold.woff2 differ diff --git a/fumadocs/assets/fonts/gilroy-extrabold.woff2 b/fumadocs/assets/fonts/gilroy-extrabold.woff2 new file mode 100644 index 0000000000..1fbf97e6d5 Binary files /dev/null and b/fumadocs/assets/fonts/gilroy-extrabold.woff2 differ diff --git a/fumadocs/assets/fonts/gilroy-medium.woff2 b/fumadocs/assets/fonts/gilroy-medium.woff2 new file mode 100755 index 0000000000..19aea34893 Binary files /dev/null and b/fumadocs/assets/fonts/gilroy-medium.woff2 differ diff --git a/fumadocs/assets/fonts/gilroy-regular.woff2 b/fumadocs/assets/fonts/gilroy-regular.woff2 new file mode 100755 index 0000000000..cc3473fa89 Binary files /dev/null and b/fumadocs/assets/fonts/gilroy-regular.woff2 differ diff --git a/fumadocs/assets/fonts/gilroy-semibold.woff2 b/fumadocs/assets/fonts/gilroy-semibold.woff2 new file mode 100755 index 0000000000..a7ea87b668 Binary files /dev/null and b/fumadocs/assets/fonts/gilroy-semibold.woff2 differ diff --git a/fumadocs/auth.ts b/fumadocs/auth.ts new file mode 100644 index 0000000000..eee58e5bb7 --- /dev/null +++ b/fumadocs/auth.ts @@ -0,0 +1,295 @@ +import { polar } from "@polar-sh/better-auth"; +import { Polar } from "@polar-sh/sdk"; +import * as Sentry from "@sentry/nextjs"; +import { betterAuth } from "better-auth"; +import { createAuthMiddleware } from "better-auth/api"; +import { customSession, magicLink, openAPI } from "better-auth/plugins"; +import { github } from "better-auth/social-providers"; +import Database from "better-sqlite3"; +import { Pool } from "pg"; + +import { PRODUCTS } from "./util/product-list"; +import { sendEmail } from "./util/send-mail"; + +export const polarClient = new Polar({ + accessToken: process.env.POLAR_ACCESS_TOKEN, + // Use 'sandbox' if you're using the Polar Sandbox environment + // Remember that access tokens, products, etc. are completely separated between environments. + // Access tokens obtained in Production are for instance not usable in the Sandbox environment. + server: process.env.NODE_ENV === "production" ? "production" : "sandbox", +}); + +export const auth = betterAuth({ + user: { + additionalFields: { + planType: { + type: "string", + required: false, + input: false, // don't allow user to set plan type + }, + ghSponsorInfo: { + type: "string", + required: false, + input: false, // don't allow user to set role + }, + }, + }, + emailVerification: { + sendOnSignUp: true, + autoSignInAfterVerification: true, + async sendVerificationEmail({ user, url }) { + await sendEmail({ + to: user.email, + template: "verifyEmail", + props: { url, name: user.name }, + }); + }, + }, + emailAndPassword: { + enabled: true, + requireEmailVerification: true, + autoSignIn: true, + }, + socialProviders: { + github: { + clientId: process.env.AUTH_GITHUB_ID as string, + clientSecret: process.env.AUTH_GITHUB_SECRET as string, + async getUserInfo(token) { + // This is a workaround to still re-use the default github provider getUserInfo + // and still be able to fetch the sponsor info with the token + return (await github({ + clientId: process.env.AUTH_GITHUB_ID as string, + clientSecret: process.env.AUTH_GITHUB_SECRET as string, + async mapProfileToUser() { + const resSponsor = await fetch(`https://api.github.com/graphql`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token.accessToken}`, + }, + // organization(login:"TypeCellOS") { + // user(login:"YousefED") { + body: JSON.stringify({ + query: `{ + user(login:"YousefED") { + sponsorshipForViewerAsSponsor(activeOnly:false) { + isActive, + tier { + name + monthlyPriceInDollars + } + } + } + }`, + }), + }); + + if (resSponsor.ok) { + // Mock data. TODO: disable and test actial data + // profile.sponsorInfo = { + // isActive: true, + // tier: { + // name: "test", + // monthlyPriceInDollars: 100, + // }, + // }; + // use API data: + + const data = await resSponsor.json(); + // eslint-disable-next-line no-console + console.log("sponsor data", data); + + // { + // "data": { + // "user": { + // "sponsorshipForViewerAsSponsor": { + // "isActive": true, + // "tier": { + // "name": "$90 a month", + // "monthlyPriceInDollars": 90 + // } + // } + // } + // } + // } + + const sponsorInfo: null | { + isActive: boolean; + tier: { + monthlyPriceInDollars: number; + }; + } = data.data.user.sponsorshipForViewerAsSponsor; + + if (!sponsorInfo?.isActive) { + return {}; + } + + return { + ghSponsorInfo: JSON.stringify(sponsorInfo), + }; + } + + return {}; + }, + }).getUserInfo(token))!; + }, + }, + }, + // Use SQLite for local development + database: + process.env.NODE_ENV === "production" || process.env.POSTGRES_URL + ? new Pool({ + connectionString: process.env.POSTGRES_URL, + }) + : new Database("./sqlite.db"), + plugins: [ + customSession( + async ({ user, session }) => { + // If they are a GitHub sponsor, use that plan type + if (user.ghSponsorInfo) { + const sponsorInfo = JSON.parse(user.ghSponsorInfo); + return { + planType: + sponsorInfo.tier.monthlyPriceInDollars > 100 + ? "business" + : "starter", + user, + session, + }; + } + // If not, see if they are subscribed to a Polar product + // If not, use the free plan + return { + planType: user.planType ?? PRODUCTS.free.slug, + user, + session, + }; + }, + { + // This is really only for type inference + user: { + additionalFields: { + ghSponsorInfo: { + type: "string", + required: false, + input: false, // don't allow user to set role + }, + planType: { + type: "string", + required: false, + input: false, // don't allow user to set plan type + }, + }, + }, + }, + ), + magicLink({ + sendMagicLink: async ({ email, url }) => { + await sendEmail({ + to: email, + template: "magicLink", + props: { url }, + }); + }, + }), + // Just temporary for testing + // Serves on http://localhost:3000/api/auth/reference + openAPI(), + polar({ + client: polarClient, + // Enable automatic Polar Customer creation on signup + createCustomerOnSignUp: true, + // http://localhost:3000/api/auth/portal + enableCustomerPortal: true, + // Configure checkout + checkout: { + enabled: true, + products: [ + { + productId: PRODUCTS.business.id, // ID of Product from Polar Dashboard + slug: PRODUCTS.business.slug, // Custom slug for easy reference in Checkout URL, e.g. /checkout/pro + // http://localhost:3000/api/auth/checkout/business + }, + { + productId: PRODUCTS.starter.id, + slug: PRODUCTS.starter.slug, + // http://localhost:3000/api/auth/checkout/starter + }, + ], + successUrl: "/thanks", + }, + // Incoming Webhooks handler will be installed at /polar/webhooks + webhooks: { + // webhooks have to be publicly accessible + // ngrok http http://localhost:3000 + secret: process.env.POLAR_WEBHOOK_SECRET as string, + async onPayload(payload) { + switch (payload.type) { + case "subscription.active": + case "subscription.canceled": + case "subscription.updated": + case "subscription.revoked": + case "subscription.created": + case "subscription.uncanceled": { + const authContext = await auth.$context; + const userId = payload.data.customer.externalId; + if (!userId) { + return; + } + if (payload.data.status === "active") { + const productId = payload.data.product.id; + const planType = Object.values(PRODUCTS).find( + (p) => p.id === productId, + )?.slug; + await authContext.internalAdapter.updateUser(userId, { + planType, + }); + } else { + // No active subscription, so we need to remove the plan type + await authContext.internalAdapter.updateUser(userId, { + planType: null, + }); + } + } + } + }, + }, + }), + ], + onAPIError: { + onError: (error) => { + Sentry.captureException(error); + }, + }, + hooks: { + after: createAuthMiddleware(async (ctx) => { + if ( + ctx.path === "/magic-link/verify" || + ctx.path === "/verify-email" || + ctx.path === "/sign-in/social" + ) { + // After verifying email, send them a welcome email + const newSession = ctx.context.newSession; + if (newSession) { + const oneMinuteAgo = new Date(Date.now() - 60 * 1000); + if ( + ctx.path === "/magic-link/verify" && + newSession.user.createdAt < oneMinuteAgo + ) { + // magic link is for an account that was created more than a minute ago, so just a normal sign in + // no need to send welcome email + return false; + } + await sendEmail({ + to: newSession.user.email, + template: "welcome", + props: { + name: newSession.user.name, + }, + }); + return; + } + } + }), + }, +}); diff --git a/fumadocs/components/AuthNavButton.tsx b/fumadocs/components/AuthNavButton.tsx new file mode 100644 index 0000000000..6c6f43aaa1 --- /dev/null +++ b/fumadocs/components/AuthNavButton.tsx @@ -0,0 +1,148 @@ +"use client"; + +import { authClient } from "@/util/auth-client"; +import { Menu, Transition } from "@headlessui/react"; +import clsx from "clsx"; +import { useTheme } from "next-themes"; +import Image from "next/image"; +import { usePathname } from "next/navigation"; +import { ReactElement, ReactNode } from "react"; + +import CTAButton from "./CTAButton"; + +interface User { + image?: string | null; + name?: string | null; +} + +interface UserImageProps { + user: User; +} + +export const UserImage = ({ user }: UserImageProps) => { + if (user.image) { + return ( + {user.name + ); + } + + return ( +
+ {user.name ? ( + user.name.substring(0, 2).toUpperCase() + ) : ( + + )} +
+ ); +}; + +export function AuthNavButton() { + const session = authClient.useSession(); + const { resolvedTheme } = useTheme(); + const pathname = usePathname(); + + if (!session.data) { + return ( + + Sign in + + ); + } + + return ( + +
+ 💖 Thanks for subscribing! 💖 +
+ + ), + + + {session.data.planType === "free" + ? "Get BlockNote Pro" + : "Manage my subscription"} + + , + + + , + ]} + > + +
+ ); +} + +function NavbarMenu({ + menuItems, + children, +}: { + menuItems: ReactNode[]; + children: ReactNode; +}): ReactElement { + return ( +
+ + + {children as any} + + + + {menuItems as any[]} + + + +
+ ); +} diff --git a/fumadocs/components/AuthenticationPage.tsx b/fumadocs/components/AuthenticationPage.tsx new file mode 100644 index 0000000000..e7bfaec323 --- /dev/null +++ b/fumadocs/components/AuthenticationPage.tsx @@ -0,0 +1,428 @@ +"use client"; + +import Image from "next/image"; +import { useRouter, useSearchParams } from "next/navigation"; +import { + ChangeEvent, + FormEvent, + HTMLInputTypeAttribute, + ReactNode, + useEffect, + useState, +} from "react"; + +import { authClient, signIn, signUp } from "@/util/auth-client"; +import blockNoteLogo from "@/public/img/logos/banner.svg"; +import blockNoteLogoDark from "@/public/img/logos/banner.dark.svg"; + +function AuthenticationInput(props: { + type: HTMLInputTypeAttribute; + name: string; + onChange: (e: ChangeEvent) => void; +}) { + return ( +
+ +
+ +
+
+ ); +} + +function AuthenticationBox(props: { + variant: "password" | "register" | "email"; +}) { + const router = useRouter(); + + const searchParams = useSearchParams(); + const callbackURL = + decodeURIComponent(searchParams?.get("redirect") || "") || "/"; + + const [name, setName] = useState(""); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + + const [signingInState, setSigningInState] = useState< + | { state: "init" } + | { state: "loading" } + | { state: "done"; message: string } + | { state: "error"; message: string } + >({ state: "init" }); + + const handleSubmit = async (e: FormEvent) => { + e.preventDefault(); + + setSigningInState({ state: "loading" }); + + if (props.variant === "password") { + await signIn.email( + { + email, + password, + callbackURL, + }, + { + onSuccess() { + router.push(callbackURL || "/"); + }, + onError(ctx) { + setSigningInState({ + state: "error", + message: ctx.error.message || ctx.error.statusText || "", + }); + }, + }, + ); + } else if (props.variant === "email") { + await signIn.magicLink( + { + email, + callbackURL, + }, + { + onSuccess() { + setSigningInState({ + state: "done", + message: + "We've sent you an email. Click the link inside to log in.", + }); + }, + onError(ctx) { + if (ctx.error.code === "VALIDATION_ERROR") { + setSigningInState({ + state: "error", + message: "Invalid email address domain.", + }); + } else { + setSigningInState({ + state: "error", + message: ctx.error.message || ctx.error.statusText || "", + }); + } + }, + }, + ); + } else { + await signUp.email( + { + email, + password, + name, + callbackURL: "/pricing", + }, + { + onSuccess() { + setSigningInState({ + state: "done", + message: + "We've sent you an email. Click the link inside to verify your account.", + }); + }, + onError(ctx) { + if ( + ctx.error.code === + "POLAR_CUSTOMER_CREATION_FAILED_ERROR_API_ERROR_OCCURRED_DETAILLOCBODYEMAILMSGVALUE_IS_NOT_A_VALID_EMAIL_ADDRESS_THE_DOMAIN_NAME_FESDDDCOM_DOES_NOT_EXISTTYPEVALUE_ERROR" + ) { + setSigningInState({ + state: "error", + message: "Invalid email address domain.", + }); + } else { + setSigningInState({ + state: "error", + message: ctx.error.message || ctx.error.statusText || "", + }); + } + }, + }, + ); + } + }; + + if (signingInState.state === "done") { + return ( +
+ +

{signingInState.message}

+
+ ); + } + + return ( + <> +
+ {props.variant === "register" && ( + setName(e.target.value)} + /> + )} + setEmail(e.target.value)} + /> + {(props.variant === "password" || props.variant === "register") && ( + setPassword(e.target.value)} + /> + )} + + {signingInState.state === "error" && ( +

+ {signingInState.message} +

+ )} + + + + + ); +} + +function AlternativeSignInButton(props: { + name: string; + icon: ReactNode; + onClick: () => void; +}) { + return ( + + ); +} + +function EmailSignInButton() { + const router = useRouter(); + + const searchParams = useSearchParams(); + const callbackURL = searchParams?.get("redirect") || "/"; + const theme = searchParams?.get("theme") || "light"; + + return ( +