# HG changeset patch # User Dan Fuhry # Date 1288249176 14400 # Node ID 307591683f3bf91cc2e15e7163989830c6653e73 # Parent 960c1572df75d8920e97a188813a6b82897c7133 Added olist, ulist, table and heading diff -r 960c1572df75 -r 307591683f3b GUIEditor.php --- 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(''); + $template->add_header_js(''); } // @@ -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:', diff -r 960c1572df75 -r 307591683f3b guieditor/editor.js --- 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(''); + for ( var j = 1; j <= 6; j++ ) + { + options.push(''); + } + options = implode('', options); + label.assign_vars({ + TITLE: '' + }); + toolbar += label.run(); + } else { if ( buttons[i].charAt(buttons[i].length - 1) == '*' ) @@ -156,6 +170,8 @@ var il_mp = miniPrompt(function(div) { div.innerHTML += '

' + $lang.get('guied_image_title') + '

'; + // 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 += ' \ \
\ @@ -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); diff -r 960c1572df75 -r 307591683f3b guieditor/icons/olist.png Binary file guieditor/icons/olist.png has changed diff -r 960c1572df75 -r 307591683f3b guieditor/icons/table.png Binary file guieditor/icons/table.png has changed diff -r 960c1572df75 -r 307591683f3b guieditor/icons/ulist.png Binary file guieditor/icons/ulist.png has changed