From da497885047febc0d6ee407de3fa7e9280b5f939 Mon Sep 17 00:00:00 2001 From: mirivlad Date: Fri, 19 Jun 2026 16:41:46 +0800 Subject: [PATCH] feat: add default-editor + files plugins, bundle execution check, fix platform-test diagnostic priority --- plugins/default-editor/frontend/index.html | 22 + plugins/default-editor/frontend/src/index.js | 440 +++++++++++++++++++ plugins/default-editor/plugin.json | 69 +++ plugins/files/frontend/src/index.js | 281 ++++++++++++ plugins/files/plugin.json | 36 ++ plugins/platform-test/plugin.json | 8 +- scripts/check.sh | 51 +++ 7 files changed, 900 insertions(+), 7 deletions(-) create mode 100644 plugins/default-editor/frontend/index.html create mode 100644 plugins/default-editor/frontend/src/index.js create mode 100644 plugins/default-editor/plugin.json create mode 100644 plugins/files/frontend/src/index.js create mode 100644 plugins/files/plugin.json diff --git a/plugins/default-editor/frontend/index.html b/plugins/default-editor/frontend/index.html new file mode 100644 index 0000000..1c19aeb --- /dev/null +++ b/plugins/default-editor/frontend/index.html @@ -0,0 +1,22 @@ + + + + + + Default Editor + + + +
+ + + diff --git a/plugins/default-editor/frontend/src/index.js b/plugins/default-editor/frontend/src/index.js new file mode 100644 index 0000000..91adefb --- /dev/null +++ b/plugins/default-editor/frontend/src/index.js @@ -0,0 +1,440 @@ +/* =========================================================== + Default Editor Plugin — Verstak v2 Frontend Bundle + Contract: window.VerstakPluginRegister(id, { components }) + =========================================================== */ + +(function () { + 'use strict'; + + /* ── Style injection ─────────────────────────────────────── */ + function injectStyles() { + if (document.getElementById('de-style-injected')) return; + var style = document.createElement('style'); + style.id = 'de-style-injected'; + style.textContent = STYLES; + document.head.appendChild(style); + } + + var STYLES = [ + '.de-root { display:flex; flex-direction:column; height:100%; min-height:0; overflow:hidden; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif; color:#e0e0e0; }', + '.de-toolbar { display:flex; align-items:center; gap:0.5rem; padding:0.5rem 0.75rem; border-bottom:1px solid #16213e; flex-shrink:0; background:#12122a; }', + '.de-toolbar-mode { font-size:0.75rem; color:#4ecca3; padding:0.15rem 0.5rem; border-radius:3px; background:#1a2a3a; }', + '.de-toolbar-context { font-size:0.7rem; color:#8b8ba8; margin-left:0.25rem; }', + '.de-toolbar-spacer { flex:1; }', + '.de-toolbar-btn { font-size:0.75rem; padding:0.25rem 0.6rem; border:1px solid #333; border-radius:4px; background:#1a1a2e; color:#ccc; cursor:pointer; }', + '.de-toolbar-btn:hover { background:#2a2a4e; border-color:#4ecca3; }', + '.de-toolbar-btn.active { background:#1a3a2a; border-color:#4ecca3; color:#4ecca3; }', + '.de-toolbar-btn:disabled { opacity:0.4; cursor:default; }', + '.de-status { font-size:0.7rem; color:#8b8ba8; padding:0.15rem 0.5rem; }', + '.de-status.saved { color:#4ecca3; }', + '.de-status.error { color:#e74c3c; }', + '.de-status.dirty { color:#f39c12; }', + '.de-editor-wrap { flex:1; display:flex; min-height:0; overflow:hidden; }', + '.de-textarea { flex:1; width:100%; height:100%; resize:none; border:none; outline:none; padding:0.75rem; font-family:"SF Mono","Fira Code","Cascadia Code",monospace; font-size:0.85rem; line-height:1.6; background:#0d0d1a; color:#e0e0e0; tab-size:2; }', + '.de-textarea:focus { outline:none; }', + '.de-preview { flex:1; height:100%; padding:0.75rem 1rem; overflow-y:auto; background:#0d0d1a; line-height:1.7; font-size:0.9rem; }', + '.de-preview h1,.de-preview h2,.de-preview h3,.de-preview h4,.de-preview h5,.de-preview h6 { color:#e0e0f0; margin:1rem 0 0.5rem; }', + '.de-preview h1 { font-size:1.5rem; border-bottom:1px solid #16213e; padding-bottom:0.3rem; }', + '.de-preview h2 { font-size:1.25rem; border-bottom:1px solid #16213e; padding-bottom:0.25rem; }', + '.de-preview h3 { font-size:1.1rem; }', + '.de-preview p { margin:0.5rem 0; }', + '.de-preview code { background:#1a1a2e; padding:0.15rem 0.35rem; border-radius:3px; font-size:0.85em; color:#4ecca3; }', + '.de-preview pre { background:#1a1a2e; padding:0.75rem; border-radius:4px; overflow-x:auto; margin:0.75rem 0; }', + '.de-preview pre code { background:none; padding:0; }', + '.de-preview ul,.de-preview ol { padding-left:1.5rem; margin:0.5rem 0; }', + '.de-preview li { margin:0.25rem 0; }', + '.de-preview blockquote { border-left:3px solid #4ecca3; margin:0.5rem 0; padding:0.25rem 0.75rem; color:#aaa; }', + '.de-preview a { color:#4ecca3; text-decoration:none; }', + '.de-preview a:hover { text-decoration:underline; }', + '.de-preview hr { border:none; border-top:1px solid #16213e; margin:1rem 0; }', + '.de-preview table { border-collapse:collapse; margin:0.75rem 0; }', + '.de-preview th,.de-preview td { border:1px solid #333; padding:0.35rem 0.6rem; text-align:left; }', + '.de-preview th { background:#1a1a2e; }', + '.de-notes-badge { font-size:0.65rem; padding:0.1rem 0.4rem; border-radius:3px; background:#2a1a3a; color:#b388ff; margin-left:0.5rem; }', + '.de-notes-info { padding:0.5rem 0.75rem; background:#1a1a2a; border-top:1px solid #16213e; font-size:0.75rem; color:#8b8ba8; flex-shrink:0; }', + '.de-loading { flex:1; display:flex; align-items:center; justify-content:center; color:#666; }', + '.de-error { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; color:#e74c3c; gap:0.5rem; }', + '.de-error-msg { font-size:0.85rem; color:#aaa; max-width:400px; text-align:center; }', + ].join('\n'); + + /* ── Simple markdown renderer (no raw HTML) ──────────────── */ + function renderMarkdown(text) { + if (!text) return ''; + var html = text + .replace(/&/g, '&') + .replace(//g, '>'); + + // Code blocks (``` ... ```) + html = html.replace(/```(\w*)\n([\s\S]*?)```/g, function (_, lang, code) { + return '
' + code.trimEnd() + '
'; + }); + + // Inline code + html = html.replace(/`([^`\n]+)`/g, '$1'); + + // Headings + html = html.replace(/^######\s+(.+)$/gm, '
$1
'); + html = html.replace(/^#####\s+(.+)$/gm, '
$1
'); + html = html.replace(/^####\s+(.+)$/gm, '

$1

'); + html = html.replace(/^###\s+(.+)$/gm, '

$1

'); + html = html.replace(/^##\s+(.+)$/gm, '

$1

'); + html = html.replace(/^#\s+(.+)$/gm, '

$1

'); + + // Horizontal rule + html = html.replace(/^---+$/gm, '
'); + html = html.replace(/^\*\*\*+$/gm, '
'); + + // Bold and italic + html = html.replace(/\*\*\*(.+?)\*\*\*/g, '$1'); + html = html.replace(/\*\*(.+?)\*\*/g, '$1'); + html = html.replace(/\*(.+?)\*/g, '$1'); + + // Strikethrough + html = html.replace(/~~(.+?)~~/g, '$1'); + + // Blockquote + html = html.replace(/^>\s+(.+)$/gm, '
$1
'); + + // Unordered list items + html = html.replace(/^[\-\*]\s+(.+)$/gm, '
  • $1
  • '); + + // Ordered list items + html = html.replace(/^\d+\.\s+(.+)$/gm, '
  • $1
  • '); + + // Wrap consecutive
  • in