|
1 | | -# React + Vite |
| 1 | +# CKEditor AI Webinar Showcase |
2 | 2 |
|
3 | | -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
| 3 | +A sample React-based application demonstrating CKEditor AI features. This interactive demo showcases AI-powered editing capabilities including AI Chat, Quick Actions, and Review Mode in a real-world content management interface. |
4 | 4 |
|
5 | | -Currently, two official plugins are available: |
| 5 | +## Getting Started |
6 | 6 |
|
7 | | -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh |
8 | | -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
| 7 | +### Prerequisites |
9 | 8 |
|
10 | | -## React Compiler |
| 9 | +- Node.js |
| 10 | +- npm or yarn |
| 11 | +- [CKEditor trial/premium license](https://portal.ckeditor.com/signup) |
11 | 12 |
|
12 | | -The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). |
| 13 | +### Installation |
13 | 14 |
|
14 | | -## Expanding the ESLint configuration |
| 15 | +1. **Install dependencies:** |
15 | 16 |
|
16 | | -If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project. |
| 17 | + ```sh |
| 18 | + npm install |
| 19 | + ``` |
| 20 | + |
| 21 | +2. **Configure environment variables:** |
| 22 | + |
| 23 | + - Copy `.env.example` to `.env` |
| 24 | + - Fill in your CKEditor credentials from the [CKEditor Portal](https://portal.ckeditor.com/): |
| 25 | + - `VITE_CKEDITOR_LICENSE_KEY` |
| 26 | + - `VITE_CKEDITOR_CLOUD_SERVICES_TOKEN_URL` |
| 27 | + |
| 28 | +3. **Start the development server:** |
| 29 | + |
| 30 | + ```bash |
| 31 | + npm run dev |
| 32 | + ``` |
| 33 | + |
| 34 | +4. **Open your browser at `http://localhost:5173` 🎉** |
| 35 | + |
| 36 | +## About CKEditor AI |
| 37 | + |
| 38 | +This demo showcases [CKEditor AI](https://ckeditor.com/ckeditor-ai), a suite of AI-powered features that enhance content creation and editing. Main focus is to demonstrate configuration and customization capabilities of following features: |
| 39 | + |
| 40 | +- **AI Chat**: Conversational AI assistant integrated into the editor for content generation, editing, and questions |
| 41 | +- **AI Quick Actions**: Context-aware shortcuts for common AI operations (summarize, rephrase, translate, etc.) |
| 42 | +- **AI Review Mode**: Comprehensive content analysis with suggestions for improvements |
| 43 | + |
| 44 | +## Interactive Tasks |
| 45 | + |
| 46 | +The codebase includes **5 hands-on tasks** to explore CKEditor AI customization. Each task is marked with comments |
| 47 | + |
| 48 | +```js |
| 49 | +// 📌 Task ... |
| 50 | +``` |
| 51 | + |
| 52 | +in `src/components/ContentField.jsx`. |
| 53 | + |
| 54 | +Complete them sequentially for the best learning experience. |
| 55 | + |
| 56 | +### 📌 Task 1: Integrate AI Sidebar to the Editor |
| 57 | + |
| 58 | +Move the AI interface from an overlay popup to the right sidebar for a more integrated experience. |
| 59 | + |
| 60 | +**Steps:** |
| 61 | + |
| 62 | +1. Import `useSidebar` import and use it to get a reference to the sidebar element |
| 63 | +2. Comment out the `toggleAi` button in toolbar since you won't need it anymore |
| 64 | +3. Update AI container config from `type: 'overlay'` to `type: 'sidebar'` and provide the sidebar container reference |
| 65 | +4. Remove the placeholder span in `RightSidebar.jsx` and ensure the AI chat is rendered in the whole sidebar container |
| 66 | + |
| 67 | +**Expected Result:** AI chat appears integrated in the right sidebar; no overlay popup; toggle button removed from toolbar. |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### 📌 Task 2: Custom Model Selection |
| 72 | + |
| 73 | +Enable AI model selection dropdown with specified model options. |
| 74 | + |
| 75 | +**Steps:** Uncomment the model configuration block |
| 76 | + |
| 77 | +**Expected Result:** Model selector dropdown in AI chat interface contains only specified models, not all of them. |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +### 📌 Task 3: Custom Context Sources |
| 82 | + |
| 83 | +Add custom knowledge source group that AI can reference when generating content. |
| 84 | + |
| 85 | +**Steps:** Uncomment the `sources` array in context configuration. |
| 86 | + |
| 87 | +**Included Sources in one source group:** |
| 88 | + |
| 89 | +- **"Email Guidelines"** - Web resource with email writing standards |
| 90 | +- **"Content Creation Guidelines"** - Web resource with content best practices |
| 91 | + |
| 92 | +**Expected Result:** New "Internal Guidelines" section appears in AI context menu; AI can cite and follow these guidelines when generating content. |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +### 📌 Task 4: Custom Quick Actions |
| 97 | + |
| 98 | +Add custom AI commands to the quick actions menu. |
| 99 | + |
| 100 | +**Steps:** Uncomment the `extraCommands` array in quick actions configuration. |
| 101 | + |
| 102 | +**Example Actions:** |
| 103 | + |
| 104 | +- **"Ask expert AI about this"** (CHAT type) - Opens AI chat with expert analysis prompt for non-technical explanations |
| 105 | +- **"Enhance by links"** (ACTION type) - Automatically adds relevant hyperlinks to selected text |
| 106 | + |
| 107 | +**Expected Result:** Custom actions appear in quick actions menu (both toolbar and balloon menu). |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +### 📌 Task 5: Custom Translation in Review Mode |
| 112 | + |
| 113 | +Specify language options for AI-powered translation. |
| 114 | + |
| 115 | +**Steps:** Uncomment the `translations` in review mode configuration. |
| 116 | + |
| 117 | +**Expected Result:** Only Polish and Czech appear in the translation dropdown in AI Review Mode. |
| 118 | + |
| 119 | +### Learn More |
| 120 | + |
| 121 | +- [CKEditor AI Overview](https://ckeditor.com/ckeditor-ai) |
| 122 | +- [Get Trial License](https://portal.ckeditor.com/signup/) |
| 123 | +- [CKEditor Builder](https://ckeditor.com/ckeditor-5/builder/) |
| 124 | +- [CKEditor AI Documentation](https://ckeditor.com/docs/ckeditor5/latest/features/ai/ckeditor-ai-overview.html) |
| 125 | +- [CKEditor AI demo](https://ckeditor.com/ckeditor-5/capabilities/ai-features/) |
0 commit comments