%3 ::xowiki::formfield::richtext::ckeditor4 ::xowiki::formfield::richtext::ckeditor4 initialize js_image_helper pathNames render_input ::xowiki::formfield::richtext ::xowiki::formfield::richtext check=safe_html editor initialize pretty_value render_richtext_as_div ::xowiki::formfield::richtext::ckeditor4->::xowiki::formfield::richtext ::xowiki::formfield::form ::xowiki::formfield::form check=form initialize ::xowiki::formfield::form->::xowiki::formfield::richtext ::xowiki::formfield::localized_richtext ::xowiki::formfield::localized_richtext ::xowiki::formfield::localized_richtext->::xowiki::formfield::richtext ::xowiki::formfield::localized_text ::xowiki::formfield::localized_text ::xowiki::formfield::localized_richtext->::xowiki::formfield::localized_text ::xowiki::formfield::richtext::wym ::xowiki::formfield::richtext::wym initialize render_input ::xowiki::formfield::richtext::wym->::xowiki::formfield::richtext ::xowiki::formfield::richtext::xinha ::xowiki::formfield::richtext::xinha initialize render_input ::xowiki::formfield::richtext::xinha->::xowiki::formfield::richtext ::xowiki::formfield::textarea ::xowiki::formfield::textarea add_statistics clear_editor_mixins initialize render_input set_feedback ::xowiki::formfield::richtext->::xowiki::formfield::textarea ::xowiki::formfield::FormField ::xowiki::formfield::FormField ::xowiki::formfield::textarea->::xowiki::formfield::FormField

Class ::xowiki::formfield::richtext::xinha

::xowiki::formfield::richtext::xinha[i] 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]
  • superclass: ::xowiki::formfield::richtext[i]
::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]
    # for the time being, we can't set the defaults via parameter,
    # but only manually, since the editor is used as a mixin, the parameter
    # would have precedence over the defaults of subclasses
    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_richtext_as_div
    } else {
      #
      # required CSP directives for Xinha
      #
      security::csp::require script-src 'unsafe-eval'
      security::csp::require script-src 'unsafe-inline'
    
      # we use for the time being the initialization of xinha based on
      # the blank master
      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 {
        #::html::div [:get_attributes id name cols rows style {CSSclass class} disabled] {}
        next
      }
    }
  • slim (setter)

  • style (setter)

  • wiki_p (setter)