Fix indentation

This commit is contained in:
josdejong 2020-05-08 21:10:59 +02:00
parent 324e5053d9
commit bcd4553adb
1 changed files with 45 additions and 45 deletions

View File

@ -1,62 +1,62 @@
<script>
import Icon from 'svelte-awesome'
import { faSearch } from '@fortawesome/free-solid-svg-icons'
import Node from './JSONNode.svelte'
import { search } from './search'
import { immutableJSONPatch } from './utils/immutableJSONPatch'
import Icon from 'svelte-awesome'
import { faSearch } from '@fortawesome/free-solid-svg-icons'
import Node from './JSONNode.svelte'
import { search } from './search'
import { immutableJSONPatch } from './utils/immutableJSONPatch'
export let json = {}
export let onChangeJson = () => {}
export let searchText = ''
export let json = {}
export let onChangeJson = () => {}
export let searchText = ''
export function get() {
return json
}
export function get() {
return json
}
export function set(newJson) {
json = newJson
}
export function set(newJson) {
json = newJson
}
function getPath () {
return []
}
function getPath () {
return []
}
function doSearch (json, searchText) {
console.time('search')
const result = search(null, json, searchText)
console.timeEnd('search')
return result
}
function doSearch (json, searchText) {
console.time('search')
const result = search(null, json, searchText)
console.timeEnd('search')
return result
}
$: searchResult = searchText ? doSearch(json, searchText) : undefined
$: searchResult = searchText ? doSearch(json, searchText) : undefined
$: onChangeJson(json)
$: onChangeJson(json)
function handleChangeKey (key, oldKey) {
// console.log('handleChangeKey', { key, oldKey })
// TODO: this should not happen?
}
function handleChangeKey (key, oldKey) {
// console.log('handleChangeKey', { key, oldKey })
// TODO: this should not happen?
}
function handleChangeValue (value, key) {
// console.log('handleChangeValue', value, key)
// json = value
}
function handleChangeValue (value, key) {
// console.log('handleChangeValue', value, key)
// json = value
}
/**
* @param {JSONPatchDocument} operations
*/
/**
* @param {JSONPatchDocument} operations
*/
function handleChange (operations) {
// console.log('handleChange', operations)
// console.log('handleChange', operations)
// TODO: store changes in history
json = immutableJSONPatch(json, operations).json
// TODO: store changes in history
json = immutableJSONPatch(json, operations).json
}
</script>
<div class="jsoneditor">
<div class="menu">
<Icon data={faSearch} /> Search: <input class="search-input" bind:value={searchText} />
</div>
<div class="menu">
<Icon data={faSearch} /> Search: <input class="search-input" bind:value={searchText} />
</div>
<div class="contents">
<Node
value={json}
@ -64,7 +64,7 @@
expanded={true}
onChangeKey={handleChangeKey}
onChange={handleChange}
getParentPath={getPath}
getParentPath={getPath}
/>
</div>
</div>