Skip to content

Commit 2ac13a8

Browse files
authored
fix: Use text area for alternative text and captions (visual editor) (#644)
* fix: use text box instead of input for alt-text * fix: use resize instead of setting height * refactor: use text area for caption * refactor: text area for table caption * refactor: use text box for caption in table * refactor: use text box for caption in callout * chore: update changelog entry * fix(changelog): correct pr number
1 parent d8a37c6 commit 2ac13a8

File tree

4 files changed

+47
-26
lines changed

4 files changed

+47
-26
lines changed

apps/vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 1.127.0 (Unreleased)
44

55
- Added a new setting `quarto.useBundledQuartoInPositron` to prefer the Quarto CLI bundled with Positron when available. This setting has precedence _between_ `quarto.path` and `quarto.usePipQuarto`, and has no effect outside of Positron (<https://github.com/quarto-dev/quarto/pull/841>).
6+
- Visual Editor: uses a text box for alternative text and captions in callouts, images, and tables interface. (<https://github.com/quarto-dev/quarto/pull/644>)
67
- Fixed a bug where previewing showed "Not Found" on Quarto files with spaces in the name in subfolders of projects (<https://github.com/quarto-dev/quarto/pull/853>).
78

89
## 1.126.0 (Release on 2025-10-08)

packages/editor-ui/src/dialogs/edit-callout.tsx

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@
1515

1616
import React, { useRef, useState } from "react"
1717

18-
import { Button, Checkbox, Field, Input, Select, SelectTabData, SelectTabEvent, Tab, TabValue, makeStyles } from "@fluentui/react-components"
18+
import {
19+
Button,
20+
Checkbox,
21+
Field,
22+
Select,
23+
SelectTabData,
24+
SelectTabEvent,
25+
Tab,
26+
TabValue,
27+
makeStyles,
28+
Textarea,
29+
} from "@fluentui/react-components";
1930

2031
import { AttrEditInput, CalloutEditProps, CalloutEditResult, CalloutProps, PandocAttr, UIToolsAttr } from "editor-types";
2132

@@ -32,10 +43,10 @@ import { useEffect } from "react";
3243

3344
export function editCallout(attrUITools: UIToolsAttr) {
3445
return async (props: CalloutEditProps, removeEnabled: boolean): Promise<CalloutEditResult | null> => {
35-
36-
const values: EditCalloutDialogValues = {
37-
values: {...attrUITools.propsToInput(props.attr), ...props.callout},
38-
action: "edit"
46+
47+
const values: EditCalloutDialogValues = {
48+
values: {...attrUITools.propsToInput(props.attr), ...props.callout},
49+
action: "edit"
3950
};
4051

4152
const result = await showValueEditorDialog(EditCalloutDialog, values, {
@@ -65,7 +76,7 @@ interface EditCalloutDialogOptions {
6576
removeEnabled: boolean;
6677
}
6778

68-
const EditCalloutDialog: React.FC<{
79+
const EditCalloutDialog: React.FC<{
6980
values: EditCalloutDialogValues,
7081
options: EditCalloutDialogOptions,
7182
onClosed: (values?: EditCalloutDialogValues) => void }
@@ -93,7 +104,7 @@ const EditCalloutDialog: React.FC<{
93104
}
94105
}
95106

96-
const removeButton =
107+
const removeButton =
97108
<Button onClick={() => close({ ...props.values, action: 'remove' })}>
98109
{t("Unwrap Div")}
99110
</Button>;
@@ -128,32 +139,36 @@ const EditCalloutDialog: React.FC<{
128139
</Field>
129140
</div>
130141
<Field label={t("Caption")} placeholder={t("(Optional)")}>
131-
<Input value={caption} onChange={(_ev, data) => setCaption(data.value)}/>
142+
<Textarea
143+
value={caption}
144+
onChange={(_ev, data) => setCaption(data.value)}
145+
resize="vertical"
146+
/>
132147
</Field>
133-
<Checkbox label={t("Display icon alongside callout")} checked={icon} onChange={(_ev, data) => setIcon(!!data.checked)}/>
148+
<Checkbox label={t("Display icon alongside callout")} checked={icon} onChange={(_ev, data) => setIcon(!!data.checked)}/>
134149
</EditAttrPanel>;
135150

136-
const attributesPanel =
151+
const attributesPanel =
137152
<EditAttrPanel>
138153
<EditAttr value={attr} onChange={setAttr} />
139154
</EditAttrPanel>;
140155

141156
return (
142157
<ModalDialog
143-
title={t("Callout")}
158+
title={t("Callout")}
144159
theme={fluentTheme()}
145-
isOpen={isOpen}
160+
isOpen={isOpen}
146161
leftButtons={props.options.removeEnabled ? removeButton : undefined}
147162
onOK={() => close({ values: { ...attr, type, appearance, caption, icon}, action: 'edit'})}
148163
onCancel={() => close() }
149164
>
150165
<ModalDialogTabList
151-
id="edit-callout"
152-
selectedValue={selectedTab}
166+
id="edit-callout"
167+
selectedValue={selectedTab}
153168
onTabSelect={onTabSelect}
154169
>
155170
<Tab id="callout" value="callout">{t("Callout")}</Tab>
156-
<Tab id="attributes" value="attributes">{t("Attributes")}</Tab>
171+
<Tab id="attributes" value="attributes">{t("Attributes")}</Tab>
157172
</ModalDialogTabList>
158173
<div>
159174
{selectedTab === "callout" && calloutPanel}
@@ -173,4 +188,4 @@ const useStyles = makeStyles({
173188
width: '50%'
174189
}
175190
},
176-
})
191+
})

packages/editor-ui/src/dialogs/edit-image.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import {
2828
useId,
2929
RadioGroup,
3030
Label,
31-
Radio
31+
Radio,
32+
Textarea
3233
} from "@fluentui/react-components";
3334

3435
import { ModalDialog, ModalDialogTabList, showValueEditorDialog} from "ui-widgets";
@@ -153,19 +154,21 @@ const imagePanel =
153154
: null
154155
}
155156
<Field label={t("Caption")}>
156-
<Input
157+
<Textarea
157158
value={caption}
158159
onChange={(_ev, data) => setCaption(data.value)}
159160
placeholder={t("(Optional)")}
161+
resize="vertical"
160162
/>
161163
</Field>
162164

163165
{alt !== undefined
164166
? <Field label={t("Alternative text")}>
165-
<Input
166-
value={alt}
167+
<Textarea
168+
value={alt}
167169
onChange={(_ev, data) => setAlt(data.value)}
168170
placeholder={t("(Optional)")}
171+
resize="vertical"
169172
/>
170173
</Field>
171174
: null
@@ -288,6 +291,3 @@ const useStyles = makeStyles({
288291
gridRowGap: tokens.spacingVerticalS,
289292
}
290293
})
291-
292-
293-

packages/editor-ui/src/dialogs/insert-table.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import React, { useState } from "react";
1717

18-
import { Checkbox, Field, Input, makeStyles } from "@fluentui/react-components";
18+
import { Checkbox, Field, Input, makeStyles, Textarea } from "@fluentui/react-components";
1919

2020
import {
2121
ModalDialog,
@@ -91,7 +91,12 @@ const InsertTableDialog: React.FC<{
9191

9292
{props.options.captions ? (
9393
<Field label={t("Caption")}>
94-
<Input value={caption} onChange={(_ev, data) => setCaption(data.value)} placeholder={t("(Optional)")}/>
94+
<Textarea
95+
value={caption}
96+
onChange={(_ev, data) => setCaption(data.value)}
97+
placeholder={t("(Optional)")}
98+
resize="vertical"
99+
/>
95100
</Field>
96101
) : null}
97102

@@ -111,4 +116,4 @@ const useStyles = makeStyles({
111116
width: '50%'
112117
}
113118
},
114-
})
119+
})

0 commit comments

Comments
 (0)