font_family.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  5. <link rel="stylesheet"
  6. href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.0.2/css/material-design-iconic-font.min.css">
  7. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
  8. <link rel="stylesheet" href="../../css/froala_editor.css">
  9. <link rel="stylesheet" href="../../css/froala_style.css">
  10. <link
  11. href='https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,700,700italic&subset=latin,vietnamese,latin-ext,cyrillic,cyrillic-ext,greek-ext,greek'
  12. rel='stylesheet' type='text/css'>
  13. <link href='https://fonts.googleapis.com/css?family=Oswald:400,300,700&subset=latin,latin-ext' rel='stylesheet'
  14. type='text/css'>
  15. <link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
  16. <link
  17. href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300italic,700&subset=latin,greek,greek-ext,vietnamese,cyrillic-ext,cyrillic,latin-ext'
  18. rel='stylesheet' type='text/css'>
  19. <style>
  20. body {
  21. text-align: center;
  22. }
  23. section {
  24. width: 81%;
  25. margin: auto;
  26. text-align: left;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <section id="editor">
  32. <div id='edit' style="margin-top: 30px;">
  33. <h1>Font Family</h1>
  34. <img class="fr-fir fr-dii" src="../../img/photo1.jpg" alt="Old Clock" width="300" />
  35. <p>When using the font_family.min.js plugin it is possible to add your own fonts to be used inside the WYSIWYG
  36. HTML editor.</p>
  37. <p>First you have to include the font on your webpage. In this example we are adding 4 Google fonts: Roboto,
  38. Oswald, Montserrat and Open Sans Condensed. Then you have to define the fonts that should appear in the Font
  39. Family dropdown using the <a href='https://www.froala.com/wysiwyg-editor/v2.0/docs/options#fontFamily'
  40. title='fontFamily' target='_blank'>fontFamily</a> option. This option is an Object where the key represents
  41. the font name (just the way you would pass it to the font-family CSS rule e.g. font-family: <strong>'Roboto',
  42. sans-serif</strong>;) and its value is the font name that appears in the dropdown list e.g.
  43. <strong>Roboto</strong>.</p>
  44. <p>By default the font family icon is visible in the editor's toolbar. If you want to be able to see the actual
  45. font family for the selected text you can use the <a
  46. href='https://www.froala.com/wysiwyg-editor/v2.0/docs/options#fontFamilySelection' title='fontFamilySelection'
  47. target='_blank'>fontFamilySelection</a> option.</p>
  48. </div>
  49. </section>
  50. <script type="text/javascript" src="../../js/froala_editor.min.js"></script>
  51. <script type="text/javascript" src="../../js/plugins/font_family.min.js"></script>
  52. <script>
  53. (function () {
  54. new FroalaEditor("div#edit", {
  55. fontFamily: {
  56. "Roboto,sans-serif": 'Roboto',
  57. "Oswald,sans-serif": 'Oswald',
  58. "Montserrat,sans-serif": 'Montserrat',
  59. "'Open Sans Condensed',sans-serif": 'Open Sans Condensed'
  60. },
  61. fontFamilySelection: true
  62. })
  63. })()
  64. </script>
  65. </body>
  66. </html>