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

when I use loadFromString , but the Canvas is empty #973

Closed
w8w8w8 opened this issue Jun 1, 2024 · 4 comments
Closed

when I use loadFromString , but the Canvas is empty #973

w8w8w8 opened this issue Jun 1, 2024 · 4 comments

Comments

@w8w8w8
Copy link
Contributor

w8w8w8 commented Jun 1, 2024

image

image

image

set debugger:

image

image

I have get svg string from my server, but can not loadFromString . At the beginning, it was successful, but then suddenly it turned into a blank screen. Is that the method I used wrong?

@jfhenon
Copy link
Collaborator

jfhenon commented Jun 2, 2024

which version of svgedit are you using?

@w8w8w8
Copy link
Contributor Author

w8w8w8 commented Jun 4, 2024

which version of svgedit are you using?

7.2

@jfhenon
Copy link
Collaborator

jfhenon commented Aug 17, 2024

I suggest to check the console for any error message.
You can also add the alert flag to the loadfromString which will display a console message in case of exception.

The code from Editor.js:

/**
   * @function module:SVGthis.loadFromString
   * @param {string} str The SVG string to load
   * @param {PlainObject} [opts={}]
   * @param {boolean} [opts.noAlert=false] Option to avoid alert to user and instead get rejected promise
   * @returns {Promise<void>}
   */
  loadFromString (str, { noAlert } = {}) {
    return this.ready(async () => {
      try {
        await this.loadSvgString(str, { noAlert })
      } catch (err) {
        if (noAlert) {
          throw err
        }
      }
    })
  }`

@jfhenon
Copy link
Collaborator

jfhenon commented Oct 27, 2024

no reply so closing this issue. Please reopen if required.

@jfhenon jfhenon closed this as completed Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants