Skip to content

Commit f838105

Browse files
committed
feat(1writer): add 1writer protocol launcher support
1 parent a606ab7 commit f838105

File tree

21 files changed

+812
-0
lines changed

21 files changed

+812
-0
lines changed

.changeset/calm-cases-guess.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(1writer): add 1writer protocol launcher support

apps/docs/.vitepress/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default defineConfig({
2626
'en/apps/apple-map.md': 'apps/apple-map.md',
2727
'en/apps/apple-script.md': 'apps/apple-script.md',
2828
'en/apps/atom.md': 'apps/atom.md',
29+
'en/apps/1writer.md': 'apps/1writer.md',
2930
'en/apps/bbedit.md': 'apps/bbedit.md',
3031
'en/apps/bear.md': 'apps/bear.md',
3132
'en/apps/cherry-studio.md': 'apps/cherry-studio.md',
@@ -136,6 +137,7 @@ export default defineConfig({
136137
{ text: 'Apple Map', link: '/apps/apple-map' },
137138
{ text: 'Apple Script Editor', link: '/apps/apple-script' },
138139
{ text: 'Atom', link: '/apps/atom' },
140+
{ text: '1Writer', link: '/apps/1writer' },
139141
{ text: 'BBEdit', link: '/apps/bbedit' },
140142
{ text: 'Bear', link: '/apps/bear' },
141143
{ text: 'Cherry Studio', link: '/apps/cherry-studio' },
@@ -251,6 +253,7 @@ export default defineConfig({
251253
{ text: 'Apple Map', link: '/apps/apple-map' },
252254
{ text: 'Apple Script Editor', link: '/apps/apple-script' },
253255
{ text: 'Atom', link: '/apps/atom' },
256+
{ text: '1Writer', link: '/apps/1writer' },
254257
{ text: 'BBEdit', link: '/apps/bbedit' },
255258
{ text: 'Bear', link: '/apps/bear' },
256259
{ text: 'Cherry Studio', link: '/apps/cherry-studio' },
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export const createParams = {
2+
path: 'Dropbox/Documents',
3+
name: 'Notes.txt',
4+
text: 'Hello world',
5+
}
6+
7+
export const replaceParams = {
8+
path: 'Dropbox/Documents/Notes.txt',
9+
text: 'Hello world',
10+
}
11+
12+
export const replaceSelectionParams = {
13+
text: 'New text',
14+
}
15+
16+
export const contentParams = {
17+
path: 'Dropbox/Documents/Notes.txt',
18+
}
19+
20+
export const openParams = {
21+
path: 'Dropbox/Documents/Notes.txt',
22+
}
23+
24+
export const appendParams = {
25+
path: 'Dropbox/Documents/Notes.txt',
26+
text: 'Hello world',
27+
}
28+
29+
export const prependParams = {
30+
path: 'Dropbox/Documents/Notes.txt',
31+
text: 'Hello world',
32+
}

apps/docs/en/apps/1writer.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
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 { create, replace, replaceSelection, content, open, append, prepend } from 'protocol-launcher/1writer';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import {
11+
createParams,
12+
replaceParams,
13+
replaceSelectionParams,
14+
contentParams,
15+
openParams,
16+
appendParams,
17+
prependParams,
18+
} from '../../.vitepress/constants/1writer';
19+
20+
const currentMethod = ref('On-Demand');
21+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/1writer' : 'protocol-launcher');
22+
</script>
23+
24+
# 1Writer
25+
26+
[1Writer](https://1writerapp.com/) is a powerful Markdown text editor for iOS with Dropbox, Google Drive, and iCloud support. **Protocol Launcher** allows you to generate deep links to create, edit, and manage documents in 1Writer using the `onewriter://` URL scheme with x-callback-url protocol.
27+
28+
## Usage
29+
30+
There are two ways to use this library:
31+
32+
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
33+
- Full Import from the root package is convenient but includes all app modules.
34+
35+
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
36+
37+
<SelectInstallationMethod v-model="currentMethod" />
38+
39+
### Create Document
40+
41+
Creates a new document.
42+
43+
```ts-vue [{{currentMethod}}]
44+
import { {{ currentMethod === 'On-Demand' ? 'create' : 'oneWriter' }} } from '{{ importPath }}'
45+
46+
const url = {{currentMethod === 'On-Demand' ? '' : 'oneWriter.'}}create({
47+
path: 'Dropbox/Documents',
48+
name: 'Notes.txt',
49+
text: 'Hello world',
50+
})
51+
```
52+
53+
<div class="flex justify-center">
54+
<VPLink :href="create(createParams)" target="_self">
55+
Create Document in 1Writer
56+
</VPLink>
57+
</div>
58+
59+
### Replace Document
60+
61+
Replaces content of a document.
62+
63+
```ts-vue [{{currentMethod}}]
64+
import { {{ currentMethod === 'On-Demand' ? 'replace' : 'oneWriter' }} } from '{{ importPath }}'
65+
66+
const url = {{currentMethod === 'On-Demand' ? '' : 'oneWriter.'}}replace({
67+
path: 'Dropbox/Documents/Notes.txt',
68+
text: 'Hello world',
69+
})
70+
```
71+
72+
<div class="flex justify-center">
73+
<VPLink :href="replace(replaceParams)" target="_self">
74+
Replace Document in 1Writer
75+
</VPLink>
76+
</div>
77+
78+
### Replace Selection
79+
80+
Replaces selected text in the current editing document.
81+
82+
```ts-vue [{{currentMethod}}]
83+
import { {{ currentMethod === 'On-Demand' ? 'replaceSelection' : 'oneWriter' }} } from '{{ importPath }}'
84+
85+
const url = {{currentMethod === 'On-Demand' ? '' : 'oneWriter.'}}replaceSelection({
86+
text: 'New text',
87+
})
88+
```
89+
90+
<div class="flex justify-center">
91+
<VPLink :href="replaceSelection(replaceSelectionParams)" target="_self">
92+
Replace Selection in 1Writer
93+
</VPLink>
94+
</div>
95+
96+
### Get Content
97+
98+
Returns content of a document.
99+
100+
```ts-vue [{{currentMethod}}]
101+
import { {{ currentMethod === 'On-Demand' ? 'content' : 'oneWriter' }} } from '{{ importPath }}'
102+
103+
const url = {{currentMethod === 'On-Demand' ? '' : 'oneWriter.'}}content({
104+
path: 'Dropbox/Documents/Notes.txt',
105+
})
106+
```
107+
108+
<div class="flex justify-center">
109+
<VPLink :href="content(contentParams)" target="_self">
110+
Get Content from 1Writer
111+
</VPLink>
112+
</div>
113+
114+
### Open Document
115+
116+
Opens an existing document.
117+
118+
```ts-vue [{{currentMethod}}]
119+
import { {{ currentMethod === 'On-Demand' ? 'open' : 'oneWriter' }} } from '{{ importPath }}'
120+
121+
const url = {{currentMethod === 'On-Demand' ? '' : 'oneWriter.'}}open({
122+
path: 'Dropbox/Documents/Notes.txt',
123+
})
124+
```
125+
126+
<div class="flex justify-center">
127+
<VPLink :href="open(openParams)" target="_self">
128+
Open Document in 1Writer
129+
</VPLink>
130+
</div>
131+
132+
### Append Document
133+
134+
Appends content to an existing document.
135+
136+
```ts-vue [{{currentMethod}}]
137+
import { {{ currentMethod === 'On-Demand' ? 'append' : 'oneWriter' }} } from '{{ importPath }}'
138+
139+
const url = {{currentMethod === 'On-Demand' ? '' : 'oneWriter.'}}append({
140+
path: 'Dropbox/Documents/Notes.txt',
141+
text: 'Hello world',
142+
})
143+
```
144+
145+
<div class="flex justify-center">
146+
<VPLink :href="append(appendParams)" target="_self">
147+
Append to Document in 1Writer
148+
</VPLink>
149+
</div>
150+
151+
### Prepend Document
152+
153+
Prepends content to an existing document.
154+
155+
```ts-vue [{{currentMethod}}]
156+
import { {{ currentMethod === 'On-Demand' ? 'prepend' : 'oneWriter' }} } from '{{ importPath }}'
157+
158+
const url = {{currentMethod === 'On-Demand' ? '' : 'oneWriter.'}}prepend({
159+
path: 'Dropbox/Documents/Notes.txt',
160+
text: 'Hello world',
161+
})
162+
```
163+
164+
<div class="flex justify-center">
165+
<VPLink :href="prepend(prependParams)" target="_self">
166+
Prepend to Document in 1Writer
167+
</VPLink>
168+
</div>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ For detailed usage instructions for each application, please refer to their resp
126126
- [Apple Map](../apps/apple-map.md)
127127
- [Apple Script Editor](../apps/apple-script.md)
128128
- [Atom](../apps/atom.md)
129+
- [1Writer](../apps/1writer.md)
129130
- [BBEdit](../apps/bbedit.md)
130131
- [Bear](../apps/bear.md)
131132
- [Cherry Studio](../apps/cherry-studio.md)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Currently, we support the following applications:
2929
- [Apple Map](../apps/apple-map.md)
3030
- [Apple Script Editor](../apps/apple-script.md)
3131
- [Atom](../apps/atom.md)
32+
- [1Writer](../apps/1writer.md)
3233
- [BBEdit](../apps/bbedit.md)
3334
- [Bear](../apps/bear.md)
3435
- [Cherry Studio](../apps/cherry-studio.md)

0 commit comments

Comments
 (0)