User tests: Successful: Unsuccessful:
Oh, you didn't know there was one? Well there was.
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.
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.
CodeMirror will not appear broken. It will look great all the time.
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.
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.
Labels |
Added:
?
|
it can be tested on the contact editing page, there editor in the second tab:
test:
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
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 actionsmy 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.
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 actionsmy 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.
test
works good now
Milestone |
Added: |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-11-21 09:54:46 |
Oh, by the way, it's quite possible that there are no views in a normal
Joomla!
installation in whichCodeMirror
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.