Hi I have a few questions about CKEditor and any help would be greatly appreciated.
- Can I insert a module so that any link to a certain site (let's say UTube) can be specifically formated - for example if inserting a UTube link the user would get a pop up which would ask for the time in minutes and seconds where they'd like the video to start from? The link would then be stripped and formatted accordingly. Would this be possible and what would it entail to have the pop-up come up automatically when the youtube link gets pasted in? If not, then maybe a button that can be pressed when you want to insert a certain type of link etc... I saw several plugins but they don't really help because it doesn't seem they can be customized... Let me explain: I don't want a youtube plugin - I want to have the link parsed the way I want it. I hope this makes sense.... NOT looking for things to insert iframes etc or do other things (this for example would be useless for me: http://ckeditor.com/addon/youtube).... just something that I can use to format the link the way I want to and eventually add to it something like &t=1m3s etc... but not just for Utube, that was just ONE example. I hope I was clear - if not please ask.
- The other question is a bit more simple: Can I remove and block certain formatting. For example I'd like to remove direct HTML code entry access and allow ONLY p, h1, h2 and ul - no other tags. Would this be possible? Thank you.
I'm new to CKEditor and had been using Tiny MCE up until now - so any help or heads up would be greatly appreciated.
Thank You.
Modify link plugin, or use browse button.
For your first point, you could modify the link plugin's link.js, but this first needs to be decompressed or got from the source as it's in compressed format.
The other option is to use the 'browse server' button on the URL dialog.
The file called when the 'browse server' button is clicked is determined in ck_config.js, or by
filebrowserBrowseUrl : 'example.php', in your ckeditor call's parameters.
This calls an external page, opened in a popup, which performs user interaction then returns a value by calling the javascript window.opener.CKEDITOR.tools.callFunction(ck_callback,fileSelected); and where fileSelected is the return value. Note that your external routine doesn't necessarily have to browse the server, it can take input from a dialog, form or whatever. With a bit of ingenuity you could combine browsing local files and entering special URLs.
For your second point, look up how to remove items from the toolbar by using a custom ck_config.js This isn't bulletproof but should constrain users to the specified tags for most purpsoes.
if using a config object ...
On your second point, I am fairly certain setting the allowedContent property, of the config object, to the tags you want will not only limit input to those tags but remove most of the relevant toolbar buttons from a full toolbar setup. For example:
I thre in an li (list item) tag because you won't get too far with an empty ul alone, I don't think :)
Re your first point, I'd suggest customizing the link dialog. It would take a bit of fiddling about, probably too much to write for you in a forum reply.