@Mat:
>
>>> - If there is no match, we cancel any already shown popups.
>>>
>>> failed attempt - I made a "deletePopState" macro but calling it gives
> RSOE Uncaught TypeError: Cannot read property 'left' of undefined
> (to locate the call: it's in editorMagicActions in the inner ListWidgets
> emptyMessage )
>
>
This is probably because you are inside a list widget, so for every type of
autocomplete defintion (eg widget, macro, etc) that doesn't match, you end
up deleting the state tiddler even if there was a match in another type of
autocomplete defintion.
For example:
- no match for <$ -> delete state tiddler
- match for << -> create state tiddler and popup
- no match for [[ -> delete state tiddler
The logic needs to be:
- loop through all autocomplete definitions
- if any of them match -> trigger popup
- if none of them match -> delete state tiddler
I think we could avoid having to resort to JS here, through everyones
favourite technique: recursive macros.
If you want to take a crack go ahead, otherwise I think its ok to leave it
alone for now and I'll look into it when I have more time.
By the way, how do we determine priority? I mean if we have an incomplete
[[ and <$ how is it determined which is being completed? Should be the one
closest to the caret, not sure if that is how it is already and if so, how
that is ensured.
Overall I think it's definitely headed in the correct direction and you've
done a good job with the refactoring.
I note that we have multiple <<qualify $:/state/EditorMagicPopupState>> in
the body/editor tiddler. One single vars/set widget around the edit widget,
assigning this to something like *em-state* would make it available in the
popup and in our actions.
Agreed on variable names needing work, same for field names set by
action-caretpopup (I've added a note that I need to do this for the JS
bits). Recommend prefixing all fields and variables you set with em- and
otherwise making names a bit more self explanatory.
All of the code does need a proper pass through for consistency before any
kind of public sharing. That should come after it is relatively stable
functionality wise though.
For instance, the action-withselection widget I modified from streams to
facilitate this re-factoring, can and should be made consistent with what
is used in Streams so that there are less maintenance issues going
forwards. Depending on the final shape this takes, there may also be room
to simplify some of the code by means of some core PRs.
>
>>> - When the popup is shown, it reads info from the state tiddler to
>>> determine what content to show. All the wikitext related to WHAT to show
>>> stays here.
>>>
>>> It is almost like the popup is just a template now that shows
information based on what is in the state tiddler, by transcluding other
tiddlers. A very TW approach in my opinion.
I wonder if would be helpful to set
currentTiddler={{{[<q-state>get[template]]}}} at the beginning of the
popup, allowing you to access trigger as {{!!trigger}} etc. This is more a
question of coding style and preference though.
>
>> git saver
>
>
> Edit: Enough to say, I don't succeed with it.
>
I took a quick look and did get it working. With proper instructions it is
actually not difficult and can all be setup via the github web interface. I
will write up instructions when I have time. It makes usage as easy as
tiddlyspot, but with the benefit of being able to see a diff of what has
changed, which is a great help for collaboration.
Eg: this is for a TW file saved with the git saver:
https://github.com/saqimtiaz/sq-tw/commit/6d6c3e18cb48be6f8f2ce1ea92202ed068aac068
The actual file is here: https://saqimtiaz.github.io/sq-tw/sandbox.html
I can use as normal and it saves back to github.
Note that the patch which adds inputActions to the edit widget has been
merged as is now part of the latest pre-release.
Cheers,
Saq
--
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/34d03f99-2fd2-4775-8ac1-6eff22b06b5fo%40googlegroups.com.