@lemonriver/core 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-DYN-H65n.js → build-Dm7gVRhb.js} +1 -1
- package/dist/cli/bin.js +3 -3
- package/dist/{config-DW1wSoxa.js → config-CubOIzrs.js} +1950 -1429
- package/dist/{dev-_VDoRfAK.js → dev-DgLeXPqp.js} +1 -1
- package/dist/{preview-CYIGh3Z8.js → preview-CxXQpPk5.js} +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/src/app/components/command/slide-command-menu.tsx +0 -9
- package/src/app/lemonriver/backup/client.ts +25 -1
- package/src/app/lemonriver/backup/model.test.ts +19 -7
- package/src/app/lemonriver/backup/model.ts +63 -18
- package/src/app/lemonriver/board/board-page.tsx +2 -2
- package/src/app/lemonriver/help/model.test.ts +1 -1
- package/src/app/lemonriver/help/model.ts +1 -1
- package/src/app/lemonriver/home/drafts.test.ts +23 -0
- package/src/app/lemonriver/home/drafts.ts +57 -0
- package/src/app/lemonriver/home/home-page.tsx +94 -10
- package/src/app/lemonriver/home/organize-drafts.tsx +192 -0
- package/src/app/lemonriver/outline/outline-page.tsx +8 -1
- package/src/app/lemonriver/settings/backup-restore-dialog.tsx +15 -1
- package/src/app/lemonriver/settings/backup-section.tsx +146 -28
- package/src/app/lemonriver/settings/settings-page.tsx +3 -0
- package/src/app/lemonriver/settings/workspace-card.tsx +53 -0
- package/src/app/lemonriver/settings/workspace.ts +37 -0
- package/src/app/lemonriver/share/editor-share.tsx +55 -0
- package/src/app/lemonriver/share/import-dialog.tsx +14 -0
- package/src/app/lemonriver/share/naming.test.ts +11 -0
- package/src/app/lemonriver/share/naming.ts +6 -1
- package/src/app/lemonriver/slide-extensions.tsx +37 -53
- package/src/app/lemonriver/text/en.ts +46 -11
- package/src/app/lemonriver/text/es.ts +39 -6
- package/src/app/lemonriver/text/ja.ts +39 -6
- package/src/app/lemonriver/text/types.ts +45 -6
- package/src/app/lemonriver/text/zh-cn.ts +47 -11
- package/src/app/lemonriver/text/zh-tw.ts +47 -11
- package/src/app/lemonriver/update/beta-badge.tsx +69 -0
- package/src/app/lib/export-html.ts +5 -3
- package/src/app/lib/export-pptx.ts +5 -4
- package/src/app/routes/slide.tsx +6 -57
|
@@ -14,7 +14,7 @@ export const zhCN: LrText = {
|
|
|
14
14
|
import: '导入',
|
|
15
15
|
backupNow: '立即备份',
|
|
16
16
|
autoBackup: '每天自动备份',
|
|
17
|
-
|
|
17
|
+
skipVideos: '不备份大于 100MB 的视频',
|
|
18
18
|
restore: '从备份恢复…',
|
|
19
19
|
restoreGo: '恢复',
|
|
20
20
|
chooseOtherFile: '选择其它备份文件…',
|
|
@@ -333,7 +333,7 @@ export const zhCN: LrText = {
|
|
|
333
333
|
text: '打开「{autoBackup}」:LemonRiver 开着的时候每天备份一次。也可以随时点「{backupNow}」。',
|
|
334
334
|
},
|
|
335
335
|
{
|
|
336
|
-
text: '
|
|
336
|
+
text: '备份保留最近 30 天,更早的会自动删掉。只动 LemonRiver 自己写进这个文件夹的内容,你放进去的其它文件不会动。',
|
|
337
337
|
},
|
|
338
338
|
],
|
|
339
339
|
},
|
|
@@ -422,7 +422,7 @@ export const zhCN: LrText = {
|
|
|
422
422
|
kind: 'list',
|
|
423
423
|
items: [
|
|
424
424
|
{
|
|
425
|
-
text: '免费的 iCloud 只有 5GB
|
|
425
|
+
text: '免费的 iCloud 只有 5GB,工作区的备份可能就有几百 MB。空间不够时可以在设置里打开「{skipVideos}」,或者在 iCloud 里升级空间。',
|
|
426
426
|
},
|
|
427
427
|
{
|
|
428
428
|
text: '换电脑恢复时,备份文件旁边如果是一朵云,表示还没下载到这台电脑:先双击它等下载完,再去恢复。',
|
|
@@ -484,7 +484,10 @@ export const zhCN: LrText = {
|
|
|
484
484
|
},
|
|
485
485
|
],
|
|
486
486
|
},
|
|
487
|
-
{
|
|
487
|
+
{
|
|
488
|
+
kind: 'list',
|
|
489
|
+
items: [{ text: '微云的免费空间比较小,可以在设置里打开「{skipVideos}」。' }],
|
|
490
|
+
},
|
|
488
491
|
],
|
|
489
492
|
},
|
|
490
493
|
{
|
|
@@ -604,7 +607,7 @@ export const zhCN: LrText = {
|
|
|
604
607
|
},
|
|
605
608
|
{
|
|
606
609
|
strong: '云盘空间满了。',
|
|
607
|
-
text: '
|
|
610
|
+
text: '备份一共占用多少在设置里能看到;空间不够时可以打开「{skipVideos}」。',
|
|
608
611
|
},
|
|
609
612
|
{
|
|
610
613
|
strong: '出现了「冲突副本」之类的文件。',
|
|
@@ -865,6 +868,18 @@ export const zhCN: LrText = {
|
|
|
865
868
|
renameHint: '新名字会显示在卡片和导出的文件上。',
|
|
866
869
|
nameRequired: '名称不能为空。',
|
|
867
870
|
noMatchesHint: '换个关键词试试,或者清空搜索看全部幻灯片。',
|
|
871
|
+
organizeDrafts: '整理草稿',
|
|
872
|
+
/** template: "草稿里有 {n} 份还没整理" */
|
|
873
|
+
draftReminder: '草稿里有 {n} 份还没整理',
|
|
874
|
+
organizeTitle: '整理草稿',
|
|
875
|
+
organizeStay: '留在草稿',
|
|
876
|
+
organizeNew: '新建文件夹…',
|
|
877
|
+
organizeNamePlaceholder: '文件夹名',
|
|
878
|
+
/** template: "移动 {n} 份" */
|
|
879
|
+
organizeMove: '移动 {n} 份',
|
|
880
|
+
/** template: "新幻灯片已放进「{folder}」" */
|
|
881
|
+
newDeckFiled: '新幻灯片已放进「{folder}」',
|
|
882
|
+
organizeFailed: '有幻灯片没能移动',
|
|
868
883
|
},
|
|
869
884
|
trash: {
|
|
870
885
|
title: '回收站',
|
|
@@ -893,6 +908,12 @@ export const zhCN: LrText = {
|
|
|
893
908
|
helpTitle: '帮助',
|
|
894
909
|
helpHint: '分享、导入、备份和云盘设置的说明',
|
|
895
910
|
helpOpen: '打开帮助',
|
|
911
|
+
workspaceTitle: '工作区文件夹',
|
|
912
|
+
workspaceHint: '让 Agent 在这个文件夹里工作。',
|
|
913
|
+
workspaceCopy: '复制',
|
|
914
|
+
workspaceCopied: '已复制',
|
|
915
|
+
workspaceReveal: '在访达里显示',
|
|
916
|
+
workspaceCopiedToast: '已复制工作区文件夹地址',
|
|
896
917
|
},
|
|
897
918
|
agents: {
|
|
898
919
|
title: 'Agent',
|
|
@@ -1103,7 +1124,8 @@ export const zhCN: LrText = {
|
|
|
1103
1124
|
},
|
|
1104
1125
|
share: {
|
|
1105
1126
|
open: '分享',
|
|
1106
|
-
|
|
1127
|
+
openHint: '分享 (S)',
|
|
1128
|
+
menuItem: '分享…',
|
|
1107
1129
|
dialogTitle: '分享「{title}」',
|
|
1108
1130
|
dialogDescription:
|
|
1109
1131
|
'打包成一个压缩包,用微信、邮件、网盘发给对方。对方没装 LemonRiver 也能看 PDF。',
|
|
@@ -1169,7 +1191,7 @@ export const zhCN: LrText = {
|
|
|
1169
1191
|
},
|
|
1170
1192
|
backup: {
|
|
1171
1193
|
title: '备份',
|
|
1172
|
-
hint: '
|
|
1194
|
+
hint: '备份的是整个工作区(所有幻灯片、素材、主题),跟幻灯片有几份没关系。',
|
|
1173
1195
|
location: '备份位置',
|
|
1174
1196
|
notSet: '还没选',
|
|
1175
1197
|
change: '更改',
|
|
@@ -1186,12 +1208,26 @@ export const zhCN: LrText = {
|
|
|
1186
1208
|
},
|
|
1187
1209
|
auto: '每天自动备份',
|
|
1188
1210
|
autoHint: 'LemonRiver 开着的时候,每天备份一次。',
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1211
|
+
retain: '保留最近 30 天,每天的改动都能找回。',
|
|
1212
|
+
totalSize: '备份一共占用 {size}',
|
|
1213
|
+
biggestTitle: '最大的几个文件',
|
|
1214
|
+
biggestItem: '{name} · {size}',
|
|
1215
|
+
biggestItemDeck: '{name} · {size} · 在「{deck}」里',
|
|
1216
|
+
skipVideos: '不备份大于 100MB 的视频',
|
|
1217
|
+
skipVideosHint: '省云盘空间。这些视频仍留在这台电脑上。',
|
|
1218
|
+
skipped: '有 {n} 个大视频没有备份',
|
|
1219
|
+
restoreSkipped: '这份备份里没有 {n} 个大视频',
|
|
1220
|
+
exportFull: '导出完整备份…',
|
|
1221
|
+
exportTitle: '导出完整备份',
|
|
1222
|
+
exportHint: '选一天,生成的文件可以用「从备份恢复…」打开。',
|
|
1223
|
+
exportDone: '已保存 {name}({size})',
|
|
1224
|
+
exportFailed: '导出这份备份失败。',
|
|
1225
|
+
oldFormat: '旧格式',
|
|
1226
|
+
snapshotLine: '{decks} 份幻灯片 · {size} · {when}',
|
|
1227
|
+
zipLine: '旧格式 · {size} · {when}',
|
|
1192
1228
|
runNow: '立即备份',
|
|
1193
1229
|
running: '已打包 {done} / {total} 个文件',
|
|
1194
|
-
lastOk: '上次备份:{when} · {
|
|
1230
|
+
lastOk: '上次备份:{when} · 这次新增 {added} · 成功',
|
|
1195
1231
|
lastFailed: '上次备份失败:{error}',
|
|
1196
1232
|
tooLarge: '工作区超过 4GB,现在的备份格式放不下。可以先把大的视频移出素材库再备份。',
|
|
1197
1233
|
never: '还没备份过',
|
|
@@ -14,7 +14,7 @@ export const zhTW: LrText = {
|
|
|
14
14
|
import: '匯入',
|
|
15
15
|
backupNow: '立即備份',
|
|
16
16
|
autoBackup: '每天自動備份',
|
|
17
|
-
|
|
17
|
+
skipVideos: '不備份大於 100MB 的影片',
|
|
18
18
|
restore: '從備份還原…',
|
|
19
19
|
restoreGo: '還原',
|
|
20
20
|
chooseOtherFile: '選擇其它備份檔案…',
|
|
@@ -333,7 +333,7 @@ export const zhTW: LrText = {
|
|
|
333
333
|
text: '打開「{autoBackup}」:LemonRiver 開著的時候每天備份一次。也可以隨時點「{backupNow}」。',
|
|
334
334
|
},
|
|
335
335
|
{
|
|
336
|
-
text: '
|
|
336
|
+
text: '備份保留最近 30 天,更早的會自動刪掉。只動 LemonRiver 自己寫進這個資料夾的內容,你放進去的其它檔案不會動。',
|
|
337
337
|
},
|
|
338
338
|
],
|
|
339
339
|
},
|
|
@@ -422,7 +422,7 @@ export const zhTW: LrText = {
|
|
|
422
422
|
kind: 'list',
|
|
423
423
|
items: [
|
|
424
424
|
{
|
|
425
|
-
text: '免費的 iCloud 只有 5GB
|
|
425
|
+
text: '免費的 iCloud 只有 5GB,工作區的備份可能就有幾百 MB。空間不夠時可以在設定裡開啟「{skipVideos}」,或者在 iCloud 裡升級空間。',
|
|
426
426
|
},
|
|
427
427
|
{
|
|
428
428
|
text: '換電腦還原時,備份檔案旁邊如果是一朵雲,表示還沒下載到這台電腦:先雙擊它等下載完,再去還原。',
|
|
@@ -484,7 +484,10 @@ export const zhTW: LrText = {
|
|
|
484
484
|
},
|
|
485
485
|
],
|
|
486
486
|
},
|
|
487
|
-
{
|
|
487
|
+
{
|
|
488
|
+
kind: 'list',
|
|
489
|
+
items: [{ text: '微雲的免費空間比較小,可以在設定裡開啟「{skipVideos}」。' }],
|
|
490
|
+
},
|
|
488
491
|
],
|
|
489
492
|
},
|
|
490
493
|
{
|
|
@@ -604,7 +607,7 @@ export const zhTW: LrText = {
|
|
|
604
607
|
},
|
|
605
608
|
{
|
|
606
609
|
strong: '雲端硬碟空間滿了。',
|
|
607
|
-
text: '
|
|
610
|
+
text: '備份一共占用多少在設定裡能看到;空間不夠時可以開啟「{skipVideos}」。',
|
|
608
611
|
},
|
|
609
612
|
{
|
|
610
613
|
strong: '出現了「衝突副本」之類的檔案。',
|
|
@@ -865,6 +868,18 @@ export const zhTW: LrText = {
|
|
|
865
868
|
renameHint: '新名稱會顯示在卡片和匯出的檔案上。',
|
|
866
869
|
nameRequired: '名稱不能空白。',
|
|
867
870
|
noMatchesHint: '換個關鍵字試試,或清除搜尋看全部投影片。',
|
|
871
|
+
organizeDrafts: '整理草稿',
|
|
872
|
+
/** template: "草稿裡有 {n} 份還沒整理" */
|
|
873
|
+
draftReminder: '草稿裡有 {n} 份還沒整理',
|
|
874
|
+
organizeTitle: '整理草稿',
|
|
875
|
+
organizeStay: '留在草稿',
|
|
876
|
+
organizeNew: '新建資料夾…',
|
|
877
|
+
organizeNamePlaceholder: '資料夾名稱',
|
|
878
|
+
/** template: "移動 {n} 份" */
|
|
879
|
+
organizeMove: '移動 {n} 份',
|
|
880
|
+
/** template: "新投影片已放進「{folder}」" */
|
|
881
|
+
newDeckFiled: '新投影片已放進「{folder}」',
|
|
882
|
+
organizeFailed: '有投影片沒能移動',
|
|
868
883
|
},
|
|
869
884
|
trash: {
|
|
870
885
|
title: '回收站',
|
|
@@ -893,6 +908,12 @@ export const zhTW: LrText = {
|
|
|
893
908
|
helpTitle: '說明',
|
|
894
909
|
helpHint: '分享、匯入、備份和雲端硬碟設定的說明',
|
|
895
910
|
helpOpen: '打開說明',
|
|
911
|
+
workspaceTitle: '工作區資料夾',
|
|
912
|
+
workspaceHint: '讓 Agent 在這個資料夾裡工作。',
|
|
913
|
+
workspaceCopy: '複製',
|
|
914
|
+
workspaceCopied: '已複製',
|
|
915
|
+
workspaceReveal: '在 Finder 中顯示',
|
|
916
|
+
workspaceCopiedToast: '已複製工作區資料夾位址',
|
|
896
917
|
},
|
|
897
918
|
agents: {
|
|
898
919
|
title: 'Agent',
|
|
@@ -1103,7 +1124,8 @@ export const zhTW: LrText = {
|
|
|
1103
1124
|
},
|
|
1104
1125
|
share: {
|
|
1105
1126
|
open: '分享',
|
|
1106
|
-
|
|
1127
|
+
openHint: '分享 (S)',
|
|
1128
|
+
menuItem: '分享…',
|
|
1107
1129
|
dialogTitle: '分享「{title}」',
|
|
1108
1130
|
dialogDescription:
|
|
1109
1131
|
'打包成一個壓縮檔,用微信、郵件、網盤寄給對方。對方沒裝 LemonRiver 也能看 PDF。',
|
|
@@ -1169,7 +1191,7 @@ export const zhTW: LrText = {
|
|
|
1169
1191
|
},
|
|
1170
1192
|
backup: {
|
|
1171
1193
|
title: '備份',
|
|
1172
|
-
hint: '
|
|
1194
|
+
hint: '備份的是整個工作區(所有簡報、素材、主題),跟簡報有幾份沒關係。',
|
|
1173
1195
|
location: '備份位置',
|
|
1174
1196
|
notSet: '還沒選',
|
|
1175
1197
|
change: '更改',
|
|
@@ -1186,12 +1208,26 @@ export const zhTW: LrText = {
|
|
|
1186
1208
|
},
|
|
1187
1209
|
auto: '每天自動備份',
|
|
1188
1210
|
autoHint: 'LemonRiver 開著的時候,每天備份一次。',
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1211
|
+
retain: '保留最近 30 天,每天的改動都能找回。',
|
|
1212
|
+
totalSize: '備份一共占用 {size}',
|
|
1213
|
+
biggestTitle: '最大的幾個檔案',
|
|
1214
|
+
biggestItem: '{name} · {size}',
|
|
1215
|
+
biggestItemDeck: '{name} · {size} · 在「{deck}」裡',
|
|
1216
|
+
skipVideos: '不備份大於 100MB 的影片',
|
|
1217
|
+
skipVideosHint: '省雲端空間。這些影片仍留在這台電腦上。',
|
|
1218
|
+
skipped: '有 {n} 個大影片沒有備份',
|
|
1219
|
+
restoreSkipped: '這份備份裡沒有 {n} 個大影片',
|
|
1220
|
+
exportFull: '匯出完整備份…',
|
|
1221
|
+
exportTitle: '匯出完整備份',
|
|
1222
|
+
exportHint: '選一天,產生的檔案可以用「從備份還原…」開啟。',
|
|
1223
|
+
exportDone: '已儲存 {name}({size})',
|
|
1224
|
+
exportFailed: '匯出這份備份失敗。',
|
|
1225
|
+
oldFormat: '舊格式',
|
|
1226
|
+
snapshotLine: '{decks} 份投影片 · {size} · {when}',
|
|
1227
|
+
zipLine: '舊格式 · {size} · {when}',
|
|
1192
1228
|
runNow: '立即備份',
|
|
1193
1229
|
running: '已打包 {done} / {total} 個檔案',
|
|
1194
|
-
lastOk: '上次備份:{when} · {
|
|
1230
|
+
lastOk: '上次備份:{when} · 這次新增 {added} · 成功',
|
|
1195
1231
|
lastFailed: '上次備份失敗:{error}',
|
|
1196
1232
|
tooLarge: '工作區超過 4GB,現在的備份格式放不下。可以先把大的影片移出素材庫再備份。',
|
|
1197
1233
|
never: '還沒備份過',
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import config from 'virtual:open-slide/config';
|
|
2
|
+
import { Folder } from 'lucide-react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { toast } from 'sonner';
|
|
2
5
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
|
6
|
+
import { copyWorkspacePath, workspacePath } from '../settings/workspace';
|
|
3
7
|
import { useLrText } from '../text';
|
|
4
8
|
import { shouldShowBeta } from './version';
|
|
5
9
|
|
|
10
|
+
/** The sidebar's version row: the Beta chip while it applies, then the workspace shortcut. */
|
|
6
11
|
export function BetaBadge() {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<BetaChip />
|
|
15
|
+
<WorkspaceCopyButton />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function BetaChip() {
|
|
7
21
|
const t = useLrText().update;
|
|
8
22
|
if (!shouldShowBeta(config.version)) return null;
|
|
9
23
|
return (
|
|
@@ -27,3 +41,58 @@ export function BetaBadge() {
|
|
|
27
41
|
</Tooltip>
|
|
28
42
|
);
|
|
29
43
|
}
|
|
44
|
+
|
|
45
|
+
function WorkspaceCopyButton() {
|
|
46
|
+
const t = useLrText().settings;
|
|
47
|
+
const [path, setPath] = useState<string | null>(null);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
let live = true;
|
|
51
|
+
void workspacePath().then((value) => {
|
|
52
|
+
if (live) setPath(value);
|
|
53
|
+
});
|
|
54
|
+
return () => {
|
|
55
|
+
live = false;
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
if (!path) return null;
|
|
60
|
+
|
|
61
|
+
async function copy() {
|
|
62
|
+
if (await copyWorkspacePath()) toast.success(t.workspaceCopiedToast);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Tooltip>
|
|
67
|
+
<TooltipTrigger
|
|
68
|
+
render={
|
|
69
|
+
// The version row is itself a button when an update is waiting, so
|
|
70
|
+
// this stays a span and takes its own clicks.
|
|
71
|
+
// biome-ignore lint/a11y/useSemanticElements: the version row is already a button when an update waits
|
|
72
|
+
<span
|
|
73
|
+
role="button"
|
|
74
|
+
tabIndex={0}
|
|
75
|
+
aria-label={t.workspaceCopy}
|
|
76
|
+
data-lr-workspace-copy
|
|
77
|
+
onClick={(event) => {
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
void copy();
|
|
80
|
+
}}
|
|
81
|
+
onKeyDown={(event) => {
|
|
82
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
void copy();
|
|
86
|
+
}}
|
|
87
|
+
className="inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-brand"
|
|
88
|
+
>
|
|
89
|
+
<Folder className="size-3" />
|
|
90
|
+
</span>
|
|
91
|
+
}
|
|
92
|
+
/>
|
|
93
|
+
<TooltipContent side="bottom" align="start" sideOffset={6}>
|
|
94
|
+
{t.workspaceCopy}
|
|
95
|
+
</TooltipContent>
|
|
96
|
+
</Tooltip>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { exportBaseName } from '../lemonriver/share/naming';
|
|
3
4
|
import { designToCssVars } from './design';
|
|
4
5
|
import { downloadBlob, nextFrame } from './dom';
|
|
5
6
|
import { SlidePageProvider } from './page-context';
|
|
@@ -14,6 +15,7 @@ export async function exportSlideAsHtml(slide: SlideModule, slideId: string): Pr
|
|
|
14
15
|
const pages = slide.default ?? [];
|
|
15
16
|
if (pages.length === 0) return;
|
|
16
17
|
const title = slide.meta?.title ?? slideId;
|
|
18
|
+
const fileBase = exportBaseName(slide.meta?.title, slideId);
|
|
17
19
|
|
|
18
20
|
const pagesHtml = await renderPagesToHtml(pages);
|
|
19
21
|
const bundledCss = collectCss();
|
|
@@ -53,20 +55,20 @@ export async function exportSlideAsHtml(slide: SlideModule, slideId: string): Pr
|
|
|
53
55
|
const htmlBytes = new TextEncoder().encode(html);
|
|
54
56
|
|
|
55
57
|
if (assets.size === 0) {
|
|
56
|
-
downloadBlob(new Blob([htmlBytes as BlobPart], { type: 'text/html' }), `${
|
|
58
|
+
downloadBlob(new Blob([htmlBytes as BlobPart], { type: 'text/html' }), `${fileBase}.html`);
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
const { zipSync } = await import('fflate');
|
|
61
63
|
const zipTree: Record<string, Uint8Array | Record<string, Uint8Array>> = {
|
|
62
|
-
[`${
|
|
64
|
+
[`${fileBase}.html`]: htmlBytes,
|
|
63
65
|
assets: {},
|
|
64
66
|
};
|
|
65
67
|
for (const { name, bytes } of assets.values()) {
|
|
66
68
|
(zipTree.assets as Record<string, Uint8Array>)[name] = bytes;
|
|
67
69
|
}
|
|
68
70
|
const zipped = zipSync(zipTree as Parameters<typeof zipSync>[0]);
|
|
69
|
-
downloadBlob(new Blob([zipped as BlobPart], { type: 'application/zip' }), `${
|
|
71
|
+
downloadBlob(new Blob([zipped as BlobPart], { type: 'application/zip' }), `${fileBase}.zip`);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
async function renderPagesToHtml(pages: NonNullable<SlideModule['default']>): Promise<string[]> {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { exportBaseName } from '../lemonriver/share/naming';
|
|
1
2
|
import { downloadBlob } from './dom';
|
|
2
3
|
import { CANVAS_HEIGHT, CANVAS_WIDTH, type SlideModule } from './sdk';
|
|
3
4
|
|
|
@@ -44,10 +45,10 @@ function download(
|
|
|
44
45
|
files: Record<string, Uint8Array>,
|
|
45
46
|
zip: (f: Record<string, Uint8Array>) => Uint8Array,
|
|
46
47
|
mime: string,
|
|
47
|
-
|
|
48
|
+
fileBase: string,
|
|
48
49
|
) {
|
|
49
50
|
const zipped = zip(files);
|
|
50
|
-
downloadBlob(new Blob([zipped as BlobPart], { type: mime }), `${
|
|
51
|
+
downloadBlob(new Blob([zipped as BlobPart], { type: mime }), `${fileBase}.pptx`);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
/**
|
|
@@ -94,7 +95,7 @@ export async function exportSlideAsPptx(
|
|
|
94
95
|
lib.buildPptxFiles({ slides, images: images.images }),
|
|
95
96
|
lib.zipSync,
|
|
96
97
|
lib.PPTX_MIME,
|
|
97
|
-
slideId,
|
|
98
|
+
exportBaseName(slide.meta?.title, slideId),
|
|
98
99
|
);
|
|
99
100
|
} finally {
|
|
100
101
|
onProgress?.({ phase: 'done', current: total, total, percent: 100 });
|
|
@@ -160,7 +161,7 @@ export async function exportSlideAsImagePptx(
|
|
|
160
161
|
lib.buildPptxFiles({ slides, images: images.images }),
|
|
161
162
|
lib.zipSync,
|
|
162
163
|
lib.PPTX_MIME,
|
|
163
|
-
slideId,
|
|
164
|
+
exportBaseName(slide.meta?.title, slideId),
|
|
164
165
|
);
|
|
165
166
|
} finally {
|
|
166
167
|
onProgress?.({ phase: 'done', current: total, total, percent: 100 });
|
package/src/app/routes/slide.tsx
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import config from 'virtual:open-slide/config';
|
|
2
2
|
import {
|
|
3
|
-
Check,
|
|
4
3
|
ChevronDown,
|
|
5
4
|
ChevronLeft,
|
|
6
5
|
Download,
|
|
7
6
|
FileCode2,
|
|
8
7
|
FileImage,
|
|
9
8
|
FileText,
|
|
10
|
-
Link2,
|
|
11
9
|
Loader2,
|
|
12
10
|
Maximize,
|
|
13
11
|
MonitorSpeaker,
|
|
@@ -98,6 +96,7 @@ import { isDeckWarmed, markDeckWarmed, SlidePreloadLayer } from '../components/s
|
|
|
98
96
|
import { SlideTransitionLayer } from '../components/slide-transition-layer';
|
|
99
97
|
import { type ThumbnailActions, ThumbnailRail } from '../components/thumbnail-rail';
|
|
100
98
|
import { exportFailedHint } from '../lemonriver/feedback/export';
|
|
99
|
+
import { ShareMenuEntry } from '../lemonriver/share/editor-share';
|
|
101
100
|
import { SlideExtensions } from '../lemonriver/slide-extensions';
|
|
102
101
|
import { exportSlideAsHtml } from '../lib/export-html';
|
|
103
102
|
import { exportSlideAsPdf, isSafari, type PdfExportProgress } from '../lib/export-pdf';
|
|
@@ -119,15 +118,10 @@ export function Slide() {
|
|
|
119
118
|
const { slideId = '' } = useParams();
|
|
120
119
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
121
120
|
const navigate = useNavigate();
|
|
122
|
-
//
|
|
123
|
-
//
|
|
121
|
+
// Back always leads to the home view the editor was opened from, so the
|
|
122
|
+
// board and the pages opened from it never stack up in the history.
|
|
124
123
|
const goBack = useCallback(() => {
|
|
125
|
-
|
|
126
|
-
if (idx > 0) {
|
|
127
|
-
navigate(-1);
|
|
128
|
-
} else {
|
|
129
|
-
navigate(readLastHomeLocation(), { replace: true });
|
|
130
|
-
}
|
|
124
|
+
navigate(readLastHomeLocation(), { replace: true });
|
|
131
125
|
}, [navigate]);
|
|
132
126
|
const { slide, error } = useSlideModule(slideId);
|
|
133
127
|
useDocumentTitle(slide?.meta?.title);
|
|
@@ -143,8 +137,6 @@ export function Slide() {
|
|
|
143
137
|
index: number;
|
|
144
138
|
} | null>(null);
|
|
145
139
|
const [exporting, setExporting] = useState(false);
|
|
146
|
-
const [linkCopied, setLinkCopied] = useState(false);
|
|
147
|
-
const linkCopiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
148
140
|
const [designOpen, setDesignOpen] = useState(false);
|
|
149
141
|
const [overviewOpen, setOverviewOpen] = useState(false);
|
|
150
142
|
const [commandOpen, setCommandOpen] = useState(false);
|
|
@@ -161,11 +153,6 @@ export function Slide() {
|
|
|
161
153
|
setWarmedTick((n) => n + 1);
|
|
162
154
|
}, [slideId]);
|
|
163
155
|
|
|
164
|
-
useEffect(() => {
|
|
165
|
-
return () => {
|
|
166
|
-
if (linkCopiedTimerRef.current) clearTimeout(linkCopiedTimerRef.current);
|
|
167
|
-
};
|
|
168
|
-
}, []);
|
|
169
156
|
const { renameSlide } = useFolders();
|
|
170
157
|
const slideViewportRef = useRef<HTMLElement>(null);
|
|
171
158
|
const t = useLocale();
|
|
@@ -589,19 +576,6 @@ export function Slide() {
|
|
|
589
576
|
|
|
590
577
|
const title = slide.meta?.title ?? slideId;
|
|
591
578
|
|
|
592
|
-
const copyLink = async () => {
|
|
593
|
-
try {
|
|
594
|
-
await navigator.clipboard.writeText(window.location.href);
|
|
595
|
-
toast.success(t.slide.toastCopyLinkSuccess);
|
|
596
|
-
setLinkCopied(true);
|
|
597
|
-
if (linkCopiedTimerRef.current) clearTimeout(linkCopiedTimerRef.current);
|
|
598
|
-
linkCopiedTimerRef.current = setTimeout(() => setLinkCopied(false), 1200);
|
|
599
|
-
} catch (err) {
|
|
600
|
-
console.error('[open-slide] copy link failed', err);
|
|
601
|
-
toast.error(t.slide.toastCopyLinkFailed);
|
|
602
|
-
}
|
|
603
|
-
};
|
|
604
|
-
|
|
605
579
|
const exportHtml = async () => {
|
|
606
580
|
if (!slide || exporting) return;
|
|
607
581
|
setExporting(true);
|
|
@@ -766,28 +740,7 @@ export function Slide() {
|
|
|
766
740
|
<span aria-hidden className="mx-0.5 hidden h-5 w-px bg-hairline md:block" />
|
|
767
741
|
)}
|
|
768
742
|
{view === 'slides' && !compactToolbar && (
|
|
769
|
-
<
|
|
770
|
-
type="button"
|
|
771
|
-
aria-label={t.slide.copyLink}
|
|
772
|
-
title={t.slide.copyLink}
|
|
773
|
-
className={buttonVariants({ variant: 'ghost', size: 'icon-sm' })}
|
|
774
|
-
onClick={copyLink}
|
|
775
|
-
>
|
|
776
|
-
<span className="relative grid size-4 place-items-center">
|
|
777
|
-
<Link2
|
|
778
|
-
className={cn(
|
|
779
|
-
'col-start-1 row-start-1 size-4 transition-opacity duration-200',
|
|
780
|
-
linkCopied ? 'opacity-0' : 'opacity-100',
|
|
781
|
-
)}
|
|
782
|
-
/>
|
|
783
|
-
<Check
|
|
784
|
-
className={cn(
|
|
785
|
-
'col-start-1 row-start-1 size-4 transition-opacity duration-200',
|
|
786
|
-
linkCopied ? 'opacity-100' : 'opacity-0',
|
|
787
|
-
)}
|
|
788
|
-
/>
|
|
789
|
-
</span>
|
|
790
|
-
</button>
|
|
743
|
+
<span data-lr-header-actions className="contents" />
|
|
791
744
|
)}
|
|
792
745
|
{view === 'slides' && allowHtmlDownload && !compactToolbar && (
|
|
793
746
|
<DropdownMenu>
|
|
@@ -824,6 +777,7 @@ export function Slide() {
|
|
|
824
777
|
)}
|
|
825
778
|
</DropdownMenuTrigger>
|
|
826
779
|
<DropdownMenuContent align="end" className="min-w-[200px]">
|
|
780
|
+
<ShareMenuEntry />
|
|
827
781
|
{narrowToolbar && import.meta.env.DEV && (
|
|
828
782
|
<EditorMenuItems
|
|
829
783
|
designOpen={designOpen}
|
|
@@ -841,10 +795,6 @@ export function Slide() {
|
|
|
841
795
|
<Terminal />
|
|
842
796
|
{t.commandMenu.trigger}
|
|
843
797
|
</DropdownMenuItem>
|
|
844
|
-
<DropdownMenuItem onClick={copyLink}>
|
|
845
|
-
<Link2 />
|
|
846
|
-
{t.slide.copyLink}
|
|
847
|
-
</DropdownMenuItem>
|
|
848
798
|
</DropdownMenuGroup>
|
|
849
799
|
{allowHtmlDownload && <DropdownMenuSeparator />}
|
|
850
800
|
{allowHtmlDownload && exportMenuItems}
|
|
@@ -1026,7 +976,6 @@ export function Slide() {
|
|
|
1026
976
|
if (slideId) openPresenterWindow(slideId);
|
|
1027
977
|
present('window');
|
|
1028
978
|
},
|
|
1029
|
-
onCopyLink: copyLink,
|
|
1030
979
|
onOverview: () => setOverviewOpen(true),
|
|
1031
980
|
onToggleDesignPanel: () => setDesignOpen((v) => !v),
|
|
1032
981
|
onToggleAgentPanel: toggleAgent,
|