Skip to content

Commit df16dc1

Browse files
author
antoine
committed
wip refactor embed templates
1 parent 488c4ed commit df16dc1

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

resources/js/form/components/fields/editor/Editor.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { __ } from "@/utils/i18n";
33
import { vSticky } from "@/directives/sticky";
44
import { FormEditorFieldData } from "@/types";
5-
import { provide, ref, watch } from "vue";
5+
import { provide, ref, useTemplateRef, watch } from "vue";
66
import { Editor } from "@tiptap/vue-3";
77
import debounce from 'lodash/debounce';
88
import { EditorContent } from '@tiptap/vue-3';
@@ -25,7 +25,6 @@
2525
import EditorUploadModal from "@/form/components/fields/editor/extensions/upload/EditorUploadModal.vue";
2626
import EditorEmbedModal from "@/form/components/fields/editor/extensions/embed/EditorEmbedModal.vue";
2727
import FormFieldLayout from "@/form/components/FormFieldLayout.vue";
28-
import { Card } from "@/components/ui/card";
2928
import EditorAttributes from "@/form/components/fields/editor/EditorAttributes.vue";
3029
import { cn } from "@/utils/cn";
3130
@@ -162,7 +161,7 @@
162161
:editor="editor"
163162
v-bind="$props"
164163
@upload="uploadModal.open()"
165-
@embed="embed => embedModal.open({ embed })"
164+
@embed="(embed) => embedModal.open({ embed })"
166165
/>
167166
</div>
168167
</template>

resources/js/form/components/fields/editor/extensions/embed/EditorEmbedModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
editor: Editor
1313
}>();
1414
const parentForm = useParentForm();
15-
const currentModalEmbed = ref<{ id: string, embed: EmbedData, form: Form } | null>(null);
15+
const currentModalEmbed = ref<{ id?: string, embed: EmbedData, form: Form } | null>(null);
1616
const embedManager = useParentEditor().embedManager;
1717
1818
async function postForm(data: EmbedData['value']) {
@@ -22,7 +22,7 @@
2222
data
2323
);
2424
25-
if(!currentModalEmbed.value.id) {
25+
if(currentModalEmbed.value.id == null) {
2626
props.editor.commands.insertEmbed({ id, embed: currentModalEmbed.value.embed });
2727
}
2828

src/Data/Embeds/EmbedData.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public function __construct(
2222
public ?IconData $icon,
2323
/** @var string[] */
2424
public array $attributes,
25-
public string $template,
2625
/** @var DataCollection<string,FormFieldData> */
2726
public DataCollection $fields,
2827
) {}

0 commit comments

Comments
 (0)