Giter VIP home page Giter VIP logo

ngx-ckeditor's Introduction

ngx-ckeditor

Travis CI Status

The CKEditor 4.x component for angular

If you used the ckeditor 5.x, please see: https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/angular.html#quick-start

Usage

Installation

  • Import CKEditor js file
<script src="//cdn.ckeditor.com/4.7.1/full/ckeditor.js"></script>
  • Install ngx-ckeditor
npm i -S ngx-ckeditor

Sample

Import CKEditorModule module in your main module:

// app.module.ts

import { CKEditorModule } from 'ngx-ckeditor';

@NgModule({
  imports: [
    // ...
    CKEditorModule
  ],
  // ...
})
export class AppModule {

}

Then use it in your component:

// app.component.html

<ck-editor name="editor1" [(ngModel)]="editorValue" skin="moono-lisa" language="en" [fullPage]="true"></ck-editor>
// app.component.ts

@Component({
  selector: 'app',
  templateUrl: 'app.component.html'
})

export class AppComponent implements OnInit {

  public editorValue: string = '';

  ngOnInit() { }
}

CKEditorComponent Options

Type Name DataType Default Value Description
Input readonly boolean false Enabled / disable readonly on editor
Input skin string 'moono-lisa' Set the editor skin
Input language string 'en' Set the editor language
Input fullPage boolean false Enalbed /disable fullPage mode on editor
Input config object {} CKEditor's config object, see more
Input inline boolean false Set the inline mode
Two-way ngModel string Two-way binding value

Version Rules (Imports)

In order to match angular version, the ngx-ckeditor version no will same as angular majar version.

  • 0.2.x: for angular 2.x ~ 4.x
  • 0.4.x: for angular 5.x ~ 7.x
  • 8.x.x: for angular 8.x
  • 10.x.x: for angular 10.x
  • 11.x.x: for angular 11.x
  • 12.x.x: for angular 12.x

How to develop?

git clone https://github.com/HstarComponents/ngx-ckeditor.git

# install deps
npm i

# run dev
npm start

# build demo
npm run build:ngx-ckeditor-examples

# build lib
npm run build:ngx-ckeditor

# test
npm test

# Upgrade angular version
ng update 
ng update @angular/core@12 @angular/cli@12

# Package Publish
npm run build:ngx-ckeditor
cp README.md dist/ngx-ckeditor/README.md && cp CHANGELOG.md dist/ngx-ckeditor/CHANGELOG.md && cd dist/ngx-ckeditor
npm publish

# Update Docs Site
npm run build:ngx-ckeditor-examples
# replace docs/index.html content

FAQ?

1、Metadata version mismatch found version 4, expected 3

A: That because the lib is build for angular 5.x, it will throw the error when your used angular version is 4.x, please use [email protected] for angular 4.x.

Issues

Create an issue

[Changelog]

Changelog

License

MIT License

ngx-ckeditor's People

Contributors

hstarorg avatar nate-summercook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ngx-ckeditor's Issues

Word count issue in full and standard version of ckeditor

I am using the full version of the editor . The package works fine, but there is issue with the word count .
I am not able to get the word count in the editor section .

The same functionality works fine in basic version , but not in standard and full version.
The required packages/plugins are added .

Is there any issue in using the word count in full version/standard version?

We are using angular 5 , browser - IE

How to destroy ckeditor on ngOnDestroy method

I am using ngx-ckeditor ^0.3.2 in my Angular4 project. It is working fine but when I go on another component, It shows a warning message[CKEDITOR] Error code: editor-incorrect-destroy.

Angular 7 - cannot import js file, script tag gets removed

hello,

I try to add <script src="//cdn.ckeditor.com/4.7.1/full/ckeditor.js"></script> to my index.html but it gets removed

if I donwload the "ckeditor.js" and put it in my assets folder, loading it with angular.json "scripts" entry point, then the script loads but it cannot find languages and css files

can you update your documentation for angular 7 ?, aparently it does not work anymore

regards

{
  "name": "editor-test",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.1.0",
    "@angular/common": "~7.1.0",
    "@angular/compiler": "~7.1.0",
    "@angular/core": "~7.1.0",
    "@angular/forms": "~7.1.0",
    "@angular/platform-browser": "~7.1.0",
    "@angular/platform-browser-dynamic": "~7.1.0",
    "@angular/router": "~7.1.0",
    "core-js": "^2.5.4",
    "ngx-ckeditor": "^0.4.0",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.11.0",
    "@angular/cli": "~7.1.0",
    "@angular/compiler-cli": "~7.1.0",
    "@angular/language-service": "~7.1.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.1.6"
  }
}

Invitation for official integration contribution

Hello,

as a CKEditor 4 core team member, I would like to invite you to contribute to the official CKEditor 4 component for Angular 2 available at https://github.com/ckeditor/ckeditor4-angular.

We appreciate the amazing work the community puts into projects based on CKEditor 4. You did a great job with the ngx-ckeditor integration and with your experience, we thought we could make the official integration even better. We would be most happy if you decided to contribute to the project.

We're looking forward to hearing from you!

'ck-editor' is not a known element in angular 5

'ck-editor' is not a known element:

  1. If 'ck-editor' is an Angular component, then verify that it is part of this module.
  2. If 'ck-editor' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

Copy paste event

I am using reactive form with the editor.
The editor doesn't trigger value when copy pasting text. Only when entering manually , it triggers the text.

I am using angular 5

CKEditorModule is not an NgModule : web pack

I'm getting a compilation error "CKEditorModule is not an NgModule".
I'm using the following delopment environment

  1. angular 4.x
  2. [email protected]
  3. angular cli: 1.4.10

Findings: the file ck-editor.module.d.ts (ngx-ckeditor/lib/src/ck-editor.module.d.ts) does not have @NgModule({}) annotation. After ngx-CKEditor npm installed, if i add the following code it works.

import { NgModule } from "@angular/core";
@NgModule({})
export declare class CKEditorModule {
}

@hstarorg
Can you guys pls add this code if I'm not missing anything. I don't have access to create a pull request against the master branch.

Thank you,
Jitender

How to configure globally in Angular 5?

I see there's a config attribute that allows you to configure a single instance of the editor. Is there a way to configure global defaults within Angular 5?

Copy Paste event not trigger

I'm using Basic version of ckeditor . while pasting text inside ckeditor not fire any events. But in full version of ckeditor this issue is not happening.
framework: Angular5 . please help ..

There is no FormControl instance attached to form control element with path

Hi,
When the Formgroup where a ck-editor is refreshed, the editor can't find its FormControl even when it is there for sure and throws an error: "There is no FormControl instance attached to form control element with path: 'info -> description -> es'".
This is solved hiding and showing the editor with an *ngIf but it would be nice that the editor could be refreshed.
Thanks for your library.

Use with Angular 11?

The current version as built with Angular 10. It throws errors when installing with Angular 11. How can it work with Angular 11? Thank you

ERROR in : Unexpected value 'CKEditorModule in

Hi,
At the time of simple ng build its working fine.
But when I'm trying to use ng build --prod --aot error below.

ERROR in : Unexpected value 'CKEditorModule in /home/node_modules/ngx-ckeditor/lib/ck-editor.module.d.ts' imported by the module 'ClientsModule in /home/web-app/src/app/controller/contractor/clients/clients.module.ts'. Please add a @NgModule annotation.

how to use inline mode

hi
thanks for your time!
i want to use inline mode but i have error.error title is:
ERROR TypeError: "b.container is undefined"

i use it like below

<ck-editor name = "comments" [config]="editorConfig"  [inline]="true"  [(ngModel)] = "comments"></ck-editor>

what is my mistake?

Using save button

When I enable and use the save button, it reloads the page, instead and submits the form for me to capture through the Anglar.
I haven't been able to solve this yet.

error TS2304: Cannot find name 'CKEDITOR'

I'm using CKEDITOR as in the Readme.
As soon as run ng build, I got following error.

ERROR in src/app/example/modules/example-tests/components/writing/writing.component.ts(40,23): error TS2304: Cannot find name 'CKEDITOR'.

ngx-ckeditor Basic version copy/paste issue

I'm using Basic version of ckeditor . while pasting text inside ckeditor not fire any events. But in full version of ckeditor this issue is not happening.
framework: Angular5 . please help ..

how to find ckeditor cdn link with https?

  1. i am using "ngx-ckeditor": "^0.4.0"
  2. including cdn link in index.html
    <script src="//cdn.ckeditor.com/4.7.1/full/ckeditor.js"></script>
  3. it was working fine in my local system, but not working on Live server, it's because of 'http' , i want cdn link with 'https'
  4. i got Error like 'ckeditor 4.X is missing'
  5. how can i find ckeditor cdn with 'https'
  6. Download cdn link also not working, getting error like, something was undefined

Underline button missing

Hello,

I am using CKEditor in angular 5 project but underline button is missing,

Can you please give me steps how can i change it's from Standard to Full, or how can i add underline button

config.js missing

Hello,

I want to remove some buttons from the default toolbar, I want it to be like this:
`CKEDITOR.editorConfig = function( config ) {
config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
{ name: 'forms', groups: [ 'forms' ] },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] },
{ name: 'links', groups: [ 'links' ] },
{ name: 'insert', groups: [ 'insert' ] },
'/',
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'colors', groups: [ 'colors' ] },
{ name: 'tools', groups: [ 'tools' ] },
{ name: 'others', groups: [ 'others' ] },
{ name: 'about', groups: [ 'about' ] }
];

config.removeButtons = 'Source,Save,NewPage,Preview,Print,Templates,Cut,Copy,Paste,PasteText,PasteFromWord,Replace,Find,SelectAll,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,RemoveFormat,BidiLtr,BidiRtl,Language,Link,Unlink,Anchor,Image,Flash,Table,HorizontalRule,SpecialChar,PageBreak,Iframe,About';

};`

And for that I want to put this code sample in config.js, but I CANT FIND IT ??

Please help.

Error in rapid destroy/init of component

Hi,

i have 8-10 ckeditor instance in a collapsable. If I open and close the collapsable in ~1 second I get the following errors. If you click fast enough the error is present even with 1 instance, with more instances the time between open and close needed for the error shrink. Here a stackblitz https://stackblitz.com/edit/angular-r9rwdh

core.js:14597 ERROR TypeError: Cannot read property 'unselectable' of null
    at b (ckeditor.js:6744)
    at a.<anonymous> (ckeditor.js:6694)
    at a.q (ckeditor.js:127)
    at a.<anonymous> (ckeditor.js:187)
    at a.CKEDITOR.editor.CKEDITOR.editor.fire (ckeditor.js:228)
    at a.fireOnce (ckeditor.js:199)
    at a.CKEDITOR.editor.CKEDITOR.editor.fireOnce (ckeditor.js:234)
    at Object.<anonymous> (ckeditor.js:5230)
    at f (ckeditor.js:4831)
    at Object.load (ckeditor.js:4833)
defaultErrorLogger @ core.js:14597
push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:14645
next @ core.js:16628
schedulerFn @ core.js:12609
push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:196
push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:134
push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:77
push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:54
push../node_modules/rxjs/_esm5/internal/Subject.js.Subject.next @ Subject.js:47
push../node_modules/@angular/core/fesm5/core.js.EventEmitter.emit @ core.js:12593
(anonymous) @ core.js:16178
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:388
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:138
push../node_modules/@angular/core/fesm5/core.js.NgZone.runOutsideAngular @ core.js:16115
onHandleError @ core.js:16178
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.handleError @ zone.js:392
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:191
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:496
ZoneTask.invoke @ zone.js:485
timer @ zone.js:2054
setTimeout (async)
scheduleTask @ zone.js:2075
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:407
onScheduleTask @ zone.js:297
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:401
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:232
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask @ zone.js:255
scheduleMacroTaskWithCurrentZone @ zone.js:1114
(anonymous) @ zone.js:2090
proto.(anonymous function) @ zone.js:1394
setTimeout @ ckeditor.js:496
a @ ckeditor.js:5085
a @ ckeditor.js:6690
CKEDITOR.replace @ ckeditor.js:6757
push../node_modules/ngx-ckeditor/fesm5/ngx-ckeditor.js.CKEditorComponent.initEditor @ ngx-ckeditor.js:152
push../node_modules/ngx-ckeditor/fesm5/ngx-ckeditor.js.CKEditorComponent.ngAfterViewChecked @ ngx-ckeditor.js:106
callProviderLifecycles @ core.js:20985
callElementProvidersLifecycles @ core.js:20956
callLifecycleHooksChildrenFirst @ core.js:20946
checkAndUpdateView @ core.js:21882
callViewAction @ core.js:22114
execComponentViewsAction @ core.js:22056
checkAndUpdateView @ core.js:21879
callViewAction @ core.js:22114
execEmbeddedViewsAction @ core.js:22077
checkAndUpdateView @ core.js:21874
callViewAction @ core.js:22114
execEmbeddedViewsAction @ core.js:22077
checkAndUpdateView @ core.js:21874
callViewAction @ core.js:22114
execEmbeddedViewsAction @ core.js:22077
checkAndUpdateView @ core.js:21874
callViewAction @ core.js:22114
execEmbeddedViewsAction @ core.js:22077
checkAndUpdateView @ core.js:21874
callViewAction @ core.js:22114
execComponentViewsAction @ core.js:22056
checkAndUpdateView @ core.js:21879
callViewAction @ core.js:22114
execComponentViewsAction @ core.js:22056
checkAndUpdateView @ core.js:21879
callViewAction @ core.js:22114
execEmbeddedViewsAction @ core.js:22077
checkAndUpdateView @ core.js:21874
callViewAction @ core.js:22114
execComponentViewsAction @ core.js:22056
checkAndUpdateView @ core.js:21879
callViewAction @ core.js:22114
execEmbeddedViewsAction @ core.js:22077
checkAndUpdateView @ core.js:21874
callViewAction @ core.js:22114
execComponentViewsAction @ core.js:22056
checkAndUpdateView @ core.js:21879
callViewAction @ core.js:22114
execEmbeddedViewsAction @ core.js:22077
checkAndUpdateView @ core.js:21874
callViewAction @ core.js:22114
execComponentViewsAction @ core.js:22056
checkAndUpdateView @ core.js:21879
callWithDebugContext @ core.js:22767
debugCheckAndUpdateView @ core.js:22445
push../node_modules/@angular/core/fesm5/core.js.ViewRef_.detectChanges @ core.js:20254
(anonymous) @ core.js:16888
push../node_modules/@angular/core/fesm5/core.js.ApplicationRef.tick @ core.js:16888
(anonymous) @ core.js:16779
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:388
onInvoke @ core.js:16156
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:387
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:138
push../node_modules/@angular/core/fesm5/core.js.NgZone.run @ core.js:16070
next @ core.js:16779
schedulerFn @ core.js:12609
push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:196
push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:134
push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:77
push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:54
push../node_modules/rxjs/_esm5/internal/Subject.js.Subject.next @ Subject.js:47
push../node_modules/@angular/core/fesm5/core.js.EventEmitter.emit @ core.js:12593
checkStable @ core.js:16125
onLeave @ core.js:16192
onInvokeTask @ core.js:16150
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:420
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:188
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:496
invokeTask @ zone.js:1540
globalZoneAwareCallback @ zone.js:1566 
3core.js:14597 ERROR TypeError: Cannot read property 'getComputedStyle' of undefined
    at $.CKEDITOR.tools.extend.getComputedStyle (ckeditor.js:2072)
    at $.getDirection (ckeditor.js:2505)
    at $.setup (ckeditor.js:7224)
    at $.m (ckeditor.js:16690)
    at ckeditor.js:497
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:16147)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:496)

Error when "inline"=true

I am using Angular 5.2 + Ionic 3.20
It prompt an error when i set inline to true
"Cannot read property 'clearCustomData' of undefined"

Angular Material Tabs

There is an issue when using with Angular Material, when switching tabs via angular material tabs the ckeditor component freezes. Is there a simple solution for this?

How to add custom button in ngx-ckeditor?

  1. i am using "ngx-ckeditor": "^0.4.0",
  2. i want to add my custom icon & access it's click event in angular 5.
  3. i am trying to hide Image dialog while click on Image icon, but it's not working
    this.ckEditorConfig = { on: { afterCommandExec: function handleAfterCommandExec(event) { if (event.data.name == 'image') { that.fileUploadImage.nativeElement.click(); var startFind = setInterval(() => { if($(".cke_dialog_ui_button_cancel span").length > 0){ clearInterval(startFind); $(".cke_dialog_ui_button_cancel span").click(); } }, 200); } }, }, };

with this code when i click on Image icon first Image dialog open and then hide, but i don't want to open it, without remove it's plugin

Unable to install ckeditor in angular 4.X

Command Use - npm i -S ngx-ckeditor@2
Error:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for ngx-ckeditor@2
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:

Docker build fails because of unknown property config

Hi :)

i tryed to implement this package into my Meteor Project with Meteor 1.7.0.1 and Angular 5.
Its working great if i run it locally, but if i try to build my docker container, it fails and says:

Errors prevented bundling:
While processing files with angular-compilers (for target web.browser):
/opt/meteor/src/node_modules/packages/compiler/esm5/src/util.js:183:2: Template
parse errors:
Can't bind to 'config' since it isn't a known property of 'ck-editor'.
1. If 'ck-editor' is an Angular component and it has 'config' input, then
verify that it is part of this module.
2. If 'ck-editor' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the
'@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of
this component. ("
<ck-editor class="form-control"
[ERROR ->][config]="options"

how can i fix this?

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.