From 2cb437864973594e61ee045a0e37652fae0ae088 Mon Sep 17 00:00:00 2001 From: Emile Date: Mon, 17 Jan 2022 11:31:04 +0100 Subject: [PATCH] fix: Trail view in lp doesn't scroll with element, simpler solution --- src/Views/TrailView.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Views/TrailView.ts b/src/Views/TrailView.ts index 81357322..07109a15 100644 --- a/src/Views/TrailView.ts +++ b/src/Views/TrailView.ts @@ -163,12 +163,12 @@ export async function drawTrail(plugin: BCPlugin): Promise { : ""; const elForMaxWidth = - selectorForMaxWidth !== "" - ? document.querySelector(selectorForMaxWidth) - : null; + selectorForMaxWidth !== "" + ? document.querySelector(selectorForMaxWidth) + : null; const max_width = elForMaxWidth ? getComputedStyle(elForMaxWidth).getPropertyValue("max-width") - : "80%"; + : "100%"; const trailDiv = createDiv({ cls: `BC-trail ${ @@ -178,8 +178,9 @@ export async function drawTrail(plugin: BCPlugin): Promise { }`, attr: { style: - (mode !== "preview" ? `max-width: ${max_width};` : "") + - "margin: 0 auto", + (mode !== "preview" ? `max-width: ${max_width};` : "") + + "margin: 0 auto;", + }, }); @@ -188,10 +189,12 @@ export async function drawTrail(plugin: BCPlugin): Promise { if (mode === "preview") { view.querySelector("div.markdown-preview-sizer").before(trailDiv); } else { - const cmEditor = view.querySelector("div.cm-editor"); - const cmSizer = view.querySelector("div.CodeMirror-sizer"); - if (cmEditor) cmEditor.firstChild?.before(trailDiv); - if (cmSizer) cmSizer.before(trailDiv); + const cmEditor = view.querySelector("div.cm-contentContainer"); + // const cmSizer = view.querySelector("div.CodeMirror-sizer"); + if (cmEditor) { + cmEditor.firstChild?.before(trailDiv); + } + // if (cmSizer) cmSizer.before(trailDiv); } trailDiv.empty();