annotate media/js/tiny_mce/plugins/advlink/editor_plugin_src.js @ 169:7071b196ddd5

Implement #54; add a forum query to display a user's posts.
author Brian Neal <bgneal@gmail.com>
date Sun, 31 Jan 2010 04:52:08 +0000
parents a5b4c5ce0658
children 149c3567fec1
rev   line source
bgneal@45 1 /**
bgneal@45 2 * $Id: editor_plugin_src.js 539 2008-01-14 19:08:58Z spocke $
bgneal@45 3 *
bgneal@45 4 * @author Moxiecode
bgneal@45 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
bgneal@45 6 */
bgneal@45 7
bgneal@45 8 (function() {
bgneal@45 9 tinymce.create('tinymce.plugins.AdvancedLinkPlugin', {
bgneal@45 10 init : function(ed, url) {
bgneal@45 11 this.editor = ed;
bgneal@45 12
bgneal@45 13 // Register commands
bgneal@45 14 ed.addCommand('mceAdvLink', function() {
bgneal@45 15 var se = ed.selection;
bgneal@45 16
bgneal@45 17 // No selection and not in link
bgneal@45 18 if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))
bgneal@45 19 return;
bgneal@45 20
bgneal@45 21 ed.windowManager.open({
bgneal@45 22 file : url + '/link.htm',
bgneal@45 23 width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),
bgneal@45 24 height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),
bgneal@45 25 inline : 1
bgneal@45 26 }, {
bgneal@45 27 plugin_url : url
bgneal@45 28 });
bgneal@45 29 });
bgneal@45 30
bgneal@45 31 // Register buttons
bgneal@45 32 ed.addButton('link', {
bgneal@45 33 title : 'advlink.link_desc',
bgneal@45 34 cmd : 'mceAdvLink'
bgneal@45 35 });
bgneal@45 36
bgneal@45 37 ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');
bgneal@45 38
bgneal@45 39 ed.onNodeChange.add(function(ed, cm, n, co) {
bgneal@45 40 cm.setDisabled('link', co && n.nodeName != 'A');
bgneal@45 41 cm.setActive('link', n.nodeName == 'A' && !n.name);
bgneal@45 42 });
bgneal@45 43 },
bgneal@45 44
bgneal@45 45 getInfo : function() {
bgneal@45 46 return {
bgneal@45 47 longname : 'Advanced link',
bgneal@45 48 author : 'Moxiecode Systems AB',
bgneal@45 49 authorurl : 'http://tinymce.moxiecode.com',
bgneal@45 50 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
bgneal@45 51 version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@45 52 };
bgneal@45 53 }
bgneal@45 54 });
bgneal@45 55
bgneal@45 56 // Register plugin
bgneal@45 57 tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);
bgneal@45 58 })();