fix: use Alpine.data() to register giteaWorkspace component
Replaced global function giteaWorkspace() with Alpine.data('giteaWorkspace', ...)
registered via document.addEventListener('alpine:init', ...). This is the
recommended Alpine 3 approach that guarantees the component factory is
available before Alpine processes x-data directives.
Changed x-data="giteaWorkspace()" to x-data="giteaWorkspace" (Alpine.data
calls the factory automatically, no parentheses needed).
This commit is contained in:
@@ -36,7 +36,8 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function giteaWorkspace() {
|
document.addEventListener('alpine:init', () => {
|
||||||
|
Alpine.data('giteaWorkspace', () => {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const owner = params.get('owner') || '';
|
const owner = params.get('owner') || '';
|
||||||
const repo = params.get('repo') || '';
|
const repo = params.get('repo') || '';
|
||||||
@@ -658,9 +659,10 @@ function giteaWorkspace() {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<div class="gw-main" x-data="giteaWorkspace()">
|
<div class="gw-main" x-data="giteaWorkspace">
|
||||||
<!-- File view -->
|
<!-- File view -->
|
||||||
<div x-show="showFile && !showEditor" x-transition>
|
<div x-show="showFile && !showEditor" x-transition>
|
||||||
<div class="gw-file-toolbar">
|
<div class="gw-file-toolbar">
|
||||||
|
|||||||
Reference in New Issue
Block a user