114
114
</div >
115
115
<v-divider class =" my-4" />
116
116
<div class =" note-content" v-if =" !hasEmptyContent && !isHomeNoteDefaultContent" >
117
- <div v-if =" showManualChild" id =" showManualChild" >
118
- <v-treeview
119
- dense
120
- :items =" noteAllChildren"
121
- item-key =" noteId" >
122
- <template #label =" { item } " >
123
- <v-list-item-title @click =" openNoteChild(item)" class =" body-2 clickable primary--text" >
124
- <span >{{ item.name }}</span >
125
- </v-list-item-title >
126
- </template >
127
- </v-treeview >
128
- </div >
129
117
<div
130
- class =" notes-application-content text-color"
131
- v-html = " noteVersionContent " >
118
+ class =" notes-application-content text-color" >
119
+ < component :is = " notesContentProcessor " / >
132
120
</div >
133
121
</div >
134
122
<div v-else-if =" !hasChildren || hasDraft && hasEmptyContent" >
@@ -326,7 +314,6 @@ export default {
326
314
isDraft: false ,
327
315
noteTitle: ' ' ,
328
316
spaceMembersUrl: ` ${ eXo .env .portal .context } /g/:spaces:${ eXo .env .portal .spaceGroup } /${ eXo .env .portal .spaceUrl } /members` ,
329
- hasManualChildren: false ,
330
317
childNodes: [],
331
318
exportStatus: ' ' ,
332
319
exportId: 0 ,
@@ -338,7 +325,6 @@ export default {
338
325
if (! this .note .draftPage ) {
339
326
this .getNoteVersionByNoteId (this .note .id );
340
327
}
341
- setTimeout (() => this .hasManualChildren = false , 100 );
342
328
if ( this .note && this .note .breadcrumb && this .note .breadcrumb .length ) {
343
329
this .note .breadcrumb [0 ].title = this .getHomeTitle (this .note .breadcrumb [0 ].title );
344
330
this .currentNoteBreadcrumb = this .note .breadcrumb ;
@@ -350,17 +336,6 @@ export default {
350
336
this .updateNote (this .note );
351
337
}
352
338
},
353
- hasManualChildren () {
354
- if (this .hasManualChildren ) {
355
- window .setTimeout (() => {
356
- const oldContainer = document .getElementById (' showManualChild' );
357
- const newContainers = document .getElementById (' note-children-container' );
358
- if (oldContainer && ! newContainers .childNodes .length ) {
359
- newContainers .append (... oldContainer .childNodes );
360
- }
361
- }, 100 );
362
- }
363
- },
364
339
actualVersion () {
365
340
if (! this .isDraft ) {
366
341
this .noteContent = this .actualVersion .content ;
@@ -369,17 +344,74 @@ export default {
369
344
},
370
345
exportStatus (){
371
346
if (this .exportStatus .status === ' ZIP_CREATED' ){
372
- this .stopGetSatus ();
347
+ this .stopGetStatus ();
373
348
this .getExportedZip ();
374
349
this .exportStatus = {};
375
350
}
376
351
if (this .exportStatus .status === null ){
377
- this .stopGetSatus ();
352
+ this .stopGetStatus ();
378
353
this .exportStatus = {};
379
354
}
380
355
}
381
356
},
382
357
computed: {
358
+ notesContentProcessor () {
359
+ return {
360
+ template: ` <div>${ this .formatContent (this .noteContent )} </div>` ,
361
+ data () {
362
+ return {
363
+ vTreeComponent: {
364
+ template: ' <v-treeview \
365
+ dense \
366
+ :items="noteChildItems" \
367
+ item-key="noteId"> \
368
+ <template #label="{ item }"> \
369
+ <v-list-item-title @click="openNoteChild(item)" class="body-2 clickable primary--text"> \
370
+ <span>{{ item.name }}</span> \
371
+ </v-list-item-title> \
372
+ </template> \
373
+ </v-treeview >' ,
374
+ props: {
375
+ noteId: 0 ,
376
+ source: ' ' ,
377
+ noteBookType: ' ' ,
378
+ noteBookOwner: ' '
379
+ },
380
+ data : function () {
381
+ return {
382
+ noteChildItems: [],
383
+ note: null
384
+ };
385
+ },
386
+ created : function () {
387
+ this .$nextTick ().then (() => {
388
+ this .getNodeById (this .noteId , this .source , this .noteBookType , this .noteBookOwner );
389
+ });
390
+ },
391
+ methods: {
392
+ getNodeById (noteId , source , noteBookType , noteBookOwner ) {
393
+ return this .$notesService .getNoteById (noteId, source, noteBookType, noteBookOwner).then (data => {
394
+ this .note = data || {};
395
+ this .$notesService .getFullNoteTree (data .wikiType , data .wikiOwner , data .name , false ).then (data => {
396
+ if (data && data .jsonList .length ) {
397
+ const allNotesTreeview = data .jsonList ;
398
+ this .noteChildItems = allNotesTreeview .filter (note => note .name === this .note .title )[0 ]? .children ;
399
+ }
400
+ });
401
+ }).catch (e => {
402
+ console .error (' Error when getting note' , e);
403
+ });
404
+ },
405
+ openNoteChild (item ) {
406
+ const noteName = item .path .split (' %2F' ).pop ();
407
+ this .$root .$emit (' open-note-by-name' , noteName);
408
+ },
409
+ }
410
+ }
411
+ };
412
+ }
413
+ };
414
+ },
383
415
noteVersionsArray () {
384
416
return this .noteVersions .slice (0 , this .versionsPageSize );
385
417
},
@@ -389,9 +421,6 @@ export default {
389
421
hasMoreVersions () {
390
422
return this .allNoteVersionsCount > this .versionsPageSize ;
391
423
},
392
- showManualChild () {
393
- return this .hasManualChildren ;
394
- },
395
424
noteVersionContent () {
396
425
return this .note .content && this .noteContent && this .formatContent (this .noteContent );
397
426
},
@@ -473,7 +502,6 @@ export default {
473
502
} else {
474
503
return 0 ;
475
504
}
476
-
477
505
},
478
506
appName () {
479
507
const uris = eXo .env .portal .selectedNodeUri .split (' /' );
@@ -593,7 +621,7 @@ export default {
593
621
this.getExportStatus();
594
622
},
595
623
cancelExportNotes() {
596
- this.stopGetSatus ();
624
+ this.stopGetStatus ();
597
625
this.$notesService.cancelExportNotes(this.exportId).then(() => {
598
626
this.$root.$emit('show-alert', {type: 'success', message: this.$t('notes.alert.success.label.export.canceled')});
599
627
}).catch(e => {
@@ -628,16 +656,15 @@ export default {
628
656
this.exportStatus = data;
629
657
this.$refs.notesBreadcrumb.setExportStaus(this.exportStatus);
630
658
}).catch(() => {
631
- this.stopGetSatus ();
659
+ this.stopGetStatus ();
632
660
});
633
661
}, 500);
634
662
},
635
- stopGetSatus (){
663
+ stopGetStatus (){
636
664
clearInterval(this.intervalId);
637
665
},
638
666
getNoteById(noteId, source) {
639
667
return this.$notesService.getNoteById(noteId, source, this.noteBookType, this.noteBookOwner).then(data => {
640
- this.note = {};
641
668
this.note = data || {};
642
669
this.loadData = true;
643
670
this.currentNoteBreadcrumb = this.note.breadcrumb;
@@ -836,12 +863,18 @@ export default {
836
863
for (let i = 0; i < contentChildren.length; i++) { // NOSONAR not iterable
837
864
const child = contentChildren[i];
838
865
if (child.classList.value.includes('navigation-img-wrapper')) {
839
- child.innerHTML = '';
840
- window.setTimeout(() => {this.hasManualChildren = true;},100);
866
+ // Props object
867
+ const componentProps = {
868
+ noteId: this.note.id,
869
+ source: '',
870
+ noteBookType: this.noteBookType,
871
+ noteBookOwner: this.noteBookOwner
872
+ };
873
+ contentChildren[i].innerHTML = ` < component v- bind: is= " vTreeComponent" note- id= " ${componentProps.noteId}" note- book- type= " ${componentProps.noteBookType}" note- book- owner= " ${componentProps.noteBookOwner}" >< / component> ` ;
841
874
}
842
875
}
843
876
}
844
- return docElement.innerHTML;
877
+ return docElement?.children[1] .innerHTML;
845
878
},
846
879
openNoteVersionsHistoryDrawer() {
847
880
if (!this.isDraft) {
0 commit comments