feat(new tool): markdown to word & fix lint

This commit is contained in:
guihouchang 2025-06-05 11:39:20 +08:00
parent 1fd83e1ca9
commit 826f64db58
5 changed files with 17 additions and 9 deletions

View file

@ -128,7 +128,7 @@ function activateOption(option: PaletteOption) {
<c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text placeholder="Type to search a tool or a command..." autofocus clearable /> <c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text placeholder="Type to search a tool or a command..." autofocus clearable />
<div v-for="(options, category) in filteredSearchResult" :key="category"> <div v-for="(options, category) in filteredSearchResult" :key="category">
<div ml-3 mt-3 text-sm font-bold text-primary op-60> <div ml-3 mt-3 text-sm text-primary font-bold op-60>
{{ category }} {{ category }}
</div> </div>
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" /> <command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />

View file

@ -10,4 +10,4 @@ export const tool = defineTool({
component: () => import('./markdown-to-word.vue'), component: () => import('./markdown-to-word.vue'),
icon: Markdown, icon: Markdown,
createdAt: new Date('2024-08-25'), createdAt: new Date('2024-08-25'),
}); });

View file

@ -59,8 +59,12 @@ async function convertMarkdownToDocx() {
<div class="markdown-to-word-container"> <div class="markdown-to-word-container">
<!-- 顶部标题和按钮区 --> <!-- 顶部标题和按钮区 -->
<div class="header"> <div class="header">
<h1 class="title">{{ t('tools.markdown-to-word.title') }}</h1> <h1 class="title">
<p class="subtitle">{{ t('tools.markdown-to-word.description') }}</p> {{ t('tools.markdown-to-word.title') }}
</h1>
<p class="subtitle">
{{ t('tools.markdown-to-word.description') }}
</p>
<button <button
class="export-button" class="export-button"
:disabled="isExportDisabled" :disabled="isExportDisabled"
@ -87,9 +91,11 @@ async function convertMarkdownToDocx() {
<div class="markdown-preview"> <div class="markdown-preview">
<div v-if="isLoading" class="loading"> <div v-if="isLoading" class="loading">
<div class="loading-spinner" /> <div class="loading-spinner" />
<div class="loading-text">{{ t('tools.markdown-to-word.export.disabled') }}</div> <div class="loading-text">
{{ t('tools.markdown-to-word.export.disabled') }}
</div>
</div> </div>
<div v-else-if="inputMarkdown" v-html="previewHtml" class="preview-content" /> <div v-else-if="inputMarkdown" class="preview-content" v-html="previewHtml" />
<div v-else class="empty-state"> <div v-else class="empty-state">
{{ t('tools.markdown-to-word.input.placeholder') }}<br> {{ t('tools.markdown-to-word.input.placeholder') }}<br>
{{ t('tools.markdown-to-word.export.disabled') }} {{ t('tools.markdown-to-word.export.disabled') }}
@ -97,7 +103,9 @@ async function convertMarkdownToDocx() {
</div> </div>
<!-- 导出成功提示 --> <!-- 导出成功提示 -->
<div v-if="lastExportTime" class="export-success"> <div v-if="lastExportTime" class="export-success">
<div class="success-icon"></div> <div class="success-icon">
</div>
{{ t('tools.markdown-to-word.notification.success') }} {{ t('tools.markdown-to-word.notification.success') }}
</div> </div>
</section> </section>

View file

@ -151,7 +151,7 @@ function onSearchInput() {
> >
<div flex-1 truncate> <div flex-1 truncate>
<slot name="displayed-value"> <slot name="displayed-value">
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full lh-normal color-current @input="onSearchInput"> <input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full color-current lh-normal @input="onSearchInput">
<span v-else-if="selectedOption" lh-normal> <span v-else-if="selectedOption" lh-normal>
{{ selectedOption.label }} {{ selectedOption.label }}
</span> </span>

View file

@ -39,7 +39,7 @@ const headers = computed(() => {
<template> <template>
<div class="relative overflow-x-auto rounded"> <div class="relative overflow-x-auto rounded">
<table class="w-full border-collapse text-left text-sm text-gray-500 dark:text-gray-400" role="table" :aria-label="description"> <table class="w-full border-collapse text-left text-sm text-gray-500 dark:text-gray-400" role="table" :aria-label="description">
<thead v-if="!hideHeaders" class="bg-#ffffff uppercase text-gray-700 dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5"> <thead v-if="!hideHeaders" class="bg-#ffffff text-gray-700 uppercase dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
<tr> <tr>
<th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs"> <th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs">
{{ header.label }} {{ header.label }}