- AuthorPosts
- March 28, 2007 at 4:42 pm #4253BSIMember
I downloaded tagger.zip and extracted files to the Plugins folder. The result is a set of plugins in the Tools->Plugins area. I assigned some of them to keyboard shortcuts. When I run them as keyboard shortcuts, they do tag the selected text (for instance, as selected text. However, after the plugin is run, the cursor bounces up several lines. Is that common? Is there a way to avoid it?
March 28, 2007 at 5:25 pm #4254Yutaka EmuraKeymasterI reproduced this issue. It works fine when “No Wrap” is selected for “Wrap by” (you can select on the toolbar, or on the General tab of the Properties for Current Configuration). However, I am not the author of these plug-ins, and so I cannot fix them.
You can probably do the same thing by writing a macro, and you can assign the macro to any keyboard shortcut.
March 28, 2007 at 7:26 pm #4255BSIMemberYou’re so right! Thank you for demystifying the use of the plugin. I just downloaded emeditor, so I’m not sure how to accomplish a macro that sees the beginning/end of a selection and inserts characters at each end.
March 29, 2007 at 1:18 am #4257Yutaka EmuraKeymasterTry this:
document.selection.Text = "<b>" + document.selection.Text + "</b>";
You can save this one line macro as something like “bold.jsee”. Then while this file is still active, click “Select This” on the Macros menu. When you open an HTML file, select text and click “Run Macro” on the toolbar or press F4. If you have multiple macros, you can assign keyboard shortcut from Keyboard Map on the Help menu.
March 31, 2007 at 3:12 am #4260VladMemberWe can do better than installing a dozen plugins or macros. The Execute Extension plugin can be configured to insert tags, but configuring it is a pain. Here is a script version of tagger, it generates popup menu with tags to insert:
// TAGGER.JSEE -- tagger and clip library, inserts strings around selected text or at the cursor.
// Usage: modify tables of tags at the start of file as you see fit.
// To add tags for other configurations: add new tables of tags and edit switch statement at the end.
// format: [string to insert before selection, string to insert after selection, optional menu label]
////////////////////////////////
HTML_TAGS = [
['<br>', '', ''],
['<p>', '</p>', ''],
[' ', '', 'space'],
['', '<hr>', ''],
['<!-- ', ' -->', 'comment'],
['', '', '-----------'], //menu separator
['<b>', '</b>', 'bold'],
['<i>', '</i>', 'italic'],
['<u>', '</u>', 'underline'],
['<pre>', '</pre>', ''],
['<blockquote>', '</blockquote>', 'blockquote'],
['<big>', '</big>', 'big'],
['<small>', '</small>', 'small'],
['<sup>', '</sup>', 'superscript'],
['<sub>', '</sub>', 'subscript'],
['<center>', '</center>', 'center'],
['', '', '-----------------'],
['<a href=#>', '</a>', 'Link'],
['<a name=>', '</a>', 'Mark'],
['<img src="" alt="" width="" height=>', '', 'Image'],
['', '', '--------------'],
['<table>', '</table>', 'table'],
['<tr>', '</tr>', ''],
['<td>', '</td>', ''],
['<ul>n', 'n</ul>', 'unorderd list'],
['<ol>n', 'n</ol>', 'orderd list'],
['<li>', '', ''],
['<dl>n', 'n<dl>', 'definition list'],
['<dt>', '', ''],
['<dd>', '', ''],
['', '', ''], //these are ignored
['', '', ''],
['', '', ''],
['', '', '']
];
////////////////////////////////
TEXT_TAGS = [
['Dear Collector:', '', ''],
['I would like to sell my kidney.', '', ''],
['Which way is to the soup kitchen?', '', ''],
['', '', ''],
['', '', '']
];
////////////////////////////////
UNIVERSAL_TAGS = [ //these should always be available
['', '', '--------------------'],
['/*', '*/', '/**/'],
['u03B2', '', 'beta'],
['', '', '']
];
/////////////////////////////////////////////////////////////////
function createMenu(tags) {
tags = tags.concat(UNIVERSAL_TAGS);
menu = CreatePopupMenu();
//populate menu
L = tags.length;
for (i=0; i<L; i++) {
if (tags[i].length!=3 || (tags[i][0]=="" && tags[i][1]=="" && tags[i][2]=="")) continue;
if (tags[i][2].slice(0,6)=="------")
menu.Add( '', 0, eeMenuSeparator );
else
menu.Add( tags[i][2] || tags[i][0] || tags[i][1], i+1 );
}
//display menu
result = menu.Track(0);
//insert tags
if (result!=0) insertTags(tags[result-1][0], tags[result-1][1]);
}
function insertTags(text_before, text_after) {
document.selection.Text = text_before + document.selection.Text + text_after;
// to do: restore selection
}
switch( document.ConfigName ) {
case("HTML"):
createMenu(HTML_TAGS);
break;
case("Text"):
createMenu(TEXT_TAGS);
break;
default:
createMenu(HTML_TAGS);
}
- AuthorPosts
- You must be logged in to reply to this topic.