Markup mode: `colorify` does not detect existing `{color}(...)` wrapper when switching colors
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- react, typescript
- Área
- frontend
Línea de trabajo
Comienza leyendo packages/editor/src/bundle/toolbar/markup/MToolbarColors.tsx y la implementación relacionada de los comandos de markup; después, revisa el caso M3 en packages/editor/src/markup/commands/marks.test.ts. Actualiza la aserción de M3 para cubrir el reemplazo de un wrapper de color existente sin anidamiento y ejecuta las pruebas enfocadas de los comandos de markup. Verifica la interacción en Storybook: {blue}(text) cambia a {red}(text), mientras que al hacer clic en el mismo color se elimina el wrapper.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
In PR #840 the markup-mode colorify was switched from inlineWrapTo to toggleInlineMarkupFactory({before: '{${color}}(', after: ')'}) so that clicking the same color twice unwraps it.
The current implementation of toggleInlineMarkupFactory only detects an exact prefix/suffix match. That breaks color switching:
- doc:
{blue}(text), cursor insidetext - click Red → expected:
{red}(text) - actual: nested wrapping like
{red}({blue}(text)){red}(because{red}(is not present at the boundaries, so the helper falls through to the wrap branch).
The author marked this with a // TODO: @makhnatkin check markup mode in packages/editor/src/bundle/toolbar/markup/MToolbarColors.tsx.
A pinning test exists in packages/editor/src/markup/commands/marks.test.ts (case M3) that captures the current broken output, so a future fix will flip the assertion.
Suggested approaches
- Pre-strip any existing
{<word>}(...)wrapper around the selection before applyingcolorify. A small parser (regex^\{[a-z0-9-]+\}\(matching the prefix and\)$for the suffix) is sufficient. - Replace
toggleInlineMarkupFactoryfor color with a dedicated command that recognises the family of{*}(prefixes and either re-wraps with the new color or unwraps when the same color is clicked. - Reach back to
inlineWrapTo(no toggle), accepting that markup-mode color clicks always wrap. This loses the toggle-off UX but avoids the nested-wrapper bug.
Out of scope for #840
Fixing this requires command-level rework in markup mode and is independent from the wysiwyg toggle fix. PR #840 ships with the pinning test M3 documenting the known limitation; this issue tracks the follow-up.
Acceptance
- M3 in
packages/editor/src/markup/commands/marks.test.tsflips to assert the correct unwrapped/replaced result. - Storybook smoke: in markup mode,
{blue}(text)→ click Red →{red}(text)(no nesting).
- Lenguaje dominante
- TypeScript
- Estrellas
- 428
- Forks
- 48
- Merge medio
- 5 d 15 h
- PR fusionados (30 d)
- 47
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de gravity-ui/markdown-editor
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
gravity-ui/markdown-editor#1452 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
gravity-ui/markdown-editor#1293 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
gravity-ui/markdown-editor#1450 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
gravity-ui/markdown-editor#1331 ·
Los mantenedores suelen responder en 1 día
-
Shared `slotsTokenizer` for directive blocksPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
gravity-ui/markdown-editor#1301 ·
Los mantenedores suelen responder en 1 día
Todos los issues de gravity-ui/markdown-editor
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
tintinweb/pi-subagents#459 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
danielmiessler/LifeOS#2830 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
freshframework/fresh#3920 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
area: client enhancement priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
opensro-dev/opensro#3681 ·
Los mantenedores suelen responder en 1 día