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

Editor Icons Fail to Display if Page URL Contains Query String #1237

Open
nmchapin opened this issue Jul 26, 2021 · 2 comments
Open

Editor Icons Fail to Display if Page URL Contains Query String #1237

nmchapin opened this issue Jul 26, 2021 · 2 comments
Labels
bug:core Bug in core (trumbowyg.js)

Comments

@nmchapin
Copy link

nmchapin commented Jul 26, 2021

When loading SVG icons for the editor from a file, the icons will fail to display if the page contains a query string. This regression was introduced in version 2.22 after the following line was introduced:

var baseHref = !!t.doc.querySelector('base') ? window.location.href.split(/[?#]/)[0] : '';

In the previous version, this line used a different argument for splitting the HREF of the current page. It looked like this:

t.svgPath = !!t.doc.querySelector('base') ? window.location.href.split('#')[0] : '';

As you can see, the HREF is split on the pound character. This allowed icons to be correctly referenced by the editor in their respective USE tags. So, for instance, a URL for referencing the "Bold" icon would look like this:

http://localhost/object/edit?page=2#trumbowyg-bold

But, due to the regression, this URL looks like this:

http://localhost/object/edit#trumbowyg-bold

@Alex-D
Copy link
Owner

Alex-D commented Jul 26, 2021

Hi!

You right! The origin commit is: 0cff83e

I did not understand why I've done this change.

I think I should roll back this in the next version.

@Alex-D Alex-D added the bug:core Bug in core (trumbowyg.js) label Jul 26, 2021
@phuongnle
Copy link

Hi @Alex-D

I think I should roll back this in the next version.

Do you plan to do it in the near future?

And there's also a PR for this issue as well #1279

Thanks for the great lib btw ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:core Bug in core (trumbowyg.js)
Projects
None yet
Development

No branches or pull requests

3 participants