From b384d15469e95f4935c3f761b667ca78c899f0ba Mon Sep 17 00:00:00 2001 From: daria <95225431+dariiing@users.noreply.github.com> Date: Fri, 8 Aug 2025 15:42:41 +0300 Subject: [PATCH] update markdown toolbar icons --- www/code/inner.js | 2 +- www/common/common-icons.js | 11 +++++++- www/common/common-ui-elements.js | 37 +++++++++++--------------- www/common/sframe-common-codemirror.js | 8 +++--- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/www/code/inner.js b/www/code/inner.js index 2248fef1f..f8b6043f0 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -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); diff --git a/www/common/common-icons.js b/www/common/common-icons.js index 6346ca1fd..dcdbeaf54 100644 --- a/www/common/common-icons.js +++ b/www/common/common-icons.js @@ -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 = {}) => { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5431ec377..0284046ad 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -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( - $('', { - '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( - $('', { - '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'); diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index e3411dc0e..d7f135d55 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -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(''); + 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(''); + $select.find('span.cp-theme-text').prepend(Icons.get('chevron-right')); } }; }());