Skip to content

Commit 1d710e6

Browse files
Branc0caio-pizzol
andauthored
fix: update dropdown trigger label on select (#2515)
* Fix overvlow dropdown * prevents label updates for "hideLabel: true" items * Revert changes on ButtonGroup.vue * fix(toolbar): pass font attrs when queuing unfocused mark commands * fix(test): removes extra properties --------- Co-authored-by: Caio Pizzol <97641911+caio-pizzol@users.noreply.github.com>
1 parent 4b6f30e commit 1d710e6

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

packages/super-editor/src/components/toolbar/defaultItems.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ export const makeDefaultItems = ({
10231023
icon: toolbarIcons.lineHeight,
10241024
hasCaret: false,
10251025
hasInlineTextInput: false,
1026+
hideLabel: true,
10261027
inlineTextInputVisible: false,
10271028
suppressActiveHighlight: true,
10281029
isWide: false,

packages/super-editor/src/components/toolbar/super-toolbar.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,15 @@ export class SuperToolbar extends EventEmitter {
11381138
// until the next selection update (after the user clicks into the editor).
11391139
if (!wasFocused && isMarkToggle) {
11401140
this.pendingMarkCommands.push({ command, argument, item });
1141-
item?.activate?.();
1141+
const shouldPassActivationAttrs = item?.command === 'setFontSize' || item?.command === 'setFontFamily';
1142+
if (shouldPassActivationAttrs) {
1143+
const itemName = item?.name?.value;
1144+
const activationAttrs = argument && itemName ? { [itemName]: argument } : {};
1145+
item?.activate?.(activationAttrs);
1146+
} else {
1147+
item?.activate?.();
1148+
}
1149+
11421150
if (this.activeEditor && !this.activeEditor.options.isHeaderOrFooter) {
11431151
this.activeEditor.focus();
11441152
}

0 commit comments

Comments
 (0)