Completed
Last Updated: 20 Sep 2016 14:44 by conall
ADMIN
Marin Bratanov
Created on: 12 Sep 2016 12:45
Category: Editor
Type: Bug Report
2
Deleting <th> contents deletes the <th> elements
			<telerik:RadEditor ID="RadEditor1" runat="server">
				<Content>
				select and delete some of the "th" content, the entire cell element will be deleted instead of its content
					<table>

						<thead>
							<tr>
								<th>th1</th>
								<th>th2</th>
								<th>th3</th>
							</tr>
						</thead>

						<tr>
							<td>1</td>
							<td>2</td>
							<td>3</td>
						</tr>

					</table>
				</Content>
			</telerik:RadEditor>
			<script>
				//workaraound

				Telerik.Web.UI.Editor.DeleteSelectionCommand.prototype.deleteNodeContent = function (node) {
					var utils = Telerik.Web.UI.Editor.Utils;
					if (utils.isTag(node, "td") || utils.isTag(node, "th")) {
						utils.removeChildren(node);
						node.innerHTML = NBSP;
					} else {
						remove(node);
					}
				}
				
				function remove(node) {
					node.parentNode.removeChild(node);
				}
			</script>
2 comments
conall
Posted on: 12 Sep 2016 15:50
we should include the caption in the workaround -       Telerik.Web.UI.Editor.DeleteSelectionCommand.prototype.deleteNodeContent = function (node) {
         var elements = ['td', 'caption', 'th'];
         if (~elements.indexOf(node.tagName.toLowerCase())) {
            Telerik.Web.UI.Editor.Utils.removeChildren(node);
            node.innerHTML = '&nbsp;';
         } else {
            node.parentNode.removeChild(node);
         }
      };
Tomas
Posted on: 12 Sep 2016 15:49
deleted by brian.ahearne