diff --git a/packages/ckeditor5-markdown-gfm/package.json b/packages/ckeditor5-markdown-gfm/package.json index a92258c9ab5..118ebcbf4cd 100644 --- a/packages/ckeditor5-markdown-gfm/package.json +++ b/packages/ckeditor5-markdown-gfm/package.json @@ -10,6 +10,7 @@ "ckeditor5-plugin" ], "dependencies": { + "@ckeditor/ckeditor5-core": "^21.0.0", "@ckeditor/ckeditor5-engine": "^21.0.0" }, "engines": { diff --git a/packages/ckeditor5-markdown-gfm/src/markdown.js b/packages/ckeditor5-markdown-gfm/src/markdown.js new file mode 100644 index 00000000000..4954283812f --- /dev/null +++ b/packages/ckeditor5-markdown-gfm/src/markdown.js @@ -0,0 +1,35 @@ +/** + * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +/** + * @module markdown-gfm/markdown + */ + +import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; +import GFMDataProcessor from './gfmdataprocessor'; + +/** + * The GitHub Flavored Markdown (GFM) plugin. + * + * For a detailed overview, check the {@glink features/markdown Markdown feature documentation}. + * + * @extends module:core/plugin~Plugin + */ +export default class Markdown extends Plugin { + /** + * @inheritDoc + */ + constructor( editor ) { + super( editor ); + editor.data.processor = new GFMDataProcessor(); + } + + /** + * @inheritDoc + */ + static get pluginName() { + return 'Markdown'; + } +} diff --git a/packages/ckeditor5-markdown-gfm/tests/markdown.js b/packages/ckeditor5-markdown-gfm/tests/markdown.js new file mode 100644 index 00000000000..712068a69f1 --- /dev/null +++ b/packages/ckeditor5-markdown-gfm/tests/markdown.js @@ -0,0 +1,26 @@ +/** + * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +import Markdown from '../src/markdown'; +import GFMDataProcessor from '../src/gfmdataprocessor'; +import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; + +describe( 'Markdown', () => { + it( 'has proper name', () => { + expect( Markdown.pluginName ).to.equal( 'Markdown' ); + } ); + + it( 'should set editor.data.processor', () => { + return ClassicTestEditor + .create( '', { + plugins: [ Markdown ] + } ) + .then( editor => { + expect( editor.data.processor ).to.be.an.instanceof( GFMDataProcessor ); + + editor.destroy(); // Tests cleanup. + } ); + } ); +} );