Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cipchk/ngx-tinymce
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Sep 29, 2022
2 parents 90be201 + a19bd9e commit c6fc54f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/src/tinymce.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class TinymceComponent implements AfterViewInit, OnChanges, OnDestroy, Co
if (defConfig.baseURL) {
let url = '' + defConfig.baseURL;
if (url.endsWith('/')) {
url = url.substr(0, url.length - 1);
url = url.substring(0, url.length - 1);
}
win.tinymce.baseURL = url;
}
Expand Down Expand Up @@ -187,7 +187,15 @@ export class TinymceComponent implements AfterViewInit, OnChanges, OnDestroy, Co
if (!this._instance) {
return;
}
this.ngZone.runOutsideAngular(() => this._instance.setMode(this._disabled ? 'readonly' : 'design'));
this.ngZone.runOutsideAngular(() => {
const mode = this._disabled ? 'readonly' : 'design';
// Compatible with 5
if (typeof this._instance.setMode === 'function') {
this._instance.setMode(mode);
} else {
this._instance.mode.set(mode);
}
});
}

ngAfterViewInit(): void {
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import { StandaloneDemoComponent } from './standalone.component';
{ useHash: true },
),
NgxTinymceModule.forRoot({
baseURL: '//cdnjs.cloudflare.com/ajax/libs/tinymce/5.7.1/',
// baseURL: '//cdnjs.cloudflare.com/ajax/libs/tinymce/5.7.1/',
baseURL: '//cdn.tiny.cloud/1/no-api-key/tinymce/6/',
}),
],
bootstrap: [AppComponent],
Expand Down

0 comments on commit c6fc54f

Please sign in to comment.