Skip to content

Commit d47945b

Browse files
authored
Merge pull request #625 from code16/improve-editor
Improve editor
2 parents 9a1bca6 + 90f7ec0 commit d47945b

60 files changed

Lines changed: 1878 additions & 1291 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

demo/app/Sharp/Posts/PostForm.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function buildFormFields(FieldsContainer $formFields): void
7272
->setMaxFileSize(2)
7373
->setHasLegend()
7474
)
75+
->allowFullscreen()
7576
->setMaxLength(2000)
7677
->setHeight(300, 0)
7778
)

demo/app/Sharp/TestForm/TestForm.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ public function buildFormFields(FieldsContainer $formFields): void
201201
// ->setReadOnly()
202202
->setLocalized()
203203
->setLabel('Wysiwyg')
204+
->allowFullscreen()
204205
->setToolbar([
205206
SharpFormEditorField::B,
206207
SharpFormEditorField::I,
@@ -252,6 +253,8 @@ public function buildFormFields(FieldsContainer $formFields): void
252253
SharpFormEditorField::QUOTE,
253254
SharpFormEditorField::CODE,
254255
SharpFormEditorField::SEPARATOR,
256+
SharpFormEditorField::IFRAME,
257+
SharpFormEditorField::TABLE,
255258
SharpFormEditorField::CODE_BLOCK,
256259
])
257260
->allowUploads(

package-lock.json

Lines changed: 958 additions & 809 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,23 @@
3939
"dependencies": {
4040
"@googlemaps/js-api-loader": "^1.16.8",
4141
"@inertiajs/vue3": "^2.0.2",
42-
"@tiptap/core": "^2.2.2",
43-
"@tiptap/extension-character-count": "^2.2.2",
44-
"@tiptap/extension-code-block": "^2.2.2",
45-
"@tiptap/extension-highlight": "^2.2.2",
46-
"@tiptap/extension-image": "^2.2.2",
47-
"@tiptap/extension-link": "^2.2.2",
48-
"@tiptap/extension-placeholder": "^2.2.2",
49-
"@tiptap/extension-superscript": "^2.2.2",
50-
"@tiptap/extension-table": "^2.2.2",
51-
"@tiptap/extension-table-cell": "^2.2.2",
52-
"@tiptap/extension-table-header": "^2.2.2",
53-
"@tiptap/extension-table-row": "^2.2.2",
54-
"@tiptap/pm": "^2.2.2",
55-
"@tiptap/starter-kit": "^2.2.2",
56-
"@tiptap/vue-3": "^2.2.2",
42+
"@tiptap/core": "^3.3.0",
43+
"@tiptap/extension-character-count": "^3.3.0",
44+
"@tiptap/extension-code-block": "^3.3.0",
45+
"@tiptap/extension-drag-handle-vue-3": "^3.4.1",
46+
"@tiptap/extension-highlight": "^3.3.0",
47+
"@tiptap/extension-image": "^3.3.0",
48+
"@tiptap/extension-link": "^3.3.0",
49+
"@tiptap/extension-placeholder": "^3.3.0",
50+
"@tiptap/extension-superscript": "^3.3.0",
51+
"@tiptap/extension-table": "^3.3.0",
52+
"@tiptap/extension-table-cell": "^3.3.0",
53+
"@tiptap/extension-table-header": "^3.3.0",
54+
"@tiptap/extension-table-row": "^3.3.0",
55+
"@tiptap/extensions": "^3.3.0",
56+
"@tiptap/pm": "^3.3.0",
57+
"@tiptap/starter-kit": "^3.3.0",
58+
"@tiptap/vue-3": "^3.3.0",
5759
"@uppy/core": "^4.4.1",
5860
"@uppy/drop-target": "^3.1.1",
5961
"@uppy/thumbnail-generator": "^4.1.1",
@@ -73,14 +75,14 @@
7375
"flexsearch": "^0.8.205",
7476
"leaflet": "^1.9.4",
7577
"lodash": "^4.17.21",
76-
"lucide-vue-next": "^0.511.0",
78+
"lucide-vue-next": "^0.542.0",
7779
"nprogress": "^0.2.0",
7880
"qs": "^6.6.0",
7981
"reka-ui": "^2.5.0",
8082
"sortablejs": "^1.15.2",
8183
"tailwind-merge": "^3.3.0",
8284
"text-clipper": "^1.3.0",
83-
"tiptap-markdown": "^0.7.3",
85+
"tiptap-markdown": "^0.9.0",
8486
"vue": "^3.5.12",
8587
"vue-sonner": "^1.1.2",
8688
"vue3-apexcharts": "^1.8.0"

resources/css/content.css

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
@layer components {
22
.content {
33
> :where(h1) {
4-
@apply mb-3 text-xl font-semibold tracking-tight border-b pb-0.5;
4+
@apply mb-[.75em] text-[1.375em]/[1.2] font-semibold tracking-tight border-b pb-[.15em];
55
}
66
> :where(h2) {
7-
@apply mb-2 text-lg font-semibold tracking-tight;
7+
@apply mb-[.5em] text-[1.25em]/[1.2] font-semibold tracking-tight;
88
}
99
> :where(h3) {
10-
@apply mb-1.5 text-sm font-semibold tracking-tight;
10+
@apply mb-[.5em] text-[1em]/[1.2] font-semibold tracking-tight;
1111
}
1212
> :where(h4, h5, h6) {
13-
@apply mb-1 font-semibold;
13+
@apply mb-[.5em] text-[1em]/[1.2] font-semibold;
1414
}
1515
> :where(p) {
16-
@apply mb-4;
16+
@apply mb-[1.25em];
1717
}
1818
> :where(ul) {
19-
@apply mb-4 ml-6 list-disc;
19+
@apply mb-[1.25em] pl-[1.75em] list-disc;
2020
> :where(li) {
21-
@apply mb-2;
21+
@apply mb-[.5em];
2222
}
2323
> :where(:last-child) {
2424
@apply mb-0;
2525
}
2626
}
2727
> :where(ol) {
28-
@apply mb-4 ml-6 list-decimal;
28+
@apply mb-[1.25em] pl-[1.75em] list-decimal;
2929
> :where(li) {
30-
@apply mb-2;
30+
@apply mb-[.5em];
3131
}
3232
> :where(:last-child) {
3333
@apply mb-0;
3434
}
3535
}
3636
> :where(blockquote) {
37-
@apply mb-4 relative flow-root pl-4 border-l-2 before:block before:-mt-0.5;
37+
@apply mb-[1.25em] relative flow-root pl-[1.125em] border-l-2 before:block before:-mt-[.2lh] after:block after:-mb-[.2lh];
3838
> :where(p,ul,ol) {
3939
@apply mt-2;
4040
}
@@ -46,28 +46,28 @@
4646
}
4747
}
4848
> :where(table) {
49-
@apply mb-4 w-full;
49+
@apply mb-[1.25em] w-full;
5050
:where(tr) {
5151
@apply m-0 border-t p-0 even:bg-muted;
5252
}
5353
:where(th) {
54-
@apply border px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right;
54+
@apply border px-[1.125em] py-[.625em] text-left font-[650] [&[align=center]]:text-center [&[align=right]]:text-right;
5555
}
5656
:where(td) {
57-
@apply border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right;
57+
@apply border px-[1.125em] py-[.625em] text-left [&[align=center]]:text-center [&[align=right]]:text-right;
5858
}
5959
}
6060
:where(code) {
6161
@apply rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm;
6262
}
6363
> :where(pre) {
64-
@apply mb-4 !whitespace-pre overflow-x-auto;
64+
@apply mb-[1.25em] !whitespace-pre overflow-x-auto;
6565
> :where(code) {
66-
@apply block py-2 px-4 bg-muted rounded-md [font-size:inherit];
66+
@apply block py-[.625em] px-[1.125em] bg-muted rounded-md [font-size:inherit];
6767
}
6868
}
6969
> :where(hr) {
70-
@apply mb-4;
70+
@apply mb-[1.25em];
7171
}
7272
:where(a:not([style],[class])) {
7373
@apply relative p-1.5 -m-1.5 text-primary underline underline-offset-4 decoration-primary/20 hover:decoration-inherit;
@@ -76,10 +76,21 @@
7676
@apply font-[650];
7777
}
7878
> :where(:first-child) {
79-
@apply mt-0;
79+
@apply mt-0!;
8080
}
8181
> :where(:last-child) {
82-
@apply mb-0;
82+
@apply mb-0!;
83+
}
84+
}
85+
.content-lg {
86+
> :where(h1) {
87+
@apply mt-[1em] text-[1.75em]/[1.2];
88+
}
89+
> :where(h2) {
90+
@apply mt-[1.25em] text-[1.5em]/[1.2];
91+
}
92+
> :where(h3) {
93+
@apply mt-[1em] text-[1.25em]/[1.2];
8394
}
8495
}
8596
.content-sm {

resources/js/components/LocaleSelectTrigger.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22
import { Languages } from "lucide-vue-next";
33
import { SelectTrigger, SelectValue } from "@/components/ui/select/index.js";
44
import { __ } from "@/utils/i18n";
5+
6+
defineProps<{
7+
errorCount?: number,
8+
}>();
59
</script>
610

711
<template>
8-
<SelectTrigger class="w-auto h-8" :aria-label="$attrs['aria-label'] ?? __('sharp::action_bar.locale_selector.label')">
12+
<SelectTrigger class="w-auto gap-0 h-8" :aria-label="$attrs['aria-label'] ?? __('sharp::action_bar.locale_selector.label')">
913
<Languages class="size-3 mr-2.5 opacity-50" />
1014
<SelectValue class="uppercase text-xs" placeholder="-" />
15+
<template v-if="errorCount">
16+
<div class="ml-1.5 -mr-0.5 grid place-content-center text-[.625rem]/2.5 px-1 h-3.5 min-w-3.5 bg-destructive rounded-full text-destructive-foreground font-semibold">
17+
{{ errorCount }}
18+
</div>
19+
</template>
1120
</SelectTrigger>
1221
</template>

resources/js/components/ui/command/CommandItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
3737
<template>
3838
<ComboboxItem
3939
v-bind="forwarded"
40-
:class="cn('relative flex gap-2 cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', props.class)"
40+
:class="cn('relative flex gap-2 cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-highlighted:bg-accent data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', props.class)"
4141
v-scroll-into-view-override
4242
v-disable-first-focus
4343
ref="el"

resources/js/components/ui/dialog/DialogContent.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { X } from 'lucide-vue-next'
1313
import { cn } from '@/utils/cn'
1414
15-
const props = defineProps<DialogContentProps & { class?: HTMLAttributes['class'] }>()
15+
const props = defineProps<DialogContentProps & { class?: HTMLAttributes['class'], closeButton?:boolean }>()
1616
const emits = defineEmits<DialogContentEmits>()
1717
1818
const delegatedProps = computed(() => {
@@ -21,13 +21,13 @@ const delegatedProps = computed(() => {
2121
return delegated
2222
})
2323
24-
const forwarded = useForwardPropsEmits(delegatedProps, emits)
24+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
2525
</script>
2626

2727
<template>
2828
<DialogPortal>
2929
<DialogOverlay
30-
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
30+
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
3131
/>
3232
<DialogContent
3333
v-bind="forwarded"

resources/js/components/ui/dropdown-menu/DropdownMenuContent.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from 'reka-ui'
1010
import { cn } from '@/utils/cn'
1111
import { useMenuBoundaryElement } from "@/Layouts/Layout.vue";
12+
import { useParentDialogElement } from "@/composables/useParentDialogElement";
1213
1314
const props = withDefaults(
1415
defineProps<DropdownMenuContentProps & { class?: HTMLAttributes['class'] }>(),
@@ -27,10 +28,11 @@ const delegatedProps = computed(() => {
2728
2829
const forwarded = useForwardPropsEmits(delegatedProps, emits)
2930
const menuBoundary = useMenuBoundaryElement();
31+
const parentDialogElement = useParentDialogElement();
3032
</script>
3133

3234
<template>
33-
<DropdownMenuPortal>
35+
<DropdownMenuPortal :to="parentDialogElement ?? undefined">
3436
<DropdownMenuContent
3537
v-bind="forwarded"
3638
:collision-boundary="typeof props.collisionBoundary === 'undefined' ? menuBoundary : props.collisionBoundary"

resources/js/components/ui/popover/PopoverContent.vue

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
useForwardPropsEmits,
1010
} from 'reka-ui'
1111
import { cn } from '@/utils/cn'
12+
import { useParentDialogElement } from "@/composables/useParentDialogElement";
1213
1314
defineOptions({
1415
inheritAttrs: false,
@@ -30,21 +31,12 @@ const delegatedProps = computed(() => {
3031
return delegated
3132
})
3233
33-
const dialogContext = injectDialogRootContext(null);
3434
const forwarded = useForwardPropsEmits(delegatedProps, emits)
35-
const parentDialogElement = ref<HTMLElement>();
36-
37-
onMounted(() => {
38-
if(dialogContext) {
39-
nextTick(() => {
40-
parentDialogElement.value = dialogContext.contentElement.value.parentElement;
41-
});
42-
}
43-
});
35+
const parentDialogElement = useParentDialogElement();
4436
</script>
4537

4638
<template>
47-
<PopoverPortal :to="parentDialogElement">
39+
<PopoverPortal :to="parentDialogElement ?? undefined">
4840
<PopoverContent
4941
v-bind="{ ...forwarded, ...$attrs }"
5042
:class="

0 commit comments

Comments
 (0)