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

Once tablature mode is entered in a note, it can't be exited #32

Open
miesvanderrobot opened this issue Jul 31, 2023 · 5 comments
Open

Comments

@miesvanderrobot
Copy link

Loving the tablature support, especially since it supports capos and alternate tunings, which means I can actually support my tenor guitar!

Ran into an issue, though. Once tablature occurs within a note, it ends up applying the same tablature properties to all subsequent non-tablature music-abc blocks in the same note. Here's an example:

X:1
T:The Legacy Jig (just fine)
M:6/8
L:1/8
R:jig
K:G
GFG BAB | gfg gab | GFG BAB | d2A AFD |
GFG BAB | gfg gab | age edB |1 dBA AFD :|2 dBA ABd |:
efe edB | dBA ABd | efe edB | gdB ABd |
efe edB | d2d def | gfe edB |1 dBA ABd :|2 dBA AFD |]
{
  "tablature": [{
    "instrument": "mandolin", 
    "label": "Tenor Guitar (%T)", 
    "tuning": ["C,", "G,", "D", "A"],
    "highestNote": "e'",
    "capo": "2"
  }]
}
---
X:1
T: Cooley's
M: 4/4
L: 1/8
R: reel
K: G
|:D2|EB{c}BA B2 EB|~B2 AB dBAG|FDAD BDAD|FDAD dAFD|
X:1
T:The Legacy Jig (now in tablature)
M:6/8
L:1/8
R:jig
K:G
GFG BAB | gfg gab | GFG BAB | d2A AFD |
GFG BAB | gfg gab | age edB |1 dBA AFD :|2 dBA ABd |:
efe edB | dBA ABd | efe edB | gdB ABd |
efe edB | d2d def | gfe edB |1 dBA ABd :|2 dBA AFD |]
@controlledaccident
Copy link

Tabs seem to be applied to all other notes as well, until Obsidian restart

@alensiljak
Copy link
Collaborator

Do you mean it applies to all abc code blocks only?

@controlledaccident
Copy link

controlledaccident commented Aug 8, 2023

All abc blocks, in all notes in the vault, if a note with tab code is open/opened.

@miesvanderrobot
Copy link
Author

This one looks correct in HTML. I'm guessing that somehow in your implementation (or the specific implementation you've chosen to consume, as I'm not using a node module here), a variable containing the tablature details isn't getting reinitialized when it should.

<html>
<head>
    <style>
        
    </style>
    <script src="/scripts/snippet-javascript-console.min.js?v=1"></script>
</head>
<body>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/abcjs/6.2.2/abcjs-basic-min.js" integrity="sha512-KXKtG2UKjAKEEwwKKNioYwVHGm/gH0ZmME+ePGFwbjs4Banx6+xJVtDpC2A2QM9nGtamOP4tqEYfxloLjq3XcA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<div id="music">
X:1
T:The Legacy Jig (just fine)
M:6/8
L:1/8
R:jig
K:G
GFG BAB | gfg gab | GFG BAB | d2A AFD |
GFG BAB | gfg gab | age edB |1 dBA AFD :|2 dBA ABd |:
efe edB | dBA ABd | efe edB | gdB ABd |
efe edB | d2d def | gfe edB |1 dBA ABd :|2 dBA AFD |]
</div>
    <script type="text/javascript">
        ABCJS.renderAbc("music", $("#music").text());
    </script>
<div id="music2">
X:1
T: Cooley's
M: 4/4
L: 1/8
R: reel
K: G
|:D2|EB{c}BA B2 EB|~B2 AB dBAG|FDAD BDAD|FDAD dAFD|
</div>
    <script type="text/javascript">
        ABCJS.renderAbc("music2", $("#music2").text(), {
        "tablature": [{
        "instrument": "mandolin", 
        "label": "Tenor Guitar (%T)", 
        "tuning": ["C,", "G,", "D", "A"],
        "highestNote": "e"
    }]
});
</script>
<div id="music3">
X:1
T:The Legacy Jig (now in tablature)
M:6/8
L:1/8
R:jig
K:G
GFG BAB | gfg gab | GFG BAB | d2A AFD |
GFG BAB | gfg gab | age edB |1 dBA AFD :|2 dBA ABd |:
efe edB | dBA ABd | efe edB | gdB ABd |
efe edB | d2d def | gfe edB |1 dBA ABd :|2 dBA AFD |]
</div>
<script type="text/javascript">
    ABCJS.renderAbc("music3", $("#music3").text());
</script>      
</body>
</html>```

@alensiljak
Copy link
Collaborator

Looking at https://github.com/abcjs-music/obsidian-plugin-abcjs/blob/main/playback_element.ts, I see nothing obvious that could be adjusted.
Based on the issue description I'd assume that the plugin settings (i.e. tablatures) apply to all the instances. If that is true, it is not obviously clear what the solution would be. Checking the Obsidian docs for any hints on the available options would be my first step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants