@wordpress/block-editor
Version:
18 lines (17 loc) • 566 B
JavaScript
// packages/block-editor/src/utils/get-editor-region.js
function getEditorRegion(editor) {
if (!editor) {
return null;
}
const editorCanvas = Array.from(
document.querySelectorAll('iframe[name="editor-canvas"]').values()
).find((iframe) => {
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
return iframeDocument === editor.ownerDocument;
}) ?? editor;
return editorCanvas?.closest('[role="region"]') ?? editorCanvas;
}
export {
getEditorRegion as default
};
//# sourceMappingURL=get-editor-region.js.map