diff --git a/CHANGES.md b/CHANGES.md index e40403fceb..59b435a727 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -38,6 +38,7 @@ - Fix wrong board size presets in Android [Taiga #12339](https://tree.taiga.io/project/penpot/issue/12339) - Fix problem with grid layout components and auto sizing [Github #7797](https://github.com/penpot/penpot/issues/7797) - Fix some alignments on inspect tab [Taiga #12915](https://tree.taiga.io/project/penpot/issue/12915) +- Fix problem with text editor maintaining previous styles [Taiga #12835](https://tree.taiga.io/project/penpot/issue/12835) - Fix color assets from shared libraries not appearing as assets in Selected colors panel [Taiga #12957](https://tree.taiga.io/project/penpot/issue/12957) - Fix CSS generated box-shadow property [Taiga #12997](https://tree.taiga.io/project/penpot/issue/12997) - Fix inner shadow selector on shadow token [Taiga #12951](https://tree.taiga.io/project/penpot/issue/12951) diff --git a/backend/deps.edn b/backend/deps.edn index 31b5e48096..cbf1176953 100644 --- a/backend/deps.edn +++ b/backend/deps.edn @@ -97,8 +97,8 @@ :jmx-remote {:jvm-opts ["-Dcom.sun.management.jmxremote" - "-Dcom.sun.management.jmxremote.port=9090" - "-Dcom.sun.management.jmxremote.rmi.port=9090" + "-Dcom.sun.management.jmxremote.port=9000" + "-Dcom.sun.management.jmxremote.rmi.port=9000" "-Dcom.sun.management.jmxremote.local.only=false" "-Dcom.sun.management.jmxremote.authenticate=false" "-Dcom.sun.management.jmxremote.ssl=false" diff --git a/frontend/text-editor/src/editor/controllers/SelectionController.js b/frontend/text-editor/src/editor/controllers/SelectionController.js index 2586aab148..add28d65d7 100644 --- a/frontend/text-editor/src/editor/controllers/SelectionController.js +++ b/frontend/text-editor/src/editor/controllers/SelectionController.js @@ -242,7 +242,6 @@ export class SelectionController extends EventTarget { continue; } let styleValue = element.style.getPropertyValue(styleName); - if (styleName === "font-family") { styleValue = sanitizeFontFamily(styleValue); } @@ -277,22 +276,29 @@ export class SelectionController extends EventTarget { this.#applyDefaultStylesToCurrentStyle(); const root = startNode.parentElement.parentElement.parentElement; this.#applyStylesFromElementToCurrentStyle(root); - // FIXME: I don't like this approximation. Having to iterate nodes twice - // is bad for performance. I think we need another way of "computing" - // the cascade. - for (const textNode of this.#textNodeIterator.iterateFrom( - startNode, - endNode, - )) { - const paragraph = textNode.parentElement.parentElement; + if (startNode === endNode) { + const paragraph = startNode.parentElement.parentElement; this.#applyStylesFromElementToCurrentStyle(paragraph); - } - for (const textNode of this.#textNodeIterator.iterateFrom( - startNode, - endNode, - )) { - const textSpan = textNode.parentElement; - this.#mergeStylesFromElementToCurrentStyle(textSpan); + const textSpan = startNode.parentElement; + this.#applyStylesFromElementToCurrentStyle(textSpan); + } else { + // FIXME: I don't like this approximation. Having to iterate nodes twice + // is bad for performance. I think we need another way of "computing" + // the cascade. + for (const textNode of this.#textNodeIterator.iterateFrom( + startNode, + endNode, + )) { + const paragraph = textNode.parentElement.parentElement; + this.#applyStylesFromElementToCurrentStyle(paragraph); + } + for (const textNode of this.#textNodeIterator.iterateFrom( + startNode, + endNode, + )) { + const textSpan = textNode.parentElement; + this.#mergeStylesFromElementToCurrentStyle(textSpan); + } } return this; }