OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
replace morphdom by idiomorph - used by turbo
ulfertsbb66321e9f27
diff --git a/frontend/package-lock.json b/frontend/package-lock.jsonindex 46b33531fc5..f6c90ff6d8b 100644--- a/frontend/package-lock.json+++ b/frontend/package-lock.json@@ -73,6 +73,7 @@"glob": "^7.1.4","hammerjs": "^2.0.8","i18n-js": "^4.3.0",+ "idiomorph": "^0.3.0","jquery": "^3.5.1","jquery-ui": "1.13.2","jquery-ujs": "^1.2.2",@@ -84,7 +85,6 @@"mime": "^2.5.2","moment": "^2.29.4","moment-timezone": "^0.5.43",- "morphdom": "^2.7.2","mousetrap": "~1.6.3","ng-dynamic-component": "^10.7.0","ng2-charts": "^4.1.1",@@ -12452,6 +12452,11 @@"postcss": "^8.1.0"}},+ "node_modules/idiomorph": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/idiomorph/-/idiomorph-0.3.0.tgz",+ "integrity": "sha512-UhV1Ey5xCxIwR9B+OgIjQa+1Jx99XQ1vQHUsKBU1RpQzCx1u+b+N6SOXgf5mEJDqemUI/ffccu6+71l2mJUsRA=="+ },"node_modules/ieee754": {"version": "1.2.1","resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",@@ -15235,11 +15240,6 @@"node": "*"}},- "node_modules/morphdom": {- "version": "2.7.2",- "resolved": "https://registry.npmjs.org/morphdom/-/morphdom-2.7.2.tgz",- "integrity": "sha512-Dqb/lHFyTi7SZpY0a5R4I/0Edo+iPMbaUexsHHsLAByyixCDiLHPHyVoKVmrpL0THcT7V9Cgev9y21TQYq6wQg=="- },"node_modules/mousetrap": {"version": "1.6.5","resolved": "https://registry.npmjs.org/mousetrap/-/mousetrap-1.6.5.tgz",@@ -30393,6 +30393,11 @@"resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz","integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA=="},+ "idiomorph": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/idiomorph/-/idiomorph-0.3.0.tgz",+ "integrity": "sha512-UhV1Ey5xCxIwR9B+OgIjQa+1Jx99XQ1vQHUsKBU1RpQzCx1u+b+N6SOXgf5mEJDqemUI/ffccu6+71l2mJUsRA=="+ },"ieee754": {"version": "1.2.1","resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",@@ -32449,11 +32454,6 @@"moment": "^2.29.4"}},- "morphdom": {- "version": "2.7.2",- "resolved": "https://registry.npmjs.org/morphdom/-/morphdom-2.7.2.tgz",- "integrity": "sha512-Dqb/lHFyTi7SZpY0a5R4I/0Edo+iPMbaUexsHHsLAByyixCDiLHPHyVoKVmrpL0THcT7V9Cgev9y21TQYq6wQg=="- },"mousetrap": {"version": "1.6.5","resolved": "https://registry.npmjs.org/mousetrap/-/mousetrap-1.6.5.tgz",diff --git a/frontend/package.json b/frontend/package.jsonindex 98a43a8119f..e0a5906fc5e 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -124,6 +124,7 @@"glob": "^7.1.4","hammerjs": "^2.0.8","i18n-js": "^4.3.0",+ "idiomorph": "^0.3.0","jquery": "^3.5.1","jquery-ui": "1.13.2","jquery-ujs": "^1.2.2",@@ -135,7 +136,6 @@"mime": "^2.5.2","moment": "^2.29.4","moment-timezone": "^0.5.43",- "morphdom": "^2.7.2","mousetrap": "~1.6.3","ng-dynamic-component": "^10.7.0","ng2-charts": "^4.1.1",diff --git a/frontend/src/stimulus/controllers/dynamic/permanent-on-focus.controller.ts b/frontend/src/stimulus/controllers/dynamic/permanent-on-focus.controller.tsnew file mode 100644index 00000000000..e69de29bb2ddiff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/progress/preview-progress.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/progress/preview-progress.controller.tsindex 5f3f479c957..00b4c2238b7 100644--- a/frontend/src/stimulus/controllers/dynamic/work-packages/progress/preview-progress.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/progress/preview-progress.controller.ts@@ -30,7 +30,7 @@import { Controller } from '@hotwired/stimulus';import { debounce } from 'lodash';-import morphdom from 'morphdom';+import Idiomorph from 'idiomorph/dist/idiomorph.cjs';interface TurboBeforeFrameRenderEventDetail {render:(currentElement:HTMLElement, newElement:HTMLElement) => void;@@ -56,14 +56,16 @@ export default class PreviewProgressController extends Controller {// See https://github.com/hotwired/turbo/issues/1161 . Once the issue is solved, we can remove// this code and just use <turbo-frame refresh="morph"> instead.this.frameMorphRenderer = (event:CustomEvent<TurboBeforeFrameRenderEventDetail>) => {- event.detail.render = (currentElement:HTMLElement, newElement:HTMLElement) => {- morphdom(currentElement, newElement, {- childrenOnly: true,- onBeforeElUpdated: (fromEl) => {- return !fromEl.hasAttribute('data-turbo-permanent');- },- });- };+ event.detail.render = (currentElement:HTMLElement, newElement:HTMLElement) => {+ Idiomorph.morph(currentElement, newElement, {+ morphStyle: 'innerHTML',+ callbacks: {+ beforeNodeMorphed: (oldNode:HTMLElement) => {+ return !oldNode.hasAttribute('data-turbo-permanent');+ },+ },+ });+ };};this.togglePermanentAttribute = (event:FocusEvent) => {diff --git a/frontend/src/typings/idiomorph.d.ts b/frontend/src/typings/idiomorph.d.tsnew file mode 100644index 00000000000..1333b8b7be5--- /dev/null+++ b/frontend/src/typings/idiomorph.d.ts@@ -0,0 +1,52 @@+/*+ * -- copyright+ * OpenProject is an open source project management software.+ * Copyright (C) 2024 the OpenProject GmbH+ *+ * This program is free software; you can redistribute it and/or+ * modify it under the terms of the GNU General Public License version 3.+ *+ * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+ * Copyright (C) 2006-2013 Jean-Philippe Lang+ * Copyright (C) 2010-2013 the ChiliProject Team+ *+ * This program is free software; you can redistribute it and/or+ * modify it under the terms of the GNU General Public License+ * as published by the Free Software Foundation; either version 2+ * of the License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+ *+ * See COPYRIGHT and LICENSE files for more details.+ * +++ */++declare module 'idiomorph/dist/idiomorph.cjs' {+ export const Idiomorph:{+ morph(oldNode:Element|Document, newContent?:string|Element|Iterable<Element>|null, options?:{+ morphStyle?:'innerHTML'|'outerHTML';+ ignoreActive?:boolean;+ ignoreActiveValue?:boolean;+ head?:{+ style?:'merge'|'append'|'morph'|'none';+ };+ callbacks?:{+ beforeNodeAdded?:(node:ChildNode) => void|boolean;+ afterNodeAdded?:(node:ChildNode) => void;+ beforeNodeMorphed?:(oldNode:Element, newNode:Element) => void|boolean;+ afterNodeMorphed?:(oldNode:Element, newNode:Element) => void;+ beforeNodeRemoved?:(node:ChildNode) => void|boolean;+ afterNodeRemoved?:(node:ChildNode) => void;+ };+ })+ };++ export = Idiomorph;+}