| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <title>jQuery UI Controlgroup - Toolbar</title> |
| 6 | <link rel="stylesheet" href="../../themes/base/all.css"> |
| 7 | <link rel="stylesheet" href="../demos.css"> |
| 8 | <style> |
| 9 | #zoom-button { |
| 10 | width: 55px; |
| 11 | } |
| 12 | #fontname-button, |
| 13 | #fontsize-button { |
| 14 | width: 45px; |
| 15 | } |
| 16 | #forecolor-button { |
| 17 | width: 50px; |
| 18 | } |
| 19 | #hilitecolor-button { |
| 20 | width: 70px; |
| 21 | } |
| 22 | #bold { |
| 23 | font-weight: bold; |
| 24 | } |
| 25 | #italic { |
| 26 | font-style: italic; |
| 27 | } |
| 28 | #underline { |
| 29 | text-decoration: underline; |
| 30 | } |
| 31 | .toolbar { |
| 32 | font-size: .75em; |
| 33 | } |
| 34 | #page { |
| 35 | width: 440px; |
| 36 | left: 50%; |
| 37 | position: relative; |
| 38 | margin-left: -226px; |
| 39 | height: 450px; |
| 40 | border: 1px solid #888; |
| 41 | box-shadow: 7px 7px 3px #ccc; |
| 42 | font-size: 11px; |
| 43 | font-family: "Lucida Grande"; |
| 44 | zoom: 100%; |
| 45 | padding: 5px; |
| 46 | white-space: pre-line; |
| 47 | overflow: scroll; |
| 48 | } |
| 49 | .wrap { |
| 50 | width: 588px; |
| 51 | } |
| 52 | </style> |
| 53 | <script src="../../external/requirejs/require.js"></script> |
| 54 | <script src="../bootstrap.js" data-modules="button checkboxradio selectmenu"> |
| 55 | var page = $( "#page" ); |
| 56 | var basicControls = [ "#print", "#bold", "#italic", "#undo", "#redo" ]; |
| 57 | var valueControls = [ "#fontsize", "#forecolor", "#hilitecolor", "#backcolor", "fontname" ]; |
| 58 | |
| 59 | $( "#print" ).button({ |
| 60 | "icon": "ui-icon-print", |
| 61 | "showLabel": false |
| 62 | }); |
| 63 | $( "#redo" ).button({ |
| 64 | "icon": "ui-icon-arrowreturnthick-1-e", |
| 65 | "showLabel": false |
| 66 | }); |
| 67 | $( "#undo" ).button({ |
| 68 | "icon": "ui-icon-arrowreturnthick-1-w", |
| 69 | "showLabel": false |
| 70 | }); |
| 71 | |
| 72 | $( ".toolbar" ).controlgroup(); |
| 73 | $( "#zoom" ).on( "selectmenuchange", function() { |
| 74 | page.css({ "zoom": $( this ).val() }); |
| 75 | }) |
| 76 | $( basicControls.concat( valueControls ).join( ", " ) ).on( "click change selectmenuchange", |
| 77 | function() { |
| 78 | document.execCommand( |
| 79 | this.id, |
| 80 | false, |
| 81 | $( this ).val() |
| 82 | ); |
| 83 | } ); |
| 84 | $( "form" ).on( "submit", function( event ) { |
| 85 | event.preventDefault(); |
| 86 | }); |
| 87 | </script> |
| 88 | </head> |
| 89 | <body> |
| 90 | <div class="wrap"> |
| 91 | <div class="toolbar"> |
| 92 | <button id="print">Print</button> |
| 93 | <button id="undo">Undo</button> |
| 94 | <button id="redo">Redo</button> |
| 95 | <select id="zoom"> |
| 96 | <option selected disabled>Zoom</option> |
| 97 | <option>50%</option> |
| 98 | <option>75%</option> |
| 99 | <option>90%</option> |
| 100 | <option>100%</option> |
| 101 | <option>125%</option> |
| 102 | <option>150%</option> |
| 103 | <option>200%</option> |
| 104 | </select> |
| 105 | <select id="fontname"> |
| 106 | <option selected disabled>Font</option> |
| 107 | <option>Arial</option> |
| 108 | <option>Comic Sans MS</option> |
| 109 | <option>Courier New</option> |
| 110 | <option>Georgia</option> |
| 111 | <option>Impact</option> |
| 112 | <option>Lucida Grande</option> |
| 113 | <option>Times New Roman</option> |
| 114 | <option>Verdana</option> |
| 115 | </select> |
| 116 | <select id="fontsize"> |
| 117 | <option selected disabled>Size</option> |
| 118 | <option value="1">8px</option> |
| 119 | <option value="2">9px</option> |
| 120 | <option value="3">10px</option> |
| 121 | <option value="4">11px</option> |
| 122 | <option value="5">12px</option> |
| 123 | <option value="6">14px</option> |
| 124 | <option value="7">18px</option> |
| 125 | <option value="8">24px</option> |
| 126 | <option value="9">30px</option> |
| 127 | <option value="10">36px</option> |
| 128 | </select> |
| 129 | <select id="hilitecolor" title="Background color"> |
| 130 | <option selected disabled>Highlight</option> |
| 131 | <option value="white">None</option> |
| 132 | <option value="red">Red</option> |
| 133 | <option value="yellow">Yellow</option> |
| 134 | <option value="green">Green</option> |
| 135 | <option value="blue">Blue</option> |
| 136 | <option value="grey">Grey</option> |
| 137 | <option value="purple">Purple</option> |
| 138 | <option value="orange">Orange</option> |
| 139 | </select> |
| 140 | <select id="forecolor" title="Color"> |
| 141 | <option selected disabled>Color</option> |
| 142 | <option value="black">Black</option> |
| 143 | <option value="white">White</option> |
| 144 | <option value="red">Red</option> |
| 145 | <option value="yellow">Yellow</option> |
| 146 | <option value="green">Green</option> |
| 147 | <option value="blue">Blue</option> |
| 148 | <option value="#ccc">Grey</option> |
| 149 | <option value="purple">Purple</option> |
| 150 | <option value="orange">Orange</option> |
| 151 | </select> |
| 152 | <button id="bold">B</button> |
| 153 | <button id="italic">I</button> |
| 154 | <button id="underline">U</button> |
| 155 | |
| 156 | </div> |
| 157 | <pre id="page" contenteditable="true"> |
| 158 | The Rime of the Ancient Mariner (text of 1834) |
| 159 | BY SAMUEL TAYLOR COLERIDGE |
| 160 | Argument |
| 161 | |
| 162 | How a Ship having passed the Line was driven by storms to the cold Country towards the South Pole; |
| 163 | and how from thence she made her course to the tropical Latitude of the Great Pacific Ocean; and |
| 164 | of the strange things that befell; and in what manner the Ancyent Marinere came back to his own |
| 165 | Country. |
| 166 | |
| 167 | PART I |
| 168 | It is an ancient Mariner, |
| 169 | And he stoppeth one of three. |
| 170 | 'By thy long grey beard and glittering eye, |
| 171 | Now wherefore stopp'st thou me? |
| 172 | |
| 173 | The Bridegroom's doors are opened wide, |
| 174 | And I am next of kin; |
| 175 | The guests are met, the feast is set: |
| 176 | May'st hear the merry din.' |
| 177 | |
| 178 | He holds him with his skinny hand, |
| 179 | 'There was a ship,' quoth he. |
| 180 | 'Hold off! unhand me, grey-beard loon!' |
| 181 | Eftsoons his hand dropt he. |
| 182 | |
| 183 | He holds him with his glittering eye— |
| 184 | The Wedding-Guest stood still, |
| 185 | And listens like a three years' child: |
| 186 | The Mariner hath his will. |
| 187 | |
| 188 | The Wedding-Guest sat on a stone: |
| 189 | He cannot choose but hear; |
| 190 | And thus spake on that ancient man, |
| 191 | The bright-eyed Mariner. |
| 192 | |
| 193 | 'The ship was cheered, the harbour cleared, |
| 194 | Merrily did we drop |
| 195 | Below the kirk, below the hill, |
| 196 | Below the lighthouse top. |
| 197 | |
| 198 | The Sun came up upon the left, |
| 199 | Out of the sea came he! |
| 200 | And he shone bright, and on the right |
| 201 | Went down into the sea. |
| 202 | |
| 203 | Higher and higher every day, |
| 204 | Till over the mast at noon—' |
| 205 | The Wedding-Guest here beat his breast, |
| 206 | For he heard the loud bassoon. |
| 207 | |
| 208 | The bride hath paced into the hall, |
| 209 | Red as a rose is she; |
| 210 | Nodding their heads before her goes |
| 211 | The merry minstrelsy. |
| 212 | |
| 213 | The Wedding-Guest he beat his breast, |
| 214 | Yet he cannot choose but hear; |
| 215 | And thus spake on that ancient man, |
| 216 | The bright-eyed Mariner. |
| 217 | |
| 218 | And now the STORM-BLAST came, and he |
| 219 | Was tyrannous and strong: |
| 220 | He struck with his o'ertaking wings, |
| 221 | And chased us south along. |
| 222 | |
| 223 | With sloping masts and dipping prow, |
| 224 | As who pursued with yell and blow |
| 225 | Still treads the shadow of his foe, |
| 226 | And forward bends his head, |
| 227 | The ship drove fast, loud roared the blast, |
| 228 | And southward aye we fled. |
| 229 | |
| 230 | And now there came both mist and snow, |
| 231 | And it grew wondrous cold: |
| 232 | And ice, mast-high, came floating by, |
| 233 | As green as emerald. |
| 234 | |
| 235 | And through the drifts the snowy clifts |
| 236 | Did send a dismal sheen: |
| 237 | Nor shapes of men nor beasts we ken— |
| 238 | The ice was all between. |
| 239 | |
| 240 | The ice was here, the ice was there, |
| 241 | The ice was all around: |
| 242 | It cracked and growled, and roared and howled, |
| 243 | Like noises in a swound! |
| 244 | |
| 245 | At length did cross an Albatross, |
| 246 | Thorough the fog it came; |
| 247 | As if it had been a Christian soul, |
| 248 | We hailed it in God's name. |
| 249 | |
| 250 | It ate the food it ne'er had eat, |
| 251 | And round and round it flew. |
| 252 | The ice did split with a thunder-fit; |
| 253 | The helmsman steered us through! |
| 254 | |
| 255 | And a good south wind sprung up behind; |
| 256 | The Albatross did follow, |
| 257 | And every day, for food or play, |
| 258 | Came to the mariner's hollo! |
| 259 | |
| 260 | In mist or cloud, on mast or shroud, |
| 261 | It perched for vespers nine; |
| 262 | Whiles all the night, through fog-smoke white, |
| 263 | Glimmered the white Moon-shine.' |
| 264 | |
| 265 | 'God save thee, ancient Mariner! |
| 266 | From the fiends, that plague thee thus!— |
| 267 | Why look'st thou so?'—With my cross-bow |
| 268 | I shot the ALBATROSS. |
| 269 | </pre> |
| 270 | </div> |
| 271 | <div class="demo-description"> |
| 272 | <p>A sample editor toolbar</p> |
| 273 | <p>Highlight text and edit it using the buttons and dropdowns in the toolbar.</p> |
| 274 | <p class="warning">Remember: This is only a demo and shouldn't be used for anything in production. Use a proper editor like <a href="https://prosemirror.net/">ProseMirror</a> instead. |
| 275 | </div> |
| 276 | </body> |
| 277 | </html> |