mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 09:35:37 -05:00
Fix Query formatting in copied html formatted query (#13633)
* Fix Query formatting in html formatted query * Changed font sizes to match Kusto Explorer Co-authored-by: Monica Gupta <mogupt@microsoft.com>
This commit is contained in:
@@ -157,7 +157,7 @@ export class CopyQueryWithResultsKeyboardAction extends Action {
|
||||
let resultSummary = queryRunner.batchSets[0].resultSetSummaries[i];
|
||||
let result = await queryRunner.getQueryRows(0, resultSummary.rowCount, resultSummary.batchId, resultSummary.id);
|
||||
let tableHeaders = resultSummary.columnInfo.map((col, i) => (col.columnName));
|
||||
let htmlTableHeaders = `<thead><tr style="background-color:DarkGray">${resultSummary.columnInfo.map((col, i) => (`<th style="border:1.0px solid black;padding:3pt;font-size:9pt;font-weight: bold;">${escape(col.columnName)}</th>`)).join('')}</tr></thead>`;
|
||||
let htmlTableHeaders = `<thead><tr style="background-color:DarkGray">${resultSummary.columnInfo.map((col, i) => (`<th style="border:1.0pt solid black;padding:3pt;font-size:9pt;font-weight: bold;">${escape(col.columnName)}</th>`)).join('')}</tr></thead>`;
|
||||
let copyString = '\n';
|
||||
let htmlCopyString = '';
|
||||
|
||||
@@ -166,7 +166,7 @@ export class CopyQueryWithResultsKeyboardAction extends Action {
|
||||
for (let colIdx = 0; colIdx < rowEntry.length; colIdx++) {
|
||||
let value = rowEntry[colIdx].displayValue;
|
||||
copyString = `${copyString}${value}\t`;
|
||||
htmlCopyString = `${htmlCopyString}<td style="border:1.0px solid black;padding:3pt;font-size:9pt;">${escape(value)}</td>`;
|
||||
htmlCopyString = `${htmlCopyString}<td style="border:1.0pt solid black;padding:3pt;font-size:9pt;">${escape(value)}</td>`;
|
||||
}
|
||||
// Removes the tab seperator from the end of a row
|
||||
copyString = copyString.slice(0, -1 * '\t'.length) + '\n';
|
||||
@@ -175,7 +175,7 @@ export class CopyQueryWithResultsKeyboardAction extends Action {
|
||||
|
||||
allResults = `${allResults}${tableHeaders.join('\t')}${copyString}\n`;
|
||||
allHtmlResults = `${allHtmlResults}<div><br/><br/>
|
||||
<table cellPadding="5" cellSpacing="1" style="border:1;border-color:Black;font-family:Segoe UI;font-size:12px;border-collapse:collapse">
|
||||
<table cellPadding="5" cellSpacing="1" style="border:1;border-color:Black;font-family:Segoe UI;font-size:9pt;border-collapse:collapse">
|
||||
${htmlTableHeaders}${htmlCopyString}
|
||||
</table></div>`;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ export class CopyQueryWithResultsKeyboardAction extends Action {
|
||||
|
||||
let data = {
|
||||
text: `${queryText}\n\n${allResults.text}`,
|
||||
html: `${escape(queryText).replace(/\r\n|\n|\r/gm, '<br />')}${allResults.html}`
|
||||
html: `<div style="font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 10pt;">${escape(queryText).replace(/\r\n|\n|\r/gm, '<br/>')}</div>${allResults.html}`
|
||||
};
|
||||
|
||||
await this._clipboardService.write(data);
|
||||
|
||||
Reference in New Issue
Block a user