update markdown toolbar icons

This commit is contained in:
daria 2025-08-08 15:42:41 +03:00
parent 6b3ae5fe68
commit b384d15469
No known key found for this signature in database
GPG Key ID: 3B75240E6B2F2701
4 changed files with 31 additions and 27 deletions

View File

@ -88,7 +88,7 @@ define([
text: Messages.toolbar_theme,
options: [],
common: framework._.sfCommon,
iconCls: 'cptools cptools-palette'
iconCls: 'color-palette'
});
framework._.toolbar.$theme = $drawer.find('ul.cp-dropdown-content');
framework._.toolbar.$bottomL.append($drawer);

View File

@ -27,6 +27,8 @@ define([
"drive": "hard-drive",
"grid": "layout-grid",
"list": "list",
"list-ol": "list-ordered",
"list-todo": "list-todo",
"filter": "list-filter-plus",
"folder-open": "folder-open",
"drive-recent": "clock",
@ -119,7 +121,14 @@ define([
"redo": "redo",
"type": "type",
"clear-canvas": "brush-cleaning",
"key": "key"
"key": "key",
"bold": "bold",
"italic": "italic",
"heading": "heading",
"strikethrough": "strikethrough",
"quote": "quote",
"toc": "newspaper",
"embed": "image-plus"
};
Icons.get = (name, attrs = {}) => {

View File

@ -1081,17 +1081,17 @@ define([
'bold': {
// Msg.mdToolbar_bold
expr: '**{0}**',
icon: 'fa-bold'
icon: 'bold'
},
'italic': {
// Msg.mdToolbar_italic
expr: '_{0}_',
icon: 'fa-italic'
icon: 'italic'
},
'strikethrough': {
// Msg.mdToolbar_strikethrough
expr: '~~{0}~~',
icon: 'fa-strikethrough'
icon: 'strikethrough'
},
'heading': {
// Msg.mdToolbar_heading
@ -1100,12 +1100,12 @@ define([
return '# '+line;
}).join('\n')+'\n';
},
icon: 'fa-header'
icon: 'heading'
},
'link': {
// Msg.mdToolbar_link
expr: '[{0}](http://)',
icon: 'fa-link'
icon: 'link'
},
'quote': {
// Msg.mdToolbar_quote
@ -1114,7 +1114,7 @@ define([
return '> '+line;
}).join('\n')+'\n\n';
},
icon: 'fa-quote-right'
icon: 'quote'
},
'nlist': {
// Msg.mdToolbar_nlist
@ -1123,7 +1123,7 @@ define([
return '1. '+line;
}).join('\n')+'\n';
},
icon: 'fa-list-ol'
icon: 'list-ol'
},
'list': {
// Msg.mdToolbar_list
@ -1132,7 +1132,7 @@ define([
return '* '+line;
}).join('\n')+'\n';
},
icon: 'fa-list-ul'
icon: 'list'
},
'check': {
// Msg.mdToolbar_check
@ -1141,7 +1141,7 @@ define([
return '* [ ] ' + line;
}).join('\n') + '\n';
},
icon: 'fa-check-square-o'
icon: 'list-todo'
},
'code': {
// Msg.mdToolbar_code
@ -1151,18 +1151,18 @@ define([
}
return '`' + str + '`';
},
icon: 'fa-code'
icon: 'code'
},
'toc': {
// Msg.mdToolbar_toc
expr: '[TOC]',
icon: 'fa-newspaper-o'
icon: 'toc'
}
};
if (typeof(cfg.embed) === "function") {
actions.embed = { // Messages.mdToolbar_embed
icon: 'fa-picture-o',
icon: 'embed',
action: function () {
var _cfg = {
types: ['file', 'link'],
@ -1220,11 +1220,7 @@ define([
'class': 'pure-button cp-markdown-' + k,
'title': Messages['mdToolbar_' + k] || k,
'aria-label': Messages['mdToolbar_' + k] || k
}).append(
$('<i>', {
'class': 'fa ' + actions[k].icon,
'aria-hidden': 'true'
})).click(onClick);
}).append(Icons.get(actions[k].icon)).click(onClick);
if (k === "embed") { $toolbar.prepend($b); }
else { $toolbar.append($b); }
}
@ -1234,10 +1230,7 @@ define([
'title': Messages.mdToolbar_help,
'aria-label': Messages.mdToolbar_help
}).append(
$('<i>', {
'class': 'fa fa-question',
'aria-hidden': 'true'
})).click(function () {
Icons.get('help')).click(function () {
var href = Messages.mdToolbar_tutorial;
common.openUnsafeURL(href);
}).appendTo($toolbar);
@ -1320,7 +1313,7 @@ define([
'type': 'button',
'title': Messages.toolbar_show_text_tools
})).append([
h('i.fa.fa-pencil', { 'aria-hidden': 'true' }),
Icons.get('edit'),
h('span.cp-toolbar-label', {}, Messages.toolbar_text_tools)
]).click(function () {
var isExpanded = $toolbar.is(':visible');

View File

@ -14,7 +14,9 @@ define([
'/common/text-cursor.js',
'/components/chainpad/chainpad.dist.js',
'/common/hyperscript.js',
], function ($, Modes, Themes, Messages, UIElements, MT, Hash, Util, TextCursor, ChainPad, h) {
'/customize/fonts/lucide.js',
'/common/common-icons.js',
], function ($, Modes, Themes, Messages, UIElements, MT, Hash, Util, TextCursor, ChainPad, h, Lucide, Icons) {
var module = {};
var cursorToPos = module.cursorToPos = function(cursor, oldText) {
@ -303,7 +305,7 @@ define([
name = name ? Messages.languageButton + ' ('+name+')' : Messages.languageButton;
exp.$language.setValue(mode, name);
exp.$language.find('span.cp-language-text').text(name);
exp.$language.find('span.cp-language-text').prepend('<i class="fa fa-chevron-right"></i>');
exp.$language.find('span.cp-language-text').prepend(Icons.get('chevron-right'));
}
if (mode === "orgmode") {
@ -349,7 +351,7 @@ define([
name = name ? Messages.themeButton + ' ('+theme+')' : Messages.themeButton;
$select.setValue(theme, name);
$select.find('span.cp-theme-text').text(name);
$select.find('span.cp-theme-text').prepend('<i class="fa fa-chevron-right"></i>');
$select.find('span.cp-theme-text').prepend(Icons.get('chevron-right'));
}
};
}());