Skip to content

Commit 198df26

Browse files
committed
feat(textastic): add textastic protocol launcher support
1 parent 121728a commit 198df26

File tree

20 files changed

+753
-0
lines changed

20 files changed

+753
-0
lines changed

.changeset/bright-stars-dream.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(textastic): add textastic protocol launcher support

apps/docs/.vitepress/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export default defineConfig({
9494
'en/apps/steam.md': 'apps/steam.md',
9595
'en/apps/telegram.md': 'apps/telegram.md',
9696
'en/apps/termius.md': 'apps/termius.md',
97+
'en/apps/textastic.md': 'apps/textastic.md',
9798
'en/apps/textmate.md': 'apps/textmate.md',
9899
'en/apps/theia.md': 'apps/theia.md',
99100
'en/apps/things.md': 'apps/things.md',
@@ -230,6 +231,7 @@ export default defineConfig({
230231
{ text: 'Steam', link: '/apps/steam' },
231232
{ text: 'Telegram', link: '/apps/telegram' },
232233
{ text: 'Termius', link: '/apps/termius' },
234+
{ text: 'Textastic', link: '/apps/textastic' },
233235
{ text: 'TextMate', link: '/apps/textmate' },
234236
{ text: 'Theia', link: '/apps/theia' },
235237
{ text: 'Things', link: '/apps/things' },
@@ -371,6 +373,7 @@ export default defineConfig({
371373
{ text: 'Steam', link: '/apps/steam' },
372374
{ text: 'Telegram', link: '/apps/telegram' },
373375
{ text: 'Termius', link: '/apps/termius' },
376+
{ text: 'Textastic', link: '/apps/textastic' },
374377
{ text: 'TextMate', link: '/apps/textmate' },
375378
{ text: 'Theia', link: '/apps/theia' },
376379
{ text: 'Things', link: '/apps/things' },
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const openFileParams = {
2+
path: 'example.com',
3+
name: 'index.html',
4+
}
5+
6+
export const newFileParams = {
7+
name: 'foo.txt',
8+
text: 'bar',
9+
}
10+
11+
export const appendParams = {
12+
location: 'iCloud' as const,
13+
name: 'clipboard.txt',
14+
}
15+
16+
export const replaceParams = {
17+
location: 'iCloud' as const,
18+
name: 'scratchpad.txt',
19+
text: 'foo',
20+
}

apps/docs/en/apps/textastic.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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, openFile, newFile, append, replace, reloadCustomizations } from 'protocol-launcher/textastic';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import { useAppStore } from '../../.vitepress/stores/app';
11+
import { openFileParams, newFileParams, appendParams, replaceParams } from '../../.vitepress/constants/textastic';
12+
13+
const appStore = useAppStore();
14+
const currentMethod = ref('On-Demand');
15+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/textastic' : 'protocol-launcher');
16+
</script>
17+
18+
# Textastic
19+
20+
[Textastic](https://www.textasticapp.com/) is a powerful text editor for iOS, iPadOS, and macOS with syntax highlighting for over 80 programming and markup languages. **Protocol Launcher** allows you to generate deep links to open, create, and edit files in Textastic.
21+
22+
## Usage
23+
24+
There are two ways to use this library:
25+
26+
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
27+
- Full Import from the root package is convenient but includes all app modules.
28+
29+
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
30+
31+
<SelectInstallationMethod v-model="currentMethod" />
32+
33+
### Open App
34+
35+
```ts-vue [{{currentMethod}}]
36+
import { {{ currentMethod === 'On-Demand' ? 'open' : 'textastic' }} } from '{{ importPath }}'
37+
38+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}open()
39+
```
40+
41+
<div class="flex justify-center">
42+
<VPLink :href="open()" target="_self">
43+
Open Textastic
44+
</VPLink>
45+
</div>
46+
47+
### Open File
48+
49+
```ts-vue [{{currentMethod}}]
50+
import { {{ currentMethod === 'On-Demand' ? 'openFile' : 'textastic' }} } from '{{ importPath }}'
51+
52+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}openFile({
53+
path: 'example.com',
54+
name: 'index.html',
55+
})
56+
```
57+
58+
<div class="flex justify-center">
59+
<VPLink :href="openFile(openFileParams)" target="_self">
60+
Open File in Textastic
61+
</VPLink>
62+
</div>
63+
64+
### New File
65+
66+
```ts-vue [{{currentMethod}}]
67+
import { {{ currentMethod === 'On-Demand' ? 'newFile' : 'textastic' }} } from '{{ importPath }}'
68+
69+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}newFile({
70+
name: 'foo.txt',
71+
text: 'bar',
72+
})
73+
```
74+
75+
<div class="flex justify-center">
76+
<VPLink :href="newFile(newFileParams)" target="_self">
77+
Create New File in Textastic
78+
</VPLink>
79+
</div>
80+
81+
### Append Text
82+
83+
```ts-vue [{{currentMethod}}]
84+
import { {{ currentMethod === 'On-Demand' ? 'append' : 'textastic' }} } from '{{ importPath }}'
85+
86+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}append({
87+
location: 'iCloud',
88+
name: 'clipboard.txt',
89+
})
90+
```
91+
92+
<div class="flex justify-center">
93+
<VPLink :href="append(appendParams)" target="_self">
94+
Append Text in Textastic
95+
</VPLink>
96+
</div>
97+
98+
### Replace Text
99+
100+
```ts-vue [{{currentMethod}}]
101+
import { {{ currentMethod === 'On-Demand' ? 'replace' : 'textastic' }} } from '{{ importPath }}'
102+
103+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}replace({
104+
location: 'iCloud',
105+
name: 'scratchpad.txt',
106+
text: 'foo',
107+
})
108+
```
109+
110+
<div class="flex justify-center">
111+
<VPLink :href="replace(replaceParams)" target="_self">
112+
Replace Text in Textastic
113+
</VPLink>
114+
</div>
115+
116+
### Reload Customizations
117+
118+
```ts-vue [{{currentMethod}}]
119+
import { {{ currentMethod === 'On-Demand' ? 'reloadCustomizations' : 'textastic' }} } from '{{ importPath }}'
120+
121+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}reloadCustomizations()
122+
```
123+
124+
<div class="flex justify-center">
125+
<VPLink :href="reloadCustomizations()" target="_self">
126+
Reload Customizations in Textastic
127+
</VPLink>
128+
</div>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ For detailed usage instructions for each application, please refer to their resp
199199
- [Steam](../apps/steam.md)
200200
- [Telegram](../apps/telegram.md)
201201
- [Termius](../apps/termius.md)
202+
- [Textastic](../apps/textastic.md)
202203
- [TextMate](../apps/textmate.md)
203204
- [Theia](../apps/theia.md)
204205
- [Things](../apps/things.md)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Currently, we support the following applications:
9797
- [Steam](../apps/steam.md)
9898
- [Telegram](../apps/telegram.md)
9999
- [Termius](../apps/termius.md)
100+
- [Textastic](../apps/textastic.md)
100101
- [TextMate](../apps/textmate.md)
101102
- [Theia](../apps/theia.md)
102103
- [Things](../apps/things.md)

apps/docs/zh/apps/textastic.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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, openFile, newFile, append, replace, reloadCustomizations } from 'protocol-launcher/textastic';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import { useAppStore } from '../../.vitepress/stores/app';
11+
import { openFileParams, newFileParams, appendParams, replaceParams } from '../../.vitepress/constants/textastic';
12+
13+
const appStore = useAppStore();
14+
const currentMethod = ref('On-Demand');
15+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/textastic' : 'protocol-launcher');
16+
</script>
17+
18+
# Textastic
19+
20+
[Textastic](https://www.textasticapp.com/) 是一款适用于 iOS、iPadOS 和 macOS 的强大文本编辑器,支持超过 80 种编程和标记语言的语法高亮。**Protocol Launcher** 允许您生成深度链接以在 Textastic 中打开、创建和编辑文件。
21+
22+
## 使用方式
23+
24+
有两种使用此库的方式:
25+
26+
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
27+
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
28+
29+
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
30+
31+
<SelectInstallationMethod v-model="currentMethod" />
32+
33+
### 打开应用
34+
35+
```ts-vue [{{currentMethod}}]
36+
import { {{ currentMethod === 'On-Demand' ? 'open' : 'textastic' }} } from '{{ importPath }}'
37+
38+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}open()
39+
```
40+
41+
<div class="flex justify-center">
42+
<VPLink :href="open()" target="_self">
43+
打开 Textastic
44+
</VPLink>
45+
</div>
46+
47+
### 打开文件
48+
49+
```ts-vue [{{currentMethod}}]
50+
import { {{ currentMethod === 'On-Demand' ? 'openFile' : 'textastic' }} } from '{{ importPath }}'
51+
52+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}openFile({
53+
path: 'example.com',
54+
name: 'index.html',
55+
})
56+
```
57+
58+
<div class="flex justify-center">
59+
<VPLink :href="openFile(openFileParams)" target="_self">
60+
在 Textastic 中打开文件
61+
</VPLink>
62+
</div>
63+
64+
### 新建文件
65+
66+
```ts-vue [{{currentMethod}}]
67+
import { {{ currentMethod === 'On-Demand' ? 'newFile' : 'textastic' }} } from '{{ importPath }}'
68+
69+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}newFile({
70+
name: 'foo.txt',
71+
text: 'bar',
72+
})
73+
```
74+
75+
<div class="flex justify-center">
76+
<VPLink :href="newFile(newFileParams)" target="_self">
77+
在 Textastic 中新建文件
78+
</VPLink>
79+
</div>
80+
81+
### 追加文本
82+
83+
```ts-vue [{{currentMethod}}]
84+
import { {{ currentMethod === 'On-Demand' ? 'append' : 'textastic' }} } from '{{ importPath }}'
85+
86+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}append({
87+
location: 'iCloud',
88+
name: 'clipboard.txt',
89+
})
90+
```
91+
92+
<div class="flex justify-center">
93+
<VPLink :href="append(appendParams)" target="_self">
94+
在 Textastic 中追加文本
95+
</VPLink>
96+
</div>
97+
98+
### 替换文本
99+
100+
```ts-vue [{{currentMethod}}]
101+
import { {{ currentMethod === 'On-Demand' ? 'replace' : 'textastic' }} } from '{{ importPath }}'
102+
103+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}replace({
104+
location: 'iCloud',
105+
name: 'scratchpad.txt',
106+
text: 'foo',
107+
})
108+
```
109+
110+
<div class="flex justify-center">
111+
<VPLink :href="replace(replaceParams)" target="_self">
112+
在 Textastic 中替换文本
113+
</VPLink>
114+
</div>
115+
116+
### 重新加载自定义
117+
118+
```ts-vue [{{currentMethod}}]
119+
import { {{ currentMethod === 'On-Demand' ? 'reloadCustomizations' : 'textastic' }} } from '{{ importPath }}'
120+
121+
const url = {{currentMethod === 'On-Demand' ? '' : 'textastic.'}}reloadCustomizations()
122+
```
123+
124+
<div class="flex justify-center">
125+
<VPLink :href="reloadCustomizations()" target="_self">
126+
在 Textastic 中重新加载自定义
127+
</VPLink>
128+
</div>

apps/docs/zh/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export default defineAdditionalConfig({
106106
{ text: 'Steam', link: '/zh/apps/steam' },
107107
{ text: 'Telegram', link: '/zh/apps/telegram' },
108108
{ text: 'Termius', link: '/zh/apps/termius' },
109+
{ text: 'Textastic', link: '/zh/apps/textastic' },
109110
{ text: 'TextMate', link: '/zh/apps/textmate' },
110111
{ text: 'Theia', link: '/zh/apps/theia' },
111112
{ text: 'Things', link: '/zh/apps/things' },

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ import { cherryStudio, cursor, githubDesktop } from 'protocol-launcher'
199199
- [Steam](../apps/steam.md)
200200
- [Telegram](../apps/telegram.md)
201201
- [Termius](../apps/termius.md)
202+
- [Textastic](../apps/textastic.md)
202203
- [TextMate](../apps/textmate.md)
203204
- [Theia](../apps/theia.md)
204205
- [Things](../apps/things.md)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ layout: doc
9696
- [Steam](../apps/steam.md)
9797
- [Telegram](../apps/telegram.md)
9898
- [Termius](../apps/termius.md)
99+
- [Textastic](../apps/textastic.md)
99100
- [TextMate](../apps/textmate.md)
100101
- [Theia](../apps/theia.md)
101102
- [Things](../apps/things.md)

0 commit comments

Comments
 (0)