Wrap/unwrap selected text in an element

Are you missing a feature? Request it's implementation here.
iatttmp
Posts: 2

Wrap/unwrap selected text in an element

Thu Mar 31, 2011 5:34 pm

When you're madly re-purposing content from a horrible xml source with an indecipherable schema, it's really handy to be able to mark a bunch of text and just wrap in an arbitrary tag. Structured Framemaker has this feature. The suggestion dialog should pop up to assist while typing the new tag, but there should be no restriction on choices since the document is probably invalid in the first place.

oXygen already has a (sort of) unwrap function. If you delete a tag, the closing tag often disappears as well. The behavior is not perfectly consistent and could be made explicit with an nice "unwrap" command.
adrian
Posts: 2326

Re: Wrap/unwrap selected text in an element

Thu Mar 31, 2011 6:08 pm

Hello,

Oxygen already has these functions/actions in Text mode.

To wrap the selected content, right click on the selection and from the contextual menu choose Refactoring -> Surround with Tags(Ctrl+E). You can choose a tag name from the proposed list or simply type your own.

To unwrap, right click on an element start or end tag and from the contextual menu choose Refactoring -> Delete Element Tags(Alt+Shift+X).

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
iatttmp
Posts: 2

Re: Wrap/unwrap selected text in an element

Thu Mar 31, 2011 6:31 pm

Thanks, Adrian.

This happens a lot to me :oops: - wanting features that great products already include.

Tim
Chaa006
Posts: 4

Re: Wrap/unwrap selected text in an element

Mon Sep 21, 2015 2:16 pm

Adrian, that is very helpful (I have been searching the Help system in vain to try to find out how to achieve that) but it will not allow me to wrap a tag with attributes. For example, while Ctrl-E allows me to wrap 'name' around (e.g., 'Charles Thorndyke') to yield <name>Charles Thorndyke</name>, I actually need to wrap 'name indexterm="Thorndyke,~Charles"' to yield <name indexterm="Thorndyke,~Charles">Charles Thorndyke</name>. How (if at all) can that be accomplished, please ? Including the attribute:value pair greys out the 'OK' button.

Philip Taylor
adrian
Posts: 2326

Re: Wrap/unwrap selected text in an element

Mon Sep 21, 2015 3:51 pm

Hello Philip,

The Surround with Tags(Ctrl+E) action is meant only for tagging content (just XML element tags without attributes).
So, why not tag the content with CTRL+E, press the left arrow twice to move the caret inside the inserted tag and continue typing the attribute name and value
e.g.
1. Select the text => Charles Thorndyke| (| = caret, blue = selection)
2. Tag it (Ctrl+E) type "name", press OK=> <name>Charles Thorndyke|</name> (| = caret, blue = selection)
3. Press the left arrow twice to position the caret inside the tag => <name|>Charles Thorndyke</name> (| = caret)
4. Insert a space in the tag and type in the attribute name and value => <name indexterm="Thorndyke,~Charles">Charles Thorndyke</name>

If you want to re-use the tagged content both in text and in the tagged attribute value, Find/Replace with regexp could be the solution.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
RBVanDyke
Posts: 35
Location: San Francisco, California USA

Re: Wrap/unwrap selected text in an element

Fri Jun 16, 2017 8:33 pm

Howdy:

The good news is that the CTRL+e shortcut is exactly what I'm looking for.

The less good news is that it took me two days to find it. That's because I searched oXygen XML Editor (19) online help, and tried filtering Options > Preferences > Menu Shortcut Keys -- for the word wrap.

Don't know if there's a way to alias surround and wrap. Perhaps easier in the OLH than in the Preferences. Key point being that oXygen had the feature, I wanted to find it, but couldn't until I finally came over here to the forum.

Cheers & hope this helps,
Riley
SFO
Radu
Posts: 5088

Re: Wrap/unwrap selected text in an element

Mon Jun 19, 2017 10:31 am

Hi Riley,

I understand, sorry for the inconvenience. We'll try to improve the menu shortcuts search to also allow us to define various extra keywords for actions.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “Feature Request”

Who is online

Users browsing this forum: No registered users and 0 guests