Learn how Scrivito CMS can help you deliver amazing digital experiences
See Scrivito CMS in action

canWrite()

Determines whether the content in a working copy is editable.

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

Scrivito.canWrite determines whether any content in a working copy 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 be its owner or have the “can edit” permission for it. This check can be used, for example, to prevent editors from changing content through custom editing components or custom dialogs. As opposed to Scrivito.canEdit, canWrite does not take account of workflows.

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' })} /> // ... ));