Wondering what’s next for npm?Check out our public roadmap! »

sharepoint-react-suneditor

1.0.52 • Public • Published

sharepoint-react-suneditor

A SunEditor React component wrapper made to work with SPFx SharePoint 2016 On-Premises

NPM JavaScript Style Guide

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

  1. Clone this repository,
  2. run npm install,
  3. 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

Install

npm i sharepoint-react-suneditor

DownloadsWeekly Downloads

8

Version

1.0.52

License

MIT

Unpacked Size

698 kB

Total Files

3

Last publish

Collaborators

  • avatar