@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.
Files changed (164) hide show
  1. package/dist/App.d.ts +11 -0
  2. package/dist/App.d.ts.map +1 -0
  3. package/dist/MarkdownEditor.d.ts +18 -0
  4. package/dist/MarkdownEditor.d.ts.map +1 -0
  5. package/dist/MarkdownEditor2.js +111 -0
  6. package/dist/MarkdownEditor2.js.map +1 -0
  7. package/dist/MarkdownInput.d.ts +27 -0
  8. package/dist/MarkdownInput.d.ts.map +1 -0
  9. package/dist/MarkdownInput.js +57 -0
  10. package/dist/MarkdownInput.js.map +1 -0
  11. package/dist/callout.js +5 -0
  12. package/dist/context/SharedHistoryContext.d.ts +11 -0
  13. package/dist/context/SharedHistoryContext.d.ts.map +1 -0
  14. package/dist/context/SharedHistoryContext.js +12 -0
  15. package/dist/context/SharedHistoryContext.js.map +1 -0
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/main.d.ts +5 -0
  19. package/dist/main.d.ts.map +1 -0
  20. package/dist/main.js +4 -0
  21. package/dist/nodes/EditorNodes.d.ts +4 -0
  22. package/dist/nodes/EditorNodes.d.ts.map +1 -0
  23. package/dist/nodes/EditorNodes.js +39 -0
  24. package/dist/nodes/EditorNodes.js.map +1 -0
  25. package/dist/nodes/callout/CalloutComponent.d.ts +6 -0
  26. package/dist/nodes/callout/CalloutComponent.d.ts.map +1 -0
  27. package/dist/nodes/callout/CalloutComponent.js +53 -0
  28. package/dist/nodes/callout/CalloutComponent.js.map +1 -0
  29. package/dist/nodes/callout/CalloutNode.d.ts +27 -0
  30. package/dist/nodes/callout/CalloutNode.d.ts.map +1 -0
  31. package/dist/nodes/callout/CalloutNode.js +153 -0
  32. package/dist/nodes/callout/CalloutNode.js.map +1 -0
  33. package/dist/nodes/callout/CalloutTransformer.d.ts +3 -0
  34. package/dist/nodes/callout/CalloutTransformer.d.ts.map +1 -0
  35. package/dist/nodes/callout/CalloutTransformer.js +48 -0
  36. package/dist/nodes/callout/CalloutTransformer.js.map +1 -0
  37. package/dist/nodes/callout/calloutPlugin.d.ts +3 -0
  38. package/dist/nodes/callout/calloutPlugin.d.ts.map +1 -0
  39. package/dist/nodes/callout/calloutPlugin.js +34 -0
  40. package/dist/nodes/callout/calloutPlugin.js.map +1 -0
  41. package/dist/nodes/callout/index.d.ts +6 -0
  42. package/dist/nodes/callout/index.d.ts.map +1 -0
  43. package/dist/nodes/schedule/ScheduleItemComponent.d.ts +9 -0
  44. package/dist/nodes/schedule/ScheduleItemComponent.d.ts.map +1 -0
  45. package/dist/nodes/schedule/ScheduleItemComponent.js +167 -0
  46. package/dist/nodes/schedule/ScheduleItemComponent.js.map +1 -0
  47. package/dist/nodes/schedule/ScheduleItemNode.d.ts +31 -0
  48. package/dist/nodes/schedule/ScheduleItemNode.d.ts.map +1 -0
  49. package/dist/nodes/schedule/ScheduleItemNode.js +94 -0
  50. package/dist/nodes/schedule/ScheduleItemNode.js.map +1 -0
  51. package/dist/nodes/schedule/ScheduleTransformer.d.ts +22 -0
  52. package/dist/nodes/schedule/ScheduleTransformer.d.ts.map +1 -0
  53. package/dist/nodes/schedule/ScheduleTransformer.js +60 -0
  54. package/dist/nodes/schedule/ScheduleTransformer.js.map +1 -0
  55. package/dist/nodes/schedule/index.d.ts +5 -0
  56. package/dist/nodes/schedule/index.d.ts.map +1 -0
  57. package/dist/nodes/schedule/schedulePlugin.d.ts +3 -0
  58. package/dist/nodes/schedule/schedulePlugin.d.ts.map +1 -0
  59. package/dist/nodes/schedule/schedulePlugin.js +33 -0
  60. package/dist/nodes/schedule/schedulePlugin.js.map +1 -0
  61. package/dist/plugins/AutoLinkPlugin.d.ts +3 -0
  62. package/dist/plugins/AutoLinkPlugin.d.ts.map +1 -0
  63. package/dist/plugins/AutoLinkPlugin.js +22 -0
  64. package/dist/plugins/AutoLinkPlugin.js.map +1 -0
  65. package/dist/plugins/FloatingLinkEditorPlugin.d.ts +7 -0
  66. package/dist/plugins/FloatingLinkEditorPlugin.d.ts.map +1 -0
  67. package/dist/plugins/FloatingLinkEditorPlugin2.js +302 -0
  68. package/dist/plugins/FloatingLinkEditorPlugin2.js.map +1 -0
  69. package/dist/plugins/HistoryPlugin.d.ts +26 -0
  70. package/dist/plugins/HistoryPlugin.d.ts.map +1 -0
  71. package/dist/plugins/LinkPlugin.d.ts +3 -0
  72. package/dist/plugins/LinkPlugin.d.ts.map +1 -0
  73. package/dist/plugins/LinkPlugin.js +18 -0
  74. package/dist/plugins/LinkPlugin.js.map +1 -0
  75. package/dist/plugins/ToolbarPlugin.d.ts +7 -0
  76. package/dist/plugins/ToolbarPlugin.d.ts.map +1 -0
  77. package/dist/plugins/ToolbarPlugin.js +372 -0
  78. package/dist/plugins/ToolbarPlugin.js.map +1 -0
  79. package/dist/schedule.js +4 -0
  80. package/dist/scribo.css +1977 -0
  81. package/dist/themes/EditorTheme.d.ts +4 -0
  82. package/dist/themes/EditorTheme.d.ts.map +1 -0
  83. package/dist/themes/EditorTheme2.js +107 -0
  84. package/dist/themes/EditorTheme2.js.map +1 -0
  85. package/dist/types.d.ts +26 -0
  86. package/dist/types.d.ts.map +1 -0
  87. package/dist/ui/ContentEditable.d.ts +6 -0
  88. package/dist/ui/ContentEditable.d.ts.map +1 -0
  89. package/dist/ui/ContentEditable2.js +14 -0
  90. package/dist/ui/ContentEditable2.js.map +1 -0
  91. package/dist/ui/DropDown.d.ts +18 -0
  92. package/dist/ui/DropDown.d.ts.map +1 -0
  93. package/dist/ui/DropDown.js +162 -0
  94. package/dist/ui/DropDown.js.map +1 -0
  95. package/dist/ui/Placeholder.d.ts +6 -0
  96. package/dist/ui/Placeholder.d.ts.map +1 -0
  97. package/dist/ui/Placeholder2.js +13 -0
  98. package/dist/ui/Placeholder2.js.map +1 -0
  99. package/dist/utils/environment.d.ts +24 -0
  100. package/dist/utils/environment.d.ts.map +1 -0
  101. package/dist/utils/environment.js +20 -0
  102. package/dist/utils/environment.js.map +1 -0
  103. package/dist/utils/getSelectedNode.d.ts +3 -0
  104. package/dist/utils/getSelectedNode.d.ts.map +1 -0
  105. package/dist/utils/getSelectedNode.js +23 -0
  106. package/dist/utils/getSelectedNode.js.map +1 -0
  107. package/dist/utils/setFloatingElemPosition.d.ts +2 -0
  108. package/dist/utils/setFloatingElemPosition.d.ts.map +1 -0
  109. package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +2 -0
  110. package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts.map +1 -0
  111. package/dist/utils/setFloatingElemPositionForLinkEditor.js +33 -0
  112. package/dist/utils/setFloatingElemPositionForLinkEditor.js.map +1 -0
  113. package/dist/utils/url.d.ts +11 -0
  114. package/dist/utils/url.d.ts.map +1 -0
  115. package/dist/utils/url.js +33 -0
  116. package/dist/utils/url.js.map +1 -0
  117. package/dist/vite.svg +1 -0
  118. package/package.json +55 -38
  119. package/src/MarkdownEditor.css +61 -47
  120. package/src/MarkdownEditor.tsx +76 -29
  121. package/src/MarkdownInput.tsx +9 -10
  122. package/src/context/SharedHistoryContext.tsx +8 -16
  123. package/src/main.tsx +3 -3
  124. package/src/nodes/EditorNodes.ts +10 -10
  125. package/src/nodes/callout/Callout.css +94 -0
  126. package/src/nodes/callout/CalloutComponent.tsx +61 -0
  127. package/src/nodes/callout/CalloutNode.ts +197 -0
  128. package/src/nodes/callout/CalloutTransformer.ts +87 -0
  129. package/src/nodes/callout/calloutPlugin.ts +37 -0
  130. package/src/nodes/callout/index.ts +5 -0
  131. package/src/nodes/schedule/ScheduleItem.css +140 -0
  132. package/src/nodes/schedule/ScheduleItemComponent.tsx +195 -0
  133. package/src/nodes/schedule/ScheduleItemNode.ts +135 -0
  134. package/src/nodes/schedule/ScheduleTransformer.ts +80 -0
  135. package/src/nodes/schedule/index.ts +4 -0
  136. package/src/nodes/schedule/schedulePlugin.ts +33 -0
  137. package/src/plugins/AutoLinkPlugin.tsx +5 -10
  138. package/src/plugins/FloatingLinkEditorPlugin.tsx +42 -66
  139. package/src/plugins/HistoryPlugin.tsx +20 -30
  140. package/src/plugins/LinkPlugin.tsx +2 -3
  141. package/src/plugins/ToolbarPlugin.tsx +129 -141
  142. package/src/themes/EditorTheme.css +9 -5
  143. package/src/themes/EditorTheme.ts +89 -90
  144. package/src/types.ts +27 -0
  145. package/src/ui/ContentEditable.tsx +5 -5
  146. package/src/ui/DropDown.tsx +23 -41
  147. package/src/ui/Placeholder.tsx +21 -21
  148. package/src/utils/environment.ts +6 -12
  149. package/src/utils/getSelectedNode.ts +3 -5
  150. package/src/utils/setFloatingElemPosition.ts +2 -5
  151. package/src/utils/setFloatingElemPositionForLinkEditor.ts +1 -1
  152. package/src/utils/url.ts +4 -10
  153. package/tsconfig.json +8 -0
  154. package/CHANGELOG.md +0 -65
  155. package/README.md +0 -126
  156. package/RELEASE.md +0 -102
  157. package/eslint.config.js +0 -4
  158. package/src/App.css +0 -35
  159. package/src/App.tsx +0 -42
  160. package/src/index.tsx +0 -13
  161. package/tsconfig.node.json +0 -11
  162. package/vite.config.site.ts +0 -19
  163. package/vite.config.ts +0 -33
  164. /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
@@ -1,4 +0,0 @@
1
- /** @type {import("eslint").Linter.Config} */
2
- module.exports = {
3
- extends: ['@eventuras/eslint-config/react-library.js'],
4
- };
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
- )
@@ -1,11 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "skipLibCheck": true,
5
- "module": "ESNext",
6
- "moduleResolution": "bundler",
7
- "allowSyntheticDefaultImports": true,
8
- "strict": true
9
- },
10
- "include": ["vite.config.ts"]
11
- }
@@ -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