[1304] 导出PDF开启嵌入附件时后缀自动联动为 .tmu.pdf + 草稿文档使用对应文件名 - #4583
Merged
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
.tmu.pdf;关闭该选项时,后缀自动恢复为.pdf。同时在浏览(Browse)选择新路径以及后端导出兜底逻辑中保证该后缀联动规则。draft_20260905_120000.pdf),而非回退为untitled.pdf。Why
.tmu.pdf为后缀,普通 PDF 应当以.pdf为后缀。此前弹窗内联路径后,目的地路径未随开关勾选联动,导致勾选嵌入后默认导出的文件名仍为.pdf。draft_YYYYMMDD_HHMMSS.tmu)。原先propose-name-buffer针对草稿返回pwd或""供「另存为」对话框输入文件名,导致导出 PDF 时未能取到草稿实际文件名而退化为untitled.pdf。草稿导出 PDF 时直接以其草稿文件名作为建议文件名更符合用户直觉。How
src/Plugins/Qt/qml/ExportPdf.qml):adjustPathSuffix(path, embedOn)工具函数:开启嵌入时将.pdf后缀替换为.tmu.pdf(若已有.tmu.pdf则保持,无后缀则追加.tmu.pdf);关闭嵌入时将.tmu.pdf替换回.pdf。onToggleChanged(key, on)处理函数:在切换 toggle 开关时,若为embed选项,则自动同步更新pathKey对应路径的后缀并赋新对象刷新pathValue绑定。values初始化阶段:若初始embed为"true",自动对路径后缀进行调整。browseBtn):选择新路径后,若当前已开启embed,新路径同样自动调整后缀为.tmu.pdf。TeXmacs/progs/texmacs/texmacs/tm-print.scm):propose-export-pdf-name函数:支持可选传入master。若为草稿文档(url-scratch?),直接从其 URL 提取真实文件名(去.tmu/.stem后缀),生成形如draft_YYYYMMDD_HHMMSS.pdf;普通文档及协作云文档保持原有标题与建议名逻辑。export-pdf-ensure-suffix函数:支持传入可选的embed参数。若开启嵌入,确保后缀为.tmu.pdf;若未开启,兜底.pdf后缀。export-as-pdf调用(export-pdf-ensure-suffix fname embed)保证后端落盘一致性。tests/Plugins/Qt/qml_load_test.cpp:验证onToggleChanged切换开启与关闭时pathValue和values的联动;验证adjustPathSuffix在各类输入下的后缀调整逻辑。TeXmacs/progs/texmacs/texmacs/tests/export-pdf-default-dir-test.scm:验证export-pdf-ensure-suffix传入嵌入参数时的各边界情况;验证草稿文档(.tmu与.stem)导出 PDF 时的建议文件名。测试方法
xmake b qml_load_test && xmake r qml_load_testxmake r export-pdf-default-dir-testdraft_...pdf)而非untitled.pdf。.tmu.pdf;取消勾选观察是否恢复为.pdf。