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

Incompatible with Silverstripe 3.3? #6

Open
Friksel opened this issue Apr 5, 2016 · 6 comments
Open

Incompatible with Silverstripe 3.3? #6

Friksel opened this issue Apr 5, 2016 · 6 comments

Comments

@Friksel
Copy link

Friksel commented Apr 5, 2016

Hello @nathancox,
I'm a happy user of the codeeditorfield module.
Until now it survived every Silverstripe 3-upgrade. But since I upgraded to Silverstripe 3.3 there are some weird things going on here with the codeeditorfield. At the moment I'm debugging my code.

This is the behaviour I get after the ss3.3 upgrade:
The visible cursor is off-sync with the 'real' position in the text (so selections/edits happen on the wrong place in the text). The font of the codeeditorfield also changed from the Arial-like font into a Times-like font.

To be honoust, I'm getting a littlebit clueless by now on where to look, so just to be sure: should this module be compatible with Silverstripe 3.3? Thanks in advance

@nathancox
Copy link
Owner

Hi,

So far I can't reproduce this problem. What browser are you using?

@Friksel
Copy link
Author

Friksel commented Apr 8, 2016

Hi @nathancox ,

Thanks for your reaction. I did some further testing and the problem only occurs in Chrome and Opera browsers (webkit), it's still working fine in IE11, Edge and Firefox.

Both Chrome and Opera throw these messages in the console when the codeeditor opens from tinyMCE:

  • 'KeyboardEvent.keyLocation' is deprecated and will be removed in M50, around April 2016. Please use 'KeyboardEvent.location' instead. See https://www.chromestatus.com/features/4997403308457984 for more details.
  • Automatically scrolling cursor into view after selection change this will be disabled in the next version set editor.$blockScrolling = Infinity to disable this message

The first message only happens when the codeditor-plugin is added to tinyMCE. The second console message is also generated when the codeditor plugin is not added.

When I don't add the codeditor plugin to tinyMCE, the editor works as expected (and with the original font too, as seen before and still in other browsers).

Perhaps this happened after Silverstripe upgrading tinyMCE to version 4?
silverstripe/silverstripe-cms#1394

If the problem is the KeyLocation, like the consolemessage says, it makes sense. The problem IS a cursorproblem: when I move the cursor, the cursor sometimes is in the middle of a character, and when I select a piece of text and press delete, somewhere else in the text some characters will be removed.
Chrome/Opera say it will be removed at 'around April 2016', so that could explain why I haven't seen this problem before, 'cause it's just April now. That doesn't explain the change in font though.

btw, this is my config:

$htmlEditorConfig = HtmlEditorConfig::get('cms');
HtmlEditorConfig::get('cms')->enablePlugins(array(
    'aceeditor' => sprintf('codeeditorfield/javascript/tinymce/editor_plugin_src.js')
));
HtmlEditorConfig::get('cms')->insertButtonsBefore('fullscreen', 'aceeditor');
HtmlEditorConfig::get('cms')->removeButtons('code');

Screenshots:
chrome (http://pasteboard.co/1HWeB1K.jpg)
opera (http://pasteboard.co/1I5SV4j.jpg)
firefox (http://pasteboard.co/1HZTSky.jpg),
edge (http://pasteboard.co/1I1PmIk.jpg),
ie11 (http://pasteboard.co/1I38cLl.jpg)

@nathancox
Copy link
Owner

How did you get your copy of SilverStripe? I was using 3.3.1 specifically but it doesn't have the TinyMCE upgrade. I switched to running the master branch (dev-master in composer.json) which has the new TinyMCE and it has it's own problems with codeeditorfield (like $allowed_actions needs to be changed to private) but I still can't reproduce the cursor issue or the console message about it. I do get the "Automatically scrolling cursor into view ..." message several times though.

@Friksel
Copy link
Author

Friksel commented Apr 11, 2016

I think you're right, I did an assumption after finding the news about the TinyMCE upgrade that SS3.3.1 was using the TinyMCE upgrade already. But the TinyMCE upgrade will probably only be available from SS version 4.

I'm using the latest stable Silverstripe version (3.3.1) too. Before this version I had all other Silverstripe versions from 3.1 up, without this problem.

Strange that it's only happening (going wrong) in webkit-browsers. And that it seems to work on your side. I'm wondering what's different in my setup. I use other modules too, but none of them, as far as I can think of, is changing the html editor behaviour.

mmm...

@nathancox
Copy link
Owner

Hi, just want to say I'm sorry for the lack of responsiveness on this. I'm completely snowed under right now and I'm having trouble finding the time to really look in to it.

@Friksel
Copy link
Author

Friksel commented Apr 18, 2016

Thanks for your response @nathancox . No problem at all. I'm not in a hurry. Take your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants