Commit Graph
35 Commits
Author SHA1 Message Date
thzxx 4e63870180 release: v0.1.12 — accessibility, Zen mode, scroll sync v2, shortcutHelp plugin
feat(a11y): toolbar keyboard navigation (Arrow keys, Home, End)
feat(a11y): aria-live region for screen reader announcements on mode change
feat(a11y): enhance focus-visible style (outline-offset: 2px, hide on mouse focus)

feat(core): Zen mode (editor.toggleZen() / exec('zen'))
- Toggle with Ctrl+Shift+Z shortcut concept
- Auto-hide toolbar and statusbar, mouse to top edge reveals toolbar
- Centered editor pane with max-width constraint

feat(core): heading-aware scroll sync v2
- Sync preview scroll to nearest heading before cursor position
- Falls back to proportional sync when no headings found

feat(core): Word wrap toggle (editor.toggleWordWrap() / setWordWrap(bool))

feat(plugins): shortcutHelp preset plugin
- Press '?' to open keyboard shortcuts overlay panel
- Lists built-in + user-registered shortcuts
- Click overlay or press Escape to close

style: Zen mode CSS, sr-only class, focus-visible refinement

test: 3 new tests for Zen mode, WordWrap, shortcutHelp (535 total)

chore: bump version 0.1.11 → 0.1.12 across all files
2026-07-24 16:10:51 +08:00
thzxx faa329682c release: v0.1.11 — quality & stability improvements
fix(core): clear _outlineTimer in destroy() to prevent post-destroy callbacks
fix(core): remove '<' from BRACKET_PAIRS to avoid HTML tag conflicts
fix(core): setValue now updates outline panel and resets gutter scroll
fix(core): getValue returns '' on destroyed instances (safe API access)
opt(core): _renderGutter skips rebuild when line count unchanged
chore: bump version 0.1.10 → 0.1.11 across all files
2026-07-24 15:59:07 +08:00
thzxx a570dac75a release: v0.1.10 2026-07-24 13:16:02 +08:00
thzxx 863c78bf47 fix(types): add missing TypeScript declarations for v0.1.5-v0.1.7 APIs
- MarkdownEditorOptions: add lineNumbers, outline, autoBrackets
- PluginObject: add version, depends, priority
- EditorEventName: add themeChange, localeChange
- MarkdownEditor: add unuse, registerShortcut, configureToolbar, toast, setLocale, getLocale, t
- pluginUtils: add topologicalSort, validateConfig
- i18nUtils: add full API surface (loadRemote, formatNumber, etc.)
- Top-level exports: topologicalSort, validateConfig, createInstanceI18n, loadRemote, exportCSSVars, etc.
- MeEditorAPI: add all missing properties
2026-07-24 13:14:08 +08:00
thzxx 6c0c5f0c81 fix(core): readonly mode should not disable all toolbar buttons
- CSS: replace pointer-events:none on entire toolbar with per-button disabled style
- _updateModeButtons: add readonly mode handling, keep mode-switch/fullscreen/undo/redo enabled
- setReadOnly: call _updateModeButtons to sync button states
2026-07-24 13:08:10 +08:00
thzxx 485f49c1f1 feat(site): add back-to-home button on demo.html 2026-07-24 11:34:08 +08:00
thzxx 225dfe0571 chore: fix README badge to 0.1.9 2026-07-24 11:29:39 +08:00
thzxx 734a423b9d release: v0.1.9 2026-07-24 11:27:47 +08:00
thzxx a44abea401 fix: stability improvements — initialize _outlineTimer, extract INLINE_RE constant
- core.js: initialize this._outlineTimer = null in constructor (fixes clearTimeout(undefined))
- parser.js: extract INLINE_RE to module-level constant (avoid recompilation on every scanInline call)
2026-07-24 11:26:10 +08:00
thzxx 5d9b934a2d fix(core): fix gutter scroll desync with textarea content
- Match gutter font-size to textarea (13.5px) so line heights align
- Always sync gutter scrollTop regardless of mode
- Sync gutter scroll position after undo/redo history apply
2026-07-24 11:20:47 +08:00
thzxx a70bfbf0cd feat(site): add emoji favicon to demo, docs, index pages
- demo.html: 📝
- docs.html: 📖
- index.html: 🚀
2026-07-24 10:55:08 +08:00
thzxx 4fd79b9890 chore: sync all version tags to 0.1.8 2026-07-24 10:51:33 +08:00
thzxx a3385f288d chore: bump to 0.1.8 for republish after npm unpublish 2026-07-24 10:48:28 +08:00
thzxx f4921c9447 fix(core): disable toolbar action buttons in preview mode
- _updateModeButtons now disables edit-action buttons in preview mode
- Mode-switch buttons (edit/split/preview/fullscreen) and undo/redo remain active
- CSS: .me-btn:disabled with opacity 0.35, cursor not-allowed, pointer-events none
- Constructor calls _updateModeButtons on init for correct initial state
2026-07-24 10:46:45 +08:00
thzxx a7a66e113f feat(site): complete demo.html redesign with all features enabled
- Modern glassmorphism design with gradient header
- Full control bar: theme/locale/mode/line numbers/outline toggle
- All 4 preset plugins active: autoSave, exportTool, searchReplace, imagePaste
- Rich demo content showcasing all v0.1.7 syntax features
- Toast notification demo button
- Custom shortcut (Ctrl+Shift+T) demo
- Responsive layout with info cards grid
- Light/dark theme CSS variable integration
2026-07-24 10:36:55 +08:00
thzxx 289b8e55a6 release: v0.1.7 — editing experience: gutter, auto-format, bracket close, drag-drop, outline
feat(core): line number gutter with current line highlight
- .me-gutter rendered alongside textarea, sync-scrolls with content
- .me-gutter-active highlights the line containing the cursor
- config.lineNumbers (default true) to toggle

feat(core): smart Enter auto-formatting
- List continuation: '- ' / '1. ' auto-insert on Enter at end of list item
- Ordered list auto-increment: '1.' → '2.'
- Quote continuation: '> ' auto-insert on Enter at end of quote line
- Empty list/quote item: Enter removes the marker (end list)

feat(core): bracket/quote auto-close
- (), [], {}, <>, "", '', ``, **, __ auto-close pairs
- Selection wrapping: select text then press ( → wraps as (text)
- config.autoBrackets (default true) to toggle

feat(core): drag & drop file support
- Drop image files → auto base64 inline insert ![](data:...)
- Drop text/code files → insert file contents
- Drop external text from browser → insert at cursor

feat(core): outline/TOC panel
- Extracts headings from rendered HTML preview
- Nested tree with indentation by heading level
- Click to scroll-jump in both preview and textarea
- config.outline (default false) to toggle

style: gutter, outline panel, current line highlight CSS

test: 11 new tests for gutter, auto-format, bracket close, outline (532 total)

chore: bump version 0.1.6 → 0.1.7 across all files, site, types
2026-07-24 10:33:12 +08:00
thzxx 45ed8d5351 release: v0.1.6 — plugin v2, i18n instance isolation, shortcuts, toolbar, toast
feat(plugins): plugin system v2
- depends: declarative plugin dependencies with topological sort (Kahn algorithm)
- async plugins: install() returning Promise auto-await
- editor.unuse(name): uninstall individual plugins
- pluginUtils.validateConfig(schema, config): configuration validation
- plugin priority field controls install order within same dependency level

feat(i18n): instance-level locale isolation, pluralization, dynamic loading
- createInstanceI18n(): per-editor independent locale contexts
- editor.setLocale()/getLocale()/t() instance methods
- Plural rules: t('items', { count: 5 }) auto-selects one/other/few/many
- i18nUtils.loadRemote(url, locale): fetch translation packs from remote
- editor.on('localeChange') event

feat(core): toolbar & shortcut customization, context menu, toast
- editor.registerShortcut(combo, handler): custom keyboard shortcuts
- editor.configureToolbar(tools): dynamic toolbar rebuild
- editor.removeToolbarButton(action): remove single button
- editor.registerContextMenu(items): right-click context menu
- editor.toast(msg, {type, duration, animation}): toast notifications

style: toast notifications, context menu, dropdown CSS
- .me-toast with success/error/warning/info types, fade/slide animations
- .me-context-menu with items, separators, shortcut hints

test: 22 new tests covering plugin deps, unuse, shortcuts, toast, i18n plural (521 total)

chore: bump version 0.1.5 → 0.1.6 across all files, site, types
2026-07-24 10:17:57 +08:00
thzxx d41da3c204 docs(site): update site pages for v0.1.5 theme features
- Update version references to 0.1.5 across demo/docs/index
- Add instance-level theme APIs to docs.html
- Add external theme following, theme inheritance docs
- Update index.html feature description
2026-07-24 09:57:11 +08:00
thzxx 517dc34435 release: v0.1.5 — theme system usability, extensibility, external theme following
feat(themes): comprehensive theme system enhancement
- Fix resolveTheme('auto') always resolves to system theme (no stale override)
- Add per-instance theme isolation via createInstanceTheme()
- Add MarkdownEditor.setTheme()/getTheme()/getThemeContext() instance methods
- Add 'themeChange' instance event with { theme, resolved, config } payload
- Multi-instance independent themes (no cross-contamination)

feat(themes): external theme following (v0.1.5)
- followExternalTheme() — follow theme via data attr, CSS class, or callback
- adoptFromParent() — inherit theme from parent container
- watch() — watch external theme source (function or selector)

feat(themes): extensibility (v0.1.5)
- registerTheme() supports 'extends' option for theme inheritance
- exportCSSVars() — export all CSS variable values from element
- getCSSVariable() — query single CSS variable
- applyThemeToElement() — apply theme to any DOM element

chore: bump version 0.1.4 → 0.1.5 across all files
test(themes): 30 new tests covering all v0.1.5 theme APIs (499 total)
2026-07-24 09:53:20 +08:00
thzxx f8b9f4a761 release: v0.1.4 — parser enhancement, new syntax, performance optimization
feat(parser): comprehensive Markdown parser enhancement
- Add nested list support (multi-level unordered/ordered, mixed nesting)
- Add Setext headings (=== / ---)
- Add indented code blocks (4-space indent)
- Add HTML comment passthrough (<!-- -->)
- Add entity reference protection (&amp; &#169;)
- Add ordered list start attribute
- Add link title single-quote support
- Add LaTeX math formulas ($inline$ / $$block$$)
- Add footnote support ([^1] ref + [^1]: definition)
- Add definition lists (term\n: definition)
- Extend emoji map from 85 to 150+ common emojis
- Fix backtick code block matching (CommonMark spec)
- Fix italic regex character truncation (lookbehind assertions)
- Fix superscript/subscript/strikethrough ambiguity
- Fix blockquote prefix handling (>text without space)
- Enhance safeUrl filtering (additional protocol checks)
- Enhance slugify (Unicode NFKC normalization)

perf(parser): single-pass inline scanning, render cache, pre-compiled regex
- Replace 14-step chained regex with unified single-pass scanInline()
- Add cachedRenderInline() with FIFO LRU eviction (300-entry cap)
- Pre-compile 15+ static regex constants for block boundary detection
- Skip redundant style='text-align:left' on default-aligned table cells

style(parser): add CSS for footnotes, definition lists, math formulas, sup/sub

test(parser): 44 new test cases covering all v0.1.4 syntax additions (469 total)

chore: bump version 0.1.3 → 0.1.4 across all source files, docs, site pages
2026-07-24 09:35:51 +08:00
thzxx 2eb86d29b6 fix(site): escape => to =&gt; in docs.html code blocks
Arrow functions in code examples were unescaped, causing parse
errors in some browsers. Script block arrow functions preserved.
2026-07-23 21:14:32 +08:00
thzxx 71ddda1155 feat(site): add docs.html, update demo and index for v0.1.3
- docs.html: comprehensive single-page documentation with sidebar navigation
  covering all APIs, config, events, plugins, themes, i18n, and syntax reference
- demo.html: add readOnly toggle, emoji/new syntax demo content,
  imagePaste plugin, refresh API button, docs link
- index.html: add docs link to nav and footer
2026-07-23 21:08:12 +08:00
thzxx 70eb71623f docs: update README for v0.1.3 — features, API, syntax, tests
- Feature list: add readOnly, imagePaste, emoji, render cache, print styles
- Test badge: 407 → 425
- Config: add readOnly, historyDebounce options
- API: add refresh(), setReadOnly(), isReadOnly()
- getStatus: add readOnly field
- Events: add beforeRender, afterRender instance events
- Plugins: add imagePaste preset documentation
- Syntax table: add highlight, superscript, subscript, emoji, table alignment
- Test coverage: update file descriptions and total count
2026-07-23 21:03:02 +08:00
thzxx 8d2e172289 release: v0.1.3 — bug fixes, performance, hardening
Bug Fixes:
- fix(core): exec() now supports _customActions registered via addToolbarButton
- fix(core): _emit('focus'/'blur') no longer passes editor argument twice
- fix(core): getHTML() now triggers beforeRender/afterRender hooks
- fix(core): _wrapSelection defaults to 'text' instead of i18n placeholder
- fix(core): addToolbarButton onClick+action no longer double-fires
- fix(core): null-safety on focus/blur/enable/disable after destroy
- fix(parser): empty headings (# ) no longer produce empty <h1> tags
- fix(parser): slugify returns 'heading' fallback for empty/special inputs
- fix(i18n): setCurrentLocale no longer mutates input parameter
- fix(core): autofocus skipped when readOnly is enabled

Performance:
- perf(core): cache last rendered value, skip parsing when content unchanged
- perf(core): add refresh() API to force re-render after theme/locale changes

Hardening:
- feat(core): tabSize dynamically applied to textarea via style.tabSize
- feat(core): getStatus() now includes readOnly field

Tests:
- 7 new test cases: customActions, refresh, focus args, destroy safety,
  getStatus readOnly, autofocus+readOnly, slugify edge cases
- Total: 425 tests passing (+7 from v0.1.2)

Types:
- EditorStatus includes readOnly field
- MarkdownEditor.refresh() added to type definitions
2026-07-23 21:00:09 +08:00
thzxx 12875921eb release: v0.1.2 — readOnly, new syntax, plugins, optimizations
Features:
- feat(core): readOnly mode with config option and setReadOnly() API
- feat(parser): superscript ^text^ and subscript ~text~ support
- feat(parser): highlight/mark ==text== syntax
- feat(parser): table column alignment with colons (:---, :---:, ---:)
- feat(parser): emoji shortcodes 😄😊 (80+ common emojis)
- feat(plugins): imagePaste preset — paste clipboard images as base64
- feat(core): instance-level beforeRender/afterRender events
- feat(styles): print stylesheet (@media print)
- feat(styles): mark element CSS styling
- feat(styles): readOnly mode CSS (.me-readonly)

Optimizations:
- perf(core): history debounce now configurable via historyDebounce option
- perf(core): skip _render() in edit-only mode (already guarded)
- fix(core): divider drag division-by-zero guard
- fix(core): config.style deep merge with DEFAULTS
- fix(core): scroll position preserved across mode switches

Tests:
- 9 new test cases: readOnly (3), parser syntax (6)
- Total: 418 tests passing (+9 from v0.1.1)

Chores:
- version bump 0.1.1 → 0.1.2
- TypeScript definitions updated for new APIs
2026-07-23 20:53:36 +08:00
thzxx e3142a17a8 feat(site): replace text 'M' logo with SVG icon
- Replace plain 'M' character with stylized SVG M monogram
- SVG uses the same white stroke-on-gradient style as before
- Add .logo .logo-mark style for hero section (32px, larger)
- Remove font-specific styles from logo-mark (now SVG-based)
- Add flex-shrink:0 to prevent icon squishing
2026-07-23 20:18:53 +08:00
thzxx f080dcd1ff fix(site): add white-space:pre-wrap to code block for proper line formatting
Root cause: .code-block was missing white-space:pre-wrap, causing all
newlines and indentation to collapse into a single line in the browser.
Also collapse open/close tags to avoid leading/trailing blank lines.
2026-07-23 20:16:56 +08:00
thzxx 86beddf63d fix(site): format code block syntax highlighting and clarify logo mark
- Add .c-punc CSS class for punctuation coloring in code blocks
- Wrap all angle brackets, operators and delimiters in c-punc spans
- Add title/aria-label to logo-mark for accessibility and clarity
- Fix CDN path in code sample to match actual usage (../dist/...)
- Fix indentation consistency
2026-07-23 20:13:10 +08:00
thzxx 9e0c1d7a7f release: v0.1.1 — bug fixes, CSS scoping, parser improvements
Bug Fixes:
- fix(core): insert() replace param was non-functional due to identical ternary branches
- fix(types): correct project URL typo (MetonaToast → MetonaEditor)

Improvements:
- feat(core): scope CSS theme variables to .me-wrapper per-instance, preventing global style pollution
- feat(themes): add optional target parameter to setThemeVariables() for element-scoped theming
- perf(parser): improve bold/strikethrough regex to support inline delimiter chars (e.g. **a*b**, ~~a~b~~)
- fix(parser): prevent *** cross-tag nesting by requiring first content char ≠ delimiter
- docs(animations): clarify module purpose as future-use animation metadata registry

Tests:
- test(core): add 2 cases for insert() replace:true / replace:false behavior
- All 409 tests passing (+2 new)

Chores:
- bump version 0.1.0 → 0.1.1 across all source files, package.json, README, and demo
2026-07-23 20:02:04 +08:00
thzxx 83357c3f22 docs: update npm package link to Gitea packages page 2026-07-23 18:04:31 +08:00
thzxx 234907b27f fix: sync global theme on construct when theme option is explicitly provided 2026-07-23 17:10:52 +08:00
thzxx 616e9311e9 build: add type:module to package.json, rename babel/jest config to .cjs 2026-07-23 16:46:44 +08:00
thzxx 61d65f7112 docs: remove redundant related links section from README 2026-07-23 16:36:44 +08:00
thzxx a08d8571cb docs: fix README CDN URLs, remove non-existent CSS link, update test counts 2026-07-23 16:32:05 +08:00
thzxx 22e867eda8 Initial commit: MetonaEditor v0.1.0 2026-07-23 16:23:07 +08:00