Verified Commit 18e80527 authored by Camil Staps's avatar Camil Staps 🚀

Export Bool argument of withSelect2 editor modifier

parent 1f1dcece
Pipeline #44327 passed with stage
in 7 minutes and 13 seconds
......@@ -45,7 +45,7 @@ enterExpression select2 hint =
Hint "You entered:" @>>
viewInformation [] expr >>! return
where
editor = if select2 (withSelect2 gEditor{|*|}) gEditor{|*|}
editor = if select2 (withSelect2 True gEditor{|*|}) gEditor{|*|}
fruits =: ["Apple", "Banana", "Cherry"]
veggies =: ["Arugula", "Broccoli", "Chickpea"]
......
......@@ -10,11 +10,13 @@ from iTasks.UI.Editor import :: Editor
from iTasks.UI.Editor.Controls import :: ChoiceText
/**
* Replaces all HTML `select` boxes in the editor with Select2 input fields
* (https://select2.org/), including `select` boxes of child editors and that
* are added later dynamically.
* Replaces HTML `select` boxes in the editor with Select2 input fields
* (https://select2.org/).
*
* @param When `True`, also the `select` boxes of child editors, which are
* added dynamically, are modified to use Select2.
*/
withSelect2 :: !(Editor a) -> Editor a
withSelect2 :: !Bool !(Editor a) -> Editor a
/**
* A replacement for `dropdown` (iTasks.UI.Editor.Controls) using Select2 input
......
......@@ -15,11 +15,8 @@ SELECT2_CSS :== "/select2/select2.min.css"
jQuery :== jsGlobal "jQuery"
withSelect2 :: !(Editor a) -> Editor a
withSelect2 editor = withSelect2` True editor
withSelect2` :: !Bool !(Editor a) -> Editor a
withSelect2` observeMutations editor=:{Editor | genUI} =
withSelect2 :: !Bool !(Editor a) -> Editor a
withSelect2 observeMutations editor=:{Editor | genUI} =
{ Editor
| editor
& genUI = withClientSideInit initUI genUI
......@@ -98,10 +95,10 @@ where
= seqSt (installSelect2 onSelect) addedNodes world
select2Dropdown :: Editor ([ChoiceText], [Int])
select2Dropdown = withSelect2` False dropdown
select2Dropdown = withSelect2 False dropdown
select2DropdownWithGroups :: Editor ([(ChoiceText, Maybe String)], [Int])
select2DropdownWithGroups = withSelect2` False dropdownWithGroups
select2DropdownWithGroups = withSelect2 False dropdownWithGroups
chooseWithSelect2Dropdown :: [String] -> Editor Int
chooseWithSelect2Dropdown labels = bijectEditorValue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment