Skip to content

Commit 2db1bab

Browse files
committed
React demo working
1 parent cf51af9 commit 2db1bab

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

demos/react/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width,initial-scale=1" />
66
<title>Quill Demo (react)</title>
7-
<link id="src-code" data="https://github.com/benwinding/quill-html-edit-button/blob/master/demos/vue" ></link>
7+
<link id="src-code" data="https://github.com/benwinding/quill-html-edit-button/blob/master/demos/react" ></link>
88
<script src="./header-text.js" ></script>
99

1010
<!-- Theme included stylesheets -->

demos/react/src/app.jsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
import React, { useState } from 'react';
22

3-
// import htmlEditButton from "../../../src/quill.htmlEditButton";
3+
import htmlEditButton from "../../../src/quill.htmlEditButton";
44
// import htmlEditButton from "quill-html-edit-button";
55
// ^ In production use this
6-
import ReactQuill from 'react-quill';
6+
import ReactQuill, { Quill } from 'react-quill';
77
import 'react-quill/dist/quill.snow.css';
88

9-
// const modules = {
10-
// ['name']: 'htmlEditButton',
11-
// ['module']: htmlEditButton,
12-
// ['options']: {
13-
// debug: true
14-
// },
15-
// };
9+
import Toolbar from "quill/modules/toolbar";
10+
import Snow from "quill/themes/snow";
11+
12+
Quill.register({
13+
'modules/toolbar': Toolbar,
14+
'themes/snow': Snow,
15+
"modules/htmlEditButton": htmlEditButton
16+
})
17+
18+
const modules = {
19+
htmlEditButton: {
20+
debug: true,
21+
}
22+
};
1623

1724
export function MyApp() {
18-
const [value, setValue] = useState('');
25+
const [value, setValue] = useState('Here is some text!');
1926

2027
return <ReactQuill theme="snow" value={value} onChange={setValue}
21-
// modules={modules}
28+
modules={modules}
2229
/>;
2330
}

0 commit comments

Comments
 (0)