Skip to content

Commit

Permalink
refactor(web-core): remove unused imports and styles
Browse files Browse the repository at this point in the history
Remove Home.module.css file and unused imports in settings.tsx and live-editor.tsx files. Additionally, update README.md with usage instructions for web-core package installation and example implementation.
  • Loading branch information
phodal committed Nov 4, 2024
1 parent 7820f20 commit c34f3a2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 14 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,41 @@ Demo Videos: [开源 AI 原生编辑器 Studio B3](https://www.bilibili.com/vide

## Usage

See in [web-core](./web-core/README.md)

### Install

```bash
npm install -g @studio-b3/web-core
```

Use

```typescript jsx
import Head from 'next/head'

import "../styles/editor-styles.css"
import { LiveEditor } from '@studio-b3/web-core'
import '@/i18n/i18n';

export default function Home() {
return (
<div className={styles.container}>
<Head>
<title>Studio B3 - all you need is editor!</title>
<link rel="icon" href="/favicon.ico" />
</Head>

<main>
<div>
<LiveEditor />
</div>
</main>
</div>
);
}
```

### Custom Menu examples

```typescript
Expand Down
5 changes: 2 additions & 3 deletions web/core/lib/editor/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as Dialog from '@radix-ui/react-dialog'
import * as Tabs from '@radix-ui/react-tabs'
import Select from 'react-select';

import styles from '@/styles/Home.module.css'
import { ARTICLE_TYPE_OPTIONS } from "@/editor/defs/type-options.type";

// all options
Expand Down Expand Up @@ -105,7 +104,7 @@ export const Settings = ({ editor }: { editor: Editor }) => {

<Dialog.Root>
<Dialog.Trigger asChild>
<Button className={styles.setting} onClick={() => {
<Button onClick={() => {
// show some dialog
}}>
<GearIcon/>
Expand Down Expand Up @@ -155,4 +154,4 @@ const SettingField = ({ label, children }: any) => (
rows={12}
className="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Write your thoughts here..."></textarea>
)
)
1 change: 0 additions & 1 deletion web/core/lib/editor/live-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { Theme } from '@radix-ui/themes';

import './editor.css';

import { InlineCompletion } from '@/editor/extensions/inline-completion/inline-completion';
import { MenuBubble } from '@/editor/menu/menu-bubble';
import { createSlashExtension } from '@/editor/extensions/slash-command/slash-extension.ts';
import { createQuickBox } from '@/editor/extensions/quick-box/quick-box-extension';
Expand Down
10 changes: 0 additions & 10 deletions web/core/lib/styles/Home.module.css

This file was deleted.

0 comments on commit c34f3a2

Please sign in to comment.