@salesforcedevs/docs-components 1.31.0-md-alpha → 1.31.0-md-alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.31.0-md-alpha",
3
+ "version": "1.31.0-md-alpha2",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -9,9 +9,7 @@ import { buildDocLinkClickHandler } from "dxUtils/analytics";
9
9
  import ContentActionToolbar from "doc/contentActionToolbar";
10
10
 
11
11
  const CONTENT_ACTION_TOOLBAR_TAG = "doc-content-action-toolbar";
12
- const PAGE_HEADING_SELECTOR = "h1";
13
- const FALLBACK_HEADING_SELECTOR = "h1, h2, h3, h4, h5, h6";
14
- const CONTENT_BODY_SELECTOR = ".content-body-container .content-body";
12
+ const PAGE_HEADING_SELECTOR = "h1, doc-heading";
15
13
 
16
14
  type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
17
15
 
@@ -288,8 +286,8 @@ export default class ContentLayout extends LightningElement {
288
286
 
289
287
  /**
290
288
  * Inserts the content action toolbar into the slotted content immediately
291
- * after the first H1 found inside this layout, falling back to the first
292
- * heading of any level if no H1 exists.
289
+ * after the first heading (any level) found inside the content body. This is
290
+ * the page's H1 when present, otherwise the first heading in document order.
293
291
  */
294
292
  protected updateContentActionToolbar(): void {
295
293
  if (!this.showContentActionToolbar || !this.sidebarValue) {
@@ -297,21 +295,11 @@ export default class ContentLayout extends LightningElement {
297
295
  return;
298
296
  }
299
297
 
300
- const contentBody = querySelector(
301
- CONTENT_BODY_SELECTOR,
298
+ const heading = querySelector(
299
+ PAGE_HEADING_SELECTOR,
302
300
  this.template.host
303
301
  ) as HTMLElement | null;
304
302
 
305
- if (!contentBody) {
306
- return;
307
- }
308
-
309
- const heading = (querySelector(PAGE_HEADING_SELECTOR, contentBody) ??
310
- querySelector(
311
- FALLBACK_HEADING_SELECTOR,
312
- contentBody
313
- )) as HTMLElement | null;
314
-
315
303
  if (!heading) {
316
304
  return;
317
305
  }