@salesforcedevs/dx-components 1.28.4 → 1.28.5

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/dx-components",
3
- "version": "1.28.4",
3
+ "version": "1.28.5",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -44,5 +44,5 @@
44
44
  "luxon": "3.4.4",
45
45
  "msw": "^2.12.4"
46
46
  },
47
- "gitHead": "d11123799036226e3b1f23d80cfee54897126dd1"
47
+ "gitHead": "2fa9927fc99914ec55e4f8322cec0b8b95d31a68"
48
48
  }
@@ -34,6 +34,7 @@ export default class CodeBlock extends LightningElement {
34
34
  private _codeBlockRendered: boolean = false;
35
35
  private _showLoadingIndicator: boolean = false;
36
36
  private _isCbHeightCalculated: boolean = false;
37
+ private _plainCodeForCopy: string = "";
37
38
  private markupLangs = ["visualforce", "html", "xml"];
38
39
  private componentLoaded: boolean = false;
39
40
  private showLanguageDropdown: boolean = false;
@@ -290,6 +291,9 @@ export default class CodeBlock extends LightningElement {
290
291
  );
291
292
  }
292
293
  }
294
+ // Get the plain code for copy functionality
295
+ const codeElement = this.template.querySelector("code");
296
+ this._plainCodeForCopy = codeElement?.textContent?.trim() ?? "";
293
297
  // Add line numbers to each line
294
298
  this.addLineNumbers();
295
299
  }
@@ -328,12 +332,8 @@ export default class CodeBlock extends LightningElement {
328
332
  });
329
333
 
330
334
  try {
331
- const snippetContainer: HTMLElement | null =
332
- this.template.querySelector(".code-block-content");
333
- if (snippetContainer && snippetContainer.textContent) {
334
- await navigator.clipboard.writeText(
335
- snippetContainer.textContent
336
- );
335
+ if (this._plainCodeForCopy) {
336
+ await navigator.clipboard.writeText(this._plainCodeForCopy);
337
337
  this.copyBtnText = "Copied!";
338
338
  setTimeout(() => {
339
339
  this.copyBtnText = "Click to copy";