Add OnlyMath plugin - #629
Conversation
OnlyMath brings in-document computer algebra to the Document editor: insert a math field (Alt+M) and calculate, solve equations, differentiate and integrate using a bundled Giac/Xcas engine compiled to WebAssembly. Runs fully client-side and offline; no external services or API keys. - config.json v1.0.0 with store block, icons2 scale maps (light/dark), screenshots and categories (work, specAbilities) - Registered in store/config.json Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi @MrMathiasen Cross-frame This plugin relies on direct DOM access to ancestor frames in a few places, all rooted in shared-*.js and the background script:
Today this only fails when the plugin happens to be cross-origin with the top window. A future editor version will sandbox plugin iframes (allow-scripts without allow-same-origin), which makes every Suggested fixes, following the pattern already used by the official ai plugin:
Separate issue: relative paths to plugins.js / plugins-ui.js / plugins.css
Let me know if anything above is unclear — happy to help however's useful. Would like these addressed before the sandbox change lands, since it'll otherwise silently stop working for every install. |
Address marketplace review: hotkeys via attachEditorEvent(onKeyDown), background↔panel via SendEvent, local op-lock/init, localStorage precision/status, and absolute onlyoffice.github.io sdkjs-plugins/v1 URLs.
|
Hi @drape3a — thanks for the careful review and the concrete guidance. Addressed in the latest commit on this branch:
One note: Happy to iterate further if anything else comes up in re-review. |
|
Thanks for the quick turnaround — the window.top/window.parent removal, local init-guard/lock, localStorage for settings, and the onKeyDown hotkey migration all look correct now. One concern with the background↔panel sync fix: it now uses Asc.plugin.executeMethod("SendEvent", [eventName, data]) to send and attachEditorEvent(eventName, cb) to receive. SendEvent broadcasts to other running plugins by guid, but explicitly skips the sender's own guid (onPluginEvent2 in the SDK core checks guid === currentPluginEvent and continues) — and background/panel share the same guid. So this likely never delivers events between the two variations at all. Please use // from any plugin variation frame
const customWindow = new window.Asc.PluginWindow();
customWindow.attachEvent("eventName", function(data) {});
customWindow.command("eventName2", data2);
// in another variation frame of the same plugin
window.Asc.plugin.sendToPlugin("eventName", data);
window.Asc.plugin.attachEvent("eventName2", function(data2) {}); |
…ndbox purity Follow-up to reviewer feedback: panel-window no longer patches asc_pluginRun, intercepts the '...' dropdown, or hides the panel close-X via ancestor-frame DOM. The panel opens purely through Asc.PluginWindow / ShowWindow, so the plugin touches no ancestor frame at all. Rebuilt full/bundled package.
|
Follow-up on my earlier note about Dropped from the plugin:
The panel now opens purely via The only same-origin access left anywhere is |
|
Hello Arthur,
You're fast as well - too fast for me :)
I rolled back the change - still not happy about the "ALT B" so I am trying
different things out.
I'll take you new comments into account and try to work it out as well
cheers
Ken
Den ons. 22. jul. 2026 kl. 16.55 skrev Arthur ***@***.***>:
… *drape3a* left a comment (ONLYOFFICE/onlyoffice.github.io#629)
<#629 (comment)>
Thanks for the quick turnaround — the window.top/window.parent removal,
local init-guard/lock, localStorage for settings, and the onKeyDown hotkey
migration all look correct now.
One concern with the background↔panel sync fix: it now uses
Asc.plugin.executeMethod("SendEvent", [eventName, data]) to send and
attachEditorEvent(eventName, cb) to receive. SendEvent broadcasts to other
running plugins by guid, but explicitly skips the sender's own guid
(onPluginEvent2 in the SDK core checks guid === currentPluginEvent and
continues) — and background/panel share the same guid. So this likely never
delivers events between the two variations at all.
Please use sendToPlugin/Asc.PluginWindow (attachEvent/command) instead,
as suggested earlier — that channel is routed by windowID, not guid, so it
doesn't hit this exclusion. Worth manually testing: open the panel, run
Solve on an equation with multiple variables, and confirm the variable
picker actually appears — that'll tell you quickly if the current wiring is
silently dead.
// from any plugin variation frameconst customWindow = new window.Asc.PluginWindow();customWindow.attachEvent("eventName", function(data) {});customWindow.command("eventName2", data2);
// in another variation frame of the same pluginwindow.Asc.plugin.sendToPlugin("eventName", data);window.Asc.plugin.attachEvent("eventName2", function(data2) {});
—
Reply to this email directly, view it on GitHub
<#629?email_source=notifications&email_token=CJNE4U56J2BP3QSXFVIPLR35GDIXXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBUG43TIMZVGI4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5047743528>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CJNE4U2QKGMIK2T2LDV5YFD5GDIXXAVCNFSNUABFKJSXA33TNF2G64TZHMZDKNBWGA3TGNBXHNEXG43VMU5TIOJUGY4DOOBYGI4KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CJNE4U5SCFZQG7MFMQD2IIL5GDIXXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBUG43TIMZVGI4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/CJNE4U2MYB3C5QAAFTYDW2T5GDIXXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBUG43TIMZVGI4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Ken Mathiasen, M.Sc.ITPD
Povlstoft 16, Blans
6400 Sønderborg
mobil: +45 5320 1965
mail: ***@***.***
|
Address drape3a's review: replace SendEvent (same-guid dead channel) with Asc.PluginWindow command/sendToPlugin (windowID-routed). Panel isActivated=false so background owns the window. Remap Calculate from Alt+B to Alt+C to avoid Firefox Bookmarks menu collision.
|
Hi @drape3a — follow-up on your SendEvent note (and the earlier Alt+B issue I was debugging). Background ↔ panel messaging — switched to the windowID-routed custom-window channel you described:
Manually verified: multi-variable Solve shows the variable picker; panel buttons drive the document. Calculate shortcut — remapped Alt+B → Alt+C. On Danish Firefox (Linux), Alt+B opens Bogmærker before the editor can preventDefault via Latest package is on this branch. Happy to iterate further if anything else comes up. |
|
....I'm all done for now - thanks Arthur :)
Den ons. 22. jul. 2026 kl. 16.55 skrev Arthur ***@***.***>:
… *drape3a* left a comment (ONLYOFFICE/onlyoffice.github.io#629)
<#629 (comment)>
Thanks for the quick turnaround — the window.top/window.parent removal,
local init-guard/lock, localStorage for settings, and the onKeyDown hotkey
migration all look correct now.
One concern with the background↔panel sync fix: it now uses
Asc.plugin.executeMethod("SendEvent", [eventName, data]) to send and
attachEditorEvent(eventName, cb) to receive. SendEvent broadcasts to other
running plugins by guid, but explicitly skips the sender's own guid
(onPluginEvent2 in the SDK core checks guid === currentPluginEvent and
continues) — and background/panel share the same guid. So this likely never
delivers events between the two variations at all.
Please use sendToPlugin/Asc.PluginWindow (attachEvent/command) instead,
as suggested earlier — that channel is routed by windowID, not guid, so it
doesn't hit this exclusion. Worth manually testing: open the panel, run
Solve on an equation with multiple variables, and confirm the variable
picker actually appears — that'll tell you quickly if the current wiring is
silently dead.
// from any plugin variation frameconst customWindow = new window.Asc.PluginWindow();customWindow.attachEvent("eventName", function(data) {});customWindow.command("eventName2", data2);
// in another variation frame of the same pluginwindow.Asc.plugin.sendToPlugin("eventName", data);window.Asc.plugin.attachEvent("eventName2", function(data2) {});
—
Reply to this email directly, view it on GitHub
<#629?email_source=notifications&email_token=CJNE4U56J2BP3QSXFVIPLR35GDIXXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBUG43TIMZVGI4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5047743528>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CJNE4U2QKGMIK2T2LDV5YFD5GDIXXAVCNFSNUABFKJSXA33TNF2G64TZHMZDKNBWGA3TGNBXHNEXG43VMU5TIOJUGY4DOOBYGI4KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CJNE4U5SCFZQG7MFMQD2IIL5GDIXXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBUG43TIMZVGI4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/CJNE4U2MYB3C5QAAFTYDW2T5GDIXXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBUG43TIMZVGI4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Ken Mathiasen, M.Sc.ITPD
Povlstoft 16, Blans
6400 Sønderborg
mobil: +45 5320 1965
mail: ***@***.***
|
|
Hi! Sandbox check passed, all clean now. One bug: the Settings window doesn't open from the toolbar. |
|
...I've updated it (removed the dots) - thanks for your time drape3a :)
Cheers Ken
Den tors. 23. jul. 2026 kl. 09.44 skrev Arthur ***@***.***>:
… *drape3a* left a comment (ONLYOFFICE/onlyoffice.github.io#629)
<#629 (comment)>
Hi! Sandbox check passed, all clean now. One bug: the Settings window
doesn't open from the toolbar.
—
Reply to this email directly, view it on GitHub
<#629?email_source=notifications&email_token=CJNE4UZR47LOJKRYICAR3ET5GG645A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBVGU3TSMZUGEZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5055793412>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CJNE4UZIWKPHXRISSCGXBND5GG645AVCNFSNUABFKJSXA33TNF2G64TZHMZDKNBWGA3TGNBXHNEXG43VMU5TIOJUGY4DOOBYGI4KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CJNE4U5POWGQTJ5YG3A4XR35GG645A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBVGU3TSMZUGEZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/CJNE4U3OJSUI2YYKM6SESFL5GG645A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBVGU3TSMZUGEZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Ken Mathiasen, M.Sc.ITPD
Povlstoft 16, Blans
6400 Sønderborg
mobil: +45 5320 1965
mail: ***@***.***
|
I don't see your latest changes reflected in the PR — could you push them? |
- config.json: drop the panelRight variation so the non-functional "…" menu no longer renders on the OnlyMath row in the background-plugins list. - Add a dedicated "Settings" toolbar button that opens the panel via Asc.PluginWindow (sandbox-safe; no ancestor-frame access). - Refresh built bundle (index) and README/CHANGELOG to match. Co-authored-by: Cursor <cursoragent@cursor.com>
|
...sorry - now it's done (we only pushed it to my dev repro)
cheers Ken
Den tors. 23. jul. 2026 kl. 17.52 skrev Arthur ***@***.***>:
… *drape3a* left a comment (ONLYOFFICE/onlyoffice.github.io#629)
<#629 (comment)>
...I've updated it (removed the dots) ...
I don't see your latest changes reflected in the PR — could you push them?
—
Reply to this email directly, view it on GitHub
<#629?email_source=notifications&email_token=CJNE4UYDD3RYYVBXTAMBS735GIYE7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWGA2TANBXGY3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5060504766>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CJNE4U5YHSN4QYBAVK45S4D5GIYE7AVCNFSNUABFKJSXA33TNF2G64TZHMZDKNBWGA3TGNBXHNEXG43VMU5TIOJUGY4DOOBYGI4KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CJNE4U4MW6AWHVNKAJCLJ435GIYE7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWGA2TANBXGY3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/CJNE4U6FMU2HFNPCG3GV6NT5GIYE7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWGA2TANBXGY3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Ken Mathiasen, M.Sc.ITPD
Povlstoft 16, Blans
6400 Sønderborg
mobil: +45 5320 1965
mail: ***@***.***
|
|
Hi @MrMathiasen! |
|
Hello drape3a,
Oh sorry - I missed that. I have been working on the three dots at the
"plug-in - background plugins". Same problem - My intention here was to
make it as the other Background Plugin - no "three dots" there either. So
that was a quick fix.
The "Toolbar - insert icon" is a tricky one (might have to make a dropdown
menu or something) - I have to look deeper into that, and then get back to
you, sorry
cheers Ken
Den fre. 24. jul. 2026 kl. 11.21 skrev Arthur ***@***.***>:
… *drape3a* left a comment (ONLYOFFICE/onlyoffice.github.io#629)
<#629 (comment)>
Hi @MrMathiasen <https://github.com/MrMathiasen>!
Settings still doesn't open from the toolbar (Insert tab).
—
Reply to this email directly, view it on GitHub
<#629?email_source=notifications&email_token=CJNE4U5PUIWJFO54NNGQIBD5GMTBZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWHAZDINJYHE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5068245894>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CJNE4U42XMNU7KDP4G4X2WT5GMTBZAVCNFSNUABFKJSXA33TNF2G64TZHMZDKNBWGA3TGNBXHNEXG43VMU5TIOJUGY4DOOBYGI4KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CJNE4UZ3H2TSBZCKVT7Q2LD5GMTBZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWHAZDINJYHE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/CJNE4U33QQV7HGAIDTMFLZD5GMTBZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWHAZDINJYHE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Ken Mathiasen, M.Sc.ITPD
Povlstoft 16, Blans
6400 Sønderborg
mobil: +45 5320 1965
mail: ***@***.***
|
- Subscribe to onToolbarMenuClick in config.json events so the editor actually delivers toolbar clicks (the missing subscription is why the Insert-tab icon did nothing). - Single OnlyMath toolbar icon with a dropdown: Insert (Alt+M), Calculate (Alt+C), Solve (Alt+L), OnlyMath Settings. Tooltip: "CAS Calculator - OnlyMath". - Sandbox-safe: editor-mediated AddToolbarMenuItem/attachToolbarMenuClickEvent only; no ancestor-frame access. - Refresh built bundles. Co-authored-by: Cursor <cursoragent@cursor.com>
|
....done - thank you for your input. have a nice weekend - cheers ken
Den fre. 24. jul. 2026 kl. 11.21 skrev Arthur ***@***.***>:
… *drape3a* left a comment (ONLYOFFICE/onlyoffice.github.io#629)
<#629 (comment)>
Hi @MrMathiasen <https://github.com/MrMathiasen>!
Settings still doesn't open from the toolbar (Insert tab).
—
Reply to this email directly, view it on GitHub
<#629?email_source=notifications&email_token=CJNE4U5PUIWJFO54NNGQIBD5GMTBZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWHAZDINJYHE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5068245894>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CJNE4U42XMNU7KDP4G4X2WT5GMTBZAVCNFSNUABFKJSXA33TNF2G64TZHMZDKNBWGA3TGNBXHNEXG43VMU5TIOJUGY4DOOBYGI4KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CJNE4UZ3H2TSBZCKVT7Q2LD5GMTBZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWHAZDINJYHE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/CJNE4U33QQV7HGAIDTMFLZD5GMTBZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWHAZDINJYHE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Ken Mathiasen, M.Sc.ITPD
Povlstoft 16, Blans
6400 Sønderborg
mobil: +45 5320 1965
mail: ***@***.***
|
OnlyMath
OnlyMath adds an in-document computer-algebra tool to the Document editor.
Insert a math field with
Alt+Mand evaluate it in place:"Mathematical" mode that keeps
π,√2,eexactk)How it works
Math is evaluated by Giac/Xcas, compiled to WebAssembly and run in a Web
Worker. The engine is bundled with the plugin, so OnlyMath works fully
offline — no external services and no API keys.
What this PR adds
sdkjs-plugins/content/onlymath/— the complete plugin (config.jsonv1.0.0,index.html+panel.html, built assets, the Giac engine undercas/,light/dark toolbar icons, store card icons + 4 screenshots,
CHANGELOG.md,README.md,LICENSE).store/config.json(discussionleft empty).Notes
work,specAbilities(its license is included at
cas/giac/LICENSE).