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.
<$tiddler tiddler={{$:/HistoryList!!current-tiddler}} >
{{||$:/core/ui/Buttons/edit}}
<$button to=<<currentTiddler>> tooltip="Jump to focused Tiddler" actions=focus-tiddler-actions class="tc-btn-invisible tc-tiddlylink">
<small><$text text={{$:/HistoryList!!current-tiddler}}/></small>
</$button>
</$tiddler>Lastly, be aware that the history list isn't always updated when a tiddler is opened. An example is direct manipulation of the storylist via action-setfield or action-listops widgets.
Not wishing to be too off topic.
Perhaps focus is not the name but I have made a solution from this idea, that works well. I would love any suggestions what to call it. Last navigated to tiddler is a mouthful.
As in my first reply;
The last opened, linked to or edited tiddler (draft of),
In addition I have an icon on any tiddler indicating if it has "focus" and if not to make it so.
I also have a list of history tiddlers in a side bar that only shows drafts if in edit, and my recently visited tiddlers ie history as well as edit and open in new window buttons.
From a designer perspective this is a very efficient way to work on a large number of tiddlers.
Without too much detail it is superior to other ways of juggling a lot of tiddlers.
Back to the OT it would be nice if jumping from one edit tiddler to another the cursor position was retained and restored especially when you go elsewhere to obtain content to insert. Is this restoring the carpet position and could it be saved in the history entries.
Regards
Tony
https://saqimtiaz.github.io/sq-tw/editormagic-poc.html
You get full access to variables like currentTiddler; there are improvements that let you know exactly where the text caret is, so you can ignore text before or after, and I tweaked your popup code so that it doesn't give multiple results if there are multiple unclosed link brackets .... amongst other things.
[...] if you have unfinished links that can cause some issues, and it will only in textareas/inputs where it has been setup to work.
Still lots more room for improvement, like only showing a popup if the triggers are found, rather than showing an empty popup (not visible) if there are no trigger matches.
Still lots more room for improvement, like only showing a popup if the triggers are found, rather than showing an empty popup (not visible) if there are no trigger matches.
If you want to work with this, I can clean it up. Then you can go crazy with wikitext in EditorMagic/_Popup
- the ability for edit-text widget to fire actions on input, taken from this PR (https://github.com/Jermolene/TiddlyWiki5/pull/4725) No reason to hesitate to use this. The actions part of it can even be made a separate PR to get it merged sooner, or be packaged as a tiny plugin until it is merged.
- action-popupcaret widget [...] Reveal Widget.
- [...] also sets a field in the state tiddler for the popup, telling us the position of the caret. This is the position in characters from the start of the text. We can access this in the popup.
In conclusion:While there may be [...]
Can I ask, is @Jeds construct of use? It obviously has been very useful for my demos, and I also recall Snowgoon bringing up some strenghts with it that his solution didn't have. Or maybe your approach covers things fully anyway?
The use of caret position by character count does seem advantageous especially for the subsequent text manipulation. BTW, I'm assuming your "floating editor toolbar" also keeps track of start-stop position of the selected text.
- the ability for edit-text widget to fire actions on input, taken from this PR (https://github.com/Jermolene/TiddlyWiki5/pull/4725) No reason to hesitate to use this. The actions part of it can even be made a separate PR to get it merged sooner, or be packaged as a tiny plugin until it is merged.
It does sound sensible with a separate primitive to fire actions from it. Would that be an actions attribute, as exists in a few other widgets?
- [...] also sets a field in the state tiddler for the popup, telling us the position of the caret. This is the position in characters from the start of the text. We can access this in the popup.
:-D Is this number updated by each key stroke as you type? Just curious.
<$set name="selectionEnd" filter="[<editorMagicState>get[selection-end]]" select="0"> {{||EditorMagic/_Popup}}</$set>I haven't thought about adding keyboard navigation support yet,
Secondly: If we move the reveal for the popup in $:/core/ui/EditTemplate/body/editor, inside of the closing </$edit> tag, it would allow editor toolbar commands to work when included in the popup. Nice bonus.
Furthermore, it would mean that any commands you add in the popup can also make use of https://tiddlywiki.com/#WidgetMessage%3A%20tm-edit-text-operation
We could also extend tm-edit-text to support "replace at caret position" to make the insertion of completed strings easier.
@Mat: https://saqimtiaz.github.io/sq-tw/editormagic-popup.html
Secondly: If we move the reveal for the popup in $:/core/ui/EditTemplate/body/editor, inside of the closing </$edit> tag, it would allow editor toolbar commands to work when included in the popup. Nice bonus.</$edit ToHere?> huh? Is that some super trick or is it an established practice?
We could also extend tm-edit-text to support "replace at caret position" to make the insertion of completed strings easier.Yes, very reasonable. I take it that the already existing "replace-selection" thus requires a selection of length>0.
@Mat: https://saqimtiaz.github.io/sq-tw/editormagic-popup.htmlYou've done a fantastic job... in fact, so much so that I'm a bit at loss of what to do next so I'd better ask before going in the wrong direction: Does it already now make sense that I modify the EditorMagic/_Popup to split out the specific title picking functionality to make the EditorMagic/_Popup tiddler general and to make the other popup content functionality tiddlers?
between <$edit> and </$edit>
<$edit-text> widget is ignored." but maybe this refers to something else. My suggestion is to first test this demo robustly.
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/hOlWpnejqvI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/bb996f37-932c-4bef-831c-1413f1ba6415o%40googlegroups.com.
I also recommend to look through the wikitext changes in the popup Tiddler, so you understand what changes were made and why.
On Thu, 9 Jul 2020, 19:13 Mat, <matia...@gmail.com> wrote:
--between <$edit> and </$edit>Aha, thanks. The docs explicitly states "The content of the<$edit-text>widget is ignored." but maybe this refers to something else.My suggestion is to first test this demo robustly.Gotcha. I'll pass it through hell.<:-)
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/hOlWpnejqvI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddly...@googlegroups.com.
- Pop up position: Creating a new row seems to take presedence and steer where the popups shows. I get this bug(?) to most consistently show if the text starts out with empty rows, then the popup shows in that area rather than where the title is completed.
- I can't find it in this thread now but I think you mentioned that: The popup doesn't follow the caret if it is moved using the keyboard arrows and then typing.
- If the text already has the closing brackets, e.g [[bar]] and you stand just to the right of the "r" and pick e.g title "barbaz", then you get [[barbaz]]]] - i.e if there's a closing "]]" they should probably be removed at injection.
- Possibly not relevant at this moment: After the injection, it is desirable that focus - i.e the caret - is returned to where the text was just inserted. Currently one has to click to insert caret.
...except for if there's a tiddler titled literally:A [[Tiddler...and I try to complete by typing this[[A [[Tid- this gives no popup. My spontaneous feeling is that TWs native warnings against using brackets in titles should be enough to prevent this ...
I think we can disregard this fringe case. And presumably the following ones because the following does work:[[A [[Tid [[Edito
So, based on your other feedback on my findings, which I also agree with, I think I'm about ready to actually split out the title functionality and try to make the popup general. I'm starting with this now :-D
<$list filter="""[all[tiddlers]prefix<fragment>]""" variable=name>
<$button class="tc-btn-invisible tc-tiddlylink">
<$text text=<<name>>/>
<$action-sendmessage
$message="tm-edit-text-operation"
$param="insert-completion"
text={{{[<name>addsuffix<trigger-end>]}}}
precursor=<<fragment>>
/>
</$button>
<br>
</$list>
[...] as well as place caret at the correct place.
If you type '[[Ed' you will get a popup. If you click the title it will show [[EditorMagic/_Popup]].
trigger-end: /> </$widget>triggendexp={{{ [enlist{!!trigger-end}escaperegexp[]join[|]addprefix[(]addsuffix[)+]split[\/]join[/]trim[]] }}}Type e.g [[Ed to get the popup.Now type either of:- a blank space and several other words- or hit the Enter key a few times to get new rowsThis hides the popup.Now, where you're standing, type [[EThis shows the popup in the old place
Right. This is actually the same bug as the one we discussed before [...]
Regarding different trigger-end options: I have to admit I am not familiar with your code beyond what was in the simplified demo at the beginning of this thread. I think your approach should be OK though I am not clear on workflow, do users get to choose which ending to use? Anyway, best way to figure it out is to try it.
Personally I think autocompletion makes sense for some things, like links. For others, like widgets, just detecting which widget the user is trying to type and showing the relevant docs in the popup might be a better approach.
I could also imagine a popup triggered by a specific character, say "|" that lets you choose to insert a transclusion, link or image etc.... though this might be more on my mind because of the work on the floating editor toolbar and the non-selection related buttons.
But I'm curious: even for pre-made popup tools, the system will still have to know if <$widget foo> is closed or not. So how is the fragment end detected? In the EditorMagic/_Popup it is defined to be the "whole string" after the trigger until a trigger-end... but it seems your code defines the fragment as after trigger until caret. Is that correct? ...in which case I should remove the trigger-end check... but then, "until caret" can mean the rest of the whole tiddler text...?
BTW, is there something more that can be done to align EditorMagic with your floating editor toolbar?
One problem is for EditorMagi/WidgetDocs - wich uses a selectwidget - and for EditorMagic/TransINclude - which shows an editor - the popup loses focus as soon as the selectwidget or editor is touched. Any ideas for this?
<$list filter="""[<text>search<trigger>removeprefix<before>]
+[!prefix[ ]splitregexp<triggexp>]
+[!search::regexp<triggendexp>]
+[last[]]""">
<$set name=fragment filter="""[<currentTiddler>]""" select="0">
<$list filter="[<fragment>minlength[1]]">
<$list filter="[all[tiddlers]prefix<fragment>count[]!match[0]]" variable="_NULL">
<div style="background:white; border:1px solid silver; padding:0 5px;">[...] I have my fingers in too many pies already and releasing plugins comes with a maintenance commitment.
The intention behind the demos I share is to hopefully inspire/provide ideas and techniques for others to follow.
[...] the popup loses focus as soon as the selectwidget or editor is touched. Any ideas for this?[...] give it the class tc-popup-keep.
Note that the ??tr present at the beginning of the tiddler adds a transclusion portion to every other popup created. This seems to not be an issue with an incomplete link or widget, but with ??tr so perhaps its limited to those with no end-trigger?
[your image with the artefact]
Looks like you missed some bits when integrating my code from https://saqimtiaz.github.io/sq-tw/editormagic-popup.html#EditorMagic%2F_Popup<$list filter="""[<text>search<trigger>removeprefix<before>]
+[!prefix[ ]splitregexp<triggexp>]
+[!search::regexp<triggendexp>]
+[last[]]""">
<$set name=fragment filter="""[<currentTiddler>]""" select="0">
<$list filter="[<fragment>minlength[1]]">
<$list filter="[all[tiddlers]prefix<fragment>count[]!match[0]]" variable="_NULL">
<div style="background:white; border:1px solid silver; padding:0 5px;">
There are some changes I think we need to make next, to the order of the wikitext code that controls triggering the popup. However, I will wait for you to work out the issues discussed in this post and properly integrate my previous changes before I get into that.
Can we find a way to make it:
<$text text=<<name>> /> <span>X</span>
where X represents the position in the list, i.e. 1, 2, 3....
Can we find a way to make it:
<$text text=<<name>> /> <span>X</span>
where X represents the position in the list, i.e. 1, 2, 3....If it is only a matter of visuals, I can do with with CSS. I suspect you want something more with it - ?
<$vars count={{{ myfilter +[count[]] }}}>
<$list filter="[range<count>]" variable=n>
<$list filter="myfilter +[nth<n>]">
<<n>> <<currentTiddler>><br>
</$list>
</$list>
</$vars>
This adds an index:
<$list filter="[<fragment>minlength[1]]">
<$list filter="[all[tiddlers]prefix<fragment>count[]!match[0]]" variable="_NULL">
<$list filter="""[all[tiddlers]prefix<fragment>]""" variable=name>
<$button class="tc-btn-invisible tc-tiddlylink">
<$text text=<<name>>/>
<$action-sendmessage
$message="tm-edit-text-operation"
$param="insert-completion"
text={{{[<name>addsuffix<trigger-end>]}}}
precursor=<<fragment>>
/>
<span data-tw-keyboard-shortcut="Alt+n"></span>
</$button>
<br>
</$list>
</$list>
</$list> But since it would be better to add proper support for keys like arrow keys for up and down, enter key etc, don't spend too much time on this.
Given that it's all wikitext changes, are you requesting that I implement it? I can probably do that given enough time but I'm sure there will be several missteps along the way.
Regarding the keyboard numbers your write:But since it would be better to add proper support for keys like arrow keys for up and down, enter key etc, don't spend too much time on this.I do think there should eventually be "regular" arrow key support so, at least for now, I'll put these numbers only in the title picker to try it out. Needing to locate, say, 7 on the keyboard doesn't quite feel like a work saver instead of arrowing through.
Perhaps locating 77 on keyboard is easier but then I think it would make more sense with some key that makes the arrow jump 10 steps at a time instead.
I can help but I wont have much time until the weekend at the earliest to do any real coding on this. If you do decide to work on this yourself, questions I can try to answer more promptly.
Also note that I have no real knowledge of the internals of your wikitext code beyond the title picker, so there would be a learning curve there for me as well. So I would need a chunk of uninterrupted and focused time to get started.
It was only meant as an idea for stop-gap kb shortcuts until proper ones for arrow keys can be implemented, not an alternative.
I would think that any list of results (at least for tiddler titles) should be capped to say the first 10 or so, and the user expected to type more to narrow down choices. '
1) How much stuff can actually be put in editorMagicActions() without overloading the poor inputActions parameter? A simpler filter surrounding the $action-popupcaret call did work.
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/hOlWpnejqvI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/5456aa56-a9f4-472d-9a00-f528f7269045o%40googlegroups.com.
Give this a go and see if it works:
I wonder if it would make things easier if you used a TW file hosted on github with the git saver, so I could easily see what had changed in each file. I haven't used the git saver but it should in theory be as easy as using tiddlyspot.
IF these changes are also supposed to deal with the move-with-arrow-keys issue, then that aspect does not seem to work fully yet. But, yes, it does show the popup and I'll continue with the wikitext.
Instead I propose we refactor our code for the following flow (note this is all wikitext changes we are discussing here):
- User types in edit widget
- for every keystroke edit widget invokes actions
- in these actions in $:/core/ui/EditTemplate/body/editor we have our wikitext code from EditorMagic/_Popup which checks IF there is a trigger-start that should prompt the showing of a popup.
- Only if there is a match, do we invoke action-popup-caret.
- We can also save extra information to the state tiddler, like what text triggered the match, what kind of popup to show (link, widget etc)
- If there is no match, we cancel any already shown popups.
- 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.
(My first tests indicate I must keep the trigger controls etc in _Popup anyway, making for such checks both there and around the $action-popupcaret.)
I wonder if it would make things easier if you used a TW file hosted on github with the git saver, so I could easily see what had changed in each file. I haven't used the git saver but it should in theory be as easy as using tiddlyspot.I have not used it either. I'll do a quick investigation but given my failing adventures with gh at large, I kind of doubt it will be as simple to use as tiddlyspot.
- User types in edit widget
- for every keystroke edit widget invokes actions
- in these actions in $:/core/ui/EditTemplate/body/editor we have our wikitext code from EditorMagic/_Popup which checks IF there is a trigger-start that should prompt the showing of a popup.
- Only if there is a match, do we invoke action-popup-caret.
- We can also save extra information to the state tiddler, like what text triggered the match, what kind of popup to show (link, widget etc)
- If there is no match, we cancel any already shown popups.
- 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.
Either you need to extend trigger definitions with a "type", eg widget, links etc. Or, be able to use the <<trigger>> (<< or <$ etc) for the purpose of knowing what display logic to use.
git saver
- If there is no match, we cancel any already shown popups.
I'm not sure how to handle this, see previous comment.
OK, updated http://editormagic2.tiddlyspot.com/I think I've now managed to separate concerns between the /body/editor and /_Popup. It is worth noting that what exact data, and which exact values that should be stored in the state tiddler or which variables that should be defined in /_Popup can depend on what the end popup content tools need. Currently, the only defined variables in _Popup are "tid" and "text" (not ideal variable names btw).
- If there is no match, we cancel any already shown popups.
I'm not sure how to handle this, see previous comment.Things are getting really to look pretty darn cool!!!<:-)
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/hOlWpnejqvI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/06b0d97b-35bd-416c-bae9-b660948e4ffdo%40googlegroups.com.
Thanx, it was indeed misplaced outside of the button. It now works but no trigger-end is appended. I'm leaving it for your to look at.<:-)
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/hOlWpnejqvI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/7e613690-764c-423f-abda-ea7d2c4dfd80o%40googlegroups.com.
Have you made trigger-end available as a variable in the popup?
- 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 )
- 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.
git saverEdit: Enough to say, I don't succeed with it.
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.
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
\define deletePopState()<$list filter="[<em-state>get[template]!match<template>]"><$action-deletetiddler $tiddler=<<em-state>>/></$list>
\endBy 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.
- 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
I took a quick look and did get it working.
Note that the patch which adds inputActions to the edit widget has been merged as is now part of the latest pre-release.
I.e only delete if what is currently investigated does not match the template in use. Problem is, there is no "template in use" until one has been set. But if we could set a faux template value in em-state to begin then nothing will match this, until the template in use is set, upon which no subsequent investigation will match that either. I think it could work... but it would also mean there'd be a state tiddler with the faux, then real value, hanging around, perhaps until deleted when tiddler closed. Not a good solution but I'm mentioning it in case it gives you ideas.
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.That sounds like my original problem in trying to decide where a string ended and which was seemingly magically solved once you stepped in. But... yeah, isn't it automatically the one closest to the left of the last key stroke?
Overall I think it's definitely headed in the correct direction and you've done a good job with the refactoring.That's encouraging to hear. Your instructions are, obviously, indispensible.
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.Yes. Interestingly, the popup content tiddlers are also basically templates. As I've mentioned, one hope is for users to be able to create these "end templates" themselves, since we probably can't predict what they'll want access to, so I'm wondering what can be moved upstream into the popup. They're a bit too complex now, I feel, but I'm not sure what is general enough to move.
git saverI took a quick look and did get it working.I can tell you didn't see my reply before I re-edited my post ;-) As for seeing diffs, isn't there a plugin with this feature? Maybe it's only for TW on node.
But if there was some kind of git saver that made it possible to use a TW as a proper multi user wiki, that would make it very worthwhile for me to grab the bull by the horns and study this properly. (As I indicated in my deleted text; I have tried, quite a lot actually). Do you think that would be possible - i.e a published wiki on gh that many people can edit... including some checkin/out or versioning...?
I'll try to find time to investigate this weekend.
Part of my goal here is to make sure you are comfortable with the wikitext portion of the code, so that if this does get into shape for release you are able to maintain it and provide support.
the popup content tiddlers. When I find the time I'll have a look to see what can be done in terms of simplifying them.
github
I will write up instructions for using the web interface when I get the chance, and I'll encourage you to give it a go at that time.
\define processNextMagicActionsTiddler() <$list filter="""[all[tiddlers]tag[$:/tags/EditorMagic]!has[draft.of]after<currentTiddler>]""" emptyMessage=<<deletePopState>>> <<processMagicActionsTiddler>> </$list>\end
\define processMagicActionsTiddler() <$vars template={{!!title}} trigger={{!!trigger}} trigger-end={{!!trigger-end}} triggexp={{{ [{!!trigger}escaperegexp[]] }}} triggendexp={{{ [enlist{!!trigger-end}escaperegexp[]join[|]addprefix[(]addsuffix[)+]split[\/]join[/]trim[]] }}} before={{{ [<text>splitbefore{!!trigger}] }}} magic-actions-tiddler=<<currentTiddler>>><$list filter="""[<text>search<trigger>removeprefix<before>] +[!prefix[ ]splitregexp<triggexp>] +[!search::regexp<triggendexp>] +[last[]]""" emptyMessage=<<processNextMagicActionsTiddler>>> <<popupcaret>> <!-- <<processNextMagicActionsTiddler>>--></$list></$vars>\end
\define editorMagicActions()<$vars text={{{ [{!!text}split[]first<selectionEnd>join[]] }}} ><$list filter="""[all[tiddlers]tag[$:/tags/EditorMagic]!has[draft.of]first[]]"""> <$vars matched="false"> <<processMagicActionsTiddler>> </$vars></$list></$vars>\end<$ac [[ <<@Mat do not test the code I posted yesterday, I did some more tinkering late last night. Just need to find time to look through it carefully and test.
Also, if you look at the Browser Developer tools console (ctrl+shift+I on chrome), there is some additonal debugging going on.
+1 to what you did with the test tiddler, I always do that sort of thing to help debug actions.
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.
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/hOlWpnejqvI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/9bc60b1a-0348-4771-814c-cda88e63041do%40googlegroups.com.
Mat: I've renamed the macros to facilitate comprehension. Beyond that I will wait for you to verify that the behaviour is correct before cleaning up the code further.
Note that I've tried to address both the issue with deleting the popup state when there are no matches, as well as making sure it is the last match (closest to the caret) that triggers the popup, rather than it being based on tag order as it was before.
The only changes while our messages crossed where renaming macros and removing unused variables
Also, if you look at the Browser Developer tools console (ctrl+shift+I on chrome), there is some additonal debugging going on.If I interpret it correctly, that's why the iframe for WidgetDocs doesn't work.
Mixed Content: The page at 'https://saqimtiaz.github.io/sq-tw/em3.html' was loaded over HTTPS, but requested an insecure frame 'http://tiddlywiki.com/static/ActionCreateTiddlerWidget.html'. This request has been blocked; the content must be served over HTTPS.I'm guessing the above does not have anything to do with the fact that typing <$ now only shows one popup content, as opposed to two contents previously i.e both WidgetDocs and the WidgetPicker that use the same trigger. I.e can a trigger now only trigger a single content in the popup? (namely thei first title, alphabetically). This is not a problem (one can modify the popup content to feature multiple things if one wants to.)
About ../body/editorThat's some pretty advanced coding now. Lots of levels - which might not be desirable per se but I'm impressed how/that you seem to have solved it. I don't understand how you realized you should do a recursive popping back and forth between processM..A..T and processNext.. but well done.
...and $action-log is that for testing?
Side note: May I ask if you use any particular tools for your dev? For one thing, I assume you don't develop directly in TW as I do (in the SideEditor) but I never understood how it can be effective to not see the results directly. Or do you, somehow see the results live?
What other things can you think of that I can do?
Just noted something; typing e.g [[xxxxxx will trigger the popup (i.e the mere artifact) in spite of no tiddler prefixed such. Is this a problem? If it is, I'm thinking some "late" filter is needed, i.e after the mechanism knows what type of "thing" is looked at (i.e is it a title or a macroname, etc) ...so it if we want to keep the separation of concerns between /body/editor and /Popup, I guess this should also go into /body/editor somewhere... IFF this all is a problem.
[...] leave it alone for now, but be prepared to have to deal with it.
We want to test all definition tiddlers for matches, and at the end decide what to do.
First, unless you object, I will hereon refer to the end user popup content templates as "popup tools" or, if the context allows, just "tools". And we can now call the /_Popup tiddler simply "the popup".
The popup is now fully reworked. It has two groups of variables. See if you think any of them should be moved upstreams into /body/editor. It feels like the popup ought not have anything to do with the state tiddler. BTW, the editedTiddler variable refers to the viewtemplate tiddler of a tiddler being edited; in our case it'd be "RikerIpsum", and this variable is used in e.g transclude tools.
Changing variable names is not as obvious as I thought: The system variables should be prefixed with em-. But IMO variables that the user is in direct contact with should be as friendly as possible. For example, when he creates a popup tool I think it is better if he creates the "trigger" field as opposed to the "em-trigger" field. Yes/no?And "fragment"... I guess it could be changed into "nameprefix" or "em-nameprefix" but I'm not sure that is more informative. It must not be "titleprefix" because it is not always titles.)
Q's for you1) The styling you've put in $:/plugins/EditorMagic/styles - mess up e.g buttons inside the popup (e.g the 100% width). Were these styles added to e.g harmonize with your floating editor tools, or why were they added?
2) Merely stepping with the arrows is not sufficient to trigger anything. Eg, if it says <$ it is not merely enough to arrow ones way to after to $ to fire popup. It would be nice if it were, because currently one needs to e.g insert some character and delete it to trigger the popup. Do arrow keys not fire actions like other keys?
3) The recursive macro and what it solves:We want to test all definition tiddlers for matches, and at the end decide what to do.I have this nagging feeling it could be made simpler than with the recursive macro by using some kind of external state value that is changed for each match. Maybe each match could append the title to a list. At the end we just extract the first title?I actually like recursions (except their binary behaviour to fully work or absolutely not ;-) but because it is part of the wikitext I feel it is advantageous to keep it as simple as possible for others reading it.
Perhaps targetTiddler instead of editedTiddler?
I think a user you expect to write regular expressions, can also be expected to read docs and use em-trigger instead of trigger.
$:/plugins/EditorMagic/styles
Arrow keys do not change the content.I already wrote JS that resolves this some days ago, but the downside is it makes the action-popupcaret widget much less generic.
3) The recursive macro and what it solves:
As far as I know we don't have any other easier and efficient way to save variables for every step of a list widget run, have them persist and update, and compare them afterwards.
I don't see an issue with complexity here as users of the tool would not need to tinker with this, unless you don't feel comfortable enough with it to maintain the code?
As far as I know we don't have any other easier and efficient way to save variables for every step of a list widget run, have them persist and update, and compare them afterwards.(JS?)
For titles this would be something like [all[tiddlers]prefix<fragment>].....
...possibly the full algo to generate "the list of whatever items" could be put in a field?
You may have to make sure the em-fragment variable is defined in the detection code as well.
I am going to need the latest working copy of the demo to be able to compare and generate a diff.
I assume that would include (starting with what I last worked on) your renaming of variables and macros, plus introduction of em-filter in popuptools, with body/editor untouched.
I am going to need the latest working copy of the demo to be able to compare and generate a diff.By "working" I assume you mean the latest copy that I'm hoping you take a look at; yes that is http://editormagic2.tiddlyspot.com/
No I mean the latest version where everything worked as it should. I assume there was a time where you had renamed variables, and introduced em-filter in popuptools but not yet in body/editor... and everything was working as it should. That's the file I would like a copy of.