feat(icon): Notion-style icon picker + custom workspace emojis; fix side peek file content & ctx menu overflow
This commit is contained in:
@@ -1195,12 +1195,25 @@ replaceBlock(idx,type){const b=this.blocks[idx];if(!b)return;this.sync();this.pu
|
||||
}catch(e){this.showToast('Remove failed','error');}
|
||||
},
|
||||
toggleIcon(){this.iconOpen=!this.iconOpen;},
|
||||
iconHtml(){
|
||||
var v=this.iconValue;
|
||||
if(!v)v=(this.contentFormat==='file')?'paperclip':'file';
|
||||
return window.fdIconHtml?window.fdIconHtml(v,36):v;
|
||||
},
|
||||
openIconPicker(){
|
||||
var self=this;
|
||||
if(window.FDIconPicker)window.FDIconPicker.openFor({
|
||||
x:120,y:160,
|
||||
onPick:function(v){self.setIcon(v);},
|
||||
onRemove:function(){self.setIcon('');}
|
||||
});
|
||||
},
|
||||
async setIcon(icon){
|
||||
this.iconValue=icon;
|
||||
try{
|
||||
const r=await fetch('/board/api/pages/'+this.pid+'/icon',{method:'POST',headers:{'Content-Type':'application/json','X-CSRF-Token':this.csrfTok()},body:JSON.stringify({icon})});
|
||||
const d=await r.json();
|
||||
if(d.status==='ok'){this.iconOpen=false;this.showToast('Icon updated');}
|
||||
if(d.status==='ok'){this.iconOpen=false;this.showToast(icon?'Icon updated':'Icon removed');}
|
||||
}catch(e){this.showToast('Icon update failed','error');}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user