Giter VIP home page Giter VIP logo

alloyeditor-react-component's Introduction

An example usage of AlloyEditor on the server and in the browser.

In this repository you can see an example of using AlloyEditor as a React component with server-side rendering of the content, which will be edited and creating an instance of AlloyEditor in the browser.

Installation

  1. Clone the repository, then execute: npm install

This will install all the needed packages

  1. In order to create the dist files, execute:

npm run build or npm run release

npm run build will create development version of the bundle. npm run release will create an optimized (minimized) version of the bundle.

Running

Open index.html page in some browser. You will be able to see a rendered on the server page and created in the browser instance of AlloyEditor.

How it works

There is a React component of AlloyEditor. This component is used on both server and in the browser. On the server it is used to render the editable content inside index.html. When index.html is served, an instance of AlloyEditor is being created.

Separation between application files and AlloyEditor's files

This project separates AlloyEditor's scripts from application's files. In this case, you will be able to leverage browser's cache. If you still want to have just one bundle file, remove the optimization part in Webpack's configuration object.

Running in production

To run the project in production, execute npm run release. The files will be minimized and ready for production.

I don't want to copy AlloyEditor to the dist folder like you did!

Sure, then please change the index.html to something like this:

<script>
  window.ALLOYEDITOR_BASEPATH = '../node_modules/alloyeditor/dist/alloy-editor/';
  window.CKEDITOR_BASEPATH = '../node_modules/alloyeditor/dist/alloy-editor/';
</script>

And it should start working.

Enjoy!

alloyeditor-react-component's People

Contributors

ipeychev avatar jedwatson 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.