Ulysses
Ulysses 是一款适用于 Mac、iPad 和 iPhone 的强大写作应用。Protocol Launcher 允许您生成深度链接以在 Ulysses 中创建和管理文稿、群组及笔记。
使用方式
有两种使用此库的方式:
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
打开应用
ts
import { open } from 'protocol-launcher/ulysses'
const url = open()打开项目
通过标识符、名称或路径打开文稿或群组。
ts
import { openItem } from 'protocol-launcher/ulysses'
const url = openItem({
id: 'DCj45UWKr_g15y2vBPwJdQ',
})新建文稿
创建新文稿,可选择内容、群组、格式和位置。
ts
import { newSheet } from 'protocol-launcher/ulysses'
const url = newSheet({
text: 'My new sheet content',
group: '/Books',
format: 'markdown',
index: 0,
})插入文本
向现有文稿插入或追加文本。
ts
import { insert } from 'protocol-launcher/ulysses'
const url = insert({
id: 'H8zLAmc1I0njH-0Ql-3YGQ',
text: 'Inserted text',
format: 'markdown',
position: 'end',
newline: 'prepend',
})附加笔记
将笔记附加到文稿。
ts
import { attachNote } from 'protocol-launcher/ulysses'
const url = attachNote({
id: 'H8zLAmc1I0njH-0Ql-3YGQ',
text: 'My new note',
format: 'markdown',
})附加关键词
向文稿添加关键词。
ts
import { attachKeywords } from 'protocol-launcher/ulysses'
const url = attachKeywords({
id: 'H8zLAmc1I0njH-0Ql-3YGQ',
keywords: 'Draft,Important',
})新建群组
创建新群组以组织文稿。
ts
import { newGroup } from 'protocol-launcher/ulysses'
const url = newGroup({
name: 'My Group',
parent: '/Books',
index: 0,
})复制项目
将文稿或群组复制到目标位置。
ts
import { copy } from 'protocol-launcher/ulysses'
const url = copy({
id: 'hZ7IX2jqKbVmPGlYUXkZjQ',
targetGroup: 'H8zLAmc1I0njH-0Ql-3YGQ',
index: 4,
})打开全部
打开显示所有文稿的"全部"特殊群组。
ts
import { openAll } from 'protocol-launcher/ulysses'
const url = openAll()打开收藏
打开"收藏"特殊群组。
ts
import { openFavorites } from 'protocol-launcher/ulysses'
const url = openFavorites()打开最近
打开"最近 7 天"(最近)特殊群组。
ts
import { openRecent } from 'protocol-launcher/ulysses'
const url = openRecent()