/
ck-editor.ts
81 lines (79 loc) · 2.69 KB
/
ck-editor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { Constants } from '@dasch-swiss/dsp-js';
export class ckEditor {
static config = {
entities: false,
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'underline',
'strikethrough',
'subscript',
'superscript',
'|',
'removeFormat',
'|',
'undo',
'redo',
'-',
'link',
'|',
'bulletedList',
'numberedList',
'horizontalLine',
'|',
'blockQuote',
'code',
'codeBlock',
'insertTable',
'specialCharacters',
'|',
'sourceEditing',
],
shouldNotGroupWhenFull: true
},
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h1', title: 'Heading 1' },
{ model: 'heading2', view: 'h2', title: 'Heading 2' },
{ model: 'heading3', view: 'h3', title: 'Heading 3' },
{ model: 'heading4', view: 'h4', title: 'Heading 4' },
{ model: 'heading5', view: 'h5', title: 'Heading 5' },
{ model: 'heading6', view: 'h6', title: 'Heading 6' },
{ model: 'formatted', view: 'pre', title: 'Formatted' },
{ model: 'cite', view: 'cite', title: 'Cited' }
]
},
codeBlock: {
languages: [
{ language: 'plaintext', label: 'Plain text', class: '' }
]
},
language: 'en',
link: {
addTargetToExternalLinks: false,
decorators: {
isInternal: {
// label: 'internal link to a Knora resource',
mode: 'automatic', // automatic requires callback -> but the callback is async and the user could save the text before the check ...
callback: url => // console.log(url, url.startsWith( 'http://rdfh.ch/' ));
!!url && url.startsWith('http://rdfh.ch/') // --> TODO: get this from config via AppInitService
,
attributes: {
class: Constants.SalsahLink
}
}
}
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
}
};
}