sharepoint-react-suneditor
v1.0.52
Published
A SunEditor React component wrapper made to work with SPFx SharePoint 2016 On-Premises
Downloads
15
Maintainers
Readme
sharepoint-react-suneditor
A SunEditor React component wrapper made to work with SPFx SharePoint 2016 On-Premises
Description
This package aims to provide a React component wrapper for the SunEditor WYSIWYG that should work with SharePoint Framework (SPFx) 1.1 (which is the required version for SharePoint 2016 On-Premises) and consequently relies on React 15.4.2 (since SPFx 1.1 is pinned to) (See Andrew Connell comment about versions), moreover SunEditor sources are transpiled to es5 to have it work with UglifyJS (which comes with SPFx but does not handle es6 modules).
If you are looking for a more general component, please see suneditor-react.
Install
npm install --save sharepoint-react-suneditor
Usage
import React from 'react'
import { SPSunEditor } from 'sharepoint-react-suneditor';
import 'suneditor/dist/css/suneditor.min.css';
class Example extends React.Component {
render() {
return <SPSunEditor />
}
}
Default SunEditor options can be passed through sunEditorOptions prop. However, some options such as plugins and lang have their own prop (See below, Props).
<SPSunEditor sunEditorOptions={{
height: 220,
width: 512,
buttonList: [ ['bold', 'underline', 'italic'], ['list'], ['link'], ['image'] ],
}}
onChange={this._onChange.bind(this)}
/>
Props
sunEditorOptions : SunEditor native options
Those are the native options that come with SunEditor.
customPlugins : Add your custom plugins
An array of custom plugins.
lang : Define language
Takes a language code (en, de, fr...).
textareaId : SunEditor textarea element ID
String for HTML textarea element ID
Run an example
- Clone this repository,
- run
npm install
, - run
npm start
both in root and example folders.
Todo
- Make upload work with SharePoint
Credits
A great thank you to SunEditor's creator and active maintainer, JiHong88.
License
MIT © Salah