Skip to content

Commit 5af193b

Browse files
authored
Add ids for divs for side-by-side component viewer (#875)
Add an id attribute for divs when presented side-by-side in the component viewer. This makes it easier to differentiate the two when debugging. Fixes #511
1 parent 9f4494a commit 5af193b

File tree

1 file changed

+6
-3
lines changed
  • packages/tools/webpack-component-loader/src

1 file changed

+6
-3
lines changed

packages/tools/webpack-component-loader/src/loader.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,14 @@ function getUrlResolver(options: IRouteOptions): IUrlResolver {
176176
}
177177

178178
// Invoked by `start()` when the 'double' option is enabled to create the side-by-side panes.
179-
function makeSideBySideDiv() {
179+
function makeSideBySideDiv(divId?: string) {
180180
const div = document.createElement("div");
181181
div.style.flexGrow = "1";
182182
div.style.border = "1px solid lightgray";
183183
div.style.position = "relative"; // Make the new <div> a CSS stacking context.
184+
if (divId) {
185+
div.id = divId;
186+
}
184187
return div;
185188
}
186189

@@ -223,8 +226,8 @@ export async function start(
223226
let leftDiv: HTMLDivElement;
224227
let rightDiv: HTMLDivElement;
225228
if (double) {
226-
leftDiv = makeSideBySideDiv();
227-
rightDiv = makeSideBySideDiv();
229+
leftDiv = makeSideBySideDiv("sbs-left");
230+
rightDiv = makeSideBySideDiv("sbs-right");
228231
div.append(leftDiv, rightDiv);
229232
}
230233

0 commit comments

Comments
 (0)