API - CodeCogs Equation Editor (original) (raw)
The Equation Editor API (Application Programming Interface) provides a mechanism to create custom equation editor and to seamlessly integrated the editor within any HTML web page. This page show the essential steps to creating an editor tool bar, customising the panels, and interfacing with content on your page.
Prerequisites
Add to :
<script src="https://editor.codecogs.com/eqneditor.api.min.js" crossorigin="anonymous"></script>
Add to :
`
TextArea
constructor
- new TextArea(textAreaId: string, focus?: boolean, wrap?: boolean): TextArea
Parameters
textAreaId: string
focus: boolean = false
wrap: boolean = true
Returns TextArea
addHistoryMenu
Parameters
history: History
Returns TextArea
addOutput
- addOutput(out: Output): TextArea
Parameters
out: Output
Returns TextArea
addRestrictedCommands
- addRestrictedCommands(words: string[]): TextArea
Parameters
words: string[]
Returns TextArea
addRestrictedVariables
- addRestrictedVariables(words: string[]): TextArea
Parameters
words: string[]
Returns TextArea
addToolbar
- addToolbar(toolbar: Toolbar, activate??: boolean): TextArea
Parameters
toolbar: Toolbar
Optional
activate: boolean = true
Returns TextArea
callOutputs
- callOutputs(func: string, arg: any): void
Parameters
func: string
arg: any
Returns void
clear
- clear(): void
Returns void
close
- close(): void
Returns void
getTextArea
- getTextArea(): HTMLElement
Returns HTMLElement
insert
- insert(txt: string, newCaretPos??: number, selectedInsertPos??: number): void
Parameters
txt: string
Optional
newCaretPos: number = nullOptional
selectedInsertPos: number = null
Returns void
isTextAreaEmpty
- isTextAreaEmpty(): boolean
Returns boolean
makeArrayMatrix
- makeArrayMatrix(type: string, start: string, end: string): void
Parameters
type: string
start: string
end: string
Returns void
makeEquationsMatrix
- makeEquationsMatrix(type: string, isNumbered?: boolean, isConditional?: boolean): void
Parameters
type: string
isNumbered: boolean = false
isConditional: boolean = false
Returns void
notifyHistoryMenus
Returns void
notifyOutputs
- notifyOutputs(): void
Returns void
pushToHistory
- pushToHistory(): void
Returns void
redoHistory
- redoHistory(): void
Returns void
setRestrictMode
- setRestrictMode(mode: number): TextArea
Parameters
mode: number
Returns TextArea
setRestrictedCommands
- setRestrictedCommands(words: string[]): TextArea
Parameters
words: string[]
Returns TextArea
setRestrictedVariables
- setRestrictedVariables(words: string[]): TextArea
Parameters
words: string[]
Returns TextArea
undoHistory
- undoHistory(): void
Returns void
updateMatrixDims
- updateMatrixDims(text: string): void
Parameters
text: string
Returns void
validate
- validate(): boolean
Returns boolean
Static
link
- link(textAreaId: string, focus?: boolean, wrap?: boolean): TextArea
Parameters
textAreaId: string
focus: boolean = false
wrap: boolean = true
Returns TextArea
History
constructor
- new History(historyMenuId: string): History
Parameters
historyMenuId: string
Returns History
setActiveTextArea
- setActiveTextArea(textArea: TextArea): void
Parameters
textArea: TextArea
Returns void
Output
constructor
- new Output(divOutputId?: string, outputFormat?: string): Output
Parameters
divOutputId: string = null
outputFormat: string = null
Returns Output
addExportArea
- addExportArea(divElementId: string, exportType: string): Output
Parameters
divElementId: string
exportType: string
Returns Output
connectTextArea
- connectTextArea(textAreaId: string): void
Parameters
textAreaId: string
Returns void
download
- download(filename??: string): void
Parameters
Optional
filename: string = ...
Returns void
exportAs
- exportAs(exportType: string): string
Parameters
exportType: string
Returns string
getEquation
- getEquation(): string
Returns string
getEquationURL
- getEquationURL(download?: boolean): string
Parameters
download: boolean = false
Returns string
getExportOptions
- getExportOptions(): string[]
Returns string[]
getInline
- getInline(): boolean
Returns boolean
getSupportedColors
- getSupportedColors(): any[]
Returns any[]
getSupportedDpi
- getSupportedDpi(): string[]
Returns string[]
getSupportedFontSizes
- getSupportedFontSizes(): any[]
Returns any[]
getSupportedFonts
- getSupportedFonts(): any[]
Returns any[]
getSupportedFormats
- getSupportedFormats(): string[]
Returns string[]
setBackground
- setBackground(backgroundColor: string): Output
Parameters
backgroundColor: string
Returns Output
setDpi
- setDpi(dpi: string): Output
Parameters
dpi: string
Returns Output
setExportFormat
- setExportFormat(format: string): Output
Parameters
format: string
Returns Output
setFont
- setFont(font: string): Output
Parameters
font: string
Returns Output
setFontSize
- setFontSize(fontSize: string): Output
Parameters
fontSize: string
Returns Output
setFormat
- setFormat(format: string): Output
Parameters
format: string
Returns Output
setInline
- setInline(flag?: boolean): Output
Parameters
flag: boolean = true
Returns Output
setRenderURL
- setRenderURL(renderURL: string): Output
Parameters
renderURL: string
Returns Output
updateOutput
- updateOutput(): void
Returns void
Static
link
- link(divOutputId?: string, outputFormat?: string): Output
Parameters
divOutputId: string = null
outputFormat: string = null
Returns Output
Toolbar
constructor
- new Toolbar(toolbarElementId: string, design?: any, scale?: number): Toolbar
Parameters
toolbarElementId: string
design: any = 'default'
scale: number = 1
Returns Toolbar
addTextArea
- addTextArea(textArea: TextArea, reverseLink?: boolean): Toolbar
Parameters
textArea: TextArea
reverseLink: boolean = true
Returns Toolbar
appendPanel
- appendPanel(id: number, panel: string | object): Toolbar
Parameters
id: number
panel: string | object
Returns Toolbar
getPanel
- getPanel(panelName: string): HTMLDivElement
Parameters
panelName: string
Returns HTMLDivElement
moveTo
- moveTo(toolbarElementId: string): Toolbar
Parameters
toolbarElementId: string
Returns Toolbar
setActiveTextArea
- setActiveTextArea(textArea: TextArea): Toolbar
Parameters
textArea: TextArea
Returns Toolbar
Static
link
- link(toolbarElementId: string, design?: any, scale?: number): Toolbar
Parameters
toolbarElementId: string
design: any = 'default'
scale: number = 1
Returns Toolbar
Parameter Details
The equation editor uses some specific parameter values to modify the behaviour of certain functions. Below are the
exportType
Used throughout the Output Class to determine which format to render the equations in.
latex | Raw LaTeX markup | 1+sin(x) |
---|---|---|
encoded | Encoded LaTeX markup | 1+%20sin(x) - Uses the javascript escape function and converts '+' rto + |
wp | Wordpress markup | [latex]1+sin(x)[/latex] |
phpBB | phpBB markup | [tex]1+sin(x)[/tex] |
tw | Tiddly Wiki | [img[http://latex.codecogs.com/gif.latex?1+sin(x)\]\] |
url | URL link to equation | http://latex.codecogs.com/gif.latex?1+sin(x) |
urlencoded | Encoded URL link to equation | http://latex.codecogs.com/gif.latex?1+sin%28x%29 |
pre | HTML code using pre-tags | 1+sin(x) |
doxygen | DOxygen markup | \f[1+sin(x)\f] |
html | HTML code for use on a webpage |
dpi
Stands for Dots Per Inch and is used throughout the Output Class to determine the resolution to render equations in. Note that a larger DPI often increases the size of the rendered equation as well.
50 | Lowest Resolution |
---|---|
80 | |
100 | |
110 | |
120 | |
150 | |
200 | |
300 | Highest Resolution |