Dear Wiki user, You have subscribed to a wiki page or wiki category on "Lenya Wiki" for change notification.
The following page has been changed by JörnNettingsmeier: http://wiki.apache.org/lenya/GenericEditorAPI ------------------------------------------------------------------------------ <img src="imagebutton.gif" onclick="window.open('?lenya.usecase=editors.insertImage)" /><br /> }}} - The following objects (defined in {{{src/modules/editors/resources/javascript/org.apache.lenya.Editors.js}}}) are used for data exchange between the editor and the generic usecases: + The following data structure is used for data exchange between the editor and the generic usecases: {{{ - var org.apache.lenya.editors; // keep the global namespace clean! - org.apache.lenya.editors.prototype.LinkData = function() { + org.apache.lenya.editors.ObjectData = function() { - this.setHref = function(href) { this.href = href }; - this.getHref = function() { return this.href }; - this.setTitle = function(title) { this.title = title }; - this.getTitle = function() { return this.title }; - this.setText = function(text) { this.text = text }; - this.getText = function() { return this.text }; + this.url : "", // href for links, src for assets and images + this.title : "", // xhtml title attribute + this.text : "", // element content for links and assets, alt text for images + this.width : "", // width for images + this.height : "", // height for images + this.type : "" // MIME Type for images and assets, "link" for links. } + + var myObjectData = new org.apache.lenya.editors.ObjectData(); - org.apache.lenya.editors.prototype.ImageData = function() { - this.setSrc = function(src) { this.src = src }; - this.getSrc = function() { return this.src }; - this.setTitle = function(title) { this.title = title }; - this.getTitle = function() { return this.title }; - this.setHeight = function(height) { this.height = height }; - this.getHeight = function() { return this.height }; - this.setWidth = function(width) { this.width = width }; - this.getWidth = function() { return this.width }; - this.setMimeType = function(mimeType) { this.mimeType = mimeType }; - this.getMimeType = function() { return this.mimeType }; - } - org.apache.lenya.editors.prototype.AssetData = function() { - this.setSrc = function(src) { this.src = src }; - this.getSrc = function() { return this.src }; - this.setTitle = function(title) { this.title = title }; - this.getTitle = function() { return this.title }; - this.setMimeType = function(mimeType) { this.mimeType = mimeType }; - this.getMimeType = function() { return this.mimeType }; - } }}} - You can obtain your own object instance by including that file and executing - {{{ - var myLinkData = new org.apache.lenya.editors.LinkData(); - myLinkData.setHref("http://www.example.com"); - }}} Each editor module that wishes to use the generic usecase implementations '''must''' provide the respective callbacks in the context of the opening window: {{{ - function org.apache.lenya.editors.callbacks.getLinkData() { + function org.apache.lenya.editors.getObjectData() { - return <some org.apache.lenya.editors.LinkData object>; + return <some org.apache.lenya.editors.ObjectData object>; }; - function org.apache.lenya.editors.callbacks.setLinkData(linkData) {}; - - function org.apache.lenya.editors.Callbacks.getImageData() { - return <some org.apache.lenya.editors.ImageData object>; - }; - - function org.apache.lenya.editors.callbacks.setImageData(imageData) {}; - - function org.apache.lenya.editors.Callbacks.getAssetData() { - return <some org.apache.lenya.editors.AssetData object>; - }; - - function org.apache.lenya.editors.callbacks.setAssetData(assetData) {}; + function org.apache.lenya.editors.setObjectData(objectData) {}; }}} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
