Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Plugin TinyMCE

2»

Comments

  • @sperrow you're absolutely correct, it looks like scp.js calls the redact function that the plugin removes: https://github.com/osTicket/osTicket/blob/770174cffaba74fae171bd3ec859491f42fdd4e1/scp/js/scp.js#L1106
    It seems to only be used for quick notes, i'll have a look at what will be the best course of action.
    Either rename the tiny to redact so that it calls the old function, or replace the whole note function at runtime.
  • edited October 27
    @sperrow 

    I can confirm that I am unable to create a note on an organization. We barely use orgs so I have not tried to do this since adding the plugin.
    .

  • What a fantastic plugin Micke1101 !! Thanks a lot for it. 
    One small thing: in a reply an image can be added by drag and drop, but adding an image by drag and drop in a new canned response, the image is saved in base64 code. Is there a way to fix this ?
    Screen Shot 2017-10-28 at 00.26.20.PNG
    987 x 307 - 122K
  • @bijl I'm unable to replicate what you're describing.

    Can you provide what webserver you're using, what browser and version, plugin configuration and an example image?
    drag and drop.PNG
    956 x 450 - 59K
    drag and drop source.PNG
    961 x 649 - 41K
  • @sperrow and @blueyeguy can you please try the latest commit, it should sort out the issue with quick notes.
  • I am on macos 10.13, chrome Version 61.0.3163.
    See enclosed screenshots for plugin and serverinfo.
    Found out that it works fine unless the size of the image remains under 50KB.

    Screen Shot 2017-10-28 at 00.26.20.PNG
    987 x 307 - 122K
    Screen Shot 2017-10-28 at 15.16.15.PNG
    673 x 1165 - 147K
    Screen Shot 2017-10-28 at 15.19.42.PNG
    1336 x 519 - 151K
    Screen Shot 2017-10-28 at 15.15.00.PNG
    671 x 747 - 112K
  • @bijl I've now tried on a mac with chrome, apache with php 5.6 and i can still not replicate this issue.
    There does not seem to be a difference for me when dropping a sub 50kb file or greater either.

    What i can see differs so far is that you've enabled the powerpaste plugin, i have not purchased this plugin so i'm unable to test if this could be the issue.

    Can you try disabling the powerpaste plugin?
    The fact that you're seeing the raw html code makes me wonder if it could be a javascript error, can you check if you get any error messages in the console as well?
  • disabled the powerpaste plugin: same result.
    did a fresh install & latest version of the plugin: still the same.
    As we are making use of a lot of images in canned responses, it would be handy if it should work, so we are open to any suggestion. On the other hand we can switch to an external file storage service and paste the link. We are very happy with this plugin anyway. Thanks a lot for your effort!
  • edited October 30
    Hi @Micke1101,

    I just tried organisational notes and they work brilliantly :) Awesome work.

    I have a little question regarding osTicket/js/tinymce (sorry it if has been answered before somewhere), but I see that this directory contains langs and skins directories, which also exists in plugins/tinymce/

    In skins directory in js/tinymce, the only difference from the main skins directory in plugins/tinymce/skins/ is that js/tinymce/skins contains charcoal skin. Also looking further down the directory tree, I can see plugins/tinymce/skins/lightgray contains more files than js/tinymce/skins/lightgray/

    Are these somehow referenced? (haven't looked into the code yet, sorry) if not, is it something people should copy over? It is slightly confusing on the first glance :)
  • @sperrow good.

    All tinymce files should be in js/tinymce, this is because if it's in the plugin directory you'll have issues with end user not being able to access the files and thus the plugin won't work.
    tinymce-osticket.js, is currently using .htaccess to be allowed to be in that folder, but i'm considering moving it to the tinymce folder aswell, tinymce-config.js is being imported into the php code itself so it doesn't matter where it sits.
  • Hi @Micke1101,

    Can you please confirm if tinymce works with IE11.608.15063.0 (11.0.46) (having said that, oddly enough Edge works fine), as it does not for me. Post Internal Note and Post Reply both display, umm, nothing :)
    image
    Internet Explorer.png
    1169 x 280 - 8K
  • @sperrow I can confirm that IE11 (11.0.47) works for me.
    I recall that there was a problem that i fixed for internet explorer specifically, do you see any errors in the javascript console?
  • edited October 31
    Yep, here you go:
    SCRIPT5007: Unable to get property 'innerHTML' of undefined or null reference
    plugin.min.js (1,2261)

    On further refresh, fiddling with compatibility settings, this error still stays, thus the first one might be a red herring.

    SCRIPT438: Object doesn't support property or method 'closest'
    tinymce-osticket.min.js (1,2029)
  • Also, as a suggestion, pre-tinymce field contained little opaque info text (Start writing your response...), if you want the plugin completely replace the functionality of the original editor, maybe it is worth including these too, as they are useful to let users to what to write in this field, e.g., add extra little notes of how to do things:

    image

    Just a suggestion really :)
    pre_tinemce.png
    827 x 239 - 47K
  • @sperrow yea that sounds like the old error that was present, make sure all of your files are the latest ones on the github and try again.

    Should be a small addition with the placeholder and i agree that it makes sense to have.
  • Hi @Micke1101, I made sure that all files are latest files from git repository, unfortunately the error still happens for some reason :/

    I made a change to use tinymce-osticket.js instead of the min version, so its easier to understand where the issue happens:

    SCRIPT438: Object doesn't support property or method 'closest'
    tinymce-osticket.js (108,5)

    Allegedly, it is this part here:
        107 tinymce.PluginManager.add('autolock', function(editor, url) {
        108     var code = $(editor.getElement().closest('form')).find('[name=lockCode]');
        109     if(code.length)
        110         editor.on('keydown', function(e){
        111             $(editor.getElement().closest('[data-lock-object-id]')).exclusive('acquire');
        112         });
        113
        114     return {
        115         getMetadata: function () {
        116             return  {
        117                 name: "osTicket autolock",
        118                 url: "https://github.com/Micke1101/OSTicket-plugin-TinyMCE"
        119             };
        120         }
        121     };
        122 });



  • @sperrow hmm that's odd i have it fixed on my version but apparently not on the git change that line to

    var code = $(editor.getElement()).closest('form').find('[name=lockCode]');
  • @Micke1101, works brilliantly, just tested it :) Thanks you for your quick fix. I made modification for both js files, the main one and the min version of it.
  • @bijl do you get the same behaviour in other browsers? On other computers?
  • Tried firefox, safari and chrome on several computers, unfortunately all with the same result :-(
  • @bijl ok so it should not be something on the client side then.
    What database engine are you using?
  • MySQL Version10.1.24
  • to be more specific:
    • Server: Localhost via UNIX socket
    • Server type: MariaDB
    • Server version: 10.1.24-MariaDB - MariaDB Server
    • Protocol version: 10
  • See images for what happens when the image is smaller and bigger that 50KB. 
    and as mentioned before: this behaviour only happens in the canned responses.
    osTicket____Staff_Control_Panel2.png
    621 x 461 - 151K
    osTicket____Staff_Control_Panel.png
    628 x 223 - 13K
  • @bijl i've now confirmed this behaviour and it seems the problem occurs when uploading larger files.
  • edited November 2
    Hello @Micke1101,

    I have observed very weird behaviour when using IE and chrome - If you copy contents from internal note or post reply box and try to paste them into chrome - it does not work, but it does if you try to copy from chrome and paste into IE :) Just bizarre behaviour, that's all, in real life people would not copy paste between browsers.

    It looks like when you try to copy from IE it adds an empty line before the text you want to copy, while doing same thing on chrome doesn't (if that makes sense).

    More pressing issue is when I try to add an Post Internal Note when using IE, it gives out error: "Your lock has expired. Please try again!" Post Reply works fine thought. I disabled the plugin to make sure it works with vanilla version of the editor - and it does.

  • There are also other cross browser usage issues in osticket (https://github.com/osTicket/osTicket/issues/3944). 

    Maybe this is a hint that the behavior has also something to do with the session management of osticket (cause this things happen with redactor and tinymce).

    I don't think this scenario is general so unreal (ok maybe for pasting). 
    In corporate environments people don't always have a assigned personal computer, sometimes they are working with different computers and have to use the software (browser) which is preinstalled on the machine. 
    At least I see several github issues that are related to such a use case..
  • I found out that ticket lock mechanism has some weird issues for me, when renewing ticket lock. 

    Sometimes it gives 404 not found error when calling ajax.php lock renew, this happens due to db having a lock for the same ticket but with a new lock id (thus can't find the old entry as it got removed somehow). 

    In reality, it should renew existing lock and not introduce a new lock, this is causing very odd issues where sometimes you have two lock entries in the database, then ticket lock works fine, after renew it removes the old lock and uses the new locks ID. This is not really consistent issue, which I can't reliably reproduce, but can be cached by setting lock timer to 1 minute and adding text to internal notes and renewing the ticket lock few times.

    tinyMCE gives out an ajax error that has occurred as a popup. I ended up commenting it out from tinymce-osticket.js:

    523 $(document).ajaxError(function(event, request, settings) {
    524 //    $.sysAlert(__('Ajax error.'),
    525 //        __('An ajax error occured.'));
    526 });

    Else every time you tried to click on internal note area it would throw this error. I also tried disabling the lock mechanism, but it only gives error 418 teapot error, which then gets picked up by tinyMCE ajax sysAlert :)

    This really needs more thorough investigation, maybe even an git issue, but for that I need somebody to confirm it via their devconsole. I had this issue in chrome, did not test on other browsers.

  • @sperrow this indeed sounds like a strange issue, i'm unable to reproduce the error with locking on internal notes so i'm suspecting it is as you say a error that happens sometimes, this should not be related to tinymce itself, however i could probably make it so that the call is less frequent, reducing the network load etc.

    The reason you might not see this with redactor is because they capture all errors but only tell you if it fails to save the draft, nothing about not being able to lock it.

    I also had a look at the placeholder you suggested and it seems that TinyMCE is one of few editors that does not have this built in, there are some examples of it available as a plugin but nothing i've seen that i really liked so far.
  • edited November 2
    I found out the why I had lock issues, it turned out to be simply tz settings. 

    Setup:
    System time was set to GMT.
    PHP timezone was set to Europe/London.
    MySQL tz was set to SYSTEM.

    Steps to be done to rectify the issue:
    ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
    mysql_tzinfo_to_sql /usr/share/zoneinfo/|mysql -u root mysql -p
    (from mysql cmd) SET GLOBAL time_zone = 'Europe/London';

    This synced all tzs and I have not seen this issue since then. Interestingly enough, we had DST change last weekend.

Sign In or Register to comment.