remove maintain attrs

This commit is contained in:
2023-04-16 01:10:45 -04:00
parent ab1a288928
commit b85b1735c0
25 changed files with 403 additions and 421 deletions

View File

@ -25,7 +25,6 @@ import 'phoenix_html'
import { Socket } from 'phoenix'
import { LiveSocket } from 'phoenix_live_view'
import topbar from 'topbar'
import MaintainAttrs from './maintain_attrs'
import ShotLogChart from './shot_log_chart'
import Date from './date'
import DateTime from './datetime'
@ -33,7 +32,7 @@ import DateTime from './datetime'
const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute('content')
const liveSocket = new LiveSocket('/live', Socket, {
params: { _csrf_token: csrfToken },
hooks: { Date, DateTime, MaintainAttrs, ShotLogChart }
hooks: { Date, DateTime, ShotLogChart }
})
// Show progress bar on live navigation and form submits

View File

@ -1,11 +0,0 @@
// maintain user adjusted attributes, like textbox length on phoenix liveview
// update. https://github.com/phoenixframework/phoenix_live_view/issues/1011
export default {
attrs () {
const attrs = this.el.getAttribute('data-attrs')
if (attrs) { return attrs.split(', ') } else { return [] }
},
beforeUpdate () { this.prevAttrs = this.attrs().map(name => [name, this.el.getAttribute(name)]) },
updated () { this.prevAttrs.forEach(([name, val]) => this.el.setAttribute(name, val)) }
}