Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of the core feature #1

Merged
merged 139 commits into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from 128 commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
933984e
Changed indent to tabs, fixed all tslint reports.
engineering-this Oct 17, 2018
7a967ad
data property can be two way binded.
engineering-this Oct 17, 2018
4a78270
Added comments.
engineering-this Oct 17, 2018
6762798
Created playground component.
engineering-this Oct 17, 2018
d63111a
Tests: changing setTimeout for fixture.whenReady
engineering-this Oct 18, 2018
abb9475
Moving initial data to element(textarea) inneHTML, so it is really in…
engineering-this Oct 19, 2018
3820d3f
Tests: replaced setTimeout with new helper which returns promise that…
engineering-this Oct 19, 2018
26ba02c
Tests: added comment on failing test.
engineering-this Oct 19, 2018
bb2cba0
Fixed compile error.
engineering-this Oct 19, 2018
397f615
Moveod part of editor creation to setTimeout, due to issues with dela…
engineering-this Oct 22, 2018
77e5abc
Added comment with issue reference.
engineering-this Oct 22, 2018
881bf6e
Tests: fixted test file.
engineering-this Oct 22, 2018
7ca78ad
Tests: fixed some failing test cases.
engineering-this Oct 22, 2018
50e93ad
Refactoring, code style. Extracted duplicate code to separate module.
engineering-this Oct 22, 2018
c1ee79a
Tests: unwraped done callback.
engineering-this Oct 22, 2018
aa807b0
Tests: fixed some failing tests.
engineering-this Oct 22, 2018
1c19854
Updated playground component.
engineering-this Oct 22, 2018
1d7902c
Comment: added todo comment.
engineering-this Oct 22, 2018
4c01f75
Updated editorconfig.
engineering-this Oct 22, 2018
0a0b99c
Reformated code with linter rules.
engineering-this Oct 22, 2018
38ab348
Forcing calling onChange listener when component data is changed from…
engineering-this Oct 23, 2018
91a72c8
Tests: corrected assertion.
engineering-this Oct 23, 2018
db835f4
Tests: fixed failing tests.
engineering-this Oct 23, 2018
1fb0633
Removed test file for playground component, as it's made for manual t…
engineering-this Oct 23, 2018
f4552c1
Refactored CKEditor creation for 2-way data binding.
jacekbogdanski Oct 24, 2018
993c6c3
Moved 'ready' emitter and event susbscriber to 'dataReady' listener.
engineering-this Oct 25, 2018
34adf7d
Tests: updated assertions after changes.
engineering-this Oct 25, 2018
e9382ed
Fixed issue with [(data)] binding, when typing in editor changed sele…
engineering-this Oct 25, 2018
62849f2
Removed comment, moved get data upper in scope so its next to set data.
engineering-this Oct 25, 2018
7b95058
Corrected ngOnDestroy, so it doens't throw warning.
engineering-this Oct 26, 2018
9a158f4
Fixed tests after changes.
engineering-this Oct 26, 2018
c687d68
Forced divarea editor, moved editor rendering outside of component.
engineering-this Nov 7, 2018
0599013
Changed karma.conf.js link to ckeditor full-all so it includes divarea.
engineering-this Nov 7, 2018
1b87e11
Removed destroy button.
engineering-this Nov 7, 2018
40b0f29
Added support for extraPlugins defined as an array.
engineering-this Nov 13, 2018
a815d97
Removed instanceReady listener priority.
engineering-this Nov 13, 2018
634fc83
Delated playground component.
engineering-this Nov 13, 2018
4c067a3
Added inline editor, added component controls.
engineering-this Nov 13, 2018
d97012b
Removed button duplicated by checkbox.
engineering-this Nov 13, 2018
1a447ef
Made data preview read-only.
engineering-this Nov 13, 2018
6c04f46
Fixed typo.
engineering-this Nov 14, 2018
fd8980d
Refactoring: extracted some code into helpers.
engineering-this Nov 14, 2018
0e001e7
Added missing doublequotes.
engineering-this Nov 14, 2018
cf7c787
Fixed readOnly not working when set from config.
engineering-this Nov 15, 2018
50e253b
Renamed disabled state to readOnly.
engineering-this Nov 15, 2018
ea25e0f
TSLint: removed rule.
engineering-this Nov 15, 2018
0402d35
Tests: added FormsModule import.
engineering-this Nov 15, 2018
827f364
Changed binding from ngModel to data.
engineering-this Nov 15, 2018
ae4afd4
Tests: updated after changes.
engineering-this Nov 15, 2018
6e7529d
Tests: added assertions for second editor.
engineering-this Nov 15, 2018
c48ae9e
E2e: updated tests.
engineering-this Oct 26, 2018
26781e0
Moved subscribing from dataReady to instanceReady.
engineering-this Nov 16, 2018
a70ffef
Removed redundant setReadOnlyState method.
engineering-this Nov 16, 2018
594fae6
Removed setReadOnly as it can be inlined.
engineering-this Nov 16, 2018
e181f7f
Removed syncEditors option.
engineering-this Nov 16, 2018
b46b329
Added information about editors data synchronization.
engineering-this Nov 16, 2018
90be325
Tests: removed tc after removing setReadOnlyState method.
engineering-this Nov 16, 2018
929a422
Tests: added config test cases.
engineering-this Nov 16, 2018
78dde07
Tests: Updated tc names and structure.
engineering-this Nov 16, 2018
96b10a0
Simple refactoring.
jacekbogdanski Nov 17, 2018
e4b3182
Simplified test case names.
jacekbogdanski Nov 17, 2018
4b750e6
Improved component data tests to proof ACF compatibility.
jacekbogdanski Nov 17, 2018
70ce8e9
Added test to cover divarea plugin.
jacekbogdanski Nov 17, 2018
97af1b5
Ensured divarea will load even when exluded by removePlugins.
engineering-this Nov 18, 2018
4497b79
Tests: added test for extraPlugins and removePlugins.
engineering-this Nov 18, 2018
158d446
Tests: fixed type error in test.
engineering-this Nov 18, 2018
f239902
Test: added types to testTools and changed param to evtName.'
engineering-this Nov 18, 2018
3ed128d
Tests: removed wait for editor destroy in afterEach.
engineering-this Nov 18, 2018
baa51cd
Tests: extracted duplicate beforeEach, afterEach to higher scope.
engineering-this Nov 18, 2018
ca27c02
Tests: added tests for inline editor.
engineering-this Nov 18, 2018
b0ce357
Tests: added test for tagName unset, and moved tagName set to div test.
engineering-this Nov 18, 2018
54f05b4
Tests: added test case for editor creation method.
engineering-this Nov 18, 2018
a45ecd2
Tests: added test case for editor instance type.
engineering-this Nov 18, 2018
fb8f256
Tests: removed redundant changeDetection which caused typeError.
engineering-this Nov 18, 2018
4aaaeb0
Added LICENSE.md file.
engineering-this Nov 19, 2018
0b4308b
Added license headers.
engineering-this Nov 19, 2018
78465cb
Changed CKEditor preset to standard.
engineering-this Nov 19, 2018
94de428
Simplified including divarea plugin,
jacekbogdanski Nov 19, 2018
4b51a61
Console.warn: removed issue reference.
engineering-this Nov 19, 2018
edd1a1b
Moved event logging from DOM elements to console.
engineering-this Nov 19, 2018
b75a097
Tests: updated after moving event logging to console.
engineering-this Nov 19, 2018
fe08bd4
E2E: added explicit navigateTo target.
engineering-this Nov 19, 2018
f218561
E2E: added tests for demo-form sample.
engineering-this Nov 19, 2018
c92ba7b
Removed stray line.
jacekbogdanski Nov 20, 2018
9b323f7
Improved test readibility.
jacekbogdanski Nov 20, 2018
140948b
Removed stray lines.
jacekbogdanski Nov 20, 2018
0d63846
Name refactoring.
jacekbogdanski Nov 20, 2018
d7cf5a9
Readme: updated readme file.
engineering-this Nov 20, 2018
3b7bd1d
Updated license headers to 2019.
engineering-this Jan 14, 2019
30629e3
Codestyle: mising space before curly bracket.
engineering-this Jan 14, 2019
733117c
Refactored 'data' and 'readOnly' setters.
engineering-this Jan 14, 2019
2ddf684
Renamed 'initialReadOnly' to '_readOnly'.
engineering-this Jan 14, 2019
f389e44
Marked 'readOnly' as private.
engineering-this Jan 14, 2019
5a4da48
Changed '_readOnly' type to boolean.
engineering-this Jan 14, 2019
55ab853
Removed 'isString' helper.
engineering-this Jan 14, 2019
76f13ea
Removed asssets/.directory
engineering-this Jan 14, 2019
8431f9a
Added missing types.
engineering-this Jan 14, 2019
ce8990b
Remove 'null' from type declaration, as in TS null can be assigned to…
engineering-this Jan 14, 2019
7b9d39a
Fixed: Editor has undo step after initialization.
engineering-this Jan 14, 2019
a695822
TSLint: removed rule.
engineering-this Jan 14, 2019
c2bbd89
Added 'load-script' dependency.
engineering-this Jan 15, 2019
9040190
Added ckeditro.helpers.ts file with 'getEditorNameSpace' method.
engineering-this Jan 15, 2019
d0dc72b
Removed script with ckeditor.js.
engineering-this Jan 15, 2019
156c6f4
Fetch CKEDITOR from cdn when namespace is missing.
engineering-this Jan 15, 2019
93e7abc
Tests: removed test case, updated another after changes.
engineering-this Jan 15, 2019
fdef6e6
Removed redundant check for string.
engineering-this Jan 15, 2019
f925716
Tests: added new test file for helpers.
engineering-this Jan 15, 2019
eb571da
Removed ckeditor.js from karma.conf as it is added by component.
engineering-this Jan 15, 2019
12484b1
Added build-package script.
engineering-this Jan 16, 2019
1622715
Added package.json for module.
engineering-this Jan 16, 2019
29beeb9
Added modules ng-packagr and fs-extra, added script build-package.
engineering-this Jan 16, 2019
a645423
Updated package-lock.json.
engineering-this Jan 16, 2019
41382df
Grouped consts, removed eslint comment.
engineering-this Jan 16, 2019
fabb327
Tests: removed empty line.
engineering-this Jan 16, 2019
f486da7
Updated license.
engineering-this Jan 16, 2019
783cd34
added load-script depenency so it is reflected in dist package.
engineering-this Jan 22, 2019
6200dca
Updated dependecies.
engineering-this Jan 22, 2019
79cac99
Updated package-lock.json.
engineering-this Jan 22, 2019
94b0d88
Renamed classic editor do divarea.
engineering-this Jan 30, 2019
57dffd6
Refactored check if removePlugins includes divarea to use [].includes.
engineering-this Feb 1, 2019
badb2ad
Corrected editorName param case.
engineering-this Feb 1, 2019
607d510
Updated typings.
engineering-this Feb 4, 2019
b04f525
Added const to enum declaration.
engineering-this Feb 4, 2019
aac0a3d
Exported CKEditorComponent and typings.
engineering-this Feb 4, 2019
d03f5b6
Removed redundant typings.
engineering-this Feb 4, 2019
a67fde1
Updated angular version to 7.
engineering-this Feb 4, 2019
06a6af8
Updated package-lock.json.
engineering-this Feb 4, 2019
3d53b35
Removed redundant if.
engineering-this Feb 4, 2019
d3c6a13
Added IE polyfill dependeciens.
engineering-this Feb 27, 2019
33f9f5c
Update package-lock.json.
engineering-this Feb 27, 2019
a4af330
Import IE polyfills.
engineering-this Feb 27, 2019
4854ae2
Tests: ignore test on IE10.
engineering-this Feb 27, 2019
3bfa435
Tests: added comment on ignoring test in IE10.
engineering-this Feb 27, 2019
f1ad71d
Update editorUrl version.
engineering-this Mar 8, 2019
de7ddf3
0.1.0
engineering-this Mar 8, 2019
23cea01
Include 'load-script' in license.
engineering-this Mar 8, 2019
db3ad31
Include Angular license.
engineering-this Mar 8, 2019
e77eb34
0.1.0
engineering-this Mar 8, 2019
a0d06cd
Update package.json.
engineering-this Mar 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[*.md]
max_line_length = off
trim_trailing_whitespace = false

27 changes: 27 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Software License Agreement
==========================

**CKEditor 4 component for Angular** – /~https://github.com/ckeditor/ckeditor4-angular <br>
Copyright (c) 2003-2019, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.

Licensed under the terms of any of the following licenses at your
choice:

- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html

- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html

- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html

Sources of Intellectual Property Included in CKEditor
-----------------------------------------------------

Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission.

Trademarks
----------

**CKEditor** is a trademark of [CKSource](http://cksource.com) Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
38 changes: 27 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
# CKEditor4Angular
# CKEditor 4 WYSIWYG editor Angular component

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.2.5.
Official [CKeditor 4](https://ckeditor.com/ckeditor-4/) WYSIWYG editor Angular component for Angular 2+

## Development server
## Documentation

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
See [CKEditor 4 Angular component](https://ckeditor.com/docs/ckeditor4/latest/guide/index.html) article.

## Contributing

Once you have cloned the repository install dependecies:

```bash
npm install
```

## Code scaffolding
### The structure of the repository

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
This repository contains the following code:

* `./src/ckeditor` contains the CKEditor component,
* `./src/app` is a demo application using the component.

### Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

## Build
### Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests
### Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests
### Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

## Further help
### License
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
84 changes: 74 additions & 10 deletions e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,78 @@
/**
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/

import { AppPage } from './app.po';
import { protractor, WebElement } from 'protractor';

describe( 'workspace-project App', () => {
let page: AppPage,
editables: WebElement[];

beforeEach( () => {
page = new AppPage;
} );

describe( 'simple-usage', () => {
beforeEach( () => {
page.navigateTo( 'simple-usage' );
} );

beforeEach( async () => {
editables = [ await page.getEditable(), await page.getInlineEditable() ];
} );

it( 'should display welcome message', () => {
expect( page.getParagraphText() ).toEqual( 'CKEditor integration with Angular 2+' );
} );

it( 'should display editor with initial content', async () => {
editables.forEach( editable => expect( page.getHtmlString( editable ) )
.toBe( '<p>Getting used to an entirely different culture can be challeng' +
'ing. While it’s also nice to learn about cultures online or from books, nothing comes close to experiencing cultural d' +
'iversity in person. You learn to appreciate each and every single one of the differences while you become more cultura' +
'lly fluid.</p>' )
);
} );

describe( 'typing', () => {
it( `in editor1 should update editors content`, testTyping( editables, 0 ) );
it( `in editor2 should update editors content`, testTyping( editables, 1 ) );
} );
} );

describe( 'demo-forms', () => {
beforeEach( () => {
page.navigateTo( 'forms' );
} );

beforeEach( async () => {
editables = [ await page.getEditable() ];
} );

it( 'should display editor with initial content', async () => {
expect( page.getHtmlString( editables[ 0 ] ) )
.toBe( '<p>A <strong>really</strong> nice fellow.</p>' );
} );

it( `typing should update editor content`, testTyping( editables, 0 ) );
} );

describe('workspace-project App', () => {
let page: AppPage;
function testTyping( elements, elementIndex: number ) {
return async function() {
const keys = [
'Foo! ',
protractor.Key.chord( protractor.Key.CONTROL, 'b' ),
'Bar?'
];

beforeEach(() => {
page = new AppPage();
});
await page.updateValue( editables[ elementIndex ], keys );

it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to ckeditor4-angular!');
});
});
editables.forEach( item => {
expect( page.getHtmlString( item ) )
.toBe( '<p>Foo!&nbsp;<strong>Bar?</strong></p>' );
} );
};
}
} );
51 changes: 44 additions & 7 deletions e2e/src/app.po.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,48 @@
import { browser, by, element } from 'protractor';
/**
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/

import { protractor, browser, by, element, WebElement, ElementFinder } from 'protractor';

export class AppPage {
navigateTo() {
return browser.get('/');
}
navigateTo( target: string = '' ) {
return browser.get( `/${target}` );
}

getParagraphText() {
return element( by.css( 'app-root h1' ) ).getText();
}

waitForElement( el: ElementFinder ) {
return browser.wait( protractor.ExpectedConditions.presenceOf( el ) ).then( () => el );
}

async getEditable() {
return this.getElementByCss( '.cke_editable:not(.cke_editable_inline)' );
}

getInlineEditable() {
return this.getElementByCss( '.cke_editable_inline' );
}

async getElementByCss( query ) {
const el = await element( by.css( query ) );
await this.waitForElement( el );
return el;
}

getHtmlString( el: WebElement ) {
return el.getAttribute( 'innerHTML' ).then( str => str.replace( /\u200B/g, '' ) );
}

async updateValue( el: WebElement, keys: string[] ) {
await el.click();
await this.selectAll();
await el.sendKeys( ...keys );
}

getParagraphText() {
return element(by.css('app-root h1')).getText();
}
selectAll() {
return browser.executeScript( 'document.execCommand( "selectAll", false, null )' );
}
}
Loading