Add version logging, Markdown card menu item, and oembed card types
- sx-editor prints version on init: [sx-editor] v2026-03-02b-exorcism - Add Markdown to card insert menu with /markdown and /md slash commands - Add YouTube, X/Twitter, Vimeo, Spotify, CodePen as dedicated embed menu items with brand icons (all create ~kg-embed cards) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,14 +40,20 @@
|
||||
]},
|
||||
{ section: "Text", items: [
|
||||
{ type: "html", icon: "fa-solid fa-code", label: "HTML", desc: "Insert raw HTML", slash: ["html"] },
|
||||
{ type: "markdown", icon: "fa-brands fa-markdown", label: "Markdown",desc: "Insert markdown content", slash: ["markdown", "md"] },
|
||||
{ type: "hr", icon: "fa-solid fa-minus", label: "Divider", desc: "Insert a dividing line", slash: ["divider", "hr"] },
|
||||
{ type: "callout", icon: "fa-regular fa-comment-dots",label: "Callout", desc: "Info box that stands out", slash: ["callout"] },
|
||||
{ type: "toggle", icon: "fa-solid fa-caret-down", label: "Toggle", desc: "Collapsible content", slash: ["toggle"] },
|
||||
{ type: "code", icon: "fa-solid fa-terminal", label: "Code", desc: "Insert a code block", slash: ["code", "codeblock"] },
|
||||
]},
|
||||
{ section: "Embed", items: [
|
||||
{ type: "youtube", icon: "fa-brands fa-youtube", label: "YouTube", desc: "Embed a YouTube video", slash: ["youtube", "yt"] },
|
||||
{ type: "twitter", icon: "fa-brands fa-x-twitter", label: "X (Twitter)", desc: "Embed a tweet", slash: ["twitter", "tweet", "x"] },
|
||||
{ type: "vimeo", icon: "fa-brands fa-vimeo-v", label: "Vimeo", desc: "Embed a Vimeo video", slash: ["vimeo"] },
|
||||
{ type: "spotify", icon: "fa-brands fa-spotify", label: "Spotify", desc: "Embed a Spotify track or playlist", slash: ["spotify"] },
|
||||
{ type: "codepen", icon: "fa-brands fa-codepen", label: "CodePen", desc: "Embed a CodePen", slash: ["codepen"] },
|
||||
{ type: "bookmark", icon: "fa-solid fa-bookmark", label: "Bookmark",desc: "Embed a link as a visual bookmark", slash: ["bookmark"] },
|
||||
{ type: "embed", icon: "fa-solid fa-link", label: "Other...",desc: "Embed a URL via oEmbed", slash: ["embed", "youtube", "vimeo", "twitter", "spotify", "codepen"] },
|
||||
{ type: "embed", icon: "fa-solid fa-link", label: "Other...",desc: "Embed any URL via oEmbed", slash: ["embed", "oembed"] },
|
||||
{ type: "button", icon: "fa-solid fa-square", label: "Button", desc: "Add a button", slash: ["button", "cta"] },
|
||||
]},
|
||||
];
|
||||
@@ -1790,6 +1796,11 @@
|
||||
insertBlockNode(editor, block, refBlock);
|
||||
block.querySelector(".sx-card-preview").click();
|
||||
return;
|
||||
} else if (type === "markdown") {
|
||||
block = createCardBlock("kg-md", { _childrenSx: '""' });
|
||||
insertBlockNode(editor, block, refBlock);
|
||||
block.querySelector(".sx-card-preview").click();
|
||||
return;
|
||||
} else if (type === "button") {
|
||||
block = createCardBlock("kg-button", { url: "", text: "Click here", alignment: "center" });
|
||||
insertBlockNode(editor, block, refBlock);
|
||||
@@ -1800,7 +1811,8 @@
|
||||
insertBlockNode(editor, block, refBlock);
|
||||
block.querySelector(".sx-card-preview").click();
|
||||
return;
|
||||
} else if (type === "embed") {
|
||||
} else if (type === "embed" || type === "youtube" || type === "vimeo" ||
|
||||
type === "twitter" || type === "spotify" || type === "codepen") {
|
||||
block = createCardBlock("kg-embed", {});
|
||||
insertBlockNode(editor, block, refBlock);
|
||||
block.querySelector(".sx-card-preview").click();
|
||||
@@ -2453,11 +2465,16 @@
|
||||
// Export
|
||||
// =========================================================================
|
||||
|
||||
var VERSION = "2026-03-02b-exorcism";
|
||||
|
||||
window.SxEditor = {
|
||||
VERSION: VERSION,
|
||||
mount: mount,
|
||||
_serializeBlocks: serializeBlocks,
|
||||
_serializeInline: serializeInline,
|
||||
_deserializeSx: deserializeSx
|
||||
};
|
||||
|
||||
console.log("[sx-editor] v" + VERSION + " init");
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user