Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

obojobo-chunks-question-bank

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obojobo-chunks-question-bank - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0-rc1

25

converter.js
import Common from 'obojobo-document-engine/src/scripts/common'
import ParameterNode from 'obojobo-document-engine/src/scripts/oboeditor/components/parameter-node'
import TextParameter from 'obojobo-document-engine/src/scripts/oboeditor/components/parameter-node/text-parameter'
import SelectParameter from 'obojobo-document-engine/src/scripts/oboeditor/components/parameter-node/select-parameter'

@@ -45,13 +46,13 @@ const QUESTION_BANK_NODE = 'ObojoboDraft.Chunks.QuestionBank'

nodes: [
ParameterNode.helpers.oboToSlate({
name: 'choose',
value: '' + node.content.choose,
display: 'Choose'
}),
ParameterNode.helpers.oboToSlate({
name: 'select',
value: node.content.select,
display: 'Select',
options: SELECT_TYPES
})
TextParameter.helpers.oboToSlate(
'choose',
'' + (node.content.choose || Infinity),
'Choose'
),
SelectParameter.helpers.oboToSlate(
'select',
node.content.select,
'Select',
SELECT_TYPES
)
]

@@ -58,0 +59,0 @@ }

@@ -35,2 +35,3 @@ import React from 'react'

oboToSlate: Converter.oboToSlate,
supportsChildren: true,
plugins

@@ -37,0 +38,0 @@ })

@@ -13,60 +13,2 @@ {

{
"object": "block",
"type": "ObojoboDraft.Chunks.QuestionBank.Settings",
"isVoid": false,
"data": {},
"nodes": [
{
"object": "block",
"type": "Parameter",
"isVoid": false,
"data": {
"name": "choose",
"display": "Choose",
"type": "type-text"
},
"nodes": [
{
"object": "text",
"leaves": [
{
"object": "leaf",
"text": "Infinity",
"marks": []
}
]
}
]
},
{
"object": "block",
"type": "Parameter",
"isVoid": true,
"data": {
"name": "select",
"display": "Select",
"options": [
"sequential",
"random",
"random-unseen"
],
"type": "type-select",
"current": "sequential"
},
"nodes": [
{
"object": "text",
"leaves": [
{
"object": "leaf",
"text": "",
"marks": []
}
]
}
]
}
]
},
{
"object":"block",

@@ -113,43 +55,35 @@ "type":"ObojoboDraft.Chunks.Question",

"object":"block",
"type":"ObojoboDraft.Chunks.MCAssessment.ChoiceList",
"type":"ObojoboDraft.Chunks.MCAssessment.MCChoice",
"isVoid":false,
"data":{},
"data":{"content":{"score":100}},
"nodes":[
{
"object":"block",
"type":"ObojoboDraft.Chunks.MCAssessment.MCChoice",
"type":"ObojoboDraft.Chunks.MCAssessment.MCAnswer",
"isVoid":false,
"data":{"content":{"score":100}},
"data":{},
"nodes":[
{
"object":"block",
"type":"ObojoboDraft.Chunks.MCAssessment.MCAnswer",
"isVoid":false,
"data":{},
"nodes":[
"object": "block",
"type": "oboeditor.component",
"nodes": [
{
"object": "block",
"type": "oboeditor.component",
"nodes": [
"object":"block",
"type":"ObojoboDraft.Chunks.Text",
"isVoid":false,
"data":{"content":{"indent":0}},
"nodes":[
{
"object":"block",
"type":"ObojoboDraft.Chunks.Text",
"type":"ObojoboDraft.Chunks.Text.TextLine",
"isVoid":false,
"data":{"content":{"indent":0}},
"data":{"indent":0},
"nodes":[
{
"object":"block",
"type":"ObojoboDraft.Chunks.Text.TextLine",
"isVoid":false,
"data":{"indent":0},
"nodes":[
"object":"text",
"leaves":[
{
"object":"text",
"leaves":[
{
"object":"leaf",
"text":"",
"marks":[]
}
]
"object":"leaf",
"text":"",
"marks":[]
}

@@ -165,40 +99,40 @@ ]

]
},
}
]
},
{
"object":"block",
"type":"ObojoboDraft.Chunks.MCAssessment.MCChoice",
"isVoid":false,
"data":{"content":{"score":0}},
"nodes":[
{
"object":"block",
"type":"ObojoboDraft.Chunks.MCAssessment.MCChoice",
"type":"ObojoboDraft.Chunks.MCAssessment.MCAnswer",
"isVoid":false,
"data":{"content":{"score":0}},
"data":{},
"nodes":[
{
"object":"block",
"type":"ObojoboDraft.Chunks.MCAssessment.MCAnswer",
"isVoid":false,
"data":{},
"nodes":[
"object": "block",
"type": "oboeditor.component",
"nodes": [
{
"object": "block",
"type": "oboeditor.component",
"nodes": [
"object":"block",
"type":"ObojoboDraft.Chunks.Text",
"isVoid":false,
"data":{"content":{"indent":0}},
"nodes":[
{
"object":"block",
"type":"ObojoboDraft.Chunks.Text",
"type":"ObojoboDraft.Chunks.Text.TextLine",
"isVoid":false,
"data":{"content":{"indent":0}},
"data":{"indent":0},
"nodes":[
{
"object":"block",
"type":"ObojoboDraft.Chunks.Text.TextLine",
"isVoid":false,
"data":{"indent":0},
"nodes":[
"object":"text",
"leaves":[
{
"object":"text",
"leaves":[
{
"object":"leaf",
"text":"",
"marks":[]
}
]
"object":"leaf",
"text":"",
"marks":[]
}

@@ -216,57 +150,2 @@ ]

]
},
{
"object":"block",
"type":"ObojoboDraft.Chunks.MCAssessment.Settings",
"isVoid":false,
"data":{},
"nodes":[
{
"object":"block",
"type":"Parameter",
"isVoid":true,
"data":{
"name":"responseType",
"display":"Response Type",
"options":["pick-one","pick-all"],
"type":"type-select",
"current":"Pick One"
},
"nodes":[
{
"object":"text",
"leaves":[
{
"object":"leaf",
"text":"",
"marks":[]
}
]
}
]
},
{
"object":"block",
"type":"Parameter",
"isVoid":true,
"data":{
"name":"shuffle",
"display":"Shuffle",
"type":"type-toggle",
"checked":true
},
"nodes":[
{
"object":"text",
"leaves":[
{
"object":"leaf",
"text":"",
"marks":[]
}
]
}
]
}
]
}

@@ -273,0 +152,0 @@ ]

{
"name": "obojobo-chunks-question-bank",
"version": "4.0.1",
"version": "4.1.0-rc1",
"license": "AGPL-3.0-only",

@@ -33,3 +33,3 @@ "description": "QuestionBank chunk for Obojobo",

"dependencies": {
"obojobo-lib-utils": "^4.0.1"
"obojobo-lib-utils": "^4.1.0-rc1"
},

@@ -36,0 +36,0 @@ "devDependencies": {

import { Block } from 'slate'
import ParameterNode from 'obojobo-document-engine/src/scripts/oboeditor/components/parameter-node'
import TextParameter from 'obojobo-document-engine/src/scripts/oboeditor/components/parameter-node/text-parameter'
import SelectParameter from 'obojobo-document-engine/src/scripts/oboeditor/components/parameter-node/select-parameter'
import SchemaViolations from 'obojobo-document-engine/src/scripts/oboeditor/util/schema-violations'

@@ -11,2 +12,4 @@

const QUESTION_NODE = 'ObojoboDraft.Chunks.Question'
const TEXT_PARAMETER = 'oboeditor.text-parameter'
const SELECT_PARAMETER = 'oboeditor.select-parameter'

@@ -54,8 +57,10 @@ import emptyQuestion from 'obojobo-chunks-question/empty-node.json'

{
match: [
{
type: 'Parameter'
}
],
min: 2
match: [{ type: TEXT_PARAMETER }],
min: 1,
max: 1
},
{
match: [{ type: SELECT_PARAMETER }],
min: 1,
max: 1
}

@@ -69,7 +74,7 @@ ],

const block = Block.create(
ParameterNode.helpers.oboToSlate({
name: 'choose',
value: 'Infinity',
display: 'Choose'
})
TextParameter.helpers.oboToSlate(
'choose',
'Infinity',
'Choose'
)
)

@@ -79,8 +84,8 @@ return editor.insertNodeByKey(node.key, index, block)

const block = Block.create(
ParameterNode.helpers.oboToSlate({
name: 'select',
value: 'sequential',
display: 'Select',
options: SELECT_TYPES
})
SelectParameter.helpers.oboToSlate(
'select',
'sequential',
'Select',
SELECT_TYPES
)
)

@@ -90,23 +95,26 @@ return editor.insertNodeByKey(node.key, index, block)

case CHILD_TYPE_INVALID: {
return editor.withoutNormalizing(c => {
c.removeNodeByKey(child.key)
if (index === 0) {
const block = Block.create(
ParameterNode.helpers.oboToSlate({
name: 'choose',
value: 'Infinity',
display: 'Choose'
})
if (index === 0) {
const block = Block.create(
TextParameter.helpers.oboToSlate(
'choose',
'Infinity',
'Choose'
)
return c.insertNodeByKey(node.key, index, block)
}
const block = Block.create(
ParameterNode.helpers.oboToSlate({
name: 'select',
value: 'sequential',
display: 'Select',
options: SELECT_TYPES
})
)
return c.insertNodeByKey(node.key, index, block)
return editor.withoutNormalizing(e => {
e.removeNodeByKey(child.key)
return e.insertNodeByKey(node.key, index, block)
})
}
const block = Block.create(
SelectParameter.helpers.oboToSlate(
'select',
'sequential',
'Select',
SELECT_TYPES
)
)
return editor.withoutNormalizing(e => {
e.removeNodeByKey(child.key)
return e.insertNodeByKey(node.key, index, block)
})

@@ -113,0 +121,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc