|
@@ -11,6 +11,7 @@ import { useTranslation } from 'react-i18next'
|
|
|
import { MathDropdown } from './math-dropdown'
|
|
import { MathDropdown } from './math-dropdown'
|
|
|
import { TableInserterDropdown } from './table-inserter-dropdown'
|
|
import { TableInserterDropdown } from './table-inserter-dropdown'
|
|
|
import { withinFormattingCommand } from '@/features/source-editor/utils/tree-operations/formatting'
|
|
import { withinFormattingCommand } from '@/features/source-editor/utils/tree-operations/formatting'
|
|
|
|
|
+import { bsVersion } from '@/features/utils/bootstrap-5'
|
|
|
|
|
|
|
|
const isMac = /Mac/.test(window.navigator?.platform)
|
|
const isMac = /Mac/.test(window.navigator?.platform)
|
|
|
|
|
|
|
@@ -37,19 +38,22 @@ export const ToolbarItems: FC<{
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
{showGroup('group-history') && (
|
|
{showGroup('group-history') && (
|
|
|
- <div className="ol-cm-toolbar-button-group">
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ className="ol-cm-toolbar-button-group"
|
|
|
|
|
+ aria-label={t('toolbar_undo_redo_actions')}
|
|
|
|
|
+ >
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-undo"
|
|
id="toolbar-undo"
|
|
|
label={t('toolbar_undo')}
|
|
label={t('toolbar_undo')}
|
|
|
command={undo}
|
|
command={undo}
|
|
|
- icon="undo"
|
|
|
|
|
|
|
+ icon={bsVersion({ bs5: 'undo', bs3: 'undo' }) as string}
|
|
|
shortcut={isMac ? '⌘Z' : 'Ctrl+Z'}
|
|
shortcut={isMac ? '⌘Z' : 'Ctrl+Z'}
|
|
|
/>
|
|
/>
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-redo"
|
|
id="toolbar-redo"
|
|
|
label={t('toolbar_redo')}
|
|
label={t('toolbar_redo')}
|
|
|
command={redo}
|
|
command={redo}
|
|
|
- icon="repeat"
|
|
|
|
|
|
|
+ icon={bsVersion({ bs5: 'redo', bs3: 'repeat' }) as string}
|
|
|
shortcut={isMac ? '⇧⌘Z' : 'Ctrl+Y'}
|
|
shortcut={isMac ? '⇧⌘Z' : 'Ctrl+Y'}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
@@ -60,18 +64,22 @@ export const ToolbarItems: FC<{
|
|
|
<div
|
|
<div
|
|
|
className="ol-cm-toolbar-button-group"
|
|
className="ol-cm-toolbar-button-group"
|
|
|
data-overflow="group-section"
|
|
data-overflow="group-section"
|
|
|
|
|
+ aria-label={t('toolbar_text_formatting')}
|
|
|
>
|
|
>
|
|
|
<SectionHeadingDropdown />
|
|
<SectionHeadingDropdown />
|
|
|
</div>
|
|
</div>
|
|
|
)}
|
|
)}
|
|
|
{showGroup('group-format') && (
|
|
{showGroup('group-format') && (
|
|
|
- <div className="ol-cm-toolbar-button-group">
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ className="ol-cm-toolbar-button-group"
|
|
|
|
|
+ aria-label={t('toolbar_text_style')}
|
|
|
|
|
+ >
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-format-bold"
|
|
id="toolbar-format-bold"
|
|
|
label={t('toolbar_format_bold')}
|
|
label={t('toolbar_format_bold')}
|
|
|
command={commands.toggleBold}
|
|
command={commands.toggleBold}
|
|
|
active={isActive('\\textbf')}
|
|
active={isActive('\\textbf')}
|
|
|
- icon="bold"
|
|
|
|
|
|
|
+ icon={bsVersion({ bs5: 'format_bold', bs3: 'bold' }) as string}
|
|
|
shortcut={isMac ? '⌘B' : 'Ctrl+B'}
|
|
shortcut={isMac ? '⌘B' : 'Ctrl+B'}
|
|
|
/>
|
|
/>
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
@@ -79,7 +87,9 @@ export const ToolbarItems: FC<{
|
|
|
label={t('toolbar_format_italic')}
|
|
label={t('toolbar_format_italic')}
|
|
|
command={commands.toggleItalic}
|
|
command={commands.toggleItalic}
|
|
|
active={isActive('\\textit')}
|
|
active={isActive('\\textit')}
|
|
|
- icon="italic"
|
|
|
|
|
|
|
+ icon={
|
|
|
|
|
+ bsVersion({ bs5: 'format_italic', bs3: 'italic' }) as string
|
|
|
|
|
+ }
|
|
|
shortcut={isMac ? '⌘I' : 'Ctrl+I'}
|
|
shortcut={isMac ? '⌘I' : 'Ctrl+I'}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
@@ -88,6 +98,7 @@ export const ToolbarItems: FC<{
|
|
|
<div
|
|
<div
|
|
|
className="ol-cm-toolbar-button-group"
|
|
className="ol-cm-toolbar-button-group"
|
|
|
data-overflow="group-math"
|
|
data-overflow="group-math"
|
|
|
|
|
+ aria-label={t('toolbar_insert_math_and_symbols')}
|
|
|
>
|
|
>
|
|
|
<MathDropdown />
|
|
<MathDropdown />
|
|
|
{symbolPaletteAvailable && (
|
|
{symbolPaletteAvailable && (
|
|
@@ -107,24 +118,25 @@ export const ToolbarItems: FC<{
|
|
|
<div
|
|
<div
|
|
|
className="ol-cm-toolbar-button-group"
|
|
className="ol-cm-toolbar-button-group"
|
|
|
data-overflow="group-misc"
|
|
data-overflow="group-misc"
|
|
|
|
|
+ aria-label={t('toolbar_insert_misc')}
|
|
|
>
|
|
>
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-href"
|
|
id="toolbar-href"
|
|
|
label={t('toolbar_insert_link')}
|
|
label={t('toolbar_insert_link')}
|
|
|
command={commands.wrapInHref}
|
|
command={commands.wrapInHref}
|
|
|
- icon="link"
|
|
|
|
|
|
|
+ icon={bsVersion({ bs5: 'link', bs3: 'link' }) as string}
|
|
|
/>
|
|
/>
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-ref"
|
|
id="toolbar-ref"
|
|
|
label={t('toolbar_insert_cross_reference')}
|
|
label={t('toolbar_insert_cross_reference')}
|
|
|
command={commands.insertRef}
|
|
command={commands.insertRef}
|
|
|
- icon="tag"
|
|
|
|
|
|
|
+ icon={bsVersion({ bs5: 'sell', bs3: 'tag' }) as string}
|
|
|
/>
|
|
/>
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-cite"
|
|
id="toolbar-cite"
|
|
|
label={t('toolbar_insert_citation')}
|
|
label={t('toolbar_insert_citation')}
|
|
|
command={commands.insertCite}
|
|
command={commands.insertCite}
|
|
|
- icon="book"
|
|
|
|
|
|
|
+ icon={bsVersion({ bs5: 'menu_book', bs3: 'book' }) as string}
|
|
|
/>
|
|
/>
|
|
|
<InsertFigureDropdown />
|
|
<InsertFigureDropdown />
|
|
|
<TableInserterDropdown />
|
|
<TableInserterDropdown />
|
|
@@ -134,24 +146,40 @@ export const ToolbarItems: FC<{
|
|
|
<div
|
|
<div
|
|
|
className="ol-cm-toolbar-button-group"
|
|
className="ol-cm-toolbar-button-group"
|
|
|
data-overflow="group-list"
|
|
data-overflow="group-list"
|
|
|
|
|
+ aria-label={t('toolbar_list_indentation')}
|
|
|
>
|
|
>
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-bullet-list"
|
|
id="toolbar-bullet-list"
|
|
|
label={t('toolbar_bullet_list')}
|
|
label={t('toolbar_bullet_list')}
|
|
|
command={commands.toggleBulletList}
|
|
command={commands.toggleBulletList}
|
|
|
- icon="list-ul"
|
|
|
|
|
|
|
+ icon={
|
|
|
|
|
+ bsVersion({
|
|
|
|
|
+ bs5: 'format_list_bulleted',
|
|
|
|
|
+ bs3: 'list-ul',
|
|
|
|
|
+ }) as string
|
|
|
|
|
+ }
|
|
|
/>
|
|
/>
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-numbered-list"
|
|
id="toolbar-numbered-list"
|
|
|
label={t('toolbar_numbered_list')}
|
|
label={t('toolbar_numbered_list')}
|
|
|
command={commands.toggleNumberedList}
|
|
command={commands.toggleNumberedList}
|
|
|
- icon="list-ol"
|
|
|
|
|
|
|
+ icon={
|
|
|
|
|
+ bsVersion({
|
|
|
|
|
+ bs5: 'format_list_numbered',
|
|
|
|
|
+ bs3: 'list-ol',
|
|
|
|
|
+ }) as string
|
|
|
|
|
+ }
|
|
|
/>
|
|
/>
|
|
|
<ToolbarButton
|
|
<ToolbarButton
|
|
|
id="toolbar-format-indent-decrease"
|
|
id="toolbar-format-indent-decrease"
|
|
|
label={t('toolbar_decrease_indent')}
|
|
label={t('toolbar_decrease_indent')}
|
|
|
command={commands.indentDecrease}
|
|
command={commands.indentDecrease}
|
|
|
- icon="outdent"
|
|
|
|
|
|
|
+ icon={
|
|
|
|
|
+ bsVersion({
|
|
|
|
|
+ bs5: 'format_indent_decrease',
|
|
|
|
|
+ bs3: 'outdent',
|
|
|
|
|
+ }) as string
|
|
|
|
|
+ }
|
|
|
shortcut={visual ? (isMac ? '⌘[' : 'Ctrl+[') : undefined}
|
|
shortcut={visual ? (isMac ? '⌘[' : 'Ctrl+[') : undefined}
|
|
|
disabled={listDepth < 2}
|
|
disabled={listDepth < 2}
|
|
|
/>
|
|
/>
|
|
@@ -159,7 +187,12 @@ export const ToolbarItems: FC<{
|
|
|
id="toolbar-format-indent-increase"
|
|
id="toolbar-format-indent-increase"
|
|
|
label={t('toolbar_increase_indent')}
|
|
label={t('toolbar_increase_indent')}
|
|
|
command={commands.indentIncrease}
|
|
command={commands.indentIncrease}
|
|
|
- icon="indent"
|
|
|
|
|
|
|
+ icon={
|
|
|
|
|
+ bsVersion({
|
|
|
|
|
+ bs5: 'format_indent_increase',
|
|
|
|
|
+ bs3: 'indent',
|
|
|
|
|
+ }) as string
|
|
|
|
|
+ }
|
|
|
shortcut={visual ? (isMac ? '⌘]' : 'Ctrl+]') : undefined}
|
|
shortcut={visual ? (isMac ? '⌘]' : 'Ctrl+]') : undefined}
|
|
|
disabled={listDepth < 1}
|
|
disabled={listDepth < 1}
|
|
|
/>
|
|
/>
|