Giter Site home page Giter Site logo

globocom / megadraft Goto Github PK

View Code? Open in Web Editor NEW
1.2K 52.0 211.0 84.25 MB

Megadraft is a Rich Text editor built on top of Facebook's Draft.JS featuring a nice default base of components and extensibility

Home Page: http://megadraft.io

License: MIT License

Makefile 0.19% JavaScript 87.90% HTML 0.76% Shell 0.30% SCSS 10.84%
react megadraft rich-text-editor contenteditable draft-js reactjs editor javascript wysiwyg wysiwyg-editor

megadraft's Introduction

Megadraft

Unit Tests npm version

Rich Text editor built on top of Facebook's draft.js

Discussion and Support

Join the #megadraft channel on the DraftJS Slack team!

Live Example & Documentation

Checkout our website with a live demo!

Developing

To run the development server and see the examples:

git clone https://github.com/globocom/megadraft.git
cd megadraft/
make setup
make run

Note: make sure you're using node <14

Then visit http://localhost:8080/#/ on your browser.

To run local tests:

make unit

To lint local source files:

make lint

To run tests and lint:

make test

Dependencies

Megadraft depends on Sass to build style assets.

Importing the default styles

Megadraft ships with a default styling available at this location in the installed package: node_modules/megadraft/dist/css/megadraft.css.

Documentation

Plugins

Check out the docs for information about plugin structure. To help in this process there is a Yeoman Megadraft Plugin Generator.

Contributing

Development of Megadraft happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving Megadraft.

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Megadraft.

License

Megadraft is licensed under the MIT license.

Third Party

The Megadraft website uses a picture from Stocksnap.io by Tim Marshall licensed under CC0 license.

The Landing page uses a Megadeth picture by Ted Van Pelt licensed under CC-BY.

megadraft's People

Contributors

allanassis avatar andrewb avatar anitavincent avatar cameracker avatar dependabot[bot] avatar estermer avatar felops avatar gaku-sei avatar icaromh avatar laisfrigerio avatar lousander avatar lucasferreiralimax avatar lucaxsilveira avatar macrozone avatar marcelometal avatar mathdevelop avatar maycondionisio avatar mdarcemont avatar mogavin avatar mottamatheus avatar nihaux avatar raphamorim avatar richardkevin avatar ricobl avatar scorphus avatar scottibr avatar taismassaro avatar vierno avatar wdtamagi avatar werlleyg 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  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

megadraft's Issues

Click on Link in Toolbar should allow to update the url

If you have selected a link and click on the link-button (or any custom entity-input), it will remove the link/entity.

It would be more flexible if you could edit the entity when clicking on the button and e.g. change the url. There, we could have a "remove" button that removes the entity.

I'll do eventually a PR for that, if there is no objection.

Create base media block

Make a base media block with media preview.

  • move each component to a single file
  • increase test coverage
  • rename MediaCaption (it has more than just the caption)
  • move caption and rights to the image component

screen shot 2016-04-27 at 5 02 35 pm

image functionality not working

heya!

great module you got here!
On the demo site a few of the functions to adjust images don't seem to work for me:

  • crop
  • sizing
  • the 'edit' button

I'm on chrome 52 if that helps...

screen shot 2016-09-06 at 17 46 16

Multiple editors cause overlap of toolbar.

Issue: When rendering multiple editors in a component, the tool bar overlaps when editing.

Replicate Issue: Render two MegaDrafEditor components in one layout:

import React from 'react';
import { MegadraftEditor } from 'megadraft';

const Header = (props) => (
  <MegaDraftEditor />
);
const Body = (props) => (
  <MegaDraftEditor />
)
export default class Testing extends React.Component {
  constructor(props){
    super(props)
  }
  render() {
    <div>
      <Header />
      <Body />
    </div>
  }
}

pasted image at 2016_11_01 09_12 pm

Using a rich text editor on mobile.

We're looking to add a draftjs implementation to our web app. We notice the native toolbar on devices (with copy, paste) really gets in the way a lot. Including with your implementation here.

realios_iphone_6s_plus

Thoughts? Experiences?

Crop

It should be possible to crop images on the editor.

insertDataBlock is not possible to use

When I create import like: import {DraftJS, insertDataBlock} from "megadraft"; the insertDataBlock is not possible to use because it was not possible to use insertDataBlock in code and it was null.

scss is not included in the distrubution

Hi there~~ Thanks for this fantastic editor!

It looks like the scss is not included in the distribution.

Some of the partials might be useful if I want to cherry pick only one part of the style.

I could also just use the css though.

Ge

Exporting to HTML

Hi

Has anyone had success with exporting the generated JSON to HTML?

I've tried the draft-js-import-html project, but it fails with the error

Uncaught Error: Unknown DraftEntity key.

Cannot read property 'getCurrentContent' of null

I'm not advanced in react , just trying to build myself a blog and found that megadraft will do amazing job for me. I just tried to implement it following the Overview section, but it returns

Cannot read property 'getCurrentContent' of null

Not sure if this is bug or not :/
I'm using following dependencies: Webpack, React, React Router, React DOM and following code:
`
export default React.createClass({

getInitialState: function () {
    return {
        editorState: null,
    }
},
onChange(editorState) {
    this.setState({editorState: editorState});
},

render() {
    return (
            <Megadraft
                editorState={this.state.editorState}
                onChange={this.onChange}/>
    );
}
});`

Media buttons

It should be possible to add media components using the side buttons.

drag and drop media

is there any talk of an enhancement allowing for drag and dropping of images and videos?

thanks!

We need docs!

There should be at least some basic documentation on how to run megadraft locally...

adding other commonly features

hi guys,
the toolbar of megadraft isn't very complete, i think it should be added other commonly features like underline, headings, ...
thanks

Editor will disable "readOnly" when a plugin receives "focus"

If the editor has readOnly=true, it can switch to readOnly=false when a plugin receives focus and you click afterwards somewhere in the editor.

E.g. if a plugin has a button or a link you can tab into the plugin to this button and then click on normal editor text.

I think if <MegadraftEditor /> has readOnly=true, it should never set its state.readOnly to false.

what you think?

Standardize style

Maybe we should use Radium or CSS Modules, currently we have no standard for css.

link youtube video

The youtube video does not show up after I inserted the link of the youtube video. Is it a bug?

Electron propmt function in media elements

Hi Guys,
I'm writing an @electron app but it doesn't let to run prompt js function and for this reason actually media element like video or photo they're going to useless.
Anybody have idea to solve this problem?
Thanks

Title accepts Bold style

As a title is already bold, It should be blocked on Toolbar to add as style, to prevent adding useless info to json file.

plugins should receive readOnly

Plugins should receive readOnly of the parent editor.

With this, you could easily use the editor to render the result and change the appearance of the plugin's component.

E.g. an image could show a form on readOnly=false and render just as an <img /> tag on readOnly

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.