Parent node contains the question
This commit is contained in:
parent
00f4e08627
commit
405113e639
1 changed files with 12 additions and 12 deletions
|
@ -18,7 +18,7 @@ async function fetchQuizzes() {
|
|||
}
|
||||
|
||||
const main = () => {
|
||||
console.log("logseq-quizhub-plugin LOADED!");
|
||||
console.log("logseq-probo-plugin LOADED!");
|
||||
|
||||
logseq.Editor.registerSlashCommand("Get All Quizzes", async () => {
|
||||
const currBlock = await logseq.Editor.getCurrentBlock();
|
||||
|
@ -34,16 +34,16 @@ const main = () => {
|
|||
|
||||
logseq.Editor.registerSlashCommand("Create a new Probo quiz", async () => {
|
||||
await logseq.Editor.insertAtEditingCursor(
|
||||
`{{renderer :quizhub_${uniqueIdentifier()}}}`
|
||||
`{{renderer :probo_${uniqueIdentifier()}}}`
|
||||
);
|
||||
|
||||
const currBlock = await logseq.Editor.getCurrentBlock();
|
||||
await logseq.Editor.insertBlock(currBlock.uuid, 'Write your question here...',
|
||||
{
|
||||
sibling: false,
|
||||
before: false,
|
||||
}
|
||||
);
|
||||
// const currBlock = await logseq.Editor.getCurrentBlock();
|
||||
// await logseq.Editor.insertBlock(currBlock.uuid, 'Write your question here...',
|
||||
// {
|
||||
// sibling: false,
|
||||
// before: false,
|
||||
// }
|
||||
// );
|
||||
|
||||
// await logseq.Editor.exitEditingMode();
|
||||
|
||||
|
@ -52,7 +52,7 @@ const main = () => {
|
|||
logseq.App.onMacroRendererSlotted(async ({ slot, payload }) => {
|
||||
const [type] = payload.arguments;
|
||||
const id = type.split("_")[1]?.trim();
|
||||
const quizhubId = `quizhub_${id}`;
|
||||
const proboId = `probo_${id}`;
|
||||
|
||||
logseq.provideModel({
|
||||
async postQuiz() {
|
||||
|
@ -64,7 +64,7 @@ const main = () => {
|
|||
})
|
||||
return { question: question, answers: answers, uuid: child.uuid }
|
||||
});
|
||||
quizzes.forEach(async (quiz, i) => {
|
||||
quizzes.forEach(async (quiz, i) => {
|
||||
const res = await fetch(endpoint, { method: 'POST', body: JSON.stringify(quiz) })
|
||||
const data = await res.json();
|
||||
const block = await logseq.Editor.getBlock(quiz.uuid)
|
||||
|
@ -90,7 +90,7 @@ const main = () => {
|
|||
`);
|
||||
|
||||
logseq.provideUI({
|
||||
key: `${quizhubId}`,
|
||||
key: `${proboId}`,
|
||||
slot,
|
||||
reset: true,
|
||||
template: `<button data-on-click="postQuiz" class="renderBtn">Save</button>`,
|
||||
|
|
Loading…
Reference in a new issue