summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBret McMillan <bretm@redhat.com>2008-11-17 17:37:17 -0500
committerBret McMillan <bretm@redhat.com>2008-11-17 17:37:17 -0500
commit7d9b4e2e642d647f63b239ec1211f61951989f8d (patch)
treef1f652a6989e0c1f760f99e9338860ea775524cf
parentbd912471fd8d0fc26039b5a83253b2c17d77fe8c (diff)
downloadmediawiki-stuff-7d9b4e2e642d647f63b239ec1211f61951989f8d.zip
mediawiki-stuff-7d9b4e2e642d647f63b239ec1211f61951989f8d.tar.gz
mediawiki-stuff-7d9b4e2e642d647f63b239ec1211f61951989f8d.tar.xz
headers aren't eating the world now, many other tags are commented out until unit-test pages look decentHEADmaster
-rw-r--r--extensions/TinyMCE_MW2.php41
-rw-r--r--extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js29
-rw-r--r--extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/wiki2html.js6
3 files changed, 33 insertions, 43 deletions
diff --git a/extensions/TinyMCE_MW2.php b/extensions/TinyMCE_MW2.php
index 3866a80..dfa0375 100644
--- a/extensions/TinyMCE_MW2.php
+++ b/extensions/TinyMCE_MW2.php
@@ -32,25 +32,18 @@ $wgExtensionCredits['other'][] = array(
"author" => "Bret McMillan <bretm@redhat.com>",
"version" => "0.1",
"url" => "http://www.redhat.com/",
- "description" => "Easily implement Moxiecode's TinyMCE into MediaWiki using the plugin framework, extends Joseph Socoloski's original work"
- );
+ "description" => "Easily implement Moxiecode's TinyMCE into MediaWiki using the plugin framework (rework of Joseph Socoloski's original work)"
+);
# REGISTER HOOKS
$wgHooks['ArticleAfterFetchContent'][] = 'wfCheckBeforeEdit';
$wgHooks['EditPage::showEditForm:initial'][] = 'wfTinymceAddScript';
-function wfTinymceAddScript ($q) {
+function wfTinymceAddScript($q) {
+ global $wgOut, $wgScriptPath;
- global $wgOut, $wgTitle, $wgScriptPath, $wgMyWikiURL;
- global $wgTempText, $wgTinymceDir, $wgTinymceTheme, $wgExt_valid_elements, $wgUseTinymce;
-
- $wgTinymceDir = "tinymce";
- $ns_allowed = true;
- $ns = $wgTitle->getNamespace();
-
- if ($ns_allowed && $wgUseTinymce) {
- # use the more modern example straight from moxiecode
- $wgOut->addScript("<script language=\"javascript\" type=\"text/javascript\">
+ # use the more modern example straight from moxiecode
+ $wgOut->addScript("<script language=\"javascript\" type=\"text/javascript\">
function toggleEditor(id) {
if (!tinyMCE.get(id))
tinyMCE.execCommand('mceAddControl', false, id);
@@ -59,11 +52,13 @@ function toggleEditor(id) {
}
</script>");
- $wgOut->addScript( "<script language=\"javascript\" type=\"text/javascript\" src=\"$wgScriptPath/extensions/$wgTinymceDir/jscripts/tiny_mce/tiny_mce.js\"></script><script language=\"javascript\" type=\"text/javascript\">tinyMCE.init({
+ $wgOut->addScript( "<script language=\"javascript\" type=\"text/javascript\" src=\"$wgScriptPath/extensions/tinymce/jscripts/tiny_mce/tiny_mce.js\"></script><script language=\"javascript\" type=\"text/javascript\">tinyMCE.init({
mode : \"textareas\",
theme : \"advanced\",
plugins : \"safari,inlinepopups,spellchecker,paste,media,fullscreen,table,mediawiki\",
- entity_encoding : \"named\",
+ entity_encoding : \"raw\",
+ cleanup : true,
+ add_unload_trigger : false,
remove_linebreaks : false,
convert_newlines_to_brs : false,
force_p_newlines : false,
@@ -73,22 +68,18 @@ function toggleEditor(id) {
convert_fonts_to_spans : true,
apply_source_formatting : false,
theme_advanced_buttons1 : \"bold,italic,strikethrough,underline,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,|,outdent,indent,|,link,unlink,|,fullscreen\",
- theme_advanced_buttons2 : \"formatselect,forecolor,|,image,media,charmap,|,undo,redo\",
+ theme_advanced_buttons2 : \"formatselect,forecolor,|,image,media,charmap,|,undo,redo,|,code\",
theme_advanced_buttons3 : \"\",
theme_advanced_buttons4 : \"\",
theme_advanced_toolbar_location : \"top\",
theme_advanced_toolbar_align : \"left\",
theme_advanced_statusbar_location : \"bottom\",
theme_advanced_resizing : true,
- document_base_url : \"$wgMyWikiURL\"});</script>" );
-
- #Since editing add the button
- $wgOut->addHTML("<p><a href=\"javascript:toggleEditor('wpTextbox1');\" title=\"toggle wysiwyg editor\">Toggle Visual Editor</a></p>");
- } else {
- $wgOut->addScript("<script language=\"javascript\" type=\"text/javascript\"></script>" );
- $wgUseTinymce = true;
- }
- return true;
+ document_base_url : \"$wgMyWikiURL\"});</script>"
+ );
+ # Since editing add the button
+ $wgOut->addHTML("<p><a href=\"javascript:toggleEditor('wpTextbox1');\" title=\"toggle wysiwyg editor\">Toggle Visual Editor</a></p>");
+ return true;
}
# Check existing article for any tags we don't want TinyMCE parsing...
diff --git a/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js b/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js
index e69dc5f..566af50 100644
--- a/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js
+++ b/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js
@@ -68,7 +68,7 @@
m.replace(/<li>(.*?)<\/li>/gim, glyph + "$1");
// TODO: fixme, this needs to be recursive...
- //m = t['convertlists'](m);
+ m = t['convertlists'](m);
return m;
});
@@ -111,29 +111,25 @@
rep(/<h3>(.*?)<\/h3>/gim, "===$1===");
rep(/<h4>(.*?)<\/h4>/gim, "====$1====");
rep(/<h5>(.*?)<\/h5>/gim, "=====$1=====");
- rep(/<h5>(.*?)<\/h6>/gim, "======$1======");
+ rep(/<h6>(.*?)<\/h6>/gim, "======$1======");
- // <p>
- rep(/<p>([\s\S]*?)<\/p>/gim, '\n$1');
+ // block elements, spacing, etc...
+ // <p>
+ //rep(/<p>([\s\S]*?)<\/p>/gim, '$1\n');
// <p align>
- rep(/<p.*?align\: left.*?>([\s\S]*?)<\/p>/gim, '\n$1');
-
+ //rep(/<p.*?align\: left.*?>([\s\S]*?)<\/p>/gim, '\n$1');
// various indents...
// <p style="padding-left"...>
- rep(/<p .*?padding\-left.*?>([\s\S]*?)<\/p>/gim, '\n $1');
- rep(/<pre>([\s\S]*?)<\/pre>/gim, '\n $1');
- rep(/<blockquote>([\s\S]*?)<\/blockquote>/gim, '\n $1');
-
- // <nbsp>
- rep(/\&nbsp\;/gim, ' ');
-
+ //rep(/<p .*?padding\-left.*?>([\s\S]*?)<\/p>/gim, '\n $1');
+ //rep(/<pre>([\s\S]*?)<\/pre>/gim, '\n $1');
+ //rep(/<blockquote>([\s\S]*?)<\/blockquote>/gim, '\n $1');
// <br>
- rep(/<br[^>]*?>/gim, '\n');
+ //rep(/<br[^>]*?>/gim, '\n');
// ul,ol lists
- s = t['convertlists'](s);
+ // s = t['convertlists'](s);
// tables
// XXXXXXXXXXXXXXXXXXXXXX
@@ -145,6 +141,9 @@
// probably due to a tinymce cleanup function repairing bad html
// rep(/\s*?<td\/>\s*?/gim, "");
+ // <nbsp>
+ //rep(/\&nbsp\;/gim, ' ');
+
return s;
},
diff --git a/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/wiki2html.js b/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/wiki2html.js
index 2d3f442..312e8b4 100644
--- a/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/wiki2html.js
+++ b/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/wiki2html.js
@@ -88,9 +88,9 @@ function wiki2html(s) {
})
/* BLOCK ELEMENTS */
- .replace(/(?:^|\n+)([^# =\*<].+)(?:\n+|$)/gm, function (m, l) {
+ .replace(/(?:^\s*|\n+\s*)([^\s\+\|#=\*<].+)(?:\s*\n+|$)/gm, function (m, l) {
if (l.match(/^\^+$/)) return l;
- return "\n<p>" + l + "</p>\n";
+ return "<p>" + l + "</p>\n";
})
.replace(/(?:^|\n)[ ]{2}(.*)+/g, function (m, l) { // blockquotes
@@ -103,7 +103,7 @@ function wiki2html(s) {
return '<pre>' + m.replace(/(^|\n)[ ]+/g, "$1") + '</pre>';
})
- .replace(/(?:^|\n)([=]+)(.*)\1/g, function (m, l, t) { // headings
+ .replace(/^([=]+)(.*?)\1/mg, function (m, l, t) { // headings
return '<h' + l.length + '>' + t + '</h' + l.length + '>';
})