Skip to content

Commit

Permalink
fix: method patch not working in tree and table mode when the con…
Browse files Browse the repository at this point in the history
…tent is text
  • Loading branch information
josdejong committed Oct 25, 2024
1 parent a315e6f commit 5f1c8a5
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/lib/components/JSONEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
<script lang="ts">
import { createDebug } from '../utils/debug.js'
import { uniqueId } from '../utils/uniqueId.js'
import {
isEqualParser,
isJSONContent,
isTextContent,
validateContentType
} from '../utils/jsonUtils.js'
import { isEqualParser, isJSONContent, validateContentType } from '../utils/jsonUtils.js'
import AbsolutePopup from './modals/popup/AbsolutePopup.svelte'
import { jsonQueryLanguage } from '$lib/plugins/query/jsonQueryLanguage.js'
import { renderValue } from '$lib/plugins/value/renderValue.js'
Expand Down Expand Up @@ -177,17 +172,6 @@
}
export async function patch(operations: JSONPatchDocument): Promise<JSONPatchResult> {
if (isTextContent(content)) {
try {
content = {
json: parser.parse(content.text),
text: undefined
}
} catch {
throw new Error('Cannot apply patch: current document contains invalid JSON')
}
}
// Note that patch has an optional afterPatch callback.
// right now we don's support this in the public API.
const result = refJSONEditorRoot.patch(operations)
Expand Down

0 comments on commit 5f1c8a5

Please sign in to comment.