Skip to content

Commit 5879892

Browse files
committed
Use the fileViewModel to get the current path
instead of extracting it from the dom
1 parent b36779c commit 5879892

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

octoprint_gcodethumbs/static/js/gcode-preview-viewmodel.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ $(function() {
8888
}
8989

9090
function enrichWithPreview(element) {
91-
const pathEl = document.querySelector('.back-path [data-bind*=currentPath]');
92-
let path = pathEl? pathEl.innerText+'/' : '';
93-
if (path == '/') path = '';
94-
const filename = path+extractKey(element);
91+
const path = self.filesViewModel.currentPath();
92+
const prefix = path ? path+'/' : '';
93+
const filename = prefix + extractKey(element);
9594

9695
if (previews[filename]) {
9796
insertAfter(previews[filename].canvas, element.querySelector('.title'));

0 commit comments

Comments
 (0)