refactor(phone-image): 清理死代码、修复历史记录和媒体标签安全移除

T8: 删除estimateImageHeight/estimateTableHeight/showGeneratedThumbnails/switchSize/
    getConfig/getPages/renderContentFlow等未使用函数,exportLongImage添加render锁检查
T9: loadFromHistory恢复pageAlignments,font_size→fontSize命名统一(PHP+JS双向兼容),
    修复历史加载时fontSize显示值bug
T10: preprocessContent移除iframe/video/svg/embed/object标签,
    封面图添加onerror处理
This commit is contained in:
augushong
2026-05-07 21:53:03 +08:00
parent 491a71bd44
commit 90b4b1d5f2
3 changed files with 37 additions and 86 deletions

View File

@@ -18,7 +18,7 @@ class PhoneImage implements PostOutputManagerInterface
'template' => ['type' => 'select', 'options' => ['minimal', 'magazine', 'mixed'], 'default' => 'minimal'],
'size' => ['type' => 'select', 'options' => ['xiaohongshu', 'douyin'], 'default' => 'xiaohongshu'],
'font' => ['type' => 'select', 'options' => ['source-han-sans', 'alibaba-puhuiti', 'lxgw-wenkai'], 'default' => 'source-han-sans'],
'font_size' => ['type' => 'number', 'default' => 14, 'min' => 10, 'max' => 24],
'fontSize' => ['type' => 'number', 'default' => 14, 'min' => 10, 'max' => 24],
'watermark' => ['type' => 'text', 'default' => ''],
];
}
@@ -39,9 +39,9 @@ class PhoneImage implements PostOutputManagerInterface
if (isset($config['font']) && !in_array($config['font'], $fields['font']['options'])) {
return false;
}
if (isset($config['font_size'])) {
$size = intval($config['font_size']);
if ($size < $fields['font_size']['min'] || $size > $fields['font_size']['max']) {
if (isset($config['fontSize'])) {
$size = intval($config['fontSize']);
if ($size < $fields['fontSize']['min'] || $size > $fields['fontSize']['max']) {
return false;
}
}