Skip to content

Commit

Permalink
fix: fixing mask directive
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj committed Sep 1, 2023
1 parent 48af3d1 commit 3437f63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend/src/helpers/CustomDirectives.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { mask } from 'vue-the-mask'

export const masking = (shadowSelector: string) => (el: any, binding: any) => {
if (el.shadowRoot && binding.value) {
const input = el.shadowRoot.querySelector(shadowSelector)
if (input) {
input.setAttribute('v-mask', binding.value)
const observer = new MutationObserver(() => mask(input, binding))
observer.observe(input, { attributes: true })
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import '@/styles'
const app = createApp(App)

app.use(router)
app.directive('mask', masking('.cds--text-input__field-wrapper input'))
app.directive('mask', masking('.cds--text-input__field-wrapper input'))
app.config.globalProperties.$session = ForestClientUserSession
app.config.globalProperties.$features = featureFlags
app.config.globalProperties.$backend = backendUrl
Expand Down

0 comments on commit 3437f63

Please sign in to comment.