Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Emoji img attributes configurable #258

Closed
wants to merge 3 commits into from

Commits on Jun 28, 2016

  1. Configuration menu
    Copy the full SHA
    6e5cd67 View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2016

  1. Configuration menu
    Copy the full SHA
    1b3e5e4 View commit details
    Browse the repository at this point in the history

Commits on Jun 30, 2016

  1. Put all logics into the emoji_image_tag method

    1. User can specify a hash `context[:img_attrs]` to change the `img` tag
    attributes, e.g. `{ "draggable" => false }`
    
    2. The hash key can be either `String` / `Symbol` (indifferent access)
    
      `{ "draggable" => false }` / `{ draggable: false }`
    
      =>
    
      `<img draggable="false">`
    
    3. The hash value can be either anything / proc-like object
    
      Proc-like object with default argument `name`:
    
      Given name is `:shipit:`
    
      `{ title: ->(name) { |n| n.gsub(":", "") } }`
    
      =>
    
      `<img title="shipit">`
    
      So you can do any customisations with the attribute.
    
    4. The hash value nil means clear the attribute of img tag
    
      For example, to clear the default `height`, `width`, and `align`
      attributes, pass `{ height: nil, width: nil, align: nil }` to
      `context[:img_attrs]`.
    
    5. Refine tests with consistent styles
    JuanitoFatas committed Jun 30, 2016
    Configuration menu
    Copy the full SHA
    f1c1618 View commit details
    Browse the repository at this point in the history