Coder Social home page Coder Social logo

ckeditor5-omi's Introduction

CKEditor 5 rich text editor component for Omi

CKEditor 5 rich text editor component for Omi.

Getting started

> npm i -g omi-cli
> omi init myapp
> npm i --save @ckeditor/ckeditor5-build-classic
> npm i --save ckeditor5-omi
> npm run start
import 'babel-polyfill'
import { define, WeElement } from 'omi'
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import 'ckeditor5-omi'

define('myapp-element', class extends WeElement {
  render() {
    return (
      <ckeditor-element
        editor={ ClassicEditor }
        data="<p>Hello from CKEditor 5!</p>"
        onInit={ editor => {
            // You can store the "editor" and use when it is needed.
            console.log( 'Editor is ready to use!', editor );
        } }
        onChange={ ( event, editor ) => {
            const data = editor.getData();
            console.log( { event, editor, data } );
        } }
        onBlur={ editor => {
            console.log( 'Blur.', editor );
        } }
        onFocus={ editor => {
            console.log( 'Focus.', editor );
        } }
      />
    )
  }
})

Executing tests

> npm install
> npm run test -- [additional options]
# or
> npm t -- [additional options]

The command accepts the following options:

  • --coverage (-c) – Whether to generate the code coverage.
  • --source-map (-s) – Whether to attach the source maps.
  • --watch (-w) – Whether to watch test files.
  • --reporter (-r) – Reporter for Karma (default: mocha, can be changed to dots).
  • --browsers (-b) – Browsers that will be used to run tests (default: Chrome, available: Firefox, BrowserStack_Edge and BrowserStack_Safari).

Note: If you would like to use the BrowserStack_* browser, you need to specify the BROWSER_STACK_USERNAME and BROWSER_STACK_ACCESS_KEY as an environment variable, e.g.:

> BROWSER_STACK_USERNAME=[...] BROWSER_STACK_ACCESS_KEY=[...] npm t -- -b BrowserStack_Edge,BrowserStack_Safari -c

If you are going to change the source (src/ckeditor.js) file, remember about rebuilding the package. You can use npm run develop in order to do it automatically.

Building the package

Build a minified version of the package that is ready to publish:

> npm run build

License

Please check the LICENSE.md file.

ckeditor5-omi's People

Watchers

 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.