Giter VIP home page Giter VIP logo

Comments (5)

bogdankharchenko avatar bogdankharchenko commented on September 25, 2024 1

@tylersticka https://jsfiddle.net/spvubqrm/

from simple-svg-placeholder.

bogdankharchenko avatar bogdankharchenko commented on September 25, 2024 1

@tylersticka first off - you the bomb for the quick turn around

So my initial use case was related to an issue posted on a project which depends on your package.

https://github.com/Cherry/placeholders.dev

See issue Cherry/placeholders.dev#7

I'm going to pull this down a play a bit tomorrow!

from simple-svg-placeholder.

tylersticka avatar tylersticka commented on September 25, 2024 1

I've decided not to add this feature because it's an uncommon request and bulks up the source code, which feels a bit at odds with the "simple" goal of this library. It also means the resulting SVGs may not function as expected outside of the browser.

If someone wants to fork this repo and maintain their own multiline-svg-placeholder or simple-svg-placeholder-multiline library, they're welcome to (see license terms).

from simple-svg-placeholder.

tylersticka avatar tylersticka commented on September 25, 2024

It might be! foreignObject should be supported in img elements in everything but IE as long as it doesn't reference any external resources and as long as its elements include a xmlns="http://www.w3.org/1999/xhtml" attribute. If this actually worked, we'd probably want to make it optional since it will break IE compatibility and will roughly double the size of the asset.

Just to make sure I have full context, can you give an example of the sort of non-wrapping text that inspired this question?

from simple-svg-placeholder.

tylersticka avatar tylersticka commented on September 25, 2024

The good news is that this seems to work fine in non-IE browsers!

The bad news is that it increases the size of the function and its output by about a third. So I'd like to think about maybe restructuring the package a bit so modules and tree-shaking can happen intelligently if someone doesn't use that feature. Or maybe split things into two different functions.

@bogdankharchenko If you have an urgent need for this feature, I've pushed my quick and dirty test of the idea to this branch: https://github.com/cloudfour/simple-svg-placeholder/tree/feature/text-wrap

You must set the textWrap option to true to opt into that type of placeholder.

from simple-svg-placeholder.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.