• Stars
    star
    137
  • Rank 266,121 (Top 6 %)
  • Language
    JavaScript
  • Created over 10 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CKEditor directive for Angular.

angular-ckeditor

Build Status Dependency Status devDependency Status

CKEditor directive for Angular.

Install

Using bower

bower install angular-ckeditor

Using NPM

npm install angular-ckeditor

Note : obviously this plugin expects the presence of AngularJS and CKEditor.

Usage

Example

HTML:

<!-- Load files. -->
<script src="angular.js"></script>
<script src="ckeditor.js"></script>
<script src="angular-ckeditor.js"></script>

<div ng-controller="CkeditorCtrl">
  <div ckeditor="options" ng-model="content" ready="onReady()"></div>
</div>

JavaScript:

angular.module('controllers.ckeditor', ['ckeditor'])
.controller('CkeditorCtrl', ['$scope', function ($scope) {

  // Editor options.
  $scope.options = {
    language: 'en',
    allowedContent: true,
    entities: false
  };

  // Called when the editor is completely ready.
  $scope.onReady = function () {
    // ...
  };
}]);

"ckeditor" directive

  • "ckeditor" editor options. Accepts an Object.
  • "ng-model" bound scope variable.
  • "ready" (optional) callback called when the editor is completely ready. Accepts an Angular expression.
  • "contenteditable" (optional) if set to true, inline editing mode is enabled

IMPORTANT NOTICE Angular-ckeditor uses ng-model. If you add an ng-if on the element to whom this directive is attached, changes in the editor won't be forwarded to your code anymore, due to the extra scope created by ng-if. A solution is to explicitely bypass the extra scope : ng-model="$parent.model". See http://stackoverflow.com/questions/18342917/angularjs-ng-model-doesnt-work-inside-ng-if

Advanced usage

getting internal ckeditor instance

Internally, CKEditor gives a name to its instances, either the id of the element it's on or automatic name (editor1, editor2...). If you plan to look for your instances programmatically via CKEditor.istances, be sure to give them a unique id="..." (Beware of re-usable directives).

In a directive on the same element, you can also use :

link: function (scope, element) {
  var ckeditorController = element.controller('ckeditor'); // angular-ckeditor controller
  var ckeditorInstance = ckeditorController.instance;

See also

You may find this other directive useful : https://github.com/lemonde/angular-ckeditor-placeholder

License

MIT

Contributing

  • clone repo
  • ensure your editor is decent and pick up the .editorconfig and .jshintrc files
  • npm install
  • npm test
  • add tests, add features
  • grunt (to generate minified version)
  • send a PR

Thanks !

More Repositories

1

team

Où nous annonçons nos ouvertures de postes côté technique
40
star
2

primus-cluster

Scale Primus across multiple servers.
JavaScript
30
star
3

php-circuit-breaker-bundle

Circuit Breaker Bundle
PHP
11
star
4

locky

Resource locking system using redis.
JavaScript
8
star
5

node-oss-client

Node.js client for Open Search Server.
JavaScript
7
star
6

utf8-binary-cutter

A small node.js lib to truncate UTF-8 strings to a given binary size. Useful when dealing with old systems handling UTF-8 as ascii/latin-1, for ex. MySQL or Oracle database
JavaScript
7
star
7

knex-schema

Bookshelf sync utility.
JavaScript
7
star
8

angular-ckeditor-placeholder

Placeholder support for CKEditor angular directive.
JavaScript
6
star
9

angular-bootstrap-datepicker

Bootstrap datepicker directive for Angular.
JavaScript
5
star
10

drbd-sandbox

DRBD/Ansible sandboxing
5
star
11

winston-kibana

Winston rewriter to optimized logs for Kibana usage.
JavaScript
5
star
12

winston-error

Error helper for winston.
JavaScript
4
star
13

react-native-at-internet

Implementation of AtInternet Android & iOS packages
TypeScript
4
star
14

slidify

Modular JavaScript slider based on jQuery and AMD modules.
JavaScript
4
star
15

sirius-import-article

Tuto on how to import an article on Sirius
JavaScript
3
star
16

json-schema-formatter

JSON Schema formatter.
JavaScript
3
star
17

cms-htmlparser

HTML Parser By John Resig (ejohn.org).
JavaScript
3
star
18

node-logger

logging for dev, test and prod
JavaScript
2
star
19

auto-label-action

Automatically add labels on pull-request based on commits.
JavaScript
2
star
20

winston-fluent

JavaScript
1
star
21

middlebot-oss

Open search server middleware.
JavaScript
1
star
22

xmlkit

A lightweight toolkit to manipulate XML.
JavaScript
1
star
23

map-monde

Amazing quiz game.
1
star
24

oss-odm

Object document mapper for Open Search Server.
JavaScript
1
star
25

oss-php

PHP library for Open Search Server.
PHP
1
star
26

phalcon-abtest

PHP
1
star
27

knex-schema-filter

JavaScript
1
star
28

grunt-knex-schema

Grunt bookshelf sync task.
JavaScript
1
star
29

middlebot-bookshelf

Collection of bookshelf middlewares.
JavaScript
1
star
30

middlebot-resource-cache

Middlebot resource cache middleware based on redis.
JavaScript
1
star
31

middlebot-primus

Primus broadcast middleware.
JavaScript
1
star
32

libvmod-access

Varnish module for access control based on cookies
C
1
star
33

universal-video-provider

ES6 client and node universal video provider
JavaScript
1
star
34

get-set

Object nested getter and setter.
JavaScript
1
star
35

knex-schema-file-loader

JavaScript
1
star
36

js-release

Tools to create a release on github
JavaScript
1
star
37

express-logger

Express logger middlewares.
JavaScript
1
star