@eventuras/scribo 0.8.3 → 0.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts +11 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/MarkdownEditor.d.ts +18 -0
- package/dist/MarkdownEditor.d.ts.map +1 -0
- package/dist/MarkdownEditor2.js +111 -0
- package/dist/MarkdownEditor2.js.map +1 -0
- package/dist/MarkdownInput.d.ts +27 -0
- package/dist/MarkdownInput.d.ts.map +1 -0
- package/dist/MarkdownInput.js +57 -0
- package/dist/MarkdownInput.js.map +1 -0
- package/dist/callout.js +5 -0
- package/dist/context/SharedHistoryContext.d.ts +11 -0
- package/dist/context/SharedHistoryContext.d.ts.map +1 -0
- package/dist/context/SharedHistoryContext.js +12 -0
- package/dist/context/SharedHistoryContext.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +4 -0
- package/dist/nodes/EditorNodes.d.ts +4 -0
- package/dist/nodes/EditorNodes.d.ts.map +1 -0
- package/dist/nodes/EditorNodes.js +39 -0
- package/dist/nodes/EditorNodes.js.map +1 -0
- package/dist/nodes/callout/CalloutComponent.d.ts +6 -0
- package/dist/nodes/callout/CalloutComponent.d.ts.map +1 -0
- package/dist/nodes/callout/CalloutComponent.js +53 -0
- package/dist/nodes/callout/CalloutComponent.js.map +1 -0
- package/dist/nodes/callout/CalloutNode.d.ts +27 -0
- package/dist/nodes/callout/CalloutNode.d.ts.map +1 -0
- package/dist/nodes/callout/CalloutNode.js +153 -0
- package/dist/nodes/callout/CalloutNode.js.map +1 -0
- package/dist/nodes/callout/CalloutTransformer.d.ts +3 -0
- package/dist/nodes/callout/CalloutTransformer.d.ts.map +1 -0
- package/dist/nodes/callout/CalloutTransformer.js +48 -0
- package/dist/nodes/callout/CalloutTransformer.js.map +1 -0
- package/dist/nodes/callout/calloutPlugin.d.ts +3 -0
- package/dist/nodes/callout/calloutPlugin.d.ts.map +1 -0
- package/dist/nodes/callout/calloutPlugin.js +34 -0
- package/dist/nodes/callout/calloutPlugin.js.map +1 -0
- package/dist/nodes/callout/index.d.ts +6 -0
- package/dist/nodes/callout/index.d.ts.map +1 -0
- package/dist/nodes/schedule/ScheduleItemComponent.d.ts +9 -0
- package/dist/nodes/schedule/ScheduleItemComponent.d.ts.map +1 -0
- package/dist/nodes/schedule/ScheduleItemComponent.js +167 -0
- package/dist/nodes/schedule/ScheduleItemComponent.js.map +1 -0
- package/dist/nodes/schedule/ScheduleItemNode.d.ts +31 -0
- package/dist/nodes/schedule/ScheduleItemNode.d.ts.map +1 -0
- package/dist/nodes/schedule/ScheduleItemNode.js +94 -0
- package/dist/nodes/schedule/ScheduleItemNode.js.map +1 -0
- package/dist/nodes/schedule/ScheduleTransformer.d.ts +22 -0
- package/dist/nodes/schedule/ScheduleTransformer.d.ts.map +1 -0
- package/dist/nodes/schedule/ScheduleTransformer.js +60 -0
- package/dist/nodes/schedule/ScheduleTransformer.js.map +1 -0
- package/dist/nodes/schedule/index.d.ts +5 -0
- package/dist/nodes/schedule/index.d.ts.map +1 -0
- package/dist/nodes/schedule/schedulePlugin.d.ts +3 -0
- package/dist/nodes/schedule/schedulePlugin.d.ts.map +1 -0
- package/dist/nodes/schedule/schedulePlugin.js +33 -0
- package/dist/nodes/schedule/schedulePlugin.js.map +1 -0
- package/dist/plugins/AutoLinkPlugin.d.ts +3 -0
- package/dist/plugins/AutoLinkPlugin.d.ts.map +1 -0
- package/dist/plugins/AutoLinkPlugin.js +22 -0
- package/dist/plugins/AutoLinkPlugin.js.map +1 -0
- package/dist/plugins/FloatingLinkEditorPlugin.d.ts +7 -0
- package/dist/plugins/FloatingLinkEditorPlugin.d.ts.map +1 -0
- package/dist/plugins/FloatingLinkEditorPlugin2.js +302 -0
- package/dist/plugins/FloatingLinkEditorPlugin2.js.map +1 -0
- package/dist/plugins/HistoryPlugin.d.ts +26 -0
- package/dist/plugins/HistoryPlugin.d.ts.map +1 -0
- package/dist/plugins/LinkPlugin.d.ts +3 -0
- package/dist/plugins/LinkPlugin.d.ts.map +1 -0
- package/dist/plugins/LinkPlugin.js +18 -0
- package/dist/plugins/LinkPlugin.js.map +1 -0
- package/dist/plugins/ToolbarPlugin.d.ts +7 -0
- package/dist/plugins/ToolbarPlugin.d.ts.map +1 -0
- package/dist/plugins/ToolbarPlugin.js +372 -0
- package/dist/plugins/ToolbarPlugin.js.map +1 -0
- package/dist/schedule.js +4 -0
- package/dist/scribo.css +1977 -0
- package/dist/themes/EditorTheme.d.ts +4 -0
- package/dist/themes/EditorTheme.d.ts.map +1 -0
- package/dist/themes/EditorTheme2.js +107 -0
- package/dist/themes/EditorTheme2.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/ui/ContentEditable.d.ts +6 -0
- package/dist/ui/ContentEditable.d.ts.map +1 -0
- package/dist/ui/ContentEditable2.js +14 -0
- package/dist/ui/ContentEditable2.js.map +1 -0
- package/dist/ui/DropDown.d.ts +18 -0
- package/dist/ui/DropDown.d.ts.map +1 -0
- package/dist/ui/DropDown.js +162 -0
- package/dist/ui/DropDown.js.map +1 -0
- package/dist/ui/Placeholder.d.ts +6 -0
- package/dist/ui/Placeholder.d.ts.map +1 -0
- package/dist/ui/Placeholder2.js +13 -0
- package/dist/ui/Placeholder2.js.map +1 -0
- package/dist/utils/environment.d.ts +24 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/environment.js +20 -0
- package/dist/utils/environment.js.map +1 -0
- package/dist/utils/getSelectedNode.d.ts +3 -0
- package/dist/utils/getSelectedNode.d.ts.map +1 -0
- package/dist/utils/getSelectedNode.js +23 -0
- package/dist/utils/getSelectedNode.js.map +1 -0
- package/dist/utils/setFloatingElemPosition.d.ts +2 -0
- package/dist/utils/setFloatingElemPosition.d.ts.map +1 -0
- package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +2 -0
- package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts.map +1 -0
- package/dist/utils/setFloatingElemPositionForLinkEditor.js +33 -0
- package/dist/utils/setFloatingElemPositionForLinkEditor.js.map +1 -0
- package/dist/utils/url.d.ts +11 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/url.js +33 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +55 -38
- package/src/MarkdownEditor.css +61 -47
- package/src/MarkdownEditor.tsx +76 -29
- package/src/MarkdownInput.tsx +9 -10
- package/src/context/SharedHistoryContext.tsx +8 -16
- package/src/main.tsx +3 -3
- package/src/nodes/EditorNodes.ts +10 -10
- package/src/nodes/callout/Callout.css +94 -0
- package/src/nodes/callout/CalloutComponent.tsx +61 -0
- package/src/nodes/callout/CalloutNode.ts +197 -0
- package/src/nodes/callout/CalloutTransformer.ts +87 -0
- package/src/nodes/callout/calloutPlugin.ts +37 -0
- package/src/nodes/callout/index.ts +5 -0
- package/src/nodes/schedule/ScheduleItem.css +140 -0
- package/src/nodes/schedule/ScheduleItemComponent.tsx +195 -0
- package/src/nodes/schedule/ScheduleItemNode.ts +135 -0
- package/src/nodes/schedule/ScheduleTransformer.ts +80 -0
- package/src/nodes/schedule/index.ts +4 -0
- package/src/nodes/schedule/schedulePlugin.ts +33 -0
- package/src/plugins/AutoLinkPlugin.tsx +5 -10
- package/src/plugins/FloatingLinkEditorPlugin.tsx +42 -66
- package/src/plugins/HistoryPlugin.tsx +20 -30
- package/src/plugins/LinkPlugin.tsx +2 -3
- package/src/plugins/ToolbarPlugin.tsx +129 -141
- package/src/themes/EditorTheme.css +9 -5
- package/src/themes/EditorTheme.ts +89 -90
- package/src/types.ts +27 -0
- package/src/ui/ContentEditable.tsx +5 -5
- package/src/ui/DropDown.tsx +23 -41
- package/src/ui/Placeholder.tsx +21 -21
- package/src/utils/environment.ts +6 -12
- package/src/utils/getSelectedNode.ts +3 -5
- package/src/utils/setFloatingElemPosition.ts +2 -5
- package/src/utils/setFloatingElemPositionForLinkEditor.ts +1 -1
- package/src/utils/url.ts +4 -10
- package/tsconfig.json +8 -0
- package/CHANGELOG.md +0 -65
- package/README.md +0 -126
- package/RELEASE.md +0 -102
- package/eslint.config.js +0 -4
- package/src/App.css +0 -35
- package/src/App.tsx +0 -42
- package/src/index.tsx +0 -13
- package/tsconfig.node.json +0 -11
- package/vite.config.site.ts +0 -19
- package/vite.config.ts +0 -33
- /package/{src → dist}/vite-env.d.ts +0 -0
package/README.md
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# Scribo markdown editor
|
|
2
|
-
|
|
3
|
-
Markdown editor built on [Lexical framework](https://lexical.dev/). Intended to be used as part of eventuras, but also packed as a standalone component. Scribo is a WYSIWYG editor with markdown export.
|
|
4
|
-
|
|
5
|
-
The editor should provide simple and intuitive editing of markdown text, with a focus on the most common use cases.
|
|
6
|
-
|
|
7
|
-
Test the [scribo editor online demo](https://scribo.losol.no/).
|
|
8
|
-
|
|
9
|
-
> **Lexical version**: we are keeping the lexical version in sync with the [lexical version used in Payload CMS](https://github.com/payloadcms/payload/blob/main/packages/richtext-lexical/package.json), to prevent multiple versions making trouble.
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pnpm add @eventuras/scribo
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
**Important**: You must import the CSS file for Scribo to display correctly:
|
|
20
|
-
|
|
21
|
-
### MarkdownEditor (WYSIWYG Editor)
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import "@eventuras/scribo/style.css";
|
|
25
|
-
import { MarkdownEditor } from "@eventuras/scribo";
|
|
26
|
-
|
|
27
|
-
function MyComponent() {
|
|
28
|
-
return <MarkdownEditor defaultValue="# Hello World" />;
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### MarkdownInput (Form-ready Input)
|
|
33
|
-
|
|
34
|
-
For use with native HTML forms (FormData API):
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
import "@eventuras/scribo/style.css";
|
|
38
|
-
import { MarkdownInput } from "@eventuras/scribo";
|
|
39
|
-
|
|
40
|
-
function MyForm() {
|
|
41
|
-
return (
|
|
42
|
-
<form>
|
|
43
|
-
<MarkdownInput
|
|
44
|
-
name="description"
|
|
45
|
-
label="Description"
|
|
46
|
-
placeholder="Enter markdown..."
|
|
47
|
-
defaultValue="# Hello"
|
|
48
|
-
maxLength={500}
|
|
49
|
-
className="mb-4"
|
|
50
|
-
labelClassName="font-bold"
|
|
51
|
-
editorClassName="border rounded"
|
|
52
|
-
errorClassName="text-red-500"
|
|
53
|
-
/>
|
|
54
|
-
<button type="submit">Submit</button>
|
|
55
|
-
</form>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
The `MarkdownInput` component is framework-agnostic and provides:
|
|
61
|
-
|
|
62
|
-
- Hidden input for FormData submission
|
|
63
|
-
- Optional label and validation
|
|
64
|
-
- Flexible styling via className props
|
|
65
|
-
- Character limit validation
|
|
66
|
-
|
|
67
|
-
### Peer Dependencies
|
|
68
|
-
|
|
69
|
-
Scribo requires the following peer dependencies:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
pnpm add react react-dom lexical @lexical/code @lexical/hashtag @lexical/link @lexical/list @lexical/mark @lexical/markdown @lexical/overflow @lexical/react @lexical/rich-text @lexical/selection @lexical/table @lexical/utils prismjs
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Prism.js for syntax highlighting:**
|
|
76
|
-
Scribo uses Prism.js for code syntax highlighting but does not bundle it. You need to install `prismjs` and import the language grammars you need in your application.
|
|
77
|
-
|
|
78
|
-
Example:
|
|
79
|
-
|
|
80
|
-
```tsx
|
|
81
|
-
import "prismjs";
|
|
82
|
-
import "prismjs/components/prism-javascript";
|
|
83
|
-
import "prismjs/components/prism-typescript";
|
|
84
|
-
import "prismjs/components/prism-css";
|
|
85
|
-
// Import other languages as needed
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Develop
|
|
89
|
-
|
|
90
|
-
To start developing Scribo, run the following commands:
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
pnpm install
|
|
94
|
-
vite dev
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Release
|
|
98
|
-
|
|
99
|
-
Quick release process:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
# 1. Create changeset (choose one)
|
|
103
|
-
pnpm changeset # Manual (recommended)
|
|
104
|
-
pnpm changeset:suggest # Auto-generate from commits
|
|
105
|
-
|
|
106
|
-
# 2. Version package
|
|
107
|
-
pnpm changeset:version
|
|
108
|
-
|
|
109
|
-
# 3. Commit and push (create PR to main)
|
|
110
|
-
git checkout -b release/scribo-v0.x.x
|
|
111
|
-
git add .
|
|
112
|
-
git commit -m "chore(scribo): release v0.x.x"
|
|
113
|
-
git push origin release/scribo-v0.x.x
|
|
114
|
-
|
|
115
|
-
# 4. Merge PR to main, then automated workflow will publish to npm and create GitHub release
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
For detailed release instructions, including setup and troubleshooting, see [RELEASE.md](./RELEASE.md).
|
|
119
|
-
|
|
120
|
-
## Credits
|
|
121
|
-
|
|
122
|
-
Scribo is built on the [Lexical framework](https://lexical.dev/), and most of the code in the repo is done by [Meta under MIT license](https://github.com/facebook/lexical).
|
|
123
|
-
|
|
124
|
-
## Learn More
|
|
125
|
-
|
|
126
|
-
- [Lexical](https://lexical.dev/)
|
package/RELEASE.md
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# Release Instructions for @eventuras/scribo
|
|
2
|
-
|
|
3
|
-
This document explains how to configure the automated release workflow for `@eventuras/scribo`.
|
|
4
|
-
|
|
5
|
-
## Release Process
|
|
6
|
-
|
|
7
|
-
### Standard Release
|
|
8
|
-
|
|
9
|
-
1. **Create changesets** for your changes:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# Option A: Manual (recommended for better changelog messages)
|
|
13
|
-
pnpm changeset
|
|
14
|
-
|
|
15
|
-
# Option B: Auto-generate from commits (review and edit after)
|
|
16
|
-
pnpm changeset:suggest
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
> **Tip**: `changeset:suggest` analyzes your git commits since the last release and automatically generates changeset files. Review the generated changesets and edit them for clarity if needed.
|
|
20
|
-
|
|
21
|
-
2. **Version the package** when ready:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
pnpm changeset:version
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
3. **Commit and push** the version bump:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
git add .
|
|
31
|
-
git commit -m "chore(scribo): release v0.x.x"
|
|
32
|
-
git push origin main
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
4. **Automated workflow** will:
|
|
36
|
-
- ✅ Build the package
|
|
37
|
-
- ✅ Publish to npm with provenance
|
|
38
|
-
- ✅ Create Git tag `@eventuras/scribo@x.x.x`
|
|
39
|
-
- ✅ Create GitHub Release with changelog
|
|
40
|
-
|
|
41
|
-
### Manual Release
|
|
42
|
-
|
|
43
|
-
If the automated workflow fails or you need to publish manually:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
cd libs/scribo
|
|
47
|
-
pnpm build
|
|
48
|
-
npm login --scope @eventuras --auth-type web
|
|
49
|
-
npm publish --access public
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Release Setup
|
|
53
|
-
|
|
54
|
-
### NPM Trusted Publishing Setup (Recommended)
|
|
55
|
-
|
|
56
|
-
Scribo uses **npm trusted publishing with OIDC** for secure, token-free publishing.
|
|
57
|
-
|
|
58
|
-
#### Configure Trusted Publisher on npmjs.com
|
|
59
|
-
|
|
60
|
-
1. Log in to [npmjs.com](https://www.npmjs.com)
|
|
61
|
-
2. Navigate to `@eventuras/scribo` package settings
|
|
62
|
-
3. Find **Trusted Publisher** section
|
|
63
|
-
4. Click **GitHub Actions**
|
|
64
|
-
5. Configure:
|
|
65
|
-
- **Organization or user**: `losol`
|
|
66
|
-
- **Repository**: `eventuras`
|
|
67
|
-
- **Workflow filename**: `scribo-release.yml` (include `.yml` extension)
|
|
68
|
-
- **Environment name**: `scribo-npm`
|
|
69
|
-
6. Click **Add trusted publisher**
|
|
70
|
-
|
|
71
|
-
#### Set Up GitHub Environment
|
|
72
|
-
|
|
73
|
-
The workflow uses a GitHub environment for deployment protection (optional but recommended):
|
|
74
|
-
|
|
75
|
-
1. Go to your GitHub repository
|
|
76
|
-
2. Navigate to **Settings** → **Environments**
|
|
77
|
-
3. Click **New environment**
|
|
78
|
-
4. Name: `scribo-npm`
|
|
79
|
-
5. (Optional) Add protection rules:
|
|
80
|
-
- Required reviewers if you want manual approval
|
|
81
|
-
- Deployment branches: Select "Selected branches" and add `main`
|
|
82
|
-
6. Click **Create environment**
|
|
83
|
-
|
|
84
|
-
> **Note**: With trusted publishing, you don't need to add any secrets to this environment. The workflow uses OIDC authentication automatically.
|
|
85
|
-
|
|
86
|
-
### Legacy: Token-Based Publishing (Not Recommended)
|
|
87
|
-
|
|
88
|
-
If you cannot use trusted publishing, you can fall back to traditional npm tokens:
|
|
89
|
-
|
|
90
|
-
1. Create a granular access token on npmjs.com with write access to `@eventuras/scribo`
|
|
91
|
-
2. Add it as `NODE_AUTH_TOKEN` secret in the `scribo-npm` environment
|
|
92
|
-
3. Update the workflow to include `NODE_AUTH_TOKEN` environment variable in the publish step
|
|
93
|
-
|
|
94
|
-
However, trusted publishing is strongly recommended for better security.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
## Workflow Trigger
|
|
98
|
-
|
|
99
|
-
The release workflow (`.github/workflows/scribo-release.yml`) triggers automatically when:
|
|
100
|
-
|
|
101
|
-
- Changes are pushed to the `main` branch
|
|
102
|
-
- The file `libs/scribo/package.json` is modified
|
package/eslint.config.js
DELETED
package/src/App.css
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
background: #eee;
|
|
4
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
h1 {
|
|
8
|
-
text-align: center;
|
|
9
|
-
margin: 20px 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.editor-container {
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.markdown-output {
|
|
18
|
-
white-space: pre-wrap;
|
|
19
|
-
overflow: auto;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@media (min-width: 768px) {
|
|
23
|
-
.editor-container {
|
|
24
|
-
flex-direction: row;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.markdown-editor,
|
|
28
|
-
.markdown-output {
|
|
29
|
-
flex: 1;
|
|
30
|
-
margin: 10px;
|
|
31
|
-
padding: 20px;
|
|
32
|
-
border: 1px solid #ccc;
|
|
33
|
-
border-radius: 5px;
|
|
34
|
-
}
|
|
35
|
-
}
|
package/src/App.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
|
-
import MarkdownEditor from './MarkdownEditor'
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
/** Initial markdown string */
|
|
6
|
-
initialMarkdown: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Wraps editor + rendered output
|
|
11
|
-
* @see {@link Props}
|
|
12
|
-
*/
|
|
13
|
-
export function App({ initialMarkdown }: Readonly<Props>) {
|
|
14
|
-
// State for current markdown
|
|
15
|
-
const [markdown, setMarkdown] = useState<string>(initialMarkdown)
|
|
16
|
-
|
|
17
|
-
// Handle editor changes
|
|
18
|
-
const onChange = (newMd: string) => setMarkdown(newMd)
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div className="App">
|
|
22
|
-
<h1>Scribo Markdown editor</h1>
|
|
23
|
-
|
|
24
|
-
<div className="editor-container">
|
|
25
|
-
{/* Editor panel */}
|
|
26
|
-
<div className="markdown-editor">
|
|
27
|
-
<h2>Edit content</h2>
|
|
28
|
-
<MarkdownEditor
|
|
29
|
-
initialMarkdown={markdown}
|
|
30
|
-
onChange={onChange}
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
{/* Rendered output */}
|
|
35
|
-
<div className="markdown-output">
|
|
36
|
-
<h2>See the markdown output</h2>
|
|
37
|
-
<pre>{markdown}</pre>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
package/src/index.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import ReactDOM from 'react-dom/client'
|
|
3
|
-
import { App } from './App'
|
|
4
|
-
import './App.css'
|
|
5
|
-
import './MarkdownEditor.css'
|
|
6
|
-
|
|
7
|
-
import readmeRaw from '../README.md?raw'
|
|
8
|
-
|
|
9
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
10
|
-
<React.StrictMode>
|
|
11
|
-
<App initialMarkdown={readmeRaw} />
|
|
12
|
-
</React.StrictMode>,
|
|
13
|
-
)
|
package/tsconfig.node.json
DELETED
package/vite.config.site.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import react from '@vitejs/plugin-react';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Vite configuration for building the demo site.
|
|
7
|
-
* Used explicitly via: vite build --config vite.config.site.ts
|
|
8
|
-
*/
|
|
9
|
-
export default defineConfig({
|
|
10
|
-
plugins: [react()],
|
|
11
|
-
build: {
|
|
12
|
-
outDir: 'dist/site',
|
|
13
|
-
rollupOptions: {
|
|
14
|
-
input: {
|
|
15
|
-
main: resolve(__dirname, 'index.html'),
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
});
|
package/vite.config.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineReactLibConfig } from '@eventuras/vite-config/react-lib';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Vite configuration for building the Scribo library.
|
|
5
|
-
* For the demo site, see vite.config.site.ts
|
|
6
|
-
*/
|
|
7
|
-
export default defineReactLibConfig({
|
|
8
|
-
entry: 'src/main.tsx',
|
|
9
|
-
useSWC: false,
|
|
10
|
-
external: [
|
|
11
|
-
// Externalize all Lexical packages to avoid bundling them
|
|
12
|
-
'lexical',
|
|
13
|
-
'@lexical/code',
|
|
14
|
-
'@lexical/hashtag',
|
|
15
|
-
'@lexical/history',
|
|
16
|
-
'@lexical/link',
|
|
17
|
-
'@lexical/list',
|
|
18
|
-
'@lexical/markdown',
|
|
19
|
-
'@lexical/mark',
|
|
20
|
-
'@lexical/overflow',
|
|
21
|
-
'@lexical/react',
|
|
22
|
-
'@lexical/rich-text',
|
|
23
|
-
'@lexical/selection',
|
|
24
|
-
'@lexical/text',
|
|
25
|
-
'@lexical/utils',
|
|
26
|
-
// Also externalize any sub-exports from @lexical/react
|
|
27
|
-
/^@lexical\//,
|
|
28
|
-
// Externalize Prism.js to avoid bundling all language grammars
|
|
29
|
-
'prismjs',
|
|
30
|
-
/^prismjs\//,
|
|
31
|
-
],
|
|
32
|
-
});
|
|
33
|
-
|
|
File without changes
|