Class ::xowiki::formfield::richtext::xinha
::xowiki::formfield::richtext::xinha
create ... \
[ -CSSclass (default "xinha") ] \
[ -extraPlugins extraPlugins ] \
[ -height height ] \
[ -javascript javascript ] \
[ -slim (default "false") ] \
[ -style style ] \
[ -wiki_p (default "true") ]
Class Relations
- class: ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- superclass: ::xowiki::formfield::richtext
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xotcl::Class create ::xowiki::formfield::richtext::xinha \
-superclass ::xowiki::formfield::richtext
Methods (to be applied on instances)
CSSclass (setter)
extraPlugins (setter)
height (setter)
initialize (scripted)
switch -- ${:displayMode} {
inplace {
::xo::Page requireJS "/resources/xowiki/xinha-inplace.js"
if {![info exists ::__xinha_inplace_init_done]} {
template::add_body_handler -event onload -script "xinha.inplace.init();"
set ::__xinha_inplace_init_done 1
}
}
inline { error "inline is not supported for xinha"}
}
next
set :widget_type richtext
if {![info exists :extraPlugins]} {
set :plugins [parameter::get -parameter "XowikiXinhaDefaultPlugins" -default [parameter::get_from_package_key -package_key "acs-templating" -parameter "XinhaDefaultPlugins"]]
} else {
set :plugins ${:extraPlugins}
}
set :options [:get_attributes editor plugins width height folder_id script_dir javascript wiki_p]
if {![info exists :slim]} {set :slim false}
if {![info exists :style]} {set :style "width: 100%;"}
if {![info exists :height]} {set :height 350px}
if {![info exists :wiki_p]} {set :wiki_p 1}
if {${:slim}} {
lappend :options javascript {
xinha_config.toolbar = [['popupeditor', 'formatblock', 'bold','italic','createlink','insertimage'],
['separator','insertorderedlist','insertunorderedlist','outdent','indent'],
['separator','killword','removeformat','htmlmode']
];
}
}javascript (setter)
render_input (scripted)
set disabled [:is_disabled]
if {![:istype ::xowiki::formfield::richtext] || $disabled} {
:render_as_div
} else {
security::csp::require script-src 'unsafe-eval'
security::csp::require script-src 'unsafe-inline'
set ::acs_blank_master(xinha) 1
set quoted [list]
foreach e [:plugins] {lappend quoted '$e'}
set ::acs_blank_master(xinha.plugins) [join $quoted ", "]
array set o ${:options}
set xinha_options ""
foreach e {width height folder_id fs_package_id file_types attach_parent_id wiki_p package_id} {
if {[info exists o($e)]} {
append xinha_options "xinha_config.$e = '$o($e)';\n"
}
}
append xinha_options "xinha_config.package_id = '[::xo::cc package_id]';\n"
if {[info exists o(javascript)]} {
append xinha_options $o(javascript) \n
}
set ::acs_blank_master(xinha.options) $xinha_options
lappend ::acs_blank_master__htmlareas ${:id}
if {${:displayMode} eq "inplace"} {
::html::div [:get_attributes id name {CSSclass class} disabled] {
set href \#
::html::a -style "float: right;" -class edit-item-button -href $href -id ${:id}-edit {
::html::t -disableOutputEscaping
}
template::add_event_listener -id ${:id}-edit -script [subst {xinha.inplace.openEditor('${:id}');}]
::html::div -id "${:id}__CONTENT__" {
::html::t -disableOutputEscaping [:value]
}
}
set :hiddenid ${:id}__HIDDEN__
set :type hidden
::html::input [:get_attributes {hiddenid id} name type value] {}
} else {
next
}
}slim (setter)
style (setter)
wiki_p (setter)