Add uuid to content component
This commit is contained in:
parent
b83d9b9faa
commit
99ce0ab84d
|
|
@ -2,6 +2,7 @@
|
||||||
<div
|
<div
|
||||||
:class="componentClass"
|
:class="componentClass"
|
||||||
:data-scrollto="component.id"
|
:data-scrollto="component.id"
|
||||||
|
:data-uuid="component.id"
|
||||||
data-cy="content-component"
|
data-cy="content-component"
|
||||||
>
|
>
|
||||||
<bookmark-actions
|
<bookmark-actions
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import popover from '@/helpers/popover';
|
||||||
interface Highlight {
|
interface Highlight {
|
||||||
contentBlock: string; // the id
|
contentBlock: string; // the id
|
||||||
contentIndex: number; // which content of the .contents array do I come from?
|
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?
|
paragraphIndex: number; // which paragraph inside the textBlock do I come from?
|
||||||
startPosition: number; // start of the selection
|
startPosition: number; // start of the selection
|
||||||
selectionLength: number; // length of the selection
|
selectionLength: number; // length of the selection
|
||||||
|
|
@ -115,17 +116,11 @@ export const getSelectionHandler = (el: HTMLElement, contentBlock: ContentBlockN
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
const { start, end } = range.toCharacterRange(paragraph);
|
const { start, end } = range.toCharacterRange(paragraph);
|
||||||
// console.log(contentBlock.id);
|
const uuid = contentComponent.dataset.uuid || '';
|
||||||
// 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 highlightedText: Highlight = {
|
const highlightedText: Highlight = {
|
||||||
contentBlock: contentBlock.id,
|
contentBlock: contentBlock.id,
|
||||||
contentIndex: position,
|
contentIndex: position,
|
||||||
|
contentUUID: uuid,
|
||||||
startPosition: start,
|
startPosition: start,
|
||||||
paragraphIndex: positionInTextBlock,
|
paragraphIndex: positionInTextBlock,
|
||||||
selectionLength: end - start,
|
selectionLength: end - start,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue