Skip to content

Commit 2f8d8a8

Browse files
committed
freetext-improve - Make boxes the same size
1 parent 03926ac commit 2f8d8a8

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

corsscripts/ascii/stackascii.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
border-radius: 5px;
44
border: solid 1px;
55
padding: 5px;
6-
margin-top: 10px;
76
overflow: auto;
87
}
98
.plaintext {

stack/cas/castext2/blocks/ascii.block.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,16 @@ public function compile($format, $options): ?MP_Node {
133133

134134
// Size from the iframe viewport so the display area tracks frame resizing.
135135
// Keep a configured minimum so default 400px frames start at 370px content height.
136-
$astyle = "width:calc({$xpars['width']} - 20px);height:calc(100vh - 30px);";
137-
$astyle .= "min-height:calc({$xpars['height']} - 30px);";
136+
$astyle = "width:calc({$xpars['width']} - 13px);height:calc(100vh - 14px);";
137+
$astyle .= "min-height:calc({$xpars['height']} - 14px);";
138138
if (array_key_exists('aspect-ratio', $xpars)) {
139139
$aspectratio = $xpars['aspect-ratio'];
140140
// Unset the undefined dimension, if both are defined then we have a problem.
141141
if ($existsuserheight) {
142-
$astyle = "height:calc(100vh - 30px);aspect-ratio:$aspectratio;";
143-
$astyle .= "min-height:calc({$xpars['height']} - 30px);";
142+
$astyle = "height:calc(100vh - 14px);aspect-ratio:$aspectratio;";
143+
$astyle .= "min-height:calc({$xpars['height']} - 14px);";
144144
} else if ($existsuserwidth) {
145-
$astyle = "width:calc({$xpars['width']} - 20px);aspect-ratio:$aspectratio;";
145+
$astyle = "width:calc({$xpars['width']} - 13px);aspect-ratio:$aspectratio;";
146146
}
147147
}
148148
$r->items[] = new MP_String('<script type="module">');

tests/ascii_block_test.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function test_ascii_compile_adds_default_filter_and_input_request(): void
110110
$expectedlinkcode = '{init(inputIds,[{"operation":"filter","type":"markdown","transforms":"asciimath,aligneq,minwrap"}]);}';
111111
$this->assertStringContainsString($expectedlinkcode, $joined);
112112
$this->assertStringContainsString(
113-
'id="asciiContainerRow" style="width:calc(100% - 20px);height:calc(100vh - 30px);min-height:calc(400px - 30px);"',
113+
'id="asciiContainerRow" style="width:calc(100% - 13px);height:calc(100vh - 14px);min-height:calc(400px - 14px);"',
114114
$joined
115115
);
116116
}
@@ -161,7 +161,7 @@ public function test_ascii_compile_uses_child_filter_and_extractor_operations():
161161
',{"type":"lastexpr","targetinput":"ans2","operation":"extractor"}]);}';
162162
$this->assertStringContainsString($expectedlinkcode, $joined);
163163
$this->assertStringContainsString(
164-
'id="asciiContainerRow" style="width:calc(80% - 20px);height:calc(100vh - 30px);min-height:calc(300px - 30px);"',
164+
'id="asciiContainerRow" style="width:calc(80% - 13px);height:calc(100vh - 14px);min-height:calc(300px - 14px);"',
165165
$joined
166166
);
167167
$this->assertStringNotContainsString('"transforms":"aligneq,boldfilter"', $joined);
@@ -198,7 +198,7 @@ public function test_ascii_compile_uses_child_filter_markdown_maths(): void {
198198
',{"type":"lastexpr","targetinput":"ans2","operation":"extractor"}]);}';
199199
$this->assertStringContainsString($expectedlinkcode, $joined);
200200
$this->assertStringContainsString(
201-
'id="asciiContainerRow" style="width:calc(80% - 20px);height:calc(100vh - 30px);min-height:calc(300px - 30px);"',
201+
'id="asciiContainerRow" style="width:calc(80% - 13px);height:calc(100vh - 14px);min-height:calc(300px - 14px);"',
202202
$joined
203203
);
204204
$this->assertStringNotContainsString('"transforms":"aligneq,boldfilter"', $joined);

0 commit comments

Comments
 (0)