From a2d37206ea56876d30ec9a9b4f2794f2e6980ca6 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Thu, 8 Apr 2021 16:40:42 +0200 Subject: [PATCH] Rename title to tooltip across editor toolbar components --- ts/editor-toolbar/ColorPicker.d.ts | 2 +- ts/editor-toolbar/ColorPicker.svelte | 4 ++-- ts/editor-toolbar/CommandIconButton.d.ts | 2 +- ts/editor-toolbar/CommandIconButton.svelte | 4 ++-- ts/editor-toolbar/DropdownItem.d.ts | 2 +- ts/editor-toolbar/DropdownItem.svelte | 4 ++-- ts/editor-toolbar/IconButton.d.ts | 2 +- ts/editor-toolbar/IconButton.svelte | 4 ++-- ts/editor-toolbar/LabelButton.d.ts | 2 +- ts/editor-toolbar/LabelButton.svelte | 4 ++-- ts/editor-toolbar/SelectButton.svelte | 4 ++-- ts/editor-toolbar/SquareButton.svelte | 4 ++-- ts/editor-toolbar/color.ts | 8 ++++---- ts/editor-toolbar/format.ts | 24 +++++++++++----------- ts/editor-toolbar/notetype.ts | 8 ++++---- ts/editor-toolbar/template.ts | 22 ++++++++++---------- 16 files changed, 50 insertions(+), 50 deletions(-) diff --git a/ts/editor-toolbar/ColorPicker.d.ts b/ts/editor-toolbar/ColorPicker.d.ts index de594367d..25ae4a6d8 100644 --- a/ts/editor-toolbar/ColorPicker.d.ts +++ b/ts/editor-toolbar/ColorPicker.d.ts @@ -1,6 +1,6 @@ export interface ColorPickerProps { id?: string; className?: string; - title: string; + tooltip: string; onChange: (event: Event) => void; } diff --git a/ts/editor-toolbar/ColorPicker.svelte b/ts/editor-toolbar/ColorPicker.svelte index da979a0a2..ceae957ac 100644 --- a/ts/editor-toolbar/ColorPicker.svelte +++ b/ts/editor-toolbar/ColorPicker.svelte @@ -2,7 +2,7 @@ export let id = ""; export let className = ""; export let props: Record = {}; - export let title: string; + export let tooltip: string; export let onChange: (event: Event) => void; @@ -47,7 +47,7 @@ {id} class={className} {...props} - {title} + title={tooltip} on:mousedown|preventDefault> diff --git a/ts/editor-toolbar/CommandIconButton.d.ts b/ts/editor-toolbar/CommandIconButton.d.ts index 6eecebe96..439a2ea8d 100644 --- a/ts/editor-toolbar/CommandIconButton.d.ts +++ b/ts/editor-toolbar/CommandIconButton.d.ts @@ -1,7 +1,7 @@ export interface CommandIconButtonProps { id?: string; className?: string; - title: string; + tooltip: string; icon: string; command: string; activatable?: boolean; diff --git a/ts/editor-toolbar/CommandIconButton.svelte b/ts/editor-toolbar/CommandIconButton.svelte index 58aae8179..6022d40d1 100644 --- a/ts/editor-toolbar/CommandIconButton.svelte +++ b/ts/editor-toolbar/CommandIconButton.svelte @@ -39,7 +39,7 @@ export let id = ""; export let className = ""; export let props: Record = {}; - export let title: string; + export let tooltip: string; export let icon; export let command: string; @@ -62,6 +62,6 @@ } - + {@html icon} diff --git a/ts/editor-toolbar/DropdownItem.d.ts b/ts/editor-toolbar/DropdownItem.d.ts index f71f5d83e..afdbda955 100644 --- a/ts/editor-toolbar/DropdownItem.d.ts +++ b/ts/editor-toolbar/DropdownItem.d.ts @@ -1,7 +1,7 @@ export interface DropdownItemProps { id?: string; className?: string; - title: string; + tooltip: string; onClick: (event: MouseEvent) => void; label: string; diff --git a/ts/editor-toolbar/DropdownItem.svelte b/ts/editor-toolbar/DropdownItem.svelte index 1be8dbe25..7563d3983 100644 --- a/ts/editor-toolbar/DropdownItem.svelte +++ b/ts/editor-toolbar/DropdownItem.svelte @@ -2,7 +2,7 @@ export let id = ""; export let className = ""; export let props: Record = {}; - export let title: string; + export let tooltip: string; export let onClick: (event: MouseEvent) => void; export let label: string; @@ -13,7 +13,7 @@ {id} class={`dropdown-item ${className}`} {...props} - {title} + title={tooltip} on:click={onClick} on:mousedown|preventDefault> {label} diff --git a/ts/editor-toolbar/IconButton.d.ts b/ts/editor-toolbar/IconButton.d.ts index b2def61da..18fe01dc9 100644 --- a/ts/editor-toolbar/IconButton.d.ts +++ b/ts/editor-toolbar/IconButton.d.ts @@ -1,7 +1,7 @@ export interface IconButtonProps { id?: string; className?: string; - title: string; + tooltip: string; icon: string; onClick: (event: MouseEvent) => void; } diff --git a/ts/editor-toolbar/IconButton.svelte b/ts/editor-toolbar/IconButton.svelte index 0e9745e72..5a3b3aa4a 100644 --- a/ts/editor-toolbar/IconButton.svelte +++ b/ts/editor-toolbar/IconButton.svelte @@ -4,12 +4,12 @@ export let id = ""; export let className = ""; export let props: Record = {}; - export let title: string; + export let tooltip: string; export let icon = ""; export let onClick: (event: MouseEvent) => void; - + {@html icon} diff --git a/ts/editor-toolbar/LabelButton.d.ts b/ts/editor-toolbar/LabelButton.d.ts index 1cab6f08c..3ed88b9e0 100644 --- a/ts/editor-toolbar/LabelButton.d.ts +++ b/ts/editor-toolbar/LabelButton.d.ts @@ -3,7 +3,7 @@ export interface LabelButtonProps { className?: string; label: string; - title: string; + tooltip: string; onClick: (event: MouseEvent) => void; disables?: boolean; } diff --git a/ts/editor-toolbar/LabelButton.svelte b/ts/editor-toolbar/LabelButton.svelte index 583a0190b..862b2c9ba 100644 --- a/ts/editor-toolbar/LabelButton.svelte +++ b/ts/editor-toolbar/LabelButton.svelte @@ -7,7 +7,7 @@ export let props: Record = {}; export let label: string; - export let title: string; + export let tooltip: string; export let onClick: (event: MouseEvent) => void; export let disables = true; @@ -60,6 +60,6 @@ {...props} on:click={onClick} on:mousedown|preventDefault - {title}> + title={tooltip}> {label} diff --git a/ts/editor-toolbar/SelectButton.svelte b/ts/editor-toolbar/SelectButton.svelte index 13da0b04c..68b63ef9e 100644 --- a/ts/editor-toolbar/SelectButton.svelte +++ b/ts/editor-toolbar/SelectButton.svelte @@ -12,7 +12,7 @@ export let id = ""; export let className = ""; export let props: Record = {}; - export let title: string; + export let tooltip: string; function extendClassName(classes: string) { return `form-select ${classes}`; @@ -60,7 +60,7 @@ {id} class={extendClassName(className)} {...props} - {title}> + title={tooltip}> {#each options as option} {/each} diff --git a/ts/editor-toolbar/SquareButton.svelte b/ts/editor-toolbar/SquareButton.svelte index 5f57808a6..a7f58896a 100644 --- a/ts/editor-toolbar/SquareButton.svelte +++ b/ts/editor-toolbar/SquareButton.svelte @@ -6,7 +6,7 @@ export let id = ""; export let className = ""; export let props: Record = {}; - export let title: string; + export let tooltip: string; export let onClick: (event: MouseEvent) => void; export let active = false; @@ -86,7 +86,7 @@ {id} class={className} {...props} - {title} + title={tooltip} class:active tabindex="-1" disabled={_disabled} diff --git a/ts/editor-toolbar/color.ts b/ts/editor-toolbar/color.ts index 7ba8b21ad..0c345eecb 100644 --- a/ts/editor-toolbar/color.ts +++ b/ts/editor-toolbar/color.ts @@ -24,26 +24,26 @@ function wrapWithForecolor(color: string): void { } const iconButton = dynamicComponent(IconButton); -const forecolorButton = iconButton( +const forecolorButton = iconButton( { icon: squareFillIcon, className: "forecolor", onClick: () => wrapWithForecolor(getForecolor()), }, { - title: tr.editingSetForegroundColourF7, + tooltip: tr.editingSetForegroundColourF7, } ); const colorPicker = dynamicComponent(ColorPicker); -const colorpickerButton = colorPicker( +const colorpickerButton = colorPicker( { className: "rainbow", onChange: ({ currentTarget }) => setForegroundColor((currentTarget as HTMLInputElement).value), }, { - title: tr.editingChangeColourF8, + tooltip: tr.editingChangeColourF8, } ); diff --git a/ts/editor-toolbar/format.ts b/ts/editor-toolbar/format.ts index 4b53f2c4a..40cad8a8a 100644 --- a/ts/editor-toolbar/format.ts +++ b/ts/editor-toolbar/format.ts @@ -13,64 +13,64 @@ import eraserIcon from "./eraser.svg"; const commandIconButton = dynamicComponent(CommandIconButton); -const boldButton = commandIconButton( +const boldButton = commandIconButton( { icon: boldIcon, command: "bold", }, { - title: tr.editingBoldTextCtrlandb, + tooltip: tr.editingBoldTextCtrlandb, } ); -const italicButton = commandIconButton( +const italicButton = commandIconButton( { icon: italicIcon, command: "italic", }, { - title: tr.editingItalicTextCtrlandi, + tooltip: tr.editingItalicTextCtrlandi, } ); -const underlineButton = commandIconButton( +const underlineButton = commandIconButton( { icon: underlineIcon, command: "underline", }, { - title: tr.editingUnderlineTextCtrlandu, + tooltip: tr.editingUnderlineTextCtrlandu, } ); -const superscriptButton = commandIconButton( +const superscriptButton = commandIconButton( { icon: superscriptIcon, command: "superscript", }, { - title: tr.editingSuperscriptCtrlandand, + tooltip: tr.editingSuperscriptCtrlandand, } ); -const subscriptButton = commandIconButton( +const subscriptButton = commandIconButton( { icon: subscriptIcon, command: "subscript", }, { - title: tr.editingSubscriptCtrland, + tooltip: tr.editingSubscriptCtrland, } ); -const removeFormatButton = commandIconButton( +const removeFormatButton = commandIconButton( { icon: eraserIcon, command: "removeFormat", activatable: false, }, { - title: tr.editingRemoveFormattingCtrlandr, + tooltip: tr.editingRemoveFormattingCtrlandr, } ); diff --git a/ts/editor-toolbar/notetype.ts b/ts/editor-toolbar/notetype.ts index 9c216b024..15ad589b1 100644 --- a/ts/editor-toolbar/notetype.ts +++ b/ts/editor-toolbar/notetype.ts @@ -6,25 +6,25 @@ import { bridgeCommand } from "anki/bridgecommand"; import * as tr from "anki/i18n"; const labelButton = dynamicComponent(LabelButton); -const fieldsButton = labelButton( +const fieldsButton = labelButton( { onClick: () => bridgeCommand("fields"), disables: false, }, { label: () => `${tr.editingFields()}...`, - title: tr.editingCustomizeFields, + tooltip: tr.editingCustomizeFields, } ); -const cardsButton = labelButton( +const cardsButton = labelButton( { onClick: () => bridgeCommand("cards"), disables: false, }, { label: () => `${tr.editingCards()}...`, - title: tr.editingCustomizeCardTemplatesCtrlandl, + tooltip: tr.editingCustomizeCardTemplatesCtrlandl, } ); diff --git a/ts/editor-toolbar/template.ts b/ts/editor-toolbar/template.ts index b4c06e2d4..772f35fc2 100644 --- a/ts/editor-toolbar/template.ts +++ b/ts/editor-toolbar/template.ts @@ -39,34 +39,34 @@ const withDropdownMenu = dynamicComponent(WithDropdownMenu); const dropdownMenu = dynamicComponent(DropdownMenu); const dropdownItem = dynamicComponent(DropdownItem); -const attachmentButton = iconButton( +const attachmentButton = iconButton( { icon: paperclipIcon, onClick: onAttachment, }, { - title: tr.editingAttachPicturesaudiovideoF3, + tooltip: tr.editingAttachPicturesaudiovideoF3, } ); const recordButton = iconButton( { icon: micIcon, onClick: onRecord }, { - title: tr.editingRecordAudioF5, + tooltip: tr.editingRecordAudioF5, } ); -const clozeButton = iconButton( +const clozeButton = iconButton( { icon: bracketsIcon, onClick: onCloze, }, { - title: tr.editingClozeDeletionCtrlandshiftandc, + tooltip: tr.editingClozeDeletionCtrlandshiftandc, } ); -const mathjaxButton = iconButton>( +const mathjaxButton = iconButton>( { icon: functionIcon, }, @@ -82,7 +82,7 @@ const mathjaxMenu = dropdownMenu( dropdownItem( { onClick: () => bridgeCommand("mathjaxInline"), - title: "test", + tooltip: "test", endLabel: "test", }, { label: tr.editingMathjaxInline } @@ -90,7 +90,7 @@ const mathjaxMenu = dropdownMenu( dropdownItem( { onClick: () => bridgeCommand("mathjaxBlock"), - title: "test", + tooltip: "test", endLabel: "test", }, { label: tr.editingMathjaxBlock } @@ -98,7 +98,7 @@ const mathjaxMenu = dropdownMenu( dropdownItem( { onClick: () => bridgeCommand("mathjaxChemistry"), - title: "test", + tooltip: "test", endLabel: "test", }, { label: tr.editingMathjaxChemistry } @@ -116,13 +116,13 @@ const mathjaxButtonWithMenu = withDropdownMenu( {} ); -const htmlButton = iconButton( +const htmlButton = iconButton( { icon: xmlIcon, onClick: onHtmlEdit, }, { - title: tr.editingHtmlEditor, + tooltip: tr.editingHtmlEditor, } );