|
@@ -31,11 +31,6 @@ interface ParsedToken {
|
|
|
type: string
|
|
type: string
|
|
|
decorationRanges: DecorationRange[]
|
|
decorationRanges: DecorationRange[]
|
|
|
wrapperAttrs?: Record<string, string>
|
|
wrapperAttrs?: Record<string, string>
|
|
|
- wrapperAttrs?: Record<string, string>
|
|
|
|
|
- pageName?: string
|
|
|
|
|
- blockId?: string
|
|
|
|
|
- tag?: string
|
|
|
|
|
- alias?: string
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -109,7 +104,7 @@ function buildDecorationsFromCache(
|
|
|
_cursorTo: number,
|
|
_cursorTo: number,
|
|
|
markerMode: MarkerVisibilityMode,
|
|
markerMode: MarkerVisibilityMode,
|
|
|
): DecorationSet {
|
|
): DecorationSet {
|
|
|
- const decorationSpecs: DecorationSpec[] = []
|
|
|
|
|
|
|
+ const decorationSpecs: Decoration[] = []
|
|
|
|
|
|
|
|
doc.descendants((node: ProsemirrorNode, pos: number) => {
|
|
doc.descendants((node: ProsemirrorNode, pos: number) => {
|
|
|
if (!node.isTextblock) return
|
|
if (!node.isTextblock) return
|
|
@@ -172,7 +167,7 @@ function buildDecorationsFromCache(
|
|
|
function buildTokenDecorations(
|
|
function buildTokenDecorations(
|
|
|
token: ParsedToken,
|
|
token: ParsedToken,
|
|
|
offset: number,
|
|
offset: number,
|
|
|
- decorationSpecs: DecorationSpec[],
|
|
|
|
|
|
|
+ decorationSpecs: Decoration[],
|
|
|
isFocused: boolean,
|
|
isFocused: boolean,
|
|
|
_cursorFrom: number,
|
|
_cursorFrom: number,
|
|
|
_cursorTo: number,
|
|
_cursorTo: number,
|
|
@@ -183,16 +178,6 @@ function buildTokenDecorations(
|
|
|
|
|
|
|
|
const sorted = [...ranges].sort((a, b) => a.from - b.from)
|
|
const sorted = [...ranges].sort((a, b) => a.from - b.from)
|
|
|
|
|
|
|
|
- if (import.meta.env?.DEV) {
|
|
|
|
|
- for (let i = 1; i < sorted.length; i++) {
|
|
|
|
|
- if (sorted[i].from < sorted[i - 1].to) {
|
|
|
|
|
- console.warn(
|
|
|
|
|
- `[markdown-decorations] Overlapping ranges in token "${token.type}": [${sorted[i - 1].from}-${sorted[i - 1].to}] and [${sorted[i].from}-${sorted[i].to}]`,
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
for (const range of sorted) {
|
|
for (const range of sorted) {
|
|
|
const rangeFrom = offset + range.from
|
|
const rangeFrom = offset + range.from
|
|
|
const rangeTo = offset + range.to
|
|
const rangeTo = offset + range.to
|
|
@@ -240,7 +225,7 @@ function buildPropertyDecorations(
|
|
|
value?: string
|
|
value?: string
|
|
|
}>,
|
|
}>,
|
|
|
childOffset: number,
|
|
childOffset: number,
|
|
|
- decorationSpecs: DecorationSpec[],
|
|
|
|
|
|
|
+ decorationSpecs: Decoration[],
|
|
|
_isFocused: boolean,
|
|
_isFocused: boolean,
|
|
|
_cursorFrom: number,
|
|
_cursorFrom: number,
|
|
|
_cursorTo: number,
|
|
_cursorTo: number,
|