From fcfd9857d562391ee706a8d7518b95487bf91c50 Mon Sep 17 00:00:00 2001 From: shibao Date: Sun, 16 Apr 2023 01:12:07 -0400 Subject: [PATCH] remove maintain attrs --- assets/js/app.js | 3 +- assets/js/maintain_attrs.js | 22 ------------ .../core_components/context_content.html.heex | 1 - .../core_components/note_content.html.heex | 1 - .../core_components/step_content.html.heex | 1 - .../context_live/form_component.html.heex | 1 - .../live/note_live/form_component.html.heex | 1 - .../pipeline_live/form_component.html.heex | 1 - .../live/pipeline_live/show.html.heex | 1 - .../live/step_live/form_component.html.heex | 1 - priv/gettext/actions.pot | 28 +++++++-------- priv/gettext/de/LC_MESSAGES/actions.po | 28 +++++++-------- priv/gettext/de/LC_MESSAGES/default.po | 36 +++++++++---------- priv/gettext/de/LC_MESSAGES/prompts.po | 4 +-- priv/gettext/default.pot | 36 +++++++++---------- priv/gettext/en/LC_MESSAGES/actions.po | 28 +++++++-------- priv/gettext/en/LC_MESSAGES/default.po | 36 +++++++++---------- priv/gettext/en/LC_MESSAGES/prompts.po | 4 +-- priv/gettext/prompts.pot | 4 +-- 19 files changed, 103 insertions(+), 134 deletions(-) delete mode 100644 assets/js/maintain_attrs.js 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 @@