mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
Revert "feat(rtl): add language switcher toolbar"
This reverts commit e930ae5f407b28de9edd65f038237d061f8d8c16.
This commit is contained in:
parent
8d60429b9c
commit
c99c4a4302
4
libraries/ckeditor/ckeditor.js
vendored
4
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
2
libraries/ckeditor/ckeditor.js.map
vendored
2
libraries/ckeditor/ckeditor.js.map
vendored
File diff suppressed because one or more lines are too long
@ -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: [
|
||||
|
Loading…
x
Reference in New Issue
Block a user