Skip to content

Commit

Permalink
🐛 Fix wire:model behavior
Browse files Browse the repository at this point in the history
* fix #1, problem with wire:model
* ⚡️ Check if `wire:ignore` is already set

Co-authored-by: jfwittmann <[email protected]>
Co-authored-by: Marc Reichel <[email protected]>
  • Loading branch information
3 people committed Mar 27, 2022
1 parent 05f9acc commit 44540cf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions dist/alpine-autosize.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/alpine-autosize.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/alpine-autosize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/alpine-autosize.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
function Autosize(Alpine) {
Alpine.directive('autosize', (el, {}, { cleanup }) => {

if (!el.hasAttribute('wire:ignore') && el.hasAttribute('wire:model')) {

This comment has been minimized.

Copy link
@leobm

leobm Mar 30, 2022

Author Contributor

ok, that's a good idea to check if the atrribute wire:ignore is not already set. I had also first been thinking about it.

el.setAttribute('wire:ignore', '');
}

const previousResizeValue = el.style.resize;
el.style.resize = 'none';

const previousMinHeight = el.style.minHeight;
el.style.minHeight = el.getBoundingClientRect().height + 'px';

const handler = (event) => {
const element = event.target;
element.style.height = '4px';
Expand Down

0 comments on commit 44540cf

Please sign in to comment.