Add default question block structure and validation for properties in question editor
This commit is contained in:
@@ -268,6 +268,14 @@
|
|||||||
currentContent = JSON.parse(JSON.stringify(question_editor.get().json));
|
currentContent = JSON.parse(JSON.stringify(question_editor.get().json));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!currentContent) {
|
||||||
|
currentContent = {
|
||||||
|
title: questionBlockTitleInput.value || "Case Questions",
|
||||||
|
type: "object",
|
||||||
|
properties: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (!currentContent.properties) {
|
if (!currentContent.properties) {
|
||||||
currentContent.properties = {};
|
currentContent.properties = {};
|
||||||
current_question_number = 1;
|
current_question_number = 1;
|
||||||
@@ -402,6 +410,10 @@
|
|||||||
} catch {
|
} catch {
|
||||||
currentContent = JSON.parse(JSON.stringify(question_editor.get().json));
|
currentContent = JSON.parse(JSON.stringify(question_editor.get().json));
|
||||||
}
|
}
|
||||||
|
if (!currentContent || !currentContent.properties) {
|
||||||
|
console.warn('No properties found in the current content.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const properties = currentContent.properties || {};
|
const properties = currentContent.properties || {};
|
||||||
|
|
||||||
// Sort questions by propertyOrder
|
// Sort questions by propertyOrder
|
||||||
|
|||||||
Reference in New Issue
Block a user