]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/markdown-editor.js
Improved loading for images with failed thumbnails
[bookstack] / resources / js / components / markdown-editor.js
index a90f74e2746401562f59c03cea0b8824298f9dc8..def3db5af864f30cd6f321d2f47c80240b9b1dd1 100644 (file)
@@ -395,8 +395,9 @@ class MarkdownEditor {
     actionInsertImage() {
         const cursorPos = this.cm.getCursor('from');
         window.ImageManager.show(image => {
+            const imageUrl = image.thumbs.display || image.url;
             let selectedText = this.cm.getSelection();
-            let newText = "[![" + (selectedText || image.name) + "](" + image.thumbs.display + ")](" + image.url + ")";
+            let newText = "[![" + (selectedText || image.name) + "](" + imageUrl + ")](" + image.url + ")";
             this.cm.focus();
             this.cm.replaceSelection(newText);
             this.cm.setCursor(cursorPos.line, cursorPos.ch + newText.length);