File tree Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 1
1
<!--
2
2
Created by Jacob Strieb.
3
- October 2024 - January 2025
3
+ Fall 2024 - Spring 2025
4
4
-->
5
5
<!doctype html>
6
6
< html lang ="en ">
Original file line number Diff line number Diff line change 233
233
window .visualViewport .addEventListener (" resize" , () => {
234
234
visualBottom = window .visualViewport .height ;
235
235
});
236
-
237
- function insertText (s ) {
238
- return ;
239
- }
236
+ let showInputButtons = $derived (
237
+ navigator .maxTouchPoints > 1 && Math .abs (innerHeight - visualBottom) > 5 ,
238
+ );
239
+ $effect (() => {
240
+ // iOS scrolls the formula bar to the middle on focus, this counteracts that
241
+ // (if it happens to run after the keyboard is up - inconsistent)
242
+ if (showInputButtons) {
243
+ window .scrollTo ({
244
+ top: 0 ,
245
+ behavior: " instant" ,
246
+ });
247
+ }
248
+ });
240
249
< / script>
241
250
242
251
{#snippet printKey (key)}
414
423
>
415
424
{/snippet}
416
425
{#if navigator.maxTouchPoints > 1}
417
- <div
418
- class="keyboardbar"
419
- style:bottom="max(calc(2.75em + 1px), {innerHeight - visualBottom}px)"
420
- >
426
+ <!-- Must set top instead of bottom for correct placement on iOS -->
427
+ <div class="keyboardbar" style:top="calc({visualBottom}px - 2.5em * 2)">
421
428
<FormulaBar bind:globals bind:editor={globals.elements.formulaBar} />
422
- {#if Math.abs(innerHeight - visualBottom) > 5 }
429
+ {#if showInputButtons }
423
430
<div class="buttonbar">
424
431
{@render insertTextButton("=")}
425
432
{@render insertTextButton("(")}
Original file line number Diff line number Diff line change 42
42
</style >
43
43
44
44
<script >
45
- let { globals, editor = $bindable () } = $props ();
45
+ let { globals, editor = $bindable (), ... rest } = $props ();
46
46
let selection = $derived (globals .selected );
47
47
let sheet = $derived (globals .currentSheet );
48
48
137
137
autocapitalization =" none"
138
138
autocomplete =" off"
139
139
spellcheck =" false"
140
+ {...rest }
140
141
></textarea >
141
142
</label >
You can’t perform that action at this time.
0 commit comments