ソースを参照

Merge pull request #205 from Spuds/draftUpdates

Draft updates
emanuele45 12 年 前
コミット
db422644ca

+ 50 - 20
Sources/Drafts.php

@@ -38,6 +38,18 @@ function SaveDraft(&$post_errors)
 	$id_draft = (int) $_POST['id_draft'];
 	$draft_info = ReadDraft($id_draft);
 
+	// A draft has been saved less than 5 seconds ago, let's not do the autosave again
+	if (isset($_REQUEST['xml']) && !empty($draft_info['poster_time']) && time() < $draft_info['poster_time'] + 5)
+	{
+		$context['draft_saved_on'] = $draft_info['poster_time'];
+
+		// since we were called from the autosave function, send something back
+		if (!empty($id_draft))
+			XmlDraft($id_draft);
+
+		return true;
+	}
+
 	// prepare any data from the form
 	$topic_id = empty($_REQUEST['topic']) ? 0 : (int) $_REQUEST['topic'];
 	$draft['icon'] = empty($_POST['icon']) ? 'xx' : preg_replace('~[\./\\\\*:"\'<>]~', '', $_POST['icon']);
@@ -143,15 +155,18 @@ function SaveDraft(&$post_errors)
 
 	// if we were called from the autosave function, send something back
 	if (!empty($id_draft) && isset($_REQUEST['xml']) && (!in_array('session_timeout', $post_errors)))
+	{
+		$context['draft_saved_on'] = time();
 		XmlDraft($id_draft);
+	}
 
 	return true;
 }
 
 /**
  * Saves a PM draft in the user_drafts table
- * The core draft feature must be enable, as well as the pm draft option
- * Determines if this is a new or and update to an existing draft
+ * The core draft feature must be enabled, as well as the pm draft option
+ * Determines if this is a new or and update to an existing pm draft
  *
  * @global type $context
  * @global type $user_info
@@ -173,6 +188,18 @@ function SavePMDraft(&$post_errors, $recipientList)
 	$id_pm_draft = (int) $_POST['id_pm_draft'];
 	$draft_info = ReadDraft($id_pm_draft, 1);
 
+	// 5 seconds is the same limit we have for posting
+	if (isset($_REQUEST['xml']) && !empty($draft_info['poster_time']) && time() < $draft_info['poster_time'] + 5)
+	{
+		$context['draft_saved_on'] = $draft_info['poster_time'];
+
+		// Send something back to the javascript caller
+		if (!empty($id_draft))
+			XmlDraft($id_draft);
+
+		return true;
+	}
+
 	// determine who this is being sent to
 	if (isset($_REQUEST['xml']))
 	{
@@ -188,7 +215,7 @@ function SavePMDraft(&$post_errors, $recipientList)
 	$draft['body'] = $smcFunc['htmlspecialchars']($_POST['message'], ENT_QUOTES);
 	$draft['subject'] = strtr($smcFunc['htmlspecialchars']($_POST['subject']), array("\r" => '', "\n" => '', "\t" => ''));
 
-	// message and subject still need a bit more massaging
+	// message and subject always need a bit more work
 	preparsecode($draft['body']);
 	if ($smcFunc['strlen']($draft['subject']) > 100)
 		$draft['subject'] = $smcFunc['substr']($draft['subject'], 0, 100);
@@ -210,8 +237,8 @@ function SavePMDraft(&$post_errors, $recipientList)
 			array(
 				'id_reply' => $reply_id,
 				'type' => 1,
-				'poster_time' =>  time(),
-				'subject' =>  $draft['subject'],
+				'poster_time' => time(),
+				'subject' => $draft['subject'],
 				'body' => $draft['body'],
 				'id_pm_draft' => $id_pm_draft,
 				'to_list' => serialize($recipientList),
@@ -256,7 +283,7 @@ function SavePMDraft(&$post_errors, $recipientList)
 		// get the new id
 		$id_pm_draft = $smcFunc['db_insert_id']('{db_prefix}user_drafts', 'id_draft');
 
-		// everything go as expected, if not toss an error
+		// everything go as expected, if not toss back an error
 		if (!empty($id_pm_draft))
 		{
 			$context['draft_saved'] = true;
@@ -268,7 +295,10 @@ function SavePMDraft(&$post_errors, $recipientList)
 
 	// if we were called from the autosave function, send something back
 	if (!empty($id_pm_draft) && isset($_REQUEST['xml']) && !in_array('session_timeout', $post_errors))
+	{
+		$context['draft_saved_on'] = time();
 		XmlDraft($id_pm_draft);
+	}
 
 	return;
 }
@@ -289,7 +319,7 @@ function ReadDraft($id_draft, $type = 0, $check = true, $load = false)
 {
 	global $context, $user_info, $smcFunc, $modSettings;
 
-	// always clean to be sure
+	// like purell always clean to be sure
 	$id_draft = (int) $id_draft;
 	$type = (int) $type;
 
@@ -471,7 +501,7 @@ function XmlDraft($id_draft)
 
 	echo '<?xml version="1.0" encoding="', $context['character_set'], '"?>
 	<drafts>
-		<draft id="', $id_draft, '"><![CDATA[', $txt['draft_saved_on'], ': ', timeformat(time()), ']]></draft>
+		<draft id="', $id_draft, '"><![CDATA[', $txt['draft_saved_on'], ': ', timeformat($context['draft_saved_on']), ']]></draft>
 	</drafts>';
 
 	obExit(false);
@@ -517,7 +547,7 @@ function showProfileDrafts($memID, $draft_type = 0)
 
 	// Default to 10.
 	if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount']))
-		$_REQUEST['viewscount'] = '10';
+		$_REQUEST['viewscount'] = 10;
 
 	// Get the count of applicable drafts on the boards they can (still) see ...
 	// @todo .. should we just let them see their drafts even if they have lost board access ?
@@ -616,7 +646,7 @@ function showProfileDrafts($memID, $draft_type = 0)
 	}
 	$smcFunc['db_free_result']($request);
 
-	// All drafts were retrieved in reverse order, get them right again.
+	// If the drafts were retrieved in reverse order, get them right again.
 	if ($reverse)
 		$context['drafts'] = array_reverse($context['drafts'], true);
 
@@ -672,12 +702,12 @@ function showPMDrafts($memID = -1)
 
 	// Default to 10.
 	if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount']))
-		$_REQUEST['viewscount'] = '10';
+		$_REQUEST['viewscount'] = 10;
 
 	// Get the count of applicable drafts
 	$request = $smcFunc['db_query']('', '
 		SELECT COUNT(id_draft)
-		FROM {db_prefix}user_drafts AS ud
+		FROM {db_prefix}user_drafts
 		WHERE id_member = {int:id_member}
 			AND type={int:draft_type}' . (!empty($modSettings['drafts_keep_days']) ? '
 			AND poster_time > {int:time}' : ''),
@@ -817,14 +847,14 @@ function ModifyDraftSettings($return_config = false)
 
 	// Here are all the draft settings, a bit lite for now, but we can add more :P
 	$config_vars = array(
-			// Draft settings ...
-			array('check', 'drafts_post_enabled'),
-			array('check', 'drafts_pm_enabled'),
-			array('check', 'drafts_show_saved_enabled', 'subtext' => $txt['drafts_show_saved_enabled_subnote']),
-			array('int', 'drafts_keep_days', 'postinput' => $txt['days_word'], 'subtext' => $txt['drafts_keep_days_subnote']),
-			'',
-			array('check', 'drafts_autosave_enabled', 'subtext' => $txt['drafts_autosave_enabled_subnote']),
-			array('int', 'drafts_autosave_frequency', 'postinput' => $txt['manageposts_seconds'], 'subtext' => $txt['drafts_autosave_frequency_subnote']),
+		// Draft settings ...
+		array('check', 'drafts_post_enabled'),
+		array('check', 'drafts_pm_enabled'),
+		array('check', 'drafts_show_saved_enabled', 'subtext' => $txt['drafts_show_saved_enabled_subnote']),
+		array('int', 'drafts_keep_days', 'postinput' => $txt['days_word'], 'subtext' => $txt['drafts_keep_days_subnote']),
+		'',
+		array('check', 'drafts_autosave_enabled', 'subtext' => $txt['drafts_autosave_enabled_subnote']),
+		array('int', 'drafts_autosave_frequency', 'postinput' => $txt['manageposts_seconds'], 'subtext' => $txt['drafts_autosave_frequency_subnote']),
 	);
 
 	if ($return_config)

+ 15 - 14
Sources/PersonalMessage.php

@@ -174,6 +174,10 @@ function MessageMain()
 	$context['current_label_redirect'] = 'action=pm;f=' . $context['folder'] . (isset($_GET['start']) ? ';start=' . $_GET['start'] : '') . (isset($_REQUEST['l']) ? ';l=' . $_REQUEST['l'] : '');
 	$context['can_issue_warning'] = in_array('w', $context['admin_features']) && allowedTo('issue_warning') && $modSettings['warning_settings'][0] == 1;
 
+	// Are PM drafts enabled?
+	$context['drafts_pm_save'] = !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_pm_enabled']) && allowedTo('pm_draft');
+	$context['drafts_autosave'] = !empty($context['drafts_pm_save']) && !empty($modSettings['drafts_autosave_enabled']) && allowedTo('pm_autosave_draft');
+	
 	// Build the linktree for all the actions...
 	$context['linktree'][] = array(
 		'url' => $scripturl . '?action=pm',
@@ -1784,10 +1788,6 @@ function MessagePost()
 
 	$modSettings['disable_wysiwyg'] = !empty($modSettings['disable_wysiwyg']) || empty($modSettings['enableBBC']);
 
-	// Are PM drafts enabled?
-	$context['drafts_pm_save'] = !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_pm_enabled']) && allowedTo('pm_draft');
-	$context['drafts_autosave'] = !empty($context['drafts_pm_save']) && !empty($modSettings['drafts_autosave_enabled']) && allowedTo('pm_autosave_draft');
-
 	// Generate a list of drafts that they can load in to the editor
 	if (!empty($context['drafts_pm_save']))
 	{
@@ -1838,10 +1838,6 @@ function MessageDrafts()
 {
 	global $context, $sourcedir, $user_info, $modSettings;
 
-	// Set draft capability
-	$context['drafts_pm_save'] = !empty($modSettings['drafts_pm_enabled']) && allowedTo('pm_draft');
-	$context['drafts_autosave'] = !empty($context['drafts_pm_save']) && !empty($modSettings['drafts_autosave_enabled']) && allowedTo('pm_autosave_draft');
-
 	// validate with loadMemberData()
 	$memberResult = loadMemberData($user_info['id'], false);
 	if (!is_array($memberResult))
@@ -1993,10 +1989,6 @@ function messagePostError($error_types, $named_recipients, $recipient_ids = arra
 			$context['error_type'] = 'serious';
 	}
 
-	// Need to reset draft capability once again
-	$context['drafts_pm_save'] = !empty($modSettings['drafts_pm_enabled']) && allowedTo('pm_draft');
-	$context['drafts_autosave'] = !empty($context['drafts_pm_save']) && !empty($modSettings['drafts_autosave_enabled']) && allowedTo('pm_autosave_draft');
-
 	// We need to load the editor once more.
 	require_once($sourcedir . '/Subs-Editor.php');
 
@@ -2047,6 +2039,10 @@ function MessagePost2()
 
 	isAllowedTo('pm_send');
 	require_once($sourcedir . '/Subs-Auth.php');
+	
+	// PM Drafts enabled and needed? 
+	if ($context['drafts_pm_save'] && (isset($_POST['save_draft']) || isset($_POST['id_pm_draft'])))
+		require_once($sourcedir . '/Drafts.php');
 
 	loadLanguage('PersonalMessage', '', false);
 
@@ -2257,9 +2253,8 @@ function MessagePost2()
 	}
 
 	// Want to save this as a draft and think about it some more?
-	if (!empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_pm_enabled']) && isset($_POST['save_draft']))
+	if ($context['drafts_pm_save'] && isset($_POST['save_draft']))
 	{
-		require_once($sourcedir . '/Drafts.php');
 		SavePMDraft($post_errors, $recipientList);
 		return messagePostError($post_errors, $namedRecipientList, $recipientList);
 	}
@@ -2313,7 +2308,13 @@ function MessagePost2()
 
 	// Message sent successfully?
 	if (!empty($context['send_log']) && empty($context['send_log']['failed']))
+	{
 		$context['current_label_redirect'] = $context['current_label_redirect'] . ';done=sent';
+		
+		// If we had a PM draft for this one, then its time to remove it since it was just sent
+		if ($context['drafts_pm_save'] && !empty($_POST['id_pm_draft']))
+			DeleteDraft($_POST['id_pm_draft']);
+	}
 
 	// Go back to the where they sent from, if possible...
 	redirectexit($context['current_label_redirect']);

+ 6 - 2
Sources/Post.php

@@ -1202,8 +1202,8 @@ function Post2()
 	require_once($sourcedir . '/Subs-Post.php');
 	loadLanguage('Post');
 
-	// Drafts enabled?
-	if (!empty($modSettings['drafts_enabled']) && isset($_POST['save_draft']))
+	// Drafts enabled and needed?
+	if (!empty($modSettings['drafts_enabled']) && (isset($_POST['save_draft']) || isset($_POST['id_draft'])))
 		require_once($sourcedir . '/Drafts.php');
 
 	// First check to see if they are trying to delete any current attachments.
@@ -1824,6 +1824,10 @@ function Post2()
 		if (isset($topicOptions['id']))
 			$topic = $topicOptions['id'];
 	}
+	
+	// If we had a draft for this, its time to remove it since it was just posted
+	if (!empty($modSettings['drafts_enabled']) && !empty($_POST['id_draft']))
+		DeleteDraft($_POST['id_draft']);
 
 	// Editing or posting an event?
 	if (isset($_POST['calendar']) && (!isset($_REQUEST['eventid']) || $_REQUEST['eventid'] == -1))

+ 2 - 0
Sources/Subs-Editor.php

@@ -1467,6 +1467,8 @@ function create_control_richedit($editorOptions)
 	{
 		// Some general stuff.
 		$settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set'];
+		if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']))
+			$context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000;
 
 		// This really has some WYSIWYG stuff.
 		loadTemplate('GenericControls', 'jquery.sceditor');

+ 1 - 1
Themes/default/GenericControls.template.php

@@ -165,7 +165,7 @@ function template_control_richedit_buttons($editor_id)
 				sSceditorID: \'', $editor_id, '\',
 				sType: \'post\',
 				iBoard: ', (empty($context['current_board']) ? 0 : $context['current_board']), ',
-				iFreq: ', (empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000), '
+				iFreq: ', $context['drafts_autosave_frequency'], '
 			});
 		// ]]></script>';
 	}

+ 0 - 2
Themes/default/languages/Admin.english.php

@@ -559,8 +559,6 @@ $txt['managedrafts_settings'] = 'Draft Settings';
 $txt['managedrafts_settings_description'] = 'Here you can set all settings involving drafts.';
 $txt['managedrafts_submit'] = 'Save';
 $txt['manage_drafts'] = 'Drafts';
-$txt['drafts_autosave'] = 'Enable the autosaving of posts as drafts';
-$txt['drafts_autosave_frequency'] = 'How often should drafts be autosaved?';
 
 $txt['removeNestedQuotes'] = 'Remove nested quotes when quoting';
 $txt['enableEmbeddedFlash'] = 'Embed flash into posts';

+ 58 - 22
Themes/default/scripts/drafts.js

@@ -9,7 +9,10 @@ function smf_DraftAutoSave(oOptions)
 	this.oDraftHandle = window;
 	this.sLastSaved = '';
 	this.bPM = this.opt.bPM ? true : false;
-	addLoadEvent(this.opt.sSelf + '.init();');
+	this.sCheckDraft = '';
+
+	// slight delay on autosave init to allow sceditor to create the iframe
+	setTimeout('addLoadEvent(' + this.opt.sSelf + '.init())', 4000);
 }
 
 // Start our self calling routine
@@ -17,41 +20,66 @@ smf_DraftAutoSave.prototype.init = function ()
 {
 	if (this.opt.iFreq > 0)
 	{
+		// find the editors wysiwyg iframe and gets its window
+		var oIframe = document.getElementsByTagName('iframe')[0];
+		var oIframeWindow = oIframe.contentWindow || oIframe.contentDocument;
 		// start the autosave timer
-		this.interval_id = setInterval(this.opt.sSelf + '.draft' + (this.bPM ? 'PM' : '') + 'Save();', this.opt.iFreq);
+		this.interval_id = window.setInterval(this.opt.sSelf + '.draft' + (this.bPM ? 'PM' : '') + 'Save();', this.opt.iFreq);
 
 		// Set up window focus and blur events
 		this.oDraftHandle.instanceRef = this;
-		this.oDraftHandle.onblur = function (oEvent) {return this.instanceRef.draftBlur(oEvent);};
-		this.oDraftHandle.onfocus = function (oEvent) {return this.instanceRef.draftFocus(oEvent);};
+		this.oDraftHandle.onblur = function (oEvent) {return this.instanceRef.draftBlur(oEvent, true);};
+		this.oDraftHandle.onfocus = function (oEvent) {return this.instanceRef.draftFocus(oEvent, true);};
+		
+		// If we found the iframe window, set body focus/blur events for it
+		if (oIframeWindow.document) 
+		{
+			var oIframeDoc = oIframeWindow.document;
+			// @todo oDraftAutoSave should use the this.opt.sSelf name not hardcoded 
+			oIframeDoc.body.onblur = function (oEvent) {return parent.oDraftAutoSave.draftBlur(oEvent, false);};
+			oIframeDoc.body.onfocus = function (oEvent) {return parent.oDraftAutoSave.draftFocus(oEvent, false);};
+		};
 	}
 }
 
 // Moved away from the page, where did you go? ... till you return we pause autosaving
-smf_DraftAutoSave.prototype.draftBlur = function(oEvent)
+smf_DraftAutoSave.prototype.draftBlur = function(oEvent, source)
 {
-	// save what we have and turn of the autosave
-    if (this.bPM)
-        this.draftPMSave();
-    else
-        this.draftSave();
-	clearInterval(this.interval_id);
-	this.interval_id = 0;
+	if ($('#' + this.opt.sSceditorID).data("sceditor").inSourceMode() == source)
+	{
+		// save what we have and turn of the autosave
+		if (this.bPM)
+			this.draftPMSave();
+		else
+			this.draftSave();
+		
+		if (this.interval_id != "")
+			window.clearInterval(this.interval_id);
+		this.interval_id = "";
+	}
+	return;
 }
 
 // Since your back we resume the autosave timer
-smf_DraftAutoSave.prototype.draftFocus = function(oEvent)
+smf_DraftAutoSave.prototype.draftFocus = function(oEvent, source)
 {
-	this.interval_id = setInterval(this.opt.sSelf + '.draft' + (this.bPM ? 'PM' : '') + 'Save();', this.opt.iFreq);
+	if ($('#' + this.opt.sSceditorID).data("sceditor").inSourceMode() == source)
+	{
+		if (this.interval_id == "")
+			this.interval_id = window.setInterval(this.opt.sSelf + '.draft' + (this.bPM ? 'PM' : '') + 'Save();', this.opt.iFreq);
+	}
+	return;
 }
 
 // Make the call to save this draft in the background
 smf_DraftAutoSave.prototype.draftSave = function ()
 {
-	// nothing to save or already posting?
-	if (isEmptyText($('#' + this.opt.sSceditorID).data("sceditor").getText()) || smf_formSubmitted)
-		return false;
+	var sPostdata = $('#' + this.opt.sSceditorID).data("sceditor").getText(true);
 
+	// nothing to save or already posting or nothing changed?
+	if (isEmptyText(sPostdata) || smf_formSubmitted || this.sCheckDraft == sPostdata)
+		return false;
+	
 	// Still saving the last one or other?
 	if (this.bInDraftMode)
 		this.draftCancel();
@@ -65,7 +93,7 @@ smf_DraftAutoSave.prototype.draftSave = function ()
 		'topic=' + parseInt(document.forms.postmodify.elements['topic'].value),
 		'id_draft=' + parseInt(document.forms.postmodify.elements['id_draft'].value),
 		'subject=' + escape(document.forms.postmodify['subject'].value.replace(/&#/g, "&#38;#").php_to8bit()).replace(/\+/g, "%2B"),
-		'message=' + escape($('#' + this.opt.sSceditorID).data("sceditor").getText().replace(/&#/g, "&#38;#").php_to8bit()).replace(/\+/g, "%2B"),
+		'message=' + escape(sPostdata.replace(/&#/g, "&#38;#").php_to8bit()).replace(/\+/g, "%2B"),
 		'icon=' + escape(document.forms.postmodify['icon'].value.replace(/&#/g, "&#38;#").php_to8bit()).replace(/\+/g, "%2B"),
 		'save_draft=true',
 		smf_session_var + '=' + smf_session_id,
@@ -81,17 +109,22 @@ smf_DraftAutoSave.prototype.draftSave = function ()
 	}
 
 	// keep track of source or wysiwyg
-	aSections[aSections.length] = 'message_mode=' + $("#message").data("sceditor").inSourceMode();
+	aSections[aSections.length] = 'message_mode=' + $('#' + this.opt.sSceditorID).data("sceditor").inSourceMode();
 
 	// Send in document for saving and hope for the best
 	sendXMLDocument.call(this, smf_prepareScriptUrl(smf_scripturl) + "action=post2;board=" + this.opt.iBoard + ";xml", aSections.join("&"), this.onDraftDone);
+	
+	// Save the latest for compare
+	this.sCheckDraft = sPostdata;
 }
 
 // Make the call to save this PM draft in the background
 smf_DraftAutoSave.prototype.draftPMSave = function ()
 {
-	// nothing to save?
-	if (isEmptyText(document.forms.postmodify['message']))
+	var sPostdata = $('#' + this.opt.sSceditorID).data("sceditor").getText();
+	
+	// nothing to save or already posting or nothing changed?
+	if (isEmptyText(sPostdata) || smf_formSubmitted || this.sCheckDraft == sPostdata)
 		return false;
 
 	// Still saving the last one or some other?
@@ -111,7 +144,7 @@ smf_DraftAutoSave.prototype.draftPMSave = function ()
 		'replied_to=' + parseInt(document.forms.postmodify.elements['replied_to'].value),
 		'id_pm_draft=' + parseInt(document.forms.postmodify.elements['id_pm_draft'].value),
 		'subject=' + escape(document.forms.postmodify['subject'].value.replace(/&#/g, "&#38;#").php_to8bit()).replace(/\+/g, "%2B"),
-		'message=' + escape(document.forms.postmodify['message'].value.replace(/&#/g, "&#38;#").php_to8bit()).replace(/\+/g, "%2B"),
+		'message=' + escape(sPostdata.replace(/&#/g, "&#38;#").php_to8bit()).replace(/\+/g, "%2B"),
 		'recipient_to=' + aTo,
 		'recipient_bcc=' + aBcc,
 		'save_draft=true',
@@ -128,6 +161,9 @@ smf_DraftAutoSave.prototype.draftPMSave = function ()
 
 	// Send in (post) the document for saving
 	sendXMLDocument.call(this, smf_prepareScriptUrl(smf_scripturl) + "action=pm;sa=send2;xml", aSections.join("&"), this.onDraftDone);
+	
+	// Save the latest for compare
+	this.sCheckDraft = sPostdata;
 }
 
 // Callback function of the XMLhttp request for saving the draft message

+ 3 - 2
Themes/default/scripts/jquery.sceditor.bbcode.js

@@ -410,8 +410,9 @@
 		 * @return string BBCode which has been converted from HTML
 		 * @memberOf jQuery.sceditorBBCodePlugin.prototype
 		 */
-		base.getHtmlHandler = function(html, domBody) {
-			$.sceditor.dom.removeWhiteSpace(domBody[0]);
+		base.getHtmlHandler = function(html, domBody, filter) {
+			if (typeof filter == 'undefined')
+				$.sceditor.dom.removeWhiteSpace(domBody[0]);
 
 			return $.trim(base.elementToBbcode(domBody));
 		};

+ 5 - 4
Themes/default/scripts/jquery.sceditor.js

@@ -1166,7 +1166,7 @@
 			html = $body.html();
 
 			if(filter !== false && base.options.getHtmlHandler)
-				html = base.options.getHtmlHandler(html, $body);
+				html = base.options.getHtmlHandler(html, $body, filter);
 
 			return html;
 		};
@@ -3411,12 +3411,13 @@
 				this.toggleTextMode();
 
 		},
-		getText: function() {
+		getText: function(filter) {
 			var current_value = '';
+			
 			if(this.inSourceMode())
 				current_value = this.getTextareaValue(false);
 			else
-				current_value = this.getWysiwygEditorValue();
+				current_value  = this.getWysiwygEditorValue(filter);
 
 			return current_value;
 		},
@@ -3607,4 +3608,4 @@ $.sceditor.setCommand(
 		this.wysiwygEditorInsertHtml('<pre>', '</pre>');
 	},
 	'Pre'
-);
+);