2022-07-26 01:20:58 +02:00
|
|
|
import { Plugin } from 'ckeditor5/src/core';
|
|
|
|
import GFMDataProcessor from '@ckeditor/ckeditor5-markdown-gfm/src/gfmdataprocessor';
|
|
|
|
|
|
|
|
const ALLOWED_TAGS = [
|
|
|
|
//Common elements
|
|
|
|
'sup',
|
|
|
|
'sub',
|
|
|
|
'u',
|
|
|
|
'kbd',
|
|
|
|
'mark',
|
|
|
|
'ins',
|
|
|
|
'small',
|
|
|
|
'abbr',
|
2022-07-26 21:23:31 +02:00
|
|
|
'br',
|
|
|
|
'span',
|
2022-07-26 01:20:58 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The GitHub Flavored Markdown (GFM) plugin with added HTML tags, which are kept in the output. (inline mode)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
export default class ExtendedMarkdownInline extends Plugin {
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
constructor( editor ) {
|
|
|
|
super( editor );
|
|
|
|
|
|
|
|
editor.data.processor = new GFMDataProcessor( editor.data.viewDocument );
|
|
|
|
for (const tag of ALLOWED_TAGS) {
|
|
|
|
editor.data.processor.keepHtml(tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
static get pluginName() {
|
|
|
|
return 'Markdown';
|
|
|
|
}
|
|
|
|
}
|