0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-19 14:41:32 +00:00

Improved loading for images with failed thumbnails

- A placeholder is now shown in the gallery.
- The page editors will use the original image url if the display
  thumbnail is missing.

For 
This commit is contained in:
Dan Brown 2022-01-10 18:12:11 +00:00
parent 4239d4c54d
commit 941217d9fb
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
5 changed files with 11 additions and 4 deletions
resources/js/components

View 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);