Skip to content
Snippets Groups Projects
Select Git revision
  • 9818954fd1944cb5bc6d01bc1e390211e27890fa
  • main default protected
  • dev
  • v0.0.3
  • v0.0.2
  • v0.0.1
6 results

ckeditor.js

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ckeditor.js 4.13 KiB
    /*
     * Copyright (C) 2022 InidiScale GmbH <info@indiscale.com>
     * Copyright (C) 2022 Florian Spreckelsen <f.spreckelsen@indiscale.com>
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     * SOFTWARE.
     */
    
    import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
    import CKEditorInspector from '@ckeditor/ckeditor5-inspector';
    
    import Autoformat from '@ckeditor/ckeditor5-autoformat/src/autoformat';
    import AutoImage from '@ckeditor/ckeditor5-image/src/autoimage.js';
    import BlockQuote from '@ckeditor/ckeditor5-block-quote/src/blockquote';
    import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
    import Code from '@ckeditor/ckeditor5-basic-styles/src/code';
    import CodeBlock from '@ckeditor/ckeditor5-code-block/src/codeblock';
    import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
    import Heading from '@ckeditor/ckeditor5-heading/src/heading';
    import HorizontalLine from '@ckeditor/ckeditor5-horizontal-line/src/horizontalline.js';
    import Image from '@ckeditor/ckeditor5-image/src/image';
    import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption';
    import ImageStyle from '@ckeditor/ckeditor5-image/src/imagestyle';
    import ImageToolbar from '@ckeditor/ckeditor5-image/src/imagetoolbar';
    import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
    import Link from '@ckeditor/ckeditor5-link/src/link';
    import List from '@ckeditor/ckeditor5-list/src/list';
    import Markdown from '@ckeditor/ckeditor5-markdown-gfm/src/markdown.js';
    import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
    import SourceEditing from '@ckeditor/ckeditor5-source-editing/src/sourceediting.js';
    import Strikethrough from '@ckeditor/ckeditor5-basic-styles/src/strikethrough.js';
    import Table from '@ckeditor/ckeditor5-table/src/table';
    import TableToolbar from '@ckeditor/ckeditor5-table/src/tabletoolbar';
    import TodoList from '@ckeditor/ckeditor5-list/src/todolist';
    
    import { ComplexitywikiPlugins } from '../src/index';
    
    /* global document, window */
    
    ClassicEditor
    	.create( document.querySelector( '#editor' ), {
    		plugins: [
    			ComplexitywikiPlugins,
    			Autoformat,
    			AutoImage,
    			BlockQuote,
    			Bold,
    			Code,
    			CodeBlock,
    			Essentials,
    			Heading,
    			HorizontalLine,
    			Image,
    			ImageCaption,
    			ImageStyle,
    			ImageToolbar,
    			Italic,
    			Link,
    			List,
    			Markdown,
    			Paragraph,
    			SourceEditing,
    			Strikethrough,
    			Table,
    			TableToolbar,
    			TodoList
    		],
    		toolbar: [
    			'sourceEditing',
    			'|',
    			'undo',
    			'redo',
    			'heading',
    			'|',
    			'bold',
    			'italic',
    			'strikethrough',
    			'|',
    			'horizontalLine',
    			'link',
    			'blockQuote',
    			'insertTable',
    			'|',
    			'bulletedList',
    			'numberedList',
    			'todoList',
    			'|',
    			'code',
    			'codeBlock',
    			'|',
    			'inlineMathButton',
    			'displayMathButton'
    		],
    		image: {
    			toolbar: [ 'imageStyle:inline', 'imageStyle:block', 'imageStyle:side', '|', 'imageTextAlternative' ]
    		},
    		table: {
    			contentToolbar: [
    				'tableColumn',
    				'tableRow',
    				'mergeTableCells'
    			]
    		}
    	} )
    	.then( editor => {
    		window.editor = editor;
    		CKEditorInspector.attach( editor );
    		window.console.log( 'CKEditor 5 is ready.', editor );
    	} )
    	.catch( err => {
    		window.console.error( err.stack );
    	} );