TWEagle / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

datePicker with tinyMCE editor doesn't display properly #172

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If I have a page that contains both a datePicker control and a tinyMCE editor 
(http://tinymce.moxiecode.com/), the datePicker doesn't display properly.

============ SAMPLE PAGE =============
<!-- jQuery -->
<script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<!-- required plugins -->
<script type="text/javascript" src="http://github.com/vitch/jquery-
methods/raw/master/date.js"></script>
<!--[if IE]><script type="text/javascript" 
src="javascripts/jquery.bgiframe.js"></script><![endif]-->

<!-- jquery.datePicker.js -->
<script type="text/javascript" 
src="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/jquery.d
atePicker.js
"></script>
<script type="text/javascript" 
src="javascripts/tiny_mce/jquery.tinymce.js"></script>

<link 
href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/styles/datePick
er.css" 
media="screen" rel="stylesheet" type="text/css">
<script type='text/javascript'>
  $(function()
  {

    $('.date-pick').datePicker( {startDate: '01/01/2007', altFormat: 'mm/dd/yyyy', dateFormat: 
'mm/dd/yyyy'} );

    $('textarea.tinymce').tinymce({
      script_url : '/javascripts/tiny_mce/tiny_mce.js',
    });
  });
</script>

<div>
<input class="date-pick" id="release_date" name="release_date" size="30" 
type="text" 
value="">
</div>

<div>
<textarea class="tinymce" cols="40" id="announcement_body" 
name="announcement[body]" 
rows="20"><p>Lorem Ipsum dolor</p></textarea>
</div>

Original issue reported on code.google.com by newelli...@gmail.com on 8 Mar 2010 at 5:09

GoogleCodeExporter commented 9 years ago
For some reason when tinymce is used, only the first argument passed to jquery's
append method will actually be appended.  If you change the commas on lines 
829, 839,
848, 858, and 867 to ').append(' in jquery.datepicker.js, the datepicker field 
works
correctly.

Passing multiple arguments to jQuery.append isn't directly specified in docs
(http://api.jquery.com/append/), but there are some user comments that indicate 
that
is it a feature.

Original comment by mackeyn@gmail.com on 15 Apr 2010 at 7:22

GoogleCodeExporter commented 9 years ago
Yeah - I have run into this before (mine is one of the comments on the bottom 
of the
docs page). It is certainly weird that TinyMCE changes the behaviour of the 
jQuery
core - I tend to think of this as a TinyMCE bug... 

I could obviously change the plugin code to call append multiple times but I 
think
the current code is more elegant (and works fine when TinyMCE hasn't got 
involved). I
wrote that comment on the docs to try and get "official" feedback on whether 
append
_should_ accept multiple items but there doesn't appear to be anything 
official...

Original comment by kelvin.l...@gmail.com on 15 Apr 2010 at 9:48

GoogleCodeExporter commented 9 years ago
I'm glad this discussion has got underway, as I think Kelvin's datepicker is 
the best
one out there.  Unfortunately, I too am running with TinyMCE and therefore the 
picker
doesnt show up.

However, I am unable to get the same results as Mack (comment 1) when 
downloading the
datepicker.js from the main page and even the google repository because the line
numbers he has provided dont match up to anything.

Kelvin, is it possible to either release a proper patch file or another js file 
if
you have tinymce on the same page please?

Thanks

Original comment by paulmos...@gmail.com on 18 Apr 2010 at 11:22

GoogleCodeExporter commented 9 years ago
My line numbers must have referred to an older version.  I've attached a patch
generated with the [$Id: jquery.datePicker.js 94 2010-01-25 02:25:27Z 
kelvin.luck $]
version.

My preference is for the datepicker to work properly no matter what else it's 
used
with.  This does look like a tinymce issue, but the use of append with multiple
arguments is undocumented.  I dug into the jQuery source and it appears that 
multiple
arguments should work.  Unfortunately, I don't have the time to spare at the 
moment
to dig deeper.

I also strive to write clean, concise code, but in this situation, it may be 
best to
apply the 5 line patch to safeguard against this issue.

Original comment by mackeyn@gmail.com on 21 Apr 2010 at 1:22

Attachments: