1.0.0 • Published 6 years ago

ory-editor-plugins-lib v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

ory-editor-plugins-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 'ory-editor-plugins-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 });