PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / frontend / src / views / admin / App.vue

App.vue in The Innovative Form Builder – IvyForms 1.0, at frontend/src/views/admin/App.vue

48 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <template>
2 <div>
3 <component
4 :is="BannerComponent"
5 v-for="(BannerComponent, index) in bannerComponents"
6 :key="index"
7 />
8 <RouterView />
9 <IvyChangelogModal />
10 <ProUpgradeDialog />
11 </div>
12 </template>
13
14 <script setup lang="ts">
15 import { shallowRef, onMounted, markRaw, isReactive } from 'vue'
16 import type { Component } from 'vue'
17 import IvyChangelogModal from '@/views/_components/changelog/IvyChangelogModal.vue'
18 import ProUpgradeDialog from '@/views/_components/dialog/ProUpgradeDialog.vue'
19
20 // Allow Pro to inject banner components via hook
21 // Use shallowRef to prevent components from being made deeply reactive
22 const bannerComponents = shallowRef<Component[]>([])
23
24 onMounted(() => {
25 // Apply filter initially
26 if (window.IvyForms?.hooks?.applyFilters) {
27 const components = window.IvyForms.hooks.applyFilters('ivyforms/app/banner_components', [])
28 // Wrap each component with markRaw to prevent reactivity (only if not already raw)
29 bannerComponents.value = components.map((comp: Component) =>
30 isReactive(comp) ? markRaw(comp) : comp,
31 )
32 }
33
34 // Listen for banner refresh events (e.g., when Pro plugin registers banners after mount)
35 const refreshBanners = () => {
36 if (window.IvyForms?.hooks?.applyFilters) {
37 const components = window.IvyForms.hooks.applyFilters('ivyforms/app/banner_components', [])
38 // Wrap each component with markRaw to prevent reactivity (only if not already raw)
39 bannerComponents.value = components.map((comp: Component) =>
40 isReactive(comp) ? markRaw(comp) : comp,
41 )
42 }
43 }
44
45 window.addEventListener('ivyforms:refresh_banners', refreshBanners)
46 })
47 </script>
48