Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: lib/phantomscript.js - foreignObjects in SVG - related to #58 #340

Closed
raghur opened this issue Apr 2, 2016 · 3 comments
Closed

Comments

@raghur
Copy link
Contributor

raghur commented Apr 2, 2016

So I've been playing around with writing a parser and adding a new diagram type. In my renderer, I added a foreignObject which got replaced to text/tspan. After a puzzling time, I found the following in lib/phantomscript.js

  // traverse the SVG, and replace all foreignObject elements
  // can be removed when https://github.com/knsv/mermaid/issues/58 is resolved
  allElements = traverse(oDOM)
  for (var i = 0, len = allElements.length; i < len; i++) {
    resolveForeignObjects(allElements[i])
  }

#58 is marked as resolved ... I commented out the call and my fo's are no longer being replaced and all seems good (cursorily though)

I don't fully understand the discussion - but wanted to ask that since the ticket is marked as resolved, then will this call to resolveForeignObjects can now be removed?

@knsv
Copy link
Collaborator

knsv commented Apr 2, 2016

I svg markup you can insert non svg elements using a foreign object tag. Some labels in the flowcharts for instance can use this feature that simplifies text handling by using html.

That however can cause problems if you generate a svg file using the command line tool and try to open it in a svg editor. (That was the problem in issue 58)

@raghur
Copy link
Contributor Author

raghur commented Apr 2, 2016

I'm using foreign objects for the same purpose.. Creating labels that wrap text easily and so on.

IMO, majority of the use case is svg being viewed in a browser... So could there be a switch for enabling disabling fo usage?

I see the 'pure' svg approach, but that makes styling and manipulation harder for the general case of viewing svg in browser

@tylerlong
Copy link
Collaborator

We no longer use phantomjs.

mgenereu pushed a commit to mgenereu/mermaid that referenced this issue Jun 25, 2022
mgenereu pushed a commit to mgenereu/mermaid that referenced this issue Jun 25, 2022
* master: (25 commits)
  chore(deps-dev): bump typescript from 4.4.2 to 4.4.3
  chore(deps-dev): bump svelte from 3.42.4 to 3.42.5
  chore(deps): bump js-base64 from 3.6.2 to 3.7.0
  chore(deps): bump node from 16.8.0 to 16.9.0
  Skip beta deploy
  [ImgBot] Optimize images
  Dont allow lookbehind in regexp
  Fix no lookbehinds in comments
  chore(deps-dev): bump tailwindcss from 2.2.11 to 2.2.15
  chore(deps-dev): bump eslint-plugin-svelte3 from 3.2.0 to 3.2.1
  chore(deps-dev): bump prettier from 2.3.2 to 2.4.0
  Test deploy on PRs
  Fix manifest issue
  Update node
  Add back Highlighting. mermaid-js#340
  chore(deps-dev): bump @typescript-eslint/eslint-plugin
  chore(deps-dev): bump @typescript-eslint/parser from 4.30.0 to 4.31.0
  chore(deps): bump js-base64 from 3.6.1 to 3.6.2
  chore(deps-dev): bump tailwindcss from 2.2.9 to 2.2.11
  chore(deps): bump node from 14.17.0 to 16.8.0
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants