Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-10-24 17:37:59

Random Bits
Xinha Community Member
Registered: 2005-10-24
Posts: 19

Add custom <div> around selected block

I have searched through the topics, and I guess my search skills are not up to par ....

I have found the plugin InsertWords which allows the user to select from a human readable list, and coded text is placed at the cursor.

However i want to be able to have the user select some text, choose from a droplist, and the selected text is surrounded by a custom <div>.

For instance:

['Searchable','<div id="css_search" myAction="search">'],
['Sounds Like','<div id="css_soundex" myAction="soundex">']

The user types in:

This is a test

The user selects the word test, and chooses 'Searchable' from the drop list. The HTML result is:

This is a <div id="css_search" myAction="search">test</div>

I can then parse the text for a <div> which has the non-standard parameter myAction, and do something with it.

Anything like this?

Offline

#2 2005-10-25 18:59:55

Random Bits
Xinha Community Member
Registered: 2005-10-24
Posts: 19

Re: Add custom <div> around selected block

Ok, the closest I can come to making this work, is to create a custom formatblock:

xinha_config.formatblock={
'&mdash;':'',
'Span 1':'span myAction=\"ACT1\"',
'Span 2':'span myAction=\"ACT2\"',
};

Which does not quite work, as the formatblock code uses the entire "span myAction"ACT1" for the closing tag, plus it blocks the entire line, not just the selection. The word test was selected, then Span 1 from the drop list:

<<span myAction="ACT1">>This is a test</<span myAction"ACT1">>

I could use a bogus tag, then parse it out to the actual span tags, but I cannot get around the entire line selection.

So close, yet so far....

Last edited by Random Bits (2005-10-25 19:00:36)

Offline

Board footer

Powered by FluxBB