Skip to content

Commit

Permalink
fix: config not set onInit
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Nov 23, 2017
1 parent 1d3e1b2 commit 443c994
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>NgxEditor</title><base href="ngx-editor"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.3ccbe96a5a764c24870d.bundle.css" rel="stylesheet"/></head><body><app-root></app-root><script async defer="defer" src="https://buttons.github.io/buttons.js"></script><script type="text/javascript" src="inline.da8d75cfacabb682539d.bundle.js"></script><script type="text/javascript" src="polyfills.ad37cd45a71cb38eee76.bundle.js"></script><script type="text/javascript" src="main.0686796be9383f2309ab.bundle.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>NgxEditor</title><base href="ngx-editor"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.3ccbe96a5a764c24870d.bundle.css" rel="stylesheet"/></head><body><app-root></app-root><script async defer="defer" src="https://buttons.github.io/buttons.js"></script><script type="text/javascript" src="inline.6dc018fd93034c80c41d.bundle.js"></script><script type="text/javascript" src="polyfills.ad37cd45a71cb38eee76.bundle.js"></script><script type="text/javascript" src="main.f7c307a459289870bb7e.bundle.js"></script></body></html>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/main.0686796be9383f2309ab.bundle.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/main.f7c307a459289870bb7e.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/polyfills.ad37cd45a71cb38eee76.bundle.js

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve -o --port 5000 --host 0.0.0.0",
"start": "ng serve -o --port 5000 --host 0.0.0.0 --aot",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"docs": "ng build --prod --output-path docs --base-href ngx-editor",
"build": "ng build --prod",
"build:package": "ng build --prod && sh scripts/build.sh",
"docs": "ng build --aot --prod --output-path docs --base-href ngx-editor",
"build": "ng build --aot --prod",
"build:package": "yarn run build && sh scripts/build.sh",
"test:single-run": "ng test --watch false",
"precommit": "ng test --watch false && yarn run build:package",
"precommit": "yarn run test:single-run && yarn run build:package",
"cz": "git-cz",
"release": "sh scripts/release.sh"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
@Injectable()
export class CommandExecutorService {

public execute(command: string): void {
execute(command: string): void {

if (command === 'enableObjectResizing') {
document.execCommand('enableObjectResizing', true, true);
Expand Down Expand Up @@ -33,17 +33,18 @@ export class CommandExecutorService {
document.execCommand(command, false, null);
}

private insertImage() {
private insertImage(): void {
const imageURI = prompt('Enter Image URL', 'http://');
if (imageURI) {
const inserted = document.execCommand('insertImage', false, imageURI);
if (!inserted) {
throw new Error('Invalid URL');
}
}
return;
}

private createLink() {
private createLink(): void {
const selection = document.getSelection();

if (selection.anchorNode.parentElement.tagName === 'A') {
Expand All @@ -61,6 +62,7 @@ export class CommandExecutorService {
}
}
}
return;
}

}
4 changes: 3 additions & 1 deletion src/app/ngx-editor/common/services/message.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ export class MessageService {
return this.message.asObservable();
}

sendMessage(message: string) {
sendMessage(message: string): void {
this.message.next(message);
this.clearMessageIn(FIVE_SECONDS);
return;
}

private clearMessageIn(milliseconds: number): void {
setTimeout(() => {
this.message.next(undefined);
}, milliseconds);
return;
}

}
2 changes: 1 addition & 1 deletion src/app/ngx-editor/common/utils/ngx-editor.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function getEditorConfiguration(value, ngxEditorConfig): any {
}

// return vertical if the element is the resizer property is set to basic
export function canResize(resizer: string) {
export function canResize(resizer: string): any {
if (resizer === 'basic') {
return 'vertical';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ export class NgxEditorToolbarComponent {

@Input() config: any;
@Input() enableToolbar = false;
@Output() execute = new EventEmitter();
@Output() execute: EventEmitter<string> = new EventEmitter<string>();

constructor() { }

/*
* enable or diable toolbar based on configuration
*/
canEnableToolbarOptions(value) {
canEnableToolbarOptions(value): boolean {
return Utils.canEnableToolbarOptions(value, this.config['toolbar']);
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/ngx-editor/ngx-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class NgxEditorComponent implements OnInit, OnChanges {

ngOnInit() {
// set configuartion
this.config = Utils.getEditorConfiguration(this.config, ngxEditorConfig);
this.config = this.Utils.getEditorConfiguration(this.config, ngxEditorConfig);

this.height = this.height || this.textArea.nativeElement.offsetHeight;

Expand Down
2 changes: 1 addition & 1 deletion src/app/ngx-editor/ngx-editor.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { CommandExecutorService } from './common/services/command-executor.servi
CommonModule
],
declarations: [NgxEditorComponent, NgxGrippieComponent, NgxEditorMessageComponent, NgxEditorToolbarComponent],
exports: [NgxEditorComponent, NgxGrippieComponent, NgxEditorToolbarComponent],
exports: [NgxEditorComponent],
providers: [CommandExecutorService, MessageService]
})

Expand Down

0 comments on commit 443c994

Please sign in to comment.