fckeditorapi.js
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:3k
源码类别:

OA系统

开发平台:

C#

  1. /*
  2.  * FCKeditor - The text editor for internet
  3.  * Copyright (C) 2003-2006 Frederico Caldeira Knabben
  4.  * 
  5.  * Licensed under the terms of the GNU Lesser General Public License:
  6.  *  http://www.opensource.org/licenses/lgpl-license.php
  7.  * 
  8.  * For further information visit:
  9.  *  http://www.fckeditor.net/
  10.  * 
  11.  * "Support Open Source software. What about a donation today?"
  12.  * 
  13.  * File Name: fckeditorapi.js
  14.  *  Create the FCKeditorAPI object that is available as a global object in
  15.  *  the page where the editor is placed in.
  16.  * 
  17.  * File Authors:
  18.  *  Frederico Caldeira Knabben (fredck@fckeditor.net)
  19.  */
  20. var FCKeditorAPI ;
  21. function InitializeAPI()
  22. {
  23. if ( !( FCKeditorAPI = window.parent.FCKeditorAPI ) )
  24. {
  25. // Make the FCKeditorAPI object available in the parent window. Use 
  26. // eval so it is independent from this window and so it will still be 
  27. // available if the editor instance is removed ("Can't execute code
  28. // from a freed script" error).
  29. var sScript = '
  30. var FCKeditorAPI = {
  31. Version : '2.3.2',
  32. VersionBuild : '1082',
  33. __Instances : new Object(),
  34. GetInstance : function( instanceName )
  35. {
  36. return this.__Instances[ instanceName ] ;
  37. },
  38. _FunctionQueue : {
  39. Functions : new Array(),
  40. IsRunning : false,
  41. Add : function( functionToAdd )
  42. {
  43. this.Functions.push( functionToAdd ) ;
  44. if ( !this.IsRunning )
  45. this.StartNext() ;
  46. },
  47. StartNext : function()
  48. {
  49. var aQueue = this.Functions ;
  50. if ( aQueue.length > 0 )
  51. {
  52. this.IsRunning = true ;
  53. aQueue[0].call() ;
  54. }
  55. else
  56. this.IsRunning = false ;
  57. },
  58. Remove : function( func )
  59. {
  60. var aQueue = this.Functions ;
  61. var i = 0, fFunc ;
  62. while( fFunc = aQueue[ i ] )
  63. {
  64. if ( fFunc == func )
  65. aQueue.splice( i,1 ) ;
  66. i++ ;
  67. }
  68. this.StartNext() ;
  69. }
  70. }
  71. }' ;
  72. // In IE, the "eval" function is not always available (it works with
  73. // the JavaScript samples, but not with the ASP ones, for example).
  74. // So, let's use the execScript instead.
  75. if ( window.parent.execScript )
  76. window.parent.execScript( sScript, 'JavaScript' ) ;
  77. else
  78. {
  79. if ( FCKBrowserInfo.IsGecko10 )
  80. {
  81. // FF 1.0.4 gives an error with the above request. The
  82. // following seams to work well. It could become to official
  83. // implementation for all browsers, but we need to check it.
  84. eval.call( window.parent, sScript ) ;
  85. }
  86. else
  87. window.parent.eval( sScript ) ;
  88. }
  89. FCKeditorAPI = window.parent.FCKeditorAPI ;
  90. }
  91. // Add the current instance to the FCKeditorAPI's instances collection.
  92. FCKeditorAPI.__Instances[ FCK.Name ] = FCK ;
  93. }
  94. function FCKeditorAPI_Cleanup()
  95. {
  96. FCKeditorAPI.__Instances[ FCK.Name ] = null ;
  97. }
  98. FCKTools.AddEventListener( window, 'unload', FCKeditorAPI_Cleanup ) ;