mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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 => {
|
this.overrideCellFn = (rowNumber, columnId, value?, data?): string => {
|
||||||
let returnVal = '';
|
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)) {
|
if (Services.DBCellValue.isDBCellValue(value)) {
|
||||||
returnVal = value.displayValue;
|
returnVal = this.spacefyLinebreaks(value.displayValue);
|
||||||
} else if (typeof value === 'string') {
|
} else if (typeof value === 'string') {
|
||||||
returnVal = value;
|
returnVal = this.spacefyLinebreaks(value);
|
||||||
}
|
}
|
||||||
return returnVal;
|
return returnVal;
|
||||||
};
|
};
|
||||||
@@ -406,6 +408,13 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
|
|||||||
this.refreshGrid();
|
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> {
|
private refreshGrid(): Thenable<void> {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user