Skip to content

Commit 5b91610

Browse files
committed
fix: make pasting work
1 parent 1e7ace4 commit 5b91610

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

components.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,17 @@ declare module '@vue/runtime-core' {
138138
NH1: typeof import('naive-ui')['NH1']
139139
NH3: typeof import('naive-ui')['NH3']
140140
NIcon: typeof import('naive-ui')['NIcon']
141+
NInput: typeof import('naive-ui')['NInput']
141142
NInputNumber: typeof import('naive-ui')['NInputNumber']
142143
NLabel: typeof import('naive-ui')['NLabel']
143144
NLayout: typeof import('naive-ui')['NLayout']
144145
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
146+
NLi: typeof import('naive-ui')['NLi']
145147
NMenu: typeof import('naive-ui')['NMenu']
148+
NP: typeof import('naive-ui')['NP']
146149
NScrollbar: typeof import('naive-ui')['NScrollbar']
147150
NSpin: typeof import('naive-ui')['NSpin']
151+
NUl: typeof import('naive-ui')['NUl']
148152
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
149153
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
150154
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']

src/tools/paste-as-markdown/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { defineTool } from '../tool';
44
export const tool = defineTool({
55
name: 'Paste as Markdown',
66
path: '/paste-as-markdown',
7-
description: 'Paste clipboard content as Markdown',
8-
keywords: ['paste', 'markdown'],
7+
description: 'Paste cells/tables and links from clipboard content as Markdown',
8+
keywords: ['paste', 'cell', 'table', 'links', 'md', 'markdown'],
99
component: () => import('./paste-as-markdown.vue'),
1010
icon: Markdown,
1111
createdAt: new Date('2024-07-14'),
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
<script setup lang="ts">
22
import { subscribe } from '@github/paste-markdown';
3+
import CInputText from '@/ui/c-input-text/c-input-text.vue';
34
4-
const inputElement = ref<HTMLElement>();
5+
const inputElement = ref<typeof CInputText>();
56
const markdown = ref('');
67
78
// Subscribe the behavior to the textarea.
89
onMounted(() => {
9-
subscribe(inputElement.value as never);
10+
subscribe(inputElement.value?.textareaRef as never);
1011
});
1112
</script>
1213

1314
<template>
1415
<c-card title="Paste in Markdown" class="paste-zone">
15-
<textarea
16+
<n-ul>
17+
<n-li>Paste spreadsheet cells and HTML tables as a Markdown tables.</n-li>
18+
<n-li>Paste URLs on selected text as Markdown links.</n-li>
19+
<n-li>Paste text containing links as text containing Markdown links.</n-li>
20+
<n-li>Paste image URLs as Markdown image links.</n-li>
21+
</n-ul>
22+
<CInputText
1623
ref="inputElement"
24+
v-model:value="markdown"
25+
multiline
26+
placeholder="Paste your content here..."
1727
rows="10"
28+
w-full
1829
/>
1930
</c-card>
2031
</template>

src/ui/c-input-text/c-input-text.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ onMounted(() => {
137137
138138
defineExpose({
139139
inputWrapperRef,
140+
textareaRef,
141+
inputRef,
140142
focus,
141143
blur,
142144
});

0 commit comments

Comments
 (0)