From 3178f00248e3b8167db4051b9234e8068f31659e Mon Sep 17 00:00:00 2001 From: shenshen Date: Mon, 22 Jan 2024 23:28:30 +0800 Subject: [PATCH] change manifest --- README.md | 1 + main.ts | 3 +-- manifest.json | 2 +- styles.css | 18 +++++++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2bf2a56..e2e51d0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ https://github.com/imshenshen/obsidian-sticky-heading/assets/19701958/12f8e9c6-f ## config +when use different theme, the space of sticky heading is different, so you need install [Style Settings plugin](obsidian://show-plugin?id=obsidian-style-settings) , allows you to config top space when sticky. ![](https://github.com/imshenshen/obsidian-sticky-heading/assets/19701958/7ffbe469-053c-487a-af50-0b11b3a47e71) diff --git a/main.ts b/main.ts index ecaf04e..217fab1 100644 --- a/main.ts +++ b/main.ts @@ -19,9 +19,8 @@ export default class MyPlugin extends Plugin { // This adds a settings tab so the user can configure various aspects of the plugin // this.addSettingTab(new SampleSettingTab(this.app, this)); - - this.registerEditorExtension([HeadingPlugin()]) this.app.workspace.trigger("parse-style-settings") + this.registerEditorExtension([HeadingPlugin()]) } diff --git a/manifest.json b/manifest.json index 9ef74d4..94d6f9d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "id": "obsidian-sticky-heading", + "id": "sticky-heading", "name": "Sticky Headings", "version": "1.0.0", "minAppVersion": "0.15.0", diff --git a/styles.css b/styles.css index 1fd02e7..0e2e764 100644 --- a/styles.css +++ b/styles.css @@ -11,22 +11,26 @@ If your plugin does not need CSS, delete this file. /* @settings -name: obsidian-sticky-heading -id: obsidian-sticky-heading +name: sticky-heading +id: sticky-heading settings: - - id: obsidian-sticky-heading-top-space + id: sticky-heading-top-space title: top space when sticky description: when sticky, how much space should be left at the top of the screen. like 5px, -1rem, etc. type: variable-text - default: 0px + default: calc(-1 * var(--size-4-8)); */ +body { + --sticky-heading-top-space: calc(-1 * var(--size-4-8)); +} + .obsidian-sticky-heading { position: sticky !important; - top: var(--obsidian-sticky-heading-top-space); - background-color: var(--titlebar-background) ; + top: var(--sticky-heading-top-space); + background-color: var(--titlebar-background); z-index: 1; } @@ -38,5 +42,5 @@ settings: font-weight: normal; color: var(--text-faint); font-size: 14px; - background-color: var(--background-primary) ; + background-color: var(--background-primary); }