Skip to content

Commit

Permalink
Merge pull request #8 from marcreichel/fix/#1-livewire-model
Browse files Browse the repository at this point in the history
🐛 Fixes wire:model problem
  • Loading branch information
marcreichel committed Aug 14, 2022
2 parents 056d08b + 3725b63 commit 5fc1bfd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
14 changes: 13 additions & 1 deletion 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.

15 changes: 13 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
function Autosize(Alpine) {
Alpine.directive('autosize', (el, {}, { cleanup }) => {

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

const attributes = Array.from(el.attributes);

let hasWireModel = false;

for (let { nodeName } of attributes) {
if (nodeName === 'wire:model' || nodeName.startsWith('wire:model.')) {
hasWireModel = true;
break;
}
}

if (!el.hasAttribute('wire:ignore') && hasWireModel) {
el.setAttribute('wire:ignore', '');
}

Expand Down

0 comments on commit 5fc1bfd

Please sign in to comment.