[389] | 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: fck.js |
---|
| 14 | * Creation and initialization of the "FCK" object. This is the main object |
---|
| 15 | * that represents an editor instance. |
---|
| 16 | * |
---|
| 17 | * File Authors: |
---|
| 18 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | // FCK represents the active editor instance |
---|
| 22 | var FCK = new Object() ; |
---|
| 23 | FCK.Name = FCKURLParams[ 'InstanceName' ] ; |
---|
| 24 | |
---|
| 25 | FCK.Status = FCK_STATUS_NOTLOADED ; |
---|
| 26 | FCK.EditMode = FCK_EDITMODE_WYSIWYG ; |
---|
| 27 | |
---|
| 28 | FCK.LoadLinkedFile = function() |
---|
| 29 | { |
---|
| 30 | // There is a bug on IE... getElementById returns any META tag that has the |
---|
| 31 | // name set to the ID you are looking for. So the best way in to get the array |
---|
| 32 | // by names and look for the correct one. |
---|
| 33 | // As ASP.Net generates a ID that is different from the Name, we must also |
---|
| 34 | // look for the field based on the ID (the first one is the ID). |
---|
| 35 | |
---|
| 36 | var oDocument = window.parent.document ; |
---|
| 37 | |
---|
| 38 | var eLinkedField = oDocument.getElementById( FCK.Name ) ; |
---|
| 39 | var colElementsByName = oDocument.getElementsByName( FCK.Name ) ; |
---|
| 40 | |
---|
| 41 | var i = 0; |
---|
| 42 | while ( eLinkedField || i == 0 ) |
---|
| 43 | { |
---|
| 44 | if ( eLinkedField && ( eLinkedField.tagName.toLowerCase() == 'input' || eLinkedField.tagName.toLowerCase() == 'textarea' ) ) |
---|
| 45 | { |
---|
| 46 | FCK.LinkedField = eLinkedField ; |
---|
| 47 | break ; |
---|
| 48 | } |
---|
| 49 | eLinkedField = colElementsByName[i++] ; |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | FCK.LoadLinkedFile() ; |
---|
| 53 | |
---|
| 54 | var FCKTempBin = new Object() ; |
---|
| 55 | FCKTempBin.Elements = new Array() ; |
---|
| 56 | |
---|
| 57 | FCKTempBin.AddElement = function( element ) |
---|
| 58 | { |
---|
| 59 | var iIndex = this.Elements.length ; |
---|
| 60 | this.Elements[ iIndex ] = element ; |
---|
| 61 | return iIndex ; |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | FCKTempBin.RemoveElement = function( index ) |
---|
| 65 | { |
---|
| 66 | var e = this.Elements[ index ] ; |
---|
| 67 | this.Elements[ index ] = null ; |
---|
| 68 | return e ; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | FCKTempBin.Reset = function() |
---|
| 72 | { |
---|
| 73 | var i = 0 ; |
---|
| 74 | while ( i < this.Elements.length ) |
---|
| 75 | this.Elements[ i++ ] == null ; |
---|
| 76 | this.Elements.length = 0 ; |
---|
| 77 | } |
---|