~ubuntu-it-wiki/wiki-ubuntu-it/wiki-repo

« back to all changes in this revision

Viewing changes to applets/moinFCKplugins/moinbehaviour/fckplugin.js

  • Committer: Leo Iannacone
  • Date: 2011-06-02 15:05:37 UTC
  • Revision ID: l3on@ubuntu.com-20110602150537-ycrnf58qf67uf593
Added applets for gui editor

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* ###########################################################################
 
3
 * IE functions
 
4
 * ###########################################################################
 
5
 */
 
6
 
 
7
function Doc_OnKeyDown_IE()
 
8
{
 
9
  var e = FCK.EditorWindow.event;
 
10
  if (e.keyCode == 13) // ENTER
 
11
  {
 
12
    if (e.ctrlKey || e.altKey || e.shiftKey|| !FCKSelection.HasAncestorNode("PRE")) {
 
13
      return true;
 
14
    }
 
15
    else
 
16
    { 
 
17
      FCKSelection.Delete();
 
18
      var oTmpNode = FCK.CreateElement("B");
 
19
      oTmpNode.innerHTML = " ";
 
20
      if (oTmpNode.previousSibling && oTmpNode.previousSibling.nodeType==3)
 
21
      {
 
22
        oTmpNode.previousSibling.nodeValue = 
 
23
      oTmpNode.previousSibling.nodeValue + '\r';
 
24
      }
 
25
      else
 
26
      {
 
27
        var oTxt = FCK.EditorDocument.createTextNode('\r');
 
28
        oTmpNode.parentNode.insertBefore(oTxt, oTmpNode);
 
29
      }
 
30
      var oRange = FCK.EditorDocument.selection.createRange();
 
31
      oRange.moveToElementText(oTmpNode);
 
32
      oRange.select();
 
33
      FCK.EditorDocument.selection.clear();           
 
34
      return false;
 
35
    }
 
36
  }
 
37
  return true;
 
38
}
 
39
 
 
40
 
 
41
function Doc_OnKeyUp_IE()
 
42
{
 
43
  /*
 
44
  var e = FCK.EditorWindow.event;
 
45
  if (e.keyCode == 8 || e.keyCode==46) // backspace, delete
 
46
    {
 
47
  */
 
48
  var oNode = FCKSelection.GetParentElement();
 
49
  var siHTML = oNode.innerHTML;
 
50
 
 
51
  if (siHTML.search(/ /i)!=-1)
 
52
  {
 
53
    oNode.normalize();
 
54
    alert("DING");
 
55
  }
 
56
      //    }
 
57
}
 
58
/* ##########################################################################
 
59
 * Register event handlers
 
60
 * ##########################################################################
 
61
 */
 
62
 
 
63
/*
 
64
// TODO FCK.EditorDocument is seems like deprecated, find alternative method for replace
 
65
if (FCK.EditorDocument.attachEvent) // IE
 
66
{
 
67
  FCK.EditorDocument.attachEvent('onkeydown', Doc_OnKeyDown_IE);
 
68
  //FCK.AttachToOnSelectionChange(Doc_OnKeyUp_IE);
 
69
 
 
70
}
 
71
 
 
72
*/
 
 
b'\\ No newline at end of file'