From: <de...@de...> - 2010-10-30 04:19:12
|
Author: PeterThoeny Date: 2010-10-29 23:19:04 -0500 (Fri, 29 Oct 2010) New Revision: 19602 Trac url: http://develop.twiki.org/trac/changeset/19602 Modified: twiki/branches/TWikiRelease05x00/EditSyntaxPlugin/lib/TWiki/Plugins/EditSyntaxPlugin.pm Log: Item6530: Make plugin coexist with new WYSIWYG editor in TWiki-4.2 and later Modified: twiki/branches/TWikiRelease05x00/EditSyntaxPlugin/lib/TWiki/Plugins/EditSyntaxPlugin.pm =================================================================== --- twiki/branches/TWikiRelease05x00/EditSyntaxPlugin/lib/TWiki/Plugins/EditSyntaxPlugin.pm 2010-10-30 04:17:34 UTC (rev 19601) +++ twiki/branches/TWikiRelease05x00/EditSyntaxPlugin/lib/TWiki/Plugins/EditSyntaxPlugin.pm 2010-10-30 04:19:04 UTC (rev 19602) @@ -1,6 +1,6 @@ # Plugin for TWiki Enterprise Collaboration Platform, http://TWiki.org/ # -# Copyright (C) 2006 Peter Thoeny, pe...@th... +# Copyright (C) 2006-2010 Peter Thoeny, pe...@th... # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,16 +19,9 @@ use strict; use vars qw( $VERSION $RELEASE $debug $pluginName $installWeb ); -# This should always be $Rev$ so that TWiki can determine the checked-in -# status of the plugin. It is used by the build automation tools, so -# you should leave it alone. -$VERSION = '$Rev$'; +$VERSION = 'V1.1 - $Rev$'; +$RELEASE = '2010-10-29'; -# This is a free-form string you can use to "name" your own plugin version. -# It is *not* used by the build automation tools, but is reported as part -# of the version number in PLUGINDESCRIPTIONS. -$RELEASE = 'Dakar'; - # Name of this Plugin, only used in this module $pluginName = 'EditSyntaxPlugin'; @@ -43,12 +36,6 @@ return 0; } - # Example code of how to get a preference value, register a variable handler - # and register a RESTHandler. (remove code you do not need) - - # Get plugin preferences variables - #my $example = TWiki::Func::getPreferencesValue( "\U$pluginName\E_EXAMPLE" ); - # get debug flag $debug = TWiki::Func::getPreferencesFlag( "\U$pluginName\E_DEBUG" ); @@ -59,25 +46,15 @@ } # ================================================================ -sub DISABLE_commonTagsHandler -{ - # do not uncomment, use $_[0], $_[1]... instead - ### my ( $text, $topic, $web ) = @_; - - TWiki::Func::writeDebug( "- ${pluginName}::commonTagsHandler( $_[2].$_[1] )" ) if $debug; - - # do custom extension rule, like for example: - # $_[0] =~ s/%XYZ%/&handleXyz()/ge; - # $_[0] =~ s/%XYZ{(.*?)}%/&handleXyz($1)/ge; -} - -# ================================================================ sub beforeEditHandler { # do not uncomment, use $_[0], $_[1]... instead ### my ( $text, $topic, $web ) = @_; TWiki::Func::writeDebug( "- ${pluginName}::beforeEditHandler( $_[2].$_[1] )" ) if $debug; + # Bail out if WYSIWYG edit session + return if TWiki::Func::getContext()->{textareas_hijacked}; + my $editSyntax = TWiki::Func::getPreferencesValue( 'EDITSYNTAX' ) || ''; $_[0] = _translateText( $_[0], $editSyntax, 'T2X' ) if( $editSyntax ); } @@ -89,6 +66,9 @@ ### my ( $text, $topic, $web ) = @_; TWiki::Func::writeDebug( "- ${pluginName}::afterEditHandler( $_[2].$_[1] )" ) if $debug; + # Bail out if WYSIWYG edit session + return if TWiki::Func::getContext()->{textareas_hijacked}; + my $editSyntax = TWiki::Func::getPreferencesValue( 'EDITSYNTAX' ) || ''; $_[0] = _translateText( $_[0], $editSyntax, 'X2T' ) if( $editSyntax ); } |