You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Francois Meillet <fr...@gmail.com> on 2016/10/08 11:04:46 UTC

add some javascript callbacks to Wicket-Bootstrap # Summernote Editor configuration

Hi,
   
How can I add some javascript callbacks to Wicket-Bootstrap # Summernote Editor configuration, like the following


$(document).ready(function () {
     $('.summernote').summernote({
        
         callbacks: {
             onKeydown: function (e) { 
                 var t = e.currentTarget.innerText; 
                 if (t.trim().length >= 400) {
                     //delete key
                     // if (e.keyCode != 8)
                     // e.preventDefault(); 
                 } 
             },
             onKeyup: function (e) {
                 var t = e.currentTarget.innerText;
                 $('#maxContentPost').text(400 - t.trim().length);
             },
             onPaste: function (e) {
                 var t = e.currentTarget.innerText;
                 var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
                 e.preventDefault();
                 var all = t + bufferText;
                 document.execCommand('insertText', false, all.trim().substring(0, 400));
                 $('#maxContentPost').text(400 - t.length);
             }
         }
     });
 });
            
Thanks for your help
François     
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: add some javascript callbacks to Wicket-Bootstrap # Summernote Editor configuration

Posted by Francois Meillet <fr...@gmail.com>.
Thanks Martin

François



> Le 8 oct. 2016 à 22:09, Martin Grigorov <mg...@apache.org> a écrit :
> 
> Hi Francois,
> 
> You will need to
> extend de.agilecoders.wicket.extensions.markup.html.bootstrap.editor.SummernoteConfig
> and add those yourself.
> "callbacks" would extend from de.agilecoders.wicket.jquery.AbstractConfig.
> "onXyz" would be be
> a de.agilecoders.wicket.jquery.function.AbstractFunction. See the default
> impls.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Sat, Oct 8, 2016 at 1:04 PM, Francois Meillet <francois.meillet@gmail.com
>> wrote:
> 
>> Hi,
>> 
>> How can I add some javascript callbacks to Wicket-Bootstrap # Summernote
>> Editor configuration, like the following
>> 
>> 
>> $(document).ready(function () {
>>     $('.summernote').summernote({
>> 
>>         callbacks: {
>>             onKeydown: function (e) {
>>                 var t = e.currentTarget.innerText;
>>                 if (t.trim().length >= 400) {
>>                     //delete key
>>                     // if (e.keyCode != 8)
>>                     // e.preventDefault();
>>                 }
>>             },
>>             onKeyup: function (e) {
>>                 var t = e.currentTarget.innerText;
>>                 $('#maxContentPost').text(400 - t.trim().length);
>>             },
>>             onPaste: function (e) {
>>                 var t = e.currentTarget.innerText;
>>                 var bufferText = ((e.originalEvent || e).clipboardData ||
>> window.clipboardData).getData('Text');
>>                 e.preventDefault();
>>                 var all = t + bufferText;
>>                 document.execCommand('insertText', false,
>> all.trim().substring(0, 400));
>>                 $('#maxContentPost').text(400 - t.length);
>>             }
>>         }
>>     });
>> });
>> 
>> Thanks for your help
>> François
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: add some javascript callbacks to Wicket-Bootstrap # Summernote Editor configuration

Posted by Martin Grigorov <mg...@apache.org>.
Hi Francois,

You will need to
extend de.agilecoders.wicket.extensions.markup.html.bootstrap.editor.SummernoteConfig
and add those yourself.
"callbacks" would extend from de.agilecoders.wicket.jquery.AbstractConfig.
"onXyz" would be be
a de.agilecoders.wicket.jquery.function.AbstractFunction. See the default
impls.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sat, Oct 8, 2016 at 1:04 PM, Francois Meillet <francois.meillet@gmail.com
> wrote:

> Hi,
>
> How can I add some javascript callbacks to Wicket-Bootstrap # Summernote
> Editor configuration, like the following
>
>
> $(document).ready(function () {
>      $('.summernote').summernote({
>
>          callbacks: {
>              onKeydown: function (e) {
>                  var t = e.currentTarget.innerText;
>                  if (t.trim().length >= 400) {
>                      //delete key
>                      // if (e.keyCode != 8)
>                      // e.preventDefault();
>                  }
>              },
>              onKeyup: function (e) {
>                  var t = e.currentTarget.innerText;
>                  $('#maxContentPost').text(400 - t.trim().length);
>              },
>              onPaste: function (e) {
>                  var t = e.currentTarget.innerText;
>                  var bufferText = ((e.originalEvent || e).clipboardData ||
> window.clipboardData).getData('Text');
>                  e.preventDefault();
>                  var all = t + bufferText;
>                  document.execCommand('insertText', false,
> all.trim().substring(0, 400));
>                  $('#maxContentPost').text(400 - t.length);
>              }
>          }
>      });
>  });
>
> Thanks for your help
> François
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>