Micke1101 / OSTicket-plugin-TinyMCE

6 stars 5 forks source link

OSTicket-plugin-TinyMCE breaks canned responses in Safari #29

Open stevland opened 6 years ago

stevland commented 6 years ago

I am very thankful for this amazing plugin.

I have discovered a glitch, however. OSTicket-plugin-TinyMCE is breaking canned responses. If you click on a canned response from the drop-down menu no text is added to the ticket.

After a little exploring in osTicket's code I see that a link is meant to be created to the canned text. I think this is accomplished though an Ajax call. Here is an example of what a link should look like:

/scp/ajax.php/tickets/105/canned-resp/2.json?_=1528942887453

But the plugin is somehow interfering and every link ends up with a 0, like this:

/scp/ajax.php/tickets/105/canned-resp/0.json?_=1528942887453

Here is the weirdest part... this only occurs when using the Safari web browser.

But as Google were forced to use Safari's rendering engine in Chrome for iOS, it means that this glitch affects Safari users on Mac and Safari/ Chrome users on iOS devices, which pretty much means all iOS users. :(

Any insight would be greatly appreciated!

Micke1101 commented 5 years ago

I unfortunately don't have access to a mac at this moment but can have a look later on, when you've selected the canned response can you test and run the following command in the console: $('form select#cannedResp').val();

C-Nedelcu commented 4 years ago

Hello stevland

We ran into the same issue. Users under Safari (any version: iOS, macOS) cannot use canned responses.

The problem seems to stem from the use of the 'select2' component. After weighing the pros and cons I have decided to design a workaround.

In /include/staff/ticket-view.inc.php search for: <select id="cannedResp" name="cannedResp"> change to: <select id="cannedResp2" name="cannedResp">

In /include/plugins/tinymce/tinymce-osticket.js at the beginning of the file where it says: $('form select#cannedResp').change(function() { I changed this to: $('form select#cannedResp2').change(function() {

You will lose the "select2" functionalities, so the list of canned responses looks like a regular html dropdown list. But at least, it works on all browsers that I have tested.

Hope this helps