Fixed Create Ticket
This commit is contained in:
@@ -363,24 +363,27 @@
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@script
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
const initialiseHelpdeskTicketCreate = function () {
|
||||||
const form = document.querySelector('.helpdesk-ticket-form');
|
const form = document.querySelector('.helpdesk-ticket-form');
|
||||||
const editor = document.querySelector('[data-helpdesk-details-editor]');
|
const editor = document.querySelector('[data-helpdesk-details-editor]');
|
||||||
const bodyField = document.getElementById('body');
|
const bodyField = document.getElementById('body');
|
||||||
|
|
||||||
if (!form || !editor || !bodyField) {
|
if (! form || ! editor || ! bodyField || form.dataset.editorReady === 'true') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form.dataset.editorReady = 'true';
|
||||||
|
|
||||||
const syncBody = function () {
|
const syncBody = function () {
|
||||||
bodyField.value = editor.innerHTML.trim();
|
const value = editor.innerHTML.trim();
|
||||||
bodyField.dispatchEvent(new Event('input', {
|
|
||||||
bubbles: true
|
bodyField.value = value;
|
||||||
}));
|
bodyField.dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
bodyField.dispatchEvent(new Event('change', {
|
bodyField.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
bubbles: true
|
|
||||||
}));
|
@this.set('body', value, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
document.querySelectorAll('[data-helpdesk-editor-command]').forEach(function (button) {
|
document.querySelectorAll('[data-helpdesk-editor-command]').forEach(function (button) {
|
||||||
@@ -413,8 +416,15 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
editor.addEventListener('input', syncBody);
|
||||||
|
editor.addEventListener('keyup', syncBody);
|
||||||
editor.addEventListener('blur', syncBody);
|
editor.addEventListener('blur', syncBody);
|
||||||
form.addEventListener('submit', syncBody, true);
|
form.addEventListener('submit', syncBody, true);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
initialiseHelpdeskTicketCreate();
|
||||||
|
|
||||||
|
document.addEventListener('livewire:navigated', initialiseHelpdeskTicketCreate);
|
||||||
</script>
|
</script>
|
||||||
|
@endscript
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user