mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 11:02:27 +08:00
Upcast Quill style tags, fixes #39
See also: https://github.com/quilljs/quill/blob/develop/formats/formula.js
This commit is contained in:
parent
d60e65b220
commit
a8b958d537
@ -5,6 +5,7 @@ Changelog
|
|||||||
|
|
||||||
* #38: You can now boot into a development instance with `yarn start` (supports
|
* #38: You can now boot into a development instance with `yarn start` (supports
|
||||||
live reload)
|
live reload)
|
||||||
|
* #40 (fixed #39): Support for upcasting Quill style tags
|
||||||
|
|
||||||
## [27.1.1](https://github.com/isaul32/ckeditor5-math/compare/v27.1.0...v27.1.1) (2021-03-29)
|
## [27.1.1](https://github.com/isaul32/ckeditor5-math/compare/v27.1.0...v27.1.1) (2021-03-29)
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
<div id="editor">
|
<div id="editor">
|
||||||
<p><script type="math/tex">e=mc^2</script></p>
|
<p><script type="math/tex">e=mc^2</script></p>
|
||||||
<p><script type="math/tex; mode=display">e=mc^2</script></p>
|
<p><script type="math/tex; mode=display">e=mc^2</script></p>
|
||||||
|
<!-- Quill Style Tag -->
|
||||||
|
<p><span class="ql-formula" data-value="e=mc^2"></span></p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -108,6 +108,21 @@ export default class MathEditing extends Plugin {
|
|||||||
|
|
||||||
return writer.createElement( params.display ? 'mathtex-display' : 'mathtex-inline', params );
|
return writer.createElement( params.display ? 'mathtex-display' : 'mathtex-inline', params );
|
||||||
}
|
}
|
||||||
|
} )
|
||||||
|
// KaTeX from Quill: https://github.com/quilljs/quill/blob/develop/formats/formula.js
|
||||||
|
.elementToElement( {
|
||||||
|
view: {
|
||||||
|
name: 'span',
|
||||||
|
classes: [ 'ql-formula' ]
|
||||||
|
},
|
||||||
|
model: ( viewElement, { writer } ) => {
|
||||||
|
const equation = viewElement.getAttribute( 'data-value' ).trim();
|
||||||
|
return writer.createElement( 'mathtex-inline', {
|
||||||
|
equation,
|
||||||
|
type: mathConfig.forceOutputType ? mathConfig.outputType : 'script',
|
||||||
|
display: false
|
||||||
|
} );
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Model -> View (element)
|
// Model -> View (element)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user