Skip to content

wecatch/ember-cli-simditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ember-cli-simditor

Build Status Downloads Version

Ember component wrapper for simditor.

Changes

1.0.0

  • Upgrade Ember to 3.85
  • Use native class rewrite addon
  • Lock simditor dependence
  • Change ci to github action

0.0.7

Different from previous version, you must wrap content in object. See issue 6 for why.

Getting Started

Installation

In your ember-cli project, install this addon from npm

ember install ember-cli-simditor

or install the latest version from github

ember install git+https://github.com/wecatch/ember-cli-simditor

Usage

<SimditorEditor
  @value={{get this.model 'one'}}
  @update={{fn (mut this.model.one.content)}}
  @editor={{fn (mut this.editor)}}
  @toolbar={{this.toolbar}}
  @onValuechanged={{this.valuechanged}}
/>

You must wrap content in one object, that means model object must have one property called content for component to render, visit issue 6 for why.

By default the content property name is content, you can custome the property name with name argument

<SimditorEditor 
  @value={{this.model}}
  @update={{fn (mut this.model.html)}}
  @editor={{fn (mut this.editor)}}
  @toolbar={{this.toolbar}}
  @onValuechanged={{this.valuechanged}}
  @name='html'/>

Locale

English by default

<SimditorEditor />

Chinese

<SimditorEditor @locale='zh-CN'/>

API

In this addon , on prefix must be used for all events name. For sample, valuechanged => OnValuechanged.

  • valuechanged => onValuechanged
  • selectionchanged => onSelectionchanged
  • decorate => onDecorate
  • undecorate = > onUndecorate
  • pasting => onPasting
  • blur => onBlur
  • destroy => onDestroy

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server