Skip to content

Commit

Permalink
[form-builder] PTE: implement custom FormField change indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin authored and rexxars committed Oct 6, 2020
1 parent 032a2f1 commit 80c1952
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/@sanity/form-builder/src/inputs/PortableText/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/require-default-props */
import classNames from 'classnames'
import {Subject} from 'rxjs'
import React, {useEffect, useState, useMemo} from 'react'
Expand All @@ -18,6 +17,7 @@ import {
import {Path, isKeySegment, Marker} from '@sanity/types'
import {uniqueId, isEqual} from 'lodash'
import ActivateOnFocus from 'part:@sanity/components/utilities/activate-on-focus'
import {ChangeIndicatorWithProvidedFullPath} from '@sanity/base/lib/change-indicators'
import {Portal} from 'part:@sanity/components/portal'
import StackedEscapeable from 'part:@sanity/components/utilities/stacked-escapable'
import PatchEvent from '../../PatchEvent'
Expand Down Expand Up @@ -360,7 +360,14 @@ export default function PortableTextInput(props: Props) {
onActivate={handleActivate}
overlayClassName={styles.activateOnFocusOverlay}
>
{ptEditor}
<ChangeIndicatorWithProvidedFullPath
compareDeep
value={value}
hasFocus={hasFocus}
path={[]}
>
{ptEditor}
</ChangeIndicatorWithProvidedFullPath>
</ActivateOnFocus>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export default withPatchSubscriber(
level={level}
markers={markers}
presence={presence}
changeIndicator={false}
>
<PortableTextInputWithRef {...this.props} ref={this.editorRef} />
</FormField>
Expand Down

0 comments on commit 80c1952

Please sign in to comment.