SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/admin/style_guide/richtext.php

  1. <?php
  2. use Sprout\Helpers\Form;
  3. use Sprout\Helpers\Needs;
  4.  
  5.  
  6. Needs::fileGroup('underscore');
  7. ?>
  8.  
  9.  
  10. <script>
  11. $(document).ready(function() {
  12. window.setTimeout(init, 1); // Needs to be after TinyMCE has loaded
  13. function init() {
  14. var mce = tinymce.get('richtext');
  15. var $pre = $('.preview');
  16. function updatePreview() {
  17. $pre.text(mce.getContent());
  18. }
  19. mce.on('change keyup', _.throttle(updatePreview, 250));
  20. updatePreview();
  21. }
  22. });
  23. </script>
  24.  
  25.  
  26. <div class="-clearfix">
  27. <div class="col col--one-half">
  28. <?php
  29. echo Form::richtext('richtext', []);
  30. ?>
  31. </div>
  32. <div class="col col--one-half">
  33. <pre class="preview"></pre>
  34. </div>
  35. </div>
  36.