2025-08-03 19:46:57 +02:00
import { ClassicEditor } from 'ckeditor5'
import { Alignment } from 'ckeditor5' ;
import { Autoformat } from 'ckeditor5' ;
import { Base64UploadAdapter } from 'ckeditor5' ;
import { BlockQuote } from 'ckeditor5' ;
import { Bold } from 'ckeditor5' ;
import { Code } from 'ckeditor5' ;
import { CodeBlock } from 'ckeditor5' ;
import { Essentials } from 'ckeditor5' ;
import { FindAndReplace } from 'ckeditor5' ;
import { FontBackgroundColor } from 'ckeditor5' ;
import { FontColor } from 'ckeditor5' ;
import { FontFamily } from 'ckeditor5' ;
import { FontSize } from 'ckeditor5' ;
import { GeneralHtmlSupport } from 'ckeditor5' ;
import { Heading } from 'ckeditor5' ;
import { Highlight } from 'ckeditor5' ;
import { HorizontalLine } from 'ckeditor5' ;
import { HtmlComment } from 'ckeditor5' ;
import { HtmlEmbed } from 'ckeditor5' ;
import { Image } from 'ckeditor5' ;
import { ImageResize } from 'ckeditor5' ;
import { ImageStyle } from 'ckeditor5' ;
import { ImageToolbar } from 'ckeditor5' ;
import { ImageUpload } from 'ckeditor5' ;
import { Indent } from 'ckeditor5' ;
import { IndentBlock } from 'ckeditor5' ;
import { Italic } from 'ckeditor5' ;
import { Link } from 'ckeditor5' ;
import { LinkImage } from 'ckeditor5' ;
import { List } from 'ckeditor5' ;
import { ListProperties } from 'ckeditor5' ;
import { Markdown } from 'ckeditor5' ;
import { MediaEmbed } from 'ckeditor5' ;
import { MediaEmbedToolbar } from 'ckeditor5' ;
import { Paragraph } from 'ckeditor5' ;
import { PasteFromOffice } from 'ckeditor5' ;
import { RemoveFormat } from 'ckeditor5' ;
import { SourceEditing } from 'ckeditor5' ;
import { SpecialCharacters } from 'ckeditor5' ;
import { SpecialCharactersArrows } from 'ckeditor5' ;
import { SpecialCharactersCurrency } from 'ckeditor5' ;
import { SpecialCharactersEssentials } from 'ckeditor5' ;
import { SpecialCharactersLatin } from 'ckeditor5' ;
import { SpecialCharactersMathematical } from 'ckeditor5' ;
import { SpecialCharactersText } from 'ckeditor5' ;
import { Strikethrough } from 'ckeditor5' ;
import { Subscript } from 'ckeditor5' ;
import { Superscript } from 'ckeditor5' ;
import { Table } from 'ckeditor5' ;
import { TableCaption } from 'ckeditor5' ;
import { TableCellProperties } from 'ckeditor5' ;
import { TableColumnResize } from 'ckeditor5' ;
import { TableProperties } from 'ckeditor5' ;
import { TableToolbar } from 'ckeditor5' ;
import { Underline } from 'ckeditor5' ;
import { WordCount } from 'ckeditor5' ;
import { EditorWatchdog } from 'ckeditor5' ;
2022-07-29 01:03:17 +02:00
import PartDBLabel from "./plugins/PartDBLabel/PartDBLabel" ;
2025-08-03 20:24:56 +02:00
import SpecialCharactersGreek from "./plugins/special_characters_emoji" ;
2022-07-26 01:20:58 +02:00
class Editor extends ClassicEditor { }
// Plugins to include in the build.
Editor . builtinPlugins = [
Alignment ,
Autoformat ,
Base64UploadAdapter ,
BlockQuote ,
Bold ,
Code ,
CodeBlock ,
Essentials ,
FindAndReplace ,
FontBackgroundColor ,
FontColor ,
FontFamily ,
FontSize ,
GeneralHtmlSupport ,
Heading ,
Highlight ,
HorizontalLine ,
HtmlComment ,
HtmlEmbed ,
Image ,
ImageResize ,
ImageStyle ,
ImageToolbar ,
ImageUpload ,
Indent ,
IndentBlock ,
Italic ,
Link ,
LinkImage ,
List ,
ListProperties ,
MediaEmbed ,
MediaEmbedToolbar ,
Paragraph ,
PasteFromOffice ,
RemoveFormat ,
SourceEditing ,
SpecialCharacters ,
SpecialCharactersArrows ,
SpecialCharactersCurrency ,
SpecialCharactersEssentials ,
SpecialCharactersLatin ,
SpecialCharactersMathematical ,
SpecialCharactersText ,
Strikethrough ,
Subscript ,
Superscript ,
Table ,
TableCaption ,
TableCellProperties ,
TableColumnResize ,
TableProperties ,
TableToolbar ,
Underline ,
2022-07-29 01:03:17 +02:00
WordCount ,
2025-08-03 20:24:56 +02:00
PartDBLabel ,
SpecialCharactersGreek
2022-07-26 01:20:58 +02:00
] ;
// Editor configuration.
Editor . defaultConfig = {
toolbar : {
items : [
'heading' ,
'alignment' ,
'|' ,
'bold' ,
'italic' ,
'underline' ,
'strikethrough' ,
'subscript' ,
'superscript' ,
'removeFormat' ,
'highlight' ,
'|' ,
'fontBackgroundColor' ,
'fontColor' ,
'fontSize' ,
'|' ,
'fontFamily' ,
'link' ,
'bulletedList' ,
'numberedList' ,
'outdent' ,
'indent' ,
'|' ,
'specialCharacters' ,
'horizontalLine' ,
'|' ,
'imageUpload' ,
'blockQuote' ,
'insertTable' ,
'mediaEmbed' ,
'code' ,
'codeBlock' ,
'htmlEmbed' ,
'|' ,
'undo' ,
'redo' ,
'findAndReplace' ,
'sourceEditing' ,
2022-07-29 21:07:54 +02:00
'|' ,
'partdb_label' ,
] ,
shouldNotGroupWhenFull : true
2022-07-26 01:20:58 +02:00
} ,
language : 'en' ,
2022-07-29 21:22:10 +02:00
fontFamily : {
options : [
'default' ,
'DejaVu Sans Mono, monospace' ,
'DejaVu Sans, sans-serif' ,
'DejaVu Serif, serif' ,
'Helvetica, Arial, sans-serif' ,
'Times New Roman, Times, serif' ,
2023-07-02 03:26:56 +02:00
'Courier New, Courier, monospace' ,
'Unifont, monospace' ,
2022-07-29 21:22:10 +02:00
] ,
supportAllValues : true
} ,
'fontSize' : {
options : [
2022-09-21 16:16:59 +02:00
'default' ,
2022-09-21 21:49:09 +02:00
6 ,
7 ,
2022-07-29 21:22:10 +02:00
8 ,
2022-09-21 16:16:59 +02:00
9 ,
10 ,
2022-07-29 21:22:10 +02:00
11 ,
2022-09-21 16:16:59 +02:00
12 ,
2022-07-29 21:22:10 +02:00
13 ,
2022-09-21 16:16:59 +02:00
14 ,
15 ,
16 ,
2022-07-29 21:22:10 +02:00
17 ,
2022-09-21 16:16:59 +02:00
18 ,
2022-07-29 21:22:10 +02:00
19 ,
2022-09-21 16:16:59 +02:00
20 ,
2022-07-29 21:22:10 +02:00
21 ,
] ,
supportAllValues : true
} ,
2022-09-25 00:47:53 +02:00
// Allow all HTML features for our labels
htmlSupport : {
allow : [
{
name : /.*/ ,
attributes : true ,
classes : true ,
styles : true
}
] ,
disallow : [
//Some rudimentary protection against XSS, even if it is not really needed as this is only parsed by DOMHTML which does not support any kind of script execution.
{
name : /^(head|body|html|script)$/i ,
} ,
{
name : /.*/ ,
attributes : /^on.*/i
}
]
} ,
2022-07-26 01:20:58 +02:00
image : {
toolbar : [
'imageTextAlternative' ,
'imageStyle:inline' ,
'imageStyle:block' ,
'imageStyle:side' ,
'linkImage'
]
} ,
table : {
contentToolbar : [
'tableColumn' ,
'tableRow' ,
'mergeTableCells' ,
'tableCellProperties' ,
'tableProperties'
]
2022-09-21 21:49:09 +02:00
} ,
2022-07-26 01:20:58 +02:00
} ;
export default { Editor , EditorWatchdog } ;