GithubHelp home page GithubHelp logo

wengweiwei / gaea-editor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ascoders/gaea-editor

0.0 2.0 0.0 2.01 MB

Design websites in your browser

Home Page: http://next.baidu.com/design

TypeScript 100.00%

gaea-editor's Introduction

GaeaEditor

A scalable web page editor, written by typescript, using symbol and proxy, support modern browsers, not support ie11.

  • Adaptation: Support all react components. Add a few lines of configuration, you can let your components in the edit menu display, and can be dragged into the view area, and edit its properties.
  • Scalable: Support plug-ins to expand the editor for any function. Plug-ins can be inserted into any part of the editor, plug-ins can also provide slots for other plug-ins, plug-ins can create and share data flow editor, call the editor arbitrary function.

Quick start

npm i gaea-editor --save

You can start it quickly:

import Editor from "gaea-editor"

ReactDOM.render(
    <Editor />,
    document.getElementById("react-root")
)

Options

You can add custom components, custom plugins, save callback, and read saved progress.

Props Type Description
onSave (info?: string) => void When you click the Save button, feed back to you to save the information
value string Editor initial value, you can pass the value of the onSave callback and resume the draft
componentClasses Array<React.ComponentClass<IGaeaProps>> React classes. Any react component is supported, but you need some configuration information to tell the editor how to edit it. TODO
plugins IPlugin[] Advanced usage for custom editor functionality. TODO

Parameter: onSave

export function renderGaeaEditor() {
    return (
        <Editor onSave={ value => {
            // send the value data to your server.
        } }/>
    )
}

Parameter: value

The value came from onSave.

export function renderGaeaEditor() {
    return (
        <Editor value={value} />
    )
}

Parameter: componentClasses

class MyInput extends React.Component {
    render() {
        return <input />
    }
}

export function renderGaeaEditor() {
    return (
        <Editor componentClasses={[ MyInput ]}/>
    )
}

Parameter: plugins

TODO.

Local development run

git clone https://github.com/ascoders/gaea-editor.git
cd gaea-editor
yarn
npm start

Will automatically open the default browser.

Deploy

The page configured with the editor cannot be used as a production environment, and we provide gaea-app to deploy it:

Render application with routes, the value of the gaea-editor onSave callback is required.

gaea-editor's People

Contributors

ascoders avatar zhuguoxi avatar

Watchers

James Cloos avatar  avatar

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.