Skip to content

Commit 068e537

Browse files
committed
Dropped 'scope' from the core interface
1 parent 3a8f51b commit 068e537

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/text-annotator/src/model/core/TextAnnotation.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,4 @@ export interface TextSelector {
2626

2727
offsetReference?: HTMLElement;
2828

29-
scope?: string;
30-
3129
}

packages/text-annotator/src/model/w3c/W3CTextFormatAdapter.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
serializeW3CBodies
88
} from '@annotorious/core';
99
import type { TextAnnotation, TextAnnotationTarget, TextSelector } from '../core';
10-
import type { W3CTextAnnotation, W3CTextSelector } from '../w3c';
10+
import type { W3CTextAnnotation, W3CTextAnnotationTarget, W3CTextSelector } from '../w3c';
1111
import { getQuoteContext } from '../../utils';
1212

1313
export type W3CTextFormatAdapter = FormatAdapter<TextAnnotation, W3CTextAnnotation>;
@@ -67,6 +67,7 @@ const parseW3CTextTargets = (annotation: W3CTextAnnotation) => {
6767
parsed.selector.push({
6868
...selector,
6969
id: w3cTarget.id,
70+
// @ts-ignore
7071
scope: w3cTarget.scope
7172
});
7273
} else {
@@ -127,7 +128,7 @@ export const serializeW3CTextAnnotation = (
127128
} = target;
128129

129130
const w3cTargets = selector.map((s) => {
130-
const { id, scope, quote, start, end, range } = s;
131+
const { id, quote, start, end, range } = s;
131132

132133
const { prefix, suffix } = getQuoteContext(range, container);
133134

@@ -145,10 +146,10 @@ export const serializeW3CTextAnnotation = (
145146
return {
146147
...targetRest,
147148
id,
148-
scope,
149+
scope: 'scope' in s ? s.scope : undefined,
149150
source,
150151
selector: w3cSelectors
151-
};
152+
} as W3CTextAnnotationTarget;
152153
});
153154

154155

0 commit comments

Comments
 (0)