diff --git a/front/scripts/fix-fomantic-css.sh b/front/scripts/fix-fomantic-css.sh index bbb7b8508..30a63d918 100755 --- a/front/scripts/fix-fomantic-css.sh +++ b/front/scripts/fix-fomantic-css.sh @@ -8,3 +8,5 @@ echo 'Removing google font…' sed -i '/@import url(/d' node_modules/fomantic-ui-css/components/site.css echo "Replacing hardcoded values by CSS vars…" scripts/fix-fomantic-css.py node_modules/fomantic-ui-css node_modules/fomantic-ui-css/tweaked +echo 'Fixing jQuery import…' +sed -i '1s/^/import jQuery from "jquery"\n/' `find node_modules/fomantic-ui-css/ -name '*.js'` \ No newline at end of file diff --git a/front/src/components/channels/UploadModal.vue b/front/src/components/channels/UploadModal.vue index 0a0cfcc8c..1940ca6ad 100644 --- a/front/src/components/channels/UploadModal.vue +++ b/front/src/components/channels/UploadModal.vue @@ -1,5 +1,5 @@ diff --git a/front/src/components/common/DangerousButton.vue b/front/src/components/common/DangerousButton.vue index 2276cdc69..a2a3d0709 100644 --- a/front/src/components/common/DangerousButton.vue +++ b/front/src/components/common/DangerousButton.vue @@ -1,3 +1,32 @@ + + - diff --git a/front/src/utils/fomantic.ts b/front/src/utils/fomantic.ts index dc89342ff..37d72a4ac 100644 --- a/front/src/utils/fomantic.ts +++ b/front/src/utils/fomantic.ts @@ -1,20 +1,16 @@ /// import $ from 'jquery' -import { nextTick } from 'vue' -import { useCurrentElement } from '@vueuse/core' +import { tryOnMounted, useCurrentElement } from '@vueuse/core' -const el = useCurrentElement() export const getDropdown = (selector = '.ui.dropdown'): JQuery => { + const el = useCurrentElement() return $(el.value).find(selector) } -export const setupDropdown = async (selector: string | HTMLElement = '.ui.dropdown') => { - if (typeof selector === 'string') { - await nextTick() - } - +export const setupDropdown = (selector: string | HTMLElement = '.ui.dropdown') => tryOnMounted(() => { + const el = useCurrentElement() const $dropdown = typeof selector === 'string' ? $(el.value).find(selector) : $(selector) @@ -29,6 +25,4 @@ export const setupDropdown = async (selector: string | HTMLElement = '.ui.dropdo $dropdown.dropdown('hide') } }) - - return $dropdown -} +}, false) diff --git a/front/vite.config.ts b/front/vite.config.ts index d07d869ad..3a2f53a3f 100644 --- a/front/vite.config.ts +++ b/front/vite.config.ts @@ -45,15 +45,7 @@ export default defineConfig(() => ({ navigateFallback: 'index.html', webManifestUrl: '/front/manifest.json' } - }), - { - name: 'fix-fomantic-ui-css', - transform (src, id) { - if (id.includes('fomantic-ui-css') && id.endsWith('.min.js')) { - return `import jQuery from 'jquery';${src}` - } - } - } + }) ], server: { port, hmr }, resolve: {