<commit_before>WysiwygSelectView = OrchestraView.extend(
  events:
    'click #sendToTiny': 'sendToTiny'
    'change #media_crop_format' : 'changeCropFormat'

  initialize: (options) ->
    @options = @reduceOption(options, [
      'domContainer'
      'html'
      'thumbnails'
    ])
    @loadTemplates [
        'OpenOrchestraMediaAdminBundle:BackOffice:Underscore/Include/previewImageView',
      ]
    return

  render: (options) ->
    @setElement $(@options.html).append(@renderTemplate('OpenOrchestraMediaAdminBundle:BackOffice:Underscore/Include/previewImageView'
      src: @options.thumbnails["original"]
    ))
    @options.domContainer.html @$el

  changeCropFormat: (event) ->
    format = $(event.currentTarget).val()
    $('#preview_thumbnail', @$el).attr 'src', @options.thumbnails[format]
 
  sendToTiny: (event) ->
    modalContainer = @$el.closest(".mediaModalContainer")
    editorId = modalContainer.data("input")
    tinymce.get(editorId).execCommand(
      'mceInsertContent',
      false,
      '<img src="' + @options.thumbnails[$('#media_crop_format').val()] + '"/>'
    )
    modalContainer.find('.mediaModalClose').click()
)
<commit_msg>add original format to select<commit_after>WysiwygSelectView = OrchestraView.extend(
  events:
    'click #sendToTiny': 'sendToTiny'
    'change #media_crop_format' : 'changeCropFormat'

  initialize: (options) ->
    @options = @reduceOption(options, [
      'domContainer'
      'html'
      'thumbnails'
    ])
    @loadTemplates [
        'OpenOrchestraMediaAdminBundle:BackOffice:Underscore/Include/previewImageView',
      ]
    return

  render: (options) ->
    @setElement $(@options.html).append(@renderTemplate('OpenOrchestraMediaAdminBundle:BackOffice:Underscore/Include/previewImageView'
      src: @options.thumbnails["original"]
    ))
    @options.domContainer.html @$el
    $("option", "#media_crop_format").first().val("original")

  changeCropFormat: (event) ->
    format = $(event.currentTarget).val()
    $('#preview_thumbnail', @$el).attr 'src', @options.thumbnails[format]
 
  sendToTiny: (event) ->
    modalContainer = @$el.closest(".mediaModalContainer")
    editorId = modalContainer.data("input")
    tinymce.get(editorId).execCommand(
      'mceInsertContent',
      false,
      '<img src="' + @options.thumbnails[$('#media_crop_format').val()] + '"/>'
    )
    modalContainer.find('.mediaModalClose').click()
)

{'fraction_non_alphanumeric': 0.15477178423236515, 'fraction_numerical': 0.0, 'mean_word_length': 4.054507337526205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5563172', 'n_tokens_mistral': 777, 'n_tokens_neox': 766, 'n_words': 102}