Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wiris plugin support #223

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions FroalaEditorA.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions FroalaEditorA.src.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions FroalaEditorButton.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions FroalaEditorButton.src.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions FroalaEditorImg.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions FroalaEditorImg.src.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions FroalaEditorInput.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions FroalaEditorInput.src.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions FroalaEditorView.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions FroalaEditorView.src.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 25 additions & 2 deletions demo/src/full_editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,36 @@ class EditorComponent extends React.Component {
}

render () {
var toolbar = ['undo', 'redo' , 'bold', '|', 'wirisEditor', 'wirisChemistry', '|', 'insertImage','html'];
let froalaConfiguration = {
// Add the custom buttons in the toolbarButtons list, after the separator.
iframe: true,
charCounterCount: false,
// Enable all the default plugins less linebreaker plugin and adding wiris plugin.
pluginsEnabled: ["wiris", "align", "charCounter", "codeBeautifier", "codeView", "colors", "draggable", "embedly", "emoticons", "entities", "file", "fontAwesome", "fontFamily", "fontSize", "fullscreen", "image", "imageTUI", "imageManager", "inlineStyle", "inlineClass", "lineHeight", "link", "lists", "paragraphFormat", "paragraphStyle", "quickInsert", "quote", "save", "table", "url", "video", "wordPaste"],
imageEditButtons: ['wirisEditor', 'wirisChemistry', 'imageRemove'],
toolbarButtons: toolbar,
toolbarButtonsMD: toolbar,
toolbarButtonsSM: toolbar,
toolbarButtonsXS: toolbar,
htmlAllowedTags: ['.*'],
htmlAllowedAttrs: ['.*'],
htmlAllowedEmptyTags: ['mprescripts'],
imageResize : false,
key: 'CA5D-16E3A2E3G1I4A8B8A9B1D2rxycF-7b1C3vyz==',
heightMax: 310,
useClasses: false
};


return(
<div className="sample">
<h2>Full Featured</h2>
<FroalaEditor
model={this.state.content}
onModelChange={this.handleModelChange}
config={froalaConfiguration}

/>
<h4>Rendered Content:</h4>
<FroalaEditorView
Expand All @@ -45,5 +69,4 @@ class EditorComponent extends React.Component {

}

ReactDOM.render(<EditorComponent/>, document.getElementById('editor'));

ReactDOM.render(<EditorComponent/>, document.getElementById('editor'));
26 changes: 26 additions & 0 deletions dist/FroalaEditorA.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dist/FroalaEditorA.src.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dist/FroalaEditorButton.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dist/FroalaEditorButton.src.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dist/FroalaEditorImg.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dist/FroalaEditorImg.src.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dist/FroalaEditorInput.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dist/FroalaEditorInput.src.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/FroalaEditorView.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/FroalaEditorView.src.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dist/index.src.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions index.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions index.src.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions lib/FroalaEditorFunctionality.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import FroalaEditor from 'froala-editor';
import React from 'react';
import $ from "jquery";

let lastId = 0;
export default class FroalaEditorFunctionality extends React.Component {
Expand Down Expand Up @@ -40,6 +41,12 @@ export default class FroalaEditorFunctionality extends React.Component {
// After first time render.
componentDidMount() {
let tagName = this.el.tagName.toLowerCase();

if (this.props.config && this.props.config.pluginsEnabled && this.props.config.pluginsEnabled.indexOf('wiris') != -1) {
$.FroalaEditor = FroalaEditor;
require('../node_modules/@wiris/mathtype-froala/wiris.js');
}

if (this.SPECIAL_TAGS.indexOf(tagName) != -1) {
this.tag = tagName;
this.hasSpecialTag = true;
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
"react-dom": "~0.14 || ^15.0.0 || ^16.0.0"
},
"dependencies": {
"@wiris/mathtype-froala": "^7.17.0",
"create-react-class": "^15.5.2",
"froala-editor": "3.1.0"
"froala-editor": "3.1.0",
"jquery": "^3.4.1"
},
"devDependencies": {
"autoprefixer": "^8.3.0",
Expand Down
9 changes: 8 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var path = require('path');
var webpack = require("webpack");

/**
* If -p flag is set, minify the files
Expand Down Expand Up @@ -60,6 +61,12 @@ module.exports = {
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
],
externals: externals,
resolve: {
modules: ['./node_modules']
Expand All @@ -69,4 +76,4 @@ module.exports = {
libraryTarget: 'umd',
library: '[name]'
}
};
};