allow external web components
This commit is contained in:
parent
5d2f121159
commit
31feccee1a
|
@ -30,11 +30,14 @@ class DevInterface {
|
|||
|
||||
function add_admin_js() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
$components = ( has_filter( 'tainacan_register_web_components' ) ) ? apply_filters('tainacan_register_web_components') : [];
|
||||
|
||||
wp_enqueue_script('wp-settings',$TAINACAN_BASE_URL . '/js/wp-settings.js');
|
||||
|
||||
$settings = [
|
||||
'root' => esc_url_raw( rest_url() ).'tainacan/v2',
|
||||
'nonce' => wp_create_nonce( 'wp_rest' )
|
||||
'nonce' => wp_create_nonce( 'wp_rest' ),
|
||||
'components' => $components
|
||||
];
|
||||
|
||||
wp_localize_script( 'wp-settings', 'wp_settings', $settings );
|
||||
|
|
|
@ -7,6 +7,11 @@ export const eventBus = new Vue({
|
|||
componentsTag: [],
|
||||
errors : store.getters['item/getError']
|
||||
},
|
||||
created(){
|
||||
if( wp_settings.components ){
|
||||
this.componentsTag = wp_settings.components;
|
||||
}
|
||||
},
|
||||
methods : {
|
||||
registerComponent( name ){
|
||||
this.componentsTag.push( name );
|
||||
|
|
Loading…
Reference in New Issue