mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-06 10:54:07 +08:00
update files
This commit is contained in:
parent
4f14ea227b
commit
00468606af
@ -1053,30 +1053,9 @@ AnsiTerminal.prototype.toString = function (type){
|
||||
stylesBuffer[i][j].value = node.value;
|
||||
}
|
||||
|
||||
if (styleBuffer.foreground) {
|
||||
style += 'color:' + styleBuffer.foreground + ';';
|
||||
}
|
||||
|
||||
if (styleBuffer.background) {
|
||||
style += 'background-color:' + styleBuffer.background + ';';
|
||||
}
|
||||
|
||||
if (styleBuffer.bold) {
|
||||
style += 'font-weight:bold;';
|
||||
}
|
||||
|
||||
if (styleBuffer.italic) {
|
||||
style += 'font-style: italic;';
|
||||
}
|
||||
|
||||
if (styleBuffer.underline) {
|
||||
style += 'text-decoration: underline;';
|
||||
}
|
||||
|
||||
if (j === 0) {
|
||||
style = htmlStyle(styleBuffer);
|
||||
s += '<span' + (style ? ' style="' + style + '"' : '') + '>';
|
||||
|
||||
style = '';
|
||||
attrCache = node.attr;
|
||||
} else if (j === cols - 1) {
|
||||
s += '</span>';
|
||||
@ -1084,9 +1063,8 @@ AnsiTerminal.prototype.toString = function (type){
|
||||
|
||||
if (node.value) {
|
||||
if (node.attr !== attrCache) {
|
||||
style = htmlStyle(styleBuffer);
|
||||
s += '</span><span' + (style ? ' style="' + style + '"' : '') + '>';
|
||||
|
||||
style = '';
|
||||
attrCache = node.attr;
|
||||
}
|
||||
|
||||
@ -2762,3 +2740,34 @@ function styles(node){
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* html style
|
||||
* @param styles
|
||||
* @returns {string}
|
||||
*/
|
||||
function htmlStyle(styles){
|
||||
var style = '';
|
||||
|
||||
if (styles.foreground) {
|
||||
style += 'color:' + styles.foreground + ';';
|
||||
}
|
||||
|
||||
if (styles.background) {
|
||||
style += 'background-color:' + styles.background + ';';
|
||||
}
|
||||
|
||||
if (styles.bold) {
|
||||
style += 'font-weight:bold;';
|
||||
}
|
||||
|
||||
if (styles.italic) {
|
||||
style += 'font-style: italic;';
|
||||
}
|
||||
|
||||
if (styles.underline) {
|
||||
style += 'text-decoration: underline;';
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user