From 5f38d52f20126fb92091d831e563f6cce288ae27 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 2 Oct 2025 18:13:47 +0300 Subject: [PATCH 1/4] feat(math): support font size adjustment (closes #7172) --- packages/ckeditor5-math/src/mathediting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-math/src/mathediting.ts b/packages/ckeditor5-math/src/mathediting.ts index bd026829c..166b209e4 100644 --- a/packages/ckeditor5-math/src/mathediting.ts +++ b/packages/ckeditor5-math/src/mathediting.ts @@ -59,7 +59,7 @@ export default class MathEditing extends Plugin { allowWhere: '$text', isInline: true, isObject: true, - allowAttributes: [ 'equation', 'type', 'display' ] + allowAttributes: [ 'equation', 'type', 'display', 'fontSize' ] } ); schema.register( 'mathtex-display', { From d49ce7c2894654ace5217ef6c3e904f7310e1a7a Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 2 Oct 2025 18:32:46 +0300 Subject: [PATCH 2/4] feat(math): support more attributes --- packages/ckeditor5-math/src/mathediting.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ckeditor5-math/src/mathediting.ts b/packages/ckeditor5-math/src/mathediting.ts index 166b209e4..a5f1a11db 100644 --- a/packages/ckeditor5-math/src/mathediting.ts +++ b/packages/ckeditor5-math/src/mathediting.ts @@ -59,12 +59,12 @@ export default class MathEditing extends Plugin { allowWhere: '$text', isInline: true, isObject: true, - allowAttributes: [ 'equation', 'type', 'display', 'fontSize' ] + allowAttributes: [ 'equation', 'type', 'display', 'fontSize', 'fontColor', 'fontBackgroundColor' ] } ); schema.register( 'mathtex-display', { inheritAllFrom: '$blockObject', - allowAttributes: [ 'equation', 'type', 'display' ] + allowAttributes: [ 'equation', 'type', 'display', 'fontSize', 'fontColor' ] } ); } From 7c30e2b4f6ed36923284ceef536d55781c6d27dc Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 2 Oct 2025 20:50:46 +0300 Subject: [PATCH 3/4] feat(math): inherit attributes from selection --- packages/ckeditor5-math/src/mathcommand.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/ckeditor5-math/src/mathcommand.ts b/packages/ckeditor5-math/src/mathcommand.ts index 63671f437..b6126f42f 100644 --- a/packages/ckeditor5-math/src/mathcommand.ts +++ b/packages/ckeditor5-math/src/mathcommand.ts @@ -33,10 +33,18 @@ export default class MathCommand extends Command { { equation, type, display } ); } else { + const selection = this.editor.model.document.selection; + // Create new model element mathtex = writer.createElement( display ? 'mathtex-display' : 'mathtex-inline', - { equation, type: outputType, display } + { + // Inherit all attributes from selection (e.g. color, background color, size). + ...Object.fromEntries( selection.getAttributes() ), + equation, + type: outputType, + display, + } ); } model.insertContent( mathtex ); From dd477258a9e239e6cc28cc0ccdb100fb12f36af7 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 2 Oct 2025 21:35:54 +0300 Subject: [PATCH 4/4] docs(guide): document formatting equations --- .../Note Types/Text/Math Equations.html | 20 +++++++++++-------- .../User Guide/Scripting/Logging.html | 6 +++--- .../Note Types/Text/Math Equations.md | 18 +++++++++++------ 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Math Equations.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Math Equations.html index dd41d19ab..598f08cc7 100644 --- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Math Equations.html +++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Math Equations.html @@ -6,12 +6,6 @@ the button from the Formatting toolbar (generally found under the Insert buttons).

-

If inserting equations frequently, using the Ctrl+M keyboard - shortcut can be more comfortable. Alternatively, type $$ or \[ to - trigger the popup directly.

-

There is currently no quick way to insert an equation, such as surrounding - it with $ or pressing Ctrl+M on an already - typed-out equation.

The mathematical expression must be written in the TeX format. There is no visual editor for the math equations, only a preview. 

Enabling Display mode will render the equation slightly bigger @@ -19,6 +13,12 @@ center it. Display mode equations will act as blocks (i.e. like paragraphs, or tables) and can be inserted for example in lists. Non-display equations can be part of the text.

+

Keyboard shortcuts

+

If inserting equations frequently, using the Ctrl+M keyboard + shortcut can be more comfortable. Alternatively, type $$ or \[ to + trigger the popup directly.

+

There is currently no quick way to turn an already typed-out equation, + such as surrounding it with $ or pressing Ctrl+M.

Supported math features

Technically we are using the KaTeX library which allows for a subset of the TeX format. To see the full list of supported features, consult the @@ -27,8 +27,12 @@ the official documentation.

Markdown support

Math equations will be preserved when exporting to or importing from Markdown, - surrounded by \( characters for inline math expressions, and $\) for + surrounded by $ characters for inline math expressions, and $$ for display mode.

If you notice any issue with the Markdown import/export for equations, feel free to report it while providing - the equation that causes issues.

\ No newline at end of file + the equation that causes issues.

+

Formatting the equation

+

It is possible to customize the font size and foreground color for both + inline and display-mode equations, just like any other text. For inline + equations, the background color/highlight can also be adjusted.

\ No newline at end of file diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Logging.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Logging.html index 8cf47c2c7..c7db77f63 100644 --- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Logging.html +++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Logging.html @@ -16,9 +16,9 @@

For logs that are not directly visible to the user, the standard console.log can be used as well.

    -
  • For front-end scripts, the log will be shown in the Developer Tools (also +
  • For front-end scripts, the log will be shown in the Developer Tools (also known as Inspect).
  • -
  • For back-end scripts, the log will be shown in the server output while +
  • For back-end scripts, the log will be shown in the server output while running but will not be visible in the Backend (server) logs.
  • + href="#root/_help_bnyigUA2UK7s">Backend (server) logs.
\ No newline at end of file diff --git a/docs/User Guide/User Guide/Note Types/Text/Math Equations.md b/docs/User Guide/User Guide/Note Types/Text/Math Equations.md index 0bcb5af7a..c8cfa94e5 100644 --- a/docs/User Guide/User Guide/Note Types/Text/Math Equations.md +++ b/docs/User Guide/User Guide/Note Types/Text/Math Equations.md @@ -3,20 +3,26 @@ Within text notes, it's possible to enter mathematical equations using the button from the Formatting toolbar (generally found under the Insert buttons). -If inserting equations frequently, using the Ctrl+M keyboard shortcut can be more comfortable. Alternatively, type `$$` or `\[` to trigger the popup directly. - -There is currently no quick way to insert an equation, such as surrounding it with `$` or pressing Ctrl+M on an already typed-out equation. - The mathematical expression must be written in the TeX format. There is no visual editor for the math equations, only a preview.  Enabling _Display mode_ will render the equation slightly bigger (especially if using big operators such as summation, or fractions) and center it. Display mode equations will act as blocks (i.e. like paragraphs, or tables) and can be inserted for example in lists. Non-display equations can be part of the text. +## Keyboard shortcuts + +If inserting equations frequently, using the Ctrl+M keyboard shortcut can be more comfortable. Alternatively, type `$$` or `\[` to trigger the popup directly. + +There is currently no quick way to turn an already typed-out equation, such as surrounding it with `$` or pressing Ctrl+M. + ## Supported math features Technically we are using the KaTeX library which allows for a subset of the TeX format. To see the full list of supported features, consult the [Supported Functions](https://katex.org/docs/supported) and the [Support Table](https://katex.org/docs/support_table) from the official documentation. ## Markdown support -Math equations will be preserved when exporting to or importing from Markdown, surrounded by `\(` characters for inline math expressions, and `$\)` for display mode. +Math equations will be preserved when exporting to or importing from Markdown, surrounded by `$` characters for inline math expressions, and `$$` for display mode. -If you notice any issue with the Markdown import/export for equations, feel free to [report](../../Troubleshooting/Reporting%20issues.md) it while providing the equation that causes issues. \ No newline at end of file +If you notice any issue with the Markdown import/export for equations, feel free to [report](../../Troubleshooting/Reporting%20issues.md) it while providing the equation that causes issues. + +## Formatting the equation + +It is possible to customize the font size and foreground color for both inline and display-mode equations, just like any other text. For inline equations, the background color/highlight can also be adjusted. \ No newline at end of file