How to use the @sanity/mutator.ImmutableAccessor function in @sanity/mutator

To help you get started, we’ve selected a few @sanity/mutator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sanity-io / sanity / src / inputs / Reference / common / ValueContainer.js View on Github external
getAttribute(key) {
    return new ImmutableAccessor(this.value[key])
  }
github sanity-io / sanity / packages / @sanity / form-builder / src / inputs / Object / ObjectContainer.js View on Github external
getAttribute(key) {
    if (key === '_key') {
      return new ImmutableAccessor(this.key)
    }
    if (key === '_id') {
      return new ImmutableAccessor(this.value._id)
    }
    return this.value[key]
  }
github sanity-io / sanity / packages / @sanity / block-editor / src / accessors.js View on Github external
getAttribute(attr) {
    if (attr === '_type') {
      return new ImmutableAccessor('textspan')
    }
    if (attr === 'content') {
      return new ImmutableAccessor(this.content)
    }
    if (attr === 'marks') {
      return new ImmutableAccessor(this.marks)
    }
    throw new Error(`Unknown key "${attr}"`)
  }
github sanity-io / sanity / packages / @sanity / form-builder / src / inputs / BlockEditor-slate / applySanityPatches.js View on Github external
getAttribute(key) {
      if (key == '_id') {
        return new ImmutableAccessor(FAKE_ID)
      }
      if (key == FAKE_KEY) {
        return value
      }
      return null
    },
    setAttributeAccessor(key, accessor) {
github sanity-io / sanity / packages / @sanity / form-builder / src / inputs / BlockEditor-slate / accessors.js View on Github external
getAttribute(attr) {
    if (attr === '_type') {
      return new ImmutableAccessor('textspan')
    }
    if (attr === 'content') {
      return new ImmutableAccessor(this.content)
    }
    if (attr === 'marks') {
      return new ImmutableAccessor(this.marks)
    }
    throw new Error(`Unknown key "${attr}"`)
  }
github sanity-io / sanity / packages / @sanity / form-builder / src / inputs / Object / ObjectContainer.js View on Github external
getAttribute(key) {
    if (key === '_key') {
      return new ImmutableAccessor(this.key)
    }
    if (key === '_id') {
      return new ImmutableAccessor(this.value._id)
    }
    return this.value[key]
  }
github sanity-io / sanity / packages / @sanity / block-editor / src / accessors.js View on Github external
getAttribute(attr) {
    if (attr === '_type') {
      return new ImmutableAccessor('textspan')
    }
    if (attr === 'content') {
      return new ImmutableAccessor(this.content)
    }
    if (attr === 'marks') {
      return new ImmutableAccessor(this.marks)
    }
    throw new Error(`Unknown key "${attr}"`)
  }

@sanity/mutator

A set of models to make it easier to utilize the powerful real time collaborative features of Sanity

MIT
Latest version published 3 days ago

Package Health Score

98 / 100
Full package analysis