annotate media/js/tiny_mce/plugins/advlink/editor_plugin_src.js @ 232:a46788862737

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