@pie-element/inline-dropdown 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/defaults.d.ts +195 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +130 -0
- package/dist/author/index.d.ts +44 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +83 -0
- package/dist/author/inline-dropdown-toolbar.d.ts +48 -0
- package/dist/author/inline-dropdown-toolbar.d.ts.map +1 -0
- package/dist/author/inline-dropdown-toolbar.js +261 -0
- package/dist/author/main.d.ts +49 -0
- package/dist/author/main.d.ts.map +1 -0
- package/dist/author/main.js +375 -0
- package/dist/author/markupUtils.d.ts +13 -0
- package/dist/author/markupUtils.d.ts.map +1 -0
- package/dist/author/markupUtils.js +23 -0
- package/dist/author/response-area.d.ts +21 -0
- package/dist/author/response-area.d.ts.map +1 -0
- package/dist/author/response-area.js +32 -0
- package/dist/author/utils.d.ts +11 -0
- package/dist/author/utils.d.ts.map +1 -0
- package/dist/author/utils.js +10 -0
- package/dist/controller/defaults.d.ts +28 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +21 -0
- package/dist/controller/index.d.ts +55 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +126 -0
- package/dist/controller/utils.d.ts +13 -0
- package/dist/controller/utils.d.ts.map +1 -0
- package/dist/controller/utils.js +13 -0
- package/dist/delivery/index.d.ts +21 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +60 -0
- package/dist/delivery/inline-dropdown.d.ts +39 -0
- package/dist/delivery/inline-dropdown.d.ts.map +1 -0
- package/dist/delivery/inline-dropdown.js +109 -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 +148 -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/_baseExtremum.js +11 -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/_baseGt.js +6 -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/_baseMap.js +11 -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/_castFunction.js +7 -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/forEach.js +10 -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/isEqual.js +7 -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/isUndefined.js +6 -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/map.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/max.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 +70 -0
- package/src/author/defaults.ts +141 -0
- package/src/author/index.ts +161 -0
- package/src/author/inline-dropdown-toolbar.tsx +454 -0
- package/src/author/main.tsx +609 -0
- package/src/author/markupUtils.tsx +68 -0
- package/src/author/response-area.tsx +55 -0
- package/src/author/utils.ts +32 -0
- package/src/controller/defaults.ts +28 -0
- package/src/controller/index.ts +340 -0
- package/src/controller/utils.ts +36 -0
- package/src/delivery/index.ts +100 -0
- package/src/delivery/inline-dropdown.tsx +209 -0
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/inline-dropdown/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 ReactDOM from 'react-dom';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html-tip-tap';
|
|
15
|
+
import { AlertDialog, InputContainer, layout, settings } from '@pie-lib/config-ui';
|
|
16
|
+
import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
|
|
17
|
+
import { color } from '@pie-lib/render-ui';
|
|
18
|
+
import { cloneDeep, isEmpty, isEqual, isUndefined, max, reduce } from 'lodash-es';
|
|
19
|
+
import { styled } from '@mui/material/styles';
|
|
20
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
21
|
+
import Typography from '@mui/material/Typography';
|
|
22
|
+
import Accordion from '@mui/material/Accordion';
|
|
23
|
+
import AccordionSummary from '@mui/material/AccordionSummary';
|
|
24
|
+
import AccordionDetails from '@mui/material/AccordionDetails';
|
|
25
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
26
|
+
import Info from '@mui/icons-material/Info';
|
|
27
|
+
|
|
28
|
+
import InlineDropdownToolbar from './inline-dropdown-toolbar.js';
|
|
29
|
+
import { generateValidationMessage } from './utils.js';
|
|
30
|
+
import ResponseAreaComponent from './response-area.js';
|
|
31
|
+
|
|
32
|
+
const { toggle, Panel, dropdown } = settings;
|
|
33
|
+
|
|
34
|
+
const PromptHolder: any = styled(InputContainer)(({ theme }) => ({
|
|
35
|
+
width: '100%',
|
|
36
|
+
paddingTop: theme.spacing(2),
|
|
37
|
+
marginBottom: theme.spacing(2),
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
const ChoiceRationaleHolder: any = styled(InputContainer)(({ theme }) => ({
|
|
41
|
+
width: '100%',
|
|
42
|
+
paddingTop: theme.spacing(0.5),
|
|
43
|
+
marginBottom: theme.spacing(2),
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
const StyledTypography: any = styled(Typography)(({ theme }) => ({
|
|
47
|
+
fontSize: theme.typography.fontSize + 2,
|
|
48
|
+
marginRight: theme.spacing(1),
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
const RationaleLabel: any = styled('span')(({ theme }) => ({
|
|
52
|
+
display: 'flex',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
whiteSpace: 'break-spaces',
|
|
55
|
+
color: color.disabled(),
|
|
56
|
+
padding: 0,
|
|
57
|
+
fontSize: theme.typography.fontSize - 2,
|
|
58
|
+
lineHeight: 1,
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
const RationaleChoices: any = styled('div')(({ theme }) => ({
|
|
62
|
+
marginBottom: theme.spacing(2.5),
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
const StyledAccordionDetails: any = styled(AccordionDetails)({
|
|
66
|
+
display: 'block',
|
|
67
|
+
paddingTop: 0,
|
|
68
|
+
paddingBottom: 0,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const FlexContainer: any = styled('div')(({ theme }) => ({
|
|
72
|
+
display: 'flex',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
marginBottom: theme.spacing(1),
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
const StyledTooltip: any = styled(Tooltip)(({ theme }) => ({
|
|
78
|
+
'& .MuiTooltip-tooltip': {
|
|
79
|
+
fontSize: theme.typography.fontSize - 2,
|
|
80
|
+
whiteSpace: 'pre',
|
|
81
|
+
maxWidth: '500px',
|
|
82
|
+
},
|
|
83
|
+
}));
|
|
84
|
+
|
|
85
|
+
const ErrorText: any = styled('div')(({ theme }) => ({
|
|
86
|
+
fontSize: theme.typography.fontSize - 2,
|
|
87
|
+
color: theme.palette.error.main,
|
|
88
|
+
paddingTop: theme.spacing(1),
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
const createElementFromHTML = (htmlString) => {
|
|
92
|
+
const div = document.createElement('div');
|
|
93
|
+
|
|
94
|
+
div.innerHTML = (htmlString || '').trim();
|
|
95
|
+
|
|
96
|
+
return div;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export class Main extends React.Component {
|
|
100
|
+
static propTypes = {
|
|
101
|
+
configuration: PropTypes.object.isRequired,
|
|
102
|
+
model: PropTypes.object.isRequired,
|
|
103
|
+
disableSidePanel: PropTypes.bool,
|
|
104
|
+
onModelChanged: PropTypes.func.isRequired,
|
|
105
|
+
onConfigurationChanged: PropTypes.func.isRequired,
|
|
106
|
+
imageSupport: PropTypes.shape({
|
|
107
|
+
add: PropTypes.func.isRequired,
|
|
108
|
+
delete: PropTypes.func.isRequired,
|
|
109
|
+
}),
|
|
110
|
+
uploadSoundSupport: PropTypes.shape({
|
|
111
|
+
add: PropTypes.func.isRequired,
|
|
112
|
+
delete: PropTypes.func.isRequired,
|
|
113
|
+
}),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
state = {
|
|
117
|
+
warning: { open: false },
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
componentDidMount() {
|
|
121
|
+
const {
|
|
122
|
+
model: { choices },
|
|
123
|
+
} = this.props;
|
|
124
|
+
|
|
125
|
+
this.setState({ respAreaChoices: cloneDeep(choices) });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
UNSAFE_componentWillReceiveProps(nProps) {
|
|
129
|
+
const newState = {};
|
|
130
|
+
|
|
131
|
+
if (
|
|
132
|
+
!isEqual(nProps.model.choices, this.props.model.choices) ||
|
|
133
|
+
!isEqual(nProps.model.choices, this.state.respAreaChoices)
|
|
134
|
+
) {
|
|
135
|
+
newState.respAreaChoices = cloneDeep(nProps.model.choices);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (!isEmpty(newState)) {
|
|
139
|
+
this.setState(newState);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
componentDidUpdate() {
|
|
144
|
+
//eslint-disable-next-line
|
|
145
|
+
const domNode = ReactDOM.findDOMNode(this);
|
|
146
|
+
|
|
147
|
+
renderMath(domNode);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
onModelChange: any = (newVal) => {
|
|
151
|
+
this.props.onModelChanged({ ...this.props.model, ...newVal });
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
onPromptChanged: any = (prompt) => {
|
|
155
|
+
this.onModelChange({ prompt });
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
onRationaleChanged: any = (rationale) => {
|
|
159
|
+
this.onModelChange({ rationale });
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
onChoiceRationaleChanged: any = (index, choice) => {
|
|
163
|
+
const { model } = this.props;
|
|
164
|
+
const indexOfChoice =
|
|
165
|
+
model.choices &&
|
|
166
|
+
model.choices[index] &&
|
|
167
|
+
model.choices[index].findIndex((elem) => elem.label === choice.label && elem.value === choice.value);
|
|
168
|
+
|
|
169
|
+
model.choices[index] && model.choices[index].splice(indexOfChoice, 1, choice);
|
|
170
|
+
|
|
171
|
+
this.onModelChange(model);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
onTeacherInstructionsChanged: any = (teacherInstructions) => {
|
|
175
|
+
this.onModelChange({ teacherInstructions });
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
onMarkupChanged: any = (slateMarkup) => {
|
|
179
|
+
this.onModelChange({ slateMarkup });
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
onCheck: any = (callback) => {
|
|
183
|
+
this.setState({
|
|
184
|
+
warning: {
|
|
185
|
+
open: true,
|
|
186
|
+
text: 'Response areas with under 2 options or with no correct answers will be discarded.',
|
|
187
|
+
onClose: () => {
|
|
188
|
+
this.setState({ warning: { open: false } });
|
|
189
|
+
},
|
|
190
|
+
onConfirm: () => {
|
|
191
|
+
this.setState({ warning: { open: false } }, callback);
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
onChange: any = (markup) => {
|
|
198
|
+
const { respAreaChoices } = this.state;
|
|
199
|
+
const domMarkup = createElementFromHTML(markup);
|
|
200
|
+
const allRespAreas = domMarkup.querySelectorAll('[data-type="inline_dropdown"]');
|
|
201
|
+
const allChoices = {};
|
|
202
|
+
|
|
203
|
+
allRespAreas.forEach((el) => {
|
|
204
|
+
allChoices[el.dataset.index] = el.dataset.value || '';
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const existingRespAreaChoices = reduce(
|
|
208
|
+
respAreaChoices,
|
|
209
|
+
(obj, choices, key) => {
|
|
210
|
+
if (!isUndefined(allChoices[key])) {
|
|
211
|
+
obj[key] = respAreaChoices[key];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return obj;
|
|
215
|
+
},
|
|
216
|
+
{},
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const newRespAreaChoices = {};
|
|
220
|
+
let shouldWarn = false;
|
|
221
|
+
|
|
222
|
+
allRespAreas.forEach((el, index) => {
|
|
223
|
+
const newChoices = existingRespAreaChoices[el.dataset.index] || [];
|
|
224
|
+
|
|
225
|
+
if (newChoices.length < 2 || !newChoices.find((c) => c.correct)) {
|
|
226
|
+
el.remove();
|
|
227
|
+
shouldWarn = true;
|
|
228
|
+
} else {
|
|
229
|
+
newRespAreaChoices[index] = existingRespAreaChoices[el.dataset.index] || [];
|
|
230
|
+
el.dataset.index = index;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
if (shouldWarn) {
|
|
235
|
+
this.onCheck(() =>
|
|
236
|
+
this.onModelChange({
|
|
237
|
+
choices: cloneDeep(newRespAreaChoices),
|
|
238
|
+
slateMarkup: domMarkup.innerHTML,
|
|
239
|
+
}),
|
|
240
|
+
);
|
|
241
|
+
} else {
|
|
242
|
+
this.onModelChange({
|
|
243
|
+
choices: cloneDeep(newRespAreaChoices),
|
|
244
|
+
slateMarkup: domMarkup.innerHTML,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
onAddChoice: any = (index, label, choiceIndex) => {
|
|
250
|
+
const { respAreaChoices } = this.state;
|
|
251
|
+
const { maxResponseAreaChoices } = this.props.configuration;
|
|
252
|
+
|
|
253
|
+
const showWarning = (message) =>
|
|
254
|
+
this.setState({
|
|
255
|
+
warning: {
|
|
256
|
+
open: true,
|
|
257
|
+
text: message,
|
|
258
|
+
onClose: undefined,
|
|
259
|
+
onConfirm: () => {
|
|
260
|
+
this.setState({ warning: { open: false } });
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
if (respAreaChoices[index] && respAreaChoices[index].length >= maxResponseAreaChoices) {
|
|
266
|
+
showWarning(`There are only ${maxResponseAreaChoices} answers allowed per choice.`);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (!respAreaChoices[index]) {
|
|
271
|
+
respAreaChoices[index] = [];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
// check for duplicate answer, but exclude the one that is currently edited
|
|
277
|
+
if ((respAreaChoices[index] || []).find((r, idx) => r.label === label && idx !== choiceIndex)) {
|
|
278
|
+
showWarning('Duplicate answers are not allowed.');
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (choiceIndex >= 0 && respAreaChoices[index]?.[choiceIndex]) {
|
|
283
|
+
// we need to update the choice label with the new value
|
|
284
|
+
respAreaChoices[index][choiceIndex].label = label;
|
|
285
|
+
} else {
|
|
286
|
+
// add a new choice
|
|
287
|
+
const value =
|
|
288
|
+
(respAreaChoices[index] &&
|
|
289
|
+
max(respAreaChoices[index].map((c) => parseInt(c.value)).filter((val) => !isNaN(val)))) ||
|
|
290
|
+
0;
|
|
291
|
+
|
|
292
|
+
respAreaChoices[index].push({
|
|
293
|
+
label,
|
|
294
|
+
value: `${value + 1}`,
|
|
295
|
+
correct: false,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
this.onModelChange({ choices: cloneDeep(respAreaChoices) });
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
onRemoveChoice: any = (respIndex, index) => {
|
|
303
|
+
const { respAreaChoices } = this.state;
|
|
304
|
+
|
|
305
|
+
respAreaChoices[respIndex].splice(index, 1);
|
|
306
|
+
|
|
307
|
+
this.onModelChange({ choices: cloneDeep(respAreaChoices) });
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
onSelectChoice: any = (respIndex, selectedIndex) => {
|
|
311
|
+
const { respAreaChoices } = this.state;
|
|
312
|
+
|
|
313
|
+
respAreaChoices[respIndex] = respAreaChoices[respIndex].map((choice, index) => ({
|
|
314
|
+
...choice,
|
|
315
|
+
correct: index === selectedIndex,
|
|
316
|
+
}));
|
|
317
|
+
|
|
318
|
+
this.onModelChange({ choices: cloneDeep(respAreaChoices) });
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
render() {
|
|
322
|
+
const { warning } = this.state;
|
|
323
|
+
const { model, configuration, onConfigurationChanged, imageSupport, uploadSoundSupport } = this.props;
|
|
324
|
+
const {
|
|
325
|
+
baseInputConfiguration = {},
|
|
326
|
+
choiceRationale = {},
|
|
327
|
+
contentDimensions = {},
|
|
328
|
+
lockChoiceOrder = {},
|
|
329
|
+
maxResponseAreas,
|
|
330
|
+
maxImageWidth = {},
|
|
331
|
+
maxImageHeight = {},
|
|
332
|
+
partialScoring = {},
|
|
333
|
+
prompt = {},
|
|
334
|
+
rationale = {},
|
|
335
|
+
settingsPanelDisabled,
|
|
336
|
+
spellCheck = {},
|
|
337
|
+
teacherInstructions = {},
|
|
338
|
+
template = {},
|
|
339
|
+
withRubric = {},
|
|
340
|
+
mathMlOptions = {},
|
|
341
|
+
language = {},
|
|
342
|
+
languageChoices = {},
|
|
343
|
+
responseAreaInputConfiguration = {},
|
|
344
|
+
} = configuration || {};
|
|
345
|
+
|
|
346
|
+
const {
|
|
347
|
+
choiceRationaleEnabled,
|
|
348
|
+
choices,
|
|
349
|
+
errors,
|
|
350
|
+
extraCSSRules,
|
|
351
|
+
promptEnabled,
|
|
352
|
+
rationaleEnabled,
|
|
353
|
+
spellCheckEnabled,
|
|
354
|
+
teacherInstructionsEnabled,
|
|
355
|
+
toolbarEditorPosition,
|
|
356
|
+
} = model || {};
|
|
357
|
+
const {
|
|
358
|
+
prompt: promptError,
|
|
359
|
+
rationale: rationaleError,
|
|
360
|
+
responseAreasError,
|
|
361
|
+
responseAreaChoicesError,
|
|
362
|
+
teacherInstructions: teacherInstructionsError,
|
|
363
|
+
} = errors || {};
|
|
364
|
+
|
|
365
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
366
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
367
|
+
|
|
368
|
+
const renderChoiceRationale = () =>
|
|
369
|
+
(Object.keys(choices) || []).map((key, index) => (
|
|
370
|
+
<RationaleChoices key={key}>
|
|
371
|
+
<Accordion slotProps={{ transition: { timeout: { enter: 225, exit: 195 } } }}>
|
|
372
|
+
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
|
373
|
+
<StyledTypography component={'div'}>{`Rationale for response area #${index + 1}`}</StyledTypography>
|
|
374
|
+
</AccordionSummary>
|
|
375
|
+
|
|
376
|
+
<StyledAccordionDetails>
|
|
377
|
+
{(choices[key] || []).map((choice) => (
|
|
378
|
+
<React.Fragment key={choice.label}>
|
|
379
|
+
<RationaleLabel
|
|
380
|
+
dangerouslySetInnerHTML={{
|
|
381
|
+
__html: `${rationale.label} for ${choice.label} (${choice.correct ? 'correct' : 'incorrect'})`,
|
|
382
|
+
}}
|
|
383
|
+
/>
|
|
384
|
+
<ChoiceRationaleHolder>
|
|
385
|
+
<EditableHtml
|
|
386
|
+
markup={choice.rationale || ''}
|
|
387
|
+
spellCheck={spellCheckEnabled}
|
|
388
|
+
pluginProps={getPluginProps(rationale?.inputConfiguration)}
|
|
389
|
+
onChange={(c) => this.onChoiceRationaleChanged(key, { ...choice, rationale: c })}
|
|
390
|
+
imageSupport={imageSupport}
|
|
391
|
+
maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}
|
|
392
|
+
maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}
|
|
393
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
394
|
+
mathMlOptions={mathMlOptions}
|
|
395
|
+
/>
|
|
396
|
+
</ChoiceRationaleHolder>
|
|
397
|
+
</React.Fragment>
|
|
398
|
+
))}
|
|
399
|
+
</StyledAccordionDetails>
|
|
400
|
+
</Accordion>
|
|
401
|
+
</RationaleChoices>
|
|
402
|
+
));
|
|
403
|
+
|
|
404
|
+
const toolbarOpts = {
|
|
405
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const validationMessage = generateValidationMessage(configuration);
|
|
409
|
+
|
|
410
|
+
const panelSettings = {
|
|
411
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
412
|
+
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
413
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
414
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
|
|
415
|
+
};
|
|
416
|
+
const panelProperties = {
|
|
417
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
418
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
419
|
+
choiceRationaleEnabled: choiceRationale.settings && toggle(choiceRationale.label),
|
|
420
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
421
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
422
|
+
rubricEnabled: withRubric?.settings && toggle(withRubric?.label),
|
|
423
|
+
};
|
|
424
|
+
const getPluginProps = (props = {}) => ({
|
|
425
|
+
...baseInputConfiguration,
|
|
426
|
+
...props,
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
return (
|
|
430
|
+
<layout.ConfigLayout
|
|
431
|
+
extraCSSRules={{
|
|
432
|
+
names: ['red', 'blue'],
|
|
433
|
+
rules: `
|
|
434
|
+
.red {
|
|
435
|
+
color: red !important;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.blue {
|
|
439
|
+
color: blue !important;
|
|
440
|
+
}
|
|
441
|
+
`,
|
|
442
|
+
}}
|
|
443
|
+
dimensions={contentDimensions}
|
|
444
|
+
hideSettings={settingsPanelDisabled}
|
|
445
|
+
settings={
|
|
446
|
+
<Panel
|
|
447
|
+
model={model}
|
|
448
|
+
configuration={configuration}
|
|
449
|
+
onChangeModel={(model) => this.onModelChange(model)}
|
|
450
|
+
onChangeConfiguration={(configuration) => onConfigurationChanged(configuration, true)}
|
|
451
|
+
groups={{
|
|
452
|
+
Settings: panelSettings,
|
|
453
|
+
Properties: panelProperties,
|
|
454
|
+
}}
|
|
455
|
+
/>
|
|
456
|
+
}
|
|
457
|
+
>
|
|
458
|
+
{teacherInstructionsEnabled && (
|
|
459
|
+
<PromptHolder label={teacherInstructions.label}>
|
|
460
|
+
<EditableHtml
|
|
461
|
+
markup={model.teacherInstructions || ''}
|
|
462
|
+
onChange={this.onTeacherInstructionsChanged}
|
|
463
|
+
imageSupport={imageSupport}
|
|
464
|
+
nonEmpty={false}
|
|
465
|
+
error={teacherInstructionsError}
|
|
466
|
+
toolbarOpts={toolbarOpts}
|
|
467
|
+
pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}
|
|
468
|
+
spellCheck={spellCheckEnabled}
|
|
469
|
+
maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}
|
|
470
|
+
maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}
|
|
471
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
472
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
473
|
+
mathMlOptions={mathMlOptions}
|
|
474
|
+
/>
|
|
475
|
+
{teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}
|
|
476
|
+
</PromptHolder>
|
|
477
|
+
)}
|
|
478
|
+
|
|
479
|
+
{promptEnabled && (
|
|
480
|
+
<PromptHolder label={prompt.label}>
|
|
481
|
+
<EditableHtml
|
|
482
|
+
markup={model.prompt}
|
|
483
|
+
onChange={this.onPromptChanged}
|
|
484
|
+
imageSupport={imageSupport}
|
|
485
|
+
nonEmpty={false}
|
|
486
|
+
disableUnderline
|
|
487
|
+
error={promptError}
|
|
488
|
+
toolbarOpts={toolbarOpts}
|
|
489
|
+
pluginProps={getPluginProps(prompt?.inputConfiguration)}
|
|
490
|
+
spellCheck={spellCheckEnabled}
|
|
491
|
+
maxImageWidth={defaultImageMaxWidth}
|
|
492
|
+
maxImageHeight={defaultImageMaxHeight}
|
|
493
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
494
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
495
|
+
mathMlOptions={mathMlOptions}
|
|
496
|
+
/>
|
|
497
|
+
{promptError && <ErrorText>{promptError}</ErrorText>}
|
|
498
|
+
</PromptHolder>
|
|
499
|
+
)}
|
|
500
|
+
|
|
501
|
+
<FlexContainer>
|
|
502
|
+
<StyledTypography component={'div'}>Define Template, Choices, and Correct Responses</StyledTypography>
|
|
503
|
+
<StyledTooltip disableFocusListener disableTouchListener placement={'right'} title={validationMessage}>
|
|
504
|
+
<Info fontSize={'small'} color={'primary'} />
|
|
505
|
+
</StyledTooltip>
|
|
506
|
+
</FlexContainer>
|
|
507
|
+
|
|
508
|
+
<ResponseAreaComponent
|
|
509
|
+
responseAreasError={responseAreasError}
|
|
510
|
+
responseAreaChoicesError={responseAreaChoicesError}
|
|
511
|
+
editableHtmlProps={{
|
|
512
|
+
pluginProps: getPluginProps(template?.inputConfiguration),
|
|
513
|
+
activePlugins: ALL_PLUGINS,
|
|
514
|
+
toolbarOpts: { position: 'top' },
|
|
515
|
+
extraCSSRules: {
|
|
516
|
+
names: ['red', 'blue'],
|
|
517
|
+
rules: `
|
|
518
|
+
.red {
|
|
519
|
+
color: red !important;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.blue {
|
|
523
|
+
color: blue !important;
|
|
524
|
+
}
|
|
525
|
+
`,
|
|
526
|
+
},
|
|
527
|
+
responseAreaProps: {
|
|
528
|
+
type: 'inline-dropdown',
|
|
529
|
+
options: {
|
|
530
|
+
duplicates: true,
|
|
531
|
+
},
|
|
532
|
+
maxResponseAreas: maxResponseAreas,
|
|
533
|
+
respAreaToolbar: (nodeInfo, editor, onToolbarDone) => {
|
|
534
|
+
const [node, pos] = nodeInfo;
|
|
535
|
+
const { respAreaChoices } = this.state;
|
|
536
|
+
|
|
537
|
+
return props => (
|
|
538
|
+
<InlineDropdownToolbar
|
|
539
|
+
{...props}
|
|
540
|
+
onAddChoice={this.onAddChoice}
|
|
541
|
+
onCheck={this.onCheck}
|
|
542
|
+
onRemoveChoice={(index) => this.onRemoveChoice(node.attrs.index, index)}
|
|
543
|
+
onSelectChoice={(index) => this.onSelectChoice(node.attrs.index, index)}
|
|
544
|
+
node={node}
|
|
545
|
+
pos={pos}
|
|
546
|
+
editor={editor}
|
|
547
|
+
onToolbarDone={onToolbarDone}
|
|
548
|
+
choices={respAreaChoices[node.attrs.index]}
|
|
549
|
+
spellCheck={spellCheckEnabled}
|
|
550
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
551
|
+
mathMlOptions={mathMlOptions}
|
|
552
|
+
baseInputConfiguration={baseInputConfiguration}
|
|
553
|
+
responseAreaInputConfiguration={responseAreaInputConfiguration}
|
|
554
|
+
/>
|
|
555
|
+
);
|
|
556
|
+
},
|
|
557
|
+
},
|
|
558
|
+
spellCheck: spellCheckEnabled,
|
|
559
|
+
markup: model.slateMarkup || '',
|
|
560
|
+
onChange: this.onChange,
|
|
561
|
+
imageSupport: imageSupport,
|
|
562
|
+
disableImageAlignmentButtons: true,
|
|
563
|
+
disabled: false,
|
|
564
|
+
highlightShape: false,
|
|
565
|
+
error: responseAreasError,
|
|
566
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
567
|
+
languageCharactersProps: [{ language: 'spanish' }, { language: 'special' }],
|
|
568
|
+
mathMlOptions: mathMlOptions,
|
|
569
|
+
}}
|
|
570
|
+
/>
|
|
571
|
+
|
|
572
|
+
{choiceRationaleEnabled && renderChoiceRationale()}
|
|
573
|
+
|
|
574
|
+
{rationaleEnabled && (
|
|
575
|
+
<PromptHolder label={rationale.label}>
|
|
576
|
+
<EditableHtml
|
|
577
|
+
markup={model.rationale || ''}
|
|
578
|
+
onChange={this.onRationaleChanged}
|
|
579
|
+
imageSupport={imageSupport}
|
|
580
|
+
error={rationaleError}
|
|
581
|
+
toolbarOpts={toolbarOpts}
|
|
582
|
+
pluginProps={getPluginProps(rationale?.inputConfiguration)}
|
|
583
|
+
spellCheck={spellCheckEnabled}
|
|
584
|
+
maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}
|
|
585
|
+
maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}
|
|
586
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
587
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
588
|
+
mathMlOptions={mathMlOptions}
|
|
589
|
+
/>
|
|
590
|
+
{rationaleError && <ErrorText>{rationaleError}</ErrorText>}
|
|
591
|
+
</PromptHolder>
|
|
592
|
+
)}
|
|
593
|
+
|
|
594
|
+
<AlertDialog
|
|
595
|
+
open={warning.open}
|
|
596
|
+
title="Warning"
|
|
597
|
+
text={warning.text}
|
|
598
|
+
onClose={warning.onClose}
|
|
599
|
+
onConfirm={warning.onConfirm}
|
|
600
|
+
disableAutoFocus={true}
|
|
601
|
+
disableEnforceFocus={true}
|
|
602
|
+
disableRestoreFocus={true}
|
|
603
|
+
/>
|
|
604
|
+
</layout.ConfigLayout>
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export default Main;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/inline-dropdown/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
|
+
// do not remove \t from \times, \triangle, \tan, \theta or \therefore
|
|
14
|
+
const tSymbols = 'imes|riangle|an|heta|herefore';
|
|
15
|
+
// do not remove \n from \nthroot, \nparallel, \ncong, \napprox, \neq, \ne or \nsim
|
|
16
|
+
const nSymbols = 'throot|parallel|cong|approx|eq|e|sim';
|
|
17
|
+
// match all \t and \n that are not part of math symbols that starts with \t or \n
|
|
18
|
+
const matchTabAndNewLine = new RegExp(
|
|
19
|
+
`(\\t(?!${tSymbols}))|(\\n(?!${nSymbols}))|(\\\\t(?!${tSymbols}))|(\\\\n(?!${nSymbols}))`,
|
|
20
|
+
'g',
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const removeUnwantedCharacters = (markup) =>
|
|
24
|
+
markup.replace(matchTabAndNewLine, '').replace(/\\"/g, '"').replace(/\\\//g, '/');
|
|
25
|
+
|
|
26
|
+
export const createElementFromHTML = (htmlString) => {
|
|
27
|
+
const div = document.createElement('div');
|
|
28
|
+
|
|
29
|
+
div.innerHTML = htmlString.trim();
|
|
30
|
+
|
|
31
|
+
return div;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const processMarkup = (markup) => {
|
|
35
|
+
const newMarkup = removeUnwantedCharacters(markup);
|
|
36
|
+
const slateMarkup = createElementFromHTML(newMarkup);
|
|
37
|
+
|
|
38
|
+
slateMarkup.querySelectorAll('[data-type="inline_dropdown"]').forEach((s) => {
|
|
39
|
+
s.replaceWith(`{{${s.dataset.index}}}`);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return slateMarkup.innerHTML;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const REGEX = /\{\{(\d+)\}\}/g;
|
|
46
|
+
|
|
47
|
+
export const createSlateMarkup = (markup, choices) => {
|
|
48
|
+
const newMarkup = removeUnwantedCharacters(markup);
|
|
49
|
+
const createSelect = (index) => {
|
|
50
|
+
let correctChoice = choices[index] && choices[index].find((c) => c.correct);
|
|
51
|
+
|
|
52
|
+
if (!correctChoice || !correctChoice.value) {
|
|
53
|
+
correctChoice = {
|
|
54
|
+
id: '',
|
|
55
|
+
value: '',
|
|
56
|
+
label: '',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return `<span data-type="inline_dropdown" data-index="${index}" data-value="${escape(
|
|
61
|
+
correctChoice.label,
|
|
62
|
+
)}"></span>`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return newMarkup.replace(REGEX, (match, g) => {
|
|
66
|
+
return createSelect(g);
|
|
67
|
+
});
|
|
68
|
+
};
|