mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
Maddy/newline overrides edit data (#5364)
* formatting it before displaying * replace with space * added comments and method to handle the line break space conversion
This commit is contained in:
@@ -177,10 +177,12 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
|
||||
|
||||
this.overrideCellFn = (rowNumber, columnId, value?, data?): string => {
|
||||
let returnVal = '';
|
||||
// replace the line breaks with space since the edit text control cannot
|
||||
// render line breaks and strips them, updating the value.
|
||||
if (Services.DBCellValue.isDBCellValue(value)) {
|
||||
returnVal = value.displayValue;
|
||||
returnVal = this.spacefyLinebreaks(value.displayValue);
|
||||
} else if (typeof value === 'string') {
|
||||
returnVal = value;
|
||||
returnVal = this.spacefyLinebreaks(value);
|
||||
}
|
||||
return returnVal;
|
||||
};
|
||||
@@ -406,6 +408,13 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
|
||||
this.refreshGrid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the line breaks with space.
|
||||
*/
|
||||
private spacefyLinebreaks(inputStr: string): string {
|
||||
return inputStr.replace(/(\r\n|\n|\r)/g, ' ');
|
||||
}
|
||||
|
||||
private refreshGrid(): Thenable<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const self = this;
|
||||
|
||||
Reference in New Issue
Block a user