Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/pages/docs/ai/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ Now, you can create the editor with the AI Extension enabled:
```ts
import { createBlockNoteEditor } from "@blocknote/core";
import { BlockNoteAIExtension } from "@blocknote/xl-ai";
import { en } from "@blocknote/core/locales";
import { en as aiEn } from "@blocknote/xl-ai/locales";
import {
locales as aiLocales,
createAIExtension,
} from "@blocknote/xl-ai";

const editor = createBlockNoteEditor({
dictionary: {
...en,
ai: aiLocales.en, // add default translations for the AI extension
ai: aiEn, // add default translations for the AI extension
},
extensions: [
createAIExtension({
Expand Down
4 changes: 2 additions & 2 deletions examples/09-ai/01-minimal/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import {
import {
AIMenuController,
AIToolbarButton,
locales as aiLocales,
createAIExtension,
createBlockNoteAIClient,
getAISlashMenuItems,
} from "@blocknote/xl-ai";
import { en as aiEn } from "@blocknote/xl-ai/locales";
import "@blocknote/xl-ai/style.css";
import { getEnv } from "./getEnv.js";

Expand Down Expand Up @@ -58,7 +58,7 @@ export default function App() {
const editor = useCreateBlockNote({
dictionary: {
...en,
ai: aiLocales.en, // add default translations for the AI extension
ai: aiEn, // add default translations for the AI extension
},
// Register the AI extension
extensions: [
Expand Down
4 changes: 2 additions & 2 deletions examples/09-ai/02-playground/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import {
import {
AIMenuController,
AIToolbarButton,
locales as aiLocales,
createAIExtension,
createBlockNoteAIClient,
getAIExtension,
getAISlashMenuItems,
llmFormats,
} from "@blocknote/xl-ai";
import { en as aiEn } from "@blocknote/xl-ai/locales";
import "@blocknote/xl-ai/style.css";
import { Fieldset, MantineProvider, Switch } from "@mantine/core";

Expand Down Expand Up @@ -88,7 +88,7 @@ export default function App() {
const editor = useCreateBlockNote({
dictionary: {
...en,
ai: aiLocales.en, // add default translations for the AI extension
ai: aiEn, // add default translations for the AI extension
},
// Register the AI extension
extensions: [
Expand Down
4 changes: 2 additions & 2 deletions examples/09-ai/03-custom-ai-menu-items/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import {
AIMenu,
AIMenuController,
AIToolbarButton,
locales as aiLocales,
createAIExtension,
createBlockNoteAIClient,
getAISlashMenuItems,
getDefaultAIMenuItems,
} from "@blocknote/xl-ai";
import { en as aiEn } from "@blocknote/xl-ai/locales";
import "@blocknote/xl-ai/style.css";
import { getEnv } from "./getEnv.js";

Expand Down Expand Up @@ -62,7 +62,7 @@ export default function App() {
const editor = useCreateBlockNote({
dictionary: {
...en,
ai: aiLocales.en, // add default translations for the AI extension
ai: aiEn, // add default translations for the AI extension
},
// Register the AI extension
extensions: [
Expand Down
4 changes: 2 additions & 2 deletions examples/09-ai/04-with-collaboration/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import {
import {
AIMenuController,
AIToolbarButton,
locales as aiLocales,
createAIExtension,
createBlockNoteAIClient,
getAISlashMenuItems,
} from "@blocknote/xl-ai";
import { en as aiEn } from "@blocknote/xl-ai/locales";
import "@blocknote/xl-ai/style.css";
import { useEffect, useState } from "react";
import YPartyKitProvider from "y-partykit/provider";
Expand Down Expand Up @@ -104,7 +104,7 @@ export default function App() {
},
dictionary: {
...en,
ai: aiLocales.en, // add default translations for the AI extension
ai: aiEn, // add default translations for the AI extension
},
// Register the AI extension
extensions: [
Expand Down
2 changes: 1 addition & 1 deletion packages/xl-ai-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"homepage": "https://github.com/TypeCellOS/BlockNote",
"private": false,
"license": "AGPL-3.0 OR PROPRIETARY",
"version": "0.30.0",
"version": "0.30.1",
"files": [
"dist",
"types",
Expand Down
11 changes: 8 additions & 3 deletions packages/xl-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"directory": "packages/xl-ai"
},
"license": "AGPL-3.0 OR PROPRIETARY",
"version": "0.30.0",
"version": "0.30.1",
"files": [
"dist",
"types",
Expand All @@ -36,18 +36,23 @@
"type": "module",
"source": "src/index.ts",
"types": "./types/src/index.d.ts",
"main": "./dist/blocknote-xl-ai.umd.cjs",
"main": "./dist/blocknote-xl-ai.js",
"module": "./dist/blocknote-xl-ai.js",
"exports": {
".": {
"types": "./types/src/index.d.ts",
"import": "./dist/blocknote-xl-ai.js",
"require": "./dist/blocknote-xl-ai.umd.cjs"
"require": "./dist/blocknote-xl-ai.cjs"
},
"./style.css": {
"import": "./dist/style.css",
"require": "./dist/style.css",
"style": "./dist/style.css"
},
"./locales": {
"types": "./types/src/i18n/locales/index.d.ts",
"import": "./dist/locales.js",
"require": "./dist/locales.cjs"
}
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/xl-ai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ export * from "./components/FormattingToolbar/AIToolbarButton.js";
export * from "./components/SuggestionMenu/getAISlashMenuItems.js";

export * from "./i18n/dictionary.js";
export * as locales from "./i18n/locales/index.js";

export * from "./api/index.js";
1 change: 1 addition & 0 deletions packages/xl-ai/src/locales.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./i18n/locales/index.js";
2 changes: 1 addition & 1 deletion packages/xl-ai/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"moduleResolution": "Node",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"strict": true,
"sourceMap": true,
Expand Down
30 changes: 16 additions & 14 deletions packages/xl-ai/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { defineConfig } from "vite";
import pkg from "./package.json";
// import eslintPlugin from "vite-plugin-eslint";

const deps = Object.keys(pkg.dependencies);

// https://vitejs.dev/config/
export default defineConfig((conf) => ({
test: {
Expand All @@ -32,23 +30,27 @@ export default defineConfig((conf) => ({
build: {
sourcemap: true,
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
entry: {
"blocknote-xl-ai": path.resolve(__dirname, "src/index.ts"),
locales: path.resolve(__dirname, "src/i18n/locales/index.ts"),
},
name: "blocknote-xl-ai",
fileName: "blocknote-xl-ai",
formats: ["es", "cjs"],
fileName: (format, entryName) =>
format === "es" ? `${entryName}.js` : `${entryName}.cjs`,
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: (source: string) => {
if (deps.includes(source)) {
return true;
}
return (
source.startsWith("prosemirror-") ||
source.startsWith("@shikijs/lang") ||
source.startsWith("@shikijs/theme")
);
},
external: [
...Object.keys({
...pkg.dependencies,
...pkg.peerDependencies,
...pkg.devDependencies,
}),
"react-dom/client",
"react/jsx-runtime",
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
Expand Down
77 changes: 0 additions & 77 deletions vitest.workspace.js

This file was deleted.

1 change: 1 addition & 0 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default defineWorkspace([
"./packages/shadcn/vite.config.ts",
"./packages/server-util/vite.config.ts",
"./packages/xl-pdf-exporter/vite.config.ts",
"./packages/xl-ai/vite.config.ts",
"./packages/mantine/vite.config.ts",
"./packages/core/vite.config.ts",
"./packages/xl-multi-column/vite.config.ts",
Expand Down
Loading