Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Self not working after templater conversion #404

Open
4 of 8 tasks
SandmansDreams opened this issue Aug 20, 2024 · 4 comments
Open
4 of 8 tasks

Replace Self not working after templater conversion #404

SandmansDreams opened this issue Aug 20, 2024 · 4 comments
Labels
bug Undesired behavior caused by this plugin

Comments

@SandmansDreams
Copy link

Please fill out these Check-boxes

  • I checked for existing similar issues
  • I checked that the plugin is up to date
  • The issue persist with all other plugins and themes disabled

Plugin Version

1.1.3

This Issue Occurs on

  • Windows
  • Linux
  • macOS
  • Android
  • iOS

Debug Info

SYSTEM INFO:
	Obsidian version: v1.6.7
	Installer version: v1.4.16
	Operating system: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 23.6.0
	Login status: logged in
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Base theme: dark
	Community theme: Spectrum Blue v1.0.0
	Snippets enabled: 4
	Restricted mode: off
	Plugins installed: 43
	Plugins enabled: 2
		1: Meta Bind v1.1.3
		2: Templater v2.4.1

RECOMMENDATIONS:
	Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Describe the Issue

When using a multi-action button and having the replaceself function, it only works (gets rid of the button) if the command function is run after the replaceself function. In this case it is a command for templater to replace the active templates in the file. Seems to work fine with other commands including other templater commands.

Steps to Reproduce

Run this button:

label: Templater Converter
icon: replace
hidden: false
class: ""
tooltip: Converts the template into a usable file.
id: TemplateConvert
style: destructive
actions:
  - type: replaceInNote
    fromLine: 3
    toLine: 3
    replacement: "tags:: #"
  - type: replaceInNote
    fromLine: 4
    toLine: 4
    replacement: "parent:: "
  - type: command
    command: templater-obsidian:replace-in-file-templater
  - type: replaceSelf
    replacement: ""

This button works (flipped the locations of the replaceself and templater converter):

label: Templater Converter
icon: replace
hidden: false
class: ""
tooltip: Converts the template into a usable file.
id: TemplateConvert
style: destructive
actions:
  - type: replaceInNote
    fromLine: 3
    toLine: 3
    replacement: "tags:: #"
  - type: replaceInNote
    fromLine: 4
    toLine: 4
    replacement: "parent:: "
  - type: replaceSelf
    replacement: ""
  - type: command
    command: templater-obsidian:replace-in-file-templater

Expected Behavior

The second button functions as expected. The first button does everything except the replaceself command.

@SandmansDreams SandmansDreams added the bug Undesired behavior caused by this plugin label Aug 20, 2024
@mProjectsCode
Copy link
Owner

I haven't looked at this closely, but my first guess is that Obsidians metadata cache (where I am pulling the line positions from) has not updated yet, so the line positions are wrong.

@SandmansDreams
Copy link
Author

I haven't looked at this closely, but my first guess is that Obsidians metadata cache (where I am pulling the line positions from) has not updated yet, so the line positions are wrong.

Hmm that could make sense. It does not appear to remove any other lines, just seems to not happen. But could still be the case.

@mProjectsCode
Copy link
Owner

Does any error appear in the console?

@SandmansDreams
Copy link
Author

Does any error appear in the console?

As far as I can tell, no. There were several errors before I cleared it and then ran the button. However, none of these errors seem to pertain to the button.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behavior caused by this plugin
Projects
None yet
Development

No branches or pull requests

2 participants