1.9.0 • Published 1 year ago

@inftechsol/react-slate-wysiwyg v1.9.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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.9.0

1 year ago

1.8.7

1 year ago

1.8.6

1 year ago

1.8.4

1 year ago

1.8.2

1 year ago

1.8.3

1 year ago

1.8.1

2 years ago

1.8.0

2 years ago

1.7.6

2 years ago

1.7.5

2 years ago

1.7.4

2 years ago

1.7.3

2 years ago

1.7.2

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.9

2 years ago

1.6.8

2 years ago

1.6.7

2 years ago

1.6.6

2 years ago

1.6.5

2 years ago

1.6.4

2 years ago

1.6.3

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.9

2 years ago

1.5.8

2 years ago

1.5.7

2 years ago

1.5.6

2 years ago

1.5.5

2 years ago

1.5.4

2 years ago

1.5.3

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.9

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.9

2 years ago

1.3.8

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago