Re: [Xsltforms-support] access to user selection?
Brought to you by:
alain-couthures
From: Tim T. <tim...@gm...> - 2016-07-05 20:03:08
|
Michael, A similar use case came up on Stack Overflow earlier this year: http://stackoverflow.com/questions/36005795/wrap-text-in-element-using-xforms. Alain has added a couple of new extension actions (xf:wrap[1] and xf:setselection[2]) to address it. (The xf:setselection action also provides access to DOM properties like selectionStart and selectionEnd, but this feature doesn't quite work as expected because the offsets aren't updated when additional "tags" are inserted.) Best, Tim [1] http://www.agencexml.com/direct/wrap/wrap.xml [2] http://www.agencexml.com/direct/wrap/setselection.xml -- Tim A. Thompson Metadata Librarian (Spanish/Portuguese Specialty) Princeton University Library On Tue, Jul 5, 2016 at 3:31 PM, C. M. Sperberg-McQueen < cm...@bl...> wrote: > Is there any way, in XSLTForms, to get access to the string of > characters the user has selected with a mouse? > > For example, imagine an xf:input bound to a PCDATA element, > in a mixed-content document. The user would like to tag > some part of the text with a sub-element, e.g. to change > > <p>Nobody does humility better than me.</p> > > to > > <p><emph>Nobody</emph> does humility better than me.</p> > > I have in mind a display of the text node, followed by a button > reading (say) "Tag selected text as 'emph'". > > Possible? Possible without writing functions in Javascript? > Not possible? > > best, > > Michael > > p.s. Yes, I am aware of the TinyMCE editor; I am trying to see how > far one can go without it or something analogous. (And the last > time I tried, I couldn't get TinyMCE to do what I wanted. I'll > try again sometime, but my question remains.) > > -- > **************************************************************** > * C. M. Sperberg-McQueen, Black Mesa Technologies LLC > * http://www.blackmesatech.com > * http://cmsmcq.com/mib > * http://balisage.net > **************************************************************** > > > > > > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > |