fix(database): remove prompt popup, create database inline with default name
Clicking Database button now creates the table directly in the page without asking for a name (uses 'Database' as default). Same pattern as Notion: one click, inline embed, no popup.
This commit is contained in:
@@ -325,21 +325,20 @@
|
||||
|
||||
// ── v4.6.0: Get Started actions ──
|
||||
async createDatabase(){
|
||||
const name=prompt('Database name:',this.pageTitle||'New Database');
|
||||
if(!name||!name.trim())return;
|
||||
const csrf=document.cookie.match(/csrf_token=([^;]+)/);
|
||||
try{
|
||||
const name='Database';
|
||||
// Create collection via API
|
||||
const r=await fetch('/db/api',{
|
||||
method:'POST',headers:{'Content-Type':'application/json','X-CSRF-Token':csrf?csrf[1]:''},
|
||||
body:JSON.stringify({name:name.trim()})
|
||||
body:JSON.stringify({name:name})
|
||||
});
|
||||
const d=await r.json();
|
||||
if(d.id){
|
||||
// Add inline database embed block to the page
|
||||
this.blocks.push(this.mkB('embed','',{embed_type:'collection',collection_id:d.id}));
|
||||
this.render(); this.dirty=true; this.autoSave();
|
||||
this.showToast('Database created: '+d.name);
|
||||
this.showToast('Database created');
|
||||
}else{
|
||||
this.showToast('Failed to create database');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user