Measurable Success «10 Checkpoints for Future-Proof Enterprise CMS» White Paper
Measurable Success - White Paper

canWrite()

Determines whether content is editable.

<input disabled={!Scrivito.canWrite()} />

Scrivito.canWrite determines whether any content is currently editable. For this to be true, the UI must be present, and the editor must be on a working copy (i.e. not the published content) and have permission to change its content. This check can be useful when providing custom editing components and custom dialogs.

Returns

booleantrue if any content is editable, otherwise false.

Example

Scrivito.registerComponent('YesOrNoTab', ({ page }) => (
  // ...
    <input
      type="checkbox"
      checked={page.get('yesOrNo') === 'yes'}
      disabled={!Scrivito.canWrite()}
      onChange={e => page.update({ yesOrNo: e.target.checked ? 'yes' : 'no' })}
    />
  // ...
));