Skip to content

Commit

Permalink
TinyMCE: replace ternary with optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
lbradley-mm committed Sep 26, 2024
1 parent 2f8128b commit ce3a503
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/dist/tinymce.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/tinymce.js.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions client/src/js/TinyMCE_ssmedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ import { transformationStringFromObject, Cloudinary } from "@cloudinary/url-gen"
*/
insertImageHandler(response) {
const asset = response.assets[0];
console.log('insertImageHandler', asset);
if (asset.resource_type !== 'image') {
throw `Resource type of [${asset.resource_type}] is not supported`;
}
Expand All @@ -113,9 +112,9 @@ console.log('insertImageHandler', asset);
}

// Copied same logic from `API::extractDescription()`
const defaultAltText = asset.context && asset.context.custom && asset.context.custom.alt ? asset.context.custom.alt : '';
const defaultAltText = asset.context?.custom?.alt;
// Copied same logic from `API::extractTitle()`
const defaultTitle = asset.context && asset.context.custom && asset.context.custom.alt ? asset.context.custom.caption : '';
const defaultTitle = asset.context?.custom?.caption;

const altText = prompt('Description', defaultAltText);
const titleText = prompt('Title', defaultTitle);
Expand Down

0 comments on commit ce3a503

Please sign in to comment.