Skip to content

Commit

Permalink
populate js question from embedded post json
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed May 5, 2024
1 parent 43c526d commit 1c45b6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MyApp/Components/Shared/QuestionPost.razor
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

<div class="question-aside"></div>
</div>
<div>
<div class="w-full">
<div id=@($"preview-{Question.Id}") class="pb-6 preview xl:flex-grow prose">
@BlazorHtml.Raw(Markdown.GenerateHtml(Question.Post.Body))
</div>
Expand Down
8 changes: 8 additions & 0 deletions MyApp/wwwroot/mjs/question.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,14 @@ const EditQuestion = {
debounceApi(request.value.body)
}
})

const postJson = $1(`#Post`)?.innerHTML
if (postJson) {
const post = JSON.parse(postJson)
request.value.title = post.title
request.value.body = post.body
request.value.tags = post.tags
}
})

function close() {
Expand Down

0 comments on commit 1c45b6b

Please sign in to comment.