Skip to content

Commit b53cfde

Browse files
committed
feat: init
1 parent 7bbbd0e commit b53cfde

File tree

11 files changed

+14818
-5125
lines changed

11 files changed

+14818
-5125
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
lib
44
node_modules
55
coverage
6+
dist
7+
.parcel-cache
8+
*.js
9+
!.*.js

.proxyrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// const { createProxyMiddleware } = require("http-proxy-middleware");
2+
const serveStatic = require("serve-static");
3+
4+
module.exports = function (app) {
5+
const serve = serveStatic("./node_modules", {
6+
index: ["index.html", "index.htm"],
7+
});
8+
app.use((req, res, next) => {
9+
if (req.url.match(/\/tinymce/i)) {
10+
console.log(`static @ ${req.url}`);
11+
return serve(req, res, next);
12+
} else {
13+
return next();
14+
}
15+
});
16+
};

bsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66
"dir": "src",
77
"subdirs": true
88
},
9+
{
10+
"dir": "demo",
11+
"subdirs": true
12+
},
913
{
1014
"dir": "__tests__",
1115
"type": "dev"
1216
}
1317
],
1418
"package-specs": {
15-
"module": "commonjs"
19+
"module": "commonjs",
20+
"in-source": true
1621
},
1722
"suffix": ".bs.js",
1823
"reason": {

demo/DemoEditor.res

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
@react.component
2+
let make = () => {
3+
let editor = React.useRef(None)
4+
<TinyMCEReact.Editor
5+
onInit={(_, e) => editor.current = Some(e)}
6+
initialValue="<p>This is the initial content of the editor.</p>"
7+
init={TinyMCEReact.initConfig(
8+
~height=500,
9+
~menubar=false,
10+
~plugins=[
11+
// "advlist",
12+
// "autolink",
13+
// "lists",
14+
// "link",
15+
"image",
16+
"charmap",
17+
"anchor",
18+
"searchreplace",
19+
"visualblocks",
20+
"code",
21+
"fullscreen",
22+
"insertdatetime",
23+
"media",
24+
"table",
25+
"preview",
26+
"help",
27+
"wordcount",
28+
"textpattern",
29+
],
30+
// ~textpattern_patterns=[
31+
// TinyMCEReact.textpattern(~start="*", ~end="*", ~format="italic", ()),
32+
// TinyMCEReact.textpattern(~start="**", ~end="**", ~format="bold", ()),
33+
// TinyMCEReact.textpattern(~start="#", ~format="h1", ()),
34+
// TinyMCEReact.textpattern(~start="##", ~format="h2", ()),
35+
// TinyMCEReact.textpattern(~start="###", ~format="h3", ()),
36+
// TinyMCEReact.textpattern(~start="####", ~format="h4", ()),
37+
// TinyMCEReact.textpattern(~start="#####", ~format="h5", ()),
38+
// TinyMCEReact.textpattern(~start="######", ~format="h6", ()),
39+
// TinyMCEReact.textpattern(~start="1. ", ~cmd="InsertOrderedList", ()),
40+
// TinyMCEReact.textpattern(~start="* ", ~cmd="InsertUnorderedList", ()),
41+
// TinyMCEReact.textpattern(~start="- ", ~cmd="InsertUnorderedList", ()),
42+
// ],
43+
~toolbar="undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help",
44+
~content_style="body { font-family:Helvetica,Arial,sans-serif; font-size:14px }",
45+
(),
46+
)}
47+
tinymceScriptSrc="/tinymce/tinymce.min.js"
48+
/>
49+
}

demo/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>demo</title>
5+
</head>
6+
<body>
7+
<div id="app"></div>
8+
<script type="module" src="./index.jsx"></script>
9+
</body>
10+
</html>

demo/index.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createRoot } from "react-dom/client";
2+
import { make as Editor } from "./DemoEditor.bs.js";
3+
4+
const container = document.getElementById("app");
5+
const root = createRoot(container); // createRoot(container!) if you use TypeScript
6+
root.render(<Editor />);

0 commit comments

Comments
 (0)