From 6f5bdf5f0de6a77e31344f3b4fbcfb087b310257 Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 21 Aug 2025 23:45:46 +0700 Subject: [PATCH] Fix PHP serialization and add Long Text type to Visual Editor - Fixed PHP serialization byte length calculation for escaped strings - Added Long Text type with textarea for multiline strings in StructuredEditor - Auto-detects strings with newlines and displays them as textarea - Improvements apply to both SerializeTool and JsonTool visual editors - Resolves parse errors with quoted strings and multiline content --- src/components/StructuredEditor.js | 40 +++++++++++++++++++++--------- src/pages/SerializeTool.js | 6 ++++- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/components/StructuredEditor.js b/src/components/StructuredEditor.js index 20b1f1cb..ca81eee8 100644 --- a/src/components/StructuredEditor.js +++ b/src/components/StructuredEditor.js @@ -144,6 +144,7 @@ const StructuredEditor = ({ onDataChange, initialData = {} }) => { // Try to preserve value when changing types if possible switch (newType) { case 'string': + case 'longtext': current[key] = currentValue === null ? '' : currentValue.toString(); break; case 'number': @@ -314,17 +315,31 @@ const StructuredEditor = ({ onDataChange, initialData = {} }) => { ) : ( - updateValue(e.target.value, path)} - className="flex-1 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 min-w-0" - placeholder="Value" - /> + typeof value === 'string' && value.includes('\n') ? ( +