diff --git a/assets/js/app.js b/assets/js/app.js index c72ccd9..6caec9f 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -28,14 +28,13 @@ import { LiveSocket } from 'phoenix_live_view' import topbar from 'topbar' import Date from './date' import DateTime from './datetime' -import MaintainAttrs from './maintain_attrs' const csrfTokenElement = document.querySelector("meta[name='csrf-token']") let csrfToken if (csrfTokenElement) { csrfToken = csrfTokenElement.getAttribute('content') } const liveSocket = new LiveSocket('/live', Socket, { params: { _csrf_token: csrfToken }, - hooks: { Date, DateTime, MaintainAttrs } + hooks: { Date, DateTime } }) // Show progress bar on live navigation and form submits diff --git a/assets/js/maintain_attrs.js b/assets/js/maintain_attrs.js deleted file mode 100644 index ae1a194..0000000 --- a/assets/js/maintain_attrs.js +++ /dev/null @@ -1,22 +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 () { - if (this.el && this.el.getAttribute('data-attrs')) { - return this.el.getAttribute('data-attrs').split(', ') - } else { - return [] - } - }, - beforeUpdate () { - if (this.el) { - this.prevAttrs = this.attrs().map(name => [name, this.el.getAttribute(name)]) - } - }, - updated () { - if (this.el) { - this.prevAttrs.forEach(([name, val]) => this.el.setAttribute(name, val)) - } - } -} diff --git a/lib/memex_web/components/core_components/context_content.html.heex b/lib/memex_web/components/core_components/context_content.html.heex index 4692f2e..7f2c6d7 100644 --- a/lib/memex_web/components/core_components/context_content.html.heex +++ b/lib/memex_web/components/core_components/context_content.html.heex @@ -1,7 +1,6 @@