Add uuid to content component
This commit is contained in:
parent
b83d9b9faa
commit
99ce0ab84d
|
|
@ -2,6 +2,7 @@
|
|||
<div
|
||||
:class="componentClass"
|
||||
:data-scrollto="component.id"
|
||||
:data-uuid="component.id"
|
||||
data-cy="content-component"
|
||||
>
|
||||
<bookmark-actions
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue