Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v diff -u -r1.284.2.253 -r1.284.2.254 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 21 Jun 2024 10:47:34 -0000 1.284.2.253 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 21 Jun 2024 11:25:05 -0000 1.284.2.254 @@ -3294,7 +3294,17 @@ } textarea instproc render_input {} { - if {[:is_disabled] && [info exists :disabled_as_div]} { + if {[info exists :render_as_div_p] && ${:render_as_div_p}} { + # + # A subclass set :render_as_div_p to indicate they want the + # field to be rendered as a div, but did not want to interrupt + # inheritance. + # + # When superclass behavior is not needed, one may simply call + # :render_as_div directly in the subclass methods. + # + :render_as_div + } elseif {[:is_disabled] && [info exists :disabled_as_div]} { :render_disabled_as_div textarea } else { set booleanAtts [:booleanAttributes {*}${:booleanHTMLAttributes}] @@ -3355,6 +3365,24 @@ :render_result_statistics } + textarea instproc render_as_div {} { + # + # Rendering a textarea as a div is needed in particular for + # richtext editors, where some may not expect to enhance a + # textarea as usual, but a div. + # + #:msg "[:get_attributes id style {CSSclass class}]" + ::html::div [:get_attributes id style {CSSclass class} data-repeat-template-id] { + if {[:wiki]} { + ${:object} references clear + ::html::t -disableOutputEscaping [${:object} substitute_markup [:value]] + } else { + ::html::t -disableOutputEscaping [:value] + } + } + ::html::div + } + textarea instproc set_feedback {feedback_mode} { set :correction [next] return ${:correction} @@ -3517,19 +3545,6 @@ #set :__initialized 1 } - richtext instproc render_richtext_as_div {} { - #:msg "[:get_attributes id style {CSSclass class}]" - ::html::div [:get_attributes id style {CSSclass class} data-repeat-template-id] { - if {[:wiki]} { - ${:object} references clear - ::html::t -disableOutputEscaping [${:object} substitute_markup [:value]] - } else { - ::html::t -disableOutputEscaping [:value] - } - } - ::html::div - } - richtext instproc check=safe_html {value} { # # Don't check, if the user has sufficient permissions on the @@ -3723,7 +3738,7 @@ } if {![:istype ::xowiki::formfield::richtext] || ($disabled && !$is_repeat_template)} { - :render_richtext_as_div + :render_as_div } else { template::head::add_javascript -src urn:ad:js:jquery @@ -3890,7 +3905,7 @@ } ); }] } - :render_richtext_as_div + :render_as_div } elseif {${:displayMode} eq "inline"} { if {"xowikiimage" in ${:extraPlugins}} { set ready_callback "xowiki_image_callback(CKEDITOR.instances\['$id'\]);" @@ -3972,7 +3987,7 @@ richtext::wym instproc render_input {} { set disabled [:is_disabled] if {![:istype ::xowiki::formfield::richtext] || $disabled } { - :render_richtext_as_div + :render_as_div } else { ::xo::Page requireCSS "/resources/xowiki/wymeditor/skins/default/screen.css" ::xo::Page requireJS urn:ad:js:jquery @@ -4084,7 +4099,7 @@ richtext::xinha instproc render_input {} { set disabled [:is_disabled] if {![:istype ::xowiki::formfield::richtext] || $disabled} { - :render_richtext_as_div + :render_as_div } else { # # required CSP directives for Xinha @@ -4225,7 +4240,7 @@ # Field is disabled. We simply render as a div. # if {$disabled && !$is_repeat_template} { - :render_richtext_as_div + :render_as_div return } @@ -4344,10 +4359,13 @@ # both the promise handler for TinyMCE.init up in the js # functions. # - :render_richtext_as_div - } else { - next + # We do not want to stop inheritance here, because we want to be + # able to plug behavior in subclasses of richtext. + # + set :render_as_div_p true } + + next } ###########################################################