<commit_before>class App.Views.EditorButtons extends Backbone.View

  el: 'form'

  events:
    'click a.button.markdown': 'launchMarkdownEditor'
    'click a.button.wysiwyg': 'launchWysiwygEditor'

  initialize: ->
    @mdPage = new App.Views.AjaxPage
      klass: 'markdown-editor'
    @wysiPage = new App.Views.AjaxPage
      klass: 'wysiwyg-editor'

  launchMarkdownEditor: (e) ->
    e.preventDefault()
    if $('form#markdown_editor').length > 0
      @mdPage.openPage()
    else
      $.get $(e.target).attr('href'), (data) =>
        @mdPage.loadContent('Markdown Editor', data)
        new App.Views.MarkdownEditor
          markdownField: '#page_body_md'
          wysiwygField: '#page_body'
        $('.right.half').find('.content').html """
          <p class="text-center">Loading preview. Please wait ...</p>
          """

  launchWysiwygEditor: (e) ->
    e.preventDefault()
    if $('form#wysiwyg_editor').length > 0
      @wysiPage.openPage()
    else
      $.get $(e.target).attr('href'), (data) =>
        @wysiPage.loadContent('Rich Text Editor', data)
        new App.Views.WysiwygEditor
          markdownField: '#page_body_md'
          wysiwygField: '#page_body'<commit_msg>don't show loading message on markdown editor if there is no content<commit_after>class App.Views.EditorButtons extends Backbone.View

  el: 'form'

  events:
    'click a.button.markdown': 'launchMarkdownEditor'
    'click a.button.wysiwyg': 'launchWysiwygEditor'

  initialize: ->
    @mdPage = new App.Views.AjaxPage
      klass: 'markdown-editor'
    @wysiPage = new App.Views.AjaxPage
      klass: 'wysiwyg-editor'

  launchMarkdownEditor: (e) ->
    e.preventDefault()
    if $('form#markdown_editor').length > 0
      @mdPage.openPage()
    else
      $.get $(e.target).attr('href'), (data) =>
        @mdPage.loadContent('Markdown Editor', data)
        new App.Views.MarkdownEditor
          markdownField: '#page_body_md'
          wysiwygField: '#page_body'
        unless $('.left.half textarea').val() == ''
          $('.right.half').find('.content').html """
            <p class="text-center">Loading preview. Please wait ...</p>
            """

  launchWysiwygEditor: (e) ->
    e.preventDefault()
    if $('form#wysiwyg_editor').length > 0
      @wysiPage.openPage()
    else
      $.get $(e.target).attr('href'), (data) =>
        @wysiPage.loadContent('Rich Text Editor', data)
        new App.Views.WysiwygEditor
          markdownField: '#page_body_md'
          wysiwygField: '#page_body'
{'fraction_non_alphanumeric': 0.1509358821186778, 'fraction_numerical': 0.0015929908403026682, 'mean_word_length': 2.7492537313432837, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5010577', 'n_tokens_mistral': 840, 'n_tokens_neox': 815, 'n_words': 157}