Total Complexity | 3 |
Complexity/F | 1.5 |
Lines of Code | 42 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* |
||
20 | import { Plugin } from 'ckeditor5/src/core'; |
||
21 | import GFMDataProcessor from '@ckeditor/ckeditor5-markdown-gfm/src/gfmdataprocessor'; |
||
22 | |||
23 | const ALLOWED_TAGS = [ |
||
24 | //Common elements |
||
25 | 'sup', |
||
26 | 'sub', |
||
27 | 'u', |
||
28 | 'kbd', |
||
29 | 'mark', |
||
30 | 'ins', |
||
31 | 'small', |
||
32 | 'abbr', |
||
33 | 'br', |
||
34 | 'span', |
||
35 | ]; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * The GitHub Flavored Markdown (GFM) plugin with added HTML tags, which are kept in the output. (inline mode) |
||
40 | * |
||
41 | */ |
||
42 | export default class ExtendedMarkdownInline extends Plugin { |
||
43 | /** |
||
44 | * @inheritDoc |
||
45 | */ |
||
46 | constructor( editor ) { |
||
47 | super( editor ); |
||
48 | |||
49 | editor.data.processor = new GFMDataProcessor( editor.data.viewDocument ); |
||
50 | for (const tag of ALLOWED_TAGS) { |
||
51 | editor.data.processor.keepHtml(tag); |
||
52 | } |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @inheritDoc |
||
57 | */ |
||
58 | static get pluginName() { |
||
59 | return 'Markdown'; |
||
60 | } |
||
61 | } |
||
62 |