Tweaking... WIP

pull/119/head
Zef Hemel 2022-11-12 17:28:35 +01:00
parent ad596d4a65
commit d8859cb10b
6 changed files with 15 additions and 10 deletions

View File

@ -1,6 +1,7 @@
import { Tag } from "./deps.ts"; import { Tag } from "./deps.ts";
export const CommandLinkTag = Tag.define(); export const CommandLinkTag = Tag.define();
export const CommandLinkNameTag = Tag.define();
export const WikiLinkTag = Tag.define(); export const WikiLinkTag = Tag.define();
export const WikiLinkPageTag = Tag.define(); export const WikiLinkPageTag = Tag.define();
export const CodeInfoTag = Tag.define(); export const CodeInfoTag = Tag.define();

View File

@ -56,11 +56,8 @@ const commandLinkRegex = /^\{\[([^\]]+)\]\}/;
const CommandLink: MarkdownConfig = { const CommandLink: MarkdownConfig = {
defineNodes: [ defineNodes: [
{ { name: "CommandLink", style: { "CommandLink/...": ct.CommandLinkTag } },
name: "CommandLink", { name: "CommandLinkName", style: ct.CommandLinkNameTag },
style: { "CommandLink/...": ct.CommandLinkTag },
},
"CommandLinkName",
{ {
name: "CommandLinkMark", name: "CommandLinkMark",
style: t.processingInstruction, style: t.processingInstruction,
@ -225,6 +222,8 @@ export default function buildMarkdown(mdExtensions: MDExt[]): Language {
styleTags({ styleTags({
WikiLink: ct.WikiLinkTag, WikiLink: ct.WikiLinkTag,
WikiLinkPage: ct.WikiLinkPageTag, WikiLinkPage: ct.WikiLinkPageTag,
// CommandLink: ct.CommandLinkTag,
// CommandLinkName: ct.CommandLinkNameTag,
Task: ct.TaskTag, Task: ct.TaskTag,
TaskMarker: ct.TaskMarkerTag, TaskMarker: ct.TaskMarkerTag,
Comment: ct.CommentTag, Comment: ct.CommentTag,

View File

@ -47,9 +47,7 @@ async function actionClickOrActionEnter(
break; break;
} }
case "CommandLink": { case "CommandLink": {
const command = mdTree const command = mdTree.children![1].text!;
.children![0].text!.substring(2, mdTree.children![0].text!.length - 2)
.trim();
console.log("Got command link", command); console.log("Got command link", command);
await system.invokeCommand(command); await system.invokeCommand(command);
break; break;

View File

@ -257,11 +257,13 @@ class HideHeaderMarkPlugin {
const cursorOverlaps = ranges.some(({ from, to }) => const cursorOverlaps = ranges.some(({ from, to }) =>
checkRangeOverlap([from, to], [line.from, line.to]) checkRangeOverlap([from, to], [line.from, line.to])
); );
if (cursorOverlaps) { if (cursorOverlaps && type.name === "HeaderMark") {
widgets.push( widgets.push(
Decoration.line({ class: "sb-header-inside" }).range(from), Decoration.line({ class: "sb-header-inside" }).range(from),
); );
return; return;
} else if (cursorOverlaps) {
return;
} }
if ( if (
type.name === "HeaderMark" && type.name === "HeaderMark" &&

View File

@ -17,6 +17,7 @@ export default function highlightStyles(mdExtension: MDExt[]) {
{ tag: ct.WikiLinkTag, class: "sb-wiki-link" }, { tag: ct.WikiLinkTag, class: "sb-wiki-link" },
{ tag: ct.WikiLinkPageTag, class: "sb-wiki-link-page" }, { tag: ct.WikiLinkPageTag, class: "sb-wiki-link-page" },
{ tag: ct.CommandLinkTag, class: "sb-command-link" }, { tag: ct.CommandLinkTag, class: "sb-command-link" },
{ tag: ct.CommandLinkNameTag, class: "sb-command-link-name" },
{ tag: ct.TaskTag, class: "sb-task" }, { tag: ct.TaskTag, class: "sb-task" },
{ tag: ct.TaskMarkerTag, class: "sb-task-marker" }, { tag: ct.TaskMarkerTag, class: "sb-task-marker" },
{ tag: ct.CodeInfoTag, class: "sb-code-info" }, { tag: ct.CodeInfoTag, class: "sb-code-info" },

View File

@ -187,7 +187,11 @@
color: #959595; color: #959595;
} }
.sb-command-link { .sb-command-link.sb-meta {
color: #959595;
}
.sb-command-link-name {
background-color: #e3dfdf; background-color: #e3dfdf;
cursor: pointer; cursor: pointer;
border-top: 1px solid silver; border-top: 1px solid silver;