LaTeXFragment

Fragments. LaTeXFragment

A fragment containing latex Supports autodom insertion

Extends

Members

auto :boolean

Description:
  • The auto attribute of this fragment, toggles automatic behaviour on/off
Source:
Overrides:
The auto attribute of this fragment, toggles automatic behaviour on/off
Type:
  • boolean

raw :string

Description:
  • The raw representation of this fragment, can be used to set/get the raw value.
Source:
Overrides:
The raw representation of this fragment, can be used to set/get the raw value.
Type:
  • string
Examples
//Get the raw value of a fragment
let fragmentValue = myFragment.raw;
//Set the raw value of a fragment
myFragment.raw = myNewFragmentValue;

(readonly) type :string

Description:
  • The type of this fragment
Source:
Overrides:
The type of this fragment
Type:
  • string

Methods

getDomPath()

Description:
  • Returns a dompath for finding this fragment
Source:
Overrides:

registerOnAutoChangedHandler(callback)

Description:
  • Register a callback to run when auto attribute changes on fragment
Source:
Overrides:
Example
Fragment.one("#myFragment").registerOnAutoChangedHandler((fragment, auto)=>{
    //Fragment auto attribute changed
});
Parameters:
Name Type Description
callback Fragments.Fragment~autoChangedCallback The callback to run when auto changes

registerOnClassChangedHandler(callback)

Description:
  • Register a callback to run when the classes of this fragment changes
Source:
Overrides:
Example
Fragment.one("#myFragment").registerOnClassChangedHandler((classes)=>{
    //Some classes changed on this fragment
});
Parameters:
Name Type Description
callback Fragments.Fragment~fragmentClassChangedCallback The callback to run when classes change on the fragment

registerOnFragmentChangedHandler(callback)

Description:
  • Register a callback to be run when this fragments content changes.
Source:
Overrides:
Example
Fragment.one("#myFragment").registerOnFragmentChangedHandler((context)=>{
    //Fragment has changed
});
Parameters:
Name Type Description
callback Fragments.Fragment~fragmentChangedCallback The callback that is run when fragment content changes

registerOnFragmentUnloadedHandler(callback)

Description:
  • Register a callback to run when this fragment is unloaded
Source:
Overrides:
Example
Fragment.one("#myFragment").registerOnFragmentUnloadedHandler(()=>{
    //Fragment is unloaded
});
Parameters:
Name Type Description
callback Fragments.Fragment~fragmentUnloadedCallback The callback to run when the fragment is unloaded

registerOnTextDeletedHandler(callback)

Description:
  • Register a callback to run when text is deleted from this fragment
Source:
Overrides:
Example
Fragment.one("#myFragment").registerOnTextDeletedHandler((position, value)=>{
    //Text "value" has been deleted from this fragment at "position"
});
Parameters:
Name Type Description
callback Fragments.Fragment~textDeletedCallback The callback to run when text is deleted

registerOnTextInsertedHandler(callback)

Description:
  • Register a callback to run when text is inserted into this fragment
Source:
Overrides:
Example
Fragment.one("#myFragment").registerOnTextInsertedHandler((position, value)=>{
    //Text "value" has been inserted into this fragment at "position"
});
Parameters:
Name Type Description
callback Fragments.Fragment~textInsertedCallback The callback to run when text is inserted

require() → {Promise.<HTMLDivElement>}

Description:
  • Render the LaTeX of this fragment to html
Source:
Overrides:
Example
let latexDiv = Fragment.one("#myLaTeXFragment").require();
Returns:
- Promise that resolves to a div containing the LaTeX rendered as html. Warning the div also contains the needed styles to render the LaTeX correctly, the styles are not namespaced.
Type
Promise.<HTMLDivElement>

unRegisterOnAutoChangedHandler(callback)

Description:
  • Unregister a callback handler
Source:
Overrides:
Parameters:
Name Type Description
callback Fragments.Fragment~autoChangedCallback The callback to unregister

unRegisterOnFragmentChangedHandler(callback)

Description:
  • Unregister a callback handler
Source:
Overrides:
Parameters:
Name Type Description
callback Fragments.Fragment~fragmentChangedCallback The callback to unregister

unRegisterOnFragmentUnloadedHandler(callback)

Description:
  • Unregister a callback handler
Source:
Overrides:
Parameters:
Name Type Description
callback Fragments.Fragment~fragmentUnloadedCallback The callback to unregister

unload()

Description:
  • Tell this fragment to unload itself
Source:
Overrides:
Example
Fragment.one("#myFragment").unload();