Sha256: b166fab2e39dc832fe4cfd7099cc553952c8a2856fa0cd6e39412fa43fc77330
Contents?: true
Size: 1.13 KB
Versions: 4
Compression:
Stored size: 1.13 KB
Contents
#= require trix/models/attachment #= require trix/models/piece Trix.Piece.registerType "attachment", class Trix.AttachmentPiece extends Trix.Piece @fromJSON: (pieceJSON) -> new this Trix.Attachment.fromJSON(pieceJSON.attachment), pieceJSON.attributes constructor: (@attachment) -> super @length = 1 @ensureAttachmentExclusivelyHasAttribute("href") ensureAttachmentExclusivelyHasAttribute: (attribute) -> if @hasAttribute(attribute) and @attachment.hasAttribute(attribute) @attributes = @attributes.remove(attribute) getValue: -> @attachment isSerializable: -> not @attachment.isPending() getCaption: -> @attributes.get("caption") ? "" getAttributesForAttachment: -> @attributes.slice(["caption"]) canBeGrouped: -> super and not @attachment.hasAttribute("href") isEqualTo: (piece) -> super and @attachment.id is piece?.attachment?.id toString: -> Trix.OBJECT_REPLACEMENT_CHARACTER toJSON: -> json = super json.attachment = @attachment json getCacheKey: -> [super, @attachment.getCacheKey()].join("/") toConsole: -> JSON.stringify(@toString())
Version data entries
4 entries across 4 versions & 1 rubygems