0.0.15 • Published 3 years ago

@geekie/geekie-image v0.0.15

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

geekie-image

DrafJS Plugin that adds image support. This is a fork of the @draft-js-plugins/image package. It adds features like image loading and resizing.

Basic usage

import React, { ReactElement } from 'react';
import { DraftailEditor as Editor, INLINE_STYLE } from 'draftail';
import createImagePlugin, {
  registerUploadImageTask,
} from '@geekie/geekie-image';
import 'draftail/dist/draftail.css';

const imagePlugin = createImagePlugin();
const plugins = [imagePlugin];

// Register how to upload the selected image
registerUploadImageTask(() =>
  Promise.resolve('https://picsum.photos/1000/700')
);

const SimpleImageEditor = (): ReactElement => (
  <div>
    <Editor
      topTool
      controls={[imagePlugin.control]}
      inlineStyles={[
        { type: INLINE_STYLE.BOLD },
        { type: INLINE_STYLE.ITALIC },
      ]}
      entityTypes={[imagePlugin.entityType]}
      plugins={plugins}
    />
  </div>
);

export default SimpleImageEditor;

Setup

yarn

Running in storybook

yarn storybook

Publishing

Edit the packages/image/package.json by yourself.

yarn build
cd packages/image && npm publish
0.0.15

3 years ago

0.0.10

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago