The approach I would try is: - extend the edit-text widget engines with a keydown event listener which saves the caret position in a state tiddler specific for that field and tiddler.
- have a reveal widget that gets triggered as a popup, depending on the text in the textarea, using the caret position. - if the reveal widget is added to the edit template, it will automatically be in the correct context to access variables like currentTiddler and storyTiddler - Extending the framed engine with an event listener also gives us access to the iframe and makes it easier to calculate the correct position. Snowgoon's plugin takes this approach. - the core is being patched with code to dismiss popups when clicking in another input field. So using reveal/popup mechanism means that will be helpful as well. PS: I like the "proof of concept" label in the Site Title, nicely implemented. On Monday, July 6, 2020 at 12:30:15 PM UTC+2, Jed Carty wrote: > > It is probably possible to pass the name of the current tiddler when the > tiddler is in edit mode and has focus by using css selectors or by walking > up the dom tree until you reach a div that has the data-tiddler-title > attribute. > > This should also be possible in text areas outside of edit mode as long as > they are inside a tiddler, I don't know if it would work in places like the > sidebar. > > The third item in your list (the popup staying open) is a problem with > when the values update. At the moment it is only on keyup. That should > probably be changed to keydown. Making it also update on focus and blur > events would probably help. > > The last item, being incompatible with the editor toolbar, is because when > the toolbar is active the editor is put in an iframe. There are limits to > the information that can be passed in and out of an iframe. We can almost > certainly work around this but I didn't work on it. > -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/ca51e9c8-da1e-44ca-a636-38dd2b9794f9o%40googlegroups.com.
