mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Allow users to provide alt text for image embeds
Summary: Ref T4843. - Add an `alt` attribute so users can provide alternate text for `{Fnnn}`. - Add an `alt` attribute to image macros. Test Plan: Embedded an image with `alt` and a macro, inspected HTML source to verify the `alt` attribute was present. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T4843 Differential Revision: https://secure.phabricator.com/D8925
This commit is contained in:
parent
e8cebb7da5
commit
c9dc554cb9
3 changed files with 14 additions and 1 deletions
|
@ -55,6 +55,7 @@ final class PhabricatorRemarkupRuleEmbedFile
|
|||
'float' => false,
|
||||
'width' => null,
|
||||
'height' => null,
|
||||
'alt' => null,
|
||||
);
|
||||
|
||||
if ($option_string) {
|
||||
|
@ -112,6 +113,10 @@ final class PhabricatorRemarkupRuleEmbedFile
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($options['alt'])) {
|
||||
$attrs['alt'] = $options['alt'];
|
||||
}
|
||||
|
||||
$img = phutil_tag('img', $attrs);
|
||||
|
||||
$embed = javelin_tag(
|
||||
|
|
|
@ -36,10 +36,17 @@ final class PhabricatorRemarkupRuleMeme
|
|||
$options['src'].' <'.PhabricatorEnv::getProductionURI($uri).'>'.
|
||||
($options['below'] != '' ? "\n\"{$options['below']}\"" : '');
|
||||
} else {
|
||||
$alt_text = pht(
|
||||
'Macro %s: %s %s',
|
||||
$options['src'],
|
||||
$options['above'],
|
||||
$options['below']);
|
||||
|
||||
$img = phutil_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => (string)$uri,
|
||||
'alt' => $alt_text,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ from clipboard into the text area.
|
|||
|
||||
You can set file display options like this:
|
||||
|
||||
{F123, layout=left, float, size=full}
|
||||
{F123, layout=left, float, size=full, alt="a duckling"}
|
||||
|
||||
Valid options are:
|
||||
|
||||
|
@ -360,6 +360,7 @@ Valid options are:
|
|||
text
|
||||
- **width** Scale image to a specific width.
|
||||
- **height** Scale image to a specific height.
|
||||
- **alt** Provide alternate text for assistive technologies.
|
||||
|
||||
== Embedding Countdowns
|
||||
|
||||
|
|
Loading…
Reference in a new issue