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 -N -r1.284.2.105 -r1.284.2.106 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 8 Jun 2020 14:01:31 -0000 1.284.2.105 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 9 Jun 2020 19:26:05 -0000 1.284.2.106 @@ -2477,6 +2477,7 @@ {cols 80} {spell false} {autosave:boolean false} + {paste:boolean true} } textarea instproc initialize {} { set :widget_type text(textarea) @@ -2529,6 +2530,22 @@ ::html::t [:value] } } + if {!${:paste}} { + # + # When "paste" is deactivated, the cut&paste and drag&drop + # handlers are deactivated for this field. "copy" is + # deactivated for the full page, since otherwise, one could + # cut the field with the surrounding text. + # + foreach event_type {paste drag drop} { + template::add_event_listener -id ${:id} -event $event_type \ + -preventdefault=true -script "" + } + template::add_script -section body -script { + window.addEventListener('copy', function (event) {event.preventDefault();}, false); + } + } + :resetBooleanAttributes $booleanAtts } :render_result_statistics @@ -3940,6 +3957,7 @@ Class create text_fields -superclass {CompoundField ShuffleField} -parameter { {descriptions ""} + {paste:boolean true} } -ad_doc { Provide multiple text and short text entries. This field is a @@ -3982,6 +4000,9 @@ set type textarea dict set field_fc_dict rows [dict get $render_hints_dict lines] dict set field_fc_dict autosave true + if {!${:paste}} { + dict set field_fc_dict paste false + } } "file_upload" { set type file