mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-06-22 04:58:40 +00:00
format
This commit is contained in:
@@ -51,9 +51,9 @@ function getUrl(node, doc) {
|
|||||||
|
|
||||||
const cursor = node.node.cursor();
|
const cursor = node.node.cursor();
|
||||||
|
|
||||||
if (cursor.firstChild()) {
|
if(cursor.firstChild()) {
|
||||||
do {
|
do {
|
||||||
if (cursor.name === "URL") {
|
if(cursor.name === 'URL') {
|
||||||
url = doc.sliceString(cursor.from, cursor.to);
|
url = doc.sliceString(cursor.from, cursor.to);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -92,24 +92,24 @@ const createHighlightPlugin = (renderer, tab)=>{
|
|||||||
let snippetCount = 0;
|
let snippetCount = 0;
|
||||||
|
|
||||||
const tree = syntaxTree(view.state);
|
const tree = syntaxTree(view.state);
|
||||||
tree.iterate({
|
tree.iterate({
|
||||||
enter: (node) => {
|
enter : (node)=>{
|
||||||
if (node.name === "Image") {
|
if(node.name === 'Image') {
|
||||||
const url = getUrl(node, view.state.doc);
|
const url = getUrl(node, view.state.doc);
|
||||||
|
|
||||||
if (!url) return;
|
if(!url) return;
|
||||||
|
|
||||||
decos.push(
|
decos.push(
|
||||||
Decoration.mark({
|
Decoration.mark({
|
||||||
class: "cm-image",
|
class : 'cm-image',
|
||||||
attributes: {
|
attributes : {
|
||||||
"style": `--preview-img:url(${url});`
|
'style' : `--preview-img:url(${url});`
|
||||||
|
}
|
||||||
|
}).range(node.from, node.to)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).range(node.from, node.to)
|
});
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
tokens.forEach((tok)=>{
|
tokens.forEach((tok)=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user