replace ck-editor by new CommentEditor on every vuejs components

This commit is contained in:
Julien Fastré 2025-05-23 13:51:44 +02:00
parent 19dd4667f2
commit bb41af4ed2
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
7 changed files with 20 additions and 80 deletions

View File

@ -5,7 +5,7 @@ const ckeditorFields: NodeListOf<HTMLTextAreaElement> =
document.querySelectorAll("textarea[ckeditor]"); document.querySelectorAll("textarea[ckeditor]");
ckeditorFields.forEach((field: HTMLTextAreaElement): void => { ckeditorFields.forEach((field: HTMLTextAreaElement): void => {
const content = field.value; const content = field.value;
const div = document.createElement("div"); const div = document.createElement("div");
if (field.parentNode !== null) { if (field.parentNode !== null) {
field.parentNode.insertBefore(div, field); field.parentNode.insertBefore(div, field);

View File

@ -13,14 +13,7 @@
$t("comment.label") $t("comment.label")
}}</label> }}</label>
<ckeditor <comment-editor v-model="content" />
name="content"
:placeholder="$t('comment.content')"
:editor="classicEditor"
:config="editorConfig"
v-model="content"
tag-name="textarea"
/>
<div class="sub-comment"> <div class="sub-comment">
<div <div
@ -61,15 +54,13 @@
</template> </template>
<script> <script>
import { ClassicEditor } from "ckeditor5"; import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue";
import { Ckeditor } from "@ckeditor/ckeditor5-vue";
import classicEditorConfig from "ChillMainAssets/module/ckeditor5/editor_config";
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
name: "Comment", name: "Comment",
components: { components: {
ckeditor: Ckeditor, CommentEditor,
}, },
data() { data() {
return { return {

View File

@ -18,14 +18,7 @@
</h3> </h3>
</template> </template>
<template #body> <template #body>
<ckeditor <comment-editor v-model="content" />
name="content"
:placeholder="$t('comment_placeholder')"
:editor="editor"
:config="editorConfig"
v-model="content"
tag-name="textarea"
/>
</template> </template>
<template #footer> <template #footer>
<a class="btn btn-save" @click="saveAction"> <a class="btn btn-save" @click="saveAction">
@ -39,15 +32,13 @@
<script> <script>
import Modal from "ChillMainAssets/vuejs/_components/Modal.vue"; import Modal from "ChillMainAssets/vuejs/_components/Modal.vue";
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods"; import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
import { Ckeditor } from "@ckeditor/ckeditor5-vue"; import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue";
import classicEditorConfig from "ChillMainAssets/module/ckeditor5/editor_config";
import { ClassicEditor } from "ckeditor5";
export default { export default {
name: "WriteComment", name: "WriteComment",
components: { components: {
Modal, Modal,
ckeditor: Ckeditor, CommentEditor,
}, },
props: ["resource"], props: ["resource"],
emits: ["updateComment"], emits: ["updateComment"],

View File

@ -34,22 +34,12 @@
<div id="privateComment" class="action-row"> <div id="privateComment" class="action-row">
<label class="col-form-label">{{ $t("private_comment") }}</label> <label class="col-form-label">{{ $t("private_comment") }}</label>
<ckeditor <comment-editor v-model="privateComment"></comment-editor>
v-model="privateComment"
:editor="classicEditor"
:config="editorConfig"
tag-name="textarea"
></ckeditor>
</div> </div>
<div id="comment" class="action-row"> <div id="comment" class="action-row">
<label class="col-form-label">{{ $t("comments") }}</label> <label class="col-form-label">{{ $t("comments") }}</label>
<ckeditor <comment-editor v-model="note"></comment-editor>
v-model="note"
:editor="classicEditor"
:config="editorConfig"
tag-name="textarea"
></ckeditor>
</div> </div>
<div id="objectives" class="action-row"> <div id="objectives" class="action-row">
@ -461,9 +451,7 @@
<script> <script>
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import { Ckeditor } from "@ckeditor/ckeditor5-vue"; import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue";
import classicEditorConfig from "ChillMainAssets/module/ckeditor5/editor_config";
import { ClassicEditor } from "ckeditor5";
import AddResult from "./components/AddResult.vue"; import AddResult from "./components/AddResult.vue";
import AddEvaluation from "./components/AddEvaluation.vue"; import AddEvaluation from "./components/AddEvaluation.vue";
import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue"; import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue";
@ -529,7 +517,7 @@ const i18n = {
export default { export default {
name: "App", name: "App",
components: { components: {
ckeditor: Ckeditor, CommentEditor,
AddResult, AddResult,
AddEvaluation, AddEvaluation,
AddPersons, AddPersons,

View File

@ -88,13 +88,7 @@
$t("evaluation_public_comment") $t("evaluation_public_comment")
}}</label> }}</label>
<div class="col-sm-12"> <div class="col-sm-12">
<ckeditor <comment-editor v-model:value="comment"></comment-editor>
:editor="classicEditor"
:config="editorConfig"
:placeholder="$t('evaluation_comment_placeholder')"
v-model="comment"
tag-name="textarea"
></ckeditor>
</div> </div>
</div> </div>
@ -273,9 +267,6 @@
<script> <script>
import { ISOToDatetime } from "ChillMainAssets/chill/js/date"; import { ISOToDatetime } from "ChillMainAssets/chill/js/date";
import { Ckeditor } from "@ckeditor/ckeditor5-vue";
import { ClassicEditor } from "ckeditor5";
import classicEditorConfig from "ChillMainAssets/module/ckeditor5/editor_config";
import { mapState } from "vuex"; import { mapState } from "vuex";
import PickTemplate from "ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue"; import PickTemplate from "ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue";
import { buildLink } from "ChillDocGeneratorAssets/lib/document-generator"; import { buildLink } from "ChillDocGeneratorAssets/lib/document-generator";
@ -284,6 +275,7 @@ import { buildLinkCreate } from "ChillMainAssets/lib/entity-workflow/api";
import { buildLinkCreate as buildLinkCreateNotification } from "ChillMainAssets/lib/entity-notification/api"; import { buildLinkCreate as buildLinkCreateNotification } from "ChillMainAssets/lib/entity-notification/api";
import DocumentActionButtonsGroup from "ChillDocStoreAssets/vuejs/DocumentActionButtonsGroup.vue"; import DocumentActionButtonsGroup from "ChillDocStoreAssets/vuejs/DocumentActionButtonsGroup.vue";
import DropFileModal from "ChillDocStoreAssets/vuejs/DropFileWidget/DropFileModal.vue"; import DropFileModal from "ChillDocStoreAssets/vuejs/DropFileWidget/DropFileModal.vue";
import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue";
const i18n = { const i18n = {
messages: { messages: {
@ -322,8 +314,8 @@ export default {
name: "FormEvaluation", name: "FormEvaluation",
props: ["evaluation", "docAnchorId"], props: ["evaluation", "docAnchorId"],
components: { components: {
CommentEditor,
DropFileModal, DropFileModal,
ckeditor: Ckeditor,
PickTemplate, PickTemplate,
ListWorkflowModal, ListWorkflowModal,
DocumentActionButtonsGroup, DocumentActionButtonsGroup,
@ -371,8 +363,6 @@ export default {
}, },
computed: { computed: {
...mapState(["isPosting", "work", "me"]), ...mapState(["isPosting", "work", "me"]),
classicEditor: () => ClassicEditor,
editorConfig: () => classicEditorConfig,
AmIRefferer() { AmIRefferer() {
return !( return !(
this.$store.state.work.accompanyingPeriod.user && this.$store.state.work.accompanyingPeriod.user &&

View File

@ -29,12 +29,7 @@
</div> </div>
<div class="item-row comment"> <div class="item-row comment">
<ckeditor <comment-editor v-model="comment" />
:editor="classicEditor"
:config="editorConfig"
v-model="comment"
tag-name="textarea"
/>
</div> </div>
<div class="item-row participation-details"> <div class="item-row participation-details">
@ -103,15 +98,13 @@ div.participation-details {
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import PersonRenderBox from "ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue"; import PersonRenderBox from "ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue";
import { Ckeditor } from "@ckeditor/ckeditor5-vue"; import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue";
import classicEditorConfig from "ChillMainAssets/module/ckeditor5/editor_config";
import { ClassicEditor } from "ckeditor5";
export default { export default {
name: "MemberDetails", name: "MemberDetails",
components: { components: {
PersonRenderBox, PersonRenderBox,
ckeditor: Ckeditor, CommentEditor,
}, },
props: ["conc"], props: ["conc"],
computed: { computed: {

View File

@ -1,30 +1,17 @@
<template> <template>
<ckeditor <comment-editor v-model="content" />
name="content"
:placeholder="
$t('household_members_editor.positioning.comment_placeholder')
"
:editor="editor"
:config="editorConfig"
v-model="content"
tag-name="textarea"
/>
</template> </template>
<script> <script>
import { Ckeditor } from "@ckeditor/ckeditor5-vue"; import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue";
import classicEditorConfig from "ChillMainAssets/module/ckeditor5/editor_config";
import { ClassicEditor } from "ckeditor5";
export default { export default {
name: "PersonComment.vue", name: "PersonComment.vue",
components: { components: {
ckeditor: Ckeditor, CommentEditor,
}, },
props: ["conc"], props: ["conc"],
computed: { computed: {
editor: () => ClassicEditor,
editorConfig: () => classicEditorConfig,
content: { content: {
get() { get() {
return this.$props.conc.comment || ""; return this.$props.conc.comment || "";