You are not logged in.
#1 2006-07-14 14:20:49
- narent
- Member
- Registered: 2006-07-14
- Posts: 2
TinyMCE FileBrowserCallBack Customize implementation
http://geekswithblogs.net/narent/archiv … 85195.aspx
please use above link to get the complete detail for customizing and implemeting fileBrowseCallback function using TinyMCE examples.
cheers--Naren
Offline
#2 2006-07-14 22:54:24
- Felix Riesterer
- Administrator
- From: Germany
- Registered: 2005-12-30
- Posts: 3901
- Website
Re: TinyMCE FileBrowserCallBack Customize implementation
narent wrote:
http://geekswithblogs.net/narent/archive/2006/07/14/85195.aspx
This link has very sketchy information on how to implement a custom file browser!
narent wrote:
please use above link to get the complete detail for customizing and implemeting fileBrowseCallback function using TinyMCE examples.
No, you better don't because it doesn't really tell you how to insert the information returned by your own custom file browser window into TinyMCE's dialogue window fields!
I once helped a member of this forum with this kind of problem in another thread: http://tinymce.moxiecode.com/punbb/view … hp?id=2276
We should make a sticky thread describing this feature or extend TinyMCE's documentation with a more elaborate description on this matter.
Greetings from Germany,
Felix Riesterer.
Last edited by Felix Riesterer (2006-07-17 16:57:14)
Offline
#3 2006-07-24 07:08:47
- narent
- Member
- Registered: 2006-07-14
- Posts: 2
Re: TinyMCE FileBrowserCallBack Customize implementation
Right Felix I forgot to add that bit u are talking about... Finally I added it...
http://geekswithblogs.net/narent/archiv … 85195.aspx
Please post ur comment on this whether it is OK now..
Offline
#4 2006-08-06 12:03:01
- Felix Riesterer
- Administrator
- From: Germany
- Registered: 2005-12-30
- Posts: 3901
- Website
Re: TinyMCE FileBrowserCallBack Customize implementation
I finally managed to write a more elaborate How-To on this matter.
As there already is a Wiki set up for all TinyMCE-related stuff I decided to put it there.
How do you like it?
Greetings from Germany,
Felix Riesterer.
Offline
#5 2006-08-20 19:53:15
- sehmaschine
- Member
- Registered: 2006-08-20
- Posts: 27
Re: TinyMCE FileBrowserCallBack Customize implementation
hello felix,
fine documentation about integrating a custom file-browser.
still, I do get a js-error.
win.document has no properties, referring to the following line of your script:
win.document.getElementById(field_name).value = URL;
I followed your steps and Iīm not sure whatīs the cause.
any ideas?
thanks,
patrick
Offline
#6 2006-08-21 04:34:13
- Felix Riesterer
- Administrator
- From: Germany
- Registered: 2005-12-30
- Posts: 3901
- Website
Re: TinyMCE FileBrowserCallBack Customize implementation
Hi sehmaschine!
Your nick seems German to me... ;-)
sehmaschine wrote:
still, I do get a js-error.
win.document has no properties
Well, doesn't this sound like one of those most explanatory JS error messages returned by this junk pile of a browser called "Internet Explorer"...?
sehmaschine wrote:
, referring to the following line of your script:
win.document.getElementById(field_name).value = URL;
I followed your steps and Iīm not sure whatīs the cause.
Neither am I. By the way: I've updated some code in this documentation. The JavaScript function you refer to is the following which I improved a little bit:
Code:
function mySubmit() {
var URL = document.my_form.my_field.value;
var win = tinyMCE.getWindowArg("window");
// insert information now
win.document.getElementById(tinyMCE.getWindowArg("input")).value = URL;
// for image browsers: update image dimensions
if (win.getImageData) win.getImageData();
// close popup window
tinyMCEPopup.close();
}If your "win" still has "no properties" I'd suggest you try to add some alert instructions that tell a bit more about this "win"-object. Maybe using Firefox might help, too, because it has vastly more informative error messages than IE!
If you can't do this, then maybe you would like to give us more of your code... a link to your test site maybe even? I hate to guess if it isn't really neccessary. ;-)
Greetings from Germany,
Felix Riesterer.
Offline
#7 2006-08-21 10:28:01
- sehmaschine
- Member
- Registered: 2006-08-20
- Posts: 27
Re: TinyMCE FileBrowserCallBack Customize implementation
Iīm already using firefox (on OS X) - no IE whatsoever. and Iīve used your updated instructions.
not able to send a link because itīs an admin-page with restricted access.
hereīs some details:
- when I open the filebrowser the advimage-window is closed (yes, Iīm using advimage - but that shouldnīt be the problem, I guess)
- tinyMCEPopup.close(); doesnīt work
- I donīt know if I need this <body onload="tinyMCEPopup.executeOnLoad('init();')"> in my custom filebrowser - however, it doesnīt make any difference whether I use it or not
- another error-message: tinyMCE object reference not found from popup
- this is the href-tag for opening the filebrowser: javascript:openBrower('srcbrowser','src', 'image','advimage_image_browser_callback');
greetings from austria,
patrick
Offline
#8 2006-08-21 14:01:33
- ericmulder
- Member
- Registered: 2006-08-18
- Posts: 3
Re: TinyMCE FileBrowserCallBack Customize implementation
Hi there,
very nice article, it was just what i was looking for.. except for one small thing. I want to use and change the advlink plugin and use my custom upload tool inside the advlink form. So i add a button for uploading and call a function onClick(). The Uploadtool i am using is FilePicker (.net). Somehow when i use the above script to open the FilePicker.aspx, it closes the parent window, which is the advlink window.
If i just open the Filepicker.aspx with a window.open(...) is works ok but i get no postback into my form. Any suggestions?
Offline
#9 2006-08-21 18:13:32
- Felix Riesterer
- Administrator
- From: Germany
- Registered: 2005-12-30
- Posts: 3901
- Website
Re: TinyMCE FileBrowserCallBack Customize implementation
Hi sehmaschine and ericmulder,
I really don't understand why your advlink or advimage windows are CLOSED??? Isn't it the browse button in these dialogue windows which triggers the extra window for the filebrowser in the first place?
Well, if the original dialogue window is closed, none of my described methods will work since there is no opener (or parent) left. And I say it again: If you don't use tinyMCE.openWindow() to open your extra window and tinymce_popup.js (and tinyMCEPopup.close() to close it again) in it, then there isn't a chance to get back to the editor!
Work on your implementations so the dialogue window (be it advlink or advimage or some other - I still use the very basic link and image windows...) survives the custom filebrowser call!!!
It might help NOT to use modal windows for your filebrowser window!
I must add that my way doesn't work in Opera 9 (is it the inline popups plugin?) and I haven't got a clue as to why.
Greetings from Germany,
Felix Riesterer.
Offline
#10 2006-08-25 13:13:07
- warath
- Member
- Registered: 2006-08-25
- Posts: 2
Re: TinyMCE FileBrowserCallBack Customize implementation
Felix Riesterer: Great document, however, it does not seem to work anymore with the newest version of tinyMCE.
When I use your document to create a custom filebrowswercallback, then link window closes when I click the "file browser" icon, and therefore messes with the call back. If I use a window.open, everything works fine.
I use the newest Firefox (1.5.0.6).
Offline
#11 2006-08-30 12:22:20
- radio4fan
- Member
- Registered: 2006-08-30
- Posts: 1
Re: TinyMCE FileBrowserCallBack Customize implementation
I had the same problem as warath: the openWindow call was closing the image properties window.
I fixed this by setting the 'close_previous' property of the window template to 'no'.
In the wiki example, change:
Code:
fileBrowserWindow['width'] = '420';
fileBrowserWindow['height'] = '400';
tinyMCE.openWindow(fileBrowserWindow, {
...to
Code:
fileBrowserWindow['width'] = '420';
fileBrowserWindow['height'] = '400';
fileBrowserWindow['close_previous'] = 'no';
tinyMCE.openWindow(fileBrowserWindow, {
...Voila!
Offline
#12 2006-08-30 13:35:05
- warath
- Member
- Registered: 2006-08-25
- Posts: 2
Re: TinyMCE FileBrowserCallBack Customize implementation
Fantastick radio4fan! Felix Riesterer: great speed at updating your document!
Thank you both.
Offline
#13 2006-08-31 02:06:32
- Felix Riesterer
- Administrator
- From: Germany
- Registered: 2005-12-30
- Posts: 3901
- Website
Re: TinyMCE FileBrowserCallBack Customize implementation
I didn't update anything this time. Credits for the update must go to Radio4fan (see edit hisory)!
EDIT: This extra setting helps very much. My custom file browser now works in Opera9 as well. ![]()
Last edited by Felix Riesterer (2006-09-08 12:43:58)
Offline
#14 2006-09-08 10:07:27
- RW_moxiecode.com
- Member
- Registered: 2006-09-07
- Posts: 5
Re: TinyMCE FileBrowserCallBack Customize implementation
Hi,
I am trying to do two things and have looked at your comments and posts above and still can't get them to work.
I simply want to override the standard image button and manipulate the return values once the pop up has closed.
I have tried to implement a custom file browser call back, but it never fires?
I've also tried to use insertimage_callback and then found that it recommends you use execcommand_callback instead.
I tried using execcommand_callback and I got this to work.
I want to understand what I have done wrong, here's my init below...I must have made a simple mistake but can't see it? Any pointers.....
Code:
tinyMCE.init( {
relative_urls : false,
theme : "advanced",
mode : "textareas",
file_browser_callback : "mceImage.fileBrowserCallBack",
content_css : "../../../css/wysiwyg.css",
force_br_newlines : true,
plugins : "paste",
theme_advanced_buttons0 : "",
theme_advanced_buttons1 : "code,bold,italic,underline,justifyleft,justifycenter,justifyright,justifyfull,separator,sub,sup,charmap,separator,bullist,numlist,separator,link,unlink,separator,image,separator,styleselect,removeformat",
theme_advanced_buttons2 : "",
paste_create_paragraphs : true,
paste_create_linebreaks : true,
paste_use_dialog : true,
paste_auto_cleanup_on_paste : true,
paste_convert_middot_lists : true,
paste_unindented_list_class : "unindentedList",
paste_convert_headers_to_strong : true
} );
function fileBrowserCallBack(field_name, url, type, win) {
//function here
}Offline
#15 2006-09-08 12:39:01
- Felix Riesterer
- Administrator
- From: Germany
- Registered: 2005-12-30
- Posts: 3901
- Website
Re: TinyMCE FileBrowserCallBack Customize implementation
Hi!
In your tinyMCE.init() you define:
file_browser_callback : "mceImage.fileBrowserCallBack"
yet you intend to define your own callback function as
function fileBrowserCallBack(field_name, url, type, win)
and thus TinyMCE will not use the latter but look for an object called "mceImage" and use its method "fileBrowserCallBack()" which of course isn't your function defined below tinyMCE.init().
Understood?
Greetings from Germany,
Felix Riesterer.
Offline
#16 2006-09-09 07:09:09
- RW_moxiecode.com
- Member
- Registered: 2006-09-07
- Posts: 5
Re: TinyMCE FileBrowserCallBack Customize implementation
thanks Felix, I removed the 'mceImage' part of the call so its now just
Code:
file_browser_callback : "fileBrowserCallBack"
however when I click on the 'insert/edit image' button my function doesn't fire, the default function associated with the command 'mceImage' still fires?
do i need to define a custom button?
regards
Ralph
Offline
#17 2006-09-09 12:08:49
- Felix Riesterer
- Administrator
- From: Germany
- Registered: 2005-12-30
- Posts: 3901
- Website
Re: TinyMCE FileBrowserCallBack Customize implementation
have you emptied your browser's cache???
Offline
#18 2006-09-10 06:55:26
- RW_moxiecode.com
- Member
- Registered: 2006-09-07
- Posts: 5
Re: TinyMCE FileBrowserCallBack Customize implementation
I emptied the browser cache and tried again, still no luck. It still fires the default function as I have some debugging in there.
It ignores my callback and runs the function execCommand : function(editor_id, element, command, user_interface, value) located in editor_template_src.js on line 154.
Do I need a special button to do this?? i am trying to override the button as define by 'image' in the advanced themes toolbar.
Offline
#19 2006-09-10 15:49:55
- Felix Riesterer
- Administrator
- From: Germany
- Registered: 2005-12-30
- Posts: 3901
- Website
Re: TinyMCE FileBrowserCallBack Customize implementation
I think I now understand your misunderstanding! ![]()
Clicking the insert/image or insert/link button will indeed NOT fire your file browser. It will open a dialogue window instead in which you are offered a browse button. Clicking this very browse button will then fire your custom function.
Overriding the default "behaviour" (which is indeed the mceInsertImage command) would need something like a plugin (like advimage) or altering the theme-specific default action if no plugin is specified .
You can now live with the additional dialogue window between the editor and your custom filebrowser or you can change the mceInsertlink and/or mceInsertImage command action. Suit yourself!
Greetings from Germany,
Felix Riesterer.
Offline
#20 2006-09-13 10:27:31
- RW_moxiecode.com
- Member
- Registered: 2006-09-07
- Posts: 5
Re: TinyMCE FileBrowserCallBack Customize implementation
thanks Felix, it makes sense now.
I've got my code to work by hacking the tinymce source but I might make a plugin to make it neater.
I've been using tinymce with .Net, so I will write up how I got it to work and put it up on the Wiki.![]()
Offline
#21 2007-03-02 16:35:02
- yudi
- Member
- Registered: 2007-03-02
- Posts: 5
Re: TinyMCE FileBrowserCallBack Customize implementation
Hi,
anyone got this error __EVENTTARGET is null or not an object in IE? I'm using asp .net, this error occured on the filebrowserpage. Same issue here http://forums.asp.net/thread/1284342.aspx.
thanks
Offline
#22 2007-03-06 17:43:24
- yudi
- Member
- Registered: 2007-03-02
- Posts: 5
Re: TinyMCE FileBrowserCallBack Customize implementation
this all never works with .net
Offline
#23 2007-03-06 19:04:11
- Overload
- Member
- From: Germany
- Registered: 2007-02-16
- Posts: 99
Re: TinyMCE FileBrowserCallBack Customize implementation
It also works with .NET.
Overload
Offline
#24 2007-03-08 22:00:07
- yudi
- Member
- Registered: 2007-03-02
- Posts: 5
Re: TinyMCE FileBrowserCallBack Customize implementation
yeah, any idea why this happened http://forums.asp.net/thread/1284342.aspx ?
I have gridview in the filebrowser page to let user pick the existing page. everytime i include the tinymce script for popup, all buttons (select button, paging button, etc) does not work with the error __EVENTTARGET is null.
Offline
#25 2007-03-12 14:57:18
- yudi
- Member
- Registered: 2007-03-02
- Posts: 5
Re: TinyMCE FileBrowserCallBack Customize implementation
see ... this never worked. Es funktioniert einfach nicht und keine weiss was es ist.
Offline
© 2003-2010