How to use @ckeditor/ckeditor5-editor-classic - 10 common examples

To help you get started, we’ve selected a few @ckeditor/ckeditor5-editor-classic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor5-media-embed / tests / manual / semanticmediaembed.js View on Github external
/**
 * @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 */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
import MediaEmbed from '../../src/mediaembed';

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		plugins: [ ArticlePluginSet, MediaEmbed ],
		toolbar: [
			'heading', '|', 'mediaEmbed', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'link', 'undo', 'redo'
		]
	} )
	.then( editor => {
		window.editor = editor;
	} )
	.catch( err => {
		console.error( err.stack );
	} );
github ckeditor / ckeditor5-engine / tests / manual / tickets / 629 / 1.js View on Github external
/**
 * @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 */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Enter from '@ckeditor/ckeditor5-enter/src/enter';
import Typing from '@ckeditor/ckeditor5-typing/src/typing';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		plugins: [ Enter, Typing, Paragraph, Bold ],
		toolbar: [ 'bold' ]
	} )
	.then( editor => {
		window.editor = editor;
	} )
	.catch( err => {
		console.error( err.stack );
	} );
github ckeditor / ckeditor5-alignment / tests / manual / alignment.js View on Github external
/**
 * @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 */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
import Alignment from '../../src/alignment';

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		plugins: [ ArticlePluginSet, Alignment ],
		toolbar: [
			'heading', '|', 'alignment', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo'
		]
	} )
	.then( editor => {
		window.editor = editor;
	} )
	.catch( err => {
		console.error( err.stack );
	} );
github ckeditor / ckeditor5-image / tests / manual / tickets / 106 / 1.js View on Github external
/* globals console:false, document, setTimeout */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';

const config = {
	plugins: [ ArticlePluginSet ],
	toolbar: [ 'undo', 'redo', 'link' ],
	image: {
		toolbar: [ 'imageTextAlternative' ]
	}
};

// Editor for the external insert.
ClassicEditor.create( document.querySelector( '#editor-insert' ), config )
	.then( editor => {
		const element = document.querySelector( '#button-insert' );

		element.addEventListener( 'click', () => {
			element.disabled = true;
			startExternalInsert( editor );
		} );
	} )
	.catch( err => console.error( err.stack ) );

// Editor for the external delete.
ClassicEditor.create( document.querySelector( '#editor-delete' ), config )
	.then( editor => {
		const element = document.querySelector( '#button-delete' );

		element.addEventListener( 'click', () => {
github ckeditor / ckeditor5-engine / tests / manual / tickets / 880 / 1.js View on Github external
/**
 * @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 */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		plugins: [ Essentials, Paragraph, Bold ],
		toolbar: [ 'undo', 'redo' ]
	} )
	.then( editor => {
		window.editor = editor;

		editor.editing.view.document.on( 'selectionChange', () => {
			editor.model.change( () => {
			} );
			console.log( 'selectionChange', ( new Date() ).getTime() );
		} );
	} )
	.catch( err => {
		console.error( err.stack );
	} );
github ckeditor / ckeditor5-markdown-gfm / tests / manual / commonmark.js View on Github external
/**
 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md.
 */

/* globals console, window, document */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import CommonMark from '../../src/commonmark';

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		plugins: [ CommonMark ],
		toolbar: [ 'headings', 'undo', 'redo', 'bold', 'italic', 'link' ],
		image: {
			toolbar: [ 'imageTextAlternative' ]
		},
		heading: {
			options: [
				{ modelElement: 'paragraph', title: 'Paragraph' },
				{ modelElement: 'heading1', viewElement: 'h1', title: 'Heading 1' },
				{ modelElement: 'heading2', viewElement: 'h2', title: 'Heading 2' },
				{ modelElement: 'heading3', viewElement: 'h3', title: 'Heading 3' },
				{ modelElement: 'heading4', viewElement: 'h4', title: 'Heading 4' },
				{ modelElement: 'heading5', viewElement: 'h5', title: 'Heading 5' },
				{ modelElement: 'heading6', viewElement: 'h6', title: 'Heading 6' },
			]
github wwalc / ckeditor5-emoji / tests / manual / emoji.js View on Github external
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md.
 */

/* global document, console, window */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Heading from '@ckeditor/ckeditor5-heading/src/heading';
import Emoji from '../../src/emoji';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
import List from '@ckeditor/ckeditor5-list/src/list';

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		plugins: [
			Essentials,
			Paragraph, Heading, Emoji, Bold, Italic, List
		],
		emoji: [
			{ name: 'smile', text: '😀' },
			{ name: 'wink', text: '😉' },
			{ name: 'cool', text: '😎' },
			{ name: 'surprise', text: '😮' },
			{ name: 'confusion', text: '😕' }
		],
		toolbar: [ 'heading', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'emoji' ]
	} )
	.then( editor => {
		window.editor = editor;
github ckeditor / ckeditor5-engine / tests / manual / two-step-caret.js View on Github external
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */

/* global console, document */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';

import bindTwoStepCaretToAttribute from '../../src/utils/bindtwostepcarettoattribute';

ClassicEditor
	.create( document.querySelector( '#editor-ltr' ), {
		plugins: [ Essentials, Paragraph, Underline, Bold, Italic ],
		toolbar: [ 'undo', 'redo', '|', 'bold', 'underline', 'italic' ]
	} )
	.then( editor => {
		const bold = editor.plugins.get( Italic );
		const underline = editor.plugins.get( Underline );

		bindTwoStepCaretToAttribute( {
			view: editor.editing.view,
			model: editor.model,
			emitter: bold,
			attribute: 'italic',
			locale: editor.locale
		} );
		bindTwoStepCaretToAttribute( {
github ckeditor / ckeditor5-image / tests / imageupload / imageuploadui.js View on Github external
beforeEach( () => {
		editorElement = document.createElement( 'div' );
		document.body.appendChild( editorElement );

		return ClassicEditor
			.create( editorElement, {
				plugins: [ Paragraph, Image, ImageUploadEditing, ImageUploadUI, FileRepository, UploadAdapterPluginMock, Clipboard ]
			} )
			.then( newEditor => {
				editor = newEditor;
				model = editor.model;

				// Hide all notifications (prevent alert() calls).
				const notification = editor.plugins.get( Notification );
				notification.on( 'show', evt => evt.stop() );
			} );
	} );
github ckeditor / ckeditor5-image / tests / imagetoolbar.js View on Github external
it( 'should not initialize if there is no configuration', () => {
		const editorElement = global.document.createElement( 'div' );
		global.document.body.appendChild( editorElement );

		return ClassicEditor.create( editorElement, {
			plugins: [ ImageToolbar ],
		} )
			.then( editor => {
				expect( editor.plugins.get( ImageToolbar )._toolbar ).to.be.undefined;

				editorElement.remove();
				return editor.destroy();
			} );
	} );

@ckeditor/ckeditor5-editor-classic

Classic editor implementation for CKEditor 5.

GPL-2.0-or-later
Latest version published 16 days ago

Package Health Score

91 / 100
Full package analysis