修改换行逻辑和段落查看方式

This commit is contained in:
yhy
2026-08-30 07:44:59 +08:00
parent 54f004a56c
commit ce79275d41
14 changed files with 489 additions and 232 deletions
+201 -33
View File
@@ -16,19 +16,20 @@
/*
* Item pane section header buttons (open in window, adaptive height).
* Lucide-style icons are stroke-based (context-stroke); Zotero only enables
* fill context on .section-custom-button by default, so strokes stay invisible
* in light and dark themes until stroke is wired to currentColor.
* Icons use fill="context-fill" like native Zotero toolbar SVGs.
*/
collapsible-section[custom][data-pane="chatpapers-chat"] > .head toolbarbutton.section-custom-button,
collapsible-section[custom][data-pane="chatpapers-lecture"] > .head toolbarbutton.section-custom-button,
collapsible-section.chatpapers-adaptive-height > .head toolbarbutton.section-custom-button,
collapsible-section.chatpapers-fixed-height > .head toolbarbutton.section-custom-button {
-moz-context-properties: fill, fill-opacity, stroke, stroke-opacity;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
stroke: currentColor;
color: inherit;
}
@media (prefers-color-scheme: light) {
collapsible-section[custom][data-pane="chatpapers-chat"] > .head toolbarbutton.section-custom-button,
collapsible-section[custom][data-pane="chatpapers-lecture"] > .head toolbarbutton.section-custom-button,
collapsible-section.chatpapers-adaptive-height > .head toolbarbutton.section-custom-button,
collapsible-section.chatpapers-fixed-height > .head toolbarbutton.section-custom-button {
list-style-image: var(--custom-button-icon-light);
@@ -36,6 +37,8 @@ collapsible-section.chatpapers-fixed-height > .head toolbarbutton.section-custom
}
@media (prefers-color-scheme: dark) {
collapsible-section[custom][data-pane="chatpapers-chat"] > .head toolbarbutton.section-custom-button,
collapsible-section[custom][data-pane="chatpapers-lecture"] > .head toolbarbutton.section-custom-button,
collapsible-section.chatpapers-adaptive-height > .head toolbarbutton.section-custom-button,
collapsible-section.chatpapers-fixed-height > .head toolbarbutton.section-custom-button {
list-style-image: var(--custom-button-icon-dark);
@@ -75,7 +78,7 @@ collapsible-section[open] > :not(.head) .chatpapers-root {
}
collapsible-section[open] > :not(.head) .chatpapers-lecture-root {
min-height: 180px;
min-height: 320px;
}
.chatpapers-header {
@@ -824,6 +827,46 @@ collapsible-section[open] > :not(.head) .chatpapers-lecture-root {
/* --- Voice lecture pane --- */
.chatpapers-lecture-root {
gap: 10px;
max-width: 100%;
min-width: 0;
}
.chatpapers-lecture-beat-list {
display: flex;
flex-direction: column;
gap: 4px;
width: 100%;
min-height: 150px;
max-height: min(260px, 34vh);
max-width: 100%;
min-width: 0;
box-sizing: border-box;
}
.chatpapers-lecture-beat-list.chatpapers-lecture-scroll-y,
.chatpapers-lecture-para-detail.chatpapers-lecture-scroll-y {
overflow-x: hidden;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: color-mix(in srgb, currentColor 32%, transparent) transparent;
scrollbar-gutter: stable;
}
.chatpapers-lecture-beat-list.chatpapers-lecture-scroll-y::-webkit-scrollbar,
.chatpapers-lecture-para-detail.chatpapers-lecture-scroll-y::-webkit-scrollbar {
width: 5px;
height: 5px;
}
.chatpapers-lecture-beat-list.chatpapers-lecture-scroll-y::-webkit-scrollbar-thumb,
.chatpapers-lecture-para-detail.chatpapers-lecture-scroll-y::-webkit-scrollbar-thumb {
background: color-mix(in srgb, currentColor 28%, transparent);
border-radius: 999px;
}
.chatpapers-lecture-beat-list.chatpapers-lecture-scroll-y::-webkit-scrollbar-track,
.chatpapers-lecture-para-detail.chatpapers-lecture-scroll-y::-webkit-scrollbar-track {
background: transparent;
}
.chatpapers-lecture-empty {
@@ -1015,7 +1058,7 @@ collapsible-section[open] > :not(.head) .chatpapers-lecture-root {
outline: 1px solid rgba(31, 122, 140, 0.35);
}
.chatpapers-lecture-sentence-item .chatpapers-lecture-beat-title {
.chatpapers-lecture-sentence-item .chatpapers-lecture-beat-preview {
font-size: 11px;
}
@@ -1032,12 +1075,21 @@ collapsible-section[open] > :not(.head) .chatpapers-lecture-root {
}
.chatpapers-lecture-sentence-chip {
appearance: none;
width: 100%;
box-sizing: border-box;
text-align: left;
padding: 4px 8px;
border-radius: 6px;
border: 1px solid color-mix(in srgb, #1f7a8c 20%, transparent);
background: transparent;
cursor: pointer;
font: inherit;
font-size: 11px;
line-height: 1.35;
color: inherit;
word-break: break-word;
overflow-wrap: anywhere;
}
.chatpapers-lecture-sentence-chip.is-active {
@@ -1062,8 +1114,54 @@ collapsible-section[open] > :not(.head) .chatpapers-lecture-root {
border: 1px solid color-mix(in srgb, #1f7a8c 15%, transparent);
font-size: 12px;
line-height: 1.45;
max-height: 200px;
overflow-y: auto;
max-width: 100%;
min-width: 0;
box-sizing: border-box;
}
.chatpapers-lecture-para-detail:not(.is-empty) {
min-height: 140px;
max-height: min(300px, 38vh);
}
.chatpapers-lecture-para-detail.is-empty {
min-height: auto;
max-height: none;
overflow: visible;
}
.chatpapers-lecture-para-detail .chatpapers-lecture-para-original,
.chatpapers-lecture-para-detail .chatpapers-lecture-para-translation,
.chatpapers-lecture-para-detail .chatpapers-lecture-para-context,
.chatpapers-lecture-para-detail .chatpapers-lecture-para-role,
.chatpapers-lecture-para-detail .chatpapers-lecture-para-kind,
.chatpapers-lecture-para-detail .chatpapers-lecture-pdf-sync-hint {
white-space: pre-wrap;
word-break: break-word;
overflow-wrap: break-word;
overflow-x: hidden;
max-width: 100%;
font-size: 12px;
line-height: 1.55;
}
.chatpapers-lecture-para-detail .chatpapers-lecture-para-original-label,
.chatpapers-lecture-para-detail .chatpapers-lecture-para-translation-label,
.chatpapers-lecture-para-detail .chatpapers-lecture-para-context-label {
white-space: normal;
}
.chatpapers-lecture-para-detail-empty {
opacity: 0.72;
font-size: 12px;
line-height: 1.45;
text-align: center;
padding: 8px 4px;
}
.chatpapers-lecture-para-play-btn {
align-self: flex-start;
margin-bottom: 2px;
}
.chatpapers-lecture-selection-explain {
@@ -1135,6 +1233,10 @@ collapsible-section[open] > :not(.head) .chatpapers-lecture-root {
flex-direction: column;
gap: 8px;
margin-top: 4px;
width: 100%;
max-width: 100%;
min-width: 0;
box-sizing: border-box;
}
.chatpapers-lecture-player-title {
@@ -1143,31 +1245,82 @@ collapsible-section[open] > :not(.head) .chatpapers-lecture-root {
opacity: 0.85;
}
.chatpapers-lecture-beat-list {
display: flex;
flex-direction: column;
gap: 4px;
max-height: 220px;
overflow-y: auto;
.chatpapers-lecture-para-list-hint {
font-size: 11px;
opacity: 0.68;
line-height: 1.35;
}
.chatpapers-lecture-beat-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 8px 10px;
align-items: stretch;
gap: 4px;
width: 100%;
max-width: 100%;
min-width: 0;
min-height: 40px;
box-sizing: border-box;
border: 1px solid color-mix(in srgb, #1f7a8c 18%, transparent);
border-radius: 8px;
background: color-mix(in srgb, #1f7a8c 4%, transparent);
overflow: hidden;
}
.chatpapers-lecture-beat-main {
flex: 1 1 auto;
min-width: 0;
min-height: 40px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 6px 10px;
border: none;
background: transparent;
cursor: pointer;
text-align: left;
font: inherit;
font-size: 12px;
color: inherit;
box-sizing: border-box;
overflow: hidden;
}
.chatpapers-lecture-beat-main:hover:not(:disabled) {
background: color-mix(in srgb, #1f7a8c 10%, transparent);
}
.chatpapers-lecture-beat-main:disabled {
opacity: 0.55;
cursor: default;
}
.chatpapers-lecture-beat-play {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
width: 34px;
align-self: stretch;
border: none;
border-left: 1px solid color-mix(in srgb, #1f7a8c 18%, transparent);
background: color-mix(in srgb, #1f7a8c 6%, transparent);
cursor: pointer;
color: inherit;
}
.chatpapers-lecture-beat-item:hover:not(:disabled) {
background: color-mix(in srgb, #1f7a8c 10%, transparent);
.chatpapers-lecture-beat-play:hover:not(:disabled) {
background: color-mix(in srgb, #1f7a8c 16%, transparent);
}
.chatpapers-lecture-beat-play:disabled {
opacity: 0.45;
cursor: default;
}
.chatpapers-lecture-beat-item.is-selected {
border-color: color-mix(in srgb, #2563eb 45%, transparent);
background: color-mix(in srgb, #2563eb 8%, transparent);
}
.chatpapers-lecture-beat-item.is-active {
@@ -1175,38 +1328,53 @@ collapsible-section[open] > :not(.head) .chatpapers-lecture-root {
background: color-mix(in srgb, #16a34a 10%, transparent);
}
.chatpapers-lecture-beat-item.is-selected.is-active {
border-color: color-mix(in srgb, #16a34a 50%, transparent);
box-shadow: inset 3px 0 0 color-mix(in srgb, #2563eb 70%, transparent);
}
.chatpapers-lecture-beat-item.is-pending {
opacity: 0.55;
cursor: default;
}
.chatpapers-lecture-beat-meta {
.chatpapers-lecture-beat-line {
display: flex;
flex-direction: column;
gap: 2px;
align-items: center;
gap: 8px;
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
}
.chatpapers-lecture-beat-type {
font-size: 10px;
.chatpapers-lecture-beat-label {
flex-shrink: 0;
font-size: 11px;
font-weight: 600;
opacity: 0.65;
text-transform: uppercase;
letter-spacing: 0.03em;
line-height: 1.3;
opacity: 0.72;
white-space: nowrap;
}
.chatpapers-lecture-beat-title {
.chatpapers-lecture-beat-preview {
flex: 1 1 auto;
min-width: 0;
font-size: 12px;
line-height: 1.35;
line-height: 1.4;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.chatpapers-lecture-beat-status {
flex-shrink: 0;
align-self: center;
font-size: 11px;
line-height: 1;
opacity: 0.7;
max-width: 4.5em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.chatpapers-lecture-player-controls {
@@ -1,11 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="context-stroke" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<!-- Lucide: FoldVertical (adaptive off / fixed height) -->
<path d="M12 22v-6"/>
<path d="M12 8V2"/>
<path d="M4 12H2"/>
<path d="M10 12H8"/>
<path d="M16 12h-2"/>
<path d="M22 12h-2"/>
<path d="m15 19-3-3-3 3"/>
<path d="m15 5-3 3-3-3"/>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- Lucide FoldVertical, filled for Zotero toolbar buttons -->
<path d="M7.375 2.75h1.25v10.5h-1.25V2.75z" fill="context-fill"/>
<path d="M8 5.25 4.75 2h6.5L8 5.25z" fill="context-fill"/>
<path d="M8 10.75 4.75 14h6.5L8 10.75z" fill="context-fill"/>
<path d="M1.5 7.625h1.25v.75H1.5v-.75zm2.75 0h1.25v.75H4.25v-.75zm5.5 0H11v.75H9.75v-.75zm2.75 0h1.25v.75H13v-.75z" fill="context-fill" fill-opacity="0.82"/>
</svg>

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 522 B

+6 -10
View File
@@ -1,11 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="context-stroke" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<!-- Lucide: UnfoldVertical (adaptive on) -->
<path d="M12 22v-6"/>
<path d="M12 8V2"/>
<path d="M4 12H2"/>
<path d="M10 12H8"/>
<path d="M16 12h-2"/>
<path d="M22 12h-2"/>
<path d="m15 19-3 3-3-3"/>
<path d="m15 5-3-3-3 3"/>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- Lucide UnfoldVertical, filled for Zotero toolbar buttons -->
<path d="M7.375 2.75h1.25v10.5h-1.25V2.75z" fill="context-fill"/>
<path d="M8 2.75 4.75 6h6.5L8 2.75z" fill="context-fill"/>
<path d="M8 13.25 4.75 10h6.5L8 13.25z" fill="context-fill"/>
<path d="M1.5 7.625h1.25v.75H1.5v-.75zm2.75 0h1.25v.75H4.25v-.75zm5.5 0H11v.75H9.75v-.75zm2.75 0h1.25v.75H13v-.75z" fill="context-fill" fill-opacity="0.82"/>
</svg>

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 524 B

+3 -6
View File
@@ -1,7 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="context-stroke" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<!-- Lucide: AppWindow -->
<rect x="2" y="4" width="20" height="16" rx="2"/>
<path d="M10 4v4"/>
<path d="M2 8h20"/>
<path d="M6 4v4"/>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- Lucide AppWindow, filled for Zotero toolbar buttons -->
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 2.5h10a1.5 1.5 0 0 1 1.5 1.5v8.5a1.5 1.5 0 0 1-1.5 1.5H3A1.5 1.5 0 0 1 1.5 12.5V4A1.5 1.5 0 0 1 3 2.5Zm0 2.5v7.5a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5V5H3Zm9-2H4a.5.5 0 0 0-.5.5V4.5h9V3a.5.5 0 0 0-.5-.5ZM5.25 2.5h1V4h-1V2.5Z" fill="context-fill"/>
</svg>

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 465 B

+11 -4
View File
@@ -4,10 +4,14 @@ prefs-title = ChatPapers
item-section-chat-head = ChatPapers
item-section-chat-sidenav = Chat with paper
item-pane-open-window = Open in separate window
item-pane-adaptive-height = Adaptive height
item-pane-adaptive-height-on = Adaptive height (on)
item-pane-adaptive-height-off = Adaptive height (off)
item-pane-open-window =
.tooltiptext = Open in separate window
item-pane-adaptive-height =
.tooltiptext = Toggle adaptive height
item-pane-adaptive-height-on =
.tooltiptext = Adaptive height (on) — click to use fixed height
item-pane-adaptive-height-off =
.tooltiptext = Fixed height (on) — click to use adaptive height
chat-loading = Loading ChatPapers…
chat-placeholder = Ask a question about this paper…
@@ -91,6 +95,9 @@ lecture-note-saved = Lecture note saved to Zotero
lecture-mode-overview = Overview
lecture-mode-paragraph = Paragraph reading
lecture-paragraph-list-title = Paper paragraphs (original, then translation)
lecture-para-list-hint = Click a paragraph for details; click ▶ to play
lecture-para-detail-empty = Select a paragraph above to view original, translation, and context
lecture-para-play = Play this part
lecture-para-label = Para { $n }
lecture-para-original = Original
lecture-para-translation = Translation
+11 -4
View File
@@ -4,10 +4,14 @@ prefs-title = ChatPapers
item-section-chat-head = ChatPapers
item-section-chat-sidenav = 论文对话
item-pane-open-window = 在独立窗口中打开
item-pane-adaptive-height = 自适应高度
item-pane-adaptive-height-on = 自适应高度(已开启)
item-pane-adaptive-height-off = 自适应高度(已关闭)
item-pane-open-window =
.tooltiptext = 在独立窗口中打开
item-pane-adaptive-height =
.tooltiptext = 切换自适应高度
item-pane-adaptive-height-on =
.tooltiptext = 自适应高度(已开启)— 点击切换为固定高度
item-pane-adaptive-height-off =
.tooltiptext = 固定高度(已开启)— 点击切换为自适应高度
chat-loading = 正在加载 ChatPapers…
chat-placeholder = 就这篇论文提问…
@@ -91,6 +95,9 @@ lecture-note-saved = 伴读笔记已写入 Zotero 子笔记
lecture-mode-overview = 整体讲解
lecture-mode-paragraph = 逐段精读
lecture-paragraph-list-title = 论文段落(先读原文,再听译文)
lecture-para-list-hint = 点击段落查看详情,点击 ▶ 开始朗读
lecture-para-detail-empty = 点击上方段落查看原文、译文与上下文
lecture-para-play = 朗读此段
lecture-para-label = 段落 { $n }
lecture-para-original = 原文
lecture-para-translation = 译文 / 讲解