plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
function() {
      var interval,
          that          = this,
          form          = this.textarea.element.form,
          startInterval = function() {
            interval = setInterval(function() { that.fromComposerToTextarea(); }, INTERVAL);
          },
          stopInterval  = function() {
            clearInterval(interval);
            interval = null;
          };

      startInterval();

      if (form) {
        // If the textarea is in a form make sure that after onreset and onsubmit the composer
        // has the correct state
        wysihtml5.dom.observe(form, "submit", function() {
          that.sync(true);
        });
        wysihtml5.dom.observe(form, "reset", function() {
          setTimeout(function() { that.fromTextareaToComposer(); }, 0);
        });
      }

      this.editor.on("change_view", function(view) {
        if (view === "composer" && !interval) {
          that.fromTextareaToComposer(true);
          startInterval();
        } else if (view === "textarea") {
          that.fromComposerToTextarea(true);
          stopInterval();
        }
      });

      this.editor.on("destroy:composer", stopInterval);
    }
function() {
      var interval,
          that          = this,
          form          = this.textarea.element.form,
          startInterval = function() {
            interval = setInterval(function() { that.fromComposerToTextarea(); }, INTERVAL);
          },
          stopInterval  = function() {
            clearInterval(interval);
            interval = null;
          };

      startInterval();

      if (form) {
        // If the textarea is in a form make sure that after onreset and onsubmit the composer
        // has the correct state
        wysihtml5.dom.observe(form, "submit", function() {
          that.sync(true);
        });
        wysihtml5.dom.observe(form, "reset", function() {
          setTimeout(function() { that.fromTextareaToComposer(); }, 0);
        });
      }

      this.editor.on("change_view", function(view) {
        if (view === "composer" && !interval) {
          that.fromTextareaToComposer(true);
          startInterval();
        } else if (view === "textarea") {
          that.fromComposerToTextarea(true);
          stopInterval();
        }
      });

      this.editor.on("destroy:composer", stopInterval);
    }
function ( ) { var interval , that = this , form = this . textarea . element . form , startInterval = function ( ) { interval = setInterval ( function ( ) { that . fromComposerToTextarea ( ) ; } , INTERVAL ) ; } , stopInterval = function ( ) { clearInterval ( interval ) ; interval = null ; } ; startInterval ( ) ; if ( form ) { // If the textarea is in a form make sure that after onreset and onsubmit the composer // has the correct state wysihtml5 . dom . observe ( form , "submit" , function ( ) { that . sync ( true ) ; } ) ; wysihtml5 . dom . observe ( form , "reset" , function ( ) { setTimeout ( function ( ) { that . fromTextareaToComposer ( ) ; } , 0 ) ; } ) ; } this . editor . on ( "change_view" , function ( view ) { if ( view === "composer" && ! interval ) { that . fromTextareaToComposer ( true ) ; startInterval ( ) ; } else if ( view === "textarea" ) { that . fromComposerToTextarea ( true ) ; stopInterval ( ) ; } } ) ; this . editor . on ( "destroy:composer" , stopInterval ) ; }
Initializes interval-based syncing
also makes sure that on-submit the composer's content is synced with the textarea
immediately when the form gets submitted
Initializes interval - based syncing also makes sure that on - submit the composer s content is synced with the textarea immediately when the form gets submitted