Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: web demo now works on mobile + fixed scrolling bug
Elijah Potterc9ef5c6efd14
diff --git a/demo.md b/demo.mdindex e11d75f1f..12a015d84 100644--- a/demo.md+++ b/demo.md@@ -1,5 +1,5 @@-There are some cases where the the standard grammar checkers-don't cut it. That s where Harper comes in handy.+There are some cases where the the standard grammar+checkers don't cut it. That s where Harper comes in handy.Harper is an language checker for developers. it can detectimproper capitalization and misspellled words,diff --git a/packages/web/src/lib/Editor.svelte b/packages/web/src/lib/Editor.svelteindex b0dc37c15..26f547635 100644--- a/packages/web/src/lib/Editor.svelte+++ b/packages/web/src/lib/Editor.svelte@@ -16,7 +16,8 @@$: lintText(content).then((newLints) => (lints = newLints));$: boxHeight = calcHeight(content);$: if (focused != null && lintCards[focused])- lintCards[focused].scrollIntoView({ behavior: 'smooth', block: 'nearest' });+ lintCards[focused].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });+ $: if (focused != null && focused >= lints.length) focused = undefined;$: if (editor != null && focused != null) {let lint = lints[focused % lints.length];@@ -34,7 +35,7 @@}</script>-<div class="flex flex-row w-full h-full p-5">+<div class="flex lg:flex-row flex-col w-full h-full p-5"><Cardclass="flex-grow h-full p-5 grid z-10 max-w-full text-lg overflow-auto mr-5"on:click={() => editor && editor.focus()}@@ -51,7 +52,7 @@<Underlines {content} bind:focusLintIndex={focused} /></div></Card>- <Card class="flex-none basis-[400px] h-full p-1">+ <Card class="flex-none basis-[400px] max-h-full p-1 hidden lg:flex"><h2 class="text-2xl font-bold m-2">Suggestions</h2><div class="flex flex-col overflow-y-scroll overflow-x-hidden m-0 p-0">{#each lints as lint, i}@@ -65,7 +66,7 @@<h3 class="font-bold">{lint.lint_kind()} - “<span class="italic">{lint.get_problem_text()}- </span> ”+ </span>”</h3></div><div@@ -97,4 +98,32 @@{/each}</div></Card>+ {#if focused != null}+ <Card class="lg:hidden max-w-full w-full justify-between flex-row">+ <div>+ <h1 class="font-bold">{lints[focused].lint_kind()}</h1>+ <p>{lints[focused].message()}</p>+ </div>+ <div class="flex flex-row">+ {#each lints[focused].suggestions() as suggestion}+ <div class="p-[4px]">+ <Button+ class="w-full"+ style="height: 40px; margin: 5px 0px;"+ on:click={() =>+ applySuggestion(content, suggestion, lints[focused].span()).then(+ (edited) => (content = edited)+ )}+ >+ {#if suggestion.kind() == SuggestionKind.Remove}+ Remove+ {:else}+ "{suggestion.get_replacement_text()}"+ {/if}+ </Button>+ </div>+ {/each}+ </div>+ </Card>+ {/if}</div>diff --git a/packages/web/src/lib/Underlines.svelte b/packages/web/src/lib/Underlines.svelteindex a547a9d91..bb9b2825e 100644--- a/packages/web/src/lib/Underlines.svelte+++ b/packages/web/src/lib/Underlines.svelte@@ -22,8 +22,8 @@$: if (focusLintIndex != null && lintHighlights[focusLintIndex] != null)lintHighlights[focusLintIndex].scrollIntoView({behavior: 'smooth',- block: 'center',- inline: 'center'+ block: 'nearest',+ inline: 'nearest'});function reOrgString(text: string): (string | undefined)[] {diff --git a/packages/web/src/routes/+page.svelte b/packages/web/src/routes/+page.svelteindex 4538e42de..75dcfd096 100644--- a/packages/web/src/routes/+page.svelte+++ b/packages/web/src/routes/+page.svelte@@ -58,11 +58,9 @@</span></Section>- {#if width > 1080}- <div class="w-full h-[600px] overflow-hidden">- <Editor />- </div>- {/if}+ <div class="w-full lg:h-[600px] h-[800px] overflow-hidden">+ <Editor />+ </div><Section><span slot="title">Private</span>