Skip to content

Commit d1890fe

Browse files
zhensherlockcodex
andcommitted
feat(iA Writer): add iA Writer URL scheme support
Co-Authored-By: Codex <267193182+codex@users.noreply.github.com>
1 parent 8fdf203 commit d1890fe

21 files changed

Lines changed: 742 additions & 0 deletions

File tree

.changeset/vast-clubs-sink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'protocol-launcher': minor
3+
---
4+
5+
feat(iA Writer): add iA Writer URL scheme support

apps/docs/.vitepress/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export default defineConfig({
6363
'en/apps/goland.md': 'apps/goland.md',
6464
'en/apps/hbuilderx.md': 'apps/hbuilderx.md',
6565
'en/apps/hookmark.md': 'apps/hookmark.md',
66+
'en/apps/ia-writer.md': 'apps/ia-writer.md',
6667
'en/apps/icab-mobile.md': 'apps/icab-mobile.md',
6768
'en/apps/idea.md': 'apps/idea.md',
6869
'en/apps/instapaper.md': 'apps/instapaper.md',
@@ -223,6 +224,7 @@ export default defineConfig({
223224
{ text: 'GoLand', link: '/apps/goland' },
224225
{ text: 'HBuilderX', link: '/apps/hbuilderx' },
225226
{ text: 'Hookmark', link: '/apps/hookmark' },
227+
{ text: 'iA Writer', link: '/apps/ia-writer' },
226228
{ text: 'iCab Mobile', link: '/apps/icab-mobile' },
227229
{ text: 'IntelliJ IDEA', link: '/apps/idea' },
228230
{ text: 'Instapaper', link: '/apps/instapaper' },
@@ -389,6 +391,7 @@ export default defineConfig({
389391
{ text: 'GoLand', link: '/apps/goland' },
390392
{ text: 'HBuilderX', link: '/apps/hbuilderx' },
391393
{ text: 'Hookmark', link: '/apps/hookmark' },
394+
{ text: 'iA Writer', link: '/apps/ia-writer' },
392395
{ text: 'iCab Mobile', link: '/apps/icab-mobile' },
393396
{ text: 'IntelliJ IDEA', link: '/apps/idea' },
394397
{ text: 'Instapaper', link: '/apps/instapaper' },
@@ -520,6 +523,7 @@ export default defineConfig({
520523
{ text: 'GoLand', link: '/zh/apps/goland' },
521524
{ text: 'HBuilderX', link: '/zh/apps/hbuilderx' },
522525
{ text: 'Hookmark', link: '/zh/apps/hookmark' },
526+
{ text: 'iA Writer', link: '/zh/apps/ia-writer' },
523527
{ text: 'iCab Mobile', link: '/zh/apps/icab-mobile' },
524528
{ text: 'IntelliJ IDEA', link: '/zh/apps/idea' },
525529
{ text: 'Instapaper', link: '/zh/apps/instapaper' },
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const openParams = {
2+
path: '/Drafts/Notes.txt',
3+
}
4+
5+
export const newFileParams = {
6+
path: '/Drafts/Meeting Notes.txt',
7+
text: '# Meeting Notes\n\n',
8+
author: 'AI',
9+
}
10+
11+
export const quickSearchParams = {
12+
query: 'meeting notes',
13+
}

apps/docs/en/apps/ia-writer.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
layout: doc
3+
---
4+
5+
<script setup lang="ts">
6+
import { ref, computed } from 'vue';
7+
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
8+
import { open, newFile, quickSearch } from 'protocol-launcher/ia-writer';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import { openParams, newFileParams, quickSearchParams } from '../../.vitepress/constants/ia-writer';
11+
12+
const currentMethod = ref('On-Demand');
13+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/ia-writer' : 'protocol-launcher');
14+
</script>
15+
16+
# iA Writer
17+
18+
[iA Writer](https://ia.net/writer) is a focused writing app for macOS, iPadOS, and iOS. **Protocol Launcher** allows you to generate iA Writer URL Commands with the `ia-writer://` scheme and x-callback-url support.
19+
20+
## Usage
21+
22+
There are two ways to use this library:
23+
24+
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
25+
- Full Import from the root package is convenient but includes all app modules.
26+
27+
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
28+
29+
<SelectInstallationMethod v-model="currentMethod" />
30+
31+
### Open Document
32+
33+
Opens Editor with an existing document if found, or a new empty document.
34+
35+
```ts-vue [{{currentMethod}}]
36+
import { {{ currentMethod === 'On-Demand' ? 'open' : 'iaWriter' }} } from '{{ importPath }}'
37+
38+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}open({
39+
path: '/Drafts/Notes.txt',
40+
})
41+
```
42+
43+
<div class="flex justify-center">
44+
<VPLink :href="open(openParams)" target="_self">
45+
Open Document in iA Writer
46+
</VPLink>
47+
</div>
48+
49+
### New File
50+
51+
Opens Editor with a new document.
52+
53+
```ts-vue [{{currentMethod}}]
54+
import { {{ currentMethod === 'On-Demand' ? 'newFile' : 'iaWriter' }} } from '{{ importPath }}'
55+
56+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}newFile({
57+
path: '/Drafts/Meeting Notes.txt',
58+
text: '# Meeting Notes\n\n',
59+
author: 'AI',
60+
})
61+
```
62+
63+
<div class="flex justify-center">
64+
<VPLink :href="newFile(newFileParams)" target="_self">
65+
Create New File in iA Writer
66+
</VPLink>
67+
</div>
68+
69+
### Quick Search
70+
71+
Opens Quick Search with a given query.
72+
73+
```ts-vue [{{currentMethod}}]
74+
import { {{ currentMethod === 'On-Demand' ? 'quickSearch' : 'iaWriter' }} } from '{{ importPath }}'
75+
76+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}quickSearch({
77+
query: 'meeting notes',
78+
})
79+
```
80+
81+
<div class="flex justify-center">
82+
<VPLink :href="quickSearch(quickSearchParams)" target="_self">
83+
Search in iA Writer
84+
</VPLink>
85+
</div>
86+
87+
### Read File
88+
89+
Reads and returns file contents. iA Writer requires an `auth-token` for data commands and returns `path` and `text` parameters on `x-success`.
90+
91+
```ts-vue [{{currentMethod}}]
92+
import { {{ currentMethod === 'On-Demand' ? 'read' : 'iaWriter' }} } from '{{ importPath }}'
93+
94+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}read({
95+
authToken: 'REPLACE_WITH_YOUR_TOKEN',
96+
path: '/Drafts/Notes.txt',
97+
xSuccess: 'myapp://callback',
98+
})
99+
```
100+
101+
### Write File
102+
103+
Creates or modifies an existing file and returns file contents. iA Writer requires an `auth-token` for data commands and returns `path` and `text` parameters on `x-success`.
104+
105+
```ts-vue [{{currentMethod}}]
106+
import { {{ currentMethod === 'On-Demand' ? 'write' : 'iaWriter' }} } from '{{ importPath }}'
107+
108+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}write({
109+
authToken: 'REPLACE_WITH_YOUR_TOKEN',
110+
path: '/Drafts/Notes.txt',
111+
text: 'Hello world',
112+
mode: 'add',
113+
addLocation: 'end',
114+
addPadding: 'paragraph',
115+
author: 'AI',
116+
xSuccess: 'myapp://callback',
117+
})
118+
```
119+
120+
### Version
121+
122+
Returns iA Writer app version and URL scheme version. iA Writer returns `scheme-version` and `app-version` parameters on `x-success`.
123+
124+
```ts-vue [{{currentMethod}}]
125+
import { {{ currentMethod === 'On-Demand' ? 'version' : 'iaWriter' }} } from '{{ importPath }}'
126+
127+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}version({
128+
xSuccess: 'myapp://callback',
129+
})
130+
```
131+
132+
## Official Documentation
133+
134+
- [iA Writer URL Commands](https://ia.net/writer/support/help/url-commands)

apps/docs/en/guide/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ For detailed usage instructions for each application, please refer to their resp
162162
- [GoLand](../apps/goland.md)
163163
- [HBuilderX](../apps/hbuilderx.md)
164164
- [Hookmark](../apps/hookmark.md)
165+
- [iA Writer](../apps/ia-writer.md)
165166
- [iCab Mobile](../apps/icab-mobile.md)
166167
- [IntelliJ IDEA](../apps/idea.md)
167168
- [Instapaper](../apps/instapaper.md)

apps/docs/en/guide/what-is-it.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Currently, we support the following applications:
6565
- [GoLand](../apps/goland.md)
6666
- [HBuilderX](../apps/hbuilderx.md)
6767
- [Hookmark](../apps/hookmark.md)
68+
- [iA Writer](../apps/ia-writer.md)
6869
- [iCab Mobile](../apps/icab-mobile.md)
6970
- [Instapaper](../apps/instapaper.md)
7071
- [IntelliJ IDEA](../apps/idea.md)

apps/docs/zh/apps/ia-writer.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
layout: doc
3+
---
4+
5+
<script setup lang="ts">
6+
import { ref, computed } from 'vue';
7+
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
8+
import { open, newFile, quickSearch } from 'protocol-launcher/ia-writer';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import { openParams, newFileParams, quickSearchParams } from '../../.vitepress/constants/ia-writer';
11+
12+
const currentMethod = ref('On-Demand');
13+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/ia-writer' : 'protocol-launcher');
14+
</script>
15+
16+
# iA Writer
17+
18+
[iA Writer](https://ia.net/writer) 是一款适用于 macOS、iPadOS 和 iOS 的专注写作应用。**Protocol Launcher** 允许您生成 iA Writer URL Commands,使用 `ia-writer://` URL scheme,并支持 x-callback-url。
19+
20+
## 使用方式
21+
22+
有两种使用此库的方式:
23+
24+
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
25+
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
26+
27+
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
28+
29+
<SelectInstallationMethod v-model="currentMethod" />
30+
31+
### 打开文档
32+
33+
如果找到现有文档则在编辑器中打开,否则打开新的空文档。
34+
35+
```ts-vue [{{currentMethod}}]
36+
import { {{ currentMethod === 'On-Demand' ? 'open' : 'iaWriter' }} } from '{{ importPath }}'
37+
38+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}open({
39+
path: '/Drafts/Notes.txt',
40+
})
41+
```
42+
43+
<div class="flex justify-center">
44+
<VPLink :href="open(openParams)" target="_self">
45+
在 iA Writer 中打开文档
46+
</VPLink>
47+
</div>
48+
49+
### 新建文件
50+
51+
在编辑器中打开一个新文档。
52+
53+
```ts-vue [{{currentMethod}}]
54+
import { {{ currentMethod === 'On-Demand' ? 'newFile' : 'iaWriter' }} } from '{{ importPath }}'
55+
56+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}newFile({
57+
path: '/Drafts/Meeting Notes.txt',
58+
text: '# Meeting Notes\n\n',
59+
author: 'AI',
60+
})
61+
```
62+
63+
<div class="flex justify-center">
64+
<VPLink :href="newFile(newFileParams)" target="_self">
65+
在 iA Writer 中新建文件
66+
</VPLink>
67+
</div>
68+
69+
### 快速搜索
70+
71+
使用给定查询打开 Quick Search。
72+
73+
```ts-vue [{{currentMethod}}]
74+
import { {{ currentMethod === 'On-Demand' ? 'quickSearch' : 'iaWriter' }} } from '{{ importPath }}'
75+
76+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}quickSearch({
77+
query: 'meeting notes',
78+
})
79+
```
80+
81+
<div class="flex justify-center">
82+
<VPLink :href="quickSearch(quickSearchParams)" target="_self">
83+
在 iA Writer 中搜索
84+
</VPLink>
85+
</div>
86+
87+
### 读取文件
88+
89+
读取并返回文件内容。iA Writer 的数据命令需要 `auth-token`,并会在 `x-success` 上返回 `path``text` 参数。
90+
91+
```ts-vue [{{currentMethod}}]
92+
import { {{ currentMethod === 'On-Demand' ? 'read' : 'iaWriter' }} } from '{{ importPath }}'
93+
94+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}read({
95+
authToken: 'REPLACE_WITH_YOUR_TOKEN',
96+
path: '/Drafts/Notes.txt',
97+
xSuccess: 'myapp://callback',
98+
})
99+
```
100+
101+
### 写入文件
102+
103+
创建或修改现有文件,并返回文件内容。iA Writer 的数据命令需要 `auth-token`,并会在 `x-success` 上返回 `path``text` 参数。
104+
105+
```ts-vue [{{currentMethod}}]
106+
import { {{ currentMethod === 'On-Demand' ? 'write' : 'iaWriter' }} } from '{{ importPath }}'
107+
108+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}write({
109+
authToken: 'REPLACE_WITH_YOUR_TOKEN',
110+
path: '/Drafts/Notes.txt',
111+
text: 'Hello world',
112+
mode: 'add',
113+
addLocation: 'end',
114+
addPadding: 'paragraph',
115+
author: 'AI',
116+
xSuccess: 'myapp://callback',
117+
})
118+
```
119+
120+
### 版本信息
121+
122+
返回 iA Writer 应用版本和 URL scheme 版本。iA Writer 会在 `x-success` 上返回 `scheme-version``app-version` 参数。
123+
124+
```ts-vue [{{currentMethod}}]
125+
import { {{ currentMethod === 'On-Demand' ? 'version' : 'iaWriter' }} } from '{{ importPath }}'
126+
127+
const url = {{currentMethod === 'On-Demand' ? '' : 'iaWriter.'}}version({
128+
xSuccess: 'myapp://callback',
129+
})
130+
```
131+
132+
## 官方文档
133+
134+
- [iA Writer URL Commands](https://ia.net/writer/support/help/url-commands)

apps/docs/zh/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export default defineAdditionalConfig({
7474
{ text: 'GoLand', link: '/zh/apps/goland' },
7575
{ text: 'HBuilderX', link: '/zh/apps/hbuilderx' },
7676
{ text: 'Hookmark', link: '/zh/apps/hookmark' },
77+
{ text: 'iA Writer', link: '/zh/apps/ia-writer' },
7778
{ text: 'iCab Mobile', link: '/zh/apps/icab-mobile' },
7879
{ text: 'IntelliJ IDEA', link: '/zh/apps/idea' },
7980
{ text: 'Instapaper', link: '/zh/apps/instapaper' },

apps/docs/zh/guide/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ import { cherryStudio, cursor, githubDesktop } from 'protocol-launcher'
162162
- [GoLand](../apps/goland.md)
163163
- [HBuilderX](../apps/hbuilderx.md)
164164
- [Hookmark](../apps/hookmark.md)
165+
- [iA Writer](../apps/ia-writer.md)
165166
- [iCab Mobile](../apps/icab-mobile.md)
166167
- [IntelliJ IDEA](../apps/idea.md)
167168
- [Instapaper](../apps/instapaper.md)

apps/docs/zh/guide/what-is-it.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ layout: doc
6565
- [GoLand](../apps/goland.md)
6666
- [HBuilderX](../apps/hbuilderx.md)
6767
- [Hookmark](../apps/hookmark.md)
68+
- [iA Writer](../apps/ia-writer.md)
6869
- [iCab Mobile](../apps/icab-mobile.md)
6970
- [Instapaper](../apps/instapaper.md)
7071
- [IntelliJ IDEA](../apps/idea.md)

0 commit comments

Comments
 (0)