nam-rich-text-editor 9.0.0 → 9.0.2
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 +24 -6
- package/dist/RichTextEditor.d.ts +2 -1
- package/dist/RichTextEditorComponent.d.ts +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/rich-text-editor.es.js +2814 -1319
- package/dist/rich-text-editor.umd.js +24 -7
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -5,15 +5,19 @@ A custom rich text editor similar to Word, built with JavaScript and TypeScript.
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install rich-text-editor
|
|
8
|
+
npm install nam-rich-text-editor
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
+
### As a Class
|
|
14
|
+
|
|
13
15
|
```javascript
|
|
14
|
-
import { RichTextEditor } from "rich-text-editor";
|
|
16
|
+
import { RichTextEditor } from "nam-rich-text-editor";
|
|
15
17
|
|
|
16
|
-
const editor = new RichTextEditor(
|
|
18
|
+
const editor = new RichTextEditor();
|
|
19
|
+
const editorElement = editor.getElement();
|
|
20
|
+
document.body.appendChild(editorElement);
|
|
17
21
|
|
|
18
22
|
// Get HTML content
|
|
19
23
|
const html = editor.getHTML();
|
|
@@ -22,10 +26,24 @@ const html = editor.getHTML();
|
|
|
22
26
|
editor.setHTML("<p>Hello <strong>world</strong>!</p>");
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
### As a React Component
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
import React from "react";
|
|
33
|
+
import { RichTextEditorComponent } from "nam-rich-text-editor";
|
|
34
|
+
|
|
35
|
+
const MyEditor = () => {
|
|
36
|
+
const handleChange = (html) => {
|
|
37
|
+
console.log("HTML content:", html);
|
|
38
|
+
};
|
|
26
39
|
|
|
27
|
-
|
|
28
|
-
<
|
|
40
|
+
return (
|
|
41
|
+
<RichTextEditorComponent
|
|
42
|
+
onChange={handleChange}
|
|
43
|
+
initialValue="<p>Start editing...</p>"
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
29
47
|
```
|
|
30
48
|
|
|
31
49
|
## Features
|
package/dist/RichTextEditor.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|