aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-08-12 01:47:08 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-08-12 01:47:08 -0700
commitdfd3cef734be3bc1bf2d16dfe8b2f71d6aff18a7 (patch)
tree9e7384883d118ecbf2d94730fb78f5d9d4c00d85
parent8d0ba934364fbb65e66edf1b2cda24ebd8afb96b (diff)
downloadvolse-hubzilla-dfd3cef734be3bc1bf2d16dfe8b2f71d6aff18a7.tar.gz
volse-hubzilla-dfd3cef734be3bc1bf2d16dfe8b2f71d6aff18a7.tar.bz2
volse-hubzilla-dfd3cef734be3bc1bf2d16dfe8b2f71d6aff18a7.zip
added code, quote styles to editor
-rw-r--r--include/bbcode.php31
-rw-r--r--tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js31
-rw-r--r--view/jot-header.tpl5
-rw-r--r--view/style.css15
4 files changed, 29 insertions, 53 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 60809a7e2..674c44ec2 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -59,38 +59,11 @@
$Text = preg_replace("(\[font=(.+?)\](.+?)\[\/font\])","<span style=\"font-family: $1;\">$2</span>",$Text);
// Declare the format for [code] layout
- $CodeLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td class="quotecodeheader"> Code:</td>
- </tr>
- <tr>
- <td class="codebody">$1</td>
- </tr>
- </table>';
+ $CodeLayout = '<code>$1</code>';
// Check for [code] text
$Text = preg_replace("/\[code\](.+?)\[\/code\]/is","$CodeLayout", $Text);
- // Declare the format for [php] layout
- $phpLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td class="quotecodeheader"> Code:</td>
- </tr>
- <tr>
- <td class="codebody">$1</td>
- </tr>
- </table>';
- // Check for [php] text
- $Text = preg_replace("/\[php\](.+?)\[\/php\]/is",$phpLayout, $Text);
-
// Declare the format for [quote] layout
- $QuoteLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td class="quotecodeheader"> Quote:</td>
- </tr>
- <tr>
- <td class="quotebody">$1</td>
- </tr>
- </table>';
-
+ $QuoteLayout = '<blockquote>$1</blockquote>';
// Check for [quote] text
$Text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","$QuoteLayout", $Text);
diff --git a/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js b/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
index 5586637f3..86f9e3d62 100644
--- a/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
+++ b/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
@@ -8,10 +8,12 @@
* Contributing: http://tinymce.moxiecode.com/contributing
*/
+/* Macgirvin Aug-2010 changed from punbb to dfrn dialect */
+
(function() {
tinymce.create('tinymce.plugins.BBCodePlugin', {
init : function(ed, url) {
- var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
+ var t = this, dialect = ed.getParam('bbcode_dialect', 'dfrn').toLowerCase();
ed.onBeforeSetContent.add(function(ed, o) {
o.content = t['_' + dialect + '_bbcode2html'](o.content);
@@ -38,8 +40,8 @@
// Private methods
- // HTML -> BBCode in PunBB dialect
- _punbb_html2bbcode : function(s) {
+ // HTML -> BBCode in DFRN dialect
+ _dfrn_html2bbcode : function(s) {
s = tinymce.trim(s);
function rep(re, str) {
@@ -48,23 +50,10 @@
// example: <strong> to [b]
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
- rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
- rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
- rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
- rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
- rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");
- rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");
rep(/<font>(.*?)<\/font>/gi,"$1");
rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
- rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");
- rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");
- rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
- rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
- rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
- rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
- rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
- rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
+ rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");
rep(/<\/(strong|b)>/gi,"[/b]");
rep(/<(strong|b)>/gi,"[b]");
rep(/<\/(em|i)>/gi,"[/i]");
@@ -88,8 +77,8 @@
return s;
},
- // BBCode -> HTML from PunBB dialect
- _punbb_bbcode2html : function(s) {
+ // BBCode -> HTML from DFRN dialect
+ _dfrn_bbcode2html : function(s) {
s = tinymce.trim(s);
function rep(re, str) {
@@ -108,8 +97,8 @@
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");
- rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span>&nbsp;");
- rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span>&nbsp;");
+ rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");
+ rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");
return s;
}
diff --git a/view/jot-header.tpl b/view/jot-header.tpl
index e2b196dc3..22e425463 100644
--- a/view/jot-header.tpl
+++ b/view/jot-header.tpl
@@ -7,13 +7,12 @@ tinyMCE.init({
mode : "specific_textareas",
editor_selector: /(profile-jot-text|prvmail-text)/,
plugins : "bbcode",
- theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
+ theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
- theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
- content_css : "bbcode.css",
+ theme_advanced_blockformats : "blockquote,code",
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
diff --git a/view/style.css b/view/style.css
index 70f6f45f9..b58c8e101 100644
--- a/view/style.css
+++ b/view/style.css
@@ -16,6 +16,21 @@ img {
width: 600px;
}
+code {
+ font-family: monospace;
+ white-space: pre;
+ display: block;
+ overflow: auto;
+ border: 1;
+ background: #000000;
+ color: #44FF44;
+ padding: 10px;
+}
+
+blockquote:before {
+ content: '>> ';
+}
+
body {
background: #FEFEFE;
color: #444444;