Sha256: d4a69b625e407478c16e41ef0c5320f48c493ad36dea6b5419dfa4fa626c3d48

Contents?: true

Size: 607 Bytes

Versions: 10

Compression:

Stored size: 607 Bytes

Contents

Editor.Parsers.push 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.26.3 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.26.2 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.26.1 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.26.0 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.25.2 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.25.1 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.25.0 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.24.1 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.24.0 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee
ecrire-0.23.0 lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee