Completed
Last Updated: 26 Aug 2015 15:53 by ADMIN
ADMIN
Nikolay
Created on: 24 Jul 2015 14:17
Category: UI for ASP.NET AJAX
Type: Bug Report
0
RadEditor's default context menu does not show up when TrackChanges functionality has been enabled
Workaround:
<telerik:RadEditor ID="radEditor1" runat="server" EnableTrackChanges="true"
	TrackChangesSettings-CanAcceptTrackChanges="true">
	<Content>
		<table>
			<tbody>
				<tr>
					<td>test</td>
					<td>test</td>
				</tr>
			</tbody>
		</table>
		<p>test paragraph</p>
	</Content>
</telerik:RadEditor>

<script type="text/javascript">
	(function ($T) {
		var prototype = $T.Editor.DefaultToolAdapter.prototype;
		var onContextMenu = prototype.onContextMenu;
		prototype.onContextMenu = function (e) {
			var editor = this.get_editor();
			if (!editor.get_enableTrackChanges()) {
				return onContextMenu.call(this, e);
			}
			if (!this._contextMenusEnabled || editor.get_mode() != $T.EditModes.Design) {
				return;
			}

			this.createContextMenus();
			var element = editor.getSelectedElement() || e.srcElement;
			var contextMenus = this._contextMenus;
			var contextElement = $T.Editor.Utils.getElementParentByCondition(element, function (node) {
				return !!contextMenus[node.nodeName];
			});
			var contextMenuId = contextElement ? contextElement.nodeName : "*";
			var parentTrackChangeEl = $T.Editor.TrackChangesUtils.findTrackChangesParentElement(element);
			if (parentTrackChangeEl) {
				if (parentTrackChangeEl.Type == $T.Editor.TrackChangesElementType.Comment)
					contextMenu = this.createContextMenuWithTrackChangeCommentItems(contextMenuId);
				else
					contextMenu = this.createContextMenuWithTrackChangeItems(contextMenuId);
			}
			else {
				contextMenu = this.createContextMenuWithTrackChangeDefaultItems(contextMenuId) || contextMenus[contextMenuId];
			}
			if (contextMenu) {
				contextMenu.set_eventObject(e);
				contextMenu.show();
			}
			return $telerik.cancelRawEvent(e);
		};
	})(Telerik.Web.UI)
</script>
0 comments