<script>
var
$T = Telerik.Web.UI;
var
utils = $T.Editor.Utils;
var
isTag = utils.isTag;
var
dom = Sys.UI.DomElement;
var
addClass = dom.addCssClass;
var
removeClass = dom.removeCssClass;
var
hasClass = dom.containsCssClass;
var
$EditorModules = $T.Editor.Modules;
$EditorModules.RadEditorDomInspector.prototype.removeSelectedElement =
function
(elem) {
var
editor =
this
.get_editor();
var
tag =
function
(name) {
return
isTag(elem, name); };
var
cmd;
try
{
if
(tag(
"TD"
) || tag(
"TH"
)) {
editor.fire(
"DeleteCell"
);
}
else
if
(tag(
"TR"
)) {
var
cells = elem.getElementsByTagName(
"td"
);
if
(cells.length) {
this
.selectElement(cells[0]);
editor.fire(
"DeleteRow"
);
}
}
else
if
(tag(
"TABLE"
) || tag(
"TBODY"
) || tag(
"THEAD"
) || tag(
"TFOOT"
) ||
tag(
"EMBED"
) || tag(
"OBJECT"
) ||
tag(
"INPUT"
) ||
tag(
"IMG"
) ||
tag(
"HR"
) ||
tag(
"STYLE"
)) {
cmd =
new
Telerik.Web.UI.Editor.GenericCommand(
this
._removeElementString, editor.get_contentWindow(), editor);
window.setTimeout(
function
() {
elem.parentNode.removeChild(elem);
editor.setFocus();
editor.executeCommand(cmd);
editor.raiseEvent(
"selectionChange"
);
}, 0);
}
else
if
(elem !== editor.get_contentArea()) {
cmd =
new
Telerik.Web.UI.Editor.GenericCommand(
this
._removeElementString, editor.get_contentWindow(), editor);
Telerik.Web.UI.Editor.Utils.removeNode(elem);
editor.setFocus();
editor.executeCommand(cmd);
}
}
catch
(ex) { }
editor.raiseEvent(
"selectionChange"
);
}
</script>
<telerik:RadEditor ID=
"RadEditor1"
runat=
"server"
></telerik:RadEditor>