From 12c96ace70f7a177cc40000f905fa3cab633c04a Mon Sep 17 00:00:00 2001
From: Adrian Lang <lang@cosmocode.de>
Date: Tue, 23 Mar 2010 12:06:41 +0100
Subject: [PATCH] Send edit target in HTML_EDITFORM_SELECTION

---
 inc/html.php | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/inc/html.php b/inc/html.php
index e2128f2bc..088f8d3c5 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1173,9 +1173,13 @@ function html_edit(){
     $data = array('form' => $form,
                   'wr'   => $wr,
                   'media_manager' => true,
+                  'target' => (isset($_REQUEST['target']) && $wr &&
+                               $RANGE !== '') ? $_REQUEST['target'] : 'section',
                   'intro_locale' => $include);
-    if ($wr && $RANGE !== '') {
-        // Only emit event if page is writable and section edit data is valid.
+
+    if ($data['target'] !== 'section') {
+        // Only emit event if page is writable, section edit data is valid and
+        // edit target is not section.
         trigger_event('HTML_EDIT_FORMSELECTION', $data, 'html_edit_form', true);
     } else {
         html_edit_form($data);
@@ -1237,10 +1241,15 @@ function html_edit(){
  */
 function html_edit_form($param) {
     global $TEXT;
-    extract($param);
+
+    if ($param['target'] !== 'section') {
+        msg('No editor for edit target ' . $param['target'] . ' found.', -1);
+    }
+
     $attr = array('tabindex'=>'1');
-    if (!$wr) $attr['readonly'] = 'readonly';
-    $form->addElement(form_makeWikiText($TEXT, $attr));
+    if (!$param['wr']) $attr['readonly'] = 'readonly';
+
+    $param['form']->addElement(form_makeWikiText($TEXT, $attr));
 }
 
 /**
-- 
GitLab