Integration of WYSIWYG editor to best-in-place textarea

前端 未结 5 944
無奈伤痛
無奈伤痛 2021-02-15 10:54

I\'m using best_in_place gem to editing client\'s info in-place.

My question is, how can I integrate a WYSIWYG Editor for editing this content as HTML? I\'m currently us

5条回答
  •  梦毁少年i
    2021-02-15 11:12

    It could be a simple indentation issue of coffeescript. Just indent the lines below $(document).ready -> by a tab.

    $(document).ready ->
      # Activating Best In Place
      jQuery(".best_in_place").best_in_place()
    
      # Loading editor
      $(".wysihtml5").each (i, elem) ->
      $(elem).wysihtml5()
    

    To validate further, copy your code in the coffeescript frame @ http://js2coffee.org/: the resulting javascript should look like this:-

    $(document).ready(function() {
      jQuery(".best_in_place").best_in_place();
      $(".wysihtml5").each(function(i, elem) {});
      return $(elem).wysihtml5();
    });
    

    That is, the plugins should be called after the dom is loaded.

提交回复
热议问题