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

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: fckstyledef.js
  14.  *  FCKStyleDef Class: represents a single style definition.
  15.  * 
  16.  * File Authors:
  17.  *  Frederico Caldeira Knabben (fredck@fckeditor.net)
  18.  */
  19. var FCKStyleDef = function( name, element )
  20. {
  21. this.Name = name ;
  22. this.Element = element.toUpperCase() ;
  23. this.IsObjectElement = FCKRegexLib.ObjectElements.test( this.Element ) ;
  24. this.Attributes = new Object() ;
  25. }
  26. FCKStyleDef.prototype.AddAttribute = function( name, value )
  27. {
  28. this.Attributes[ name ] = value ;
  29. }
  30. FCKStyleDef.prototype.GetOpenerTag = function()
  31. {
  32. var s = '<' + this.Element ;
  33. for ( var a in this.Attributes )
  34. s += ' ' + a + '="' + this.Attributes[a] + '"' ;
  35. return s + '>' ;
  36. }
  37. FCKStyleDef.prototype.GetCloserTag = function()
  38. {
  39. return '</' + this.Element + '>' ;
  40. }
  41. FCKStyleDef.prototype.RemoveFromSelection = function()
  42. {
  43. if ( FCKSelection.GetType() == 'Control' )
  44. this._RemoveMe( FCK.ToolbarSet.CurrentInstance.Selection.GetSelectedElement() ) ;
  45. else
  46. this._RemoveMe( FCK.ToolbarSet.CurrentInstance.Selection.GetParentElement() ) ;
  47. }