Sha256: a76c2537bc5383efb4731737e7f8cdc54f99917b86153fa5504f15910e589519

Contents?: true

Size: 753 Bytes

Versions: 13

Compression:

Stored size: 753 Bytes

Contents

getCkEditorFuncNum = ->
  reParam = new RegExp( '(?:[\?&]|&)' + 'CKEditorFuncNum' + '=([^&]+)', 'i' )
  match = window.location.search.match(reParam)

  if match && match.length > 0
    match[1]

$(document).on 'click', 'a[data-insert-ck-asset]', (event) ->
  ckeditor = getCkEditorFuncNum()

  if ckeditor && window.opener && window.opener.CKEDITOR
    event.preventDefault()

    attachment = $(event.currentTarget)

    url = attachment.attr('href') || attachment.attr('src')
    alt = attachment.attr('alt') || ''

    window.opener.CKEDITOR.tools.callFunction(ckeditor, url, ->
      dialog = this.getDialog()

      if dialog && dialog.getName() == 'image2'
        dialog.getContentElement('info', 'alt').setValue(alt)
    )

    window.close()

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
effective_regions-1.11.0 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.10.3 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.10.2 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.10.1 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.10.0 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.9.0 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.8.6 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.8.5 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.8.4 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.7.6 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.8.3 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.8.2 app/assets/javascripts/ck_assets.js.coffee
effective_regions-1.8.1 app/assets/javascripts/ck_assets.js.coffee