From 525c2433b778312ae8d0c9ac5a20c395b2e98976 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 21 Jul 2021 00:58:42 +0100 Subject: [PATCH] Update to work with new Button component --- js/src/common/components/TextEditorButton.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/src/common/components/TextEditorButton.js b/js/src/common/components/TextEditorButton.js index 4f379ef400f..fa517e627f3 100644 --- a/js/src/common/components/TextEditorButton.js +++ b/js/src/common/components/TextEditorButton.js @@ -1,24 +1,27 @@ +import extractText from '../utils/extractText'; import Button from './Button'; import Tooltip from './Tooltip'; /** * The `TextEditorButton` component displays a button suitable for the text * editor toolbar. + * + * Automatically creates tooltips using the Tooltip component and provided text. + * + * ## Attrs + * - `title` - Tooltip for the button */ export default class TextEditorButton extends Button { view(vnode) { const originalView = super.view(vnode); - // Steal tooltip label from the Button superclass - const tooltipText = originalView.attrs.title; - delete originalView.attrs.title; - - return {originalView}; + return {originalView}; } static initAttrs(attrs) { super.initAttrs(attrs); attrs.className = attrs.className || 'Button Button--icon Button--link'; + attrs.tooltipText = attrs.title; } }