Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Reintroduced the legacy wysiwyg wiki editor as an optional element which can be plugged in via the skin if desired. Several semi-related "code-adjacent" tweaks and improvements. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
03a64a39adcefcc5d9beb525531a4bb5 |
User & Date: | stephan 2020-08-30 18:58:42 |
Context
2020-08-30
| ||
19:07 | Explicit font color inheritance fix for .fossil-tooltip elements to fix it for a couple skins, and added some contrast to those widgets in the default skin. ... (check-in: e05bbdec user: stephan tags: trunk) | |
18:58 | Reintroduced the legacy wysiwyg wiki editor as an optional element which can be plugged in via the skin if desired. Several semi-related "code-adjacent" tweaks and improvements. ... (check-in: 03a64a39 user: stephan tags: trunk) | |
18:43 | Adapted SVG background from Florian for the .help-buttonlet CSS. ... (Closed-Leaf check-in: b2ece413 user: stephan tags: wikiedit-wysiwyg-legacy) | |
06:07 | Fixed color quirk (unintentionally deriving a default color) in the Ardoise skin reported at /forumpost/9ac6b287d9. ... (check-in: 693bf6b2 user: stephan tags: trunk) | |
Changes
Changes to skins/xekri/css.txt.
︙ | ︙ | |||
1116 1117 1118 1119 1120 1121 1122 | tr.row0 { /* use default */ } /* odd table row color */ tr.row1 { /* Use default */ } | > > > > > | 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 | tr.row0 { /* use default */ } /* odd table row color */ tr.row1 { /* Use default */ } .fossil-tooltip.help-buttonlet-content { background-color: #111; border: 1px solid rgba(255,255,255,0.5); } |
Changes to src/default.css.
︙ | ︙ | |||
1106 1107 1108 1109 1110 1111 1112 | both a LABEL tag and an INPUT or SELECT control. The wrapper is "necessary", as opposed to placing the INPUT in the LABEL, so that we can include multiple INPUT elements (e.g. a set of radio buttons). Note that these elements must sometimes be BLOCK elements (e.g. DIV) so that certain nesting constructs are legal. */ .input-with-label { | | | > | 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | both a LABEL tag and an INPUT or SELECT control. The wrapper is "necessary", as opposed to placing the INPUT in the LABEL, so that we can include multiple INPUT elements (e.g. a set of radio buttons). Note that these elements must sometimes be BLOCK elements (e.g. DIV) so that certain nesting constructs are legal. */ .input-with-label { border: 1px inset rgba(128, 128, 128, 0.5); border-radius: 0.25em; padding: 0.15em 0.25em; margin: 0 0.5em; display: inline-block; cursor: default; white-space: nowrap; } .input-with-label > * { vertical-align: middle; } .input-with-label > label { display: inline; /* some skins set label display to block! */ } |
︙ | ︙ | |||
1308 1309 1310 1311 1312 1313 1314 | the DOM and shown in a singleton popup when they are clicked. They may be SPAN elements if their children are all inline elements, otherwise they must be DIVs (block elements) so that nesting of block-element content is legal. */ .help-buttonlet { display: inline-block; | | | | | < < < < < < > > > > > > > > > > > > > > > > > > > > > | > > > > > > > < | | < > | 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | the DOM and shown in a singleton popup when they are clicked. They may be SPAN elements if their children are all inline elements, otherwise they must be DIVs (block elements) so that nesting of block-element content is legal. */ .help-buttonlet { display: inline-block; min-width: 1em; max-width: 1em; min-height: 1em; max-height: 1em; cursor: pointer; margin: 0 0 0 0.35em; background-image: /* white question mark on blue circular background */ url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' \ viewBox='0 0 15.867574 15.867574'%3e%3ccircle cx='7.9337869' cy='7.9337869' \ r='7.9337869' style='fill:%23f0f0f0;stroke-width:1' /%3e%3ccircle cx='7.9337869' \ cy='7.9337869' r='6.9662519' style='fill:%23404040;stroke-width:1' /%3e%3ccircle \ cx='7.9337869' cy='7.9337869' r='5.9987168' style='fill:%235080d0;stroke-width:1' \ /%3e%3cpath d='M 8.7214664,9.7504179 H 6.1597329 V 9.4027037 q 0,-0.5818896 \ 0.234175,-1.0289511 Q 6.628083,7.9195949 7.3802819,7.2241658 L 7.8344395,6.8125852 \ Q 8.2389238,6.4435822 8.4234253,6.1171563 8.6150232,5.7907304 8.6150232,5.4643045 \ q 0,-0.496735 -0.3406184,-0.7734874 Q 7.9337866,4.4069686 7.323512,4.4069686 q \ -0.5747934,0 -1.2418375,0.2412712 Q 5.4146304,4.8824149 4.6908164,5.3507651 \ V 3.1225537 Q 5.5494585,2.8245126 6.2590798,2.6825884 6.9687013,2.5406641 \ 7.6286492,2.5406641 q 1.7314764,0 2.6397908,0.7096215 0.908317,0.7025253 \ 0.908317,2.0579022 0,0.6954289 -0.276754,1.2489339 -0.276751,0.5464084 \ -0.9437957,1.1779715 L 9.5020499,8.1395775 Q 9.0195073,8.5795428 8.8704867,8.8491989 \ 8.7214664,9.1117588 8.7214664,9.4310884 Z M 6.1597329,10.800658 H 8.7214664 \ V 13.32691 H 6.1597329 Z' style='fill:%23f8f8f8;stroke-width:1.32118618' /%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: center; /* When not using a background image, this additional style works reasonably well along with a ::before content of "?": */ /*border-width: 1px; border-style: outset; border-radius: 0.5em; font-size: 100%; font-family: monspace; font-weight: 700; overflow: hidden; background-color: rgba(54, 54, 255,1); color: rgb(255, 255, 255); text-align: center; line-height: 1; */ } /*.help-buttonlet::before { content: "?"; }*/ /** We really want to hide all help text via CSS but CSS cannot select TEXT nodes. Thus we move them out of the way programmatically during initialization. */ .help-buttonlet > *{} /** CSS class for PopupWidget which wraps .help-buttonlet content. They also have class fossil-tooltip. We need an overly-exact selector here to be certain that this class's style overrides that of fossil-tooltip. */ .fossil-tooltip.help-buttonlet-content { cursor: default; text-align: left; border-style: outset; background-color: inherit; } |
Changes to src/fossil.dom.js.
︙ | ︙ | |||
398 399 400 401 402 403 404 | old.parentNode.removeChild(old); } }; dom.replaceNode.counter = 0; /** Two args == getter: (e,key), returns value | | | | | > > > | | > > > | > > | | | | | > | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | old.parentNode.removeChild(old); } }; dom.replaceNode.counter = 0; /** Two args == getter: (e,key), returns value Three or more == setter: (e,key,val[...,keyN,valN]), returns e. If val===null or val===undefined then the attribute is removed. If (e) has a forEach method then this routine is applied to each element of that collection via that method. Each pair of keys/values is applied to all elements designated by the first argument. */ dom.attr = function f(e){ if(2===arguments.length) return e.getAttribute(arguments[1]); const a = argsToArray(arguments); if(e.forEach){ /* Apply to all elements in the collection */ e.forEach(function(x){ a[0] = x; f.apply(f,a); }); return e; } a.shift(/*element(s)*/); while(a.length){ const key = a.shift(), val = a.shift(); if(null===val || undefined===val){ e.removeAttribute(key); }else{ e.setAttribute(key,val); } } return e; }; const enableDisable = function f(enable){ var i = 1, n = arguments.length; for( ; i < n; ++i ){ |
︙ | ︙ |
Changes to src/fossil.page.fileedit.js.
︙ | ︙ | |||
685 686 687 688 689 690 691 | }else if(D.hasClass(P.e.taCommentBig,'hidden')){ P.e.taComment = P.e.taCommentSmall; }else{ P.e.taComment = P.e.taCommentSmall; D.addClass(P.e.taCommentBig, 'hidden'); } D.removeClass(P.e.taComment, 'hidden'); | < < < < | < < < | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | }else if(D.hasClass(P.e.taCommentBig,'hidden')){ P.e.taComment = P.e.taCommentSmall; }else{ P.e.taComment = P.e.taCommentSmall; D.addClass(P.e.taCommentBig, 'hidden'); } D.removeClass(P.e.taComment, 'hidden'); P.tabs.addCustomWidget( E('#fossil-status-bar') ).addCustomWidget(P.e.editStatus); P.tabs.addEventListener( /* Set up auto-refresh of the preview tab... */ 'before-switch-to', function(ev){ if(ev.detail===P.e.tabs.preview){ P.baseHrefForFile(); if(P.previewNeedsUpdate && P.e.cbAutoPreview.checked) P.preview(); }else if(ev.detail===P.e.tabs.diff){ |
︙ | ︙ |
Added src/fossil.page.wikiedit-wysiwyg-legacy.js.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | /** A slight adaptation of fossil's legacy wysiwyg wiki editor which makes it usable with the newer editor's edit widget replacement API. Requires: window.fossil, fossil.dom, and that the current page is /wikiedit. If called from another page it returns without effect. */ (function(F/*fossil object*/){ 'use strict'; if(!F || !F.page || F.page.name!=='wikiedit') return; const D = F.dom; //////////////////////////////////////////////////////////////////////// // Install an app-specific stylesheet... (function(){ const head = document.head || document.querySelector('head'), styleTag = document.createElement('style'), styleCSS = ` .intLink { cursor: pointer; } img.intLink { border: 0; } #wysiwyg-container { display: flex; flex-direction: column; max-width: 100% /* w/o this, toolbars don't wrap properly! */ } #wysiwygBox { border: 1px solid rgba(127,127,127,0.3); border-radius: 0.25em; padding: 0.25em 1em; margin: 0; overflow: auto; min-height: 20em; resize: vertical; } #wysiwygEditMode { /* wrapper for radio buttons */ border: 1px solid rgba(127,127,127,0.3); border-radius: 0.25em; padding: 0 0.35em 0 0.35em } #wysiwygEditMode > * { vertical-align: text-top; } #wysiwygEditMode label { cursor: pointer; } #wysiwyg-toolbars { margin: 0 0 0.25em 0; display: flex; flex-wrap: wrap; flex-direction: column; align-items: flex-start; } #wysiwyg-toolbars > * { margin: 0 0.5em 0.25em 0; } #wysiwyg-toolBar1, #wysiwyg-toolBar2 { margin: 0 0.2em 0.2em 0; display: flex; flex-flow: row wrap; } #wysiwyg-toolBar1 > * { /* formatting buttons */ vertical-align: middle; margin: 0 0.25em 0.25em 0; } #wysiwyg-toolBar2 > * { /* icons */ border: 1px solid rgba(127,127,127,0.3); vertical-align: baseline; margin: 0.1em; } `; head.appendChild(styleTag); /* Adapted from https://stackoverflow.com/a/524721 */ styleTag.type = 'text/css'; D.append(styleTag, styleCSS); })(); const outerContainer = D.attr(D.div(), 'id', 'wysiwyg-container'), toolbars = D.attr(D.div(), 'id', 'wysiwyg-toolbars'), toolbar1 = D.attr(D.div(), 'id', 'wysiwyg-toolBar1'), // ^^^ formatting options toolbar2 = D.attr(D.div(), 'id', 'wysiwyg-toolBar2') // ^^^^ action icon buttons ; D.append(outerContainer, D.append(toolbars, toolbar1, toolbar2)); /** Returns a function which simplifies adding a list of options to the given select element. See below for example usage. */ const addOptions = function(select){ return function ff(value, label){ D.option(select, value, label || value); return ff; }; }; //////////////////////////////////////////////////////////////////////// // Edit mode selection (radio buttons). const radio0 = D.attr( D.input('radio'), 'name','wysiwyg-mode', 'id', 'wysiwyg-mode-0', 'value',0, 'checked',true), radio1 = D.attr( D.input('radio'), 'id','wysiwyg-mode-1', 'name','wysiwyg-mode', 'value',1), radios = D.append( D.attr(D.span(), 'id', 'wysiwygEditMode'), radio0, D.append( D.attr(D.label(), 'for', 'wysiwyg-mode-0'), "WYSIWYG" ), radio1, D.append( D.attr(D.label(), 'for', 'wysiwyg-mode-1'), "Raw HTML" ) ); D.append(toolbar1, radios); const radioHandler = function(){setDocMode(+this.value)}; radio0.addEventListener('change',radioHandler, false); radio1.addEventListener('change',radioHandler, false); //////////////////////////////////////////////////////////////////////// // Text formatting options... var select; select = D.addClass(D.select(), 'format'); select.dataset.format = "formatblock"; D.append(toolbar1, select); addOptions(select)( '', '- formatting -')( "h1", "Title 1 <h1>")( "h2", "Title 2 <h2>")( "h3", "Title 3 <h3>")( "h4", "Title 4 <h4>")( "h5", "Title 5 <h5>")( "h6", "Subtitle <h6>")( "p", "Paragraph <p>")( "pre", "Preformatted <pre>"); select = D.addClass(D.select(), 'format'); select.dataset.format = "fontname"; D.append(toolbar1, select); D.addClass( D.option(select, '', '- font -'), "heading" ); addOptions(select)( 'Arial')( 'Arial Black')( 'Courier New')( 'Times New Roman'); select = D.addClass(D.select(), 'format'); D.append(toolbar1, select); select.dataset.format = "fontsize"; D.addClass( D.option(select, '', '- size -'), "heading" ); addOptions(select)( "1", "Very small")( "2", "A bit small")( "3", "Normal")( "4", "Medium-large")( "5", "Big")( "6", "Very big")( "7", "Maximum"); select = D.addClass(D.select(), 'format'); D.append(toolbar1, select); select.dataset.format = 'forecolor'; D.addClass( D.option(select, '', '- color -'), "heading" ); addOptions(select)( "red", "Red")( "blue", "Blue")( "green", "Green")( "black", "Black")( "grey", "Grey")( "yellow", "Yellow")( "cyan", "Cyan")( "magenta", "Magenta"); //////////////////////////////////////////////////////////////////////// // Icon-based toolbar... /** Inject the icons... mkbuiltins strips anything which looks like a C++-style comment, even if it's in a string literal, and thus the runs of "/" characters in the DOM element data attributes have been mangled to work around that: we simply use \x2f for every 2nd slash. */ (function f(title,format,src){ const img = D.img(); D.append(toolbar2, img); D.addClass(img, 'intLink'); D.attr(img, 'title', title); img.dataset.format = format; D.attr(img, 'src', 'string'===typeof src ? src : src.join('')); return f; })( 'Undo', 'undo', ["data:image/gif;base64,R0lGODlhFgAWAOMKADljwliE33mOrpGjuYKl8aezxqPD+7", "/I19DV3NHa7P/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f", "/\x2f/\x2f/\x2f/yH5BAEKAA8ALAAAAAAWABYAAARR8MlJq704680", "7TkaYeJJBnES4EeUJvIGapWYAC0CsocQ7SDlWJkAkCA6ToMYWIARGQF3mRQVIEjkkSVLIbSfE", "whdRIH4fh/DZMICe3/C4nBQBADs="] )( 'Redo','redo', ["data:image/gif;base64,R0lGODlhFgAWAMIHAB1ChDljwl9vj1iE34Kl8aPD+7/I1/", "/\x2f/yH5BAEKAAcALAAAAAAWABYAAANKeLrc/jDKSesyphi7SiEgsVXZEATDICqBVJjpqWZt9Na", "EDNbQK1wCQsxlYnxMAImhyDoFAElJasRRvAZVRqqQXUy7Cgx4TC6bswkAOw=="] )( "Remove formatting", "removeFormat", ["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AA", "AABGdBTUEAALGPC/xhBQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwA", "AAAd0SU1FB9oECQMCKPI8CIIAAAAIdEVYdENvbW1lbnQA9syWvwAAAuhJREFUOMtjYBgFxAB5", "01ZWBvVaL2nHnlmk6mXCJbF69zU+Hz/9fB5O1lx+bg45qhl8/fYr5it3XrP/YWTUvvvk3VeqG", "Xz70TvbJy8+Wv39+2/Hz19/mGwjZzuTYjALuoBv9jImaXHeyD3H7kU8fPj2ICML8z92dlbtMz", "deiG3fco7J08foH1kurkm3E9iw54YvKwuTuom+LPt/BgbWf3/\x2fsf37/1/c02cCG1lB8f/\x2ff95", "DZx74MTMzshhoSm6szrQ/a6Ir/Z2RkfEjBxuLYFpDiDi6Af/\x2f/2ckaHBp7+7wmavP5n76+P2C", "lrLIYl8H9W36auJCbCxM4szMTJac7Kza/\x2f/\x2fR3H1w2cfWAgafPbqs5g7D95++/P1B4+ECK8tA", "wMDw/1H7159+/7r7ZcvPz4fOHbzEwMDwx8GBgaGnNatfHZx8zqrJ+4VJBh5CQEGOySEua/v3n", "7hXmqI8WUGBgYGL3vVG7fuPK3i5GD9/fja7ZsMDAzMG/Ze52mZeSj4yu1XEq/ff7W5dvfVAS1", "lsXc4Db7z8C3r8p7Qjf/\x2f/2dnZGxlqJuyr3rPqQd/Hhyu7oSpYWScylDQsd3kzvnH738wMDzj", "5GBN1VIWW4c3KDon7VOvm7S3paB9u5qsU5/x5KUnlY+eexQbkLNsErK61+++VnAJcfkyMTIwf", "fj0QwZbJDKjcETs1Y8evyd48toz8y/ffzv/\x2fvPP4veffxpX77z6l5JewHPu8MqTDAwMDLzyrj", "b/mZm0JcT5Lj+89+Ybm6zz95oMh7s4XbygN3Sluq4Mj5K8iKMgP4f0/\x2f/\x2ffv77/\x2f8nLy+7MCc", "XmyYDAwODS9jM9tcvPypd35pne3ljdjvj26+H2dhYpuENikgfvQeXNmSl3tqepxXsqhXPyc66", "6s+fv1fMdKR3TK72zpix8nTc7bdfhfkEeVbC9KhbK/9iYWHiErbu6MWbY/7/\x2f8/4/\x2f9/pgOnH", "6jGVazvFDRtq2VgiBIZrUTIBgCk+ivHvuEKwAAAAABJRU5ErkJggg=="] )( "Bold", "bold", ["data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWAB", "YAQAInhI+pa+H9mJy0LhdgtrxzDG5WGFVk6aXqyk6Y9kXvKKNuLbb6zgMFADs="] )( "Italic", "italic", ["data:image/gif;base64,R0lGODlhFgAWAKEDAAAAAF9vj5WIbf/\x2f/yH5BAEAAAMALA", "AAAAAWABYAAAIjnI+py+0Po5x0gXvruEKHrF2BB1YiCWgbMFIYpsbyTNd2UwAAOw=="] )( "Underline", "underline", ["data:image/gif;base64,R0lGODlhFgAWAKECAAAAAF9vj/\x2f/\x2f/\x2f/\x2fyH5BAEAAAIALA", "AAAAAWABYAAAIrlI+py+0Po5zUgAsEzvEeL4Ea15EiJJ5PSqJmuwKBEKgxVuXWtun+DwxCCgA", "7"] )( "Left align", "justifyleft", ["data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWAB", "YAQAIghI+py+0Po5y02ouz3jL4D4JMGELkGYxo+qzl4nKyXAAAOw=="] )( "Center align", "justifycenter", ["data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWAB", "YAQAIfhI+py+0Po5y02ouz3jL4D4JOGI7kaZ5Bqn4sycVbAQA7"] )( "Right align", "justifyright", ["data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWAB", "YAQAIghI+py+0Po5y02ouz3jL4D4JQGDLkGYxouqzl43JyVgAAOw=="] )( "Numbered list", "insertorderedlist", ["data:image/gif;base64,R0lGODlhFgAWAMIGAAAAADljwliE35GjuaezxtHa7P/\x2f/\x2f", "/\x2f/yH5BAEAAAcALAAAAAAWABYAAAM2eLrc/jDKSespwjoRFvggCBUBoTFBeq6QIAysQnRHaEO", "zyaZ07Lu9lUBnC0UGQU1K52s6n5oEADs="] )( "Dotted list", "insertunorderedlist", ["data:image/gif;base64,R0lGODlhFgAWAMIGAAAAAB1ChF9vj1iE33mOrqezxv/\x2f/\x2f", "/\x2f/yH5BAEAAAcALAAAAAAWABYAAAMyeLrc/jDKSesppNhGRlBAKIZRERBbqm6YtnbfMY7lud6", "4UwiuKnigGQliQuWOyKQykgAAOw=="] )( "Quote", "formatblock", ["data:image/gif;base64,R0lGODlhFgAWAIQXAC1NqjFRjkBgmT9nqUJnsk9xrFJ7u2", "R9qmKBt1iGzHmOrm6Sz4OXw3Odz4Cl2ZSnw6KxyqO306K63bG70bTB0rDI3bvI4P", "/\x2f/\x2f/\x2f/\x2f/", "/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f", "/\x2f/\x2f/\x2fyH5BAEKAB8ALAAAAAAWABYAAAVP4CeOZGmeaKqubEs2Cekk", "ErvEI1zZuOgYFlakECEZFi0GgTGKEBATFmJAVXweVOoKEQgABB9IQDCmrLpjETrQQlhHjINrT", "q/b7/i8fp8PAQA7"] )( "Delete indentation", "outdent", ["data:image/gif;base64,R0lGODlhFgAWAMIHAAAAADljwliE35GjuaezxtDV3NHa7P", "/\x2f/yH5BAEAAAcALAAAAAAWABYAAAM2eLrc/jDKCQG9F2i7u8agQgyK1z2EIBil+TWqEMxhMcz", "sYVJ3e4ahk+sFnAgtxSQDqWw6n5cEADs="] )( "Add indentation", "indent", ["data:image/gif;base64,R0lGODlhFgAWAOMIAAAAADljwl9vj1iE35GjuaezxtDV3N", "Ha7P/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f", "/\x2f/\x2f/yH5BAEAAAgALAAAAAAWABYAAAQ7EMlJq704650", "B/x8gemMpgugwHJNZXodKsO5oqUOgo5KhBwWESyMQsCRDHu9VOyk5TM9zSpFSr9gsJwIAOw==" ] )( "Hyperlink", "createlink", ["data:image/gif;base64,R0lGODlhFgAWAOMKAB1ChDRLY19vj3mOrpGjuaezxrCztb", "/I19Ha7Pv8/f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f", "/yH5BAEKAA8ALAAAAAAWABYAAARY8MlJq704682", "7/2BYIQVhHg9pEgVGIklyDEUBy/RlE4FQF4dCj2AQXAiJQDCWQCAEBwIioEMQBgSAFhDAGghG", "i9XgHAhMNoSZgJkJei33UESv2+/4vD4TAQA7"] )( "Cut", "cut", ["data:image/gif;base64,R0lGODlhFgAWAIQSAB1ChBFNsRJTySJYwjljwkxwl19vj1", "dusYODhl6MnHmOrpqbmpGjuaezxrCztcDCxL/I18rL1P/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f", "/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/", "/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f", "yH5BAEAAB8ALAAAAAAWABYAAAVu4CeOZGmeaKqubDs6TNnE", "bGNApNG0kbGMi5trwcA9GArXh+FAfBAw5UexUDAQESkRsfhJPwaH4YsEGAAJGisRGAQY7UCC9", "ZAXBB+74LGCRxIEHwAHdWooDgGJcwpxDisQBQRjIgkDCVlfmZqbmiEAOw=="] )( "Copy", "copy", ["data:image/gif;base64,R0lGODlhFgAWAIQcAB1ChBFNsTRLYyJYwjljwl9vj1iE31", "iGzF6MnHWX9HOdz5GjuYCl2YKl8ZOt4qezxqK63aK/9KPD+7DI3b/I17LM/MrL1MLY9NHa7OP", "s++bx/Pv8/f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f", "/yH5BAEAAB8ALAAAAAAWABYAAAWG4CeOZGmeaKqubOum1SQ/", "kPVOW749BeVSus2CgrCxHptLBbOQxCSNCCaF1GUqwQbBd0JGJAyGJJiobE+LnCaDcXAaEoxhQ", "ACgNw0FQx9kP+wmaRgYFBQNeAoGihCAJQsCkJAKOhgXEw8BLQYciooHf5o7EA+kC40qBKkAAA", "Grpy+wsbKzIiEAOw=="] )( /* Paste, when activated via JS, has no effect in some (maybe all) environments. Activated externally, e.g. keyboard, it works. */ "Paste (does not work in all environments)", "paste", ["data:image/gif;base64,R0lGODlhFgAWAIQUAD04KTRLY2tXQF9vj414WZWIbXmOrp", "qbmpGjudClFaezxsa0cb/I1+3YitHa7PrkIPHvbuPs+/fvrvv8/f/\x2f/\x2f/\x2f", "/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/", "/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f/\x2f", "yH5BAEAAB8ALAAAAAAWABYAAAWN4CeOZGmeaKqubGsusPvB", "SyFJjVDs6nJLB0khR4AkBCmfsCGBQAoCwjF5gwquVykSFbwZE+AwIBV0GhFog2EwIDchjwRiQ", "o9E2Fx4XD5R+B0DDAEnBXBhBhN2DgwDAQFjJYVhCQYRfgoIDGiQJAWTCQMRiwwMfgicnVcAAA", "MOaK+bLAOrtLUyt7i5uiUhADs="] ); //////////////////////////////////////////////////////////////////////// // The main editor area... const oDoc = D.attr(D.div(), 'id', "wysiwygBox"); D.attr(oDoc, 'contenteditable', 'true'); D.append(outerContainer, oDoc); /* Initialize the document editor */ function initDoc() { initEventHandlers(); if (!isWysiwyg()) { setDocMode(true); } } function initEventHandlers() { //console.debug("initEventHandlers()"); const handleDropDown = function() { formatDoc(this.dataset.format,this[this.selectedIndex].value); this.selectedIndex = 0; }; const handleFormatButton = function() { var extra; switch (this.dataset.format) { case 'createlink': const sLnk = prompt('Target URL:',''); if(sLnk) extra = sLnk; break; case 'formatblock': extra = 'blockquote'; break; } formatDoc(this.dataset.format, extra); }; var i, controls = outerContainer.querySelectorAll('select.format'); for(i = 0; i < controls.length; i++) { controls[i].addEventListener('change', handleDropDown, false);; } controls = outerContainer.querySelectorAll('.intLink'); for(i = 0; i < controls.length; i++) { controls[i].addEventListener('click', handleFormatButton, false); } } /* Return true if the document editor is in WYSIWYG mode. Return ** false if it is in Markup mode */ function isWysiwyg() { return radio0.checked; } /* Invoke this routine prior to submitting the HTML content back ** to the server */ /*function wysiwygSubmit() { if(oDoc.style.whiteSpace=="pre-wrap"){setDocMode(0);} document.getElementById("wysiwygValue").value=oDoc.innerHTML; }*/ /* Run the editing command if in WYSIWYG mode */ function formatDoc(sCmd, sValue) { if (isWysiwyg()){ try { // First, try the W3C draft standard way, which has // been working on all non-IE browsers for a while. // It is also supported by IE11 and higher. document.execCommand("styleWithCSS", false, false); } catch (e) { try { // For IE9 or IE10, this should work. document.execCommand("useCSS", 0, true); } catch (e) { // OK, that apparently did not work, do nothing. } } document.execCommand(sCmd, false, sValue); oDoc.focus(); } } /* Change the editing mode. Convert to markup if the argument ** is true and wysiwyg if the argument is false. */ function setDocMode(bToMarkup, content) { if(undefined===content){ content = bToMarkup ? oDoc.innerHTML : oDoc.innerText; } if(!setDocMode.linebreak){ setDocMode.linebreak = new RegExp("</p><p>","ig"); } if(!setDocMode.toHide){ setDocMode.toHide = toolbars.querySelectorAll( '#wysiwyg-toolBar1 > *:not(#wysiwygEditMode), ' +'#wysiwyg-toolBar2'); } if (bToMarkup) { /* WYSIWYG -> Markup */ // Legacy did this: content=content.replace(setDocMode.linebreak,"</p>\n\n<p>") D.append(D.clearElement(oDoc), content) oDoc.style.whiteSpace = "pre-wrap"; D.addClass(setDocMode.toHide, 'hidden'); } else { /* Markup -> WYSIWYG */ oDoc.innerHTML = content; oDoc.style.whiteSpace = "normal"; D.removeClass(setDocMode.toHide, 'hidden'); } oDoc.focus(); } //////////////////////////////////////////////////////////////////////// // A hook which can be activated via a site skin to plug this editor // in to the wikiedit page. F.page.wysiwyg = { // only for debugging: oDoc: oDoc, /* Replaces wikiedit's default editor widget with this wysiwyg editor. Must either be called via an onPageLoad handler instead via the site skin's footer or else it can be called manually from the dev tools console. Calling it too early (e.g. in the page footer *without* outside of an an onPageLoad handler) will crash because wikiedit has not been initialized. */ init: function(){ initDoc(); const content = F.page.wikiContent() || ''; var isDirty = false /* keep from stashing too often */; F.page.setContentMethods( function(){ const rc = isWysiwyg() ? oDoc.innerHTML : oDoc.innerText; return rc; }, function(content){ isDirty = false; setDocMode(radio0.checked ? 0 : 1, content); } ); oDoc.addEventListener('blur', function(){ if(isDirty) F.page.notifyOfChange(); }, false); oDoc.addEventListener('input', function(){isDirty = true}, false); F.page.wikiContent(content)/*feed it back in to our widget*/; F.page.replaceEditorElement(outerContainer); F.message("Replaced wiki editor widget with legacy wysiwyg editor."); } }; })(window.fossil); |
Changes to src/fossil.page.wikiedit.js.
︙ | ︙ | |||
861 862 863 864 865 866 867 | preview: E('#wikiedit-tab-preview'), diff: E('#wikiedit-tab-diff'), misc: E('#wikiedit-tab-misc') //commit: E('#wikiedit-tab-commit') } }; P.tabs = new F.TabManager(D.clearElement(P.e.tabContainer)); | < | | | | < < | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | preview: E('#wikiedit-tab-preview'), diff: E('#wikiedit-tab-diff'), misc: E('#wikiedit-tab-misc') //commit: E('#wikiedit-tab-commit') } }; P.tabs = new F.TabManager(D.clearElement(P.e.tabContainer)); /* Move the status bar between the tab buttons and tab panels. Seems to be the best fit in terms of functionality and visibility. */ P.tabs.addCustomWidget( E('#fossil-status-bar') ).addCustomWidget(P.e.editStatus); P.tabs.addEventListener( /* Set up some before-switch-to tab event tasks... */ 'before-switch-to', function(ev){ const theTab = ev.detail, btnSlot = theTab.querySelector('.save-button-slot'); if(btnSlot){ /* Several places make sense for a save button, so we'll move that button around to those tabs where it makes sense. */ |
︙ | ︙ |
Changes to src/fossil.tabs.js.
︙ | ︙ | |||
202 203 204 205 206 207 208 209 210 211 212 213 214 215 | Returns this object. */ addEventListener: function(eventName, callback){ this.e.container.addEventListener(eventName, callback, false); return this; }, /** If the given DOM element, unique selector, or integer (0-based tab number) is one of this object's tabs, the UI makes that tab the currently-visible one, firing any relevant events. Returns this object. If the argument is the current tab, this is a no-op, and no events are fired. | > > > > > > > > > > | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | Returns this object. */ addEventListener: function(eventName, callback){ this.e.container.addEventListener(eventName, callback, false); return this; }, /** Inserts the given DOM element immediately after the tab bar. Intended for a status bar or similar always-visible component. Returns this object. */ addCustomWidget: function(e){ this.e.container.insertBefore(e, this.e.tabs); return this; }, /** If the given DOM element, unique selector, or integer (0-based tab number) is one of this object's tabs, the UI makes that tab the currently-visible one, firing any relevant events. Returns this object. If the argument is the current tab, this is a no-op, and no events are fired. |
︙ | ︙ |
Changes to src/main.mk.
︙ | ︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 240 241 | $(SRCDIR)/fossil.confirmer.js \ $(SRCDIR)/fossil.copybutton.js \ $(SRCDIR)/fossil.dom.js \ $(SRCDIR)/fossil.fetch.js \ $(SRCDIR)/fossil.numbered-lines.js \ $(SRCDIR)/fossil.page.fileedit.js \ $(SRCDIR)/fossil.page.forumpost.js \ $(SRCDIR)/fossil.page.wikiedit.js \ $(SRCDIR)/fossil.popupwidget.js \ $(SRCDIR)/fossil.storage.js \ $(SRCDIR)/fossil.tabs.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ | > | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | $(SRCDIR)/fossil.confirmer.js \ $(SRCDIR)/fossil.copybutton.js \ $(SRCDIR)/fossil.dom.js \ $(SRCDIR)/fossil.fetch.js \ $(SRCDIR)/fossil.numbered-lines.js \ $(SRCDIR)/fossil.page.fileedit.js \ $(SRCDIR)/fossil.page.forumpost.js \ $(SRCDIR)/fossil.page.wikiedit-wysiwyg-legacy.js \ $(SRCDIR)/fossil.page.wikiedit.js \ $(SRCDIR)/fossil.popupwidget.js \ $(SRCDIR)/fossil.storage.js \ $(SRCDIR)/fossil.tabs.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ |
︙ | ︙ |
Changes to src/style.fileedit.css.
︙ | ︙ | |||
145 146 147 148 149 150 151 | margin: 0.25em 0.5em 0.25em 0; } body.fileedit #fileedit-stash-selector { margin: 0.25em; display: flex; flex-direction: row; flex-wrap: wrap; | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | margin: 0.25em 0.5em 0.25em 0; } body.fileedit #fileedit-stash-selector { margin: 0.25em; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; } body.fileedit #fileedit-stash-selector select { margin: 0 1em; height: initial; font-family: monospace; flex: 10 1 auto; } |
︙ | ︙ |
Changes to src/style.wikiedit.css.
︙ | ︙ | |||
36 37 38 39 40 41 42 | } body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > input { vertical-align: middle; margin: 0.5em; } body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > .input-with-label { vertical-align: middle; | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | } body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > input { vertical-align: middle; margin: 0.5em; } body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > .input-with-label { vertical-align: middle; margin: 0 0.5em 0.25em 0.5em; } body.wikiedit label { display: inline; /* some skins set label display to block! */ } body.wikiedit .wikiedit-options > div > * { margin: 0.25em; } |
︙ | ︙ | |||
179 180 181 182 183 184 185 | content: "]"; } body.wikiedit #wikiedit-stash-selector { margin: 0.25em; display: flex; flex-direction: row; flex-wrap: wrap; | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | content: "]"; } body.wikiedit #wikiedit-stash-selector { margin: 0.25em; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; } body.wikiedit #wikiedit-stash-selector select { margin: 0 1em 0 0.5em; height: initial; font-family: monospace; flex: 10 1 auto; } body.wikiedit fieldset.page-types-list > div > span { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; } |
Changes to win/Makefile.mingw.
︙ | ︙ | |||
640 641 642 643 644 645 646 647 648 649 650 651 652 653 | $(SRCDIR)/fossil.confirmer.js \ $(SRCDIR)/fossil.copybutton.js \ $(SRCDIR)/fossil.dom.js \ $(SRCDIR)/fossil.fetch.js \ $(SRCDIR)/fossil.numbered-lines.js \ $(SRCDIR)/fossil.page.fileedit.js \ $(SRCDIR)/fossil.page.forumpost.js \ $(SRCDIR)/fossil.page.wikiedit.js \ $(SRCDIR)/fossil.popupwidget.js \ $(SRCDIR)/fossil.storage.js \ $(SRCDIR)/fossil.tabs.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ | > | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | $(SRCDIR)/fossil.confirmer.js \ $(SRCDIR)/fossil.copybutton.js \ $(SRCDIR)/fossil.dom.js \ $(SRCDIR)/fossil.fetch.js \ $(SRCDIR)/fossil.numbered-lines.js \ $(SRCDIR)/fossil.page.fileedit.js \ $(SRCDIR)/fossil.page.forumpost.js \ $(SRCDIR)/fossil.page.wikiedit-wysiwyg-legacy.js \ $(SRCDIR)/fossil.page.wikiedit.js \ $(SRCDIR)/fossil.popupwidget.js \ $(SRCDIR)/fossil.storage.js \ $(SRCDIR)/fossil.tabs.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ |
︙ | ︙ |
Changes to win/Makefile.msc.
︙ | ︙ | |||
561 562 563 564 565 566 567 568 569 570 571 572 573 574 | "$(SRCDIR)\fossil.confirmer.js" \ "$(SRCDIR)\fossil.copybutton.js" \ "$(SRCDIR)\fossil.dom.js" \ "$(SRCDIR)\fossil.fetch.js" \ "$(SRCDIR)\fossil.numbered-lines.js" \ "$(SRCDIR)\fossil.page.fileedit.js" \ "$(SRCDIR)\fossil.page.forumpost.js" \ "$(SRCDIR)\fossil.page.wikiedit.js" \ "$(SRCDIR)\fossil.popupwidget.js" \ "$(SRCDIR)\fossil.storage.js" \ "$(SRCDIR)\fossil.tabs.js" \ "$(SRCDIR)\graph.js" \ "$(SRCDIR)\href.js" \ "$(SRCDIR)\login.js" \ | > | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | "$(SRCDIR)\fossil.confirmer.js" \ "$(SRCDIR)\fossil.copybutton.js" \ "$(SRCDIR)\fossil.dom.js" \ "$(SRCDIR)\fossil.fetch.js" \ "$(SRCDIR)\fossil.numbered-lines.js" \ "$(SRCDIR)\fossil.page.fileedit.js" \ "$(SRCDIR)\fossil.page.forumpost.js" \ "$(SRCDIR)\fossil.page.wikiedit-wysiwyg-legacy.js" \ "$(SRCDIR)\fossil.page.wikiedit.js" \ "$(SRCDIR)\fossil.popupwidget.js" \ "$(SRCDIR)\fossil.storage.js" \ "$(SRCDIR)\fossil.tabs.js" \ "$(SRCDIR)\graph.js" \ "$(SRCDIR)\href.js" \ "$(SRCDIR)\login.js" \ |
︙ | ︙ | |||
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | echo "$(SRCDIR)\fossil.confirmer.js" >> $@ echo "$(SRCDIR)\fossil.copybutton.js" >> $@ echo "$(SRCDIR)\fossil.dom.js" >> $@ echo "$(SRCDIR)\fossil.fetch.js" >> $@ echo "$(SRCDIR)\fossil.numbered-lines.js" >> $@ echo "$(SRCDIR)\fossil.page.fileedit.js" >> $@ echo "$(SRCDIR)\fossil.page.forumpost.js" >> $@ echo "$(SRCDIR)\fossil.page.wikiedit.js" >> $@ echo "$(SRCDIR)\fossil.popupwidget.js" >> $@ echo "$(SRCDIR)\fossil.storage.js" >> $@ echo "$(SRCDIR)\fossil.tabs.js" >> $@ echo "$(SRCDIR)\graph.js" >> $@ echo "$(SRCDIR)\href.js" >> $@ echo "$(SRCDIR)\login.js" >> $@ | > | 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | echo "$(SRCDIR)\fossil.confirmer.js" >> $@ echo "$(SRCDIR)\fossil.copybutton.js" >> $@ echo "$(SRCDIR)\fossil.dom.js" >> $@ echo "$(SRCDIR)\fossil.fetch.js" >> $@ echo "$(SRCDIR)\fossil.numbered-lines.js" >> $@ echo "$(SRCDIR)\fossil.page.fileedit.js" >> $@ echo "$(SRCDIR)\fossil.page.forumpost.js" >> $@ echo "$(SRCDIR)\fossil.page.wikiedit-wysiwyg-legacy.js" >> $@ echo "$(SRCDIR)\fossil.page.wikiedit.js" >> $@ echo "$(SRCDIR)\fossil.popupwidget.js" >> $@ echo "$(SRCDIR)\fossil.storage.js" >> $@ echo "$(SRCDIR)\fossil.tabs.js" >> $@ echo "$(SRCDIR)\graph.js" >> $@ echo "$(SRCDIR)\href.js" >> $@ echo "$(SRCDIR)\login.js" >> $@ |
︙ | ︙ |