Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#1485 closed enhancement (fixed)

Add doubleclick funtionality to Xinha

Reported by: guest Owned by: gogo
Priority: normal Milestone: 0.97
Component: Xinha Core Version: trunk
Severity: normal Keywords:
Cc:

Description

make it possible to add a generate event-handling to any plugin
add the following to XinhaCore?.js (as part of Config)

  this.dblclickList = 
  {
    "a": [function(e, target) {e._createLink(target);}],
    "img": [function(e, target) {e._insertImage(target);}]
  };

add the following to XinhaCore?.js

Xinha.prototype._onDoubleClick = function(ev)
{
  var editor=this;
  var target = Xinha.is_ie ? ev.srcElement : ev.target;
  var tag = target.tagName;
  var className = target.className;
  if (tag) {
    tag = tag.toLowerCase();
    if (className && (this.config.dblclickList[tag+"."+className] != undefined))
      this.config.dblclickList[tag+"."+className][0](editor, target);
    else if (this.config.dblclickList[tag] != undefined)
      this.config.dblclickList[tag][0](editor, target);
  };
};

and the following to XinhaCore?.js

(Xinha.prototype.setEditorEvents = function(resetting_events_for_opera))
      Xinha._addEvents(
        doc, 
        ["dblclick"],
        function (event)
        {
          return editor._onDoubleClick(Xinha.is_ie ? editor._iframe.contentWindow.event : event);
        }
      );

than you can add something like the following to plugins:

cfg.dblclickList["a.googlemaps"] = [function(e, target) {e.config.btnList["googleMaps"][3](e, target);}];
  cfg.dblclickList["a.filePDF"] = [function(e, target) {e._insertDownload(target);}];
  cfg.dblclickList["a.fileDOC"] = [function(e, target) {e._insertDownload(target);}];
  cfg.dblclickList["a.fileZIP"] = [function(e, target) {e._insertDownload(target);}];
  cfg.dblclickList["a.fileXLS"] = [function(e, target) {e._insertDownload(target);}];
  cfg.dblclickList["a.filePPT"] = [function(e, target) {e._insertDownload(target);}];
  cfg.dblclickList["a.fileELSE"] = [function(e, target) {e._insertDownload(target);}];

Gocher

Change History (2)

comment:1 Changed 4 years ago by gogo

  • Milestone changed from 0.96 to 0.97
  • Resolution set to fixed
  • Status changed from new to closed

Committed changeset:1256

comment:2 Changed 4 years ago by ejucovy

See also #1555 -- this functionality already existed in the DoubleClick plugin, which is now redundant with core.

Note: See TracTickets for help on using tickets.