UNPKG

2.4 kBSource Map (JSON)View Raw
1{"version":3,"sources":["@wordpress/block-library/src/embed/wp-embed-preview.js"],"names":["Component","createRef","withGlobalEvents","window","FocusEvent","WpEmbedPreview","arguments","checkFocus","bind","node","document","activeElement","tagName","parentNode","current","focusEvent","bubbles","dispatchEvent","html","props","__html","blur"],"mappings":";;;;;;;;AAAA;;;AAGA,SAASA,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;;;;cAIuBC,M;IAAfC,U,WAAAA,U;;IAEFC,c;;;;;AACL,4BAAc;AAAA;;AAAA;;AACb,yFAAUC,SAAV;AAEA,UAAKC,UAAL,GAAkB,MAAKA,UAAL,CAAgBC,IAAhB,uDAAlB;AACA,UAAKC,IAAL,GAAYR,SAAS,EAArB;AAJa;AAKb;AAED;;;;;;;;iCAIa;AAAA,sBACcS,QADd;AAAA,UACJC,aADI,aACJA,aADI;;AAGZ,UACCA,aAAa,CAACC,OAAd,KAA0B,QAA1B,IACAD,aAAa,CAACE,UAAd,KAA6B,KAAKJ,IAAL,CAAUK,OAFxC,EAGE;AACD;AACA;;AAED,UAAMC,UAAU,GAAG,IAAIX,UAAJ,CAAgB,OAAhB,EAAyB;AAAEY,QAAAA,OAAO,EAAE;AAAX,OAAzB,CAAnB;AACAL,MAAAA,aAAa,CAACM,aAAd,CAA6BF,UAA7B;AACA;;;6BAEQ;AAAA,UACAG,IADA,GACS,KAAKC,KADd,CACAD,IADA;AAER,aACC;AACC,QAAA,GAAG,EAAG,KAAKT,IADZ;AAEC,QAAA,SAAS,EAAC,yBAFX;AAGC,QAAA,uBAAuB,EAAG;AAAEW,UAAAA,MAAM,EAAEF;AAAV;AAH3B,QADD;AAOA;;;;EAnC2BlB,S;;AAsC7B,eAAeE,gBAAgB,CAAE;AAChCmB,EAAAA,IAAI,EAAE;AAD0B,CAAF,CAAhB,CAEVhB,cAFU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component, createRef } from '@wordpress/element';\nimport { withGlobalEvents } from '@wordpress/compose';\n\n/**\n * Browser dependencies\n */\n\nconst { FocusEvent } = window;\n\nclass WpEmbedPreview extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.checkFocus = this.checkFocus.bind( this );\n\t\tthis.node = createRef();\n\t}\n\n\t/**\n\t * Checks whether the wp embed iframe is the activeElement,\n\t * if it is dispatch a focus event.\n\t */\n\tcheckFocus() {\n\t\tconst { activeElement } = document;\n\n\t\tif (\n\t\t\tactiveElement.tagName !== 'IFRAME' ||\n\t\t\tactiveElement.parentNode !== this.node.current\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst focusEvent = new FocusEvent( 'focus', { bubbles: true } );\n\t\tactiveElement.dispatchEvent( focusEvent );\n\t}\n\n\trender() {\n\t\tconst { html } = this.props;\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ this.node }\n\t\t\t\tclassName=\"wp-block-embed__wrapper\"\n\t\t\t\tdangerouslySetInnerHTML={ { __html: html } }\n\t\t\t/>\n\t\t);\n\t}\n}\n\nexport default withGlobalEvents( {\n\tblur: 'checkFocus',\n} )( WpEmbedPreview );\n"]}
\No newline at end of file