Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #1985 (HTML Render in Mail) #1994

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/Webkul/Admin/src/Resources/assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -641,4 +641,8 @@

.tox .tox-toolbar__group:last-child button:hover {
@apply border-0 !bg-[#3389ec] text-white shadow-none;
}

.tox.tox-silver-sink.tox-tinymce-aux {
z-index: 99999;
}
68 changes: 37 additions & 31 deletions packages/Webkul/Admin/src/Resources/views/mail/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class="!font-normal"
<x-admin::modal
ref="toggleComposeModal"
position="bottom-right"
@toggle="removeTinyMCE"
>
<x-slot:header>
<h3 class="text-lg font-bold text-gray-800 dark:text-white">
Expand Down Expand Up @@ -379,6 +380,7 @@ class="w-[calc(100%-62px)]"
rules="required"
rows="8"
::value="draft.reply"
:tinymce="true"
:label="trans('admin::app.mail.index.mail.message')"
/>

Expand Down Expand Up @@ -434,19 +436,19 @@ class="primary-button"
<script type="module">
app.component('v-mail', {
template: '#v-mail-template',

data() {
return {
selectedMail: false,

showCC: false,

showBCC: false,

isStoring: false,

saveAsDraft: 0,

draft: {
id: null,
reply_to: [],
Expand All @@ -456,7 +458,7 @@ class="primary-button"
reply: '',
attachments: [],
},

backgroundColors: [
{
label: "@lang('admin::app.components.tags.index.aquarelle-red')",
Expand Down Expand Up @@ -486,53 +488,57 @@ class="primary-button"
],
};
},

mounted() {
const params = new URLSearchParams(window.location.search);

if (params.get('openModal')) {
this.$refs.toggleComposeModal.toggle();
}
},

methods: {
removeTinyMCE() {
tinymce?.remove?.();
},

truncatedReply(reply) {
const maxLength = 100;

if (reply.length > maxLength) {
return `${reply.substring(0, maxLength)}...`;
}

return reply;
},

toggleModal() {
this.draft.reply_to = [];

this.$refs.toggleComposeModal.toggle();
},

save(params, { resetForm, setErrors }) {
this.isStoring = true;

let formData = new FormData(this.$refs.mailForm);

formData.append('is_draft', this.saveAsDraft);

if (this.draft.id) {
formData.append('_method', 'PUT');
}

this.$axios.post(this.draft.id ? "{{ route('admin.mail.update', ':id') }}".replace(':id', this.draft.id) : '{{ route('admin.mail.store') }}', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
})
.then ((response) => {
this.$refs.datagrid.get();

this.$emitter.emit('add-flash', { type: 'success', message: response.data?.message });

resetForm();
})
.catch ((error) => {
Expand All @@ -543,34 +549,34 @@ class="primary-button"
}
}).finally(() => {
this.$refs.toggleComposeModal.close();

this.isStoring = false;

this.resetForm();
});
},

editModal(row) {
if(row.title == 'View') {
window.location.href = row.url;

return;
}

this.$axios.get(row.url)
.then(response => {
this.draft = response.data.data;

this.$refs.toggleComposeModal.toggle();

this.showCC = this.draft.cc.length > 0;

this.showBCC = this.draft.bcc.length > 0;

})
.catch(error => {});
},

resetForm() {
this.draft = {
id: null,
Expand Down
Loading