2023-10-10 22:07:12 -04:00
|
|
|
<script setup lang="ts">
|
|
|
|
import TinymceEditor from "@tinymce/tinymce-vue";
|
|
|
|
import { Field as VeeField } from "vee-validate";
|
2023-12-29 20:11:07 -05:00
|
|
|
|
2023-10-10 22:07:12 -04:00
|
|
|
const props = defineProps<{
|
|
|
|
name: string;
|
|
|
|
init: any;
|
|
|
|
label: string;
|
|
|
|
val?: string;
|
|
|
|
width?: number;
|
|
|
|
wrapCol?: any;
|
2023-10-01 19:37:31 -04:00
|
|
|
}>();
|
|
|
|
let dark = inject<boolean>("dark");
|
2024-03-16 21:18:07 -04:00
|
|
|
const stop = (e, ed) => {
|
|
|
|
console.log(e.type.toUpperCase(), e, ed);
|
|
|
|
e.preventDefault();
|
|
|
|
e.cancel();
|
|
|
|
e.stopImmediatePropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
};
|
2023-10-10 22:07:12 -04:00
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<ClientOnly>
|
2024-03-16 21:18:07 -04:00
|
|
|
<vee-field :name="props.name" v-slot="{ errorMessage, field, value, setValue }" :model-value="props.val">
|
|
|
|
<a-form-item
|
|
|
|
:data-testid="$attrs['data-testid']"
|
|
|
|
:validate-status="!!errorMessage ? 'error' : ''"
|
|
|
|
:name="props.name"
|
|
|
|
:label="props.label as any"
|
|
|
|
:help="errorMessage"
|
|
|
|
>
|
2023-10-10 22:07:12 -04:00
|
|
|
<tinymce-editor
|
2024-03-16 21:18:07 -04:00
|
|
|
model-events="drag dragdrop dragend draggesture dragover dragstart drop change"
|
2023-10-10 22:07:12 -04:00
|
|
|
v-bind="field"
|
|
|
|
width="100%"
|
2024-03-15 19:05:23 -04:00
|
|
|
@change="
|
|
|
|
(e) => {
|
|
|
|
console.debug(e);
|
|
|
|
setValue(e);
|
|
|
|
}
|
|
|
|
"
|
2023-10-10 22:07:12 -04:00
|
|
|
:initial-value="value"
|
|
|
|
v-model:model-value="field.value"
|
2024-03-16 21:18:07 -04:00
|
|
|
@drag="stop"
|
|
|
|
@deactivate="(e) => console.log(e)"
|
|
|
|
@dragOver="stop"
|
|
|
|
@dragEnter="stop"
|
|
|
|
@dragEnd="stop"
|
|
|
|
@dragDrop="stop"
|
|
|
|
@draggesture="stop"
|
|
|
|
@dragGesture="stop"
|
|
|
|
@dragstart="stop"
|
|
|
|
@drop="stop"
|
2023-10-11 14:09:06 -04:00
|
|
|
tinymce-script-src="/tinymce/tinymce.min.js"
|
2023-10-10 22:07:12 -04:00
|
|
|
:init="{
|
|
|
|
...props.init,
|
|
|
|
skin: dark ? 'oxide-dark' : 'oxide',
|
|
|
|
content_css: dark ? 'dark' : 'default',
|
|
|
|
}"
|
|
|
|
/>
|
|
|
|
</a-form-item>
|
|
|
|
</vee-field>
|
|
|
|
</ClientOnly>
|
|
|
|
</template>
|