问题
Toolbar buttons are not showing in our React App created by facebook/create-react-app.
I've tried importing the JS and CSS files in src/index.tsx or right before where the component is used. I also tried importing individual plugins. None of them is working.
// Froala Editor JS files.
import 'froala-editor/js/froala_editor.pkgd.min.js';
import 'froala-editor/js/plugins.pkgd.min.js';
// Froala Editor CSS files.
import 'froala-editor/css/froala_style.min.css';
import 'froala-editor/css/froala_editor.pkgd.min.css';
import 'froala-editor/css/plugins.pkgd.min.css';
// Froala requires Font Awesome.
import 'font-awesome/css/font-awesome.css';
This is how I set the options. I even tried only setting the align buttons, but it's not working.
<FroalaEditor
model={model}
onModelChange={onModelChange}
config={{
key: FROALA_KEY,
attribution: false,
toolbarButtons: {
moreText: {
buttons: [
'bold',
'italic',
'underline',
'strikeThrough',
'subscript',
'superscript',
'fontFamily',
'fontSize',
'textColor',
'backgroundColor',
'inlineClass',
'inlineStyle',
'clearFormatting',
],
align: 'left',
buttonsVisible: 3,
},
moreParagraph: {
buttons: [
'alignLeft',
'alignCenter',
'formatOLSimple',
'alignRight',
'alignJustify',
'formatOL',
'formatUL',
'paragraphFormat',
'paragraphStyle',
'lineHeight',
'outdent',
'indent',
'quote',
],
align: 'left',
buttonsVisible: 3,
},
moreRich: {
buttons: [
'insertLink',
'insertImage',
'insertVideo',
'insertTable',
'emoticons',
'fontAwesome',
'specialCharacters',
'embedly',
'insertFile',
'insertHR',
],
align: 'left',
buttonsVisible: 3,
},
moreMisc: {
buttons: [
'undo',
'redo',
'fullscreen',
'print',
'getPDF',
'spellChecker',
'selectAll',
'html',
'help',
],
align: 'right',
buttonsVisible: 2,
},
},
...config,
}}
/>
I can only see these buttons on the UI no matter how I set up the options.
来源:https://stackoverflow.com/questions/61403110/froala-wysiwyg-editor-not-showing-all-the-toolbar-buttons-in-react