@ -110,102 +110,85 @@ export function buildConfig() {
}
export function buildToolbarConfig ( isClassicToolbar : boolean ) {
const languages = JSON . parse ( options . get ( "languages" ) ? ? "[]" ) as string [ ] ;
const enableLanguageSwitcher = languages . length > 1 ;
if ( isClassicToolbar ) {
const multilineToolbar = utils . isDesktop ( ) && options . get ( "textNoteEditorMultilineToolbar" ) === "true"
return buildClassicToolbar ( multilineToolbar , enableLanguageSwitcher );
return buildClassicToolbar ( multilineToolbar ) ;
} else {
return buildFloatingToolbar ( enableLanguageSwitcher ) ;
return buildFloatingToolbar ( ) ;
}
}
function buildClassicToolbar ( multilineToolbar : boolean , enableLanguageSwitcher : boolean ) {
const items = [
'heading' , 'fontSize' ,
'|' ,
'bold' , 'italic' ,
{
label : "Text formatting" ,
icon : "text" ,
items : [
'underline' ,
'strikethrough' ,
'superscript' ,
'subscript' ,
'code' ,
] ,
} ,
'|' ,
'fontColor' , 'fontBackgroundColor' , 'removeFormat' ,
'|' ,
'bulletedList' , 'numberedList' , 'todoList' ,
'|' ,
'blockQuote' , 'insertTable' , 'codeBlock' , 'footnote' ,
{
label : "Insert" ,
icon : "plus" ,
items : [
'imageUpload' ,
'|' ,
'link' ,
'internallink' ,
'includeNote' ,
'|' ,
'specialCharacters' ,
'math' ,
'mermaid' ,
'horizontalLine' ,
'pageBreak'
]
} ,
'|' ,
'outdent' , 'indent' ,
'|' ,
'markdownImport' , 'cuttonote' , 'findAndReplace' ,
] ;
if ( enableLanguageSwitcher ) {
items . push ( '|' ) ;
items . push ( 'textPartLanguage' ) ;
}
function buildClassicToolbar ( multilineToolbar : boolean ) {
// For nested toolbars, refer to https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/toolbar.html#grouping-toolbar-items-in-dropdowns-nested-toolbars.
return {
toolbar : {
items ,
items : [
'heading' , 'fontSize' ,
'|' ,
'bold' , 'italic' ,
{
label : "Text formatting" ,
icon : "text" ,
items : [
'underline' ,
'strikethrough' ,
'superscript' ,
'subscript' ,
'code' ,
] ,
} ,
'|' ,
'fontColor' , 'fontBackgroundColor' , 'removeFormat' ,
'|' ,
'bulletedList' , 'numberedList' , 'todoList' ,
'|' ,
'blockQuote' , 'insertTable' , 'codeBlock' , 'footnote' ,
{
label : "Insert" ,
icon : "plus" ,
items : [
'imageUpload' ,
'|' ,
'link' ,
'internallink' ,
'includeNote' ,
'|' ,
'specialCharacters' ,
'math' ,
'mermaid' ,
'horizontalLine' ,
'pageBreak'
]
} ,
'|' ,
'outdent' , 'indent' ,
'|' ,
'markdownImport' , 'cuttonote' , 'findAndReplace'
] ,
shouldNotGroupWhenFull : multilineToolbar
}
}
}
function buildFloatingToolbar ( enableLanguageSwitcher : boolean ) {
const items = [
'fontSize' ,
'bold' ,
'italic' ,
'underline' ,
'strikethrough' ,
'superscript' ,
'subscript' ,
'fontColor' ,
'fontBackgroundColor' ,
'code' ,
'link' ,
'removeFormat' ,
'internallink' ,
'cuttonote'
] ;
if ( enableLanguageSwitcher ) {
items . push ( '|' ) ;
items . push ( 'textPartLanguage' ) ;
}
function buildFloatingToolbar() {
return {
toolbar : {
items
items : [
'fontSize' ,
'bold' ,
'italic' ,
'underline' ,
'strikethrough' ,
'superscript' ,
'subscript' ,
'fontColor' ,
'fontBackgroundColor' ,
'code' ,
'link' ,
'removeFormat' ,
'internallink' ,
'cuttonote'
]
} ,
blockToolbar : [