@salesforcedevs/docs-components 1.29.0-toolbar-alpha3 → 1.30.0-fix-alpha
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 +1 -1
- package/src/modules/doc/amfReference/amfReference.ts +1 -10
- package/src/modules/doc/contentActionToolbar/contentActionToolbar.html +1 -1
- package/src/modules/doc/contentActionToolbar/contentActionToolbar.ts +22 -22
- package/src/modules/doc/contentLayout/contentLayout.ts +1 -1
package/package.json
CHANGED
|
@@ -73,16 +73,7 @@ export default class AmfReference extends LightningElement {
|
|
|
73
73
|
return this.isSpecBasedReference(this._currentReferenceId);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
* Content action toolbar is only enabled for markdown-based references in the en-us locale.
|
|
78
|
-
*/
|
|
79
|
-
get showContentActionToolbar(): boolean {
|
|
80
|
-
if (this.showSpecBasedReference) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
const locale = this.language?.toLowerCase() ?? "en-us";
|
|
84
|
-
return locale === "en-us";
|
|
85
|
-
}
|
|
76
|
+
@api showContentActionToolbar = false;
|
|
86
77
|
|
|
87
78
|
@api
|
|
88
79
|
get referenceSetConfig(): ReferenceSetConfig {
|
|
@@ -3,7 +3,7 @@ import { track } from "dxUtils/analytics";
|
|
|
3
3
|
|
|
4
4
|
const DEFAULT_COPY_TOOLTIP_LABEL = "Click to copy";
|
|
5
5
|
const COPIED_TOOLTIP_LABEL = "Copied!";
|
|
6
|
-
const COPIED_TOOLTIP_RESET_MS =
|
|
6
|
+
const COPIED_TOOLTIP_RESET_MS = 1000;
|
|
7
7
|
|
|
8
8
|
const ANALYTICS_CONTENT_CATEGORY = "content action toolbar";
|
|
9
9
|
const COPY_MARKDOWN_LABEL = "Copy as Markdown";
|
|
@@ -20,7 +20,6 @@ export default class ContentActionToolbar extends LightningElement {
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
this._pageUrl = value;
|
|
23
|
-
this.markdownUrl = this.deriveMarkdownUrl();
|
|
24
23
|
}
|
|
25
24
|
private _pageUrl?: string;
|
|
26
25
|
|
|
@@ -29,7 +28,27 @@ export default class ContentActionToolbar extends LightningElement {
|
|
|
29
28
|
|
|
30
29
|
private copyTooltipResetTimeout: number | null = null;
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Returns the `.md` equivalent of `pageUrl` with any hash and query
|
|
33
|
+
* string stripped, or `null` when `pageUrl` is not set or does not end
|
|
34
|
+
* with `.html`.
|
|
35
|
+
*/
|
|
36
|
+
get markdownUrl(): string | null {
|
|
37
|
+
if (!this.pageUrl) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const url = new URL(this.pageUrl, window.location.href);
|
|
42
|
+
url.hash = "";
|
|
43
|
+
url.search = "";
|
|
44
|
+
|
|
45
|
+
if (!url.pathname.endsWith(".html")) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
url.pathname = url.pathname.replace(/\.html$/, ".md");
|
|
50
|
+
return url.toString();
|
|
51
|
+
}
|
|
33
52
|
|
|
34
53
|
get copyMarkdownButtonText(): string {
|
|
35
54
|
return COPY_MARKDOWN_LABEL;
|
|
@@ -118,25 +137,6 @@ export default class ContentActionToolbar extends LightningElement {
|
|
|
118
137
|
});
|
|
119
138
|
}
|
|
120
139
|
|
|
121
|
-
/**
|
|
122
|
-
* Returns the `.md` equivalent of the current page URL with any hash and
|
|
123
|
-
* query string stripped, or `null` when the current page does not end
|
|
124
|
-
* with `.html`.
|
|
125
|
-
*/
|
|
126
|
-
private deriveMarkdownUrl(): string | null {
|
|
127
|
-
const sourceHref = this._pageUrl || window.location.href;
|
|
128
|
-
const url = new URL(sourceHref, window.location.href);
|
|
129
|
-
url.hash = "";
|
|
130
|
-
url.search = "";
|
|
131
|
-
|
|
132
|
-
if (!url.pathname.endsWith(".html")) {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
url.pathname = url.pathname.replace(/\.html$/, ".md");
|
|
137
|
-
return url.toString();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
140
|
private flashCopied(labelKey: "copyMarkdownLabel" | "copyUrlLabel") {
|
|
141
141
|
if (this.copyTooltipResetTimeout !== null) {
|
|
142
142
|
window.clearTimeout(this.copyTooltipResetTimeout);
|
|
@@ -289,7 +289,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
289
289
|
* after the first H1 found inside this layout.
|
|
290
290
|
*/
|
|
291
291
|
protected updateContentActionToolbar(): void {
|
|
292
|
-
if (!this.showContentActionToolbar) {
|
|
292
|
+
if (!this.showContentActionToolbar || !this.sidebarValue) {
|
|
293
293
|
this.removeContentActionToolbar();
|
|
294
294
|
return;
|
|
295
295
|
}
|