提交 d02d73f4 编写于 作者: M Martin Aeschlimann

Prevent new lines in after/before decorator content. Fixes #18646

上级 76117153
...@@ -305,12 +305,14 @@ class DecorationRenderHelper { ...@@ -305,12 +305,14 @@ class DecorationRenderHelper {
if (typeof opts !== 'undefined') { if (typeof opts !== 'undefined') {
DecorationRenderHelper.collectBorderSettingsCSSText(opts, cssTextArr); DecorationRenderHelper.collectBorderSettingsCSSText(opts, cssTextArr);
if (typeof opts.contentIconPath === 'string') { if (typeof opts.contentIconPath === 'string') {
cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, URI.file(opts.contentIconPath).toString())); cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, URI.file(opts.contentIconPath).toString().replace(/'/g, '%27')));
} else if (opts.contentIconPath instanceof URI) { } else if (opts.contentIconPath instanceof URI) {
cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, opts.contentIconPath.toString(true).replace(/'/g, '%27'))); cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, opts.contentIconPath.toString(true).replace(/'/g, '%27')));
} }
if (typeof opts.contentText !== 'undefined') { if (typeof opts.contentText === 'string') {
const escaped = opts.contentText.replace(/'/g, '\\\''); const truncated = opts.contentText.match(/^.*$/m)[0]; // only take first line
const escaped = truncated.replace(/'\\/g, '\\$&');
cssTextArr.push(strings.format(this._CSS_MAP.contentText, escaped)); cssTextArr.push(strings.format(this._CSS_MAP.contentText, escaped));
} }
DecorationRenderHelper.collectCSSText(opts, ['textDecoration', 'color', 'backgroundColor', 'margin'], cssTextArr); DecorationRenderHelper.collectCSSText(opts, ['textDecoration', 'color', 'backgroundColor', 'margin'], cssTextArr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册