[TW5] How to get hidden textarea value

160 views
Skip to first unread message

infurnoape

unread,
May 15, 2016, 8:27:45 PM5/15/16
to tiddl...@googlegroups.com
With the new editor toolbar in the prerelease of 5.1.12, a new iframe & hidden textarea are introduced for the text field so that selection can be preserved. I used to be able to use parentDomNode.getElementsByTagName("textarea")[0]; to get the textarea value but that is changing. In developer tools I can inspect and find the value of the textarea under properties under textarea under value but I can't figure out how to get the value. Maybe because it's hidden? The undo and redo buttons are not being included because they were not acting properly. I feel that if I could capture the text after the execCommand to undo, I could assign it to operation.replacement and then use the editor engine to update the preview pane. Maybe then the undo and redo buttons could be added back in under a plugin. Any suggestions?


Happy Connecting. Sent from my Sprint Samsung Galaxy S® 5

Jeremy Ruston

unread,
May 16, 2016, 2:10:47 PM5/16/16
to tiddl...@googlegroups.com
Hi Andrew

With the new editor toolbar in the prerelease of 5.1.12, a new iframe & hidden textarea are introduced for the text field so that selection can be preserved. I used to be able to use parentDomNode.getElementsByTagName("textarea")[0]; to get the textarea value but that is changing. In developer tools I can inspect and find the value of the textarea under properties under textarea under value but I can't figure out how to get the value. Maybe because it's hidden? The undo and redo buttons are not being included because they were not acting properly. I feel that if I could capture the text after the execCommand to undo, I could assign it to operation.replacement and then use the editor engine to update the preview pane. Maybe then the undo and redo buttons could be added back in under a plugin. Any suggestions?

You’ll need to reach into the textarea within the iframe, something like this:

parentDomNode.getElementsByTagName("iframe")[0].contentWindow.document.getElementsByTagName("textarea")[0].value

Best wishes

Jeremy




Happy Connecting. Sent from my Sprint Samsung Galaxy S® 5

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/6ev5pmxalgx05b7vdugl8eul.1463352713728%40email.android.com.
For more options, visit https://groups.google.com/d/optout.

infurnoape

unread,
May 16, 2016, 2:53:36 PM5/16/16
to tiddl...@googlegroups.com
Thank you for a super quick reply jeremy. I tried it an I must still be doing something wrong because I got error 
parentDomNode is not defined
so it must needs to be how do you say added as dot notation on the end of document or window or operation or something. I'm trying to access it from a module-type: texteditoroperation.
I take it that I may have to do a require something in order to do a parentDomNode call? I sense I not inheriting the method? Sorry, I really don't know how the architecture works, still foggy on that.


Happy Connecting. Sent from my Sprint Samsung Galaxy S® 5




Jeremy Ruston

unread,
May 16, 2016, 2:57:04 PM5/16/16
to tiddl...@googlegroups.com
Hi Andrew

Thank you for a super quick reply jeremy. I tried it an I must still be doing something wrong because I got error 
parentDomNode is not defined
so it must needs to be how do you say added as dot notation on the end of document or window or operation or something. I'm trying to access it from a module-type: texteditoroperation.
I take it that I may have to do a require something in order to do a parentDomNode call? I sense I not inheriting the method? Sorry, I really don't know how the architecture works, still foggy on that.

texteditoroperation’s are intended to do simple string manipulations, rather than direct manipulation of the textarea.

The implementation of undo/redo that we had relied on a different mechanism; you can have a look back in the commit history to the commit where the feature was removed.

Depending on what you’re trying to do, we may need to introduce a new mechanism.

Best wishes

Jeremy.

Reply all
Reply to author
Forward
0 new messages