A simple SunEditor React component wrapper made to work with SharePoint 2016 On-Premises
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).
If you are looking for a more general component, please see suneditor-react.
npm install --save sharepoint-react-suneditor
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)}
/>
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...).
- Clone this repository,
- run
npm install
, - run
npm start
both in root and example folders.
- Make upload work with SharePoint
A great thank you to SunEditor's creator and active maintainer, JiHong88.
MIT © Salah