What happened?
Hello 👋
First of all, thank you for this great package — it works very well for standard Editor.js tools.
I’m trying to integrate a custom Editor.js tool based on MathLive (a MathBlock for LaTeX equations), but I’m currently unable to make it appear or register correctly, and I would really appreciate your guidance.
What I’m trying to achieve
- Add a custom Editor.js tool (MathBlock using MathLive)
- Tool key: math
- Use it alongside other tools like header, list, quote, etc.
What I’ve done so far
in filament panel provider i do
->assets([
Js::make('mathlive-js', 'https://cdn.jsdelivr.net/npm/mathlive@latest/dist/mathlive.min.js'),
Js::make('editorjs-math-block-js', asset('js/editorjs-math-block.js?' . time())),
])
js/editorjs-math-block.js
class MathBlock {
static get toolbox() {
return {
title: 'Equation',
icon: '∑',
};
}
constructor({data}) {
this.data = data || {latex: ''};
this.wrapper = document.createElement('div');
}
render() {
const math = document.createElement('math-field');
math.value = this.data.latex || 'x^2';
math.setAttribute('dir', 'ltr');
this.wrapper.appendChild(math);
this.mathField = math;
return this.wrapper;
}
save() {
return {
latex: this.mathField.value,
};
}
}
window.MathBlock = MathBlock;
Installed MathLive and my custom MathBlock JS file (confirmed it loads correctly):
- console.log(window.editorjs); //undefined
- console.log(window.MathLive); // defined
- console.log(window.MathBlock); // class exists, toolbox getter exists
And I've added the tool to the Filament EditorJS config:
'profiles' => [
'math' => [
'header',
'math',
'list',
'quote',
'table',
],
],
Used the profile in my form field:
EditorjsTextField::make('question')
->translateLabel()
->columnSpanFull()
->tools('math')
->required(),
The editor loads normally, and all other tools appear, but the math tool does not appear in the toolbar.
What I tried to debug
- Inspecting the DOM and JS runtime
- Trying to access the Editor.js instance from the DOM (e.g. __editorjs)
- Waiting for initialization / polling
- Livewire hooks
However, it seems that:
- The Editor.js instance is not exposed
- Only tool names (strings) are supported
- There’s no documented way to register custom JS tools
My question
What is the correct / supported way to register a custom Editor.js tool (JS class) with this package?
Specifically:
- Is it currently supported?
- If yes, how should the JS tool be registered?
- If not, is there a recommended extension point or planned support?
Thank you again for your work on this package.
How to reproduce the bug
JS packages will be loaded but doesn't appear in the editor
Package Version
^1.1
PHP Version
8.4
Laravel Version
^12.42.0
Which operating systems does with happen with?
Linux
Notes
No response
What happened?
Hello 👋
First of all, thank you for this great package — it works very well for standard Editor.js tools.
I’m trying to integrate a custom Editor.js tool based on MathLive (a MathBlock for LaTeX equations), but I’m currently unable to make it appear or register correctly, and I would really appreciate your guidance.
What I’m trying to achieve
What I’ve done so far
in filament panel provider i do
js/editorjs-math-block.js
Installed MathLive and my custom MathBlock JS file (confirmed it loads correctly):
And I've added the tool to the Filament EditorJS config:
Used the profile in my form field:
The editor loads normally, and all other tools appear, but the math tool does not appear in the toolbar.
What I tried to debug
However, it seems that:
My question
What is the correct / supported way to register a custom Editor.js tool (JS class) with this package?
Specifically:
Thank you again for your work on this package.
How to reproduce the bug
JS packages will be loaded but doesn't appear in the editor
Package Version
^1.1
PHP Version
8.4
Laravel Version
^12.42.0
Which operating systems does with happen with?
Linux
Notes
No response