Bug 838294 - FEATURE: Wrap selection in tag
Summary: FEATURE: Wrap selection in tag
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Topic Tool
Classification: Other
Component: FUDCon Docs Hack
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Joshua Wulf
QA Contact: Joshua Wulf
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-08 10:40 UTC by Joshua Wulf
Modified: 2014-10-19 23:01 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-08-08 17:25:48 UTC
Embargoed:


Attachments (Terms of Use)

Description Joshua Wulf 2012-07-08 10:40:36 UTC
At the moment if I want to wrap existing text in a tag, I have to type the tag, get the autoclosure, then cut and paste either the ending tag or the text.

In the oXygenXML editor there is a hot key and a pop-up. You make a selection, then you hit the hot key, put the tag name into the pop-up, and get the wrapping.

Implement.

Comment 1 Joshua Wulf 2012-07-08 10:46:02 UTC
Here's the pseudo-code:

Add an onKeyEvent handler for the hot-key combination to the Codemirror create code in the editor page.

In the handler, get the current selected text in the editor.

Pop-up a modal dialog and allow the user to enter a tag. Parse the tag to the first space, and use that as the tag name. Assume the rest is attributes.

If the user input looks like this: XXXX

then do:

<XXXX>SELECTED-TEXT</XXXX>

if it looks like: XXXX YYY ZZZ then do:

<XXXX YYY ZZZ>SELECTED-TEXT</XXXX>

Comment 2 Joshua Wulf 2012-07-08 11:13:01 UTC
Another thing to do would be to make a hot key that will delete the last inserted tag. This allows you to close the tag on the other side of the text you want to wrap, and get the autoclosure.

So, the pseudo code:

1. Trap the hot key.

2. When it fires, check the text at the cursor. Parse around it for the open and closed tag. If found, delete the closed tag part.

Comment 4 Joshua Wulf 2012-08-08 17:25:48 UTC
Hot key is Ctrl+Shift+D. Tested in Chrome, Firefox and Opera on Linux.


Note You need to log in before you can comment on or make changes to this bug.