Skip to content

Commit

Permalink
fix(text-editor): put most used controls in the toolbar first
Browse files Browse the repository at this point in the history
Since the toolbar can truncate actions that are not fitting into
the available space, we need to make sure that we have
the frequently used actions displayed first.
  • Loading branch information
Kiarokh committed Jun 11, 2024
1 parent 5335ab7 commit 1061c72
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions src/components/text-editor/prosemirror-adapter/menu/menu-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,23 @@ const textEditorMenuItems: Array<
selected: false,
},
{
value: EditorMenuTypes.Code,
text: 'Code',
commandText: `${mod} \``,
icon: '-lime-text-code',
value: EditorMenuTypes.Link,
text: 'Link',
icon: '-lime-text-link',
iconOnly: true,
},
{ separator: true },
{
value: EditorMenuTypes.BulletList,
text: 'Bullet list',
icon: '-lime-text-bulleted-list',
iconOnly: true,
selected: false,
},
{
value: EditorMenuTypes.CodeBlock,
text: 'Code Block',
commandText: `${mod} ${shift} C`,
icon: '-lime-text-code-block',
value: EditorMenuTypes.OrderedList,
text: 'Numbered list',
icon: '-lime-text-ordered-list',
iconOnly: true,
selected: false,
},
Expand Down Expand Up @@ -88,32 +93,29 @@ const textEditorMenuItems: Array<
},
{ separator: true },
{
value: EditorMenuTypes.BulletList,
text: 'Bullet list',
icon: '-lime-text-bulleted-list',
value: EditorMenuTypes.Blockquote,
text: 'Blockquote',
icon: '-lime-text-blockquote',
iconOnly: true,
selected: false,
},
{ separator: true },
{
value: EditorMenuTypes.OrderedList,
text: 'Numbered list',
icon: '-lime-text-ordered-list',
value: EditorMenuTypes.Code,
text: 'Code',
commandText: `${mod} \``,
icon: '-lime-text-code',
iconOnly: true,
selected: false,
},
{
value: EditorMenuTypes.Blockquote,
text: 'Blockquote',
icon: '-lime-text-blockquote',
value: EditorMenuTypes.CodeBlock,
text: 'Code Block',
commandText: `${mod} ${shift} C`,
icon: '-lime-text-code-block',
iconOnly: true,
selected: false,
},
{
value: EditorMenuTypes.Link,
text: 'Link',
icon: '-lime-text-link',
iconOnly: true,
},
];

export const getTextEditorMenuItems = () => cloneDeep(textEditorMenuItems);
Expand Down

0 comments on commit 1061c72

Please sign in to comment.