Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/light-clubs-post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@dolphin/lark': patch
---

feat: support font color and font background color
5 changes: 5 additions & 0 deletions .changeset/whole-donkeys-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@dolphin/chrome-extension': patch
---

feat: support whether to enable text highlighting or not
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ Install Cloud Document Converter from [Chrome Web Store](https://chromewebstore.

## Inline

| **Lark Doc** | **Support** | **Markdown** |
| ------------ | ---------------- | ------------ |
| Bold | ✅ | Bold |
| Delete | ✅ | Delete |
| Italic | ✅ | Italic |
| Inline code | ✅ | Inline code |
| Link | ✅ | Link |
| Underline | To be determined | |
| **Lark Doc** | **Support** | **Markdown** |
| --------------------- | ---------------- | ------------ |
| Bold | ✅ | Bold |
| Delete | ✅ | Delete |
| Italic | ✅ | Italic |
| Inline code | ✅ | Inline Code |
| Link | ✅ | Link |
| Font Color | ✅ | HTML |
| Font Background Color | ✅ | HTML |
| Underline | To be determined | |

## Other

Indent and Align: To be determined

Font color and background color: to be determined

# Contribution

If you are interested in fixing issues and contributing directly to the code base, please see the document [How to Contribute](./contributing.md).
Expand Down
6 changes: 3 additions & 3 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ Cloud Document Converter 是一个浏览器扩展, 支持下载、复制飞书
| 加粗 | ✅ | Bold |
| 删除线 | ✅ | Delete |
| 倾斜 | ✅ | Italic |
| 行内代码 | ✅ | Inline code |
| 行内代码 | ✅ | Inline Code |
| 链接 | ✅ | Link |
| 字体颜色 | ✅ | HTML |
| 字体背景色 | ✅ | HTML |
| 下划线 | 待定 | |

## 其它

- 缩进和对齐:待定

- 字体颜色和背景色:待定

# 贡献

如果你有兴趣修复问题并直接为代码库做出贡献,请参阅文档 [如何贡献](./contributing.md)。
Expand Down
3 changes: 3 additions & 0 deletions apps/chrome-extension/src/common/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum SettingKey {
Theme = 'general.theme',
DownloadMethod = 'download.method',
TableWithNonPhrasingContent = 'general.table_with_non_phrasing_content',
TextHighlight = 'general.text_highlight',
}

export enum Theme {
Expand All @@ -31,6 +32,7 @@ export interface Settings {
[SettingKey.Theme]: (typeof Theme)[keyof typeof Theme]
[SettingKey.DownloadMethod]: (typeof DownloadMethod)[keyof typeof DownloadMethod]
[SettingKey.TableWithNonPhrasingContent]: (typeof TableWithNonPhrasingContent)[keyof typeof TableWithNonPhrasingContent]
[SettingKey.TextHighlight]: boolean
}

export const fallbackSettings: Settings = {
Expand All @@ -40,6 +42,7 @@ export const fallbackSettings: Settings = {
? DownloadMethod.ShowSaveFilePicker
: DownloadMethod.Direct,
[SettingKey.TableWithNonPhrasingContent]: TableWithNonPhrasingContent.ToHTML,
[SettingKey.TextHighlight]: true,
}

export const getSettings = async <Key extends keyof Settings>(
Expand Down
22 changes: 22 additions & 0 deletions apps/chrome-extension/src/components/ui/field/Field.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import type { FieldVariants } from '.'
import { cn } from '@/lib/utils'
import { fieldVariants } from '.'

const props = defineProps<{
class?: HTMLAttributes['class']
orientation?: FieldVariants['orientation']
}>()
</script>

<template>
<div
role="group"
data-slot="field"
:data-orientation="orientation"
:class="cn(fieldVariants({ orientation }), props.class)"
>
<slot />
</div>
</template>
22 changes: 22 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldContent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'

const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<div
data-slot="field-content"
:class="
cn(
'group/field-content flex flex-1 flex-col gap-1.5 leading-snug',
props.class,
)
"
>
<slot />
</div>
</template>
24 changes: 24 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldDescription.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'

const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<p
data-slot="field-description"
:class="
cn(
'text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance',
'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',
'[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
props.class,
)
"
>
<slot />
</p>
</template>
57 changes: 57 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldError.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { computed } from 'vue'
import { cn } from '@/lib/utils'

const props = defineProps<{
class?: HTMLAttributes['class']
errors?: Array<string | { message: string | undefined } | undefined>
}>()

const content = computed(() => {
if (!props.errors || props.errors.length === 0) return null

const uniqueErrors = [
...new Map(
props.errors.filter(Boolean).map(error => {
const message = typeof error === 'string' ? error : error?.message
return [message, error]
}),
).values(),
]

if (uniqueErrors.length === 1 && uniqueErrors[0]) {
return typeof uniqueErrors[0] === 'string'
? uniqueErrors[0]
: uniqueErrors[0].message
}

return uniqueErrors.map(error =>
typeof error === 'string' ? error : error?.message,
)
})
</script>

<template>
<div
v-if="$slots.default || content"
role="alert"
data-slot="field-error"
:class="cn('text-destructive text-sm font-normal', props.class)"
>
<slot v-if="$slots.default" />

<template v-else-if="typeof content === 'string'">
{{ content }}
</template>

<ul
v-else-if="Array.isArray(content)"
class="ml-4 flex list-disc flex-col gap-1"
>
<li v-for="(error, index) in content" :key="index">
{{ error }}
</li>
</ul>
</div>
</template>
22 changes: 22 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldGroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'

const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<div
data-slot="field-group"
:class="
cn(
'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4',
props.class,
)
"
>
<slot />
</div>
</template>
25 changes: 25 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldLabel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
import { Label } from '@/components/ui/label'

const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<Label
data-slot="field-label"
:class="
cn(
'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50',
'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4',
'has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10',
props.class,
)
"
>
<slot />
</Label>
</template>
26 changes: 26 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldLegend.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'

const props = defineProps<{
class?: HTMLAttributes['class']
variant?: 'legend' | 'label'
}>()
</script>

<template>
<legend
data-slot="field-legend"
:data-variant="variant"
:class="
cn(
'mb-3 font-medium',
'data-[variant=legend]:text-base',
'data-[variant=label]:text-sm',
props.class,
)
"
>
<slot />
</legend>
</template>
31 changes: 31 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldSeparator.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
import { Separator } from '@/components/ui/separator'

const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<div
data-slot="field-separator"
:data-content="!!$slots.default"
:class="
cn(
'relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2',
props.class,
)
"
>
<Separator class="absolute inset-0 top-1/2" />
<span
v-if="$slots.default"
class="bg-background text-muted-foreground relative mx-auto block w-fit px-2"
data-slot="field-separator-content"
>
<slot />
</span>
</div>
</template>
23 changes: 23 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldSet.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'

const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<fieldset
data-slot="field-set"
:class="
cn(
'flex flex-col gap-6',
'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',
props.class,
)
"
>
<slot />
</fieldset>
</template>
22 changes: 22 additions & 0 deletions apps/chrome-extension/src/components/ui/field/FieldTitle.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'

const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<div
data-slot="field-label"
:class="
cn(
'flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50',
props.class,
)
"
>
<slot />
</div>
</template>
Loading