Fossil

Check-in [a84f6458c0]
Login

Check-in [a84f6458c0]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improved the tab control styling, and no longer use buttons so that their :focus style doesn't break the appearance. Fixed some CSS which no longer matched after removal of the outer wrapping FORM element.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fileedit-ajaxify
Files: files | file ages | folders
SHA3-256: a84f6458c04800ee0bd8b1843012eb8e49a7987c2b29c91ad848a99180689e8b
User & Date: stephan 2020-05-06 22:57:37.701
Context
2020-05-06
23:53
Added a 'tick' mode to fossil.confirmer to more easily allow the triggering element to be visibly updated to reflect the countdown state. The editor's discard/reload button now visibly counts down from 3 if clicked. ... (check-in: 3da4b94c44 user: stephan tags: fileedit-ajaxify)
22:57
Improved the tab control styling, and no longer use buttons so that their :focus style doesn't break the appearance. Fixed some CSS which no longer matched after removal of the outer wrapping FORM element. ... (check-in: a84f6458c0 user: stephan tags: fileedit-ajaxify)
17:52
Renamed the file=filename, r=checkin query params to filename=..., checkin=..., for consistency with the annotate/blame URLs and possibly others. ... (check-in: 6b7805e056 user: stephan tags: fileedit-ajaxify)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/default_css.txt.
915
916
917
918
919
920
921
922

923
924

925








926
927
928
929
930
931




932
933
934
935
936
937

938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
.tab-container > .tab-bar {
  display: flex;
  flex-direction: row;
  flex: 1 10 auto;
  align-self: stretch;
  flex-wrap: wrap;
}
.tab-container > .tab-bar > button {

  border-radius: 0.5em 0.5em 0 0;
  margin: 0.5em 0.5em 0 0.5em;

  align-self: baseline;








}
.tab-container > .tab-bar > button.selected {
  font-style: italic;
  font-weight: bold;
  margin: 0 0.5em;
  text-decoration: underline;




}
//////////////////////////////////
// Styles for /fileedit:
form.fileedit textarea {
  font-family: monospace;
  width: 100%;

}
form.fileedit fieldset {
  margin: 0.5em 0 0.5em 0;
  border-radius: 0.5em;
  border-color: inherit;
  border-width: 1px;
  font-size: 85%;
}
form.fileedit fieldset > legend {
  margin: 0 0 0 1em;
  padding: 0 0.5em 0 0.5em;
}
form.fileedit fieldset > div {
  margin: 0 0.25em 0.25em 0.25em;
}
form.fileedit fieldset > div > .input-with-label {
  margin: 0.25em 0.5em;
}
form.fileedit fieldset > div > button {
  margin: 0.25em 0.5em;
}
form.fileedit input:invalid {
  border-left: 0.2em dashed red;
}
.fileedit-hint {
  font-size: 80%;
  opacity: 0.75;
}
.fileedit-error-report {
  background: yellow;
  color: darkred;







|
>

|
>

>
>
>
>
>
>
>
>

|
<
<
<

>
>
>
>



|


>

|






|



|


|


|


<
<
<







915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937



938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970



971
972
973
974
975
976
977
.tab-container > .tab-bar {
  display: flex;
  flex-direction: row;
  flex: 1 10 auto;
  align-self: stretch;
  flex-wrap: wrap;
}
.tab-container > .tab-bar > .tab-button {
  display: inline-block;
  border-radius: 0.5em 0.5em 0 0;
  margin: 0 0.1em;
  padding: 0.25em 0.75em;
  align-self: baseline;
  border-color: inherit;
  border-width: 1px;
  border-bottom: none;
  border-top-style: inset;
  border-left-style: inset;
  border-right-style: inset;
  cursor: pointer;
  opacity: 0.6;
}
.tab-container > .tab-bar > .tab-button.selected {



  text-decoration: underline;
  opacity: 1.0;
  border-top-style: outset;
  border-left-style: outset;
  border-right-style: outset;
}
//////////////////////////////////
// Styles for /fileedit:
textarea.fileedit {
  font-family: monospace;
  width: 100%;
  flex: 10 1 auto;
}
body.fileedit fieldset {
  margin: 0.5em 0 0.5em 0;
  border-radius: 0.5em;
  border-color: inherit;
  border-width: 1px;
  font-size: 85%;
}
body.fileedit fieldset > legend {
  margin: 0 0 0 1em;
  padding: 0 0.5em 0 0.5em;
}
body.fileedit fieldset > div {
  margin: 0 0.25em 0.25em 0.25em;
}
body.fileedit fieldset > div > .input-with-label {
  margin: 0.25em 0.5em;
}
body.fileedit fieldset > div > button {
  margin: 0.25em 0.5em;
}



.fileedit-hint {
  font-size: 80%;
  opacity: 0.75;
}
.fileedit-error-report {
  background: yellow;
  color: darkred;
Changes to src/fileedit.c.
1515
1516
1517
1518
1519
1520
1521












1522
1523
1524
1525
1526
1527
1528
  ** All errors which "could" have happened up to this point are of a
  ** degree which keep us from rendering the rest of the page, and
  ** thus have already caused us to skipped to the end of the page to
  ** render the errors. Any up-coming errors, barring malloc failure
  ** or similar, are not "that" fatal. We can/should continue
  ** rendering the page, then output the error message at the end.
  ********************************************************************/












  CX("<p>This page is <em>NEW AND EXPERIMENTAL</em>. "
     "USE AT YOUR OWN RISK, preferably on a test "
     "repo.</p>\n");

  /******* Hidden fields *******/
  CX("<input type='hidden' name='checkin' value='%s'>",
     cimi.zParentUuid);







>
>
>
>
>
>
>
>
>
>
>
>







1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
  ** All errors which "could" have happened up to this point are of a
  ** degree which keep us from rendering the rest of the page, and
  ** thus have already caused us to skipped to the end of the page to
  ** render the errors. Any up-coming errors, barring malloc failure
  ** or similar, are not "that" fatal. We can/should continue
  ** rendering the page, then output the error message at the end.
  ********************************************************************/

  {
    /* The CSS for this page lives in a common file but much of it we
    ** don't want inadvertently being used by other pages. We don't
    ** have a common, page-specific container we can filter our CSS
    ** selectors, but we do have the BODY, which we can decorate with
    ** whatever CSS we wish...
    */
    style_emit_script_tag(0,0);
    CX("document.body.classList.add('fileedit');\n");
    style_emit_script_tag(1,0);
  }
  CX("<p>This page is <em>NEW AND EXPERIMENTAL</em>. "
     "USE AT YOUR OWN RISK, preferably on a test "
     "repo.</p>\n");

  /******* Hidden fields *******/
  CX("<input type='hidden' name='checkin' value='%s'>",
     cimi.zParentUuid);
1586
1587
1588
1589
1590
1591
1592

1593
1594
1595
1596
1597
1598
1599
                          100,
                          "100%", 100, "125%", 125,
                          "150%", 150, "175%", 175,
                          "200%", 200, NULL);
    CX("</div>");
    CX("<div class='flex-container row'>");
    CX("<textarea name='content' id='fileedit-content-editor' "

       "rows='20' cols='80'>");
    CX("Loading...");
    CX("</textarea>");
    CX("</div>"/*textarea wrapper*/);
    CX("</div>"/*#tab-file-content*/);
  }








>







1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
                          100,
                          "100%", 100, "125%", 125,
                          "150%", 150, "175%", 175,
                          "200%", 200, NULL);
    CX("</div>");
    CX("<div class='flex-container row'>");
    CX("<textarea name='content' id='fileedit-content-editor' "
       "class='fileedit' "
       "rows='20' cols='80'>");
    CX("Loading...");
    CX("</textarea>");
    CX("</div>"/*textarea wrapper*/);
    CX("</div>"/*#tab-file-content*/);
  }

Changes to src/fossil.page.fileedit.js.
90
91
92
93
94
95
96

97
98
99
100
101
102
103
104
105
106
      // Force UI update
      new Event('change',{target:selectPreviewMode})
    );
    const selectFontSize = E('select[name=editor_font_size]');
    if(selectFontSize){
      selectFontSize.addEventListener(
        "change",function(e){

          P.e.taEditor.className = e.target.className.replace(
              /\bfont-size-\d+/g, '' );
          P.e.taEditor.classList.add('font-size-'+e.target.value);
        }, false
      );
      selectFontSize.dispatchEvent(
        // Force UI update
        new Event('change',{target:selectFontSize})
      );
    }







>
|

|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
      // Force UI update
      new Event('change',{target:selectPreviewMode})
    );
    const selectFontSize = E('select[name=editor_font_size]');
    if(selectFontSize){
      selectFontSize.addEventListener(
        "change",function(e){
          const ed = P.e.taEditor;
          ed.className = ed.className.replace(
              /\bfont-size-\d+/g, '' );
          ed.classList.add('font-size-'+e.target.value);
        }, false
      );
      selectFontSize.dispatchEvent(
        // Force UI update
        new Event('change',{target:selectFontSize})
      );
    }
187
188
189
190
191
192
193

194
195
196
197
198
199
200
201
202
203
204
205
    const updateView = function(c){
      D.clearElement(target);
      if('string'===typeof c){
        target.innerHTML = c;
      }
      if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview);
    };

    if(!content){
      updateView('');
      return this;
    }
    this._postPreview(this.e.taEditor.value, updateView);
    return this;
  };

  /**
     Callback for use with F.connectPagePreviewers()
  */
  P._postPreview = function(content,callback){







>




|







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
    const updateView = function(c){
      D.clearElement(target);
      if('string'===typeof c){
        target.innerHTML = c;
      }
      if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview);
    };
    const content = this.e.taEditor.value;
    if(!content){
      updateView('');
      return this;
    }
    this._postPreview(content, updateView);
    return this;
  };

  /**
     Callback for use with F.connectPagePreviewers()
  */
  P._postPreview = function(content,callback){
Changes to src/fossil.tabs.js.
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65

       Returns this object.

       DOM elements of potential interest to users:

       this.e.container = the outermost container element.

       this.e.tabBar = the button bar


       this.e.tabs = the parent for all of the tab elements.

       It is legal, within reason, to manipulate these a bit, in
       particular this.e.container, e.g. by adding more children to
       it. Do not remove elements from the tabs or tabBar, however, or
       the tab state may get sorely out of sync.







|
>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

       Returns this object.

       DOM elements of potential interest to users:

       this.e.container = the outermost container element.

       this.e.tabBar = the button bar. Each "button" (whether it's a
       buttor not is unspecified) has a class of .tab-button.

       this.e.tabs = the parent for all of the tab elements.

       It is legal, within reason, to manipulate these a bit, in
       particular this.e.container, e.g. by adding more children to
       it. Do not remove elements from the tabs or tabBar, however, or
       the tab state may get sorely out of sync.
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
         e.target.$manager.switchToTab(e.target.$tab);
        };
      }
      tab = tabArg(tab);
      tab.remove();
      D.append(this.e.tabs, D.addClass(tab,'tab-panel'));
      const lbl = tab.dataset.tabLabel || 'Tab #'+(this.e.tabs.childNodes.length-1);
      const btn = D.button(lbl);
      D.append(this.e.tabBar,btn);
      btn.$manager = this;
      btn.$tab = tab;
      btn.addEventListener('click', f.click, false);
      return this;
    },
    /**







|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
         e.target.$manager.switchToTab(e.target.$tab);
        };
      }
      tab = tabArg(tab);
      tab.remove();
      D.append(this.e.tabs, D.addClass(tab,'tab-panel'));
      const lbl = tab.dataset.tabLabel || 'Tab #'+(this.e.tabs.childNodes.length-1);
      const btn = D.addClass(D.append(D.span(), lbl), 'tab-button');
      D.append(this.e.tabBar,btn);
      btn.$manager = this;
      btn.$tab = tab;
      btn.addEventListener('click', f.click, false);
      return this;
    },
    /**