Skip to content

Commit

Permalink
Improve html tag names
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed Jan 12, 2025
1 parent defb99a commit 46b5c88
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fn build_completion() -> Result<(), Error> {
}
Ok(())
}

fn build_man() -> Result<(), Error> {
let outdir = match var_os("CARGO_MANIFEST_DIR") {
None => return Ok(()),
Expand Down
10 changes: 5 additions & 5 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h3> An extremely fast LaTex formatter </h3>

<!-- Buttons -->
<div>
<button id="submitButton">Format</button>
<button id="formatButton">Format</button>
<button id="copyButton">Copy output to clipboard</button>
</div>

Expand All @@ -22,12 +22,12 @@ <h3> An extremely fast LaTex formatter </h3>

<div style="flex: 1; display: flex; flex-direction: column; max-width: 600px;">
<h3> Input </h3>
<textarea id="textInput" rows="30" cols="80"></textarea>
<textarea id="inputText" rows="30" cols="80"></textarea>
</div>

<div style="flex: 1; display: flex; flex-direction: column; max-width: 600px;">
<h3> Output </h3>
<textarea id="textOutput" rows="30" cols="80" readonly></textarea>
<textarea id="outputText" rows="30" cols="80" readonly></textarea>
</div>

</div>
Expand All @@ -37,12 +37,12 @@ <h3> Output </h3>

<div style="flex: 1; display: flex; flex-direction: column; max-width: 600px;">
<h3> Config (optional) </h3>
<textarea id="textConfig" rows="20" cols="80"></textarea>
<textarea id="configText" rows="20" cols="80"></textarea>
</div>

<div style="flex: 1; display: flex; flex-direction: column; max-width: 600px;">
<h3> Logs </h3>
<textarea id="textLog" rows="20" cols="80" readonly></textarea>
<textarea id="logText" rows="20" cols="80" readonly></textarea>
</div>

</div>
Expand Down
22 changes: 11 additions & 11 deletions web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import init, { main } from './pkg/tex_fmt.js';
})();

// Submit button logic
document.getElementById('submitButton').addEventListener(
document.getElementById('formatButton').addEventListener(
'click', async () => {
const inputText = document.getElementById('textInput').value;
const outputBox = document.getElementById('textOutput');
const logBox = document.getElementById('textLog');
const inputText = document.getElementById('inputText').value;
const outputText = document.getElementById('outputText');
const logText = document.getElementById('logText');
try {
const configText = document.getElementById('textConfig').value;
const configText = document.getElementById('configText').value;
const result = await main(inputText, configText);
outputBox.value = result.output;
logBox.value = result.logs;
outputText.value = result.output;
logText.value = result.logs;
} catch (error) {
console.error('Error calling WebAssembly function:', error);
alert('An error occurred. Check the console for details.');
Expand All @@ -33,12 +33,12 @@ document.getElementById('submitButton').addEventListener(
// Copy output text to clipboard
document.getElementById('copyButton').addEventListener(
'click', () => {
const outputBox = document.getElementById('textOutput');
outputBox.select();
outputBox.setSelectionRange(0, 99999);
const outputText = document.getElementById('outputText');
outputText.select();
outputText.setSelectionRange(0, 99999);
try {
document.execCommand('copy');
alert('Copied to clipboard:\n\n' + outputBox.value);
alert('Copied to clipboard:\n\n' + outputText.value);
} catch (err) {
console.error('Failed to copy text: ', err);
}
Expand Down

0 comments on commit 46b5c88

Please sign in to comment.