Color preview in one line and bug fixing
This commit is contained in:
parent
df2cf98b22
commit
f33b15bfa0
@ -36,7 +36,7 @@ const REPLHistory: NextPage<REPLHistoryParams> = ({history, inputRef}) => {
|
|||||||
while (idxStart !== -1 && idxSep !== -1 && idxEnd !== -1) {
|
while (idxStart !== -1 && idxSep !== -1 && idxEnd !== -1) {
|
||||||
const linkText = line.substring(idxStart+2, idxSep);
|
const linkText = line.substring(idxStart+2, idxSep);
|
||||||
const linkHref = line.substring(idxSep+1, idxEnd);
|
const linkHref = line.substring(idxSep+1, idxEnd);
|
||||||
const isLocal = linkHref.startsWith("https://c0ntroller.de") || linkHref.startsWith("/");
|
const isLocal = linkHref.startsWith("https://c0ntroller.de") || linkHref.startsWith("/") || linkHref.startsWith("#");
|
||||||
|
|
||||||
result.push(line.substring(0, idxStart));
|
result.push(line.substring(0, idxStart));
|
||||||
result.push(<Link href={linkHref}><a className={styles.link} target={isLocal ? "_self" : "_blank"} rel={isLocal ? "" : "noreferrer"}>{linkText}</a></Link>);
|
result.push(<Link href={linkHref}><a className={styles.link} target={isLocal ? "_self" : "_blank"} rel={isLocal ? "" : "noreferrer"}>{linkText}</a></Link>);
|
||||||
@ -46,7 +46,9 @@ const REPLHistory: NextPage<REPLHistoryParams> = ({history, inputRef}) => {
|
|||||||
idxSep = line.indexOf("|", idxStart);
|
idxSep = line.indexOf("|", idxStart);
|
||||||
idxEnd = line.indexOf("}", idxSep);
|
idxEnd = line.indexOf("}", idxSep);
|
||||||
}
|
}
|
||||||
result.push(line.substring(idxEnd+1));
|
|
||||||
|
// Its already cut off
|
||||||
|
result.push(line);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,7 +72,9 @@ const REPLHistory: NextPage<REPLHistoryParams> = ({history, inputRef}) => {
|
|||||||
idxStart = line.indexOf("%{");
|
idxStart = line.indexOf("%{");
|
||||||
idxEnd = line.indexOf("}", idxStart);
|
idxEnd = line.indexOf("}", idxStart);
|
||||||
}
|
}
|
||||||
result.push(line.substring(idxEnd+1));
|
|
||||||
|
// Its already cut off
|
||||||
|
result.push(line);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -225,15 +225,16 @@ const color: Command = {
|
|||||||
window.document.documentElement.style.removeProperty("--repl-color-hint");
|
window.document.documentElement.style.removeProperty("--repl-color-hint");
|
||||||
return ["Color reset."];
|
return ["Color reset."];
|
||||||
} else {
|
} else {
|
||||||
|
let color: Color;
|
||||||
try {
|
try {
|
||||||
const color = Color(args.join().trim());
|
color = Color(args.join().trim());
|
||||||
window?.document.documentElement.style.setProperty("--repl-color", color.string());
|
|
||||||
window?.document.documentElement.style.setProperty("--repl-color-link", color.lighten(0.3).rgb().string());
|
|
||||||
window?.document.documentElement.style.setProperty("--repl-color-hint", color.fade(0.7).string());
|
|
||||||
} catch {
|
} catch {
|
||||||
return ["Invalid color!"];
|
return ["Invalid color!"];
|
||||||
}
|
}
|
||||||
return ["Color set.", "#{Link|https://google.de}.", "%{command}"];
|
window?.document.documentElement.style.setProperty("--repl-color", color.string());
|
||||||
|
window?.document.documentElement.style.setProperty("--repl-color-link", color.lighten(0.3).rgb().string());
|
||||||
|
window?.document.documentElement.style.setProperty("--repl-color-hint", color.fade(0.7).string());
|
||||||
|
return ["Color set | #{Link|#} | %{help}"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user