@entur-partner/rich-text-editor 6.3.4 → 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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This package contains a rich text editor.
4
4
 
5
+ This package is maintained by [Team Produkt](https://github.com/orgs/entur/teams/team-produkt).
6
+
5
7
  ## Installation
6
8
 
7
9
  ```sh
@@ -14,9 +16,30 @@ yarn add @entur-partner/rich-text-editor
14
16
  ## Requirements
15
17
 
16
18
  - Node.JS ~24
17
- - yarn ~4.9.2
19
+ - yarn ~4.13
20
+
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
+ ```
18
40
 
19
- You may use [Volta](https://docs.volta.sh/guide/) to manage your js command-line tools. Versions are pinned in `package.json` for seamless, per-project version [switching](https://docs.volta.sh/guide/understanding#managing-your-project).
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.
20
43
 
21
44
  ## Development
22
45
 
@@ -26,7 +49,7 @@ All dependencies are defined in `package.json` and are managed with [yarn](https
26
49
  initially install all dependencies and when the list dependency has changed, run `yarn`.
27
50
 
28
51
  ```
29
- $ yarn && yarn bootstrap
52
+ $ yarn
30
53
  ```
31
54
 
32
55
  ### Build
@@ -39,7 +62,7 @@ $ yarn build
39
62
 
40
63
  ### Code style
41
64
 
42
- [BiomeJS](https://biomejs.dev/formatter/) is used for automatic code formatting.
65
+ [Oxc](https://oxc.rs/) is used for automatic code formatting and linting.
43
66
 
44
67
  Format code:
45
68
 
@@ -53,19 +76,19 @@ Check that code is formatted correctly:
53
76
  $ yarn format-check
54
77
  ```
55
78
 
56
- Tip: See [Editor integration](https://biomejs.dev/reference/vscode/) for how to configure your editor to format code on save.
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.
57
80
 
58
81
  ### Linting
59
82
 
60
- BiomeJS is used for linting. Check linting:
83
+ [Oxc](https://oxc.rs/) is used for linting. Check linting:
61
84
 
62
85
  ```
63
- $ yarn lint-check
86
+ $ yarn lint
64
87
  ```
65
88
 
66
89
  ### Testing
67
90
 
68
- Uses [Jest](https://facebook.github.io/jest) to test unit and reducer testing
91
+ Uses [Vitest](https://vitest.dev/) to test unit and reducer testing
69
92
 
70
93
  ```
71
94
  yarn test
package/dist/index.d.ts CHANGED
@@ -1,5 +1,41 @@
1
- export { ExpandableMultiLanguageRichTextEditor } from "./ExpandableMultiLanguageRichTextEditor";
2
- export { default as RichTextEditor } from "./RichTextEditor";
3
- export { EditorConfigTypes, MinifiedConfigTypes, } from "./RichTextEditor/constants";
4
- export { editorStateToHtml, htmlToEditorState, } from "./RichTextEditor/htmlConvertion";
5
- export { editorStateToMarkdown, markdownToEditorState, markdownToHtml, } from "./RichTextEditor/markdownConvertion";
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 };