diff --git a/app/assets/javascripts/marksmith_controller-full.esm.js b/app/assets/javascripts/marksmith_controller-full.esm.js index 1f179de..d58dc6d 100644 --- a/app/assets/javascripts/marksmith_controller-full.esm.js +++ b/app/assets/javascripts/marksmith_controller-full.esm.js @@ -3262,12 +3262,24 @@ var MarksmithController = (function () { } connect() { + const naturallyStretchy = CSS && CSS.supports('field-sizing', 'content'); + subscribe(this.fieldElementTarget); // Install all the hotkeys on the page for (const el of document.querySelectorAll('[data-hotkey]')) { install(el); } + + // Workaround for browsers not supporting field-sizing css property + if (!naturallyStretchy) { + this.fieldElementTarget.style.overflowY = "initial"; + const fieldElement = this.fieldElementTarget; + this.fieldElementTarget.oninput = function() { + fieldElement.style.minHeight = ""; + fieldElement.style.minHeight = fieldElement.scrollHeight+ "px"; + }; + } } disconnect() { diff --git a/app/assets/javascripts/marksmith_controller-no-stimulus.esm.js b/app/assets/javascripts/marksmith_controller-no-stimulus.esm.js index c155f46..60472d6 100644 --- a/app/assets/javascripts/marksmith_controller-no-stimulus.esm.js +++ b/app/assets/javascripts/marksmith_controller-no-stimulus.esm.js @@ -2772,12 +2772,24 @@ var MarksmithController = (function (stimulus) { } connect() { + const naturallyStretchy = CSS && CSS.supports('field-sizing', 'content'); + subscribe(this.fieldElementTarget); // Install all the hotkeys on the page for (const el of document.querySelectorAll('[data-hotkey]')) { install(el); } + + // Workaround for browsers not supporting field-sizing css property + if (!naturallyStretchy) { + this.fieldElementTarget.style.overflowY = "initial"; + const fieldElement = this.fieldElementTarget; + this.fieldElementTarget.oninput = function() { + fieldElement.style.minHeight = ""; + fieldElement.style.minHeight = fieldElement.scrollHeight+ "px"; + }; + } } disconnect() { diff --git a/app/frontend/entrypoints/javascript/controllers/marksmith_controller.js b/app/frontend/entrypoints/javascript/controllers/marksmith_controller.js index 9d4fcf5..c499352 100644 --- a/app/frontend/entrypoints/javascript/controllers/marksmith_controller.js +++ b/app/frontend/entrypoints/javascript/controllers/marksmith_controller.js @@ -30,12 +30,24 @@ export default class extends Controller { } connect() { + const naturallyStretchy = CSS && CSS.supports('field-sizing', 'content'); + subscribe(this.fieldElementTarget) // Install all the hotkeys on the page for (const el of document.querySelectorAll('[data-hotkey]')) { install(el) } + + // Workaround for browsers not supporting field-sizing css property + if (!naturallyStretchy) { + this.fieldElementTarget.style.overflowY = "initial"; + const fieldElement = this.fieldElementTarget + this.fieldElementTarget.oninput = function() { + fieldElement.style.minHeight = ""; + fieldElement.style.minHeight = fieldElement.scrollHeight+ "px"; + }; + } } disconnect() { diff --git a/dist/marksmith-core.esm.js b/dist/marksmith-core.esm.js index 225389e..47202ff 100644 --- a/dist/marksmith-core.esm.js +++ b/dist/marksmith-core.esm.js @@ -456,12 +456,24 @@ class marksmith_controller extends Controller { } connect() { + const naturallyStretchy = CSS && CSS.supports('field-sizing', 'content'); + subscribe(this.fieldElementTarget); // Install all the hotkeys on the page for (const el of document.querySelectorAll('[data-hotkey]')) { install(el); } + + // Workaround for browsers not supporting field-sizing css property + if (!naturallyStretchy) { + this.fieldElementTarget.style.overflowY = "initial"; + const fieldElement = this.fieldElementTarget; + this.fieldElementTarget.oninput = function() { + fieldElement.style.minHeight = ""; + fieldElement.style.minHeight = fieldElement.scrollHeight+ "px"; + }; + } } disconnect() { diff --git a/dist/marksmith.esm.js b/dist/marksmith.esm.js index f5d66ab..4c802a9 100644 --- a/dist/marksmith.esm.js +++ b/dist/marksmith.esm.js @@ -3259,12 +3259,24 @@ class marksmith_controller extends Controller { } connect() { + const naturallyStretchy = CSS && CSS.supports('field-sizing', 'content'); + subscribe(this.fieldElementTarget); // Install all the hotkeys on the page for (const el of document.querySelectorAll('[data-hotkey]')) { install(el); } + + // Workaround for browsers not supporting field-sizing css property + if (!naturallyStretchy) { + this.fieldElementTarget.style.overflowY = "initial"; + const fieldElement = this.fieldElementTarget; + this.fieldElementTarget.oninput = function() { + fieldElement.style.minHeight = ""; + fieldElement.style.minHeight = fieldElement.scrollHeight+ "px"; + }; + } } disconnect() {