/editor-framework

A framework gives you power to easily write professional multi-panel desktop software in HTML5 and node.js.

Primary LanguageJavaScriptMIT LicenseMIT

Editor Framework

Documentation | Downloads | Install | Features

Circle CI Build Status Build status bitHound Overall Score Dependency Status devDependency Status

Editor Framework gives you power to easily write professional multi-panel desktop software in HTML5 and node.js.

The framework is based on top of Electron and Polymer(Polymer will be removed soon, and editor-framework will be unlimited for any gui framework). It is designed conforming to Electron’s main and renderer process architecture. To make multiple windows communicate easily, Editor Framework extends Electron’s IPC message API, making it easier to send and receive callbacks between the main and renderer processes.

It is designed for full extensibility. In the main process, we achieve this by introducing a package management module and several registration APIs. The user can load or unload packages on the fly without closing or restarting the app. In the renderer process, we use HTML5 Web Component standards. The user can extend the widgets and panels, then refresh the page to apply the changes.

screen shot

Prerequisite

npm install -g bower gulp

For Windows user, you need the following environment set up to be able to build nodejs native modules:

Install

In cloned project folder, run the following command to setup dev environment:

# Initialize gulp task dependencies
# npm is a builtin CLI when you install Node.js
npm install

Install With NPM

You can also install Editor Framework into your app as a npm package:

# Again, npm script will take care of other dependencies
npm install cocos-creator/editor-framework

NOTE: after npm dependencies are installed, we will run node-gyp rebuild against all native modules in editor-framework path. Please make sure node-gyp works in your command line environment. To learn more about native module building and setting up a node-gyp working environment, please check out:

Choose Electron Download Mirror

Download Electron can take time, especially when you're on the wrong side of wall. We use electron-prebuilt for Electron binary download. You can choose if you want to use the china mirror during gulp update-electron task.

The first time you run this task (this task is included in npm install process), you'll be asked if you want to use China mirror for Electron downloading. A json file mirror-setting.json will be created to record your choice, like this:

// local-setting.json
{
  "mirror": "china" // this value can be 'china' or 'global'
                    // depending on your answer
}

You can change this file anytime to choose mirror for Electron downloading again.

Run Editor-Framework Demo

npm start

In the demo you will see builtin packages and other example packages from Developer and Examples menu.

Builtin Packages

The gulp install-builtin will install these builtin packages (this operation is covered in the npm install script):

Update

To get the latest fireball build:

# Update editor-framework from github repo,
# also update builtin packages and electron binary
# this command will also check dependencies
# and report outdated or missing dependencies
gulp update

# If you want to update all dependencies
# this command will bootstrap and update the whole project and takes long
npm install

# or if you just want to quickly install a missing package:
# please use the semver reported at the end of `gulp update` dependency check
npm install some-npm-package@x.x.x

# If you only want to update bower dependencies
bower install

Develop

Test Environment

  • Mocha
  • Chai
  • Sinon

Note: We need to install Mocha, Chai in both core and page; that’s why we put them in both Bower and npm dependencies. The core-level tests only run during the development phase, and will not go into the final product. The page-level test environment has integrated with the tester package and every developer can use it to test your panels.

To test the editor-framework itself, just run:

npm test

You can also run a single test or a bunch of tests in one directory by:

npm start -- test ${your/test/path}

You can also force to run tests in renderer by --renderer option:

npm start -- test --renderer ${your/test/path}

You can load specific package and run its tests by --package option:

npm start -- test --package ${your/test/path}

To debug a test, use the --detail option:

npm start -- test --detail ${your/test/path}

Generate Documentation

To generate the document, just run:

npm run api

It will generate the API document in ./apidocs, you can browse it by open ./apidocs/index.html.

Features

  • Package Management
    • Dynamically load and unload packages
    • Can use any web language (Less, Sass, CoffeeScript, TypeScript, …) for your package; editor-framework will build it first before loading the package.
    • Watch package changes and reload or notify changes immediately
    • Manage your packages in package manager
  • Panel Management
    • Freely docks panel anywhere in multiple windows
    • Dynamically load user define panels from package
    • Easily register and respond to ipc messages for your panel
    • Easily register shortcuts (hotkeys) for your panel
    • Save and load layout in json
    • Save and load panel profiles
  • Menu Extends
    • Dynamically add and remove menu item
    • Dynamically change menu item state (enabled, checked, visible, …)
    • Load user menu from packages
  • Commands (under development)
    • Register and customize commands for your App
    • A powerful command window (CmdP) for searching and executing your commands
  • Profiles
    • Allow user to register different types of profile to their need (global, local, project, …)
    • Load and save profiles through unified API
  • Logs
    • Use Winston for low level logs
    • Log to file
    • Integrate with console for display and query your logs
  • Global Selection
    • Selection cached and synced among windows
    • User can register his own selection type
    • Automatically filtering selections
  • Global Undo and Redo
  • Enhance the native Dialog (under development)
    • Remember dialog last edit position
  • Enhance IPC Programming Experience
    • Add more ipc methods to help sending and recieving ipc messages in different level
    • Allow sending ipc message to specific panel
    • Allow sending ipc message to specific window
    • Allow sending ipc request and waiting for the reply in callback function
    • Integrate with ipc-debugger to help you writing better ipc code
  • An Auto-Test Workflow
    • Detect your package changes and automatically run tests under it in tester
    • Integrate Mocha, Chai and Sinon to our test framework
    • A ghost-tester to simulate UI events and behaviours for testing
    • Automatically recreate your test target (widgets, panels) after each test case

License (MIT)

Copyright (c) 2015 Cocos Creator

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.