new attribute type "html", which is NOT run through (tags removing) html_entity_decode, used for value in et2_html(area)

This commit is contained in:
Ralf Becker 2014-02-14 10:14:28 +00:00
parent e60294fdf4
commit bd7980f0e8
3 changed files with 22 additions and 7 deletions

View File

@ -30,7 +30,7 @@ if (typeof Array.prototype.indexOf == "undefined")
/**
* Array with all types supported by the et2_checkType function.
*/
var et2_validTypes = ["boolean", "string", "float", "integer", "any", "js", "dimension"];
var et2_validTypes = ["boolean", "string", "html", "float", "integer", "any", "js", "dimension"];
/**
* Object whith default values for the above types. Do not specify array or
@ -40,6 +40,7 @@ var et2_validTypes = ["boolean", "string", "float", "integer", "any", "js", "dim
var et2_typeDefaults = {
"boolean": false,
"string": "",
"html": "",
"js": null,
"float": 0.0,
"integer": 0,
@ -152,11 +153,11 @@ function et2_checkType(_val, _type, _attr, _widget)
}
// Check whether the given value is of the type "string"
if (_type == "string")
if (_type == "string" || _type == "html")
{
if (typeof _val == "string")
{
return html_entity_decode(_val);
return _type == "html" ? _val : html_entity_decode(_val);
}
// Handle some less common possibilities

View File

@ -30,10 +30,16 @@ var et2_html = et2_valueWidget.extend([et2_IDetachedDOM],
ignore: false,
name: "Label",
translate: true,
type: "string",
type: "string"
},
"needed": {
"ignore": true
},
value: {
name: "Value",
description: "The value of the widget",
type: "html", // "string" would remove html tags by running html_entity_decode
default: et2_no_init
}
},
@ -84,6 +90,8 @@ var et2_html = et2_valueWidget.extend([et2_IDetachedDOM],
/**
* Code for implementing et2_IDetachedDOM
*
* @param {array} _attrs
*/
getDetachedAttributes: function(_attrs)
{

View File

@ -65,6 +65,12 @@ var et2_htmlarea = et2_inputWidget.extend(
'description': 'Internal configuration - managed by preferences & framework, passed in here',
'translate': 'no_lang'
},
value: {
name: "Value",
description: "The value of the widget",
type: "html", // "string" would remove html tags by running html_entity_decode
default: et2_no_init
}
},
legacyOptions: ['mode','height','width','expand_toolbar','base_href'],