Código:
Esta es la llamada que se hace en el origen y no se muy bien como volver a lanzarla./** * class SlimeyInsertImageTool - this tool inserts new images into the editor */ var SlimeyInsertImageTool = function(slimey) { /* create the DOM element that represents the tool (a clickable image) */ var img = createImageButton('insertImage', lang("insert image"), this); SlimeyTool.call(this, 'insertImage', img, slimey); } /** * SlimeyInsertImageTool extends SlimeyTool */ SlimeyInsertImageTool.prototype = new SlimeyTool(); /** * inserts a new image into the editor */ SlimeyInsertImageTool.prototype.execute = function() { chooseImage(this.imageChosen, this, this.element); } SlimeyInsertImageTool.prototype.imageChosen = function(url) { if (url) { var action = new SlimeyInsertAction(this.slimey, 'img'); action.getElement().src = url; this.slimey.editor.performAction(action); } }
Código:
Esta es la funcion chooseImage lanza la ventana pones la url de la imagen y la inserta, yo lo que he intentado hacer es llamar a la chooseImage desde otro script, el problema es que los parametros no son los correctos me falla ese scope, si alguien me pudiera ayudar estoy un poco perdido.function chooseImage(func, scope, button) { var url = prompt(lang("enter the url of the image") + ":", "images/sample.png"); func.call(scope, url); }
Un saludo y gracias.