Completed
Last Updated: 28 Jul 2015 08:17 by ADMIN
ADMIN
Ianko
Created on: 13 Oct 2014 08:48
Category: UI for ASP.NET AJAX
Type: Bug Report
1
Aligning of selected text in table does not work correct and consistent across the major browsers
When trying to align selected text in a table, not all cells are being aligned correctly under IE and Chrome. In Firefox only one table cell is being applied with the chosen modification and not the selected text.  

Under IE and Chrome, when a table row element is in the selection, the child td elements are not processed by the Align command.

Under FF when the table text is selected, the selected element is only the first TD element. 

The problem under IE and Chrome could be resolved using the following override of the executeOnNode():

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

<script type="text/javascript">
	Telerik.Web.UI.Editor.AlignCommand.prototype.executeOnNode = function (node) {
		var utils = Telerik.Web.UI.Editor.Utils;

		if (utils.isTag(node, "table"))
			return;//prevent alignment of tables since this has no effect in browsers.

		if (utils.isTag(node, "tr")) {
			var nodes = node.childNodes;
			var nodeArr = [];

			for (var i = 0; i < nodes.length; i++) {
				nodeArr.push(nodes[i]);
			}

			while (nodeArr.length) {
				var childNode = nodeArr.shift();
				if (this.isSuitableNode(childNode))
					this.executeOnNode(childNode);
				else
					this.executeInlineNode(childNode);
			}

			return;
		}

		if (utils.isTag(node, "ul") || utils.isTag(node, "ol"))
			return this.executeDomCommand($.makeArray(node.children));

		if (utils.isTag(node, "img")) {
			if (this.nodes.length == 0 && this.canAlignImage()) {
				if (this.options.align == "none")
					this.alignBlock(this.getBlockContainer(node));

				return this.alignImage(node);
			}
			else {
				this.removeImageAlign(node);

				var imageContainer = this.getBlockContainer(node);
				if (imageContainer != node)
					this.executeOnNode(imageContainer);
				else
					return this.executeInlineNode(node);
			}
		}

		this.alignBlock(node);
	};
</script>
2 comments
ADMIN
Ianko
Posted on: 14 Oct 2014 11:35
Thank you for the feedback. 

Indeed, the same issue under FF cannot be resolved with the provided workaround. The problem there is related to the native browser functionality of handling table selections and it is quite a complex matter that cannot be easily handled via simple, temporary fix. 

I updated further the information about the workaround.

Regards,
Ianko
Jose Antonio de Alarcon
Posted on: 14 Oct 2014 09:25
Thanks a lot!. This solve the problem with my large tables :).
In FF seem´s don´t Works.

Best Regards,
Jose A.