Skip to content

TextArea expansion on more browsers #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/assets/javascripts/marksmith_controller-full.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions app/assets/javascripts/marksmith_controller-no-stimulus.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions dist/marksmith-core.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions dist/marksmith.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading