Compare commits

...

27 Commits

Author SHA1 Message Date
b5c9e65986 Merge branch 'refs/heads/master' into 321-text-editor
# Conflicts:
#	src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts
#	src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts
#	src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue
#	src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue
#	src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
#	src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
#	src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue
#	src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue
#	yarn.lock
2025-05-21 20:03:14 +02:00
2dcce7b826 Remove dumps 2025-02-25 15:29:45 +01:00
dcd1777a70 Pass content of the textEditor to the symfony form 2025-02-17 16:25:17 +01:00
a6eb28175a Revert backend to original state and load commentEditor vue app anytime CommentType form field is used 2025-02-17 14:13:07 +01:00
7d78512823 Change symfony form back to original 2025-02-17 13:11:03 +01:00
d0cd4792d6 Fix dynamicEntityPicker: declare variables 2025-02-13 15:02:06 +01:00
6d196ead94 Merge branch '321-text-editor' of https://gitlab.com/Chill-Projet/chill-bundles into 321-text-editor 2025-02-13 14:49:51 +01:00
4047d5fd5b WIP Allow for comment content to be submitted to backend 2025-02-13 14:49:33 +01:00
9aac80d834 Change logic to allow as many comment vue apps to be charged on same page as needed 2025-02-13 14:49:33 +01:00
7560dc57c6 Remove comment editor component from Activity vue app 2025-02-13 14:49:33 +01:00
10314845f6 Turn component into a small vue app and add public private comment logic 2025-02-13 14:49:33 +01:00
9b84bc4d69 Use update ckeditor5 2025-02-13 14:49:33 +01:00
a2fcf039be Refactor CKEditor integration across application
Replaced `ClassicEditor` with a consistent `classicEditor` and added centralized editor configuration using `editorConfig`. Simplified webpack configuration by removing CKEditor-specific setups and dependencies, improving maintainability.
2025-02-13 14:49:33 +01:00
b4d887a372 upgrade ckeditor 2025-02-13 14:49:32 +01:00
0aaa7122da upgrade ckeditor/vue 2025-02-13 14:49:32 +01:00
1bc7f85874 Implement localStorage and toggling of simple/rich text editor 2025-02-13 14:49:32 +01:00
1d2fd000aa Setup new component for text editor 2025-02-13 14:49:32 +01:00
506df432b0 WIP Allow for comment content to be submitted to backend 2025-02-06 16:07:40 +01:00
c32c18b0e2 Change logic to allow as many comment vue apps to be charged on same page as needed 2025-02-06 15:10:49 +01:00
321d569ee9 Remove comment editor component from Activity vue app 2025-02-06 14:32:22 +01:00
cd40eb3932 Turn component into a small vue app and add public private comment logic 2025-02-06 12:46:19 +01:00
f0f2531fa3 Use update ckeditor5 2025-02-06 10:33:32 +01:00
183a220e7b Refactor CKEditor integration across application
Replaced `ClassicEditor` with a consistent `classicEditor` and added centralized editor configuration using `editorConfig`. Simplified webpack configuration by removing CKEditor-specific setups and dependencies, improving maintainability.
2025-02-06 10:33:32 +01:00
9df127a82c upgrade ckeditor 2025-02-06 10:33:32 +01:00
04a1412562 upgrade ckeditor/vue 2025-02-06 10:33:32 +01:00
3aef0a185e Implement localStorage and toggling of simple/rich text editor 2025-02-06 10:33:32 +01:00
578bce31b9 Setup new component for text editor 2025-02-06 10:33:32 +01:00
20 changed files with 221 additions and 43 deletions

View File

@@ -11,7 +11,7 @@ import Location from "./components/Location.vue";
export default { export default {
name: "App", name: "App",
props: ["hasSocialIssues", "hasLocation", "hasPerson"], props: ["hasSocialIssues", "hasLocation", "hasPerson", "isSimpleEditor"],
components: { components: {
ConcernedGroups, ConcernedGroups,
SocialIssuesAcc, SocialIssuesAcc,

View File

@@ -14,18 +14,21 @@ const i18n = _createI18n(activityMessages);
const hasSocialIssues = document.querySelector("#social-issues-acc") !== null; const hasSocialIssues = document.querySelector("#social-issues-acc") !== null;
const hasLocation = document.querySelector("#location") !== null; const hasLocation = document.querySelector("#location") !== null;
const hasPerson = document.querySelector("#add-persons") !== null; const hasPerson = document.querySelector("#add-persons") !== null;
const isSimpleEditor = true;
const app = createApp({ const app = createApp({
template: `<app template: `<app
:hasSocialIssues="hasSocialIssues" :hasSocialIssues="hasSocialIssues"
:hasLocation="hasLocation" :hasLocation="hasLocation"
:hasPerson="hasPerson" :hasPerson="hasPerson"
:isSimpleEditor = "isSimpleEditor"
></app>`, ></app>`,
data() { data() {
return { return {
hasSocialIssues, hasSocialIssues,
hasLocation, hasLocation,
hasPerson, hasPerson,
isSimpleEditor
}; };
}, },
}) })

View File

@@ -33,6 +33,8 @@
@import './scss/hover.scss'; @import './scss/hover.scss';
@import './scss/comment-editor.scss';
/* /*
* BASE LAYOUT POSITION * BASE LAYOUT POSITION
*/ */

View File

@@ -0,0 +1,39 @@
.comment-container {
margin-top: 1.5rem;
}
.toggle-button {
background-color: white;
font-size: .8rem;
text-decoration: none;
position: absolute;
bottom: -10px;
left: 20px;
padding: 2px 6px;
cursor: pointer;
z-index: 10;
transition: left 0.1s ease-in-out;
}
.rich-editor-active .toggle-button {
bottom: 0;
}
.editor-wrapper textarea {
resize: vertical;
min-height: 100px;
}
.editor-container {
position: relative;
display: flex;
flex-direction: column;
}
.editor-wrapper {
position: relative;
}
.hidden-textarea {
display: none;
}

View File

@@ -8,10 +8,10 @@ import {
Heading, Heading,
Link, Link,
List, List,
} from "ckeditor5"; } from 'ckeditor5';
import coreTranslations from "ckeditor5/translations/fr.js"; import coreTranslations from 'ckeditor5/translations/fr.js';
import "ckeditor5/ckeditor5.css"; import 'ckeditor5/ckeditor5.css';
import "./index.scss"; import "./index.scss";
@@ -41,6 +41,8 @@ export default {
"redo", "redo",
], ],
}, },
translations: [coreTranslations], translations: [
coreTranslations
],
licenseKey: "GPL", licenseKey: "GPL",
} ; } ;

View File

@@ -1,12 +1,23 @@
import config from "./editor_config"; import App from "../../vuejs/CommentEditor/App.vue"
import { ClassicEditor } from "ckeditor5"; import { createApp, reactive } from "vue";
const ckeditorFields: NodeListOf<HTMLTextAreaElement> = const ckeditorFields: NodeListOf<HTMLTextAreaElement> =
document.querySelectorAll("textarea[ckeditor]"); document.querySelectorAll("[id^='comment-app']");
const globalState = reactive({
isSimple: localStorage.getItem('editorMode') === 'simple'
});
window.addEventListener('storage', () => {
globalState.isSimple = localStorage.getItem('editorMode') === 'simple';
});
ckeditorFields.forEach((field: HTMLTextAreaElement): void => { ckeditorFields.forEach((field: HTMLTextAreaElement): void => {
ClassicEditor.create(field, config).catch((error) => { const app = createApp(App,{
console.error(error.stack); fieldName: field.dataset.fieldName,
throw error; template: `<app></app>`
}); });
app.provide('globalState', globalState)
.component("app", App)
.mount(field);
}); });
//Fields.push.apply(Fields, document.querySelectorAll('.cf-fields textarea'));

View File

@@ -10,6 +10,10 @@ let appsPerInput = new Map();
function loadDynamicPicker(element) { function loadDynamicPicker(element) {
let apps = element.querySelectorAll('[data-module="pick-dynamic"]'); let apps = element.querySelectorAll('[data-module="pick-dynamic"]');
let suggested;
let as_id;
let submit_on_adding_new_entity;
let label;
apps.forEach(function (el) { apps.forEach(function (el) {
const isMultiple = parseInt(el.dataset.multiple) === 1, const isMultiple = parseInt(el.dataset.multiple) === 1,

View File

@@ -0,0 +1,36 @@
<template>
<div>
<div>
<comment-editor
:isSimple="globalState.isSimple"
:fieldName="fieldName"
@toggle="toggleEditorMode"
></comment-editor>
</div>
</div>
</template>
<script>
import { defineComponent, inject } from 'vue';
import CommentEditor from "../CommentEditor/component/CommentEditor.vue";
export default defineComponent({
name: "App",
components: { CommentEditor },
props: {
fieldName: String
},
setup() {
const globalState = inject('globalState');
const toggleEditorMode = () => {
globalState.isSimple = !globalState.isSimple;
localStorage.setItem('editorMode', globalState.isSimple ? 'simple' : 'rich');
};
return {
globalState,
toggleEditorMode,
};
}
});
</script>

View File

@@ -0,0 +1,58 @@
<template>
<div :class="{'editor-container': true, 'rich-editor-active': !isSimple}">
<div v-if="!isSimple" class="editor-wrapper">
<ckeditor
:name="fieldName"
:editor="classicEditor"
:config="editorConfig"
v-model.lazy="content"
tag-name="textarea"
/>
</div>
<div v-else class="editor-wrapper">
<textarea
v-model.lazy="content"
:name="fieldName"
class="form-control"
></textarea>
</div>
<a @click="toggleSimpleEditor" class="toggle-button">{{ isSimple ? "rich" : "simple" }}</a>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, computed, toRefs } from 'vue';
import { Ckeditor } from "@ckeditor/ckeditor5-vue";
import classicEditorConfig from "ChillMainAssets/module/ckeditor5/editor_config";
import { ClassicEditor } from "ckeditor5";
export default defineComponent({
name: "CommentEditor",
components: {
ckeditor: Ckeditor,
},
props: {
type: String,
isSimple: Boolean,
fieldName: String,
},
setup(props, { emit }) {
const { isSimple } = toRefs(props);
const content = ref("");
const classicEditor = ClassicEditor;
const editorConfig = classicEditorConfig;
const toggleSimpleEditor = () => {
emit("toggle");
};
return {
isSimple,
content,
classicEditor,
editorConfig,
toggleSimpleEditor,
};
}
});
</script>

View File

@@ -0,0 +1,14 @@
import {personMessages} from "ChillPersonAssets/vuejs/_js/i18n";
import {calendarUserSelectorMessages} from "ChillCalendarAssets/vuejs/_components/CalendarUserSelector/js/i18n";
import {activityMessages} from "ChillActivityAssets/vuejs/Activity/i18n";
const appMessages = {
fr: {
mode: {
simple: "Editeur simple",
rich: "Editeur riche"
}
},
};
export { appMessages };

View File

@@ -54,6 +54,11 @@ const messages = {
residential_address: "Adresse de résidence", residential_address: "Adresse de résidence",
located_at: "réside chez", located_at: "réside chez",
}, },
comment: {
label: "Commentaire",
editor_simple: "Simple",
editor_rich: "Riche"
}
}, },
}; };

View File

@@ -214,7 +214,9 @@
{% block private_comment_widget %} {% block private_comment_widget %}
{% for entry in form %} {% for entry in form %}
{{ form_widget(entry) }} <div id="comment-app-{{ form.vars.id }}" data-field-name="{{ form.vars.full_name }}">
{{ form_widget(entry, { attr: { ckeditor: 'true' } }) }}
</div>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}
@@ -224,7 +226,9 @@
{% block comment_widget %} {% block comment_widget %}
{% for entry in form %} {% for entry in form %}
{{ form_widget(entry) }} <div id="comment-app-{{ form.vars.id }}" data-field-name="{{ form.vars.full_name }}">
{{ form_widget(entry, { attr: { ckeditor: 'true' } }) }}
</div>
{% endfor %} {% endfor %}
{% endblock comment_widget %} {% endblock comment_widget %}

View File

@@ -113,6 +113,8 @@ Any comment: Aucun commentaire
# comment embeddable # comment embeddable
No comment associated: Aucun commentaire No comment associated: Aucun commentaire
private comment: Notes privées private comment: Notes privées
comment_public: Note
comment_private: Note privée
#pagination #pagination
Previous: Précédent Previous: Précédent

View File

@@ -69,7 +69,7 @@ import { mapState } from "vuex";
export default { export default {
name: "Comment", name: "Comment",
components: { components: {
ckeditor: Ckeditor, ckeditor: Ckeditor
}, },
data() { data() {
return { return {

View File

@@ -47,7 +47,7 @@ export default {
name: "WriteComment", name: "WriteComment",
components: { components: {
Modal, Modal,
ckeditor: Ckeditor, ckeditor: Ckeditor
}, },
props: ["resource"], props: ["resource"],
emits: ["updateComment"], emits: ["updateComment"],

View File

@@ -46,8 +46,7 @@
<label class="col-form-label">{{ $t("comments") }}</label> <label class="col-form-label">{{ $t("comments") }}</label>
<ckeditor <ckeditor
v-model="note" v-model="note"
:editor="classicEditor" :editor="classicEditor" :config="editorConfig"
:config="editorConfig"
tag-name="textarea" tag-name="textarea"
></ckeditor> ></ckeditor>
</div> </div>

View File

@@ -30,8 +30,7 @@
<div class="item-row comment"> <div class="item-row comment">
<ckeditor <ckeditor
:editor="classicEditor" :editor="classicEditor" :config="editorConfig"
:config="editorConfig"
v-model="comment" v-model="comment"
tag-name="textarea" tag-name="textarea"
/> />

View File

@@ -19,7 +19,7 @@ import { ClassicEditor } from "ckeditor5";
export default { export default {
name: "PersonComment.vue", name: "PersonComment.vue",
components: { components: {
ckeditor: Ckeditor, ckeditor: Ckeditor
}, },
props: ["conc"], props: ["conc"],
computed: { computed: {