mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Translate automatically hterm css class in config
Change css class name in config after plugin decoration for partial backward compatibility
This commit is contained in:
parent
a9bb9b697b
commit
df68daaaba
2 changed files with 20 additions and 1 deletions
|
|
@ -106,3 +106,20 @@ const checkDeprecatedConfig = function () {
|
|||
const deprecatedStr = deprecated.join(', ');
|
||||
notify('Configuration warning', `Your configuration uses some deprecated CSS classes (${deprecatedStr})`)
|
||||
}
|
||||
|
||||
exports.htermConfigTranslate = (config) => {
|
||||
const cssReplacements = {
|
||||
'x-screen x-row([ \{\.\[])': '.xterm-rows > div$1',
|
||||
'.cursor-node([ \{\.\[])': '.terminal-cursor$1',
|
||||
'::selection([ \{\.\[])': '.terminal .xterm-selection div$1',
|
||||
'x-screen a([ \{\.\[])': '.terminal a$1',
|
||||
'x-row a([ \{\.\[])': '.terminal a$1'
|
||||
}
|
||||
Object.keys(cssReplacements).forEach(pattern => {
|
||||
const searchvalue = new RegExp(pattern, 'g');
|
||||
const newvalue = cssReplacements[pattern];
|
||||
config.css = config.css.replace(searchvalue, newvalue);
|
||||
config.termCSS = config.termCSS.replace(searchvalue, newvalue);
|
||||
})
|
||||
return config;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,7 +332,9 @@ exports.getDecoratedEnv = function (baseEnv) {
|
|||
|
||||
exports.getDecoratedConfig = function () {
|
||||
const baseConfig = config.getConfig();
|
||||
return decorateObject(baseConfig, 'decorateConfig');
|
||||
const decoratedConfig = decorateObject(baseConfig, 'decorateConfig');
|
||||
const translatedConfig = config.htermConfigTranslate(decoratedConfig);
|
||||
return translatedConfig;
|
||||
};
|
||||
|
||||
exports.getDecoratedBrowserOptions = function (defaults) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue