overtype 2.2.0 → 2.3.0

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 CHANGED
@@ -776,20 +776,30 @@ Special thanks to:
776
776
  - [Lyric Wai](https://github.com/lyricat) - Fixed double-escaping of links ([#64](https://github.com/panphora/overtype/pull/64)), shared code block alignment fix ([#65](https://github.com/panphora/overtype/issues/65))
777
777
  - [kozi](https://github.com/kozi) - Reported Firefox link tooltip bug ([#68](https://github.com/panphora/overtype/issues/68)), toolbar positioning ([#69](https://github.com/panphora/overtype/issues/69)), theme CSS variable issues ([#70](https://github.com/panphora/overtype/issues/70), [#71](https://github.com/panphora/overtype/issues/71))
778
778
  - [1951FDG](https://github.com/1951FDG) - Reported unordered list rendering bug ([#74](https://github.com/panphora/overtype/issues/74)), suggested showStats() API improvement ([#77](https://github.com/panphora/overtype/issues/77))
779
- - [nodesocket](https://github.com/nodesocket) - Reported toolbarButtons export issues ([#73](https://github.com/panphora/overtype/issues/73), [#78](https://github.com/panphora/overtype/issues/78))
779
+ - [nodesocket](https://github.com/nodesocket) - Reported toolbarButtons export issues ([#73](https://github.com/panphora/overtype/issues/73), [#78](https://github.com/panphora/overtype/issues/78)), suggested image toolbar button ([#89](https://github.com/panphora/overtype/issues/89))
780
780
  - [Travis Bell](https://github.com/travisbell) - Reported keyboard shortcuts bug in ESM build ([#80](https://github.com/panphora/overtype/issues/80))
781
+ - [fab2713](https://github.com/fab2713) - Reported italic rendering in lists ([#81](https://github.com/panphora/overtype/issues/81)), reinit maxHeight ([#82](https://github.com/panphora/overtype/issues/82)), placeholder visibility ([#83](https://github.com/panphora/overtype/issues/83)), suggested auto theme ([#84](https://github.com/panphora/overtype/issues/84)), relative URL prefix ([#85](https://github.com/panphora/overtype/issues/85)), minification improvements ([#94](https://github.com/panphora/overtype/issues/94))
782
+ - [oooo-ps](https://github.com/oooo-ps) - Reported remote script loading issue ([#86](https://github.com/panphora/overtype/issues/86))
783
+ - [ddarfantasy](https://github.com/ddarfantasy) - Reported text misalignment on longer lines ([#91](https://github.com/panphora/overtype/issues/91))
784
+ - [milen-yordanov](https://github.com/milen-yordanov) - Reported code block colors ignoring theme in preview mode ([#97](https://github.com/panphora/overtype/issues/97))
785
+ - [asalimian](https://github.com/asalimian) - Reported spellcheck being disabled ([#98](https://github.com/panphora/overtype/issues/98))
781
786
 
782
787
  ### TypeScript & Framework Support
783
788
  - [merlinz01](https://github.com/merlinz01) - Contributed TypeScript declaration file ([#20](https://github.com/panphora/overtype/pull/20))
784
789
  - [ChasLui](https://github.com/ChasLui) - Web component implementation ([#40](https://github.com/panphora/overtype/pull/40))
790
+ - [pscanf](https://github.com/pscanf) - Added performAction type definition ([#99](https://github.com/panphora/overtype/pull/99))
785
791
 
786
792
  ### New Features & Enhancements
787
793
  - [davidlazar](https://github.com/davidlazar) - Suggested view mode feature ([#24](https://github.com/panphora/overtype/issues/24))
788
794
  - [Yukai Huang](https://github.com/Yukaii) - Contributed syntax highlighting implementation ([#35](https://github.com/panphora/overtype/pull/35))
789
795
  - [Rognoni](https://github.com/rognoni) - Suggested custom toolbar button API ([#61](https://github.com/panphora/overtype/issues/61))
790
- - [Deyan Gigov](https://github.com/dido739) - Reported checkbox rendering bug in preview mode ([#60](https://github.com/panphora/overtype/issues/60))
791
- - [GregJohnStewart](https://github.com/GregJohnStewart) - Suggested data attribute configuration ([#76](https://github.com/panphora/overtype/issues/76))
796
+ - [Deyan Gigov](https://github.com/dido739) - Reported checkbox rendering bug in preview mode ([#60](https://github.com/panphora/overtype/issues/60)), contributed auto theme implementation ([#100](https://github.com/panphora/overtype/pull/100))
797
+ - [GregJohnStewart](https://github.com/GregJohnStewart) - Suggested data attribute configuration ([#76](https://github.com/panphora/overtype/issues/76)), reported initFromData array nesting bug ([#93](https://github.com/panphora/overtype/issues/93)), suggested DOM element init ([#92](https://github.com/panphora/overtype/issues/92))
792
798
  - [boris-glumpler](https://github.com/boris-glumpler) - Suggested custom syntax highlighting API ([#79](https://github.com/panphora/overtype/issues/79))
799
+ - [sorokya](https://github.com/sorokya) - Contributed file upload support ([#87](https://github.com/panphora/overtype/pull/87))
800
+ - [aaronmyatt](https://github.com/aaronmyatt) - Contributed show/hide toolbar methods ([#95](https://github.com/panphora/overtype/pull/95))
801
+ - [rouilj](https://github.com/rouilj) - Suggested progressive textarea enhancement ([#90](https://github.com/panphora/overtype/issues/90))
802
+ - [inklesspen](https://github.com/inklesspen) - Suggested autocompletion popups ([#96](https://github.com/panphora/overtype/issues/96))
793
803
 
794
804
  ### Developer Experience
795
805
  - [Ned Twigg](https://github.com/nedtwigg) - Built gitcasso browser extension using OverType ([#59](https://github.com/panphora/overtype/issues/59))
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OverType v2.2.0
2
+ * OverType v2.3.0
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author David Miranda
@@ -856,6 +856,20 @@ var solar = {
856
856
  // Lemon Chiffon - active button background
857
857
  placeholder: "#999999"
858
858
  // Gray - placeholder text
859
+ },
860
+ previewColors: {
861
+ text: "#1a1a1a",
862
+ h1: "#1a1a1a",
863
+ h2: "#2a2a2a",
864
+ h3: "#3a3a3a",
865
+ strong: "inherit",
866
+ em: "inherit",
867
+ link: "#0066cc",
868
+ code: "#1a1a1a",
869
+ codeBg: "rgba(135, 131, 120, 0.15)",
870
+ blockquote: "#555",
871
+ hr: "#ddd",
872
+ bg: "transparent"
859
873
  }
860
874
  };
861
875
  var cave = {
@@ -922,6 +936,20 @@ var cave = {
922
936
  // Even lighter - active button background
923
937
  placeholder: "#6a7a88"
924
938
  // Muted blue-gray - placeholder text
939
+ },
940
+ previewColors: {
941
+ text: "#c5dde8",
942
+ h1: "#e0e0e0",
943
+ h2: "#d0d0d0",
944
+ h3: "#c0c0c0",
945
+ strong: "inherit",
946
+ em: "inherit",
947
+ link: "#6cb6e0",
948
+ code: "#c5dde8",
949
+ codeBg: "rgba(255, 255, 255, 0.08)",
950
+ blockquote: "#9aa8b4",
951
+ hr: "rgba(255, 255, 255, 0.15)",
952
+ bg: "transparent"
925
953
  }
926
954
  };
927
955
  var themes = {
@@ -945,20 +973,30 @@ function resolveAutoTheme(themeName) {
945
973
  const mq = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)");
946
974
  return (mq == null ? void 0 : mq.matches) ? "cave" : "solar";
947
975
  }
948
- function themeToCSSVars(colors) {
976
+ function themeToCSSVars(colors, previewColors) {
949
977
  const vars = [];
950
978
  for (const [key, value] of Object.entries(colors)) {
951
979
  const varName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
952
980
  vars.push(`--${varName}: ${value};`);
953
981
  }
982
+ if (previewColors) {
983
+ for (const [key, value] of Object.entries(previewColors)) {
984
+ const varName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
985
+ vars.push(`--preview-${varName}: ${value};`);
986
+ }
987
+ }
954
988
  return vars.join("\n");
955
989
  }
956
- function mergeTheme(baseTheme, customColors = {}) {
990
+ function mergeTheme(baseTheme, customColors = {}, customPreviewColors = {}) {
957
991
  return {
958
992
  ...baseTheme,
959
993
  colors: {
960
994
  ...baseTheme.colors,
961
995
  ...customColors
996
+ },
997
+ previewColors: {
998
+ ...baseTheme.previewColors,
999
+ ...customPreviewColors
962
1000
  }
963
1001
  };
964
1002
  }
@@ -985,7 +1023,7 @@ function generateStyles(options = {}) {
985
1023
  }
986
1024
  }
987
1025
  ` : "";
988
- const themeVars = theme && theme.colors ? themeToCSSVars(theme.colors) : "";
1026
+ const themeVars = theme && theme.colors ? themeToCSSVars(theme.colors, theme.previewColors) : "";
989
1027
  return `
990
1028
  /* OverType Editor Styles */
991
1029
 
@@ -1657,27 +1695,29 @@ function generateStyles(options = {}) {
1657
1695
  }
1658
1696
 
1659
1697
  /* Headers - restore proper sizing in preview mode */
1660
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1,
1661
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2,
1698
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1,
1699
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2,
1662
1700
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1663
1701
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
1664
1702
  font-weight: 600 !important;
1665
1703
  margin: 0 !important;
1666
1704
  display: block !important;
1667
- color: inherit !important; /* Use parent text color */
1668
- line-height: 1 !important; /* Tight line height for headings */
1705
+ line-height: 1 !important;
1669
1706
  }
1670
-
1671
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1 {
1672
- font-size: 2em !important;
1707
+
1708
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1 {
1709
+ font-size: 2em !important;
1710
+ color: var(--preview-h1, #222) !important;
1673
1711
  }
1674
-
1675
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2 {
1676
- font-size: 1.5em !important;
1712
+
1713
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2 {
1714
+ font-size: 1.5em !important;
1715
+ color: var(--preview-h2, #333) !important;
1677
1716
  }
1678
-
1679
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1680
- font-size: 1.17em !important;
1717
+
1718
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1719
+ font-size: 1.17em !important;
1720
+ color: var(--preview-h3, #444) !important;
1681
1721
  }
1682
1722
 
1683
1723
  /* Lists - restore list styling in preview mode */
@@ -1727,14 +1767,14 @@ function generateStyles(options = {}) {
1727
1767
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview a {
1728
1768
  pointer-events: auto !important;
1729
1769
  cursor: pointer !important;
1730
- color: var(--link, #0066cc) !important;
1770
+ color: var(--preview-link, #0066cc) !important;
1731
1771
  text-decoration: underline !important;
1732
1772
  }
1733
1773
 
1734
1774
  /* Code blocks - proper pre/code styling in preview mode */
1735
1775
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview pre.code-block {
1736
- background: var(--code-bg, rgba(244, 211, 94, 0.4)) !important;
1737
- color: var(--code, #0d3b66) !important;
1776
+ background: var(--preview-code-bg, rgba(135, 131, 120, 0.15)) !important;
1777
+ color: var(--preview-code, #333) !important;
1738
1778
  padding: 1.2em !important;
1739
1779
  border-radius: 3px !important;
1740
1780
  overflow-x: auto !important;
@@ -1763,7 +1803,8 @@ function generateStyles(options = {}) {
1763
1803
  /* Blockquotes - enhanced styling in preview mode */
1764
1804
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview .blockquote {
1765
1805
  display: block !important;
1766
- border-left: 4px solid var(--blockquote, #ddd) !important;
1806
+ border-left: 4px solid var(--preview-blockquote, #666) !important;
1807
+ color: var(--preview-blockquote, #666) !important;
1767
1808
  padding-left: 1em !important;
1768
1809
  margin: 1em 0 !important;
1769
1810
  font-style: italic !important;
@@ -1774,14 +1815,16 @@ function generateStyles(options = {}) {
1774
1815
  font-family: Georgia, 'Times New Roman', serif !important;
1775
1816
  font-size: 16px !important;
1776
1817
  line-height: 1.8 !important;
1777
- color: var(--text, #333) !important; /* Consistent text color */
1818
+ color: var(--preview-text, #333) !important;
1819
+ background: var(--preview-bg, transparent) !important;
1778
1820
  }
1779
1821
 
1780
1822
  /* Inline code in preview mode - keep monospace */
1781
1823
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview code {
1782
1824
  font-family: ${fontFamily} !important;
1783
1825
  font-size: 0.9em !important;
1784
- background: rgba(135, 131, 120, 0.15) !important;
1826
+ background: var(--preview-code-bg, rgba(135, 131, 120, 0.15)) !important;
1827
+ color: var(--preview-code, #333) !important;
1785
1828
  padding: 0.2em 0.4em !important;
1786
1829
  border-radius: 3px !important;
1787
1830
  }
@@ -1789,18 +1832,18 @@ function generateStyles(options = {}) {
1789
1832
  /* Strong and em elements in preview mode */
1790
1833
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview strong {
1791
1834
  font-weight: 700 !important;
1792
- color: inherit !important; /* Use parent text color */
1835
+ color: var(--preview-strong, inherit) !important;
1793
1836
  }
1794
1837
 
1795
1838
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview em {
1796
1839
  font-style: italic !important;
1797
- color: inherit !important; /* Use parent text color */
1840
+ color: var(--preview-em, inherit) !important;
1798
1841
  }
1799
1842
 
1800
1843
  /* HR in preview mode */
1801
1844
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview .hr-marker {
1802
1845
  display: block !important;
1803
- border-top: 2px solid var(--hr, #ddd) !important;
1846
+ border-top: 2px solid var(--preview-hr, #ddd) !important;
1804
1847
  text-indent: -9999px !important;
1805
1848
  height: 2px !important;
1806
1849
  }
@@ -5462,7 +5505,7 @@ var _OverType = class _OverType {
5462
5505
  this.container.setAttribute("data-theme", themeName);
5463
5506
  }
5464
5507
  if (themeObj && themeObj.colors) {
5465
- const cssVars = themeToCSSVars(themeObj.colors);
5508
+ const cssVars = themeToCSSVars(themeObj.colors, themeObj.previewColors);
5466
5509
  this.container.style.cssText += cssVars;
5467
5510
  }
5468
5511
  this.updatePreview();
@@ -5474,7 +5517,7 @@ var _OverType = class _OverType {
5474
5517
  const themeObj = getTheme(themeName);
5475
5518
  this.container.setAttribute("data-theme", themeName);
5476
5519
  if (themeObj && themeObj.colors) {
5477
- this.container.style.cssText = themeToCSSVars(themeObj.colors);
5520
+ this.container.style.cssText = themeToCSSVars(themeObj.colors, themeObj.previewColors);
5478
5521
  }
5479
5522
  this.updatePreview();
5480
5523
  }