Code Monkey home page Code Monkey logo

react-tapable-editor's Introduction

react-tapable-editor

A pluginable, intuitive medium/notion like rich text editor

The original idea is to build an easy used rich text editor. react-tapable-editor is built on draft-js, and its plugin system is besed on tapable which is famous as the engine of webpack.

Features

BlockStyle

  • header
  • quotation
  • list
  • quotation

gif

code block

  • highlight with prism
  • copy from vscode, style could be preserved.
  • copy from github, code will suppress into one line.

code

Image

image

Experimental feature

Drag and drop block

drag-block

drag to make layout design

TODO consider smooth reflow...

How to start

$ npm install
$ npm run storybook

FAQ

why choose draft-js

react-tapable-editor's People

Contributors

ryuever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-tapable-editor's Issues

drop a image on a blank line

when drop a image in editor, it will do as follows:

  1. split current block
  2. add image atomic
  3. add a new blank line

But when the block is a blank line, the first step may not be necessary..

cannot find on yarn/npm

Hi There,

i'm unable to find this package on npm registry. have you considered publishing?

Awesome job

Awesome job! We are looking forward to your consistent update。

error block.getChildKeys is not a function

I tried to use this package in a project but I get this error: block.getChildKeys is not a function

I cloned this repository, and run storybook, it works, but When I used in a react project it gave Me this error. how can I use it ?

my code

import Editor from "react-tapable-editor";

export default function App() {
  return (
    <div className="App">
      <Editor />
    </div>
  );
}

you can reproduce the error here
https://codesandbox.io/s/nifty-aryabhata-m19vy?file=/src/App.js

Cannot read property 'getType' of undefined

image

How to reproduce

2020-10-11 18 14 56

  1. create multiple text lines
  2. drop a block to the right of any block
  3. backspace the dropped block
  4. backspace continue

Reason

In experimental mode. There is a blockMap

A has a child C
C has a child D
D is empty
if backspace block D, blockMap will be updated as follows:

set A as D's parent
update A's children list
remove C
But, C is still in A's children list due to the use of old newParent which is derived from blockMap

How to fix

Do not use draft-js/lib/NestedRichTextEditorUtil to handle keyCommand operation. Then create a temp fold to override this functionality until fixed in draft-js(facebookarchive/draft-js#2571)

backspace a image

It's a draft-js bug. Detail info refer to facebookarchive/draft-js#2572

How to re-produce

  1. drop a image, then it should be followed by a blank new line
  2. place cursor to the new line's beginning.
  3. press backspace.
  4. all the content following the new blank line will be delete as well.

Not able to start package locally

I was trying to run next example locally. But I'm getting following issue.
image
Can anyone help me with a running example on Codesandbox or snippet?

Publish a pkg

Hey! Awesome job.
I request you to publish an NPM package to let users easily import the editor in their project.
It's quite urgent for me and I love your editor.
Thanks!

The afterwards blocks will be removed when backspace preceding atomic block

Issue 1: The following gif shows the detail issue info. If backspace a preceding image block, then the following blocks will be deleted as well

2020-10-12 00 32 39

Issue 2: To fix this, add shouldPreserveBlocks variable in removeRangeFromContentState function. However, after this issue fix, another issue comes. If there is a blank line before image block, then continue to backspace blank line, it could not be removed.

2020-10-12 00 35 15

The final: after fixed issue 1 & 2, it works as expected.

2020-10-12 00 37 37

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.