2017-11-06 20:57:02 +08:00
|
|
|
import fs from 'fs';
|
|
|
|
import path from 'path';
|
2017-11-05 03:50:26 +08:00
|
|
|
|
2017-11-06 20:57:02 +08:00
|
|
|
let style = null;
|
2017-11-05 03:50:26 +08:00
|
|
|
|
|
|
|
export function activate() {
|
2017-11-06 20:57:02 +08:00
|
|
|
return AppEnv.commands.add(document.body, 'window:toggle-screenshot-mode', () => {
|
2017-11-05 03:50:26 +08:00
|
|
|
if (!style) {
|
2017-11-06 20:57:02 +08:00
|
|
|
style = document.createElement('style');
|
|
|
|
style.innerText = fs
|
|
|
|
.readFileSync(path.join(__dirname, '..', 'assets', 'font-override.css'))
|
|
|
|
.toString();
|
2017-11-05 03:50:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (style.parentElement) {
|
2017-11-06 20:57:02 +08:00
|
|
|
document.body.removeChild(style);
|
|
|
|
} else {
|
|
|
|
document.body.appendChild(style);
|
2017-11-05 03:50:26 +08:00
|
|
|
}
|
2017-11-06 20:57:02 +08:00
|
|
|
});
|
2017-11-05 03:50:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function deactivate() {
|
|
|
|
if (style && style.parentElement) {
|
2017-11-06 20:57:02 +08:00
|
|
|
return document.body.removeChild(style);
|
2017-11-05 03:50:26 +08:00
|
|
|
}
|
2017-11-06 20:57:02 +08:00
|
|
|
}
|