No Description

config.js 3.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. 'use strict';
  2. const autoHeightHtml0 = `<p style="font-weight: 400;font-style: normal;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;">Tags are great for describing the essence of your story in a single word or phrase, but stories are rarely about a single thing. <span style="background-color: transparent !important;background-image: linear-gradient(to bottom, rgba(146, 249, 190, 1), rgba(146, 249, 190, 1));">If I pen a story about moving across the country to start a new job in a car with my husband, two cats, a dog, and a tarantula, I wouldn't only tag the piece with "moving". I’d also use the tags "pets", "marriage", "career change", and "travel tips".</span></p>`;
  3. const autoHeightHtml1 = `Tags are great for describing the essence of your story in a single word or phrase, but stories are rarely about a single thing. If I pen a story about moving across the country to start a new job in a car with my husband, two cats, a dog, and a tarantula, I wouldn’t only tag the piece with "moving".`;
  4. const style0 = `
  5. p {
  6. padding: 50px;
  7. box-sizing: border-box;
  8. }
  9. `;
  10. const style1 = `
  11. p {
  12. font-size: 12px !important;
  13. box-sizing: border-box;
  14. }
  15. `;
  16. const inlineBodyStyle = `
  17. body {
  18. display: inline-block;
  19. }
  20. `;
  21. const autoHeightScript = `
  22. var styleElement = document.createElement('style');
  23. styleElement.innerHTML = '${style1
  24. .replace(/\'/g, "\\'")
  25. .replace(/\n/g, '\\n')}';
  26. document.head.appendChild(styleElement);
  27. document.body.style.background = 'cornflowerblue';
  28. `;
  29. const autoWidthHtml0 = `
  30. <html>
  31. <head>
  32. <meta name="viewport" content="target-densitydpi=device-dpi, initial-scale=1.0, user-scalable=no" />
  33. </head>
  34. <p class="localStyle" style="display: inline;background-color: transparent !important;background-image: linear-gradient(to bottom, rgba(146, 249, 190, 1), rgba(146, 249, 190, 1));font-style: normal;zoom:1;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;">hey</p>
  35. </html>
  36. `;
  37. const autoWidthHtml1 = `
  38. <p style="display: inline;background-color: transparent !important;">easy</p>
  39. `;
  40. const autoWidthScript = `
  41. var styleElement = document.createElement('style');
  42. styleElement.innerHTML = '${style1
  43. .replace(/\'/g, "\\'")
  44. .replace(/\n/g, '\\n')}';
  45. document.head.appendChild(styleElement);
  46. `;
  47. const autoDetectLinkHtml = `
  48. <p style="font-weight: 400;font-style: normal;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;">
  49. <a href="https://github.com/iou90/react-native-autoheight-webview">Tags</a> are great for describing the essence of your story in a single word or phrase, but stories are rarely about a single thing.
  50. <span style="background-color: transparent !important;background-image: linear-gradient(to bottom, rgba(146, 249, 190, 1), rgba(146, 249, 190, 1));">If I pen a story about moving across the country to start a new job in a car with my husband, two cats, a dog, and a tarantula, I wouldn't only tag the piece with "moving". I’d also use the <a href="http://x-squad.com">tags</a> "pets", "marriage", "career change", and "travel tips".</span>
  51. </p>
  52. `;
  53. //https://medium.com/@elhardoum/opening-external-links-in-browser-in-react-native-webview-18fe6a66312a
  54. const autoDetectLinkScript = `
  55. !function(){
  56. function isUrl(str){
  57. return str.startsWith('http');
  58. }
  59. var e=function(e,n,t){if(n=n.replace(/^on/g,""),"addEventListener"in window)e.addEventListener(n,t,!1);else if("attachEvent"in window)e.attachEvent("on"+n,t);else{var o=e["on"+n];e["on"+n]=o?function(e){o(e),t(e)}:t}return e},n=document.querySelectorAll("a[href]");if(n)for(var t in n)n.hasOwnProperty(t)&&e(n[t],"onclick",function(e){!isUrl(this.href)||(e.preventDefault(),window.postMessage(JSON.stringify({url:this.href})))})
  60. }();
  61. `;
  62. export {
  63. autoHeightHtml0,
  64. autoHeightHtml1,
  65. style0,
  66. autoHeightScript,
  67. autoWidthHtml0,
  68. autoWidthHtml1,
  69. autoWidthScript,
  70. inlineBodyStyle,
  71. autoDetectLinkHtml,
  72. autoDetectLinkScript
  73. };