Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1075 ddelon 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
 
20
var FCKStyleDef = function( name, element )
21
{
22
	this.Name = name ;
23
	this.Element = element.toUpperCase() ;
24
	this.IsObjectElement = FCKRegexLib.ObjectElements.test( this.Element ) ;
25
	this.Attributes = new Object() ;
26
}
27
 
28
FCKStyleDef.prototype.AddAttribute = function( name, value )
29
{
30
	this.Attributes[ name ] = value ;
31
}
32
 
33
FCKStyleDef.prototype.GetOpenerTag = function()
34
{
35
	var s = '<' + this.Element ;
36
 
37
	for ( var a in this.Attributes )
38
		s += ' ' + a + '="' + this.Attributes[a] + '"' ;
39
 
40
	return s + '>' ;
41
}
42
 
43
FCKStyleDef.prototype.GetCloserTag = function()
44
{
45
	return '</' + this.Element + '>' ;
46
}
47
 
48
 
49
FCKStyleDef.prototype.RemoveFromSelection = function()
50
{
51
	if ( FCKSelection.GetType() == 'Control' )
52
		this._RemoveMe( FCK.ToolbarSet.CurrentInstance.Selection.GetSelectedElement() ) ;
53
	else
54
		this._RemoveMe( FCK.ToolbarSet.CurrentInstance.Selection.GetParentElement() ) ;
55
}