@pie-element/drag-in-the-blank 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/author/choice.d.ts +23 -0
- package/dist/author/choice.d.ts.map +1 -0
- package/dist/author/choice.js +88 -0
- package/dist/author/choices.d.ts +41 -0
- package/dist/author/choices.d.ts.map +1 -0
- package/dist/author/choices.js +159 -0
- package/dist/author/defaults.d.ts +172 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +123 -0
- package/dist/author/index.d.ts +43 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +92 -0
- package/dist/author/main.d.ts +37 -0
- package/dist/author/main.d.ts.map +1 -0
- package/dist/author/main.js +301 -0
- package/dist/author/markupUtils.d.ts +18 -0
- package/dist/author/markupUtils.d.ts.map +1 -0
- package/dist/author/markupUtils.js +38 -0
- package/dist/author/utils.d.ts +10 -0
- package/dist/author/utils.d.ts.map +1 -0
- package/dist/author/utils.js +7 -0
- package/dist/controller/defaults.d.ts +27 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +20 -0
- package/dist/controller/index.d.ts +42 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +104 -0
- package/dist/controller/utils.d.ts +14 -0
- package/dist/controller/utils.d.ts.map +1 -0
- package/dist/controller/utils.js +15 -0
- package/dist/delivery/index.d.ts +22 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +105 -0
- package/dist/delivery/main.d.ts +29 -0
- package/dist/delivery/main.d.ts.map +1 -0
- package/dist/delivery/main.js +83 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.iife.d.ts +9 -0
- package/dist/index.iife.d.ts.map +1 -0
- package/dist/index.iife.js +152 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayReduce.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseEach.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseForOwn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseHasIn.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMatch.js +26 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIteratee.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMatches.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseProperty.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePropertyDeep.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePropertyOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseReduce.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseEach.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_escapeHtmlChar.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMatchData.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hasPath.js +18 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isStrictComparable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/escape.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/hasIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/property.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/reduce.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
- package/package.json +72 -0
- package/src/author/choice.tsx +132 -0
- package/src/author/choices.tsx +314 -0
- package/src/author/defaults.ts +132 -0
- package/src/author/index.tsx +176 -0
- package/src/author/main.tsx +498 -0
- package/src/author/markupUtils.tsx +106 -0
- package/src/author/utils.ts +27 -0
- package/src/controller/defaults.ts +27 -0
- package/src/controller/index.ts +274 -0
- package/src/controller/utils.ts +50 -0
- package/src/delivery/index.ts +266 -0
- package/src/delivery/main.tsx +146 -0
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/drag-in-the-blank/configure/src/main.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html-tip-tap';
|
|
14
|
+
import { layout, settings } from '@pie-lib/config-ui';
|
|
15
|
+
import { InputContainer as InputContainerImport } from '@pie-lib/render-ui';
|
|
16
|
+
|
|
17
|
+
function isRenderableReactInteropType(value: any) {
|
|
18
|
+
return (
|
|
19
|
+
typeof value === 'function' ||
|
|
20
|
+
(typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {
|
|
25
|
+
if (!maybeSymbol) return maybeSymbol;
|
|
26
|
+
if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;
|
|
27
|
+
if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;
|
|
28
|
+
if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {
|
|
29
|
+
return maybeSymbol[namedExport];
|
|
30
|
+
}
|
|
31
|
+
if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {
|
|
32
|
+
return maybeSymbol[namedExport].default;
|
|
33
|
+
}
|
|
34
|
+
return maybeSymbol;
|
|
35
|
+
}
|
|
36
|
+
const InputContainer = unwrapReactInteropSymbol(InputContainerImport, 'InputContainer') || unwrapReactInteropSymbol(renderUi.InputContainer, 'InputContainer');
|
|
37
|
+
import * as RenderUiNamespace from '@pie-lib/render-ui';
|
|
38
|
+
const renderUiNamespaceAny = RenderUiNamespace as any;
|
|
39
|
+
const renderUiDefaultMaybe = renderUiNamespaceAny['default'];
|
|
40
|
+
const renderUi =
|
|
41
|
+
renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'
|
|
42
|
+
? renderUiDefaultMaybe
|
|
43
|
+
: renderUiNamespaceAny;
|
|
44
|
+
import { DragProvider } from '@pie-lib/drag';
|
|
45
|
+
import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
|
|
46
|
+
import { styled } from '@mui/material/styles';
|
|
47
|
+
import Typography from '@mui/material/Typography';
|
|
48
|
+
import Info from '@mui/icons-material/Info';
|
|
49
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
50
|
+
import { DragOverlay } from '@dnd-kit/core';
|
|
51
|
+
|
|
52
|
+
import Choice from './choice.js';
|
|
53
|
+
import Choices from './choices.js';
|
|
54
|
+
import { createSlateMarkup } from './markupUtils.js';
|
|
55
|
+
import { generateValidationMessage } from './utils.js';
|
|
56
|
+
|
|
57
|
+
class DragPreviewWrapper extends React.Component {
|
|
58
|
+
containerRef = React.createRef();
|
|
59
|
+
|
|
60
|
+
componentDidMount() {
|
|
61
|
+
// Render math in the drag preview after it mounts
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
if (this.containerRef.current) {
|
|
64
|
+
renderMath(this.containerRef.current);
|
|
65
|
+
}
|
|
66
|
+
}, 0);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
componentDidUpdate() {
|
|
70
|
+
// Re-render math when the drag preview updates
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
if (this.containerRef.current) {
|
|
73
|
+
renderMath(this.containerRef.current);
|
|
74
|
+
}
|
|
75
|
+
}, 0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
render() {
|
|
79
|
+
return <div ref={this.containerRef}>{this.props.children}</div>;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const { dropdown, toggle, Panel } = settings;
|
|
84
|
+
|
|
85
|
+
const StyledInputContainer: any = styled(InputContainer)(({ theme }) => ({
|
|
86
|
+
width: '100%',
|
|
87
|
+
paddingTop: theme.spacing(2),
|
|
88
|
+
marginBottom: theme.spacing(2),
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
const StyledMarkup: any = styled('div')(({ theme }) => ({
|
|
92
|
+
minHeight: '235px',
|
|
93
|
+
paddingTop: theme.spacing(1),
|
|
94
|
+
paddingBottom: theme.spacing(2),
|
|
95
|
+
width: '100%',
|
|
96
|
+
'& [data-slate-editor="true"]': {
|
|
97
|
+
minHeight: '235px',
|
|
98
|
+
},
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
const StyledText: any = styled(Typography)(({ theme }) => ({
|
|
102
|
+
fontSize: theme.typography.fontSize + 2,
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
const StyledTooltip: any = styled(Tooltip)(({ theme }) => ({
|
|
106
|
+
'& .MuiTooltip-tooltip': {
|
|
107
|
+
fontSize: theme.typography.fontSize - 2,
|
|
108
|
+
whiteSpace: 'pre',
|
|
109
|
+
maxWidth: '500px',
|
|
110
|
+
},
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const ErrorText: any = styled('div')(({ theme }) => ({
|
|
114
|
+
fontSize: theme.typography.fontSize - 2,
|
|
115
|
+
color: theme.palette.error.main,
|
|
116
|
+
paddingTop: theme.spacing(1),
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
const FlexContainer: any = styled('div')({
|
|
120
|
+
display: 'flex',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export class Main extends React.Component {
|
|
125
|
+
static propTypes = {
|
|
126
|
+
configuration: PropTypes.object.isRequired,
|
|
127
|
+
model: PropTypes.object.isRequired,
|
|
128
|
+
disableSidePanel: PropTypes.bool,
|
|
129
|
+
onModelChanged: PropTypes.func.isRequired,
|
|
130
|
+
onConfigurationChanged: PropTypes.func.isRequired,
|
|
131
|
+
imageSupport: PropTypes.shape({
|
|
132
|
+
add: PropTypes.func.isRequired,
|
|
133
|
+
delete: PropTypes.func.isRequired,
|
|
134
|
+
}),
|
|
135
|
+
uploadSoundSupport: PropTypes.object,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
state = {
|
|
139
|
+
activeDragItem: null,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
constructor(props) {
|
|
143
|
+
super(props);
|
|
144
|
+
this.markupRef = React.createRef();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
onModelChange: any = (newVal) => {
|
|
148
|
+
this.props.onModelChanged({
|
|
149
|
+
...this.props.model,
|
|
150
|
+
...newVal,
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
onPromptChanged: any = (prompt) => {
|
|
155
|
+
this.props.onModelChanged({
|
|
156
|
+
...this.props.model,
|
|
157
|
+
prompt,
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
onRationaleChanged: any = (rationale) => {
|
|
162
|
+
this.props.onModelChanged({
|
|
163
|
+
...this.props.model,
|
|
164
|
+
rationale,
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
onTeacherInstructionsChanged: any = (teacherInstructions) => {
|
|
169
|
+
this.props.onModelChanged({
|
|
170
|
+
...this.props.model,
|
|
171
|
+
teacherInstructions,
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
onMarkupChanged: any = (slateMarkup) => {
|
|
176
|
+
this.props.onModelChanged({
|
|
177
|
+
...this.props.model,
|
|
178
|
+
slateMarkup,
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
onResponsesChanged: any = (choices) => {
|
|
183
|
+
const {
|
|
184
|
+
model: { correctResponse, markup },
|
|
185
|
+
} = this.props;
|
|
186
|
+
const slateMarkup = createSlateMarkup(markup, choices, correctResponse);
|
|
187
|
+
|
|
188
|
+
this.props.onModelChanged({
|
|
189
|
+
...this.props.model,
|
|
190
|
+
slateMarkup,
|
|
191
|
+
choices,
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
render() {
|
|
196
|
+
const { model, configuration, onConfigurationChanged, imageSupport, uploadSoundSupport } = this.props;
|
|
197
|
+
const {
|
|
198
|
+
addChoice = {},
|
|
199
|
+
baseInputConfiguration = {},
|
|
200
|
+
contentDimensions = {},
|
|
201
|
+
duplicates = {},
|
|
202
|
+
prompt = {},
|
|
203
|
+
partialScoring = {},
|
|
204
|
+
lockChoiceOrder = {},
|
|
205
|
+
rationale = {},
|
|
206
|
+
teacherInstructions = {},
|
|
207
|
+
choicesPosition = {},
|
|
208
|
+
spellCheck = {},
|
|
209
|
+
settingsPanelDisabled,
|
|
210
|
+
maxChoices,
|
|
211
|
+
maxResponseAreas,
|
|
212
|
+
maxImageWidth = {},
|
|
213
|
+
maxImageHeight = {},
|
|
214
|
+
withRubric = {},
|
|
215
|
+
mathMlOptions = {},
|
|
216
|
+
language = {},
|
|
217
|
+
languageChoices = {},
|
|
218
|
+
maxLength = {},
|
|
219
|
+
} = configuration || {};
|
|
220
|
+
const {
|
|
221
|
+
rationaleEnabled,
|
|
222
|
+
promptEnabled,
|
|
223
|
+
teacherInstructionsEnabled,
|
|
224
|
+
spellCheckEnabled,
|
|
225
|
+
toolbarEditorPosition,
|
|
226
|
+
errors,
|
|
227
|
+
extraCSSRules,
|
|
228
|
+
} = model || {};
|
|
229
|
+
|
|
230
|
+
const {
|
|
231
|
+
choicesError,
|
|
232
|
+
correctResponseError,
|
|
233
|
+
prompt: promptError,
|
|
234
|
+
rationale: rationaleError,
|
|
235
|
+
responseAreasError,
|
|
236
|
+
teacherInstructions: teacherInstructionsError,
|
|
237
|
+
} = errors || {};
|
|
238
|
+
const validationMessage = generateValidationMessage(configuration);
|
|
239
|
+
|
|
240
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
241
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
242
|
+
|
|
243
|
+
const toolbarOpts = {
|
|
244
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const panelSettings = {
|
|
248
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
249
|
+
duplicates: duplicates.settings && toggle(duplicates.label),
|
|
250
|
+
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
251
|
+
choicesPosition: choicesPosition.settings && dropdown(choicesPosition.label, ['above', 'below', 'left', 'right']),
|
|
252
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
253
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const panelProperties = {
|
|
257
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
258
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
259
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
260
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
261
|
+
rubricEnabled: withRubric?.settings && toggle(withRubric?.label),
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const getPluginProps = (props) => {
|
|
265
|
+
return Object.assign(
|
|
266
|
+
{
|
|
267
|
+
...baseInputConfiguration,
|
|
268
|
+
},
|
|
269
|
+
props || {},
|
|
270
|
+
);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
const onDragEnd = ({ active, over }) => {
|
|
275
|
+
// check if item was placed as a correct answer and then dropped outside of StyledMarkup component
|
|
276
|
+
if (active && !over) {
|
|
277
|
+
const drag = active.data.current;
|
|
278
|
+
|
|
279
|
+
if (drag && drag.type === 'drag-in-the-blank-placed-choice') {
|
|
280
|
+
if (this.markupRef.current) {
|
|
281
|
+
const markupBounds = this.markupRef.current.getBoundingClientRect();
|
|
282
|
+
const dropX = active.rect.current.translated?.x || 0;
|
|
283
|
+
const dropY = active.rect.current.translated?.y || 0;
|
|
284
|
+
|
|
285
|
+
const isOutsideMarkup = (
|
|
286
|
+
dropX < markupBounds.left ||
|
|
287
|
+
dropX > markupBounds.right ||
|
|
288
|
+
dropY < markupBounds.top ||
|
|
289
|
+
dropY > markupBounds.bottom
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
if (isOutsideMarkup && drag.onRemove && typeof drag.onRemove === 'function') {
|
|
293
|
+
drag.onRemove(drag);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (!active || !over) {
|
|
300
|
+
this.setState({
|
|
301
|
+
activeDragItem: null,
|
|
302
|
+
});
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const drag = active.data.current;
|
|
307
|
+
const drop = over.data.current;
|
|
308
|
+
|
|
309
|
+
if (drop && typeof drop.onDrop === "function") {
|
|
310
|
+
drop.onDrop(drag, drop);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (drag && typeof drag.onDrop === "function") {
|
|
315
|
+
drag.onDrop(drag, drop);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
this.setState({
|
|
319
|
+
activeDragItem: null,
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
const onDragStart = (event) => {
|
|
324
|
+
const { active } = event;
|
|
325
|
+
|
|
326
|
+
if (active?.data?.current) {
|
|
327
|
+
this.setState({
|
|
328
|
+
activeDragItem: active.data.current,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const renderDragOverlay = () => {
|
|
334
|
+
const { activeDragItem } = this.state;
|
|
335
|
+
const { model } = this.props;
|
|
336
|
+
|
|
337
|
+
if (!activeDragItem) return null;
|
|
338
|
+
|
|
339
|
+
if ((activeDragItem.type === 'drag-in-the-blank-choice' || activeDragItem.type === 'drag-in-the-blank-placed-choice') && activeDragItem.value) {
|
|
340
|
+
const choice = model.choices?.find(c => c.id === activeDragItem.value.id);
|
|
341
|
+
|
|
342
|
+
if (!choice) return null;
|
|
343
|
+
|
|
344
|
+
return <Choice choice={choice} />;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
return (
|
|
349
|
+
<DragProvider onDragEnd={onDragEnd} onDragStart={onDragStart}>
|
|
350
|
+
<layout.ConfigLayout
|
|
351
|
+
extraCSSRules={extraCSSRules}
|
|
352
|
+
dimensions={contentDimensions}
|
|
353
|
+
hideSettings={settingsPanelDisabled}
|
|
354
|
+
settings={
|
|
355
|
+
<Panel
|
|
356
|
+
model={model}
|
|
357
|
+
configuration={configuration}
|
|
358
|
+
onChangeModel={(model) => this.onModelChange(model)}
|
|
359
|
+
onChangeConfiguration={(configuration) => onConfigurationChanged(configuration, true)}
|
|
360
|
+
groups={{
|
|
361
|
+
Settings: panelSettings,
|
|
362
|
+
Properties: panelProperties,
|
|
363
|
+
}}
|
|
364
|
+
/>
|
|
365
|
+
}
|
|
366
|
+
>
|
|
367
|
+
{teacherInstructionsEnabled && (
|
|
368
|
+
<StyledInputContainer label={teacherInstructions.label}>
|
|
369
|
+
<EditableHtml
|
|
370
|
+
markup={model.teacherInstructions || ''}
|
|
371
|
+
onChange={this.onTeacherInstructionsChanged}
|
|
372
|
+
imageSupport={imageSupport}
|
|
373
|
+
nonEmpty={false}
|
|
374
|
+
error={teacherInstructionsError}
|
|
375
|
+
toolbarOpts={toolbarOpts}
|
|
376
|
+
pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}
|
|
377
|
+
spellCheck={spellCheckEnabled}
|
|
378
|
+
maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}
|
|
379
|
+
maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}
|
|
380
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
381
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
382
|
+
mathMlOptions={mathMlOptions}
|
|
383
|
+
/>
|
|
384
|
+
{teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}
|
|
385
|
+
</StyledInputContainer>
|
|
386
|
+
)}
|
|
387
|
+
|
|
388
|
+
{promptEnabled && (
|
|
389
|
+
<StyledInputContainer label={prompt.label}>
|
|
390
|
+
<EditableHtml
|
|
391
|
+
markup={model.prompt}
|
|
392
|
+
onChange={this.onPromptChanged}
|
|
393
|
+
imageSupport={imageSupport}
|
|
394
|
+
nonEmpty={false}
|
|
395
|
+
disableUnderline
|
|
396
|
+
error={promptError}
|
|
397
|
+
toolbarOpts={toolbarOpts}
|
|
398
|
+
pluginProps={getPluginProps(prompt?.inputConfiguration)}
|
|
399
|
+
spellCheck={spellCheckEnabled}
|
|
400
|
+
maxImageWidth={defaultImageMaxWidth}
|
|
401
|
+
maxImageHeight={defaultImageMaxHeight}
|
|
402
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
403
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
404
|
+
mathMlOptions={mathMlOptions}
|
|
405
|
+
/>
|
|
406
|
+
{promptError && <ErrorText>{promptError}</ErrorText>}
|
|
407
|
+
</StyledInputContainer>
|
|
408
|
+
)}
|
|
409
|
+
|
|
410
|
+
<FlexContainer>
|
|
411
|
+
<StyledText component={'div'}>
|
|
412
|
+
Define Template, Choices, and Correct Responses
|
|
413
|
+
</StyledText>
|
|
414
|
+
<StyledTooltip
|
|
415
|
+
disableFocusListener
|
|
416
|
+
disableTouchListener
|
|
417
|
+
placement={'right'}
|
|
418
|
+
title={validationMessage}
|
|
419
|
+
>
|
|
420
|
+
<Info fontSize={'small'} color={'primary'} style={{ marginLeft: '5px' }} />
|
|
421
|
+
</StyledTooltip>
|
|
422
|
+
</FlexContainer>
|
|
423
|
+
|
|
424
|
+
<StyledMarkup ref={this.markupRef}>
|
|
425
|
+
<EditableHtml
|
|
426
|
+
activePlugins={ALL_PLUGINS}
|
|
427
|
+
responseAreaProps={{
|
|
428
|
+
type: 'drag-in-the-blank',
|
|
429
|
+
options: {
|
|
430
|
+
duplicates: model.duplicates,
|
|
431
|
+
},
|
|
432
|
+
maxResponseAreas: maxResponseAreas,
|
|
433
|
+
}}
|
|
434
|
+
pluginProps={getPluginProps()}
|
|
435
|
+
markup={model.slateMarkup}
|
|
436
|
+
onChange={this.onMarkupChanged}
|
|
437
|
+
imageSupport={imageSupport}
|
|
438
|
+
disableImageAlignmentButtons={true}
|
|
439
|
+
nonEmpty={false}
|
|
440
|
+
disableUnderline
|
|
441
|
+
error={responseAreasError || correctResponseError}
|
|
442
|
+
toolbarOpts={toolbarOpts}
|
|
443
|
+
spellCheck={spellCheckEnabled}
|
|
444
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
445
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
446
|
+
mathMlOptions={mathMlOptions}
|
|
447
|
+
/>
|
|
448
|
+
</StyledMarkup>
|
|
449
|
+
{responseAreasError && <ErrorText>{responseAreasError}</ErrorText>}
|
|
450
|
+
{correctResponseError && <ErrorText>{correctResponseError}</ErrorText>}
|
|
451
|
+
|
|
452
|
+
<Choices
|
|
453
|
+
model={model}
|
|
454
|
+
imageSupport={imageSupport}
|
|
455
|
+
duplicates={model.duplicates}
|
|
456
|
+
error={choicesError}
|
|
457
|
+
onChange={this.onResponsesChanged}
|
|
458
|
+
toolbarOpts={toolbarOpts}
|
|
459
|
+
maxChoices={maxChoices}
|
|
460
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
461
|
+
mathMlOptions={mathMlOptions}
|
|
462
|
+
pluginProps={getPluginProps(addChoice?.inputConfiguration)}
|
|
463
|
+
maxImageWidth={(maxImageWidth && maxImageWidth.choice) || defaultImageMaxWidth}
|
|
464
|
+
maxImageHeight={(maxImageHeight && maxImageHeight.choice) || defaultImageMaxHeight}
|
|
465
|
+
maxLength={maxLength}
|
|
466
|
+
/>
|
|
467
|
+
|
|
468
|
+
{rationaleEnabled && (
|
|
469
|
+
<StyledInputContainer label={rationale.label}>
|
|
470
|
+
<EditableHtml
|
|
471
|
+
markup={model.rationale || ''}
|
|
472
|
+
onChange={this.onRationaleChanged}
|
|
473
|
+
imageSupport={imageSupport}
|
|
474
|
+
error={rationaleError}
|
|
475
|
+
toolbarOpts={toolbarOpts}
|
|
476
|
+
pluginProps={getPluginProps(rationale?.inputConfiguration)}
|
|
477
|
+
spellCheck={spellCheckEnabled}
|
|
478
|
+
maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}
|
|
479
|
+
maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}
|
|
480
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
481
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
482
|
+
mathMlOptions={mathMlOptions}
|
|
483
|
+
/>
|
|
484
|
+
{rationaleError && <ErrorText>{rationaleError}</ErrorText>}
|
|
485
|
+
</StyledInputContainer>
|
|
486
|
+
)}
|
|
487
|
+
</layout.ConfigLayout>
|
|
488
|
+
<DragOverlay>
|
|
489
|
+
<DragPreviewWrapper>
|
|
490
|
+
{renderDragOverlay()}
|
|
491
|
+
</DragPreviewWrapper>
|
|
492
|
+
</DragOverlay>
|
|
493
|
+
</DragProvider>
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export default Main;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/drag-in-the-blank/configure/src/markupUtils.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { escape } from 'lodash-es';
|
|
12
|
+
|
|
13
|
+
export const createElementFromHTML = (htmlString) => {
|
|
14
|
+
const div = document.createElement('div');
|
|
15
|
+
|
|
16
|
+
div.innerHTML = htmlString.trim();
|
|
17
|
+
|
|
18
|
+
return div;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// do not remove \t from \times, \triangle, \tan, \theta or \therefore
|
|
22
|
+
const tSymbols = 'imes|riangle|an|heta|herefore';
|
|
23
|
+
// do not remove \n from \nthroot, \nparallel, \ncong, \napprox, \neq, \ne or \nsim
|
|
24
|
+
const nSymbols = 'throot|parallel|cong|approx|eq|e|sim';
|
|
25
|
+
// match all \t and \n that are not part of math symbols that starts with \t or \n
|
|
26
|
+
const matchTabAndNewLine = new RegExp(
|
|
27
|
+
`(\\t(?!${tSymbols}))|(\\n(?!${nSymbols}))|(\\\\t(?!${tSymbols}))|(\\\\n(?!${nSymbols}))`,
|
|
28
|
+
'g',
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export const removeUnwantedCharacters = (markup) =>
|
|
32
|
+
markup.replace(matchTabAndNewLine, '').replace(/\\"/g, '"').replace(/\\\//g, '/');
|
|
33
|
+
|
|
34
|
+
export const processMarkup = (markup) => {
|
|
35
|
+
const newMarkup = removeUnwantedCharacters(markup);
|
|
36
|
+
const slateMarkup = createElementFromHTML(newMarkup);
|
|
37
|
+
const choices = [];
|
|
38
|
+
let index = 0;
|
|
39
|
+
|
|
40
|
+
slateMarkup.querySelectorAll('[data-type="drag_in_the_blank"]').forEach((s) => {
|
|
41
|
+
let value = s.dataset.value && s.dataset.value.replace(/ /g, ' ').trim();
|
|
42
|
+
|
|
43
|
+
if (!value) {
|
|
44
|
+
value = '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
choices.push({
|
|
48
|
+
value,
|
|
49
|
+
id: s.dataset.id,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
s.replaceWith(`{{${index++}}}`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
markup: slateMarkup.innerHTML,
|
|
57
|
+
choices: choices,
|
|
58
|
+
correctResponse: choices.reduce((obj, c, index) => {
|
|
59
|
+
obj[index] = (c.id !== undefined && c.id) || '';
|
|
60
|
+
|
|
61
|
+
return obj;
|
|
62
|
+
}, {}),
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const REGEX = /\{\{(\d+)\}\}/g;
|
|
67
|
+
|
|
68
|
+
export const createSlateMarkup = (markup, choices, correctResponse) => {
|
|
69
|
+
const newMarkup = removeUnwantedCharacters(markup);
|
|
70
|
+
let index = 0;
|
|
71
|
+
|
|
72
|
+
return newMarkup.replace(REGEX, (match, g) => {
|
|
73
|
+
const correctId = correctResponse[g];
|
|
74
|
+
let correctChoice = choices.find((c) => c.id === correctId);
|
|
75
|
+
|
|
76
|
+
if (!correctChoice || !correctChoice.value) {
|
|
77
|
+
correctChoice = {
|
|
78
|
+
id: '',
|
|
79
|
+
value: '',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return `<span data-type="drag_in_the_blank" data-index="${index++}" data-id="${
|
|
84
|
+
correctChoice.id
|
|
85
|
+
}" data-value="${escape(correctChoice.value)}"></span>`;
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const choiceIsEmpty = (choice) => {
|
|
90
|
+
if (choice) {
|
|
91
|
+
const { value = '' } = choice;
|
|
92
|
+
const domEl = createElementFromHTML(value);
|
|
93
|
+
|
|
94
|
+
Array.from(domEl.querySelectorAll('*')).forEach((domEl) => {
|
|
95
|
+
if (domEl.tagName !== 'IMG' && domEl.childNodes.length === 0) {
|
|
96
|
+
domEl.remove();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const newString = domEl.innerHTML.trim();
|
|
101
|
+
|
|
102
|
+
return newString === '';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return false;
|
|
106
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/drag-in-the-blank/configure/utils.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const generateValidationMessage = (config) => {
|
|
12
|
+
let { maxResponseAreas, minChoices, maxChoices } = config;
|
|
13
|
+
minChoices = minChoices || 2;
|
|
14
|
+
|
|
15
|
+
const responseAreasMessage =
|
|
16
|
+
'\nThe tokens should ' +
|
|
17
|
+
'not be empty and should be unique.\nThere should be at least 1 ' +
|
|
18
|
+
(maxResponseAreas ? `and at most ${maxResponseAreas} ` : '') +
|
|
19
|
+
'response area' +
|
|
20
|
+
(maxResponseAreas ? 's' : '') +
|
|
21
|
+
' defined.' +
|
|
22
|
+
`\nThere should be at least ${minChoices} ` +
|
|
23
|
+
(maxChoices ? `and at most ${maxChoices} ` : '') +
|
|
24
|
+
'tokens defined.';
|
|
25
|
+
|
|
26
|
+
return 'Validation requirements:' + responseAreasMessage;
|
|
27
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/drag-in-the-blank/controller/src/defaults.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
choices: [],
|
|
13
|
+
choicesPosition: 'below',
|
|
14
|
+
correctResponse: {},
|
|
15
|
+
disabled: false,
|
|
16
|
+
duplicates: true,
|
|
17
|
+
markup: '',
|
|
18
|
+
mode: 'gather',
|
|
19
|
+
prompt: '',
|
|
20
|
+
promptEnabled: true,
|
|
21
|
+
rationale: '',
|
|
22
|
+
rationaleEnabled: true,
|
|
23
|
+
studentInstructionsEnabled: true,
|
|
24
|
+
teacherInstructions: '',
|
|
25
|
+
teacherInstructionsEnabled: true,
|
|
26
|
+
toolbarEditorPosition: 'bottom',
|
|
27
|
+
};
|