ckeditor5-math
Advanced tools
Comparing version 34.1.0 to 34.1.1
@@ -7,2 +7,23 @@ # Changelog | ||
## [34.1.1](https://github.com/isaul32/ckeditor5-math/compare/v34.1.0...v34.1.1) (2022-08-03) | ||
- New configuration setting, `katexRenderOptions` (optional) - for KaTeX engines. Accepts object of `katex.render()` / `katex.renderToString()` [options](https://katex.org/docs/options.html): | ||
```js | ||
InlineEditor.defaultConfig = { | ||
// ... | ||
math: { | ||
engine: 'katex' | ||
katexRenderOptions: { | ||
macros: { | ||
"\\neq": "\\mathrel{\\char`≠}", | ||
}, | ||
}, | ||
} | ||
} | ||
``` | ||
via PR [#64](https://github.com/isaul32/ckeditor5-math/pull/64) by [Tony | ||
Narlock](https://www.git-pull.com). | ||
## [34.1.0](https://github.com/isaul32/ckeditor5-math/compare/v34.0.0...v34.1.0) (2022-06-21) | ||
@@ -12,2 +33,5 @@ | ||
notes](https://github.com/ckeditor/ckeditor5/blob/v34.1.0/CHANGELOG.md)) | ||
- Changelog: | ||
- Begin adding dates to releases | ||
- Remove _(current)_, which was being applied to old releases incorrectly up to last release | ||
@@ -14,0 +38,0 @@ ## [34.0.0](https://github.com/isaul32/ckeditor5-math/compare/v33.0.0...v34.0.0) (2022-05-12) |
{ | ||
"name": "ckeditor5-math", | ||
"version": "34.1.0", | ||
"version": "34.1.1", | ||
"description": "Math feature for CKEditor 5.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -118,3 +118,4 @@ # CKEditor 5 mathematical feature · [](https://github.com/isaul32/ckeditor5-math/blob/master/LICENSE) [](https://www.npmjs.com/package/ckeditor5-math) | ||
previewClassName: [], // Class names to add to previews | ||
popupClassName: [] // Class names to add to math popup balloon | ||
popupClassName: [], // Class names to add to math popup balloon | ||
katexRenderOptions: {} // KaTeX only options for katex.render(ToString) | ||
} | ||
@@ -139,2 +140,18 @@ } | ||
- `katexRenderOptions` - pass [options](https://katex.org/docs/options.html). | ||
```js | ||
InlineEditor.defaultConfig = { | ||
// ... | ||
math: { | ||
engine: 'katex' | ||
katexRenderOptions: { | ||
macros: { | ||
"\\neq": "\\mathrel{\\char`≠}", | ||
}, | ||
}, | ||
} | ||
} | ||
``` | ||
**Custom typesetting** | ||
@@ -141,0 +158,0 @@ |
@@ -35,3 +35,4 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; | ||
previewClassName: [], | ||
popupClassName: [] | ||
popupClassName: [], | ||
katexRenderOptions: {} | ||
} ); | ||
@@ -172,3 +173,4 @@ } | ||
renderEquation( equation, domElement, mathConfig.engine, mathConfig.lazyLoad, display, false ); | ||
renderEquation( equation, domElement, mathConfig.engine, mathConfig.lazyLoad, display, false, mathConfig.previewClassName, | ||
null, mathConfig.katexRenderOptions ); | ||
@@ -175,0 +177,0 @@ return domElement; |
@@ -81,3 +81,4 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; | ||
mathConfig.previewClassName, | ||
mathConfig.popupClassName | ||
mathConfig.popupClassName, | ||
mathConfig.katexRenderOptions | ||
); | ||
@@ -84,0 +85,0 @@ |
@@ -26,3 +26,3 @@ import View from '@ckeditor/ckeditor5-ui/src/view'; | ||
export default class MainFormView extends View { | ||
constructor( locale, engine, lazyLoad, previewEnabled, previewUid, previewClassName, popupClassName ) { | ||
constructor( locale, engine, lazyLoad, previewEnabled, previewUid, previewClassName, popupClassName, katexRenderOptions ) { | ||
super( locale ); | ||
@@ -57,3 +57,3 @@ | ||
// Math element | ||
this.mathView = new MathView( engine, lazyLoad, locale, previewUid, previewClassName ); | ||
this.mathView = new MathView( engine, lazyLoad, locale, previewUid, previewClassName, katexRenderOptions ); | ||
this.mathView.bind( 'display' ).to( this.displayButtonView, 'isOn' ); | ||
@@ -60,0 +60,0 @@ |
@@ -6,3 +6,3 @@ import View from '@ckeditor/ckeditor5-ui/src/view'; | ||
export default class MathView extends View { | ||
constructor( engine, lazyLoad, locale, previewUid, previewClassName ) { | ||
constructor( engine, lazyLoad, locale, previewUid, previewClassName, katexRenderOptions ) { | ||
super( locale ); | ||
@@ -13,3 +13,3 @@ | ||
this.previewUid = previewUid; | ||
this.previewClassName = previewClassName; | ||
this.katexRenderOptions = katexRenderOptions; | ||
@@ -37,3 +37,4 @@ this.set( 'value', '' ); | ||
updateMath() { | ||
renderEquation( this.value, this.element, this.engine, this.lazyLoad, this.display, true, this.previewUid, this.previewClassName ); | ||
renderEquation( this.value, this.element, this.engine, this.lazyLoad, this.display, true, this.previewUid, this.previewClassName, | ||
this.katexRenderOptions ); | ||
} | ||
@@ -40,0 +41,0 @@ |
@@ -47,3 +47,4 @@ import global from '@ckeditor/ckeditor5-utils/src/dom/global'; | ||
export async function renderEquation( | ||
equation, element, engine = 'katex', lazyLoad, display = false, preview = false, previewUid, previewClassName = [] | ||
equation, element, engine = 'katex', lazyLoad, display = false, preview = false, previewUid, previewClassName = [], | ||
katexRenderOptions = {} | ||
) { | ||
@@ -81,3 +82,4 @@ if ( engine === 'mathjax' && typeof MathJax !== 'undefined' ) { | ||
throwOnError: false, | ||
displayMode: display | ||
displayMode: display, | ||
...katexRenderOptions | ||
} ); | ||
@@ -99,3 +101,3 @@ if ( preview ) { | ||
await global.window.CKEDITOR_MATH_LAZY_LOAD; | ||
renderEquation( equation, element, engine, undefined, display, preview, previewUid, previewClassName ); | ||
renderEquation( equation, element, engine, undefined, display, preview, previewUid, previewClassName, katexRenderOptions ); | ||
} | ||
@@ -102,0 +104,0 @@ catch ( err ) { |
56774
1009
250