overtype 2.0.4 → 2.0.6

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OverType v2.0.4
2
+ * OverType v2.0.6
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author David Miranda
@@ -114,7 +114,7 @@ var OverTypeEditor = (() => {
114
114
  * @returns {string} Parsed bullet list item
115
115
  */
116
116
  static parseBulletList(html) {
117
- return html.replace(/^((?: )*)([-*])\s(.+)$/, (match, indent, marker, content) => {
117
+ return html.replace(/^((?: )*)([-*+])\s(.+)$/, (match, indent, marker, content) => {
118
118
  return `${indent}<li class="bullet-list"><span class="syntax-marker">${marker} </span>${content}</li>`;
119
119
  });
120
120
  }
@@ -173,7 +173,7 @@ var OverTypeEditor = (() => {
173
173
  * @returns {string} HTML with italic styling
174
174
  */
175
175
  static parseItalic(html) {
176
- html = html.replace(new RegExp("(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)", "g"), '<em><span class="syntax-marker">*</span>$1<span class="syntax-marker">*</span></em>');
176
+ html = html.replace(new RegExp("(?<![\\*>])\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)", "g"), '<em><span class="syntax-marker">*</span>$1<span class="syntax-marker">*</span></em>');
177
177
  html = html.replace(new RegExp("(?<=^|\\s)_(?!_)(.+?)(?<!_)_(?!_)(?=\\s|$)", "g"), '<em><span class="syntax-marker">_</span>$1<span class="syntax-marker">_</span></em>');
178
178
  return html;
179
179
  }
@@ -1683,16 +1683,22 @@ ${blockSuffix}` : suffix;
1683
1683
  // White - editor background
1684
1684
  text: "#0d3b66",
1685
1685
  // Yale Blue - main text
1686
+ textPrimary: "#0d3b66",
1687
+ // Yale Blue - primary text (same as text)
1688
+ textSecondary: "#5a7a9b",
1689
+ // Muted blue - secondary text
1686
1690
  h1: "#f95738",
1687
1691
  // Tomato - h1 headers
1688
1692
  h2: "#ee964b",
1689
- // Sandy Brown - h2 headers
1693
+ // Sandy Brown - h2 headers
1690
1694
  h3: "#3d8a51",
1691
1695
  // Forest green - h3 headers
1692
1696
  strong: "#ee964b",
1693
1697
  // Sandy Brown - bold text
1694
1698
  em: "#f95738",
1695
1699
  // Tomato - italic text
1700
+ del: "#ee964b",
1701
+ // Sandy Brown - deleted text (same as strong)
1696
1702
  link: "#0d3b66",
1697
1703
  // Yale Blue - links
1698
1704
  code: "#0d3b66",
@@ -1705,17 +1711,25 @@ ${blockSuffix}` : suffix;
1705
1711
  // Muted blue - horizontal rules
1706
1712
  syntaxMarker: "rgba(13, 59, 102, 0.52)",
1707
1713
  // Yale Blue with transparency
1714
+ syntax: "#999999",
1715
+ // Gray - syntax highlighting fallback
1708
1716
  cursor: "#f95738",
1709
1717
  // Tomato - cursor
1710
1718
  selection: "rgba(244, 211, 94, 0.4)",
1711
1719
  // Naples Yellow with transparency
1712
1720
  listMarker: "#ee964b",
1713
1721
  // Sandy Brown - list markers
1722
+ rawLine: "#5a7a9b",
1723
+ // Muted blue - raw line indicators
1724
+ border: "#e0e0e0",
1725
+ // Light gray - borders
1726
+ hoverBg: "#f0f0f0",
1727
+ // Very light gray - hover backgrounds
1728
+ primary: "#0d3b66",
1729
+ // Yale Blue - primary accent
1714
1730
  // Toolbar colors
1715
1731
  toolbarBg: "#ffffff",
1716
1732
  // White - toolbar background
1717
- toolbarBorder: "rgba(13, 59, 102, 0.15)",
1718
- // Yale Blue border
1719
1733
  toolbarIcon: "#0d3b66",
1720
1734
  // Yale Blue - icon color
1721
1735
  toolbarHover: "#f5f5f5",
@@ -1733,6 +1747,10 @@ ${blockSuffix}` : suffix;
1733
1747
  // Darker charcoal - editor background
1734
1748
  text: "#c5dde8",
1735
1749
  // Light blue-gray - main text
1750
+ textPrimary: "#c5dde8",
1751
+ // Light blue-gray - primary text (same as text)
1752
+ textSecondary: "#9fcfec",
1753
+ // Brighter blue - secondary text
1736
1754
  h1: "#d4a5ff",
1737
1755
  // Rich lavender - h1 headers
1738
1756
  h2: "#f6ae2d",
@@ -1743,6 +1761,8 @@ ${blockSuffix}` : suffix;
1743
1761
  // Hunyadi Yellow - bold text
1744
1762
  em: "#9fcfec",
1745
1763
  // Brighter blue - italic text
1764
+ del: "#f6ae2d",
1765
+ // Hunyadi Yellow - deleted text (same as strong)
1746
1766
  link: "#9fcfec",
1747
1767
  // Brighter blue - links
1748
1768
  code: "#c5dde8",
@@ -1755,17 +1775,25 @@ ${blockSuffix}` : suffix;
1755
1775
  // Light blue-gray - horizontal rules
1756
1776
  syntaxMarker: "rgba(159, 207, 236, 0.73)",
1757
1777
  // Brighter blue semi-transparent
1778
+ syntax: "#7a8c98",
1779
+ // Muted gray-blue - syntax highlighting fallback
1758
1780
  cursor: "#f26419",
1759
1781
  // Orange Pantone - cursor
1760
1782
  selection: "rgba(51, 101, 138, 0.4)",
1761
1783
  // Lapis Lazuli with transparency
1762
1784
  listMarker: "#f6ae2d",
1763
1785
  // Hunyadi Yellow - list markers
1786
+ rawLine: "#9fcfec",
1787
+ // Brighter blue - raw line indicators
1788
+ border: "#2a3f52",
1789
+ // Dark blue-gray - borders
1790
+ hoverBg: "#243546",
1791
+ // Slightly lighter charcoal - hover backgrounds
1792
+ primary: "#9fcfec",
1793
+ // Brighter blue - primary accent
1764
1794
  // Toolbar colors for dark theme
1765
1795
  toolbarBg: "#1D2D3E",
1766
1796
  // Darker charcoal - toolbar background
1767
- toolbarBorder: "rgba(197, 221, 232, 0.1)",
1768
- // Light blue-gray border
1769
1797
  toolbarIcon: "#c5dde8",
1770
1798
  // Light blue-gray - icon color
1771
1799
  toolbarHover: "#243546",
@@ -2285,6 +2313,7 @@ ${blockSuffix}` : suffix;
2285
2313
  gap: 4px !important;
2286
2314
  padding: 8px !important; /* Override reset */
2287
2315
  background: var(--toolbar-bg, var(--bg-primary, #f8f9fa)) !important; /* Override reset */
2316
+ border-bottom: 1px solid var(--toolbar-border, transparent) !important; /* Override reset */
2288
2317
  overflow-x: auto !important; /* Allow horizontal scrolling */
2289
2318
  overflow-y: hidden !important; /* Hide vertical overflow */
2290
2319
  -webkit-overflow-scrolling: touch !important;
@@ -2756,6 +2785,28 @@ ${blockSuffix}` : suffix;
2756
2785
  button.addEventListener("click", button._clickHandler);
2757
2786
  return button;
2758
2787
  }
2788
+ /**
2789
+ * Handle button action programmatically (used by keyboard shortcuts)
2790
+ * @param {Object} buttonConfig - Button configuration object with action function
2791
+ */
2792
+ async handleAction(buttonConfig) {
2793
+ this.editor.textarea.focus();
2794
+ try {
2795
+ if (buttonConfig.action) {
2796
+ await buttonConfig.action({
2797
+ editor: this.editor,
2798
+ getValue: () => this.editor.getValue(),
2799
+ setValue: (value) => this.editor.setValue(value),
2800
+ event: null
2801
+ });
2802
+ }
2803
+ } catch (error) {
2804
+ console.error(`Action "${buttonConfig.name}" error:`, error);
2805
+ this.editor.wrapper.dispatchEvent(new CustomEvent("button-error", {
2806
+ detail: { buttonName: buttonConfig.name, error }
2807
+ }));
2808
+ }
2809
+ }
2759
2810
  /**
2760
2811
  * Sanitize SVG to prevent XSS
2761
2812
  */
@@ -3694,10 +3745,13 @@ ${blockSuffix}` : suffix;
3694
3745
  */
3695
3746
  handleKeydown(event) {
3696
3747
  if (event.key === "Tab") {
3697
- event.preventDefault();
3698
3748
  const start = this.textarea.selectionStart;
3699
3749
  const end = this.textarea.selectionEnd;
3700
3750
  const value = this.textarea.value;
3751
+ if (event.shiftKey && start === end) {
3752
+ return;
3753
+ }
3754
+ event.preventDefault();
3701
3755
  if (start !== end && event.shiftKey) {
3702
3756
  const before = value.substring(0, start);
3703
3757
  const selection = value.substring(start, end);
@@ -4534,6 +4588,9 @@ ${blockSuffix}` : suffix;
4534
4588
  break;
4535
4589
  case "theme":
4536
4590
  this._reinjectStyles();
4591
+ if (this._editor && this._editor.setTheme) {
4592
+ this._editor.setTheme(value || "solar");
4593
+ }
4537
4594
  break;
4538
4595
  case "placeholder":
4539
4596
  if (this._editor.textarea) {