streetbees-ory-editor-lib
v1.0.9
Published
Custom lib for ORY Editor
Downloads
19
Readme
streetbees-ory-editor-lib
Custom lib for ORY Editor
Table of Contents
Dependencies
- node (developed on v7.9.0)
- watchman (jest dependency)
- yarn
Development Setup
- Install watchman
$ brew install watchman
- Run sample app
$ yarn start:sample
- Run test watcher
$ yarn watch:test
Plugins
uploadableImage
- Plugin that allows to drop or select a file to upload
// Import plugin and style
import { uploadableImage } from 'streetbees-ory-editor-lib';
import 'ory-editor-plugins-image/lib/index.css';
function uploadFile(file) {
// fictional function that uploads the file and returns promise
}
// The function to handle the upload. Will be called with args:
// - file: instance of File to upload
// - onSuccess: callback on success, call with the url for the uploaded file
// - onError: callback on error
function onUpload(file, onSuccess, onError) {
uploadFile(file).then(url => onSuccess(url)).catch(error => onError(error));
}
const plugin = uploadableImage({ onUpload });