@@ -57,6 +57,7 @@ import {
5757import { MToolbarColors } from '../toolbar/markup/MToolbarColors' ;
5858import { MToolbarFilePopup } from '../toolbar/markup/MToolbarFilePopup' ;
5959import { MToolbarImagePopup } from '../toolbar/markup/MToolbarImagePopup' ;
60+ import type { MarkdownEditorPreset } from '../types' ;
6061
6162import { ActionName } from './action-names' ;
6263import { icons } from './icons' ;
@@ -544,3 +545,209 @@ export const mToolbarConfig: MToolbarData = [
544545 ] ,
545546 [ mImagePopupData , mFilePopupData , mTableButton , mCheckboxButton ] ,
546547] ;
548+
549+ export const mToolbarConfigByPreset : Record < MarkdownEditorPreset , MToolbarData > = {
550+ zero : [ mHistoryGroupConfig ] ,
551+ commonmark : [
552+ [ mUndoItemData , mRedoItemData ] ,
553+ [ mBoldItemData , mItalicItemData ] ,
554+ [
555+ {
556+ id : 'heading' ,
557+ type : ToolbarDataType . ListButton ,
558+ icon : icons . headline ,
559+ withArrow : true ,
560+ title : i18n . bind ( null , 'heading' ) ,
561+ data : [
562+ mHeading1ItemData ,
563+ mHeading2ItemData ,
564+ mHeading3ItemData ,
565+ mHeading4ItemData ,
566+ mHeading5ItemData ,
567+ mHeading6ItemData ,
568+ ] ,
569+ } ,
570+ {
571+ id : 'list' ,
572+ type : ToolbarDataType . ListButton ,
573+ icon : icons . bulletList ,
574+ withArrow : true ,
575+ title : i18n . bind ( null , 'list' ) ,
576+ data : [ mBulletListItemData , mOrderedListItemData ] ,
577+ } ,
578+ mLinkButton ,
579+ mQuoteButton ,
580+ {
581+ id : 'code' ,
582+ type : ToolbarDataType . ListButton ,
583+ icon : icons . code ,
584+ withArrow : true ,
585+ title : i18n . bind ( null , 'code' ) ,
586+ data : [ mCodeItemData , mCodeblockItemData ] ,
587+ } ,
588+ ] ,
589+ ] ,
590+ default : [
591+ [ mUndoItemData , mRedoItemData ] ,
592+ [ mBoldItemData , mItalicItemData , mStrikethroughItemData ] ,
593+ [
594+ {
595+ id : 'heading' ,
596+ type : ToolbarDataType . ListButton ,
597+ icon : icons . headline ,
598+ withArrow : true ,
599+ title : i18n . bind ( null , 'heading' ) ,
600+ data : [
601+ mHeading1ItemData ,
602+ mHeading2ItemData ,
603+ mHeading3ItemData ,
604+ mHeading4ItemData ,
605+ mHeading5ItemData ,
606+ mHeading6ItemData ,
607+ ] ,
608+ } ,
609+ {
610+ id : 'list' ,
611+ type : ToolbarDataType . ListButton ,
612+ icon : icons . bulletList ,
613+ withArrow : true ,
614+ title : i18n . bind ( null , 'list' ) ,
615+ data : [ mBulletListItemData , mOrderedListItemData ] ,
616+ } ,
617+ mLinkButton ,
618+ mQuoteButton ,
619+ {
620+ id : 'code' ,
621+ type : ToolbarDataType . ListButton ,
622+ icon : icons . code ,
623+ withArrow : true ,
624+ title : i18n . bind ( null , 'code' ) ,
625+ data : [ mCodeItemData , mCodeblockItemData ] ,
626+ } ,
627+ ] ,
628+ ] ,
629+ yfm : [
630+ [ mUndoItemData , mRedoItemData ] ,
631+ [
632+ mBoldItemData ,
633+ mItalicItemData ,
634+ mUnderlineItemData ,
635+ mStrikethroughItemData ,
636+ mMonospaceItemData ,
637+ ] ,
638+ [
639+ {
640+ id : 'heading' ,
641+ type : ToolbarDataType . ListButton ,
642+ icon : icons . headline ,
643+ withArrow : true ,
644+ title : i18n . bind ( null , 'heading' ) ,
645+ data : [
646+ mHeading1ItemData ,
647+ mHeading2ItemData ,
648+ mHeading3ItemData ,
649+ mHeading4ItemData ,
650+ mHeading5ItemData ,
651+ mHeading6ItemData ,
652+ ] ,
653+ } ,
654+ {
655+ id : 'list' ,
656+ type : ToolbarDataType . ListButton ,
657+ icon : icons . bulletList ,
658+ withArrow : true ,
659+ title : i18n . bind ( null , 'list' ) ,
660+ data : [ mBulletListItemData , mOrderedListItemData ] ,
661+ } ,
662+ mLinkButton ,
663+ mNoteButton ,
664+ mCutButton ,
665+ mQuoteButton ,
666+ {
667+ id : 'code' ,
668+ type : ToolbarDataType . ListButton ,
669+ icon : icons . code ,
670+ withArrow : true ,
671+ title : i18n . bind ( null , 'code' ) ,
672+ data : [ mCodeItemData , mCodeblockItemData ] ,
673+ } ,
674+ ] ,
675+ [ mImagePopupData , mFilePopupData , mTableButton , mCheckboxButton ] ,
676+ ] ,
677+ full : mToolbarConfig . slice ( ) ,
678+ } ;
679+
680+ export const mHiddenDataByPreset : Record < MarkdownEditorPreset , MToolbarItemData [ ] > = {
681+ zero : [ ] ,
682+ commonmark : [
683+ mHeading1ItemData ,
684+ mHeading2ItemData ,
685+ mHeading3ItemData ,
686+ mHeading4ItemData ,
687+ mHeading5ItemData ,
688+ mHeading6ItemData ,
689+ mBulletListItemData ,
690+ mOrderedListItemData ,
691+ mLinkButton ,
692+ mQuoteButton ,
693+ mCodeblockItemData ,
694+ mHruleItemData ,
695+ ] ,
696+ default : [
697+ mHeading1ItemData ,
698+ mHeading2ItemData ,
699+ mHeading3ItemData ,
700+ mHeading4ItemData ,
701+ mHeading5ItemData ,
702+ mHeading6ItemData ,
703+ mBulletListItemData ,
704+ mOrderedListItemData ,
705+ mLinkButton ,
706+ mQuoteButton ,
707+ mCodeblockItemData ,
708+ mHruleItemData ,
709+ ] ,
710+ yfm : [
711+ mHeading1ItemData ,
712+ mHeading2ItemData ,
713+ mHeading3ItemData ,
714+ mHeading4ItemData ,
715+ mHeading5ItemData ,
716+ mHeading6ItemData ,
717+ mBulletListItemData ,
718+ mOrderedListItemData ,
719+ mLinkButton ,
720+ mQuoteButton ,
721+ mNoteButton ,
722+ mCutButton ,
723+ mCodeblockItemData ,
724+ mCheckboxButton ,
725+ mTableButton ,
726+ mImagePopupData ,
727+ mHruleItemData ,
728+ mFilePopupData ,
729+ mTabsItemData ,
730+ ] ,
731+ full : [
732+ mHeading1ItemData ,
733+ mHeading2ItemData ,
734+ mHeading3ItemData ,
735+ mHeading4ItemData ,
736+ mHeading5ItemData ,
737+ mHeading6ItemData ,
738+ mBulletListItemData ,
739+ mOrderedListItemData ,
740+ mLinkButton ,
741+ mQuoteButton ,
742+ mNoteButton ,
743+ mCutButton ,
744+ mCodeblockItemData ,
745+ mCheckboxButton ,
746+ mTableButton ,
747+ mImagePopupData ,
748+ mHruleItemData ,
749+ mEmojiItemData ,
750+ mFilePopupData ,
751+ mTabsItemData ,
752+ ] ,
753+ } ;
0 commit comments