fix(dev-tools): use app root in getDocument()

This commit is contained in:
vakrilov
2019-11-04 11:10:37 +02:00
parent e11bfd4c68
commit cf32428f52
3 changed files with 20 additions and 10 deletions

View File

@ -5,7 +5,7 @@ import { ViewBase } from "../ui/core/view-base";
import { mainThreadify } from "../utils/utils";
// Use lazy requires for core modules
const frameTopmost = () => require("../ui/frame").topmost();
const getAppRootView = () => require("../application").getRootView();
let unsetValue;
function unsetViewValue(view, name) {
@ -27,19 +27,19 @@ function getViewById(nodeId: number): ViewBase {
}
export function getDocument() {
const topMostFrame = frameTopmost();
if (!topMostFrame) {
const appRoot = getAppRootView();
if (!appRoot) {
return undefined;
}
try {
topMostFrame.ensureDomNode();
appRoot.ensureDomNode();
} catch (e) {
console.log("ERROR in getDocument(): " + e);
}
return topMostFrame.domNode.toObject();
return appRoot.domNode.toObject();
}
export function getComputedStylesForNode(nodeId): Array<{ name: string, value: string }> {