-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
540 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. | ||
For licensing, see LICENSE.html or http://ckeditor.com/license | ||
--> | ||
<html> | ||
<head> | ||
<title>Widgets: MathJax — CKEditor Sample</title> | ||
<meta charset="utf-8"> | ||
<script src="../../../ckeditor.js"></script> | ||
<link href="../../../samples/sample.css" rel="stylesheet"> | ||
<meta name="ckeditor-sample-name" content="Mathematics"> | ||
<meta name="ckeditor-sample-group" content="Plugins"> | ||
<meta name="ckeditor-sample-description" content="Create mathematical equations in TeX and display them in visual form."> | ||
<meta name="ckeditor-sample-isnew" content="1"> | ||
<script> | ||
CKEDITOR.disableAutoInline = true; | ||
</script> | ||
</head> | ||
<body> | ||
<h1 class="samples"> | ||
<a href="../../../samples/index.html">CKEditor Samples</a> » Widgets: MathJax | ||
</h1> | ||
|
||
<textarea id="editor1" cols="10" rows="10"> | ||
<h1>Apollo 11</h1> | ||
|
||
<div style="background:red;color:blue"> | ||
<p><strong>Apollo 11</strong> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin">Buzz Aldrin</a> <span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span>. Armstrong became the first to step onto the lunar surface 6 hours later. Armstrong spent about two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5 kg) of lunar material for return to Earth. A third member of the mission, Michael Collins, piloted the command spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth.</p> | ||
</div> | ||
|
||
<p>Foo foo <span class="userclass mjx">\(J_\alpha(x) = \sum\limits_{m=0}^\infty \frac{(-1)^m}{m! \, \Gamma(m + \alpha + 1)}{\left({\frac{x}{2}}\right)}^{2 m + \alpha}\)</span> bar bar.</p> | ||
|
||
<p>Launched by a Saturn V rocket from Kennedy Space Center in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of <a href="http://en.wikipedia.org/wiki/NASA">NASA</a>'s Apollo program. The Apollo spacecraft had three parts: aCommand Module with a cabin for the three astronauts which was the only part which landed back on Earth; a Service Module which supported the Command Module with propulsion, electrical power, oxygen and water; and a Lunar Module for landing on the Moon. After being sent to the Moon by the Saturn V's upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the Sea of Tranquility. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the Pacific Ocean .</p> | ||
</textarea> | ||
|
||
<div id="editor2" contenteditable="true" cols="10" rows="10"> | ||
<h1>Apollo 11</h1> | ||
|
||
<div style="background:red;color:blue"> | ||
<p><strong>Apollo 11</strong> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin">Buzz Aldrin</a> <span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span>. Armstrong became the first to step onto the lunar surface 6 hours later. Armstrong spent about two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5 kg) of lunar material for return to Earth. A third member of the mission, Michael Collins, piloted the command spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth.</p> | ||
</div> | ||
|
||
<p>Foo foo <span class="userclass mjx">\(J_\alpha(x) = \sum\limits_{m=0}^\infty \frac{(-1)^m}{m! \, \Gamma(m + \alpha + 1)}{\left({\frac{x}{2}}\right)}^{2 m + \alpha}\)</span> bar bar.</p> | ||
|
||
<p>Launched by a Saturn V rocket from Kennedy Space Center in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of <a href="http://en.wikipedia.org/wiki/NASA">NASA</a>'s Apollo program. The Apollo spacecraft had three parts: aCommand Module with a cabin for the three astronauts which was the only part which landed back on Earth; a Service Module which supported the Command Module with propulsion, electrical power, oxygen and water; and a Lunar Module for landing on the Moon. After being sent to the Moon by the Saturn V's upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the Sea of Tranquility. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the Pacific Ocean .</p> | ||
</div> | ||
|
||
<script> | ||
|
||
CKEDITOR.stylesSet.add('my_custom_style', [ | ||
{ name: 'My Custom Block', element: 'h1', styles: { color: 'blue'} } | ||
]); | ||
|
||
CKEDITOR.replace( 'editor1', { | ||
extraPlugins: 'mathjax', | ||
height: 350, | ||
allowedContent: true, | ||
// mathJaxLib: './truncated-mathjax/MathJax.js?config=TeX-AMS_HTML', | ||
mathJaxClass: 'mjx' | ||
} ); | ||
|
||
CKEDITOR.inline( 'editor2', { | ||
extraPlugins: 'mathjax', | ||
height: 350, | ||
allowedContent: true, | ||
// mathJaxLib: './truncated-mathjax/MathJax.js?config=TeX-AMS_HTML', | ||
mathJaxClass: 'mjx' | ||
} ); | ||
|
||
</script> | ||
|
||
<div id="footer"> | ||
<hr> | ||
<p> | ||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> | ||
</p> | ||
<p id="copy"> | ||
Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico | ||
Knabben. All rights reserved. | ||
</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/** | ||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or http://ckeditor.com/license | ||
*/ | ||
|
||
'use strict'; | ||
|
||
CKEDITOR.dialog.add( 'mathjax', function( editor ) { | ||
|
||
var preview, | ||
lang = editor.lang.mathjax; | ||
|
||
return { | ||
title: lang.title, | ||
minWidth: 350, | ||
minHeight: 100, | ||
contents: [ | ||
{ | ||
id: 'info', | ||
elements: [ | ||
{ | ||
id: 'equation', | ||
type: 'textarea', | ||
label: lang.dialogInput, | ||
|
||
onLoad: function( widget ) { | ||
var that = this; | ||
|
||
this.getInputElement().on( 'keyup', function() { | ||
// Add \( and \) for preview. | ||
preview.setValue( '\\(' + that.getInputElement().getValue() + '\\)' ); | ||
} ); | ||
}, | ||
|
||
setup: function( widget ) { | ||
// Remove \( and \). | ||
var math = widget.data.math, | ||
begin = math.indexOf( '\\(' ) + 2, | ||
end = math.lastIndexOf( '\\)' ); | ||
this.setValue( math.substring( begin, end ) ); | ||
}, | ||
|
||
commit: function( widget ) { | ||
// Add \( and \) to make TeX be parsed by MathJax by default. | ||
widget.setData( 'math', '\\(' + this.getValue() + '\\)' ); | ||
} | ||
}, | ||
{ | ||
id: 'documentation', | ||
type: 'html', | ||
html: | ||
'<div style="width:100%;text-align:right;margin:-8px 0 10px">' + | ||
'<a class="cke_mathjax_doc" href="' + lang.docUrl + '" target="_black" style="cursor:pointer;color:#00B2CE;text-decoration:underline">' + | ||
lang.docLabel + | ||
'</a>' + | ||
'</div>', | ||
}, | ||
{ | ||
id: 'preview', | ||
type: 'html', | ||
html: | ||
'<div style="width:100%;text-align:center;">' + | ||
'<iframe style="border:0;width:0;height:0;font-size:20px" scrolling="no" frameborder="0" allowTransparency="true"></iframe>' + | ||
'</div>', | ||
|
||
onLoad: function( widget ) { | ||
var iFrame = CKEDITOR.document.getById( this.domId ).getChild( 0 ); | ||
preview = new CKEDITOR.plugins.mathjax.frameWrapper( iFrame, editor ); | ||
}, | ||
|
||
setup: function( widget ) { | ||
preview.setValue( widget.data.math ); | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} ); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. | ||
For licensing, see LICENSE.md or http://ckeditor.com/license | ||
*/ | ||
CKEDITOR.plugins.setLang( 'mathjax', 'en', { | ||
title: 'Mathematics in TeX', | ||
button: 'Math', | ||
dialogInput: 'Write you TeX here', | ||
docUrl: 'http://en.wikibooks.org/wiki/LaTeX/Mathematics', | ||
docLabel: 'TeX documentation', | ||
} ); |
Oops, something went wrong.