Add uuid to content component

This commit is contained in:
Ramon Wenger 2024-01-08 22:30:59 +01:00
parent b83d9b9faa
commit 99ce0ab84d
2 changed files with 4 additions and 8 deletions

View File

@ -2,6 +2,7 @@
<div
:class="componentClass"
:data-scrollto="component.id"
:data-uuid="component.id"
data-cy="content-component"
>
<bookmark-actions

View File

@ -17,6 +17,7 @@ import popover from '@/helpers/popover';
interface Highlight {
contentBlock: string; // the id
contentIndex: number; // which content of the .contents array do I come from?
contentUUID: string; // the wagtail UUID of the content element
paragraphIndex: number; // which paragraph inside the textBlock do I come from?
startPosition: number; // start of the selection
selectionLength: number; // length of the selection
@ -115,17 +116,11 @@ export const getSelectionHandler = (el: HTMLElement, contentBlock: ContentBlockN
).length;
const { start, end } = range.toCharacterRange(paragraph);
// console.log(contentBlock.id);
// console.log(start, end);
// console.log(parent);
// console.log(position);
// console.log(numOfParagraphs);
// console.log(positionInTextBlock);
// const instance = new Mark(paragraph);
// instance.markRanges([{ start, length: end - start }]);
const uuid = contentComponent.dataset.uuid || '';
const highlightedText: Highlight = {
contentBlock: contentBlock.id,
contentIndex: position,
contentUUID: uuid,
startPosition: start,
paragraphIndex: positionInTextBlock,
selectionLength: end - start,