mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 02:52:27 +08:00
Merge pull request #1913 from TriliumNext/css-tweaks
Some css fine tunes
This commit is contained in:
commit
7c753117b8
@ -8,6 +8,10 @@ import appContext from "../components/app_context.js";
|
|||||||
import type FNote from "../entities/fnote.js";
|
import type FNote from "../entities/fnote.js";
|
||||||
import { t } from "./i18n.js";
|
import { t } from "./i18n.js";
|
||||||
|
|
||||||
|
// Track all elements that open tooltips
|
||||||
|
let openTooltipElements: JQuery<HTMLElement>[] = [];
|
||||||
|
let dismissTimer: ReturnType<typeof setTimeout>;
|
||||||
|
|
||||||
function setupGlobalTooltip() {
|
function setupGlobalTooltip() {
|
||||||
$(document).on("mouseenter", "a", mouseEnterHandler);
|
$(document).on("mouseenter", "a", mouseEnterHandler);
|
||||||
|
|
||||||
@ -23,7 +27,12 @@ function setupGlobalTooltip() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dismissAllTooltips() {
|
function dismissAllTooltips() {
|
||||||
$(".note-tooltip").remove();
|
clearTimeout(dismissTimer);
|
||||||
|
openTooltipElements.forEach($el => {
|
||||||
|
$el.tooltip("dispose");
|
||||||
|
$el.removeAttr("aria-describedby");
|
||||||
|
});
|
||||||
|
openTooltipElements = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupElementTooltip($el: JQuery<HTMLElement>) {
|
function setupElementTooltip($el: JQuery<HTMLElement>) {
|
||||||
@ -86,8 +95,8 @@ async function mouseEnterHandler(this: HTMLElement) {
|
|||||||
// we need to check if we're still hovering over the element
|
// we need to check if we're still hovering over the element
|
||||||
// since the operation to get tooltip content was async, it is possible that
|
// since the operation to get tooltip content was async, it is possible that
|
||||||
// we now create tooltip which won't close because it won't receive mouseleave event
|
// we now create tooltip which won't close because it won't receive mouseleave event
|
||||||
if ($(this).filter(":hover").length > 0) {
|
if ($link.filter(":hover").length > 0) {
|
||||||
$(this).tooltip({
|
$link.tooltip({
|
||||||
container: "body",
|
container: "body",
|
||||||
// https://github.com/zadam/trilium/issues/2794 https://github.com/zadam/trilium/issues/2988
|
// https://github.com/zadam/trilium/issues/2794 https://github.com/zadam/trilium/issues/2988
|
||||||
// with bottom this flickering happens a bit less
|
// with bottom this flickering happens a bit less
|
||||||
@ -103,7 +112,9 @@ async function mouseEnterHandler(this: HTMLElement) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
dismissAllTooltips();
|
dismissAllTooltips();
|
||||||
$(this).tooltip("show");
|
$link.tooltip("show");
|
||||||
|
|
||||||
|
openTooltipElements.push($link);
|
||||||
|
|
||||||
// Dismiss the tooltip immediately if a link was clicked inside the tooltip.
|
// Dismiss the tooltip immediately if a link was clicked inside the tooltip.
|
||||||
$(`.${tooltipClass} a`).on("click", (e) => {
|
$(`.${tooltipClass} a`).on("click", (e) => {
|
||||||
@ -115,15 +126,16 @@ async function mouseEnterHandler(this: HTMLElement) {
|
|||||||
// click on links within tooltip etc. without tooltip disappearing
|
// click on links within tooltip etc. without tooltip disappearing
|
||||||
// - once the user moves the cursor away from both link and the tooltip, hide the tooltip
|
// - once the user moves the cursor away from both link and the tooltip, hide the tooltip
|
||||||
const checkTooltip = () => {
|
const checkTooltip = () => {
|
||||||
if (!$(this).filter(":hover").length && !$(`.${linkId}:hover`).length) {
|
|
||||||
|
if (!$link.filter(":hover").length && !$(`.${linkId}:hover`).length) {
|
||||||
// cursor is neither over the link nor over the tooltip, user likely is not interested
|
// cursor is neither over the link nor over the tooltip, user likely is not interested
|
||||||
dismissAllTooltips();
|
dismissAllTooltips();
|
||||||
} else {
|
} else {
|
||||||
setTimeout(checkTooltip, 1000);
|
dismissTimer = setTimeout(checkTooltip, 1000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setTimeout(checkTooltip, 1000);
|
dismissTimer = setTimeout(checkTooltip, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +188,25 @@ function renderFootnote($link: JQuery<HTMLElement>, url: string) {
|
|||||||
.closest(".footnote-item") // find the parent container of the footnote
|
.closest(".footnote-item") // find the parent container of the footnote
|
||||||
.find(".footnote-content"); // find the actual text content of the footnote
|
.find(".footnote-content"); // find the actual text content of the footnote
|
||||||
|
|
||||||
return $footnoteContent.html() || "";
|
const isEditable = $link.closest(".ck-content").hasClass("note-detail-editable-text-editor");
|
||||||
|
if (isEditable) {
|
||||||
|
/* Remove widget buttons for tables, formulas, and images in editable notes. */
|
||||||
|
$footnoteContent.find('.ck-widget__selection-handle').remove();
|
||||||
|
$footnoteContent.find('.ck-widget__type-around').remove();
|
||||||
|
$footnoteContent.find('.ck-widget__resizer').remove();
|
||||||
|
|
||||||
|
/* Handling in-line math formulas */
|
||||||
|
$footnoteContent.find('.ck-math-tex.ck-math-tex-inline.ck-widget').each(function () {
|
||||||
|
const $katex = $(this).find('.katex').first();
|
||||||
|
if ($katex.length) {
|
||||||
|
$(this).replaceWith($('<span class="math-tex"></span>').append($('<span></span>').append($katex.clone())));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let footnoteContent = $footnoteContent.html();
|
||||||
|
footnoteContent = `<div class="ck-content">${footnoteContent}</div>`
|
||||||
|
return footnoteContent || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1213,6 +1213,10 @@ body:not(.mobile) #launcher-pane.horizontal .dropdown-submenu > .dropdown-menu {
|
|||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::selection {
|
||||||
|
background-color: var(--selection-background-color);
|
||||||
|
}
|
||||||
|
|
||||||
[data-bs-toggle="tooltip"]:not(.button-widget) span {
|
[data-bs-toggle="tooltip"]:not(.button-widget) span {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
border-bottom: 1px dotted;
|
border-bottom: 1px dotted;
|
||||||
@ -1769,7 +1773,7 @@ body.zen .title-row {
|
|||||||
height: unset !important;
|
height: unset !important;
|
||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
padding-left: env(titlebar-area-x);
|
padding-left: env(titlebar-area-x);
|
||||||
padding-right: 2.5em;
|
padding-right: calc(100vw - env(titlebar-area-width, 100vw) + 2.5em);
|
||||||
}
|
}
|
||||||
|
|
||||||
body.zen .floating-buttons {
|
body.zen .floating-buttons {
|
||||||
|
@ -195,6 +195,8 @@
|
|||||||
--scrollbar-background-color: transparent;
|
--scrollbar-background-color: transparent;
|
||||||
--scrollbar-border-color: unset; /* Deprecated */
|
--scrollbar-border-color: unset; /* Deprecated */
|
||||||
|
|
||||||
|
--selection-background-color: #3399FF70;
|
||||||
|
|
||||||
--link-color: lightskyblue;
|
--link-color: lightskyblue;
|
||||||
|
|
||||||
--mermaid-theme: dark;
|
--mermaid-theme: dark;
|
||||||
|
@ -194,6 +194,8 @@
|
|||||||
--scrollbar-background-color: transparent;
|
--scrollbar-background-color: transparent;
|
||||||
--scrollbar-border-color: unset; /* Deprecated */
|
--scrollbar-border-color: unset; /* Deprecated */
|
||||||
|
|
||||||
|
--selection-background-color: #3399FF70;
|
||||||
|
|
||||||
--link-color: blue;
|
--link-color: blue;
|
||||||
|
|
||||||
--mermaid-theme: default;
|
--mermaid-theme: default;
|
||||||
|
@ -131,6 +131,7 @@ body.layout-horizontal > .horizontal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#launcher-pane.vertical #launcher-container {
|
#launcher-pane.vertical #launcher-container {
|
||||||
|
width: var(--launcher-pane-size);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
@ -44,10 +44,9 @@
|
|||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ck .ck-widget.footnote-section .ck-widget__type-around__button_after {
|
.ck .ck-widget.footnote-section > .ck-reset_all.ck-widget__type-around > .ck-widget__type-around__button_after {
|
||||||
display:none; /* hides the 'insert after' button from the ckeditor widget */
|
display: none; /* hides the 'insert after' button from the ckeditor widget, but displays the button inside the footnote content. */
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder {
|
.placeholder {
|
||||||
padding: 2px 2px;
|
padding: 2px 2px;
|
||||||
outline-offset: -2px;
|
outline-offset: -2px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user