overtype 1.1.3 → 1.1.5

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 v1.1.3
2
+ * OverType v1.1.4
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author Demo User
@@ -129,7 +129,8 @@ var OverType = (() => {
129
129
  * @returns {string|null} Parsed code fence or null
130
130
  */
131
131
  static parseCodeBlock(html) {
132
- if (html.match(/^```(\s*|\w*)$/)) {
132
+ const codeFenceRegex = /^`{3}[^`]*$/;
133
+ if (codeFenceRegex.test(html)) {
133
134
  return `<div><span class="code-fence">${html}</span></div>`;
134
135
  }
135
136
  return null;
@@ -161,7 +162,7 @@ var OverType = (() => {
161
162
  * @returns {string} HTML with code styling
162
163
  */
163
164
  static parseInlineCode(html) {
164
- return html.replace(/`(.+?)`/g, '<code><span class="syntax-marker">`</span>$1<span class="syntax-marker">`</span></code>');
165
+ return html.replace(new RegExp("(?<!`)(`+)(?!`)((?:(?!\\1).)+?)(\\1)(?!`)", "g"), '<code><span class="syntax-marker">$1</span>$2<span class="syntax-marker">$3</span></code>');
165
166
  }
166
167
  /**
167
168
  * Parse links
@@ -1441,6 +1442,7 @@ ${blockSuffix}` : suffix;
1441
1442
  /* Overflow */
1442
1443
  overflow-y: auto !important;
1443
1444
  overflow-x: auto !important;
1445
+ overscroll-behavior: none !important;
1444
1446
  scrollbar-width: auto !important;
1445
1447
  scrollbar-gutter: auto !important;
1446
1448
 
@@ -2506,6 +2508,8 @@ ${blockSuffix}` : suffix;
2506
2508
  while (currentDiv && currentDiv !== closeParent) {
2507
2509
  if (currentDiv.tagName === "DIV") {
2508
2510
  currentDiv.classList.add("code-block-line");
2511
+ const plainText = currentDiv.textContent;
2512
+ currentDiv.textContent = plainText;
2509
2513
  }
2510
2514
  currentDiv = currentDiv.nextElementSibling;
2511
2515
  if (!currentDiv)