| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- /**
- * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
- /* globals console, window, document, setTimeout */
- import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
- import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
- import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage';
- import CodeBlock from '@ckeditor/ckeditor5-code-block/src/codeblock';
- import Code from '@ckeditor/ckeditor5-basic-styles/src/code';
- import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
- import Markdown from '@ckeditor/ckeditor5-markdown-gfm/src/markdown';
- ClassicEditor
- .create( document.querySelector( '#snippet-markdown' ), {
- plugins: [ ArticlePluginSet, EasyImage, Markdown, Code, CodeBlock ],
- toolbar: [
- 'heading',
- '|',
- 'bold',
- 'italic',
- 'link',
- 'bulletedList',
- 'numberedList',
- '|',
- 'code',
- 'codeBlock',
- '|',
- 'outdent',
- 'indent',
- '|',
- 'imageUpload',
- 'blockQuote',
- '|',
- 'undo',
- 'redo'
- ],
- image: {
- toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ]
- },
- codeBlock: {
- languages: [
- { language: 'css', label: 'CSS' },
- { language: 'html', label: 'HTML' }
- ]
- },
- cloudServices: CS_CONFIG
- } )
- .then( editor => {
- window.editor = editor;
- const outputElement = document.querySelector( '#snippet-markdown-output' );
- editor.model.document.on( 'change', () => {
- outputElement.innerText = editor.getData();
- } );
- // Set the initial data with delay so hightlight.js doesn't catch them.
- setTimeout( () => {
- outputElement.innerText = editor.getData();
- }, 500 );
- } )
- .catch( err => {
- console.error( err.stack );
- } );
|