Changeset 1271 for trunk/plugins


Ignore:
Timestamp:
11/15/10 16:15:48 (9 years ago)
Author:
ejucovy
Message:

Fix editor._createLink confusion, closes ticket:1553

  • editor.execCommand("createlink") is now the standard way to trigger a link-creation action
  • under the hood, this calls an editor._createLink method
  • core itself doesn't define editor._createLink -- instead, modules/CreateLink or plugins/Linker defines that method
  • double-clicking on an existing link to edit that link now works

It is also possible to trigger a link-edit action independent of the cursor position/selection.
The way to do this is editor.execCommand("createlink", false, anchorEl)

Location:
trunk/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/DoubleClick/DoubleClick.js

    r1067 r1271  
    3838  this.editor.dblClickList = { 
    3939    // Edit Link dialog 
    40     a: [ function(e) {e.config.btnList['createlink'][3](e); } ], 
     40    a: [ function(e, target) {e.execCommand("createlink", false, target);} ], 
    4141    // Follow link 
    4242    //a: [ function(editor, target) { window.location = target.href; properties(target); } ], 
  • trunk/plugins/Linker/Linker.js

    r1192 r1271  
    3232 
    3333  var linker = this; 
    34   if(editor.config.btnList.createlink) 
    35   { 
    36     editor.config.btnList.createlink[3] 
    37       =  function(e, objname, obj) { linker._createLink(linker._getSelectedAnchor()); }; 
     34  if(typeof editor._createLink == 'undefined') { 
     35      editor._createLink = function(target) { 
     36          if(!target) target = linker._getSelectedAnchor(); 
     37          linker._createLink(target); 
     38      } 
    3839  } 
    39   else 
     40  if(!editor.config.btnList.createlink) 
    4041  { 
    4142    editor.config.registerButton( 
    4243                                 'createlink', 'Insert/Modify Hyperlink', [_editor_url + "images/ed_buttons_main.gif",6,1], false, 
    43                                  function(e, objname, obj) { linker._createLink(linker._getSelectedAnchor()); } 
     44                                 function(e, objname, obj) { editor.execCommand("createlink"); } 
    4445                                 ); 
    4546  } 
Note: See TracChangeset for help on using the changeset viewer.