Further Optimization of {Selection}
The newly added {selection} feature is very useful—much appreciated! However, there are still some minor issues in its current implementation:
Cross-entry selection is not possible.
For example, in the screenshot below, if I select the definition from the previous entry and then try to add the pronunciation from the next entry, the actual {selection} value turns out to be empty.
Would it be possible to modify this behavior?
Limited flexibility in {selection} usage.
Could {selection} support expressions like {selection} | {clipboard}? This way, if {selection} has a value, it will be used; otherwise, {clipboard} will be used instead.
It is possible to have cross entry selection, but in terms of software architecture it isn't very elegant. I'll look into it.
For using {selection} and falling back to {clipboard}, I don't think Memento needs to implement this. You can achieve this using some HTML and CSS in your cards. Here's an article about hiding empty elements using CSS. I imagine one element contains {selection} and another has {clipboard} and using some CSS, the {clipboard} element is shown conditionally if {selection} is empty. Here's a codepen that implements conditionally hiding elements based on whether or not a condition in another element is met.
Thank you very much for providing the fallback idea!
There is one issue, though—{clipboard} is only needed when {selection} is empty. If we implement this using CSS, every card will still include {clipboard}, even when it's not relevant. Since {clipboard} almost always has content, it will exist in the card data even if it's not visible on the card.
I just wanted to mention this. Having {selection} already makes things very useful. Thanks again!
it will exist in the card data even if it's not visible on the card.
I can understand why this might be annoying. I can look into how difficult it would be to have a general conditional marker syntax where {selection | clipboard} would try to use {selection} first and if it's empty move onto {clipboard}. I can see this being useful in other cases, for example something like {sentence-2 | context-2}. Though I worry about making the marker syntax too complex since I have to find a place to explain all this stuff to people.
Though I worry about making the marker syntax too complex since I have to find a place to explain all this stuff to people
Sentence mining is already a complex process—anyone who’s into it won’t be scared off by a little extra challenge. Plus, it’s just an optional feature—if someone finds it too much hassle, they can simply ignore it!
I agree, selection is an amazing addition, thank you!!
Being able to select multiple, separate lines (perhaps with CTRL, like in text editors for example) would also be really useful :D
I've implemented the conditional marker syntax as described previously. I've left it undocumented for now since it seems to be fairly niche.