EditSource.js
Summary
This module allows editing of the HTML/XML source ofthe current element.
Version: 0.7.0
Author: Grant Gredvig
MozileMediator.prototype.getEditSourceInterface = function() {
if(!this._iface) {
this._iface = new MozileInterface(
this.getRoot()+"modules/EditSource/edit.xml",
"MozileAboutInterface: width=450px");
this._iface.init = function() { }
this._iface.Apply = function() {
this._editElement.innerHTML =
document.getElementById("sourceEditor").value;
}
}
return this._iface;
}
mozile.getModule("EditSource").init = function() {
var but = mozile.getCommandList().createCommand(
"MozileCommand: id=Mozile-EditSource, label='Edit Source', image='"+
mozile.getRoot()+"images/edit-source.png', "+
"tooltip='Edit the source code of the current element', accelerator='Command-Alt-E'");
but.execute = function(event) {
var a = mozile.getEditSourceInterface();
a.show();
var selection = window.getSelection();
var range = selection.getRangeAt(0);
var container = range.commonAncestorContainer;
if(container.nodeType==3) container = container.parentNode;
a._editElement = container;
document.getElementById("sourceEditor").value = container.innerHTML;
return true;
}
}
Documentation generated by
JSDoc on Wed Nov 1 15:37:30 2006