0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

🐛 Fixed snippet insertion in the new editor (#17003)

refs TryGhost/Team#3445
- The snippet model always expects an object as it gets serialized when
saving - if we give it a string, it gets doubly serialized. It breaks
snippet replacement and insertion in the new editor.
This commit is contained in:
Elena Baidakova 2023-06-13 15:51:23 +04:00 committed by GitHub
parent 6a9d01c6ad
commit 9f1279b58e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -392,7 +392,7 @@ export default class LexicalEditorController extends Controller {
const existingSnippet = this.snippets.find(snippet => snippet.name.toLowerCase() === snippetNameLC);
if (existingSnippet) {
await this.confirmUpdateSnippet(existingSnippet, {lexical: data.value});
await this.confirmUpdateSnippet(existingSnippet, {lexical: JSON.parse(data.value)});
} else {
await this.saveNewSnippet(data);
}