Skip to content

Commit

Permalink
Remove bake confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
Maarrk committed Feb 18, 2024
1 parent ee9b8e0 commit 0412a9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
20 changes: 1 addition & 19 deletions plugs/query/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,7 @@ export async function editButton(pos: number) {
await editor.moveCursor(pos);
}

export async function bakeButton(pos: number, confirmed: boolean | undefined) {
if (
!confirmed &&
!await editor.confirm(
"Are you sure you want to permanently replace this live query with current contents?",
)
) {
return;
}

export async function bakeButton(pos: number) {
const text = await editor.getText();
const tree = await markdown.parseMarkdown(text);
try {
Expand All @@ -91,14 +82,6 @@ export async function bakeButton(pos: number, confirmed: boolean | undefined) {
}

export async function bakePage() {
if (
!await editor.confirm(
"Are you sure you want to permanently replace all queries and templates on this page with current contents?",
)
) {
return;
}

// TODO: How to register that automagically?
const bakedBlockTypes: Record<string, string> = {
query: "query.bakeButton",
Expand All @@ -118,7 +101,6 @@ export async function bakePage() {
system.invokeFunction(
bakedBlockTypes[blockType],
block.from,
true, // confirmed
);
});
}
11 changes: 1 addition & 10 deletions plugs/template/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,7 @@ export async function templateWidget(
}
}

export async function bakeButton(pos: number, confirmed: boolean | undefined) {
if (
!confirmed &&
!await editor.confirm(
"Are you sure you want to permanently replace this template with current contents?",
)
) {
return;
}

export async function bakeButton(pos: number) {
const text = await editor.getText();
const tree = await markdown.parseMarkdown(text);
try {
Expand Down

0 comments on commit 0412a9b

Please sign in to comment.