| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | {{define "textModal"}} | 
					
						
							|  |  |  | <a-modal id="text-modal" v-model="txtModal.visible" :title="txtModal.title" | 
					
						
							|  |  |  |          :closable="true" ok-text='{{ i18n "copy" }}' cancel-text='{{ i18n "close" }}' | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |          :class="themeSwitcher.darkCardClass" | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |          :ok-button-props="{attrs:{id:'txt-modal-ok-btn'}}"> | 
					
						
							|  |  |  |     <a-button v-if="!ObjectUtil.isEmpty(txtModal.fileName)" type="primary" style="margin-bottom: 10px;" | 
					
						
							| 
									
										
										
										
											2023-05-05 18:22:35 +00:00
										 |  |  |               :href="'data:application/text;charset=utf-8,' + encodeURIComponent(txtModal.content)" | 
					
						
							|  |  |  |               :download="txtModal.fileName"> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         {{ i18n "download" }} [[ txtModal.fileName ]] | 
					
						
							|  |  |  |     </a-button> | 
					
						
							|  |  |  |     <a-input type="textarea" v-model="txtModal.content" | 
					
						
							|  |  |  |              :autosize="{ minRows: 10, maxRows: 20}"></a-input> | 
					
						
							|  |  |  | </a-modal> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const txtModal = { | 
					
						
							|  |  |  |         title: '', | 
					
						
							|  |  |  |         content: '', | 
					
						
							|  |  |  |         fileName: '', | 
					
						
							|  |  |  |         qrcode: null, | 
					
						
							|  |  |  |         clipboard: null, | 
					
						
							|  |  |  |         visible: false, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |         show: function (title = '', content = '', fileName = '') { | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             this.title = title; | 
					
						
							|  |  |  |             this.content = content; | 
					
						
							|  |  |  |             this.fileName = fileName; | 
					
						
							|  |  |  |             this.visible = true; | 
					
						
							|  |  |  |             textModalApp.$nextTick(() => { | 
					
						
							|  |  |  |                 if (this.clipboard === null) { | 
					
						
							|  |  |  |                     this.clipboard = new ClipboardJS('#txt-modal-ok-btn', { | 
					
						
							|  |  |  |                         text: () => this.content, | 
					
						
							|  |  |  |                     }); | 
					
						
							|  |  |  |                     this.clipboard.on('success', () => app.$message.success('{{ i18n "copied" }}')); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }); | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         close: function () { | 
					
						
							|  |  |  |             this.visible = false; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const textModalApp = new Vue({ | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         delimiters: ['[[', ']]'], | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         el: '#text-modal', | 
					
						
							|  |  |  |         data: { | 
					
						
							|  |  |  |             txtModal: txtModal, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | {{end}} |