Sha256: 3e2b792d702c43ab462c0629ec645689638fd2801fa001f6258df638a3c16512

Contents?: true

Size: 1.35 KB

Versions: 11

Compression:

Stored size: 1.35 KB

Contents

/*jslint newcap: true */
/*global inlineAttachment: false, jQuery: false */
/**
 * jQuery plugin for inline attach
 *
 * @param {document} document
 * @param {window} window
 * @param {jQuery} $
 */
(function(document, window, $) {
  'use strict';

  inlineAttachment.editors.jquery = {};

  /**
   * Creates a new editor using jQuery
   */
  var editor = function(instance) {

    var $this = $(instance);

    return {
      getValue: function() {
        return $this.val();
      },
      insertValue: function(val) {
        inlineAttachment.util.insertTextAtCursor($this[0], val);
      },
      setValue: function(val) {
        $this.val(val);
      }
    };
  };

  $.fn.inlineattachment = function(options) {

    var set = $(this);

    set.each(function() {

      var $this = $(this),
        ed = new editor($this),
        inlineattach = new inlineAttachment(options, ed);

      $this.bind({
        'paste': function(e) {
          inlineattach.onPaste(e.originalEvent);
        },
        'drop': function(e) {
          e.stopPropagation();
          e.preventDefault();
          inlineattach.onDrop(e.originalEvent);
        },
        'dragenter dragover': function(e) {
          e.stopPropagation();
          e.preventDefault();
        }
      });
    });

    return this;
  };

  inlineAttachment.editors.jquery.Editor = editor;

})(document, window, jQuery);

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.7.2 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.7.0 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.6.7 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.6.6 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.6.5 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.6.4 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.6.3 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.6.2 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.6.1 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.6.0 vendor/assets/javascripts/jquery.inline-attachment.js
decidim-decidim_awesome-0.5.1 vendor/assets/javascripts/jquery.inline-attachment.js