overtype 1.1.7 → 1.1.8

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 v1.1.7
2
+ * OverType v1.1.8
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author Demo User
@@ -1323,6 +1323,7 @@ function generateStyles(options = {}) {
1323
1323
  const {
1324
1324
  fontSize = "14px",
1325
1325
  lineHeight = 1.6,
1326
+ /* System-first, guaranteed monospaced; avoids Android 'ui-monospace' pitfalls */
1326
1327
  fontFamily = '"SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Code", Consolas, "Roboto Mono", "Noto Sans Mono", "Droid Sans Mono", "Ubuntu Mono", "DejaVu Sans Mono", "Liberation Mono", "Courier New", Courier, monospace',
1327
1328
  padding = "20px",
1328
1329
  theme = null,
@@ -1386,7 +1387,6 @@ function generateStyles(options = {}) {
1386
1387
 
1387
1388
  /* Font properties - any difference breaks alignment */
1388
1389
  font-family: ${fontFamily} !important;
1389
- font-synthesis: none !important; /* no faux bold/italic width drift */
1390
1390
  font-variant-ligatures: none !important; /* keep metrics stable for code */
1391
1391
  font-size: var(--instance-font-size, ${fontSize}) !important;
1392
1392
  line-height: var(--instance-line-height, ${lineHeight}) !important;
@@ -1782,6 +1782,23 @@ function generateStyles(options = {}) {
1782
1782
  margin: 0 2px;
1783
1783
  }
1784
1784
  }
1785
+
1786
+ /* Plain mode - hide preview and show textarea text */
1787
+ .overtype-container.plain-mode .overtype-preview {
1788
+ display: none !important;
1789
+ }
1790
+
1791
+ .overtype-container.plain-mode .overtype-input {
1792
+ color: var(--text, #0d3b66) !important;
1793
+ /* Use system font stack for better plain text readability */
1794
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
1795
+ "Helvetica Neue", Arial, sans-serif !important;
1796
+ }
1797
+
1798
+ /* Ensure textarea remains transparent in overlay mode */
1799
+ .overtype-container:not(.plain-mode) .overtype-input {
1800
+ color: transparent !important;
1801
+ }
1785
1802
 
1786
1803
  ${mobileStyles}
1787
1804
  `;
@@ -1845,6 +1862,10 @@ var taskListIcon = `<svg viewBox="0 0 18 18">
1845
1862
  <rect stroke="currentColor" fill="none" stroke-width="1.5" x="2" y="13" width="3" height="3" rx="0.5"></rect>
1846
1863
  <polyline stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" points="2.65 9.5 3.5 10.5 5 8.5"></polyline>
1847
1864
  </svg>`;
1865
+ var eyeIcon = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1866
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" fill="none"></path>
1867
+ <circle cx="12" cy="12" r="3" fill="none"></circle>
1868
+ </svg>`;
1848
1869
 
1849
1870
  // src/toolbar.js
1850
1871
  var Toolbar = class {
@@ -1876,7 +1897,9 @@ var Toolbar = class {
1876
1897
  { separator: true },
1877
1898
  { name: "bulletList", icon: bulletListIcon, title: "Bullet List", action: "toggleBulletList" },
1878
1899
  { name: "orderedList", icon: orderedListIcon, title: "Numbered List", action: "toggleNumberedList" },
1879
- { name: "taskList", icon: taskListIcon, title: "Task List", action: "toggleTaskList" }
1900
+ { name: "taskList", icon: taskListIcon, title: "Task List", action: "toggleTaskList" },
1901
+ { separator: true },
1902
+ { name: "togglePlain", icon: eyeIcon, title: "Show plain textarea", action: "toggle-plain" }
1880
1903
  ];
1881
1904
  buttonConfig.forEach((config) => {
1882
1905
  if (config.separator) {
@@ -1957,6 +1980,10 @@ var Toolbar = class {
1957
1980
  case "toggleTaskList":
1958
1981
  toggleTaskList(textarea);
1959
1982
  break;
1983
+ case "toggle-plain":
1984
+ const isPlain = this.editor.container.classList.contains("plain-mode");
1985
+ this.editor.showPlainTextarea(!isPlain);
1986
+ break;
1960
1987
  }
1961
1988
  textarea.dispatchEvent(new Event("input", { bubbles: true }));
1962
1989
  } catch (error) {
@@ -2005,6 +2032,9 @@ var Toolbar = class {
2005
2032
  case "h3":
2006
2033
  isActive = activeFormats.includes("header-3");
2007
2034
  break;
2035
+ case "togglePlain":
2036
+ isActive = !this.editor.container.classList.contains("plain-mode");
2037
+ break;
2008
2038
  }
2009
2039
  button.classList.toggle("active", isActive);
2010
2040
  button.setAttribute("aria-pressed", isActive.toString());
@@ -2253,7 +2283,8 @@ var _OverType = class _OverType {
2253
2283
  // Typography
2254
2284
  fontSize: "14px",
2255
2285
  lineHeight: 1.6,
2256
- fontFamily: "ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', 'Liberation Mono', monospace",
2286
+ /* System-first, guaranteed monospaced; avoids Android 'ui-monospace' pitfalls */
2287
+ fontFamily: '"SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Code", Consolas, "Roboto Mono", "Noto Sans Mono", "Droid Sans Mono", "Ubuntu Mono", "DejaVu Sans Mono", "Liberation Mono", "Courier New", Courier, monospace',
2257
2288
  padding: "16px",
2258
2289
  // Mobile styles
2259
2290
  mobile: {
@@ -2731,6 +2762,26 @@ var _OverType = class _OverType {
2731
2762
  this.statsBar = null;
2732
2763
  }
2733
2764
  }
2765
+ /**
2766
+ * Show or hide the plain textarea (toggle overlay visibility)
2767
+ * @param {boolean} show - true to show plain textarea (hide overlay), false to show overlay
2768
+ * @returns {boolean} Current plain textarea state
2769
+ */
2770
+ showPlainTextarea(show) {
2771
+ if (show) {
2772
+ this.container.classList.add("plain-mode");
2773
+ } else {
2774
+ this.container.classList.remove("plain-mode");
2775
+ }
2776
+ if (this.toolbar) {
2777
+ const toggleBtn = this.container.querySelector('[data-action="toggle-plain"]');
2778
+ if (toggleBtn) {
2779
+ toggleBtn.classList.toggle("active", !show);
2780
+ toggleBtn.title = show ? "Show markdown preview" : "Show plain textarea";
2781
+ }
2782
+ }
2783
+ return show;
2784
+ }
2734
2785
  /**
2735
2786
  * Destroy the editor instance
2736
2787
  */