Registers extra vue components inside global variables of window. #349.

This commit is contained in:
Mateus Machado Luna 2020-03-02 16:54:44 -03:00
parent afd2939107
commit d8c38ea5c2
3 changed files with 23 additions and 14 deletions

View File

@ -21,6 +21,8 @@ module.exports = {
globals: {
'tainacan_plugin': true,
'_': true,
'jQuery': true
'jQuery': true,
'tainacan_extra_components': true,
'tainacan_extra_plugins': true
}
}

View File

@ -55,9 +55,9 @@ import eventBusSearch from './event-bus-search';
import eventBusTermsList from './event-bus-terms-list.js';
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCapabilitiesPlugin, StatusHelperPlugin, CommentsStatusHelperPlugin } from './utilities';
/* Registers Extra Vue Pluginss passed to the TainacanExtraVuePlugins */
if (typeof TainacanExtraVuePlugins != "undefined") {
for (let [extraVuePluginName, extraVuePluginObject] of Object.entries(TainacanExtraVuePlugin))
/* Registers Extra Vue Plugins passed to the window.tainacan_extra_plugins */
if (typeof window.tainacan_extra_plugins != "undefined") {
for (let [extraVuePluginName, extraVuePluginObject] of Object.entries(window.tainacan_extra_plugins))
Vue.use(extraVuePluginObject);
}
@ -76,10 +76,13 @@ Vue.use(ConsolePlugin, {visual: false});
Vue.use(VueTheMask);
Vue.use(CommentsStatusHelperPlugin);
/* Registers Extra Vue Components passed to the TainacanExtraVueComponents */
if (typeof TainacanExtraVueComponents != "undefined") {
for (let [extraVueComponentName, extraVueComponentObject] of Object.entries(TainacanExtraVueComponents))
/* Registers Extra Vue Components passed to the window.tainacan_extra_components */
if (typeof window.tainacan_extra_components != "undefined") {
for (let [extraVueComponentName, extraVueComponentObject] of Object.entries(window.tainacan_extra_components)) {
Vue.component(extraVueComponentName, extraVueComponentObject);
console.log(extraVueComponentName, extraVueComponentObject)
}
}
/* Metadata */

View File

@ -35,10 +35,12 @@ import routerTheme from './theme-router.js';
import eventBusSearch from '../../admin/js/event-bus-search';
import { I18NPlugin, UserPrefsPlugin, ConsolePlugin } from '../../admin/js/utilities';
/* Registers Extra Vue Pluginss passed to the TainacanExtraVuePlugins */
if (typeof TainacanExtraVuePlugins != "undefined") {
for (let [extraVuePluginName, extraVuePluginObject] of Object.entries(TainacanExtraVuePlugin))
Vue.use(extraVuePluginObject);
/* Registers Extra Vue Plugins passed to the window.tainacan_extra_plugins */
if (typeof window.tainacan_extra_plugins != "undefined") {
for (let [extraVuePluginName, extraVuePluginObject] of Object.entries(window.tainacan_extra_plugins)) {
Vue.component(extraVuePluginName, extraVuePluginObject);
console.log(extraVuePluginName, extraVuePluginObject)
}
}
// Configure and Register Plugins
@ -51,10 +53,12 @@ Vue.use(I18NPlugin);
Vue.use(UserPrefsPlugin);
Vue.use(ConsolePlugin, {visual: false});
/* Registers Extra Vue Components passed to the TainacanExtraVueComponents */
if (typeof TainacanExtraVueComponents != "undefined") {
for (let [extraVueComponentName, extraVueComponentObject] of Object.entries(TainacanExtraVueComponents))
/* Registers Extra Vue Components passed to the window.tainacan_extra_components */
if (typeof window.tainacan_extra_components != "undefined") {
for (let [extraVueComponentName, extraVueComponentObject] of Object.entries(window.tainacan_extra_components)) {
Vue.component(extraVueComponentName, extraVueComponentObject);
console.log(extraVueComponentName, extraVueComponentObject)
}
}
Vue.component('tainacan-filter-item', TaincanFiltersList);