MIT License

项目介绍

draft-js-plugins/draft-js-plugins 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 MIT License 许可证,目前获得 4.1k 个 Star、1.0k 次 Fork。

仓库全名
draft-js-plugins/draft-js-plugins
开源许可证
MIT License
Star 数
4.1k
Fork 数
1.0k
未关闭 Issue
1

README 摘要

DraftJS Plugins Deprecated: This project is no longer maintained. The underlying Draft.js editor was archived by Facebook in 2023 and is no longer receiving updates. This repository is archived and no further bug fixes or features will be released. High quality plugins with great UX on top of DraftJS. Available Plugins (incl. Docs) Anchor Alignment Counter Drag and Drop Divider Emoji Focus Hashtag Image Inline…

完整内容见 GitHub 原始 README 或本页 。

常见问题

draft-js-plugins 用什么语言开发?

主要使用 TypeScript 编写,采用 MIT License 许可证,目前有 4.1k 个 Star。

draft-js-plugins 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 draft-js-plugins 的源码?

可以直接克隆仓库:git clone https://github.com/draft-js-plugins/draft-js-plugins.git,默认分支为 master;安装与运行步骤见仓库 README。

draft-js-plugins 最近还在维护吗?

仓库最近一次更新为 3月18日,当前有 1 个未关闭 Issue;Star 数为 4.1k,可作为社区活跃度的参考。

README

DraftJS Plugins

Deprecated: This project is no longer maintained. The underlying Draft.js editor was archived by Facebook in 2023 and is no longer receiving updates. This repository is archived and no further bug fixes or features will be released.

Draft JS Plugins Logo

High quality plugins with great UX on top of DraftJS.

Build Status

Available Plugins (incl. Docs)

Built by the community

Live Example & Documentation

Checkout the website!

Usage

First, install the editor with npm:

$ npm install @draft-js-plugins/editor --save

Then import the editor somewhere in your code and you’re ready to go!

import Editor from '@draft-js-plugins/editor';

Documentation

@draft-js-plugins/editor

Editor

An editor component accepting plugins. see source

Props Description Required
editorState see here *
onChange see here *
plugins an array of plugins
decorators an array of custom decorators
defaultKeyBindings bool
defaultBlockRenderMap bool
all other props accepted by the DraftJS Editor except decorator see here

Usage:

import React, { Component } from 'react';
import Editor from '@draft-js-plugins/editor';
import createHashtagPlugin from '@draft-js-plugins/hashtag';
import createLinkifyPlugin from '@draft-js-plugins/linkify';
import { EditorState } from 'draft-js';

const hashtagPlugin = createHashtagPlugin();
const linkifyPlugin = createLinkifyPlugin();

const plugins = [linkifyPlugin, hashtagPlugin];

export default class UnicornEditor extends Component {
  state = {
    editorState: EditorState.createEmpty(),
  };

  onChange = (editorState) => {
    this.setState({
      editorState,
    });
  };

  render() {
    return (
      <Editor
        editorState={this.state.editorState}
        onChange={this.onChange}
        plugins={plugins}
      />
    );
  }
}
How to write a Plugin

Feel free to copy any of the existing plugins as a starting point.In this repository you can also find a Guide on how to create a plugin, including a description of the supported features. In addition you can contact @nikgraf directly in case you need help or simply open a Github Issue!

Discussion and Support

Join the channel #draft-js-plugins after signing into the DraftJS Slack organization or check out our collection of frequently asked questions here: FAQ.

Development

Check out our Contribution Guide.

Learn about why Draft.js and how to use DraftJS Plugins

In this talk Nik Graf explained the ContentState structure of a Draft.js Editor as well as explained how to use plugins.

License

MIT

评论

暂无评论