Completed
Last Updated: 14 Sep 2021 10:19 by ADMIN
Release Q2 2015
ADMIN
Ianko
Created on: 02 Jul 2014 07:27
Category: UI for ASP.NET AJAX
Type: Bug Report
0
The RadEditor Statistics module counts words and characters incorrectly when CSS styles are added directly in the content area
This causes incorrect behavior. The STYLE tags should be removed along with the get_text method.
The origin of this problem is the behavior of the get_text method of the RadEditor control.

The following workaround can be used as a workaround for this issue. The implemented resolution is related to another logged bug - http://feedback.telerik.com/Project/108/Feedback/Details/119856

<telerik:RadEditor runat="server" ID="RadEditor1">
</telerik:RadEditor>

<script type="text/javascript">
	Telerik.Web.UI.RadEditor.prototype.get_text = function () {
		var $T = Telerik.Web.UI,
			modeEnum = $T.EditModes,
			oContent = "";

		if (this.get_mode() != modeEnum.Html) {
			var oArea = this.get_contentArea();
			if (oArea) {
				oContent = oArea.innerHTML;
				oContent = oContent.replace(/<br>/ig, "\r\n");
				oContent = oContent.replace(/<\/p>/gi, "\r\n");
				oContent = oContent.replace(/&nbsp;/gi, "\s");
				if (this.get_newLineMode() === $T.EditorNewLineModes.Div) {
					oContent = oContent.replace(/<\/div>/gi, "\r\n");
				}

				oContent = oContent.replace(/\s*<div[^>]*style="display:none;"[^>]*>[^>]*>\s*/gi, "");
				oContent = oContent.replace(/\s*<style[^>]*>[^>]*>\s*/gi, " ");

				oContent = oContent.replace(/<\/?[^>]*>/ig, "");
				oContent = oContent.replace(/<!--(.|\s)*?-->/gi, "");
			}
		}
		else {
			oContent = this._getTextArea().value;
			oContent = oContent.replace(/\s*<style[^>]*>[^>]*>\s*/gi, " ");
			oContent = oContent.replace(/<\/?[^>]*>/ig, "");
		}
		return oContent;
	};
</script>
1 comment
Laurie
Posted on: 11 Jul 2014 16:53
Will this update to get_text be implemented in a future version of RadEditor?  If so, any way to get word about it?