mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							54 lines
						
					
					
						
							1.6 KiB
						
					
					
				
			
		
		
	
	
							54 lines
						
					
					
						
							1.6 KiB
						
					
					
				| import '@hotwired/turbo-rails'
 | |
| 
 | |
| import { createApp, reactive } from 'vue'
 | |
| 
 | |
| import ToggleVisible from './elements/toggle_visible'
 | |
| import DisableHidden from './elements/disable_hidden'
 | |
| import TurboModal from './elements/turbo_modal'
 | |
| import FileDropzone from './elements/file_dropzone'
 | |
| import MenuActive from './elements/menu_active'
 | |
| import ClipboardCopy from './elements/clipboard_copy'
 | |
| import TemplateBuilder from './template_builder/builder'
 | |
| 
 | |
| document.addEventListener('turbo:before-cache', () => {
 | |
|   window.flash?.remove()
 | |
| })
 | |
| 
 | |
| document.addEventListener('keyup', (e) => {
 | |
|   if (e.code === 'Escape') {
 | |
|     document.activeElement?.blur()
 | |
|   }
 | |
| })
 | |
| 
 | |
| window.customElements.define('toggle-visible', ToggleVisible)
 | |
| window.customElements.define('disable-hidden', DisableHidden)
 | |
| window.customElements.define('turbo-modal', TurboModal)
 | |
| window.customElements.define('file-dropzone', FileDropzone)
 | |
| window.customElements.define('menu-active', MenuActive)
 | |
| window.customElements.define('clipboard-copy', ClipboardCopy)
 | |
| 
 | |
| window.customElements.define('template-builder', class extends HTMLElement {
 | |
|   connectedCallback () {
 | |
|     this.appElem = document.createElement('div')
 | |
| 
 | |
|     this.app = createApp(TemplateBuilder, {
 | |
|       template: reactive(JSON.parse(this.dataset.template))
 | |
|     })
 | |
| 
 | |
|     this.app.config.globalProperties.$t = (key) => TemplateBuilder.i18n[key] || key
 | |
| 
 | |
|     this.app.mount(this.appElem)
 | |
| 
 | |
|     this.appendChild(this.appElem)
 | |
|   }
 | |
| 
 | |
|   disconnectedCallback () {
 | |
|     this.app?.unmount()
 | |
|     this.appElem?.remove()
 | |
|   }
 | |
| })
 | |
| 
 | |
| document.addEventListener('clipboard-copy', function (event) {
 | |
|   console.log('Copied to clipboard') // TODO: Add a toast message
 | |
| })
 |