mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-22 19:29:17 +00:00
Fix CSS errors when using HTML escaped quotes
This commit is contained in:
@@ -198,6 +198,17 @@ function updateContent(c: EmbeddedRegion, content: string): string {
|
||||
if (!c.attributeValue && c.languageId === 'javascript') {
|
||||
return content.replace(`<!--`, `/* `).replace(`-->`, ` */`);
|
||||
}
|
||||
if (c.languageId === 'css') {
|
||||
const quoteEscape = /("|")/g;
|
||||
return content.replace(quoteEscape, (match, _, offset) => {
|
||||
const spaces = ' '.repeat(match.length - 1);
|
||||
const afterChar = content[offset + match.length];
|
||||
if (!afterChar || afterChar.includes(' ')) {
|
||||
return `${spaces}"`;
|
||||
}
|
||||
return `"${spaces}`;
|
||||
});
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user