Skip to content

Commit 3a96eaa

Browse files
Merge pull request #17 from mindfiredigital/feature/modify-package-example
fix: edit package usage feature array
2 parents eec56f4 + 5a6b5e7 commit 3a96eaa

File tree

1 file changed

+51
-28
lines changed

1 file changed

+51
-28
lines changed

README.md

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,51 +60,74 @@ npm install @mindfiredigital/react-text-igniter
6060

6161
```javascript
6262
import { HtmlEditor } from "@mindfiredigital/react-text-igniter";
63-
import React,{useRef} from "react";
63+
import React, { useRef } from "react";
6464

6565
export const App = () => {
66-
const editorRef = useRef();
67-
features: ['heading' ,'bold', 'italic', 'underline',"orderedList",'unorderedList','justifyLeft','justifyCenter','justifyRight','createLink','insertImage','superscript','subscript','table','layout'],
68-
return (
69-
<HtmlEditor
70-
ref={editoRef}
71-
features={features}
72-
height={"400px"}
73-
/>
74-
);
66+
const editorRef = useRef();
67+
const features = [
68+
"heading",
69+
"bold",
70+
"italic",
71+
"underline",
72+
"orderedList",
73+
"unorderedList",
74+
"justifyLeft",
75+
"justifyCenter",
76+
"justifyRight",
77+
"createLink",
78+
"insertImage",
79+
"superscript",
80+
"subscript",
81+
"table",
82+
"layout",
83+
];
84+
85+
return <HtmlEditor ref={editorRef} features={features} height={"400px"} />;
7586
};
7687
```
7788

7889
- **GET HTML/JSON**: Geting HTML and JSON for the content of Editor.
7990

8091
```javascript
8192
import { HtmlEditor } from "@mindfiredigital/react-text-igniter";
82-
import React,{useRef} from "react";
93+
import React, { useRef } from "react";
8394

8495
export const App = () => {
85-
const editorRef = useRef();
86-
features: ['heading' ,'bold', 'italic', 'underline',"orderedList",'unorderedList','justifyLeft','justifyCenter','justifyRight','createLink','insertImage','superscript','subscript','table','layout'],
87-
88-
// get HTML content
89-
const handleGetHtmlContent = () => {
90-
console.log('HTML:', editorRef.current.getHtml());
96+
const editorRef = useRef();
97+
const features = [
98+
"heading",
99+
"bold",
100+
"italic",
101+
"underline",
102+
"orderedList",
103+
"unorderedList",
104+
"justifyLeft",
105+
"justifyCenter",
106+
"justifyRight",
107+
"createLink",
108+
"insertImage",
109+
"superscript",
110+
"subscript",
111+
"table",
112+
"layout",
113+
];
114+
115+
// get HTML content
116+
const handleGetHtmlContent = () => {
117+
console.log("HTML:", editorRef.current.getHtml());
91118
};
92119

93-
// get JSON content
120+
// get JSON content
94121
const handleGetJsonContent = () => {
95-
console.log('JSON:', editorRef.current.getJson());
122+
console.log("JSON:", editorRef.current.getJson());
96123
};
97124

98125
return (
99-
<>
100-
<HtmlEditor
101-
ref={editoRef}
102-
features={features}
103-
height={"400px"}
104-
/>
105-
<button onClick={handleGetHtmlContent}>check html</button>
106-
<button onClick={handleGetJsonContent}>check Json</button>
107-
</>
126+
<>
127+
<HtmlEditor ref={editorRef} features={features} height={"400px"} />
128+
<button onClick={handleGetHtmlContent}>check html</button>
129+
<button onClick={handleGetJsonContent}>check Json</button>
130+
</>
108131
);
109132
};
110133
```

0 commit comments

Comments
 (0)