Skip to content

Fix empty latex ck5#1138

Merged
carla-at-wiris merged 2 commits intorelease/v8.15.2from
fix/empty-latex-ck5
Feb 17, 2026
Merged

Fix empty latex ck5#1138
carla-at-wiris merged 2 commits intorelease/v8.15.2from
fix/empty-latex-ck5

Conversation

@carla-at-wiris
Copy link
Contributor

@carla-at-wiris carla-at-wiris commented Feb 17, 2026

Description

This PR fixes the following:

  • Empty LaTeX $$$$ was not being recognized, hence not adding LaTeX content when inserting a formula in between the $$.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How should be tested? (Manual or Automated Tests)

Go to the staging demo and validate that the bug is fixed.

@carla-at-wiris carla-at-wiris self-assigned this Feb 17, 2026
@carla-at-wiris carla-at-wiris added type:bug Something isn't working package:ckeditor5 Issues involving the plugin for CKEditor 5 labels Feb 17, 2026
@carla-at-wiris carla-at-wiris changed the base branch from master to release/v8.15.2 February 17, 2026 08:06
@carla-at-wiris carla-at-wiris changed the title Fix/empty latex ck5 Fix empty latex ck5 Feb 17, 2026
Comment on lines +11612 to +11613
const latex = acceptedLatex !== undefined && acceptedLatex !== standardResult?.latex ? acceptedLatex : standardResult?.latex;
if (latex === undefined && acceptedLatex === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estas condiciones son super complejas de entender, sobre todo porque latex ya contiene incluye de alguna forma a acceptedLatex, sin embargo en el if se comprueban a ambos. Me parece retorcido, ¿quizás con un comentario se pueda mejorar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta comprobación es necesaria, ya que, aunque puedan depender entre ellas, también pueden ser undefined de forma independiente

Aun así, este fichero es el compilado y sobre el que no tenemos ningún control. El que interesa revisar es todo lo que hay fuera de la carpeta dist, que ahora mismo es solo el integration.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le añado un comentario al fichero nuestro explicando esto

Copy link
Contributor

@jgonzalez-at-wiris jgonzalez-at-wiris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En general la solución no me gusta porque estamos duplicando lógica de algún modo: latex y acceptedLatex. De todas formas veo que eso ya estaba y siendo sincero, el proyecto necesita una revisión general, no vamos a rasgarnos las vestiduras por este detalle ahora mismo.

Echo en falta que el código respire en algunos sitios (saltos de línea tras bloques de código). Por lo demás poco más, he dejado un comentario por ahi!

Comment on lines +11613 to +11615
// Use explicit undefined check to allow empty LaTeX strings.
const latex = acceptedLatex !== undefined && acceptedLatex !== standardResult?.latex ? acceptedLatex : standardResult?.latex;
if (latex === undefined && acceptedLatex === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veo que esto es código repetido de lo que hay en index.js. Me imagino el motivo, pero me gustaría saber si para el furuo, esto es algo que se podríia evitar (el builder posiblemente ya sepa cómo consturir la versión umd y la "normal")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo lo que hay en la carpeta dist es el compilado autogenerado por ck5 a partir de nuestro plugin. No tenemos mucho que decir/hacer allí

@carla-at-wiris carla-at-wiris merged commit 8726379 into release/v8.15.2 Feb 17, 2026
15 checks passed
@carla-at-wiris carla-at-wiris deleted the fix/empty-latex-ck5 branch February 17, 2026 10:06
jgonzalez-at-wiris pushed a commit that referenced this pull request Feb 17, 2026
* fix: Empty LaTeX in CKEditor 5

* docs: Update code docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package:ckeditor5 Issues involving the plugin for CKEditor 5 type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants