Skip to content

Commit

Permalink
Merge pull request #1041 from codidact/cellio/alt-text-slug
Browse files Browse the repository at this point in the history
change alt-text placeholder to single token
  • Loading branch information
cellio committed May 18, 2023
2 parents ca1989f + 1985acd commit 7af570b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/markdown.js
Expand Up @@ -117,7 +117,7 @@ $(() => {

QPixel.addPrePostValidation(text => {
// This regex catches Markdown images with no or default alt text.
const altRegex = /!\[(?:Image alt text)?\](?:\(.+(?!\\\))\)|\[.+(?!\\\])\])/gi;
const altRegex = /!\[(?:Image_alt_text)?\](?:\(.+(?!\\\))\)|\[.+(?!\\\])\])/gi;
if (text.match(altRegex)) {
const message = `It looks like you're posting an image with no alt text. Alt text is important for ` +
`accessibility. Consider adding alt text to the images in your post - ` +
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/posts.js
Expand Up @@ -63,7 +63,7 @@ $(() => {

const $postField = $('.js-post-field');
const postText = $postField.val();
$postField.val(postText.replace(placeholder, `![Image alt text](${data.link})`));
$postField.val(postText.replace(placeholder, `![Image_alt_text](${data.link})`));
$tgt.parents('.modal').removeClass('is-active');
});

Expand Down

0 comments on commit 7af570b

Please sign in to comment.