Jump to content
You must now use your email address to sign in [click for more info] ×

layer name is not trimmed


Recommended Posts

When having a space (at the end) of a layer name and exporting to svg, Designer doesn't trim the layername when setting it in the svg's id attribute. Resulting in an illegal (non-working) id.

I don't believe pre- and postfix spaces will be ever usefull and especially while naming hundreds of layers a mistake by entering a non-wanting space there is made very quickly, but pretty much impossible to spot in the editor.

This results in different IDs in the svg output though, making the elements not be found by code, as these 'invisible' spaces are replaced by hyphens (which is great with inbetween spaces, but not with post- and prefix spaces).

Could Designer please always trim pre- and postfix spaces in layer names directly after entering them?

 

 

Link to comment
Share on other sites

  • Staff

Hi wigglepixel,

As far as I can see the actual space is stripped away and replaced with a hyphen in the actual 'ID' entry that matters.  If you've got a document that this is failing with on export then by all means please do attach it.

It was reported a while back that IDs were including spaces if the layer name contained a space, so it decided to change the space to a hyphen to stop the illegal ids. However we also retained the original layer name using 'serif:id' which is used on import back into Affinity so your layer names still contain spaces.

image.png
 

Link to comment
Share on other sites

12 minutes ago, Sean P said:

Hi wigglepixel,

As far as I can see the actual space is stripped away and replaced with a hyphen in the actual 'ID' entry that matters.  If you've got a document that this is failing with on export then by all means please do attach it.

It was reported a while back that IDs were including spaces if the layer name contained a space, so it decided to change the space to a hyphen to stop the illegal ids. However we also retained the original layer name using 'serif:id' which is used on import back into Affinity so your layer names still contain spaces.
 

Thanks for your quick response. Ah, I believe you're right. I remember I've seen a hyphen along in the process. So probably I 'automatically' replaced the hyphen and forgot about it. Sorry for the inconvinience. So just changed the opening post.

There's still the thing about spaces in the layer names though. We cannot see them in the editor, so accidentely entered spaces in the layer names are difficult/not to spot in the editor, but are a pain in the resulting SVG when programming as the IDs suddenly are different (just found out the hard way with a few hundred layers here, where chances were higher that by accident a space was entered in some of these layers. These issues are very difficult/impossible to spot in the editor)

Is there a reason why leading and trailing spaces aren't trimmed from layernames inside Designer?

Link to comment
Share on other sites

  • Staff
3 minutes ago, wigglepixel said:

Ah, you might be right. I indeed saw a hyphen along in the process. So probably I 'automatically' replaced the hyphen. Sorry for the inconvinience.

There's still the thing about spaces in the layer names though. We cannot see them in the editor, so accidentely entered spaces in the layer names are difficult/not to spot in the editor (just found out the hard way with a few hundred layers here, where chances are higher that by accident a space was entered in some of these layers)

Is there a reason why leading and trailing spaces aren't trimmed from layernames inside Designer though?

There is no specific reason I'm aware of, but we do risk breaking workflow for other users if we do this, as the SVG format is quite versatile.

Link to comment
Share on other sites

18 minutes ago, Sean P said:

There is no specific reason I'm aware of, but we do risk breaking workflow for other users if we do this, as the SVG format is quite versatile.

Just to be clear that we don't have a misunderstanding; I'm not talking about middle  spaces (inbetween spaces), but leading and trailing spaces of the layer names.

I can't think of a workflow of people using leading and trailing spaces we cannot see in the editor anyhow (definitely not the trailing spaces), but let's say there is a useful workflow to use them; could you guys please consider to add a setting to automatically strip them during entering (or when exporting) as these are error prone when programming with svg's and lots of layers and I don't see any way to spot issues with spaces now in the editor without clicking all hundred layers one by one, which does't only take a loooong time and is boring, but also is errror prone by itself, as it's active for changes again? Please consider this, it doesn't seem like a major change, but it makes a difference of hours of work here.

Just a quick demo to illustrate this

This is a layername without a trailing space:

image.png.db8cf7804beee7b88f3a169a86dc09a5.png

And this is a layername with a trailing space:

image.png.e02a9d5bc7f14a9fa412aa93c687843f.png

I don't know about other people, but for me it's pretty much impossible to spot, especially when having hundreds of layers in a file and inside groups all with different names. I can't spot the difference even when directly looking at it. But one of these names is wrong as the space got there by accident and is now messing up the workflow in svg.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.