1- Component[OptionsPattern[]] := With[{Messager = OptionValue["Messager"], Color = (If[StringQ[#], #, "teal"]&) @ OptionValue["Parameters"]["AccentColor"], Event = OptionValue["Event"], ExtesionInjector = OptionValue["ExtesionInjector"]},
1+ Component[OptionsPattern[]] := With[
2+ {Messager = OptionValue["Messager"], Color = (If[StringQ[#], #, "teal"]&) @ OptionValue["Parameters"]["AccentColor"], Event = OptionValue["Event"], ExtesionInjector = OptionValue["ExtesionInjector"]},
3+ {additionalButtons = ExtesionInjector["Template"->"CellDropdown", "Messager" -> Messager, "Event"->Event]},
4+
25 EventHandler[Event, {
36 "CallDropdown" -> ((Print["CallDropdown!"]; WebUISubmit[Global`UICellsDropdown[#], Global`$Client])&)
47 }];
8+
59 If[OptionValue["ElectronQ"],
6- With[{},
10+ With[{ExtraButtons = ExportString[If[ListQ[additionalButtons], #["Native"] &/@ additionalButtons, {}], "JSON", "Compact"->0] },
711 <script type="module">
812 core.UICellsDropdown = async (args, env) => {
913 const uid = await interpretate(args[0], env);
@@ -13,6 +17,7 @@ Component[OptionsPattern[]] := With[{Messager = OptionValue["Messager"], Color
1317 {type: 'separator'},
1418 {label: 'Make initialization cell', ref: 'MakeInit'},
1519 {type: 'separator'},
20+ ...<ExtraButtons/>,
1621 {label: 'Insert cell before', ref: 'AddBefore'},
1722 {type: 'separator'},
1823 {label: 'Hide / Show', ref: 'Hide'},
@@ -27,6 +32,9 @@ Component[OptionsPattern[]] := With[{Messager = OptionValue["Messager"], Color
2732 </script>
2833 ]
2934 ,
35+ With[{
36+ ExtraButtons = If[ListQ[additionalButtons], #["HTML"] &/@ additionalButtons, ""]
37+ },
3038 With[{Layout =
3139 {
3240 <div class="py-0 px-2" role="none">
@@ -62,6 +70,7 @@ Component[OptionsPattern[]] := With[{Messager = OptionValue["Messager"], Color
6270 </svg>
6371 Insert cell before
6472 </button>
73+ <ExtraButtons/>
6574 </div>
6675 ,
6776 <div class="py-0 px-2" role="none">
@@ -158,6 +167,7 @@ Component[OptionsPattern[]] := With[{Messager = OptionValue["Messager"], Color
158167 </div>
159168 ]
160169 ]
170+ ]
161171];
162172
163173Options[Component] = {"Event"->"", "Messager"->"", "Parameters"->Null, "ExtesionInjector"->( "" &), "ElectronQ"->False};
0 commit comments