Socket
Book a DemoInstallSign in
Socket

atlassian-editorkit

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atlassian-editorkit

Provides basic tooling an infrastructure for developing or creating new EditorKit components

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
3
Created
Source

EditorKit

Purpose

Providing the basic tooling and structure to create new EditorKit components.

EditorKit does this by exposing a set of tasks to aid the development.

Usage

Install EditorKit as a dev dependency of your project:

npm install atlassian-editorkit --save-dev

Available tasks

  • sandbox - Starts a server on port 1988 with an editor instance and your plugin integrated to it
  • build - build files using typescript
  • compile - builds typescript file
  • typings - install typings that are used on editorkit dependencies
  • lint - lint files on the repo
  • test - run tests
  • dev - watch, lint, test and build files upon file change

Using the binary

./node_modules/.bin/editorkit --$CMD

Adding as a npm run task

Modify the scripts section of your package.json

example of a modified package.json:

{
  ...
  scripts: {
    ...
    'sandbox': 'editorkit --sandbox',
    'build': 'editorkit --build',
    'compile': 'editorkit --compile',
    'typings': 'editorkit --typings',
    'lint': 'editorkit --lint',
    'test': 'editorkit --test',
    'dev': 'editorkit --dev'
  }
}

Then execute your tasks:

npm run sandbox

Component Creation

EditorKit components should have their entry points defined on src/index.js. And they should export a class in the following form:

example src/index/js:

class MyPlugin {
  constructor(EditorKITInstance) {
    // initialize your plugin here
    ...
  }

  detach(EditorKITInstance) {
    // called to allow your plugin to do cleanups
    ...
  }
}

module.exports = MyPlugin;

Configuring prosemirror default initializer settings

Sometimes you may want to overwrite default prosemirror settings such as schema to do so you can supply a static 'configure()' method on your Plugin, and output of it will be used as the initialization settings for prosemirror.

this will be called prior to prosemirror being initialized and the output of configure should be a configuration object to be used to instantiate prosemirror.

example:

class MyPlugin {
  ...
}

MyPlugin.configure = function(settings) {
  ...
  settings.foo = bar;
  return settings;
};

module.exports = MyPlugin;

FAQs

Package last updated on 23 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts