overtype 2.0.6 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -3
- package/dist/overtype-webcomponent.esm.js +1435 -1283
- package/dist/overtype-webcomponent.esm.js.map +3 -3
- package/dist/overtype-webcomponent.js +1433 -1281
- package/dist/overtype-webcomponent.js.map +3 -3
- package/dist/overtype-webcomponent.min.js +50 -50
- package/dist/overtype.cjs +1435 -1283
- package/dist/overtype.cjs.map +3 -3
- package/dist/overtype.esm.js +1435 -1283
- package/dist/overtype.esm.js.map +3 -3
- package/dist/overtype.js +1668 -1515
- package/dist/overtype.js.map +3 -3
- package/dist/overtype.min.js +39 -38
- package/package.json +5 -3
- package/src/link-tooltip.js +18 -4
- package/src/overtype.js +204 -3
- package/src/parser.js +25 -2
- package/src/shortcuts.js +11 -76
- package/src/toolbar-buttons.js +25 -12
- package/src/toolbar.js +27 -48
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OverType
|
|
2
2
|
|
|
3
|
-
A lightweight markdown editor library with perfect WYSIWYG alignment using an invisible textarea overlay technique. Includes optional toolbar. ~
|
|
3
|
+
A lightweight markdown editor library with perfect WYSIWYG alignment using an invisible textarea overlay technique. Includes optional toolbar. ~95KB minified with all features.
|
|
4
4
|
|
|
5
5
|
## Live Examples
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ A lightweight markdown editor library with perfect WYSIWYG alignment using an in
|
|
|
19
19
|
- ⌨️ **Keyboard shortcuts** - Common markdown shortcuts (Cmd/Ctrl+B for bold, etc.)
|
|
20
20
|
- 📱 **Mobile optimized** - Responsive design with mobile-specific styles
|
|
21
21
|
- 🔄 **DOM persistence aware** - Recovers from existing DOM (perfect for HyperClay and similar platforms)
|
|
22
|
-
- 🚀 **Lightweight** - ~
|
|
22
|
+
- 🚀 **Lightweight** - ~95KB minified
|
|
23
23
|
- 🎯 **Optional toolbar** - Clean, minimal toolbar with all essential formatting
|
|
24
24
|
- ✨ **Smart shortcuts** - Keyboard shortcuts with selection preservation
|
|
25
25
|
- 📝 **Smart list continuation** - GitHub-style automatic list continuation on Enter
|
|
@@ -35,7 +35,7 @@ We overlap an invisible textarea on top of styled output, giving the illusion of
|
|
|
35
35
|
|
|
36
36
|
| Feature | OverType | HyperMD | Milkdown | TUI Editor | EasyMDE |
|
|
37
37
|
|---------|----------|---------|----------|------------|---------|
|
|
38
|
-
| **Size** | ~
|
|
38
|
+
| **Size** | ~95KB | 364.02 KB | 344.51 KB | 560.99 KB | 323.69 KB |
|
|
39
39
|
| **Dependencies** | Bundled | CodeMirror | ProseMirror + plugins | Multiple libs | CodeMirror |
|
|
40
40
|
| **Setup** | Single file | Complex config | Build step required | Complex config | Moderate |
|
|
41
41
|
| **Approach** | Invisible textarea | ContentEditable | ContentEditable | ContentEditable | CodeMirror |
|
|
@@ -537,11 +537,22 @@ OverType.setTheme('solar', { h1: '#custom' }) // Override specific colors
|
|
|
537
537
|
OverType.setCodeHighlighter((code, lang) => highlightedHTML)
|
|
538
538
|
OverType.setCodeHighlighter(null) // Disable global highlighting
|
|
539
539
|
|
|
540
|
+
// Extend parsing with custom syntax (footnotes, directives, etc.)
|
|
541
|
+
// IMPORTANT: You must maintain 1-to-1 character alignment - wrap text, don't change it
|
|
542
|
+
// See: https://panphora.github.io/overtype/examples/custom-syntax.html
|
|
543
|
+
OverType.setCustomSyntax((html) => {
|
|
544
|
+
return html.replace(/\[\^(\w+)\]/g, '<span class="footnote">$&</span>');
|
|
545
|
+
})
|
|
546
|
+
|
|
540
547
|
// Note: Instance methods override global settings
|
|
541
548
|
|
|
542
549
|
// Initialize multiple editors (same as constructor)
|
|
543
550
|
OverType.init(target, options)
|
|
544
551
|
|
|
552
|
+
// Initialize with per-element config via data-ot-* attributes
|
|
553
|
+
// Uses kebab-case: data-ot-show-stats="true" → showStats: true
|
|
554
|
+
OverType.initFromData('.editor', { /* defaults */ })
|
|
555
|
+
|
|
545
556
|
// Get instance from element
|
|
546
557
|
OverType.getInstance(element)
|
|
547
558
|
|
|
@@ -731,6 +742,26 @@ OverType uses a unique invisible textarea overlay approach:
|
|
|
731
742
|
- Textarea content drives everything
|
|
732
743
|
- One-way data flow: textarea → parser → preview
|
|
733
744
|
|
|
745
|
+
## Data Attribute Configuration
|
|
746
|
+
|
|
747
|
+
Use `OverType.initFromData()` to configure multiple editors via HTML data attributes:
|
|
748
|
+
|
|
749
|
+
```html
|
|
750
|
+
<div class="editor" data-ot-toolbar="true" data-ot-theme="cave"></div>
|
|
751
|
+
<div class="editor" data-ot-auto-resize="true" data-ot-min-height="200px"></div>
|
|
752
|
+
<div class="editor" data-ot-show-stats="true" data-ot-placeholder="Write here..."></div>
|
|
753
|
+
|
|
754
|
+
<script>
|
|
755
|
+
OverType.initFromData('.editor', { fontSize: '14px' }); // defaults
|
|
756
|
+
</script>
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
Uses kebab-case attributes that convert to camelCase options (e.g., `data-ot-show-stats` → `showStats`).
|
|
760
|
+
|
|
761
|
+
**Supported:** `toolbar`, `theme`, `value`, `placeholder`, `autofocus`, `auto-resize`, `min-height`, `max-height`, `font-size`, `line-height`, `show-stats`, `smart-lists`, `show-active-line-raw`
|
|
762
|
+
|
|
763
|
+
**Not supported (use JS):** `toolbarButtons`, `textareaProps`, `onChange`, `onKeydown`, `statsFormatter`, `codeHighlighter`, `colors`, `mobile`
|
|
764
|
+
|
|
734
765
|
## Contributors
|
|
735
766
|
|
|
736
767
|
Special thanks to:
|
|
@@ -741,6 +772,9 @@ Special thanks to:
|
|
|
741
772
|
- [Kristián Kostecký](https://github.com/kristiankostecky) - Fixed toolbar option being ignored in reinit() ([#62](https://github.com/panphora/overtype/pull/62))
|
|
742
773
|
- [Lyric Wai](https://github.com/lyricat) - Fixed double-escaping of links ([#64](https://github.com/panphora/overtype/pull/64)), reported code block alignment issues ([#65](https://github.com/panphora/overtype/issues/65))
|
|
743
774
|
- [kozi](https://github.com/kozi) - Reported link tooltip issues in Firefox ([#68](https://github.com/panphora/overtype/issues/68)), toolbar positioning ([#69](https://github.com/panphora/overtype/issues/69)), theme synchronization issues ([#70](https://github.com/panphora/overtype/issues/70), [#71](https://github.com/panphora/overtype/issues/71))
|
|
775
|
+
- [1951FDG](https://github.com/1951FDG) - Reported list rendering issues ([#74](https://github.com/panphora/overtype/issues/74)), suggested showStats refresh ([#77](https://github.com/panphora/overtype/issues/77))
|
|
776
|
+
- [nodesocket](https://github.com/nodesocket) - Reported toolbarButtons global access ([#73](https://github.com/panphora/overtype/issues/73), [#78](https://github.com/panphora/overtype/issues/78))
|
|
777
|
+
- [Travis Bell](https://github.com/travisbell) - Reported keyboard shortcuts not working ([#80](https://github.com/panphora/overtype/issues/80))
|
|
744
778
|
|
|
745
779
|
### TypeScript & Framework Support
|
|
746
780
|
- [merlinz01](https://github.com/merlinz01) - Initial TypeScript definitions implementation ([#20](https://github.com/panphora/overtype/pull/20))
|
|
@@ -751,6 +785,8 @@ Special thanks to:
|
|
|
751
785
|
- [Yukai Huang](https://github.com/Yukaii) - Syntax highlighting support (under review) ([#35](https://github.com/panphora/overtype/pull/35))
|
|
752
786
|
- [Rognoni](https://github.com/rognoni) - Suggested custom toolbar button API ([#61](https://github.com/panphora/overtype/issues/61))
|
|
753
787
|
- [Deyan Gigov](https://github.com/dido739) - Reported checkbox rendering issue in preview mode ([#60](https://github.com/panphora/overtype/issues/60))
|
|
788
|
+
- [GregJohnStewart](https://github.com/GregJohnStewart) - Suggested data attribute configuration ([#76](https://github.com/panphora/overtype/issues/76))
|
|
789
|
+
- [boris-glumpler](https://github.com/boris-glumpler) - Suggested custom syntax/directive highlighting ([#79](https://github.com/panphora/overtype/issues/79))
|
|
754
790
|
|
|
755
791
|
### Developer Experience
|
|
756
792
|
- [Ned Twigg](https://github.com/nedtwigg) - Browser extension developer feedback, gitcasso extension ([#59](https://github.com/panphora/overtype/issues/59))
|