overtype 2.3.1 → 2.3.3

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.3.1
2
+ * OverType v2.3.3
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author David Miranda
@@ -5584,12 +5584,12 @@ var _OverType = class _OverType {
5584
5584
  const textarea = this.textarea;
5585
5585
  const preview = this.preview;
5586
5586
  const wrapper = this.wrapper;
5587
- const computed = window.getComputedStyle(textarea);
5588
- const paddingTop = parseFloat(computed.paddingTop);
5589
- const paddingBottom = parseFloat(computed.paddingBottom);
5590
- const scrollTop = textarea.scrollTop;
5587
+ const isPreviewMode = this.container.dataset.mode === "preview";
5588
+ const scrollTop = isPreviewMode ? preview.scrollTop : textarea.scrollTop;
5589
+ wrapper.style.setProperty("height", "auto", "important");
5590
+ preview.style.setProperty("height", "auto", "important");
5591
5591
  textarea.style.setProperty("height", "auto", "important");
5592
- let newHeight = textarea.scrollHeight;
5592
+ let newHeight = isPreviewMode ? preview.scrollHeight : textarea.scrollHeight;
5593
5593
  if (this.options.minHeight) {
5594
5594
  const minHeight = parseInt(this.options.minHeight);
5595
5595
  newHeight = Math.max(newHeight, minHeight);
@@ -5639,6 +5639,7 @@ var _OverType = class _OverType {
5639
5639
  showNormalEditMode() {
5640
5640
  this.container.dataset.mode = "normal";
5641
5641
  this.updatePreview();
5642
+ this._updateAutoHeight();
5642
5643
  requestAnimationFrame(() => {
5643
5644
  this.textarea.scrollTop = this.preview.scrollTop;
5644
5645
  this.textarea.scrollLeft = this.preview.scrollLeft;
@@ -5651,6 +5652,7 @@ var _OverType = class _OverType {
5651
5652
  */
5652
5653
  showPlainTextarea() {
5653
5654
  this.container.dataset.mode = "plain";
5655
+ this._updateAutoHeight();
5654
5656
  if (this.toolbar) {
5655
5657
  const toggleBtn = this.container.querySelector('[data-action="toggle-plain"]');
5656
5658
  if (toggleBtn) {
@@ -5667,6 +5669,7 @@ var _OverType = class _OverType {
5667
5669
  showPreviewMode() {
5668
5670
  this.container.dataset.mode = "preview";
5669
5671
  this.updatePreview();
5672
+ this._updateAutoHeight();
5670
5673
  return this;
5671
5674
  }
5672
5675
  /**