Skip to content

Commit

Permalink
fix(Path View): 🐛 For real, don't try querySelect a non-existent sele…
Browse files Browse the repository at this point in the history
…ctor
  • Loading branch information
SkepticMystic committed Nov 24, 2021
1 parent 72b0243 commit 6853d4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
9 changes: 6 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50223,12 +50223,15 @@ class BCPlugin extends obsidian.Plugin {
debugGroupEnd(settings, "debugMode");
return;
}
const elForMaxWidth = mode === "preview"
const selectorForMaxWidth = mode === "preview"
? ".markdown-preview-view.is-readable-line-width .markdown-preview-sizer"
: "";
const max_width = elForMaxWidth !== ""
? getComputedStyle(document.querySelector(elForMaxWidth)).getPropertyValue("max-width")
const elForMaxWidth = selectorForMaxWidth !== ""
? document.querySelector(selectorForMaxWidth)
: null;
const max_width = elForMaxWidth
? getComputedStyle(elForMaxWidth).getPropertyValue("max-width")
: "100%";
const trailDiv = createDiv({
cls: `BC-trail ${respectReadableLineLength
? "is-readable-line-width markdown-preview-sizer markdown-preview-section"
Expand Down
13 changes: 7 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1236,17 +1236,18 @@ export default class BCPlugin extends Plugin {
return;
}

const elForMaxWidth =
const selectorForMaxWidth =
mode === "preview"
? ".markdown-preview-view.is-readable-line-width .markdown-preview-sizer"
: "";

const max_width =
elForMaxWidth !== ""
? getComputedStyle(
document.querySelector(elForMaxWidth)
).getPropertyValue("max-width")
const elForMaxWidth =
selectorForMaxWidth !== ""
? document.querySelector(selectorForMaxWidth)
: null;
const max_width = elForMaxWidth
? getComputedStyle(elForMaxWidth).getPropertyValue("max-width")
: "100%";

const trailDiv = createDiv({
cls: `BC-trail ${
Expand Down

0 comments on commit 6853d4c

Please sign in to comment.