Skip to content

Commit

Permalink
Merge branch '1' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Apr 3, 2023
2 parents 48c64d4 + 4e27352 commit 7614c29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_ssmedia.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions client/src/entwine/TinyMCE_ssmedia_sizepressets.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ function presetButton(editor, preset) {
* @returns {HTMLElement|undefined}
*/
const image = () => {
const img = editor.selection.getNode();
let img = editor.selection.getNode();
if (img.tagName !== 'IMG' && img.children.item('img')) {
img = img.children.item('img');
}
return img && img.tagName === 'IMG' ? img : undefined;
};

Expand Down Expand Up @@ -89,7 +92,9 @@ function presetButton(editor, preset) {
if (formatMatches()) {
editor.formatter.apply(formatName);
const img = image();
img.setAttribute('width', width || img.naturalWidth);
if (img) {
img.setAttribute('width', width || img.naturalWidth);
}
}
}
};
Expand Down

0 comments on commit 7614c29

Please sign in to comment.