Browse Source

Fixed preview

Signed-off-by: emanuele <[email protected]>
emanuele 13 years ago
parent
commit
cebed37956

+ 15 - 0
Themes/default/GenericControls.template.php

@@ -48,6 +48,21 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 						if (!bIsSource)
 							this.toggleTextMode();
 
+					},
+					getText: function() {
+						var bIsSource = this.inSourceMode();
+						var current_value = this.getWysiwygEditorValue();
+
+						// @TODO make it put the quote close to the current selection
+
+						if (!bIsSource)
+						{
+							this.toggleTextMode();
+							this.toggleTextMode();
+						}
+
+						return current_value;
+
 					}
 				};
 

+ 2 - 2
Themes/default/Post.template.php

@@ -579,8 +579,8 @@ function template_main()
 						if (textFields[i] in document.forms.postmodify)
 						{
 							// Handle the WYSIWYG editor.
-							if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled)
-								x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
+							if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && $("#', $context['post_box_name'], '").data("sceditor") != undefined)
+								x[x.length] = textFields[i] + \'=\' + $("#', $context['post_box_name'], '").data("sceditor").getText().replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
 							else
 								x[x.length] = textFields[i] + \'=\' + document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
 						}

+ 1 - 1
Themes/default/scripts/jquery.sceditor.bbcode.js

@@ -1098,7 +1098,7 @@
 				var from = '';
 				if(typeof attrs.defaultAttr !== "undefined")
 					from = '<cite>' + attrs.defaultAttr + '</cite>';
-				
+
 				return '<code>' + from + content + '</code>'
 			}
 		},