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.
package/dist/overtype.js CHANGED
@@ -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
@@ -117,7 +117,7 @@ var OverType = (() => {
117
117
  * @returns {string} Parsed bullet list item
118
118
  */
119
119
  static parseBulletList(html) {
120
- return html.replace(/^((?: )*)([-*])\s(.+)$/, (match, indent, marker, content) => {
120
+ return html.replace(/^((?: )*)([-*+])\s(.+)$/, (match, indent, marker, content) => {
121
121
  return `${indent}<li class="bullet-list"><span class="syntax-marker">${marker} </span>${content}</li>`;
122
122
  });
123
123
  }
@@ -176,7 +176,7 @@ var OverType = (() => {
176
176
  * @returns {string} HTML with italic styling
177
177
  */
178
178
  static parseItalic(html) {
179
- html = html.replace(new RegExp("(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)", "g"), '<em><span class="syntax-marker">*</span>$1<span class="syntax-marker">*</span></em>');
179
+ html = html.replace(new RegExp("(?<![\\*>])\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)", "g"), '<em><span class="syntax-marker">*</span>$1<span class="syntax-marker">*</span></em>');
180
180
  html = html.replace(new RegExp("(?<=^|\\s)_(?!_)(.+?)(?<!_)_(?!_)(?=\\s|$)", "g"), '<em><span class="syntax-marker">_</span>$1<span class="syntax-marker">_</span></em>');
181
181
  return html;
182
182
  }
@@ -1686,16 +1686,22 @@ ${blockSuffix}` : suffix;
1686
1686
  // White - editor background
1687
1687
  text: "#0d3b66",
1688
1688
  // Yale Blue - main text
1689
+ textPrimary: "#0d3b66",
1690
+ // Yale Blue - primary text (same as text)
1691
+ textSecondary: "#5a7a9b",
1692
+ // Muted blue - secondary text
1689
1693
  h1: "#f95738",
1690
1694
  // Tomato - h1 headers
1691
1695
  h2: "#ee964b",
1692
- // Sandy Brown - h2 headers
1696
+ // Sandy Brown - h2 headers
1693
1697
  h3: "#3d8a51",
1694
1698
  // Forest green - h3 headers
1695
1699
  strong: "#ee964b",
1696
1700
  // Sandy Brown - bold text
1697
1701
  em: "#f95738",
1698
1702
  // Tomato - italic text
1703
+ del: "#ee964b",
1704
+ // Sandy Brown - deleted text (same as strong)
1699
1705
  link: "#0d3b66",
1700
1706
  // Yale Blue - links
1701
1707
  code: "#0d3b66",
@@ -1708,17 +1714,25 @@ ${blockSuffix}` : suffix;
1708
1714
  // Muted blue - horizontal rules
1709
1715
  syntaxMarker: "rgba(13, 59, 102, 0.52)",
1710
1716
  // Yale Blue with transparency
1717
+ syntax: "#999999",
1718
+ // Gray - syntax highlighting fallback
1711
1719
  cursor: "#f95738",
1712
1720
  // Tomato - cursor
1713
1721
  selection: "rgba(244, 211, 94, 0.4)",
1714
1722
  // Naples Yellow with transparency
1715
1723
  listMarker: "#ee964b",
1716
1724
  // Sandy Brown - list markers
1725
+ rawLine: "#5a7a9b",
1726
+ // Muted blue - raw line indicators
1727
+ border: "#e0e0e0",
1728
+ // Light gray - borders
1729
+ hoverBg: "#f0f0f0",
1730
+ // Very light gray - hover backgrounds
1731
+ primary: "#0d3b66",
1732
+ // Yale Blue - primary accent
1717
1733
  // Toolbar colors
1718
1734
  toolbarBg: "#ffffff",
1719
1735
  // White - toolbar background
1720
- toolbarBorder: "rgba(13, 59, 102, 0.15)",
1721
- // Yale Blue border
1722
1736
  toolbarIcon: "#0d3b66",
1723
1737
  // Yale Blue - icon color
1724
1738
  toolbarHover: "#f5f5f5",
@@ -1736,6 +1750,10 @@ ${blockSuffix}` : suffix;
1736
1750
  // Darker charcoal - editor background
1737
1751
  text: "#c5dde8",
1738
1752
  // Light blue-gray - main text
1753
+ textPrimary: "#c5dde8",
1754
+ // Light blue-gray - primary text (same as text)
1755
+ textSecondary: "#9fcfec",
1756
+ // Brighter blue - secondary text
1739
1757
  h1: "#d4a5ff",
1740
1758
  // Rich lavender - h1 headers
1741
1759
  h2: "#f6ae2d",
@@ -1746,6 +1764,8 @@ ${blockSuffix}` : suffix;
1746
1764
  // Hunyadi Yellow - bold text
1747
1765
  em: "#9fcfec",
1748
1766
  // Brighter blue - italic text
1767
+ del: "#f6ae2d",
1768
+ // Hunyadi Yellow - deleted text (same as strong)
1749
1769
  link: "#9fcfec",
1750
1770
  // Brighter blue - links
1751
1771
  code: "#c5dde8",
@@ -1758,17 +1778,25 @@ ${blockSuffix}` : suffix;
1758
1778
  // Light blue-gray - horizontal rules
1759
1779
  syntaxMarker: "rgba(159, 207, 236, 0.73)",
1760
1780
  // Brighter blue semi-transparent
1781
+ syntax: "#7a8c98",
1782
+ // Muted gray-blue - syntax highlighting fallback
1761
1783
  cursor: "#f26419",
1762
1784
  // Orange Pantone - cursor
1763
1785
  selection: "rgba(51, 101, 138, 0.4)",
1764
1786
  // Lapis Lazuli with transparency
1765
1787
  listMarker: "#f6ae2d",
1766
1788
  // Hunyadi Yellow - list markers
1789
+ rawLine: "#9fcfec",
1790
+ // Brighter blue - raw line indicators
1791
+ border: "#2a3f52",
1792
+ // Dark blue-gray - borders
1793
+ hoverBg: "#243546",
1794
+ // Slightly lighter charcoal - hover backgrounds
1795
+ primary: "#9fcfec",
1796
+ // Brighter blue - primary accent
1767
1797
  // Toolbar colors for dark theme
1768
1798
  toolbarBg: "#1D2D3E",
1769
1799
  // Darker charcoal - toolbar background
1770
- toolbarBorder: "rgba(197, 221, 232, 0.1)",
1771
- // Light blue-gray border
1772
1800
  toolbarIcon: "#c5dde8",
1773
1801
  // Light blue-gray - icon color
1774
1802
  toolbarHover: "#243546",
@@ -2288,6 +2316,7 @@ ${blockSuffix}` : suffix;
2288
2316
  gap: 4px !important;
2289
2317
  padding: 8px !important; /* Override reset */
2290
2318
  background: var(--toolbar-bg, var(--bg-primary, #f8f9fa)) !important; /* Override reset */
2319
+ border-bottom: 1px solid var(--toolbar-border, transparent) !important; /* Override reset */
2291
2320
  overflow-x: auto !important; /* Allow horizontal scrolling */
2292
2321
  overflow-y: hidden !important; /* Hide vertical overflow */
2293
2322
  -webkit-overflow-scrolling: touch !important;
@@ -2759,6 +2788,28 @@ ${blockSuffix}` : suffix;
2759
2788
  button.addEventListener("click", button._clickHandler);
2760
2789
  return button;
2761
2790
  }
2791
+ /**
2792
+ * Handle button action programmatically (used by keyboard shortcuts)
2793
+ * @param {Object} buttonConfig - Button configuration object with action function
2794
+ */
2795
+ async handleAction(buttonConfig) {
2796
+ this.editor.textarea.focus();
2797
+ try {
2798
+ if (buttonConfig.action) {
2799
+ await buttonConfig.action({
2800
+ editor: this.editor,
2801
+ getValue: () => this.editor.getValue(),
2802
+ setValue: (value) => this.editor.setValue(value),
2803
+ event: null
2804
+ });
2805
+ }
2806
+ } catch (error) {
2807
+ console.error(`Action "${buttonConfig.name}" error:`, error);
2808
+ this.editor.wrapper.dispatchEvent(new CustomEvent("button-error", {
2809
+ detail: { buttonName: buttonConfig.name, error }
2810
+ }));
2811
+ }
2812
+ }
2762
2813
  /**
2763
2814
  * Sanitize SVG to prevent XSS
2764
2815
  */
@@ -3697,10 +3748,13 @@ ${blockSuffix}` : suffix;
3697
3748
  */
3698
3749
  handleKeydown(event) {
3699
3750
  if (event.key === "Tab") {
3700
- event.preventDefault();
3701
3751
  const start = this.textarea.selectionStart;
3702
3752
  const end = this.textarea.selectionEnd;
3703
3753
  const value = this.textarea.value;
3754
+ if (event.shiftKey && start === end) {
3755
+ return;
3756
+ }
3757
+ event.preventDefault();
3704
3758
  if (start !== end && event.shiftKey) {
3705
3759
  const before = value.substring(0, start);
3706
3760
  const selection = value.substring(start, end);
@@ -4295,6 +4349,8 @@ ${blockSuffix}` : suffix;
4295
4349
 
4296
4350
  if (typeof window !== "undefined" && typeof window.document !== "undefined") {
4297
4351
  window.OverType = OverType.default ? OverType.default : OverType;
4352
+ window.toolbarButtons = OverType.toolbarButtons;
4353
+ window.defaultToolbarButtons = OverType.defaultToolbarButtons;
4298
4354
  }
4299
4355
 
4300
4356
  //# sourceMappingURL=overtype.js.map