you can do it like this:
EditListWidget.prototype.myFunction= function (pre,post) {
var dummy=ResetFind();
/* This function is for entries that are preceeded and followed by the
entry */
var txtarea = this.parentDomNode.getElementsByTagName("textarea")[0];
var str=txtarea.value;
and change references from myFunction() to this.myFunction()
all the best
BJ
On Tuesday, February 9, 2016 at 1:00:34 PM UTC, Andrew wrote:
>
> Thank you Jed, Tobias, and BJ,
> I guess it is over my head. All of your suggestions may actually work but
> I cant figure out how to use them. In it's half unfinished state I was
> working on http://www.format.tiddlyspot.com if anyone would like to have
> a look. It has problems of overriding core tiddlers which I want to change
> but cant figure out how. I wish anyone could work on it directly.
>
> Happy Connecting. Sent from my Sprint Samsung Galaxy S® 5
>
>
>
>
> -------- Original message --------
> From: BJ <[email protected] <javascript:>>
> Date: 02/08/2016 12:16 AM (GMT-07:00)
> To: TiddlyWikiDev <[email protected] <javascript:>>
> Subject: [twdev] Re: [TW5] How get target tiddler by title in widget
>
> you could do it like this:
>
> var element = window.focusedElement;
> if(element) {// only allow input[type=text]/textarea
> if (element.tagName === "TEXTAREA" ||(element.tagName ===
> "INPUT" && element.type === "text")) {
> return
> element.value.substring(element.selectionStart,element.selectionEnd);
> }
> }
>
> On Saturday, February 6, 2016 at 1:01:46 AM UTC, Andrew wrote:
>>
>> Currently I'm reworking a format widget that modifies text in edit mode.
>> The widgets I'm modifying use the following to get selected text but it
>> means the ID had to be added to a core tiddler. I'd like to select the
>> element by title instead of a Id if possible so that core tiddlers don't
>> have to be overridden?
>>
>> txt=document.getElementById("myTextarea");
>> var startPos = txt.selectionStart;
>> var endPos = txt.selectionEnd;
>> var listtext= txt.value.substr(startPos, endPos -startPos);
>>
>> Maybe with something like the following. I really wish I could figure
>> this out:
>>
>> var tiddler =
>> this.getAttribute("tiddler",this.getVariable("currentTiddler"));
>>
>> Or maybe some kind of getTargetElement by title? Help.
>>
>> --
> 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] <javascript:>.
> To post to this group, send email to [email protected]
> <javascript:>.
> Visit this group at https://groups.google.com/group/tiddlywikidev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/7f44c313-8fd4-4049-8957-e9477af3da95%40googlegroups.com
>
> <https://groups.google.com/d/msgid/tiddlywikidev/7f44c313-8fd4-4049-8957-e9477af3da95%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/9073a265-8e05-4d00-ab9f-a6d95e030ff6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.