diff options
| author | Sanaei <ho3ein.sanaei@gmail.com> | 2025-03-26 15:04:42 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-26 15:04:42 +0300 |
| commit | d376ce057c4e2de6071dfb2185b4fd9a3a4338b1 (patch) | |
| tree | f349a170638f023f27f507ccbc1574bd50f4a164 /web/html/xui/modals/text_modal.html | |
| parent | 6545d8b61df5ad03d89bd738dad84c5fc946a0b5 (diff) | |
| parent | 5e6e900e64bb2da5c0146cafa75d1a7b7bafaed7 (diff) | |
Merge pull request #2823 from shishkevichd/refactor/refactor-5
Code refactoring
Diffstat (limited to 'web/html/xui/modals/text_modal.html')
| -rw-r--r-- | web/html/xui/modals/text_modal.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/web/html/xui/modals/text_modal.html b/web/html/xui/modals/text_modal.html new file mode 100644 index 00000000..77cb719e --- /dev/null +++ b/web/html/xui/modals/text_modal.html @@ -0,0 +1,52 @@ +{{define "modals/textModal"}} +<a-modal id="text-modal" v-model="txtModal.visible" :title="txtModal.title" + :closable="true" + :class="themeSwitcher.currentTheme"> + <template slot="footer"> + <a-button v-if="!ObjectUtil.isEmpty(txtModal.fileName)" icon="download" + :href="'data:application/text;charset=utf-8,' + encodeURIComponent(txtModal.content)" + :download="txtModal.fileName">[[ txtModal.fileName ]] + </a-button> + <a-button type="primary" @click="txtModal.copy(txtModal.content)">{{ i18n "copy" }}</a-button> + </template> + <a-input style="overflow-y: auto;" type="textarea" v-model="txtModal.content" + :autosize="{ minRows: 10, maxRows: 20}"></a-input> +</a-modal> + +<script> + + const txtModal = { + title: '', + content: '', + fileName: '', + qrcode: null, + visible: false, + show: function (title = '', content = '', fileName = '') { + this.title = title; + this.content = content; + this.fileName = fileName; + this.visible = true; + }, + copy: function (content = '') { + ClipboardManager + .copyText(content) + .then(() => { + app.$message.success('{{ i18n "copied" }}') + this.close(); + }) + }, + close: function () { + this.visible = false; + }, + }; + + const textModalApp = new Vue({ + delimiters: ['[[', ']]'], + el: '#text-modal', + data: { + txtModal: txtModal, + }, + }); + +</script> +{{end}} |
