Skip to content

fix(freemind): load FreeMind files again and import them more completely - #407

Merged
AndyScherzinger merged 10 commits into
mainfrom
fix/freemind-import
Oct 20, 2026
Merged

AndyScherzinger merged 10 commits into
mainfrom
fix/freemind-import

Conversation

@AndyScherzinger

@AndyScherzinger AndyScherzinger commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

FreeMind (.mm) files did not open: the editor showed "Load file fail!ReferenceError: FilesMindMap is not defined", although the app lists FreeMind as supported (read-only). Testing with real files then showed more gaps in the import. One commit each:

  • Load failure: src/plugins/freemind.js still called xml2json through a global FilesMindMap.Util. That global no longer exists since the frontend was split into modules in November 2024 (62f4fe1), so every .mm file failed in every release since. The plugin now imports util as the XMind plugin does. The unit test defined that global itself, which hid the problem; it now tests the real module.
  • Formatted text (FreeMind 0.9 and later): text with any formatting is stored as HTML in <richcontent TYPE="NODE"> instead of the TEXT attribute. Such nodes, often the central one, were empty; their text is now taken from the HTML, one line per paragraph.
  • Line breaks: <br> in that HTML is now a line break, while the whitespace the HTML is wrapped with is still collapsed.
  • Formatted text (FreeMind 0.8): that version stored the HTML directly in TEXT, which showed up as raw markup. It is now converted the same way. Form fields in it, such as rating dropdowns, show their chosen value.
  • Notes and folded branches: notes (<richcontent TYPE="NOTE">) now become editor notes, and branches folded in FreeMind (FOLDED="true") open collapsed.
  • Icons: FreeMind icons the editor has no marker for are shown as emoji before the node text (✅, ⌛, 😊, ℹ️, …), so icon-only nodes are no longer empty. full-9 now maps to priority 9 like full-1 to full-8.
  • Images: a node whose formatted text is just an image gets the image's alt text or file name as its text (binah.gif → "binah"), and an image on the web becomes the node's link unless it has one already. Images themselves can't be shown: external ones are blocked by the CSP.
  • Text style and colours: a node's bold, italic, size and font name (<font>), its text colour (COLOR) and its background (BACKGROUND_COLOR) are taken over. FreeMind's default font (SansSerif, Dialog) is left to the editor, Java's other logical fonts map to CSS families, and a node with a background but no text colour gets FreeMind's black text. Branch line colours and styles (<edge>) have no counterpart and stay unmapped.
  • Not a FreeMind file: a .mm file without a FreeMind map, such as a saved web page, failed with a TypeError about reading TEXT of undefined. It now fails with "This file is not a valid FreeMind mind map.". Decoding errors reach the alert as their message instead of the error object.

Tested on Nextcloud 32, 35 and 36, in Chromium and Firefox, with the same results on every version and in both browsers:

File Nodes Central node Notes Collapsed
FreeMind template (FreeMind 1.1) 290 "FreeMind / Mind Map / Template" – 4
FreeMind's own documentation map (1.0.1) 482 "FreeMind / - free mind mapping software -" 17 58
Freeplane "Basic Functions" map (Freeplane 1.9) 69 "Basic Freeplane / Functions" 34 –
A FreeMind 0.8 map 137 "Complete Man" – 40
A saved web page named .mm – clear error message – –

The counts match the files. After the icon and image commits, no node is empty except two with TEXT="" in the Freeplane file. In Windows Chrome the emoji render in colour, for example "✅ DONE" and "✅😊 Done, but improvements possible" in the template; its central node keeps its green background with black text, and the "RESULT" nodes of the 0.8 map are red, bold and italic as in FreeMind. Unit tests cover each case; Vitest and lint pass.

Backport: #408.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

The FreeMind plugin still read xml2json from a global FilesMindMap.Util
that no longer exists since the frontend was split into modules, so
every .mm file failed with "FilesMindMap is not defined". Import util
as the XMind plugin does. The test defined that global itself, which hid
the problem; it now runs against the real module.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
FreeMind keeps formatted node text as HTML in a richcontent element
instead of the TEXT attribute, so such nodes, often the central one,
were shown empty. Take their text from the rich content, one line per
paragraph.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
FreeMind separates lines of formatted text with <br> within one
paragraph, which came out as one run-on line. Take <br> as a line break,
and still collapse the whitespace the HTML is wrapped with.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
FreeMind 0.8 kept formatted node text as HTML in the TEXT attribute, so
the editor showed the raw markup. Take the plain text from that HTML as
for rich content, and show form fields by their chosen value instead of
all their options.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Take node notes from their rich content into the editor's notes, and
open branches folded in FreeMind collapsed.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
A .mm file that is no FreeMind map, such as a saved web page, failed
with a TypeError about reading TEXT of undefined. Check for a map with
a root node and fail with a clear message, and pass the message of a
decoding error to the load failure instead of the error object.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger AndyScherzinger changed the title fix(freemind): load FreeMind files again fix(freemind): load FreeMind files again and import them more completely Oct 20, 2026
The editor only has markers for priorities, so FreeMind's other icons
were dropped and icon-only nodes came out empty. Show them as emoji
before the node text, and map full-9 to priority 9 as well. Write the
line break marker as an escape rather than an invisible character.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Nodes whose formatted text is just an image came out empty. Use the
image's alternative text or file name as their text, and link images on
the web from the node unless it has a link already.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Map a node's bold, italic, size and font name, its text colour and its
background to the editor's node styles. FreeMind's default font is left
to the editor, and a node with a background but no text colour gets
FreeMind's black text, as the editor's own may not suit the background.
Branch line colours and styles have no counterpart and stay unmapped.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger
AndyScherzinger merged commit 8efcf99 into main Oct 20, 2026
8 checks passed
@AndyScherzinger
AndyScherzinger deleted the fix/freemind-import branch October 20, 2026 13:16
@AndyScherzinger AndyScherzinger mentioned this pull request Oct 20, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants