Skip to content

Commit 300a227

Browse files
committed
♻️ Refactored modes to global scope, updated fontSize
1 parent 8fbd6bd commit 300a227

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

stories/TinymceEditor.jsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React, { useRef } from 'react';
22
import { Editor } from '@tinymce/tinymce-react';
33
import '../public/tinymce/tinymce.js'
44

5-
6-
75
const sizes = {
86
'none': {
97

@@ -22,20 +20,7 @@ const sizes = {
2220
}
2321
}
2422

25-
export default function TinymceEditor({ skin = 'oxide', mode, value, size = 'none'}) {
26-
const editorRef = useRef(null);
27-
28-
const commonConfiguration = {
29-
skin,
30-
base_url: '/tinymce',
31-
promotion: false,
32-
statusbar: false,
33-
menubar: false,
34-
highlight_on_focus: false,
35-
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
36-
}
37-
38-
const modes = {
23+
const modes = {
3924
"super" : {
4025
plugins: [
4126
'advlist', 'autolink', 'lists', 'link', 'anchor',
@@ -45,6 +30,9 @@ export default function TinymceEditor({ skin = 'oxide', mode, value, size = 'non
4530
'bold italic forecolor | alignleft aligncenter ' +
4631
'alignright alignjustify | bullist numlist outdent indent | ' +
4732
'codeeditor | supercode',
33+
supercode: {
34+
fontSize: 12,
35+
}
4836
},
4937
"classic" : {
5038
plugins: [
@@ -58,6 +46,22 @@ export default function TinymceEditor({ skin = 'oxide', mode, value, size = 'non
5846
}
5947
}
6048

49+
export default function TinymceEditor({ skin = 'oxide', mode, value, size = 'none'}) {
50+
const editorRef = useRef(null);
51+
52+
const commonConfiguration = {
53+
skin,
54+
base_url: '/tinymce',
55+
promotion: false,
56+
statusbar: false,
57+
menubar: false,
58+
highlight_on_focus: false,
59+
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
60+
61+
}
62+
63+
64+
6165
React.useEffect(() => {
6266
console.debug('skin reloaded');
6367
}, [skin])

0 commit comments

Comments
 (0)