react-helmet icon indicating copy to clipboard operation
react-helmet copied to clipboard

Add support for multi windows.

Open vipcxj opened this issue 8 years ago • 8 comments

Add props: window and document. With them, this library will work with multi windows environment. For example, with https://github.com/ryanseddon/react-frame-component:

<Frame> <Helmet window={this.context.window} document={this.context.document}> <Script>...</Script> </Helmet> </Frame> The script will be add to the head of the iframe instead of the parent window.

update: add a feature. <Helmet> <body sytle={{color: 'red'}}/> </Helmet> this works now.

vipcxj avatar May 08 '17 07:05 vipcxj

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 08 '17 07:05 CLAassistant

Codecov Report

Merging #278 into master will decrease coverage by 1.29%. The diff coverage is 92.55%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #278     +/-   ##
=========================================
- Coverage   98.92%   97.62%   -1.3%     
=========================================
  Files           3        3             
  Lines         278      337     +59     
=========================================
+ Hits          275      329     +54     
- Misses          3        8      +5
Impacted Files Coverage Δ
src/Helmet.js 100% <ø> (ø) :arrow_up:
src/HelmetUtils.js 97.03% <92.55%> (-1.55%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update aad5457...22cc083. Read the comment docs.

codecov[bot] avatar May 08 '17 09:05 codecov[bot]

I have merge master, no conflicts now. And I replace full version lodash with module version lodash. All test passed.

vipcxj avatar May 13 '17 11:05 vipcxj

Any chance we could get an update on this PR @vipcxj @jamsea?

richtr avatar Sep 21 '17 23:09 richtr

Any updates on this one? We are currently having problems because Helmet doesn't support multiple windows.

smddzcy avatar Nov 13 '17 18:11 smddzcy

@smddzcy I can resolve conflicts when I am not busy. But I don't know how to pass codecov check.

vipcxj avatar Nov 14 '17 05:11 vipcxj

@vipcxj You can see the untested lines of code here: https://codecov.io/gh/nfl/react-helmet/pull/278/diff

smddzcy avatar Nov 14 '17 12:11 smddzcy

Wouldn't a kebob-case function be as simple as looking at charCodes for any character falling in the range 65 - 90 and replace it with "-" and that same charCode plus 32 ?

`/** *

  • @param camelCaseString - A camelCased String that needs to be converted to kabob-case

  • @description As camelCase never begins with a capital this function naively assumes camelCaseString will not either

  • @returns {string} - A String formatted in kabob-case */ function camelToKabobConverter(camelCaseString){ let result = ''; for(let i = 0 ; i < camelCaseString.length ; i++){ let charCode = camelCaseString.charCodeAt(i); result += (charCode <= 90 && charCode >= 65) ? -${String.fromCharCode(charCode+32)} : String.fromCharCode(charCode);

    } return result } console.log(camelToKabobConverter('helloWorld')); // hello-world`

miaklwalker avatar Apr 07 '20 06:04 miaklwalker