mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-06-22 04:58:40 +00:00
change tok for token
This commit is contained in:
@@ -119,22 +119,22 @@ const createHighlightPlugin = (renderer, tab)=>{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tokens.forEach((tok)=>{
|
tokens.forEach((token)=>{
|
||||||
const line = view.state.doc.line(tok.line + 1);
|
const line = view.state.doc.line(token.line + 1);
|
||||||
|
|
||||||
if(tok.from != null && tok.to != null && tok.from < tok.to) {
|
if(token.from != null && token.to != null && token.from < token.to) {
|
||||||
const from = line.from + tok.from;
|
const from = line.from + token.from;
|
||||||
const to = line.from + tok.to;
|
const to = line.from + token.to;
|
||||||
|
|
||||||
const attrs = {};
|
const attrs = {};
|
||||||
if(tok.type === 'Image' && tok.url) {
|
if(token.type === 'Image' && token.url) {
|
||||||
|
|
||||||
attrs['data-url'] = tok.url;
|
attrs['data-url'] = token.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
decos.push(
|
decos.push(
|
||||||
Decoration.mark({
|
Decoration.mark({
|
||||||
class : `cm-${tok.type}`,
|
class : `cm-${token.type}`,
|
||||||
...(Object.keys(attrs).length
|
...(Object.keys(attrs).length
|
||||||
? { attributes: attrs }
|
? { attributes: attrs }
|
||||||
: {})
|
: {})
|
||||||
@@ -143,15 +143,15 @@ const createHighlightPlugin = (renderer, tab)=>{
|
|||||||
} else {
|
} else {
|
||||||
decos.push(
|
decos.push(
|
||||||
Decoration.line({
|
Decoration.line({
|
||||||
class : `cm-${tok.type}`
|
class : `cm-${token.type}`
|
||||||
}).range(line.from)
|
}).range(line.from)
|
||||||
);
|
);
|
||||||
if(tok.type === 'pageLine' && tab === 'brewText') {
|
if(token.type === 'pageLine' && tab === 'brewText') {
|
||||||
pageCount++;
|
pageCount++;
|
||||||
if(line.from === 0) pageCount--;
|
if(line.from === 0) pageCount--;
|
||||||
decos.push(Decoration.line({ attributes: { 'data-page-number': pageCount } }).range(line.from));
|
decos.push(Decoration.line({ attributes: { 'data-page-number': pageCount } }).range(line.from));
|
||||||
}
|
}
|
||||||
if(tok.type === 'snippetLine' && tab === 'brewSnippets') {
|
if(token.type === 'snippetLine' && tab === 'brewSnippets') {
|
||||||
snippetCount++;
|
snippetCount++;
|
||||||
decos.push(Decoration.line({ attributes: { 'data-page-number': snippetCount } }).range(line.from));
|
decos.push(Decoration.line({ attributes: { 'data-page-number': snippetCount } }).range(line.from));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user