LogoLogo
  • LEARN
    • Overview
    • Capabilities
      • Rich and Diverse Assets
      • Organised Collections
      • Asset Lifecycle Management
      • Powerful Discovery
      • Phygital Discovery
      • Observability
    • Technical Architecture
    • Product & Developer Guide
      • Content Service
        • Content APIs
          • Features
          • Architecture
          • Code Structure
          • Schemas
          • APIs
          • Jobs
            • Content publish
            • Asset enrichment
            • Audit event generator
            • Video stream generator
          • FAQs
            • Upload Content
        • Media APIs
          • Features
          • Architecture
          • Schemas
          • APIs
          • Jobs
            • Asset enrichment
            • Audit event generator
          • FAQs
        • Channel APIs
          • Architecture
          • Schema
          • APIs
          • Configuration
          • FAQs
        • License APIs
          • Architecture
          • Schema
          • APIs
          • Configuration
          • FAQs
        • Collection APIs
          • Features
          • Architecture
          • Schemas
          • APIs
          • Jobs
            • Content publish
            • Post publish processor
            • Audit event generator
          • FAQs
      • Search Service
        • Architecture
        • Code Structure
          • Configuration
        • APIs
        • Jobs
          • Search indexer
          • Audit history indexer
        • FAQs
      • Taxonomy Service (Taxonomy & Tagging)
        • Framework APIs
          • Architecture
          • Code Structure
            • Configuration
          • Schemas
          • APIs
          • Jobs
            • Audit event generator
          • FAQs
            • Create Framework
            • Add Content to Framework
        • Object Category APIs
          • Architecture
          • Code Structure
          • Schemas
          • APIs
          • Jobs
            • Audit event generator
          • Configuration
          • FAQs
      • DIAL Service
        • Architecture
        • APIs
        • Jobs
        • Configuration
        • FAQs
          • Link DIAL Code to a Book
      • Player
        • V1
          • Features
          • Architecture
          • Players
            • ECML Player - v1
              • Quiz
              • Create Content
            • Video Player v1
            • Epub Player - v1
            • PDF Player - v1
            • HTML-h5p Player - v1
          • Content import and preview folder creation
          • FAQs
        • V2
          • PDF Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
          • Epub Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
          • Video Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
        • Telemetry Events
          • Offline Telemetry
          • Generate API keys
      • Editors
        • Architecture
        • Interactive Editor
          • Features
            • Content Editor
            • Adding Question Set
            • Concept Selector
            • Add Image
            • Add Video
            • Adding Math Function
            • Limited Publishing and Sharing
        • File Upload Editor
          • Features
          • FAQ's
            • Content Upload
        • Collection Editor - V1
        • Collection Editor - V2
          • Features
          • Architecture
          • APIs
          • FAQ's
        • How to contribute as a JS plugin
          • How do I think about a plugin?
          • Interactive Editor Plugin Guide
          • Using SDK to create and test the plugin
      • Other Knowlg Jobs
        • Configuration
        • FAQs
      • Other
        • Data Migration
        • Schema strucure
    • Product Roadmap
  • ENGAGE
    • Discuss
    • Contribute to SB Knowlg
  • USE
    • Overview
    • System requirements
    • Installation guide
      • Players
        • V1
          • How to setup
        • V2
          • Epub Player
          • Video Player
          • Pdf Player
      • Editors
        • Interactive Editor
        • File Upload Editor
        • Collection Editor - V1
        • Collection Editor - V2
        • Plugins
      • Services
        • Content Service
          • Configuration
        • Search Service
        • Taxonomy Service (Taxonomy & Tagging)
        • DIAL Service
        • Knowlg Jobs
    • Deployment
    • Release notes
      • Release - 6.2.0 (Ongoing)
      • Release - 6.1.0 (latest)
      • Release - 6.0.0
      • Release - 5.7.0
      • Release - 5.6.0
      • Release - 5.5.0
      • Release - 5.4.0
      • Release - 5.3.0
      • Release - 5.2.0
      • Release - 5.1.0
      • Release - 5.0.0
      • Release - 4.10.0
      • Release - 4.8.0
    • Breaking Changes
    • Deprecations
      • Release-5.2.0
      • Release-5.1.0
    • Release
    • USE
      • Infra Requirements
    • Additional Reading
      • Content Service Environment Variables
      • Import External Content
  • Archived
    • Powerful Discovery
      • Usecase
      • Sample data
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. LEARN
  2. Product & Developer Guide
  3. Editors
  4. How to contribute as a JS plugin

How do I think about a plugin?

PreviousHow to contribute as a JS pluginNextInteractive Editor Plugin Guide

Last updated 2 years ago

Was this helpful?

Let's take an example of a desktop application e.g. . Assume you create a presentation file, add some content and then save it. You can access the file again in future, by opening it. The entire content is saved in a format, which can be read by respective app e.g. OpenOffice. OpenOffice stores the files in odp(open document format). The editor in OpenOffice Presentation can understand .odp format and the player/preview understands the same.

While the editor shows you controls, where you can move objects, add, delete etc.

the preview of the .odp files only shows you the full screen view with all the interactions and controls which you have added on stage.

In a similar fashion, you should think about the plugin. You are going to allow the end user to add objects and interactivity, which then will be stored in the server(How to ECML)](ECML-How-to-Guide.md). And the same ecml data is passed to Preview, to play the content.

and renderer / preview

Alright, I am excited!, How can I develop one?

To contribute a plugin, you need be familiar with following libraries:

  1. FabricJS

  2. CreateJS

  3. Unit Testing using Jasmine, Karma

FabricJS

CreateJS

Unit testing

<TBU>

Do you have a wishlist, where I can get some idea?

Indeed. You can refer to link below to refer to couple of plugins which are in our wishlist. Link here.... (Surendra to add link here)

Which methods can I extend in Editor?

We have following properties and methods, which you can extend from BasePlugin.

Properties

type

e.g. assessmentbrowser

Methods

initialize

Initialize the plugin when it is loaded. This is a no-op implementation and child classes must provide the complete functional implementation. Register all events, ensure that you namespace with your plugin, such that it doesn't clash with other plugin events e.g.

EkstepEditorAPI.addEventListener("org.ekstep.developer:loadplugin", this.loadPlugin, this);

newInstance

Instantiate an object of the plugin type. This is a no-op implementation and child classes must provide the complete functional implementation. Tip: Create your fabric object here

convertToFabric

Editor and Renderer both keep output in 16:9 ratio. Current canvas size in editor is 720x405, which is 16:9. If you are going to draw any custom shapes, ensure that you do the calculation accordingly here.

onConfigChange

Called when the configuration is modified for the plugin. This is useful if the plugin * has to provide WYSIWYG feedback on the fabric canvas.

getConfig

Returns the config for this plugin. Child plugins should override this method to generate the custom plugin JSON objects.

getAttributes

Returns the ECML attributes for the plugins. This includes x,y,w,h and rotation related attributes that are common to all plugins.

Below is a screenshot from Content Editor

Refer to our developer plugin guide and explore the Content Editor, if you haven't done so yet.

You should refer to fabricjs website and get acquainted with FabricJS library. Refer to to see few samples on whats possible. To quickly get started, fork the codepen below, which includes fabricjs and QuickSetting to get you started with fabricjs library.

Refer to createjs website and get acquainted with createJS library. Preview uses createjs library. To quickly get started, fork the codepen below, which includes createjs to get you started with createjs. codepen link here...

https://knowlg.sunbird.org/learn/product-and-developer-guide/editors/how-to-contribute-as-a-js-plugin/using-sdk-to-create-and-test-the-plugin
http://fabricjs.com/
http://fabricjs.com/demos/
http://codepen.io/pen?template=MJBgGE
http://www.createjs.com/
Apache OpenOffice