-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7308 from ckeditor/i/6007
Feature (markdown-gfm): Introduced the `Markdown` plugin. Closes #6007.
- Loading branch information
Showing
6 changed files
with
117 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @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( editor.data.viewDocument ); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
static get pluginName() { | ||
return 'Markdown'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters