@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,7 @@
|
|
|
1
|
+
import e from "./_baseUnary.js";
|
|
2
|
+
import t from "./_nodeUtil.js";
|
|
3
|
+
import n from "./_baseIsMap.js";
|
|
4
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js
|
|
5
|
+
var r = t && t.isMap, i = r ? e(r) : n;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { i as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "./_baseUnary.js";
|
|
2
|
+
import t from "./_nodeUtil.js";
|
|
3
|
+
import n from "./_baseIsSet.js";
|
|
4
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js
|
|
5
|
+
var r = t && t.isSet, i = r ? e(r) : n;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { i as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import e from "./_baseGetTag.js";
|
|
2
|
+
import t from "./isObjectLike.js";
|
|
3
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js
|
|
4
|
+
var n = "[object Symbol]";
|
|
5
|
+
function r(r) {
|
|
6
|
+
return typeof r == "symbol" || t(r) && e(r) == n;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { r as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "./_baseIsTypedArray.js";
|
|
2
|
+
import t from "./_baseUnary.js";
|
|
3
|
+
import n from "./_nodeUtil.js";
|
|
4
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js
|
|
5
|
+
var r = n && n.isTypedArray, i = r ? t(r) : e;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { i as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import e from "./isArrayLike.js";
|
|
2
|
+
import t from "./_arrayLikeKeys.js";
|
|
3
|
+
import n from "./_baseKeys.js";
|
|
4
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js
|
|
5
|
+
function r(r) {
|
|
6
|
+
return e(r) ? t(r) : n(r);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { r as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import e from "./isArrayLike.js";
|
|
2
|
+
import t from "./_arrayLikeKeys.js";
|
|
3
|
+
import n from "./_baseKeysIn.js";
|
|
4
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js
|
|
5
|
+
function r(r) {
|
|
6
|
+
return e(r) ? t(r, !0) : n(r);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { r as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import e from "./_MapCache.js";
|
|
2
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js
|
|
3
|
+
var t = "Expected a function";
|
|
4
|
+
function n(r, i) {
|
|
5
|
+
if (typeof r != "function" || i != null && typeof i != "function") throw TypeError(t);
|
|
6
|
+
var a = function() {
|
|
7
|
+
var e = arguments, t = i ? i.apply(this, e) : e[0], n = a.cache;
|
|
8
|
+
if (n.has(t)) return n.get(t);
|
|
9
|
+
var o = r.apply(this, e);
|
|
10
|
+
return a.cache = n.set(t, o) || n, o;
|
|
11
|
+
};
|
|
12
|
+
return a.cache = new (n.Cache || e)(), a;
|
|
13
|
+
}
|
|
14
|
+
n.Cache = e;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from "./_isKey.js";
|
|
2
|
+
import t from "./_toKey.js";
|
|
3
|
+
import n from "./_baseProperty.js";
|
|
4
|
+
import r from "./_basePropertyDeep.js";
|
|
5
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/property.js
|
|
6
|
+
function i(i) {
|
|
7
|
+
return e(i) ? n(t(i)) : r(i);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { i as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import e from "./isArray.js";
|
|
2
|
+
import t from "./_arrayReduce.js";
|
|
3
|
+
import n from "./_baseIteratee.js";
|
|
4
|
+
import r from "./_baseEach.js";
|
|
5
|
+
import i from "./_baseReduce.js";
|
|
6
|
+
//#region ../../../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/reduce.js
|
|
7
|
+
function a(a, o, s) {
|
|
8
|
+
var c = e(a) ? t : i, l = arguments.length < 3;
|
|
9
|
+
return c(a, n(o, 4), s, l, r);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { a as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-element/drag-in-the-blank",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@emotion/react": "^11.14.0",
|
|
7
|
+
"@emotion/style": "^0.8.0",
|
|
8
|
+
"@mui/icons-material": "^7.3.4",
|
|
9
|
+
"@mui/material": "^7.3.4",
|
|
10
|
+
"@pie-lib/correct-answer-toggle": "0.1.0",
|
|
11
|
+
"@pie-lib/drag": "0.1.0",
|
|
12
|
+
"@pie-lib/mask-markup": "0.1.0",
|
|
13
|
+
"@pie-lib/render-ui": "0.1.0",
|
|
14
|
+
"lodash-es": "^4.17.23",
|
|
15
|
+
"prop-types": "^15.6.1",
|
|
16
|
+
"@pie-lib/editable-html-tip-tap": "0.1.0",
|
|
17
|
+
"@pie-lib/config-ui": "0.1.0",
|
|
18
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.0",
|
|
19
|
+
"@pie-element/shared-configure-events": "0.1.0",
|
|
20
|
+
"@pie-element/shared-controller-utils": "0.1.0",
|
|
21
|
+
"@pie-element/shared-player-events": "0.1.0",
|
|
22
|
+
"@dnd-kit/core": "6.3.1",
|
|
23
|
+
"debug": "^4.1.1"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react": "^18.0.0",
|
|
27
|
+
"react-dom": "^18.0.0"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"development": "./src/index.ts",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./delivery": {
|
|
36
|
+
"development": "./src/delivery/index.ts",
|
|
37
|
+
"types": "./dist/delivery/index.d.ts",
|
|
38
|
+
"default": "./dist/delivery/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./author": {
|
|
41
|
+
"development": "./src/author/index.tsx",
|
|
42
|
+
"types": "./dist/author/index.d.ts",
|
|
43
|
+
"default": "./dist/author/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./controller": {
|
|
46
|
+
"development": "./src/controller/index.ts",
|
|
47
|
+
"types": "./dist/controller/index.d.ts",
|
|
48
|
+
"default": "./dist/controller/index.js"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"type": "module",
|
|
52
|
+
"main": "./dist/index.js",
|
|
53
|
+
"types": "./dist/index.d.ts",
|
|
54
|
+
"files": [
|
|
55
|
+
"dist",
|
|
56
|
+
"src"
|
|
57
|
+
],
|
|
58
|
+
"sideEffects": false,
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"vite": "^8.0.1",
|
|
61
|
+
"typescript": "^5.9.3",
|
|
62
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
63
|
+
"@types/react": "^18.2.0",
|
|
64
|
+
"@types/react-dom": "^18.2.0"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "bun x vite build && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
|
|
68
|
+
"dev": "bun x vite",
|
|
69
|
+
"demo": "bun x vite --mode demo",
|
|
70
|
+
"test": "bun x vitest run"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/drag-in-the-blank/configure/src/choice.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 MoreVert from '@mui/icons-material/MoreVert';
|
|
14
|
+
import Delete from '@mui/icons-material/Delete';
|
|
15
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
import { choiceIsEmpty } from './markupUtils.js';
|
|
18
|
+
|
|
19
|
+
const GripIcon = ({ style }) => (
|
|
20
|
+
<span style={style}>
|
|
21
|
+
<MoreVert style={{ margin: '0 -16px' }} />
|
|
22
|
+
<MoreVert />
|
|
23
|
+
</span>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
GripIcon.propTypes = {
|
|
27
|
+
style: PropTypes.object,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const StyledChoice: any = styled('div', {
|
|
31
|
+
shouldForwardProp: (prop) => !['error', 'isDragging'].includes(prop),
|
|
32
|
+
})(({ theme, error }) => ({
|
|
33
|
+
display: 'inline-flex',
|
|
34
|
+
minWidth: '178px',
|
|
35
|
+
minHeight: '36px',
|
|
36
|
+
background: theme.palette.common.white,
|
|
37
|
+
boxSizing: 'border-box',
|
|
38
|
+
borderRadius: '3px',
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
position: 'relative',
|
|
41
|
+
padding: '8px 35px 8px 35px',
|
|
42
|
+
cursor: 'grab',
|
|
43
|
+
border: `1px solid ${error ? '#f44336' : '#C0C3CF'}`,
|
|
44
|
+
'& img': {
|
|
45
|
+
display: 'flex',
|
|
46
|
+
},
|
|
47
|
+
// browser adds extra marrgin for p tags by default
|
|
48
|
+
'& p': {
|
|
49
|
+
margin: 0,
|
|
50
|
+
},
|
|
51
|
+
'& mjx-frac': {
|
|
52
|
+
fontSize: '120% !important',
|
|
53
|
+
},
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
const StyledDeleteIcon: any = styled(Delete)(({ theme }) => ({
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
top: '6px',
|
|
59
|
+
right: '0',
|
|
60
|
+
color: theme.palette.grey[500],
|
|
61
|
+
zIndex: 2,
|
|
62
|
+
'&:hover': {
|
|
63
|
+
cursor: 'pointer',
|
|
64
|
+
color: theme.palette.common.black,
|
|
65
|
+
},
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
export const BlankContent = (props) => {
|
|
69
|
+
const { choice, onClick, onRemoveChoice, error, instanceId, disabled } = props;
|
|
70
|
+
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
|
|
71
|
+
id: `choice-${choice.id}-${instanceId || 'default'}`,
|
|
72
|
+
data: {
|
|
73
|
+
type: 'drag-in-the-blank-choice',
|
|
74
|
+
id: choice.id,
|
|
75
|
+
value: choice,
|
|
76
|
+
instanceId: instanceId,
|
|
77
|
+
},
|
|
78
|
+
disabled: disabled || choiceIsEmpty(choice),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const handleDragStart = (e) => {
|
|
82
|
+
if (choiceIsEmpty(choice)) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
alert('You need to define a value for an answer choice before it can be associated with a response area.');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<StyledChoice
|
|
91
|
+
ref={setNodeRef}
|
|
92
|
+
error={error}
|
|
93
|
+
isDragging={isDragging}
|
|
94
|
+
onClick={onClick}
|
|
95
|
+
{...attributes}
|
|
96
|
+
{...listeners}
|
|
97
|
+
onDragStart={handleDragStart}
|
|
98
|
+
>
|
|
99
|
+
<GripIcon
|
|
100
|
+
style={{
|
|
101
|
+
position: 'absolute',
|
|
102
|
+
top: '6px',
|
|
103
|
+
left: '15px',
|
|
104
|
+
color: '#9e9e9e',
|
|
105
|
+
zIndex: 2,
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<span dangerouslySetInnerHTML={{ __html: choice.value }} />
|
|
110
|
+
|
|
111
|
+
<StyledDeleteIcon
|
|
112
|
+
onClick={(e) => {
|
|
113
|
+
e.preventDefault();
|
|
114
|
+
e.stopPropagation();
|
|
115
|
+
|
|
116
|
+
onRemoveChoice(e);
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
</StyledChoice>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
BlankContent.propTypes = {
|
|
124
|
+
choice: PropTypes.object.isRequired,
|
|
125
|
+
onClick: PropTypes.func,
|
|
126
|
+
onRemoveChoice: PropTypes.func.isRequired,
|
|
127
|
+
error: PropTypes.bool,
|
|
128
|
+
instanceId: PropTypes.string,
|
|
129
|
+
disabled: PropTypes.bool,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export default BlankContent;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/drag-in-the-blank/configure/src/choices.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 from '@pie-lib/editable-html-tip-tap';
|
|
14
|
+
import { AlertDialog } from '@pie-lib/config-ui';
|
|
15
|
+
import Button from '@mui/material/Button';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
|
|
18
|
+
import Choice from './choice.js';
|
|
19
|
+
import { choiceIsEmpty } from './markupUtils.js';
|
|
20
|
+
import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
|
|
21
|
+
|
|
22
|
+
const StyledDesign: any = styled('div')(({ theme }) => ({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
marginBottom: theme.spacing(1.5),
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
const StyledAddButton: any = styled(Button)({
|
|
29
|
+
marginLeft: 'auto',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const StyledAltChoices: any = styled('div')(({ theme }) => ({
|
|
33
|
+
alignItems: 'flex-start',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexWrap: 'wrap',
|
|
36
|
+
justifyContent: 'space-evenly',
|
|
37
|
+
marginTop: theme.spacing(1),
|
|
38
|
+
|
|
39
|
+
'& > *': {
|
|
40
|
+
margin: theme.spacing(1),
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
const ErrorText: any = styled('div')(({ theme }) => ({
|
|
45
|
+
fontSize: theme.typography.fontSize - 2,
|
|
46
|
+
color: theme.palette.error.main,
|
|
47
|
+
paddingBottom: theme.spacing(2),
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
export class Choices extends React.Component {
|
|
51
|
+
static propTypes = {
|
|
52
|
+
duplicates: PropTypes.bool,
|
|
53
|
+
error: PropTypes.string,
|
|
54
|
+
model: PropTypes.object.isRequired,
|
|
55
|
+
onChange: PropTypes.func.isRequired,
|
|
56
|
+
toolbarOpts: PropTypes.object,
|
|
57
|
+
pluginProps: PropTypes.object,
|
|
58
|
+
maxChoices: PropTypes.number,
|
|
59
|
+
uploadSoundSupport: PropTypes.object,
|
|
60
|
+
maxImageWidth: PropTypes.number,
|
|
61
|
+
maxImageHeight: PropTypes.number,
|
|
62
|
+
maxLength: PropTypes.number,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
state = { warning: { open: false } };
|
|
66
|
+
preventDone = false;
|
|
67
|
+
wrapperRef = React.createRef(null);
|
|
68
|
+
|
|
69
|
+
componentDidUpdate() {
|
|
70
|
+
if (this.focusedNodeRef) {
|
|
71
|
+
this.focusedNodeRef.focus('end');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
renderMath(this.wrapperRef.current);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onChoiceChanged: any = (prevValue, val, key) => {
|
|
78
|
+
const { onChange, model } = this.props;
|
|
79
|
+
const { choices, correctResponse, alternateResponses } = model;
|
|
80
|
+
const duplicatedValue = (choices || []).find((c) => c.value === val && c.id !== key);
|
|
81
|
+
|
|
82
|
+
// discard the new added choice or the changes if the choice would be a duplicate to one that already exists
|
|
83
|
+
if (duplicatedValue) {
|
|
84
|
+
if (prevValue === '') {
|
|
85
|
+
// remove the new added choice from choices
|
|
86
|
+
const newChoices = (choices || []).filter((c) => c.id !== key);
|
|
87
|
+
|
|
88
|
+
onChange(newChoices);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.setState({
|
|
92
|
+
warning: {
|
|
93
|
+
open: true,
|
|
94
|
+
text: 'Identical answer choices are not allowed and the changes will be discarded.',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const newChoices = choices?.map((choice) => (choice.id === key ? { ...choice, value: val } : choice)) || [];
|
|
102
|
+
|
|
103
|
+
if (!choiceIsEmpty({ value: val })) {
|
|
104
|
+
onChange(newChoices);
|
|
105
|
+
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// if the edited content is empty, its usage has to be searched in the correct response definitions
|
|
110
|
+
let usedForResponse = false;
|
|
111
|
+
|
|
112
|
+
if (correctResponse) {
|
|
113
|
+
Object.keys(correctResponse).forEach((responseKey) => {
|
|
114
|
+
if (correctResponse[responseKey] === key) {
|
|
115
|
+
usedForResponse = true;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (alternateResponses && !usedForResponse) {
|
|
121
|
+
Object.values(alternateResponses).forEach((alternate) => {
|
|
122
|
+
if (alternate.indexOf(key) >= 0) {
|
|
123
|
+
usedForResponse = true;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (usedForResponse) {
|
|
129
|
+
this.setState({
|
|
130
|
+
warning: {
|
|
131
|
+
open: true,
|
|
132
|
+
text: 'Answer choices cannot be blank and the changes will be discarded.',
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const newChoicesWithoutTheEmptyOne = newChoices.filter((choice) => choice.id !== key);
|
|
140
|
+
|
|
141
|
+
onChange(newChoicesWithoutTheEmptyOne);
|
|
142
|
+
|
|
143
|
+
this.setState({
|
|
144
|
+
warning: {
|
|
145
|
+
open: true,
|
|
146
|
+
text: 'Answer choices cannot be blank.',
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
onChoiceFocus = (id) =>
|
|
152
|
+
this.setState({
|
|
153
|
+
focusedEl: id,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
onAddChoice: any = () => {
|
|
157
|
+
const {
|
|
158
|
+
model: { choices: oldChoices },
|
|
159
|
+
onChange,
|
|
160
|
+
} = this.props;
|
|
161
|
+
|
|
162
|
+
// find the maximum existing id and add 1 to generate the new id so we avoid duplicates
|
|
163
|
+
const maxId = oldChoices.length > 0 ? Math.max(...oldChoices.map((choice) => parseInt(choice.id, 10) || 0)) : -1;
|
|
164
|
+
const newId = `${maxId + 1}`;
|
|
165
|
+
|
|
166
|
+
this.setState(
|
|
167
|
+
{
|
|
168
|
+
focusedEl: newId,
|
|
169
|
+
},
|
|
170
|
+
() => {
|
|
171
|
+
onChange([
|
|
172
|
+
...oldChoices,
|
|
173
|
+
{
|
|
174
|
+
id: newId,
|
|
175
|
+
value: '',
|
|
176
|
+
},
|
|
177
|
+
]);
|
|
178
|
+
},
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
onChoiceRemove: any = (id) => {
|
|
183
|
+
const {
|
|
184
|
+
onChange,
|
|
185
|
+
model: { choices },
|
|
186
|
+
} = this.props;
|
|
187
|
+
const newChoices = (choices || []).filter((choice) => choice.id !== id);
|
|
188
|
+
|
|
189
|
+
onChange(newChoices);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
getVisibleChoices: any = () => {
|
|
193
|
+
const {
|
|
194
|
+
duplicates,
|
|
195
|
+
model: { choices, correctResponse },
|
|
196
|
+
} = this.props;
|
|
197
|
+
|
|
198
|
+
if (!choices) {
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (duplicates) {
|
|
203
|
+
return choices;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// if duplicates not allowed, remove the choices that are used to define the correct response
|
|
207
|
+
return choices.filter((choice) => !(correctResponse && Object.values(correctResponse).includes(choice.id)));
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
render() {
|
|
211
|
+
const { focusedEl, warning } = this.state;
|
|
212
|
+
const {
|
|
213
|
+
duplicates,
|
|
214
|
+
error,
|
|
215
|
+
mathMlOptions = {},
|
|
216
|
+
maxChoices,
|
|
217
|
+
model: { choices },
|
|
218
|
+
toolbarOpts,
|
|
219
|
+
uploadSoundSupport,
|
|
220
|
+
imageSupport = {},
|
|
221
|
+
pluginProps = {},
|
|
222
|
+
maxImageWidth,
|
|
223
|
+
maxImageHeight,
|
|
224
|
+
maxLength,
|
|
225
|
+
} = this.props;
|
|
226
|
+
const visibleChoices = this.getVisibleChoices() || [];
|
|
227
|
+
return (
|
|
228
|
+
<StyledDesign ref={this.wrapperRef}>
|
|
229
|
+
<StyledAddButton
|
|
230
|
+
variant="contained"
|
|
231
|
+
color="primary"
|
|
232
|
+
onClick={this.onAddChoice}
|
|
233
|
+
disabled={maxChoices && choices && maxChoices === choices.length}
|
|
234
|
+
>
|
|
235
|
+
Add Choice
|
|
236
|
+
</StyledAddButton>
|
|
237
|
+
|
|
238
|
+
<StyledAltChoices>
|
|
239
|
+
{visibleChoices.map((choice, index) => {
|
|
240
|
+
if (!choice || !choice.id) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return focusedEl === choice.id ? (
|
|
245
|
+
<div
|
|
246
|
+
key={index}
|
|
247
|
+
style={{
|
|
248
|
+
minWidth: '100%',
|
|
249
|
+
zIndex: '100',
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
<EditableHtml
|
|
253
|
+
ref={(ref) => (this.focusedNodeRef = ref)}
|
|
254
|
+
autoFocus
|
|
255
|
+
imageSupport={imageSupport}
|
|
256
|
+
markup={choice.value}
|
|
257
|
+
pluginProps={pluginProps}
|
|
258
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
259
|
+
onChange={(val) => {
|
|
260
|
+
if (this.preventDone) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
this.onChoiceChanged(choice.value, val, choice.id);
|
|
265
|
+
}}
|
|
266
|
+
onDone={() => {
|
|
267
|
+
if (this.preventDone) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
this.setState({
|
|
272
|
+
focusedEl: undefined,
|
|
273
|
+
});
|
|
274
|
+
}}
|
|
275
|
+
onBlur={(e) => {
|
|
276
|
+
const inInInsertCharacter = e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog');
|
|
277
|
+
|
|
278
|
+
this.preventDone = inInInsertCharacter;
|
|
279
|
+
}}
|
|
280
|
+
disableUnderline
|
|
281
|
+
toolbarOpts={toolbarOpts}
|
|
282
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
283
|
+
mathMlOptions={mathMlOptions}
|
|
284
|
+
maxImageHeight={maxImageHeight}
|
|
285
|
+
maxImageWidth={maxImageWidth}
|
|
286
|
+
charactersLimit={maxLength}
|
|
287
|
+
/>
|
|
288
|
+
</div>
|
|
289
|
+
) : (
|
|
290
|
+
<Choice
|
|
291
|
+
key={index}
|
|
292
|
+
duplicates={duplicates}
|
|
293
|
+
choice={choice}
|
|
294
|
+
error={error}
|
|
295
|
+
onClick={() => this.onChoiceFocus(choice.id)}
|
|
296
|
+
onRemoveChoice={() => this.onChoiceRemove(choice.id)}
|
|
297
|
+
/>
|
|
298
|
+
);
|
|
299
|
+
})}
|
|
300
|
+
</StyledAltChoices>
|
|
301
|
+
{error && <ErrorText>{error}</ErrorText>}
|
|
302
|
+
|
|
303
|
+
<AlertDialog
|
|
304
|
+
open={warning.open}
|
|
305
|
+
title="Warning"
|
|
306
|
+
text={warning.text}
|
|
307
|
+
onConfirm={() => this.setState({ warning: { open: false } })}
|
|
308
|
+
/>
|
|
309
|
+
</StyledDesign>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export default Choices;
|