- {elements.map((element, i) => {
- const elementName = element?.name || element;
+
+
+
+
{
+ if (val !== defaultValue && val !== value) {
+ setValue(val);
+ }
+ }}
+ >
+
+
+ {elements.map((element, i) => {
+ const elementName = element?.name || element;
- const elementType = enabledElements[elementName];
- const Button = elementType?.Button;
+ const elementType = enabledElements[elementName];
+ const Button = elementType?.Button;
- if (Button) {
- return (
-
- );
- }
-
- return null;
- })}
- {leaves.map((leaf, i) => {
- const leafName = leaf?.name || leaf;
- const leafType = enabledLeaves[leafName];
- const Button = leafType?.Button;
-
- if (Button) {
- return (
-
- );
- }
-
- return null;
- })}
-
-
{
- Object.keys(hotkeys).forEach((hotkey) => {
- if (isHotkey(hotkey, event)) {
- event.preventDefault();
- const mark = hotkeys[hotkey];
- toggleLeaf(editor, mark);
+ if (Button) {
+ return (
+
+ );
}
- });
- }}
- />
-
-
+
+ return null;
+ })}
+ {leaves.map((leaf, i) => {
+ const leafName = leaf?.name || leaf;
+ const leafType = enabledLeaves[leafName];
+ const Button = leafType?.Button;
+
+ if (Button) {
+ return (
+
+ );
+ }
+
+ return null;
+ })}
+
+
{
+ Object.keys(hotkeys).forEach((hotkey) => {
+ if (isHotkey(hotkey, event)) {
+ event.preventDefault();
+ const mark = hotkeys[hotkey];
+ toggleLeaf(editor, mark);
+ }
+ });
+ }}
+ />
+