17223554 : xquared upgrade to 0.7

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4968 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2008-11-24 08:52:19 +00:00
parent 5956e254e7
commit 7c3b336e41
59 changed files with 34562 additions and 8454 deletions

View file

@ -0,0 +1,66 @@
/**
* @requires Xquared.js
* @requires Browser.js
* @requires Editor.js
* @requires plugin/Base.js
* @requires ui/Control.js
* @requires macro/Factory.js
* @requires macro/JavascriptMacro.js
*/
xq.plugin.JavascriptMacroPlugin = xq.Class(xq.plugin.Base,
/**
* @name xq.plugin.JavascriptMacroPlugin
* @lends xq.plugin.JavascriptMacroPlugin.prototype
* @extends xq.plugin.Base
* @constructor
*/
{
onAfterLoad: function(xed) {
xed.config.macroIds.push("Javascript");
xed.config.defaultToolbarButtonGroups.insert.push(
{className:"script", title:"Script", handler:"xed.handleScript()"}
)
xed.handleInsertScript = function(url) {
var params = {url: url};
var macro = this.macroFactory.createMacroFromDefinition({id:"Javascript", params:params});
if(macro) {
var placeHolder = macro.createPlaceHolderHtml();
this.rdom.insertHtml(placeHolder);
var historyAdded = this.editHistory.onCommand();
this._fireOnCurrentContentChanged(this);
} else {
alert("Unknown URL pattern");
}
return true;
};
xed.handleScript = function() {
var dialog = new xq.ui.FormDialog(
this,
xq.ui_templates.basicScriptDialog,
function(dialog) {},
function(data) {
this.focus();
if(xq.Browser.isTrident) {
var rng = this.rdom.rng();
rng.moveToBookmark(bm);
rng.select();
}
// cancel?
if(!data) return;
this.handleInsertScript(data.url);
}.bind(this)
);
if(xq.Browser.isTrident) var bm = this.rdom.rng().getBookmark();
dialog.show({position: 'centerOfEditor'});
return true;
}
}
});