Git Product home page Git Product logo

Comments (8)

damiankorcz avatar damiankorcz commented on May 24, 2024

I've tested a few more things and it appears to pass through the entire text but strips out the ; at the start section url("data:image/png;base64 which breaks it.

from obsidian-style-settings.

mgmeyers avatar mgmeyers commented on May 24, 2024

@damiankorcz can you post a sample of your style settings yaml with the data url?

from obsidian-style-settings.

damiankorcz avatar damiankorcz commented on May 24, 2024

@mgmeyers
Putting the base64 in the default: appears to keep the ; in the text field for the setting in the Style Settings tab.

image

However it appears undefined in Dev Tools preventing it from working:

image

I've tried doing default: url() and pasting the data into the text field but that's when it strips out the ; as soon as click on another tab in the settings and then back to Style Settings.

image

This appears to create the variable correctly in this case as shown below but without the ; it won't work:

image

Here is a sample of one of the settings I'm trying to use this for:

Yaml Sample.txt

P.S.
I'm using two separate settings for standard URL and Base64 however the formatting is the same so if I use a standard URL to an image in the setting provided it works just fine.

from obsidian-style-settings.

mgmeyers avatar mgmeyers commented on May 24, 2024

Hmm, what happens if you wrap your default value in single quotes?

Eg:

-     
    id: custom-vault-banner-icon-base64
    title: Vault Banner Icon (Base64)
    description: Customise the Vault Banner Icon. Use the format in the Default below for an Online image. Use the following format to point to a local file - url("app://local/C://Obsidian/Vault Name/Vault Icon.jpg").
    type: variable-text
    default: 'url("data:image/png;...")'

from obsidian-style-settings.

damiankorcz avatar damiankorcz commented on May 24, 2024

The same thing happens as when I don't wrap it with single quotes. It just removes the single quotes and passes it without them in Style Settings.

image
image
image

from obsidian-style-settings.

damiankorcz avatar damiankorcz commented on May 24, 2024

@mgmeyers Just to follow up with a few more things I've found:

I appear to have this issue with a normal URL link as well, however it seems to be an issue with the default: value only.

image
image
image

I also tried wrapping just the URL itself with ' ' and " " to see if that would make a difference but it's the same. I also tried both with the single quotes around the whole string like you suggested previously but I get the same behaviour.

The strangest thing with this is that it grabs the string that is in the default: and even displays it correctly in the Style Settings text box and the small text under the description but it doesn't work, however if I copy the string it's displaying in Style Settings text box and paste it over itself it starts to work.

Also any other URL I manually type in or paste works in this case unlike with the Base64 value.

from obsidian-style-settings.

mgmeyers avatar mgmeyers commented on May 24, 2024

@damiankorcz I just realized I forgot to check: did you define your variable in CSS as well? Style settings will only override variables, not set their initial value, so you'd have to do something like this:

/* @settings

name: testing
id: testing
settings:
  -     
    id: custom-vault-banner-icon-base64
    title: Vault Banner Icon (Base64)
    description: Customise the Vault Banner Icon. Use the format in the Default below for an Online image. Use the following format to point to a local file - url("app://local/C://Obsidian/Vault Name/Vault Icon.jpg").
    type: variable-text
    default: url("data:image/png;base64,....")

*/

:root {
  --custom-vault-banner-icon-base64: url("data:image/png;base64,....");
}

from obsidian-style-settings.

damiankorcz avatar damiankorcz commented on May 24, 2024

@mgmeyers Well that's embarrassing on my part๐Ÿ˜…. I wasn't sure if I needed to have default variables defined in the CSS as well as the YAML so that is my bad.

Right so that fixed the default. It now works correctly but trying to change it in the Style Settings still strips the ; from the Base64 text. Reverting back to default when I try to change it to something else also works now.

So should I have default variables set in the :root for all variables I use in Style Settings as well as in the default: of each property in the YAML?

The only thing I noticed is that sometimes I'll test and change a bunch of options in Style Settings and when I click the Reset all settings to default button at the root of the theme settings it doesn't quite change everything back. If I then refresh through Dev Tools or restart Obsidian it's all back to default as expected. Would defining them in the :root be the solution as well?

Thank you for sticking with me to solve this btw. I appreciate it!

from obsidian-style-settings.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.