1.8.7 • Published 2 months ago

@inftechsol/react-slate-wysiwyg v1.8.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@inftechsol/react-slate-wysiwyg

About component

It is a simle Wysiwyg component using Slate (slate-react) with some basic formatting.

Compatibility

This component use slate-react v0.95.0, react v18.2.0, react-dom v18.2.0. You should use FontAwesome 6 for the button icons, and Boostrap 5.

Installation

npm i @inftechsol/react-slate-wysiwyg

Basic usage

import React from 'react';
import { Wysiwyg, initialValue, Editor, setEditorValue } from '@inftechsol/react-slate-wysiwyg';

const App = () => {
    const initVal = initialValue || [ type: 'align-left', style: {{ fontSize: '17px', textALign: 'left' }} ];
    const [value, setValue] = useState(initVal);

    const onChange = (value) => {
        setValue(value);
    }
    const getDataFromServer = () => {
        fetch('https://example.com/api/getData', { method: 'GET' }).then((value) => {
            setEditorValue(value, Editor);
        })
    }

    return (
        <div>
            <div>
                <button onClick={getDataFromServer}>Get Data</button>
            </div>
            <div>
                <Wysiwyg onChange={onChange} value={value} />
            </div>
        </div>
    );
};

export default App;

Properties

- Wysiwyg properties:
    - value: CustomElement[] (required) - see initialValue or Slate documents,
    - onChange: function (required)
    - className: string (optional) // default: 'react-slate-wysiwyg',
    - id: (optional) string | number
    - colors: object (optional) - Formatting buttons font color // default:  { normal: { activeColor: '#0f0', color: '#000' }, reverse: { activeColor: 'black', color: '#0f0' } },
    - reserved: (optional) boolean - colors is reserved // default false,
    - placeholder: (optional) // default: 'Ide írjon szöveget...',
    - uploadType: (optional) 'link' || 'pc' // default 'link' - PC upload is not working yet,
    - customButtons: (optional) Array - add custom Text(format) - [{ format: string, text: string }] - [{ format: ${variable}, text: ${variable} }]
1.8.7

2 months ago

1.8.6

2 months ago

1.8.4

2 months ago

1.8.2

2 months ago

1.8.3

2 months ago

1.8.1

8 months ago

1.8.0

8 months ago

1.7.6

10 months ago

1.7.5

11 months ago

1.7.4

11 months ago

1.7.3

11 months ago

1.7.2

11 months ago

1.7.1

11 months ago

1.7.0

11 months ago

1.6.9

11 months ago

1.6.8

11 months ago

1.6.7

11 months ago

1.6.6

11 months ago

1.6.5

11 months ago

1.6.4

11 months ago

1.6.3

11 months ago

1.6.2

11 months ago

1.6.1

11 months ago

1.6.0

11 months ago

1.5.9

11 months ago

1.5.8

11 months ago

1.5.7

11 months ago

1.5.6

11 months ago

1.5.5

11 months ago

1.5.4

11 months ago

1.5.3

11 months ago

1.5.1

11 months ago

1.5.0

11 months ago

1.4.9

11 months ago

1.4.8

11 months ago

1.4.7

11 months ago

1.4.6

11 months ago

1.4.5

11 months ago

1.4.4

11 months ago

1.4.3

11 months ago

1.4.2

11 months ago

1.4.1

11 months ago

1.4.0

11 months ago

1.3.9

11 months ago

1.3.8

11 months ago

1.3.5

11 months ago

1.3.4

11 months ago

1.3.3

11 months ago

1.3.2

11 months ago

1.3.1

11 months ago

1.3.0

11 months ago

1.2.9

11 months ago

1.2.8

11 months ago

1.2.7

11 months ago

1.2.6

11 months ago

1.2.5

11 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

11 months ago

1.2.0

11 months ago

1.1.9

11 months ago

1.1.8

11 months ago

1.1.7

11 months ago

1.1.6

11 months ago

1.1.5

11 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago