Bug 838294 - FEATURE: Wrap selection in tag
FEATURE: Wrap selection in tag
Status: CLOSED CURRENTRELEASE
Product: Topic Tool
Classification: Other
Component: FUDCon Docs Hack (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Joshua Wulf
Joshua Wulf
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-08 06:40 EDT by Joshua Wulf
Modified: 2014-10-19 19:01 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-08 13:25:48 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Joshua Wulf 2012-07-08 06:40:36 EDT
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 06:46:02 EDT
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 07:13:01 EDT
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 13:25:48 EDT
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.