Item11031: Enable the TinyMCE editor for data form textareas

pencil
Priority: Enhancement
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: TinyMCEPlugin, WysiwygPlugin
Branches:
Reported By: DavidPatterson
Waiting For:
Last Change By: GeorgeClark
I've got this feature running locally with some minor updates made as below. This is a simple demonstration, granted, as everything is still dependent on the evaluation of the content of the topic text only (no check is made on the content of the formfields) but, in the majority of cases, if the topic text is good for editing, so are the form textareas and, if the topic text isn't good for editing, there isn't a form attached.

  • commented out the "editor_selector" setting from the TinyMCE init settings
  • WysiwygPlugin/Handlers.pm afterEditHandler now looks like
sub afterEditHandler {
    my ( $text, $topic, $web, $meta ) = @_;
    my $query = Foswiki::Func::getCgiQuery();
    return unless $query;

    # return
      # unless defined( $query->param('wysiwyg_edit') )
          # || $text =~ s/<!--$SECRET_ID-->//go;

    $text = TranslateHTML2TML( $text, $_[1], $_[2] ) 
      if defined( $query->param('wysiwyg_edit') )
         || $text =~ s/<!--$SECRET_ID-->//go;
         
    # Switch off wysiwyg_edit so it doesn't try to transform again in
    # the beforeSaveHandler
    $query->delete('wysiwyg_edit');

    foreach my $field ($meta->find('FIELD')) {
      $field->{value} = TranslateHTML2TML( $field->{value}, $_[1], $_[2] ) 
         if $field->{value} =~ s/<!--$SECRET_ID-->//go;
    }

    $_[0] = $text;
}
  • disabled the FoswikiTiny.initialisedFromServer check from foswiki_tiny(_src).js
    • I don't really get why this check is here at all (yes, I've seen the related comment, still don't get it / agree with it) but it prevents additional tinymce editors from being initialised on the page
  • fixed the _fixAutoSave in the foswiki plugin of tinymce otherwise the same storage is used for all the editors on the page, line 93 of _src is now
ed.id = FoswikiTiny.twikiVars.WEB + '.' + FoswikiTiny.twikiVars.TOPIC + '.' + ed.id;
  • given Form/Textarea.pm its own renderForDisplay that uses its own protectFormFieldValue that doesn't substitue newlines with <br /> which would prevent the proper rendering of lists.

-- DavidPatterson - 10 Aug 2011

Cool. I've made some efforts at this, but got distracted pretending to re-write Foswiki::Form smile

My believe is that WysiwygPlugin should supply a Foswiki::Form::Richtext type - the renderForDisplay/edit should be able to take care of this cleanly

-- PaulHarvey - 10 Aug 2011

Was any of this ever completed?

-- GeorgeClark - 24 Dec 2014
 

ItemTemplate edit

Summary Enable the TinyMCE editor for data form textareas
ReportedBy DavidPatterson
Codebase
SVN Range
AppliesTo Extension
Component TinyMCEPlugin, WysiwygPlugin
Priority Enhancement
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r3 - 24 Dec 2014, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy