Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const DocumentPaneProvider = withInitialValue((props: Props) => {
const {patch, commit}: any = useDocumentOperation(props.options.id, props.options.type)
const editState: any = useEditState(props.options.id, props.options.type)
const runThrottled = useThrottled(run => run(), 1000, {leading: true, trailing: true}, [])
const value = (editState && (editState.draft || editState.published)) || props.initialValue
return (
{
patch.execute(patches)
runThrottled(commit.execute)
}}
value={value}
draft={editState && editState.draft}
published={editState && editState.published}
markers={editState ? editState.validation : []}
isLoading={!editState}
export function HistoryStatusBarActions(props: HistoryStatusBarActionsProps) {
const editState: any = useEditState(props.id, props.type)
if (!editState) {
return null
}
const actionProps = {...editState, historyId: props.historyId, revision: props.revision}
return (
{
/*todo: make optional*/
}}
/>
)
}
export function DocumentStatusBarActions(props: Props) {
const editState = useEditState(props.id, props.type)
const [isMenuOpen, setMenuOpen] = React.useState(false)
const actions = editState ? resolveDocumentActions(editState) : null
return actions ? (
setMenuOpen(true)}
onMenuClose={() => setMenuOpen(false)}
onActionComplete={() => setMenuOpen(false)}
actions={actions}
actionProps={editState}
/>
) : null
}