mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-06-15 18:54:47 -04:00
wip
This commit is contained in:
parent
d572467e99
commit
bcf40fe667
14 changed files with 217 additions and 22 deletions
|
@ -14,6 +14,7 @@ import {
|
|||
MAX_LEVEL_SIZE,
|
||||
MIN_LEVEL_SIZE,
|
||||
} from "./pure_functions";
|
||||
import {toast} from "./toast";
|
||||
|
||||
const palette = _palette as Palette;
|
||||
|
||||
|
@ -146,6 +147,11 @@ export async function editRawLevelList(nth: number, color = "W") {
|
|||
value: "copy",
|
||||
help: t("editor.editing.copy_help"),
|
||||
},
|
||||
{
|
||||
text: t("editor.editing.show_code"),
|
||||
value: "show_code",
|
||||
help: t("editor.editing.show_code_help"),
|
||||
},
|
||||
{
|
||||
text: t("editor.editing.bigger"),
|
||||
value: "size:+1",
|
||||
|
@ -228,7 +234,7 @@ export async function editRawLevelList(nth: number, color = "W") {
|
|||
});
|
||||
return;
|
||||
}
|
||||
if (action === "copy") {
|
||||
if (action === "copy" || action ==='show_code') {
|
||||
let text =
|
||||
"```\n[" +
|
||||
(level.name || "unnamed level")?.replace(/\[|\]/gi, " ") +
|
||||
|
@ -241,7 +247,24 @@ export async function editRawLevelList(nth: number, color = "W") {
|
|||
"\n[" +
|
||||
(level.credit?.replace(/\[|\]/gi, " ") || "Missing credits") +
|
||||
"]\n```";
|
||||
navigator.clipboard.writeText(text);
|
||||
|
||||
if (action === "copy") {
|
||||
try{
|
||||
await navigator.clipboard.writeText(text);
|
||||
toast(t('editor.editing.copied'))
|
||||
}catch (e){
|
||||
if('message' in e) {
|
||||
toast(e.message)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
await asyncAlert({
|
||||
title:t('editor.editing.show_code'),
|
||||
content:[`
|
||||
<pre>${text}</pre>
|
||||
`]
|
||||
})
|
||||
}
|
||||
// return
|
||||
}
|
||||
if (action === "rename") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue