? Success

User tests: Successful: Unsuccessful:

avatar okonomiyaki3000
okonomiyaki3000
21 Nov 2014

Oh, you didn't know there was one? Well there was.

Testing

1) Set CodeMirror as your editor (as if you haven't already, right?)
2) Go to some page on which the editor will be in a hidden element... like a hidden tab or something.
3) Display the hidden tab.

Before

CodeMirror will appear broken. It's not, if you try to use it, it will fix itself right away. But it looks really bad at first.

After

CodeMirror will not appear broken. It will look great all the time.

How?

Well, CodeMirror has a refresh function for exactly this kind of situation but we need to call it when CM becomes visible. Bootstrap provides events for doing this kind of thing when a tab or modal or other kind of hidden content gets shown. This addition just places a listener for those events and refreshes CM when one of them happens. It only works if jQuery is on the page and it only listens for Bootstrap's events (although anything that fires a 'shown' event could theoretically trigger this). There shouldn't be any problem if there is no jQuery or Bootstrap, but the refresh event won't get fired. Which is no worse than the current situation.

Can it be better?

Yes, this rendering code can go in a layout so that it can be overridden in case a different js library is being used or something like that. I wanted to keep this PR simple though.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar okonomiyaki3000 okonomiyaki3000 - open - 21 Nov 2014
avatar jissues-bot jissues-bot - change - 21 Nov 2014
Labels Added: ?
avatar okonomiyaki3000
okonomiyaki3000 - comment - 21 Nov 2014

Oh, by the way, it's quite possible that there are no views in a normal Joomla! installation in which CodeMirror appears in a tab which is initially hidden. So you might have to do some magic to make that happen. That doesn't make this problem any less real though. JForm is quite extensible and it's trivial for a developer to add additional fields to a form.

avatar Fedik
Fedik - comment - 21 Nov 2014

:+1:
it can be tested on the contact editing page, there editor in the second tab:
test:

  • set default editor to Codemirror
  • open some contact to editing
  • click on the second tab, where the editor

before patch: editor field empty until click on it
after patch: editor displayed without additional actions

my test result
something wrong, I got Uncaught ReferenceError: editor is not defined after apply this patch

avatar okonomiyaki3000
okonomiyaki3000 - comment - 21 Nov 2014

D'oh! I know what this is. Gimme 5 minutes.

Sent from my iPhone

On 2014/11/21, at 18:19, Fedik notifications@github.com wrote:

it can be tested on the contact editing page, there editor in the second tab:
test:

set default editor to Codemirror
open some contact to editing
click on the second tab, where the editor
before patch: editor field empty until click on it
after patch: editor displayed without additional actions

my test result
something wrong, I got Uncaught ReferenceError: editor is not defined after apply this patch

�\
Reply to this email directly or view it on GitHub.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 21 Nov 2014

That should do it.

Sent from my iPhone

On 2014/11/21, at 18:19, Fedik notifications@github.com wrote:

it can be tested on the contact editing page, there editor in the second tab:
test:

set default editor to Codemirror
open some contact to editing
click on the second tab, where the editor
before patch: editor field empty until click on it
after patch: editor displayed without additional actions

my test result
something wrong, I got Uncaught ReferenceError: editor is not defined after apply this patch

�\
Reply to this email directly or view it on GitHub.

avatar Fedik Fedik - test_item - 21 Nov 2014 - Tested successfully
avatar Fedik
Fedik - comment - 21 Nov 2014

test
works good now :wink:

avatar waader
waader - comment - 21 Nov 2014

@test works also for me

avatar infograf768 infograf768 - change - 21 Nov 2014
Milestone Added:
avatar infograf768
infograf768 - comment - 21 Nov 2014

@test
Fine. Merging. Thanks!

avatar infograf768 infograf768 - reference | 1fd19e0 - 21 Nov 14
avatar infograf768 infograf768 - merge - 21 Nov 2014
avatar infograf768 infograf768 - close - 21 Nov 2014
avatar infograf768 infograf768 - close - 21 Nov 2014
avatar infograf768 infograf768 - change - 21 Nov 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-11-21 09:54:46
avatar okonomiyaki3000 okonomiyaki3000 - head_ref_deleted - 26 Nov 2014

Add a Comment

Login with GitHub to post a comment