Search working in the editor again
This commit is contained in:
parent
e30674a971
commit
5fb69ffcc5
|
@ -183,7 +183,7 @@ export default class JSONNode extends PureComponent {
|
|||
// this.renderActionMenuButton(),
|
||||
this.renderProperty(prop, index, eson, options),
|
||||
this.renderSeparator(),
|
||||
this.renderValue(eson._meta.value, eson._meta.searchResult, options),
|
||||
this.renderValue(eson._meta.value, eson._meta.searchValue, options),
|
||||
// this.renderFloatingMenuButton(),
|
||||
this.renderError(eson._meta.error)
|
||||
])
|
||||
|
@ -272,7 +272,7 @@ export default class JSONNode extends PureComponent {
|
|||
const editable = !isIndex && (!options.isPropertyEditable || options.isPropertyEditable(this.props.eson._meta.path))
|
||||
|
||||
const emptyClassName = (prop != null && prop.length === 0) ? ' jsoneditor-empty' : ''
|
||||
const searchClassName = prop != null ? JSONNode.getSearchResultClass(prop.searchResult) : ''
|
||||
const searchClassName = prop != null ? JSONNode.getSearchResultClass(eson._meta.searchProperty) : ''
|
||||
const escapedPropName = prop != null ? escapeHTML(prop, options.escapeUnicode) : null
|
||||
|
||||
if (editable) {
|
||||
|
@ -395,7 +395,7 @@ export default class JSONNode extends PureComponent {
|
|||
}
|
||||
|
||||
target.className = JSONNode.getValueClass(type, itsAnUrl, isEmpty) +
|
||||
JSONNode.getSearchResultClass(this.props.eson._meta.searchResult)
|
||||
JSONNode.getSearchResultClass(this.props.eson._meta.searchValue)
|
||||
target.title = itsAnUrl ? JSONNode.URL_TITLE : ''
|
||||
|
||||
// remove all classNames from childs (needed for IE and Edge)
|
||||
|
|
|
@ -642,8 +642,7 @@ export default class TreeMode extends Component {
|
|||
handlePrevious = (event) => {
|
||||
event.preventDefault()
|
||||
|
||||
const searchResults = search(this.state.data, this.state.search.text)
|
||||
if (searchResults) {
|
||||
if (this.state.search) {
|
||||
const { eson, active } = previousSearchResult(this.state.eson, this.state.search.matches, this.state.search.active)
|
||||
|
||||
this.setState({
|
||||
|
|
|
@ -57,6 +57,8 @@ export type ESONObject = {
|
|||
path: JSONPath,
|
||||
expanded?: boolean,
|
||||
selected?: boolean,
|
||||
searchProperty?: SearchResultStatus,
|
||||
searchValue?: SearchResultStatus
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,9 +66,11 @@ export type ESONArray = {
|
|||
_meta: {
|
||||
type: 'Array',
|
||||
path: JSONPath,
|
||||
length: number
|
||||
expanded?: boolean,
|
||||
selected?: boolean,
|
||||
length: number
|
||||
searchProperty?: SearchResultStatus,
|
||||
searchValue?: SearchResultStatus
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +80,8 @@ export type ESONValue = {
|
|||
path: JSONPath,
|
||||
value: null | boolean | string | number,
|
||||
selected?: boolean,
|
||||
searchResult?: SearchResultStatus
|
||||
searchProperty?: SearchResultStatus,
|
||||
searchValue?: SearchResultStatus
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue