--- a/GUIEditor.php Thu Oct 28 01:44:13 2010 -0400
+++ b/GUIEditor.php Thu Oct 28 02:59:36 2010 -0400
@@ -16,7 +16,15 @@
function guied_attach_script()
{
global $template;
- $template->add_header_js('<script type="text/javascript" src="' . scriptPath . '/plugins/guieditor/editor.js"></script>');
+ $template->add_header_js('<style type="text/css">
+ select.guied_dropdown {
+ font-size: 10px;
+ padding: 0;
+ border: 1px solid #aaaaff;
+ background-color: white;
+ color: #202020;
+ }
+ </style><script type="text/javascript" src="' . scriptPath . '/plugins/guieditor/editor.js"></script>');
}
//
@@ -70,10 +78,20 @@
btn_intlink: 'Internal link',
btn_extlink: 'External link',
btn_image: 'Image',
+ btn_table: 'Table',
+ btn_ulist: 'Bulleted list',
+ btn_olist: 'Numbered list',
+ sample_heading: 'Heading',
sample_bold: 'Bold text',
sample_italic: 'Italic text',
sample_underline: 'Underlined text',
+ // translators: translating this may be easier if you understand wiki-table syntax
+ sample_table: '|-\n! Column header 1\n! Column header 2\n|-\n| Row 1, column 1\n| Row 1, column 2\n|-\n| Row 2, column 1\n| Row 2, column 2',
+ sample_ulist: '\n* Bulleted list\n** Sub-level\n*** Deeper indent\n* Back to one indent',
+ sample_olist: '\n# Numbered list\n## Sub-level\n### Deeper indent\n# Back to one indent',
+
+ lbl_heading: 'Heading',
intlink_title: 'Insert internal link',
intlink_lbl_page: 'Page:',
--- a/guieditor/editor.js Thu Oct 28 01:44:13 2010 -0400
+++ b/guieditor/editor.js Thu Oct 28 02:59:36 2010 -0400
@@ -15,7 +15,7 @@
toolbar += head.run();
- var buttons = ['bold*', 'italic*', 'underline*', '|', 'intlink', 'extlink', 'image'];
+ var buttons = ['heading', '|', 'bold*', 'italic*', 'underline*', '|', 'intlink', 'extlink', 'image', 'table', '|', 'ulist*', 'olist*'];
// Button: Bold
var i;
@@ -29,6 +29,20 @@
});
toolbar += label.run();
}
+ else if ( buttons[i] == 'heading' )
+ {
+ var options = [];
+ options.push('<option value="0">' + $lang.get('guied_lbl_heading') + '...</option>');
+ for ( var j = 1; j <= 6; j++ )
+ {
+ options.push('<option value="' + j + '">' + $lang.get('guied_lbl_heading') + ' '+j+'</option>');
+ }
+ options = implode('', options);
+ label.assign_vars({
+ TITLE: '<select class="guied_dropdown" onchange="guied_register_heading(this);">' + options + '</select>'
+ });
+ toolbar += label.run();
+ }
else
{
if ( buttons[i].charAt(buttons[i].length - 1) == '*' )
@@ -156,6 +170,8 @@
var il_mp = miniPrompt(function(div)
{
div.innerHTML += '<h3>' + $lang.get('guied_image_title') + '</h3>';
+ // Yes, I know what you're thinking. Probably something along the lines of "holy fuck, this is a long ass string."
+ // I'll move all these tools over to templates at some point in time
div.innerHTML += '<table border="0" cellspacing="5" cellpadding="0" style="width: 100%;"> \
<tr> \
<td valign="top" style="white-space: nowrap;"> \
@@ -275,11 +291,31 @@
$('#guied_image_caption').val(selection);
break;
+ case 'table':
+ guied_insert_wikitext_tag(textarea, "{| styled\n", "\n|}", $lang.get('guied_sample_table'));
+ break;
+ case 'ulist':
+ guied_replace_selection(textarea, $lang.get('guied_sample_ulist'));
+ break;
+ case 'olist':
+ guied_replace_selection(textarea, $lang.get('guied_sample_olist'));
+ break;
}
- /*
+}
+
+function guied_register_heading(select)
+{
+ var textarea = document.getElementById('ajaxEditArea');
+ var n = Number($(select).val());
+ if ( n < 1 || n > 6 )
+ return;
+ $(select).val('0');
+ var tag = '';
+ for ( var i = 0; i < n; i++ )
+ tag += '=';
- */
+ guied_insert_wikitext_tag(textarea, tag + ' ', ' ' + tag, $lang.get('guied_sample_heading'));
}
function guied_intlink_finish(insertbtn)
@@ -376,6 +412,8 @@
case 'inline':
caption = $('#guied_image_alttext').val();
break;
+ case 'raw':
+ attrs.push('raw');
}
if ( caption != '' )
attrs.push(caption);
Binary file guieditor/icons/olist.png has changed
Binary file guieditor/icons/table.png has changed
Binary file guieditor/icons/ulist.png has changed