Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7317609
field_type.text.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
field_type.text.js
View Options
var
Sealious
=
require
(
"../main.js"
);
var
Promise
=
require
(
"bluebird"
);
var
sanitizeHtml
=
require
(
"sanitize-html"
);
var
field_type_text
=
Sealious
.
ChipTypes
.
FieldType
(
"text"
);
field_type_text
.
prototype
.
isProperValue
=
function
(
context
,
value
){
if
(
this
.
params
==
undefined
||
this
.
params
.
max_length
===
undefined
){
return
true
;
}
else
{
if
(
value
.
length
<=
this
.
params
.
max_length
){
return
true
;
}
else
{
return
Sealious
.
Errors
.
ValidationError
(
"Text '"
+
value
+
"' has exceeded max length of "
+
this
.
params
.
max_length
+
" chars."
);
}
}
}
field_type_text
.
prototype
.
encode
=
function
(
value_in_code
){
return
new
Promise
(
function
(
resolve
,
reject
){
if
(
this
.
params
&&
this
.
params
.
strip_html
===
true
){
var
stripped
=
sanitizeHtml
(
value_in_code
.
toString
(),
{
allowedTags
:
[]
})
resolve
(
stripped
);
}
else
{
if
(
value_in_code
instanceof
Object
){
resolve
(
JSON
.
stringify
(
value_in_code
));
}
else
if
(
value_in_code
==
null
){
resolve
(
""
);
}
else
{
resolve
(
value_in_code
.
toString
());
}
}
}.
bind
(
this
))
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jul 13, 04:52 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
816974
Default Alt Text
field_type.text.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment