Skip to content

Commit

Permalink
Simplify CDN demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed Sep 4, 2024
1 parent 1d3ef1a commit d6935de
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 120 deletions.
1 change: 1 addition & 0 deletions src/app/simple-cdn-usage/simple-cdn-usage.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ <h3>Classic build</h3>
[data]="editorData"
[editor]="Editor"
[disabled]="isDisabled"
[config]="config"
id="classic-editor"
name="classic-editor"

Expand Down
113 changes: 105 additions & 8 deletions src/app/simple-cdn-usage/simple-cdn-usage.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Component, type OnInit } from '@angular/core';
import type { ClassicEditor } from 'https://cdn.ckeditor.com/typings/ckeditor5.d.ts';
import type { ClassicEditor, EditorConfig } from 'https://cdn.ckeditor.com/typings/ckeditor5.d.ts';

import { createCdnEditor } from 'src/editor/create-cdn-editor';
import { loadCKEditorCloud } from '@ckeditor/ckeditor5-integrations-common';
import { loadCKEditorCloud, type CKEditorCloudResult } from '@ckeditor/ckeditor5-integrations-common';

@Component( {
selector: 'app-simple-cdn-usage',
Expand All @@ -12,6 +11,8 @@ import { loadCKEditorCloud } from '@ckeditor/ckeditor5-integrations-common';
export class SimpleCdnUsageComponent implements OnInit {
public Editor: typeof ClassicEditor | null = null;

public config: EditorConfig | null = null;

public isDisabled = false;
public editorData =
`<p>Getting used to an entirely different culture can be challenging.
Expand All @@ -28,11 +29,107 @@ You learn to appreciate each and every single one of the differences while you b
loadCKEditorCloud( {
version: '43.0.0'
} )
.then( cloud => {
this.Editor = createCdnEditor( {
cloud
} );
} );
.then( this._setupEditor.bind( this ) );
}

private _setupEditor( cloud: CKEditorCloudResult ) {
const {
ClassicEditor,
Essentials,
CKFinderUploadAdapter,
Autoformat,
Bold,
Italic,
BlockQuote,
CKBox,
CKFinder,
CloudServices,
EasyImage,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Indent,
Link,
List,
MediaEmbed,
Paragraph,
PasteFromOffice,
PictureEditing,
Table,
TableToolbar,
TextTransformation
} = cloud.CKEditor;

this.Editor = ClassicEditor;
this.config = {
plugins: [
Essentials,
CKFinderUploadAdapter,
Autoformat,
Bold,
Italic,
BlockQuote,
CKBox,
CKFinder,
CloudServices,
EasyImage,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Indent,
Link,
List,
MediaEmbed,
Paragraph,
PasteFromOffice,
PictureEditing,
Table,
TableToolbar,
TextTransformation
],
toolbar: {
items: [
'undo',
'redo',
'|',
'heading',
'|',
'bold',
'italic',
'|',
'link',
'uploadImage',
'insertTable',
'blockQuote',
'mediaEmbed',
'|',
'bulletedList',
'numberedList',
'outdent',
'indent'
]
},
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'toggleImageCaption',
'imageTextAlternative'
]
},
table: {
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
},
language: 'en'
};
}

public onReady(): void {
Expand Down
112 changes: 0 additions & 112 deletions src/editor/create-cdn-editor.ts

This file was deleted.

0 comments on commit d6935de

Please sign in to comment.