1
+
2
+
3
+
4
+ parseInt[any_String] := ToExpression[any]
5
+ parseInt[any_] := any
6
+
7
+
8
+
9
+ Component[OptionsPattern[]] := Module[{tempBuffer}, With[{
10
+ update = CreateUUID[],
11
+ settings = OptionValue["Settings"],
12
+ log = OptionValue["Messager"],
13
+ onsave = OptionValue["OnSave"],
14
+ controller = CreateUUID[],
15
+
16
+ initialValues = Join[<|
17
+ "OutputCharactersLimit" -> 6000
18
+ |>, OptionValue["Settings"]]
19
+ },
20
+
21
+ EventHandler[controller, {
22
+ "Charlim" -> Function[value,
23
+ If[NumericQ[parseInt[value]],
24
+ onsave[<|"OutputCharactersLimit" -> parseInt[value]|>];
25
+ EventFire[log, Notifications`NotificationMessage["Info"](*`*), "Restart of a Kernel required"];
26
+ ,
27
+ EventFire[Messager, Notifications`NotificationMessage["Warning"](*`*), "Not a valid number!"];
28
+ ];
29
+ ]
30
+ }];
31
+
32
+ With[{lim = initialValues["OutputCharactersLimit"]},
33
+
34
+ <li class="list-none px-0 py-4 sm:px-0">
35
+ <div class="px-4 sm:px-0 pb-3 border-b border-gray-100">
36
+ <h3 class="text-base font-semibold leading-7 text-gray-900 dark:text-gray-300">Editor settings</h3>
37
+ <p class="mt-1 max-w-2xl text-sm leading-6 text-gray-500 dark:text-gray-500"></p>
38
+ </div>
39
+ <div class="mt-4">
40
+ <span class="dark:text-gray-400">Output form</span>
41
+ <div class="pb-2 mt-2 mt-5 gap-y-2 flex flex-col">
42
+ <p class="text-sm text-gray-500">Sets the maximum character limit for the output before the output cell is truncated.</p>
43
+ <div class="rounded-md px-3 pb-3 pt-2.5 shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-indigo-600">
44
+ <label for="characterslimit" class="block text-xs font-medium text-gray-900 dark:text-gray-400">Characters limit</label>
45
+ <input type="number" value="{lim}" min="3000" max="50000" step="100" id="characterslimit" class="block w-full border-0 p-0 dark:bg-gray-700 text-gray-900 dark:text-gray-300 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6"/>
46
+ <WebUIEventListener Id={"characterslimit"} Type={"blur"} Event={controller} Pattern={"Charlim"}/>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </li>
51
+ ]
52
+ ]]
53
+
54
+ Component
0 commit comments