mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-03-03 18:58:01 +03:00
Fix support for Firefox
This commit is contained in:
parent
44a1a467a7
commit
8a58a2b906
|
@ -36,20 +36,25 @@ function openInEditor(editor, path, stackFrame) {
|
||||||
|
|
||||||
export default function openFile(fileName, lineNumber, stackFrame) {
|
export default function openFile(fileName, lineNumber, stackFrame) {
|
||||||
if (process.env.NODE_ENV === 'development') console.log(fileName, lineNumber, stackFrame); // eslint-disable-line no-console
|
if (process.env.NODE_ENV === 'development') console.log(fileName, lineNumber, stackFrame); // eslint-disable-line no-console
|
||||||
if (!chrome || !chrome.storage || !chrome.storage.sync) return; // TODO: Pass editor settings for using outside of browser extension
|
if (!chrome || !chrome.storage) return; // TODO: Pass editor settings for using outside of browser extension
|
||||||
if (chrome && chrome.storage && chrome.storage.sync) {
|
const isFF = navigator.userAgent.indexOf('Firefox') !== -1;
|
||||||
chrome.storage.sync.get(['useEditor', 'editor', 'projectPath'], function({ useEditor, editor, projectPath }) {
|
const storage = isFF ? chrome.storage.local : chrome.storage.sync || chrome.storage.local;
|
||||||
if (useEditor && projectPath && typeof editor === 'string' && /^\w{1,30}$/.test(editor)) {
|
storage.get(['useEditor', 'editor', 'projectPath'], function({ useEditor, editor, projectPath }) {
|
||||||
openInEditor(editor, projectPath, stackFrame);
|
if (useEditor && projectPath && typeof editor === 'string' && /^\w{1,30}$/.test(editor)) {
|
||||||
} else {
|
openInEditor(editor, projectPath, stackFrame);
|
||||||
if (chrome.devtools && chrome.devtools.panels && chrome.devtools.panels.openResource) {
|
} else {
|
||||||
openResource(fileName, lineNumber, stackFrame);
|
if (chrome.devtools && chrome.devtools.panels && chrome.devtools.panels.openResource) {
|
||||||
} else if (chrome.runtime && chrome.runtime.openOptionsPage) {
|
openResource(fileName, lineNumber, stackFrame);
|
||||||
if (confirm('Set the editor to open the file in?')) {
|
} else if (chrome.runtime && (chrome.runtime.openOptionsPage || isFF)) {
|
||||||
chrome.runtime.openOptionsPage();
|
if (chrome.devtools && isFF) {
|
||||||
}
|
chrome.devtools.inspectedWindow.eval('confirm("Set the editor to open the file in?")', result => {
|
||||||
|
if (!result) return;
|
||||||
|
chrome.runtime.sendMessage({ type: 'OPEN_OPTIONS' });
|
||||||
|
});
|
||||||
|
} else if (confirm('Set the editor to open the file in?')) {
|
||||||
|
chrome.runtime.openOptionsPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user