some lib fixes
This commit is contained in:
@@ -9,6 +9,26 @@ const LEGACY_GATING_KEY = "cmajghqmadhnadjcjhamajdhda";
|
||||
|
||||
const bundled = require("./jibo-sdk");
|
||||
|
||||
function registerPulsarUriOpeners() {
|
||||
try {
|
||||
if (typeof atom === "undefined" || !atom.workspace || typeof atom.workspace.addOpener !== "function") return;
|
||||
|
||||
atom.workspace.addOpener((uri) => {
|
||||
if (uri === "atom://jibo-cheat-sheet") {
|
||||
const CheatSheetTab = require("./cheat-sheet/cheat-sheat-tab");
|
||||
return new CheatSheetTab();
|
||||
}
|
||||
if (uri === "atom://atom-react-styleguide") {
|
||||
const StyleguideEditor = require("./atom-react/styleguide/styleguide-editor");
|
||||
return new StyleguideEditor();
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
} catch (_) {
|
||||
// Best-effort only.
|
||||
}
|
||||
}
|
||||
|
||||
function forceLegacyLoginFlag() {
|
||||
try {
|
||||
if (typeof globalThis !== "undefined" && globalThis.localStorage) {
|
||||
@@ -23,7 +43,9 @@ if (bundled && typeof bundled.activate === "function") {
|
||||
const originalActivate = bundled.activate.bind(bundled);
|
||||
bundled.activate = function activate(state) {
|
||||
forceLegacyLoginFlag();
|
||||
return originalActivate(state);
|
||||
const result = originalActivate(state);
|
||||
registerPulsarUriOpeners();
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user