mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix frontend API to work with JAM icons
This commit is contained in:
parent
71f333154d
commit
bc2e230425
@ -47,7 +47,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
|
|||||||
/**
|
/**
|
||||||
* @typedef {Object} ToolbarButtonOptions
|
* @typedef {Object} ToolbarButtonOptions
|
||||||
* @property {string} title
|
* @property {string} title
|
||||||
* @property {string} [icon] - name of the jQuery UI icon to be used (e.g. "clock" for "ui-icon-clock" icon)
|
* @property {string} [icon] - name of the JAM icon to be used (e.g. "clock" for "jam-clock" icon)
|
||||||
* @property {function} action - callback handling the click on the button
|
* @property {function} action - callback handling the click on the button
|
||||||
* @property {string} [shortcut] - keyboard shortcut for the button, e.g. "alt+t"
|
* @property {string} [shortcut] - keyboard shortcut for the button, e.g. "alt+t"
|
||||||
*/
|
*/
|
||||||
@ -60,14 +60,16 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
|
|||||||
this.addButtonToToolbar = opts => {
|
this.addButtonToToolbar = opts => {
|
||||||
const buttonId = "toolbar-button-" + opts.title.replace(/[^a-zA-Z0-9]/g, "-");
|
const buttonId = "toolbar-button-" + opts.title.replace(/[^a-zA-Z0-9]/g, "-");
|
||||||
|
|
||||||
const icon = $("<span>")
|
|
||||||
.addClass("ui-icon ui-icon-" + opts.icon);
|
|
||||||
|
|
||||||
const button = $('<button>')
|
const button = $('<button>')
|
||||||
.addClass("btn btn-sm")
|
.addClass("btn btn-sm")
|
||||||
.click(opts.action)
|
.click(opts.action);
|
||||||
.append(icon)
|
|
||||||
.append($("<span>").text(opts.title));
|
if (opts.icon) {
|
||||||
|
button.append($("<span>").addClass("jam jam-" + opts.icon))
|
||||||
|
.append(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
button.append($("<span>").text(opts.title));
|
||||||
|
|
||||||
button.attr('id', buttonId);
|
button.attr('id', buttonId);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ body {
|
|||||||
|
|
||||||
#header {
|
#header {
|
||||||
grid-area: header;
|
grid-area: header;
|
||||||
background-color: #f1f1f1;
|
background-color: #f8f8f8;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user