From 7924e3954f0f13ddf4d1f77a5f03c33b70429f5b Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Wed, 27 Jul 2005 10:12:40 +0000 Subject: [PATCH] Better "multi spawn" JS functionality for plugins that have more than one HTML nugget. This only creates the calling function once instead of many, many, many times. :) Thanks to FLorian Solcher for this patch. --- include/admin/plugins.inc.php | 6 +++--- include/functions_entries.inc.php | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/admin/plugins.inc.php b/include/admin/plugins.inc.php index f5f843a..f32c8a9 100644 --- a/include/admin/plugins.inc.php +++ b/include/admin/plugins.inc.php @@ -472,14 +472,14 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
- +
get('type') == 'html') { $htmlnugget[] = $elcount; - serendipity_emit_htmlarea_code('nugget' . $elcount, 'nugget' . $elcount); + serendipity_emit_htmlarea_code('nuggets', 'nuggets', true); } break; @@ -512,7 +512,7 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) { diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index f916682..d28803c 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -1599,10 +1599,14 @@ if (!$serendipity['wysiwyg']) { echo ' '; } -function serendipity_emit_htmlarea_code($item, $jsname) { +function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) { static $init = false; global $serendipity; + if ($init && $spawnMulti) { + return true; + } + if (isset($serendipity['wysiwyg']) && $serendipity['wysiwyg']) { $eventData = array( @@ -1655,8 +1659,8 @@ function serendipity_emit_htmlarea_code($item, $jsname) { // HTMLArea.loadPlugin("SpellChecker"); // [SPELLCHECK] var editor = null; var config = null; - function Spawn() { - var editor = new HTMLArea(""); + function Spawn() { + var editor = new HTMLArea(""); var config = editor.config; config.registerButton('image_selector', '', 'htmlarea/images/ed_s9yimage.gif', false, function(editor, id) { -- 2.39.5