fix: Added icons in Add Block Dropdown

This commit is contained in:
shariquerik 2021-08-04 19:00:00 +05:30
parent a4fee548d6
commit 66a91fc014
4 changed files with 12 additions and 3 deletions

View file

@ -3,7 +3,7 @@ export default class Card extends Block {
static get toolbox() {
return {
title: 'Card',
icon: '<svg height="24" width="24" viewBox="0 0 24 24"><path d="M7 15h3a1 1 0 000-2H7a1 1 0 000 2zM19 5H5a3 3 0 00-3 3v9a3 3 0 003 3h14a3 3 0 003-3V8a3 3 0 00-3-3zm1 12a1 1 0 01-1 1H5a1 1 0 01-1-1v-6h16zm0-8H4V8a1 1 0 011-1h14a1 1 0 011 1z"/></svg>'
icon: '<svg height="20" width="20" viewBox="2 2 20 20"><path d="M7 15h3a1 1 0 000-2H7a1 1 0 000 2zM19 5H5a3 3 0 00-3 3v9a3 3 0 003 3h14a3 3 0 003-3V8a3 3 0 00-3-3zm1 12a1 1 0 01-1 1H5a1 1 0 01-1-1v-6h16zm0-8H4V8a1 1 0 011-1h14a1 1 0 011 1z"/></svg>'
};
}

View file

@ -4,7 +4,7 @@ export default class Onboarding extends Block {
static get toolbox() {
return {
title: 'Onboarding',
icon: '<svg width="24" height="24" fill="none"><path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM12 11.09v5.455" stroke="#1F272E" fill="none"/><path d="M12.41 7.455a.41.41 0 11-.82 0 .41.41 0 01.82 0z" stroke="#1F272E"/></svg>'
icon: '<svg width="24" height="24" viewBox="2 0 20 24" fill="none"><path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM12 11.09v5.455" stroke="#1F272E" fill="none"/><path d="M12.41 7.455a.41.41 0 11-.82 0 .41.41 0 01.82 0z" stroke="#1F272E"/></svg>'
};
}

View file

@ -410,7 +410,10 @@ frappe.views.Workspace = class Workspace {
);
Object.keys(this.blocks).forEach(key => {
this.page.add_inner_button(__(this.blocks[key].toolbox.title), function() {
this.page.add_inner_button(`
<span class="block-item-icon">${this.blocks[key].toolbox.icon}</span>
<span class="block-item-label">${__(this.blocks[key].toolbox.title)}</span>
`, function() {
const index = me.editor.blocks.getBlocksCount() + 1;
me.editor.blocks.insert(key, {}, {}, index, true);
me.editor.caret.setToLastBlock('start', 0);

View file

@ -793,6 +793,12 @@ body {
}
}
.block-item-icon svg{
width: 12px;
height: 12px;
margin-right: 5px;
}
.standard-sidebar-item {
justify-content: space-between;
padding: 0px;