Sha256: d0c5df206d3fe1da303fa142aec671ad996b164bb649c545e03beda49f118c56

Contents?: true

Size: 615 Bytes

Versions: 10

Compression:

Stored size: 615 Bytes

Contents

Editor.Parsers.add 'image', class
  rule: /^(!{1}\[([^\]]+)\])(\(([^\s]+)?\))$/i

  constructor: (node) ->
    @walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT)

  isMatched: =>
    @match = @rule.exec(@walker.root.textContent)
    @match?

  render: =>
    @figure = EditorElements.content.querySelector("[as='Editor.Image']").cloneNode(true)

    @caption = @figure.querySelector('figcaption')
    @caption.appendChild document.createTextNode(@match[1])
    @caption.appendChild document.createTextNode(@match[3])
    if @match[4]?
      @caption.setAttribute('name', @match[4])

    return @figure

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ecrire-0.30.3 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.30.2 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.30.1 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.30.0 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.29.0 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.28.3 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.28.2 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.28.1 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.28.0 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.27.0 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee