mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-11 09:14:59 +00:00
Compare commits
27 Commits
move-docum
...
321-text-e
Author | SHA1 | Date | |
---|---|---|---|
b5c9e65986
|
|||
2dcce7b826 | |||
dcd1777a70 | |||
a6eb28175a | |||
7d78512823 | |||
d0cd4792d6 | |||
6d196ead94 | |||
4047d5fd5b | |||
9aac80d834 | |||
7560dc57c6 | |||
10314845f6 | |||
9b84bc4d69 | |||
a2fcf039be | |||
b4d887a372 | |||
0aaa7122da | |||
1bc7f85874 | |||
1d2fd000aa | |||
506df432b0 | |||
c32c18b0e2 | |||
321d569ee9 | |||
cd40eb3932 | |||
f0f2531fa3 | |||
183a220e7b | |||
9df127a82c | |||
04a1412562 | |||
3aef0a185e | |||
578bce31b9 |
@@ -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,
|
||||||
|
@@ -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
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
@import './scss/hover.scss';
|
@import './scss/hover.scss';
|
||||||
|
|
||||||
|
@import './scss/comment-editor.scss';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BASE LAYOUT POSITION
|
* BASE LAYOUT POSITION
|
||||||
*/
|
*/
|
||||||
|
@@ -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;
|
||||||
|
}
|
@@ -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",
|
||||||
} ;
|
} ;
|
||||||
|
@@ -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'));
|
|
||||||
|
@@ -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,
|
||||||
|
@@ -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>
|
@@ -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>
|
@@ -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 };
|
@@ -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"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -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 %}
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
@@ -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 {
|
||||||
|
@@ -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"],
|
||||||
|
@@ -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>
|
||||||
|
@@ -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"
|
||||||
/>
|
/>
|
||||||
|
@@ -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: {
|
||||||
|
Reference in New Issue
Block a user