diff --git a/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_en.properties b/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_en.properties index d18cef21d..72cc3c295 100644 --- a/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_en.properties +++ b/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_en.properties @@ -164,6 +164,7 @@ notes.filter.label.published.notes=Published notes.filter.label.drafts=Drafts notes.label.translations=Translation: notes.label.translation.add=Add a new translation: +notes.label.addTheTranslation=Add the translation notes.label.chooseLangage=Choose language notes.label.translation.originalVersion=Original version notes.label.noTranslations=No translation diff --git a/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_fr.properties b/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_fr.properties index 4edfddf18..80921a2e2 100644 --- a/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_fr.properties +++ b/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_fr.properties @@ -166,6 +166,7 @@ notes.filter.label.drafts=Brouillons notes.label.translations=Translation: notes.label.translation.add=Ajouter une translation: +notes.label.addTheTranslation=Ajouter la translation notes.label.chooseLangage=Choisir une langue notes.label.translation.originalVersion=Version originale notes.label.noTranslations=Pas de translation diff --git a/notes-webapp/src/main/webapp/skin/less/notes/notes.less b/notes-webapp/src/main/webapp/skin/less/notes/notes.less index e55043c10..f39bf4082 100644 --- a/notes-webapp/src/main/webapp/skin/less/notes/notes.less +++ b/notes-webapp/src/main/webapp/skin/less/notes/notes.less @@ -1150,13 +1150,9 @@ ul.note-manual-child { color: @primaryColor !important; } -.left-separator { - border-left: solid; -} - - -.right-separator { - border-right: solid; +.bar-separator { + border-right: solid 2px @greyColor; + height: 26px; } diff --git a/notes-webapp/src/main/webapp/vue-app/notes-editor/components/NotesEditorDashboard.vue b/notes-webapp/src/main/webapp/vue-app/notes-editor/components/NotesEditorDashboard.vue index 23ab5eba9..656833b75 100644 --- a/notes-webapp/src/main/webapp/vue-app/notes-editor/components/NotesEditorDashboard.vue +++ b/notes-webapp/src/main/webapp/vue-app/notes-editor/components/NotesEditorDashboard.vue @@ -24,9 +24,10 @@ {{ noteFormTitle }} fa-language @@ -71,7 +72,9 @@ + :note="note" + :languages="languages" + :translations="translations" />
@@ -168,6 +171,8 @@ export default { oembedMinWidth: 300, showTranslationBar: false, slectedLanguage: null, + translations: null, + languages: [], }; }, computed: { @@ -193,7 +198,11 @@ export default { }, notesMultilingualActive() { return eXo?.env?.portal?.notesMultilingual; + }, + langBottonColor(){ + return this.translations?.length>0 ? 'primary--text':''; } + }, watch: { 'note.title'() { @@ -207,9 +216,10 @@ export default { this.autoSave(); this.hideTranslations(); } - }, + } }, created() { + this.getAvailableLanguages(); window.addEventListener('beforeunload', () => { if (!this.postingNote && this.note.draftPage && this.note.id) { const currentDraft = localStorage.getItem(`draftNoteId-${this.note.id}`); @@ -236,6 +246,7 @@ export default { } else { this.getNote(this.noteId); } + this.getNoteLanguages(); } if (urlParams.has('parentNoteId')) { this.parentPageId = urlParams.get('parentNoteId'); @@ -277,10 +288,11 @@ export default { } }); this.$root.$on('add-translation', lang => { - this.slectedLanguage=lang; + this.slectedLanguage=lang.value; + this.translations.unshift(lang); this.note.content=''; this.note.title=''; - this.note.lang=lang; + this.note.lang=lang.value; this.initCKEditor(); }); this.$root.$on('lang-translation-changed', lang => { @@ -758,16 +770,18 @@ export default { setToolBarEffect() { const element = CKEDITOR.instances['notesContent'] ; const elementNewTop = document.getElementById('notesTop'); - element.on('contentDom', function () { - this.document.on('click', function(){ - elementNewTop.classList.add('darkComposerEffect'); + if (element){ + element.on('contentDom', function () { + this.document.on('click', function(){ + elementNewTop.classList.add('darkComposerEffect'); + }); }); - }); - element.on('contentDom', function () { - this.document.on('keyup', function(){ - elementNewTop.classList.add('darkComposerEffect'); + element.on('contentDom', function () { + this.document.on('keyup', function(){ + elementNewTop.classList.add('darkComposerEffect'); + }); }); - }); + } $('#notesEditor').parent().click(() => { elementNewTop.classList.remove('darkComposerEffect'); elementNewTop.classList.add('greyComposerEffect'); @@ -784,7 +798,7 @@ export default { if (CKEDITOR.instances['notesContent']) { CKEDITOR.instances['notesContent'].status = 'ready'; window.setTimeout(() => { - this.$nextTick().then(() => CKEDITOR.instances['notesContent'].focus()); + this.$nextTick().then(() => CKEDITOR.instances['notesContent']?.focus()); }, 200); } } @@ -958,7 +972,28 @@ export default { oembed.setAttribute('style', style); }); return docElement?.children[1].innerHTML; - } + }, + getNoteLanguages(){ + return this.$notesService.getNoteLanguages(this.noteId).then(data => { + this.translations = data || []; + if (this.translations.length>0) { + this.translations = this.languages.filter(item1 => this.translations.some(item2 => item2 === item1.value)); + this.languages = this.languages.filter(item1 => !this.translations.some(item2 => item2.value === item1.value)); + } + if (this.isMobile) { + this.translations.unshift({value: '',text: this.$t('notes.label.translation.originalVersion')}); + } + }); + }, + getAvailableLanguages(){ + return this.$notesService.getAvailableLanguages().then(data => { + this.languages = data || []; + this.languages.unshift({value: '',text: this.$t('notes.label.chooseLangage')}); + if (this.translations){ + this.languages = this.languages.filter(item1 => !this.translations.some(item2 => item2.value === item1.value)); + } + }); + }, } }; diff --git a/notes-webapp/src/main/webapp/vue-app/notes-editor/components/TranslationsEditBar.vue b/notes-webapp/src/main/webapp/vue-app/notes-editor/components/TranslationsEditBar.vue index c30eaed57..fc49052c9 100644 --- a/notes-webapp/src/main/webapp/vue-app/notes-editor/components/TranslationsEditBar.vue +++ b/notes-webapp/src/main/webapp/vue-app/notes-editor/components/TranslationsEditBar.vue @@ -3,27 +3,36 @@ v-if="showTranslationbar" id="translationBar" class="d-flex flex-nowrap text-truncate px-1 pt-4 pb-3"> - - fa-arrow-left - -
+ + + {{ $t('notes.label.button.back') }} + +
+
{{ $t('notes.label.translation.originalVersion') }} -
{{ $t('notes.label.translations') }}
-
{{ $t('notes.label.noTranslations') }}
+
{{ $t('notes.label.translations') }}
+
{{ $t('notes.label.noTranslations') }}
+ class="my-auto mx-1"> {{ translation.text }}
@@ -49,11 +59,11 @@ width="32" fab depressed + class="my-1" v-bind="attrs" v-on="on">
+{{ moreTranslations.length }} @@ -63,7 +73,7 @@ @@ -81,9 +91,10 @@ small :outlined="item.value!==selectedTranslation.value" color="primary" + close-label="translation remove button" @click:close="removeTranslation(item)" @click="changeTranslation(item)" - class="ma-2"> + class="my-auto mx-1"> {{ item.text }} @@ -91,6 +102,7 @@
+
{{ $t('notes.label.translation.add') }}
- - fa-plus - + + + {{ $t('notes.label.addTheTranslation') }} +
@@ -121,17 +142,23 @@ export default { type: Object, default: () => null, }, + translations: { + type: Object, + default: () => null, + }, + languages: { + type: Object, + default: () => null, + }, }, data: () => ({ moreTranslationsMenu: false, showTranslationbar: false, - languages: [], selectedLang: {}, selectedTranslation: {value: ''}, displayActionMenu: true, noteLanguages: [], - translations: null, }), mounted() { @@ -141,9 +168,6 @@ export default { }, - created() { - this.getAvailableLanguages(); - }, computed: { moreTranslations(){ @@ -177,10 +201,9 @@ export default { this.$root.$emit('hide-translations'); }, add(){ - this.translations.unshift(this.selectedLang); + this.$root.$emit('add-translation', this.selectedLang); this.selectedTranslation=this.selectedLang; this.languages = this.languages.filter(item => item.value !== this.selectedLang.value); - this.$root.$emit('add-translation', this.selectedLang.value); this.selectedLang={value: '',text: this.$t('notes.label.chooseLangage')}; }, @@ -192,27 +215,6 @@ export default { this.selectedTranslation=translation; this.$root.$emit('lang-translation-changed', this.selectedTranslation.value); }, - getAvailableLanguages(){ - return this.$notesService.getAvailableLanguages().then(data => { - this.languages = data || []; - this.languages.unshift({value: '',text: this.$t('notes.label.chooseLangage')}); - if (this.translations){ - this.languages = this.languages.filter(item1 => !this.translations.some(item2 => item2.value === item1.value)); - } - }); - }, - getNoteLanguages(){ - return this.$notesService.getNoteLanguages(this.noteId).then(data => { - this.translations = data || []; - if (this.translations.length>0) { - this.translations = this.languages.filter(item1 => this.translations.some(item2 => item2 === item1.value)); - this.languages = this.languages.filter(item1 => !this.translations.some(item2 => item2.value === item1.value)); - } - if (this.isMobile) { - this.translations.unshift({value: '',text: this.$t('notes.label.translation.originalVersion')}); - } - }); - }, removeTranslation(translation){ return this.$notesService.deleteNoteTranslation(this.noteId,translation.value).then(() => { this.translations=this.translations.filter(item => item.value !== translation.value);