@entur-partner/rich-text-editor 6.3.5 → 7.0.0
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/README.md +29 -8
- package/dist/index.d.ts +41 -5
- package/dist/index.js +697 -8
- package/dist/styles.css +6179 -93
- package/package.json +108 -133
- package/dist/ExpandableMultiLanguageRichTextEditor.d.ts +0 -21
- package/dist/ExpandableMultiLanguageRichTextEditor.test.d.ts +0 -1
- package/dist/rich-text-editor.cjs.development.js +0 -884
- package/dist/rich-text-editor.cjs.development.js.map +0 -1
- package/dist/rich-text-editor.cjs.production.min.js +0 -2
- package/dist/rich-text-editor.cjs.production.min.js.map +0 -1
- package/dist/rich-text-editor.esm.js +0 -872
- package/dist/rich-text-editor.esm.js.map +0 -1
package/README.md
CHANGED
|
@@ -16,9 +16,30 @@ yarn add @entur-partner/rich-text-editor
|
|
|
16
16
|
## Requirements
|
|
17
17
|
|
|
18
18
|
- Node.JS ~24
|
|
19
|
-
- yarn ~4.
|
|
19
|
+
- yarn ~4.13
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
We use [mise](https://mise.jdx.dev/) to set up basic tooling and tasks to be used in the project.
|
|
22
|
+
To install mise, run the following:
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
# Install mise
|
|
26
|
+
brew install mise
|
|
27
|
+
|
|
28
|
+
# Activate mise. If you use another shell than zsh, please refer to https://mise.jdx.dev/cli/activate.html
|
|
29
|
+
echo 'eval "$(mise activate zsh)"' >> ~/.zshrc
|
|
30
|
+
|
|
31
|
+
# Mark the mise configuration as trusted. This is needed due to using experimental features in the .mise.toml file.
|
|
32
|
+
mise trust
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then, navigate to the project root and run:
|
|
36
|
+
|
|
37
|
+
```shell
|
|
38
|
+
mise install
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This will install the required tools and dependencies specified in the `.mise.toml` file.
|
|
42
|
+
**Note!** Remember to reload your terminal to ensure all changes take effect.
|
|
22
43
|
|
|
23
44
|
## Development
|
|
24
45
|
|
|
@@ -28,7 +49,7 @@ All dependencies are defined in `package.json` and are managed with [yarn](https
|
|
|
28
49
|
initially install all dependencies and when the list dependency has changed, run `yarn`.
|
|
29
50
|
|
|
30
51
|
```
|
|
31
|
-
$ yarn
|
|
52
|
+
$ yarn
|
|
32
53
|
```
|
|
33
54
|
|
|
34
55
|
### Build
|
|
@@ -41,7 +62,7 @@ $ yarn build
|
|
|
41
62
|
|
|
42
63
|
### Code style
|
|
43
64
|
|
|
44
|
-
[
|
|
65
|
+
[Oxc](https://oxc.rs/) is used for automatic code formatting and linting.
|
|
45
66
|
|
|
46
67
|
Format code:
|
|
47
68
|
|
|
@@ -55,19 +76,19 @@ Check that code is formatted correctly:
|
|
|
55
76
|
$ yarn format-check
|
|
56
77
|
```
|
|
57
78
|
|
|
58
|
-
Tip: See [Editor integration](https://
|
|
79
|
+
Tip: See [Editor integration](https://oxc.rs/docs/guide/usage/formatter/editors.html) for how to configure your editor to format code on save.
|
|
59
80
|
|
|
60
81
|
### Linting
|
|
61
82
|
|
|
62
|
-
|
|
83
|
+
[Oxc](https://oxc.rs/) is used for linting. Check linting:
|
|
63
84
|
|
|
64
85
|
```
|
|
65
|
-
$ yarn lint
|
|
86
|
+
$ yarn lint
|
|
66
87
|
```
|
|
67
88
|
|
|
68
89
|
### Testing
|
|
69
90
|
|
|
70
|
-
Uses [
|
|
91
|
+
Uses [Vitest](https://vitest.dev/) to test unit and reducer testing
|
|
71
92
|
|
|
72
93
|
```
|
|
73
94
|
yarn test
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/RichTextEditor/RichTextEditor.d.ts
|
|
4
|
+
type RichTextEditorProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
initialValue: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
contentType?: 'markdown' | 'html';
|
|
10
|
+
maxNumberOfCharacters?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* RichTextEditor is a React component that provides a rich text editing interface using the Tiptap editor.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} [className] - Optional additional class name for styling the editor container.
|
|
16
|
+
* @param {string} [label] - Optional label to display above the editor.
|
|
17
|
+
* @param {string} initialValue - The initial content of the editor, which can be in markdown or HTML format.
|
|
18
|
+
* @param {function} onChange - A callback function that is called whenever the content of the editor changes. It receives the current content as an argument.
|
|
19
|
+
* @param {'markdown' | 'html'} [contentType='html'] - The format of the content (either 'markdown' or 'html'). This determines how the content is processed and returned in the onChange callback.
|
|
20
|
+
* @param {number} [maxNumberOfCharacters=0] - The maximum number of characters allowed in the editor. This limits the amount of content that can be entered by the user. (0 means no limit)
|
|
21
|
+
* @returns {JSX.Element} A React component that renders a rich text editor with the specified configuration and functionality.
|
|
22
|
+
* @example
|
|
23
|
+
* <RichTextEditor
|
|
24
|
+
* className="description-editor"
|
|
25
|
+
* initialValue="# Hello World\n\nThis is **Markdown**!"
|
|
26
|
+
* onChange={(value) => console.log(value)}
|
|
27
|
+
* label="My Rich Text Editor"
|
|
28
|
+
* contentType="markdown"
|
|
29
|
+
* maxNumberOfCharacters={5000}
|
|
30
|
+
* />
|
|
31
|
+
*/
|
|
32
|
+
declare const RichTextEditor: ({
|
|
33
|
+
className,
|
|
34
|
+
label,
|
|
35
|
+
initialValue,
|
|
36
|
+
onChange,
|
|
37
|
+
contentType,
|
|
38
|
+
maxNumberOfCharacters
|
|
39
|
+
}: RichTextEditorProps) => _$react_jsx_runtime0.JSX.Element | null;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { RichTextEditor };
|