Fix autocomplete and copy button

This commit is contained in:
Joseph Abbey
2024-01-28 12:02:24 +00:00
parent f5f88ced4e
commit d991f7f180
2 changed files with 18 additions and 1 deletions

View File

@ -212,6 +212,9 @@
&[icon='download']::before {
background-image: url(https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/download/default/48px.svg);
}
&[icon='copy']::before {
background-image: url(https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/content_copy/default/48px.svg);
}
}
}
</style>
@ -239,6 +242,12 @@
icon="download"
id="download"
type="button"></button>
<button
title="Copy the content of the editor to the clipboard"
class="icon"
icon="copy"
id="copy"
type="button"></button>
<input
required
autocomplete="new-password"

View File

@ -569,6 +569,13 @@ require(['vs/editor/editor.main'], async () => {
document.querySelector('#menu_url').classList.add('invalid');
}
});
document.querySelector('#copy').addEventListener('click', async (e) => {
navigator.clipboard.writeText(model.getValue());
toast({
text: 'Copied!',
color: 'var(--ctp-mocha-green)',
});
});
document.querySelector('#api_url').addEventListener('change', (e) => {
api_url = e.target.value;
@ -661,7 +668,8 @@ require(['vs/editor/editor.main'], async () => {
i--;
} while (
i >= 0 &&
word.word[i].toUpperCase() != word.word[i].toLowerCase()
(word.word[i] == '_' ||
word.word[i].toUpperCase() != word.word[i].toLowerCase())
);
i++;
var range = {