0.9.3 • Published 3 years ago

content-state v0.9.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

ContentState.js

API

Classes

Functions

expandAnnotation(annotation) ⇒ Object

Given a contentState annotation, add back in the context if it's missing. Given a mimimal target-only contentState, assume that it's a target and wrap it in the annotation.

Kind: global function Returns: Object - the annotation with any transformations applied

ParamTypeDescription
annotationObjectthe annotation to expand

validateAnnotation(annotation)

Given an annotation, confirm that it has the correct context and that it has a target property. Will throw errors if it is not.

Kind: global function

ParamTypeDescription
annotationObjectthe annotation to expand

isContentStateAnnotation(annotation) ⇒ Boolean

Inspect the motivation of an annotation and see if it contains the "contentState" motivation.

Kind: global function Returns: Boolean - true if it's a contentState Annotation, false if not.

ParamTypeDescription
annotationObjectthe annotation to inspect

encodeLink(url, annotation) ⇒ string

Helper function to create a full link that includes the annotation param.

Kind: global function Returns: string - The augmented URL

ParamTypeDescription
urlstringThe URL that should have a contentState param added.
annotationObjectThe annotation Object

parseURL(url) ⇒ Object

Extract the annotation information from a full URL

Kind: global function Returns: Object - The annotation data and manifest value

ParamTypeDescription
urlStringThe URL to parse

Credits

0.9.3

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.9.0

3 years ago