Fossil SCM

Improvements to the CSS editor.

drh 2020-04-27 17:57 trunk merge
Commit a8967ca91c46f37eb16f34ca51740b0513875ec6cfeb5fb91f24466940629732
--- src/default_css.txt
+++ src/default_css.txt
@@ -841,5 +841,24 @@
841841
}
842842
.accordion_panel {
843843
overflow: hidden;
844844
transition: max-height 0.25s ease-out;
845845
}
846
+#setup_skinedit_css_defaults {
847
+ max-width: 98%;
848
+ font-family: monospace;
849
+// These are for the UL-based implementation:
850
+ column-width: auto;
851
+ column-count: 2;
852
+ padding-top: 1em;
853
+}
854
+// These are for the alternate table-based skinedit CSS list:
855
+// #setup_skinedit_css_defaults > tbody > tr > td {
856
+// font-family: monospace;
857
+// white-space: pre-wrap;
858
+// border: 1px solid black;
859
+// vertical-align: top;
860
+// }
861
+// #setup_skinedit_css_defaults > tbody > tr > td:nth-of-type(2) > div {
862
+// max-width: 30em;
863
+// overflow: auto;
864
+// }
846865
--- src/default_css.txt
+++ src/default_css.txt
@@ -841,5 +841,24 @@
841 }
842 .accordion_panel {
843 overflow: hidden;
844 transition: max-height 0.25s ease-out;
845 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
846
--- src/default_css.txt
+++ src/default_css.txt
@@ -841,5 +841,24 @@
841 }
842 .accordion_panel {
843 overflow: hidden;
844 transition: max-height 0.25s ease-out;
845 }
846 #setup_skinedit_css_defaults {
847 max-width: 98%;
848 font-family: monospace;
849 // These are for the UL-based implementation:
850 column-width: auto;
851 column-count: 2;
852 padding-top: 1em;
853 }
854 // These are for the alternate table-based skinedit CSS list:
855 // #setup_skinedit_css_defaults > tbody > tr > td {
856 // font-family: monospace;
857 // white-space: pre-wrap;
858 // border: 1px solid black;
859 // vertical-align: top;
860 // }
861 // #setup_skinedit_css_defaults > tbody > tr > td:nth-of-type(2) > div {
862 // max-width: 30em;
863 // overflow: auto;
864 // }
865
+55
--- src/skins.c
+++ src/skins.c
@@ -688,10 +688,62 @@
688688
}
689689
}
690690
return zResult;
691691
}
692692
693
+extern const struct strctCssDefaults {
694
+/* From the generated default_css.h, which we cannot #include here
695
+** without causing an ODR violation.
696
+*/
697
+ const char *elementClass; /* Name of element needed */
698
+ const char *value; /* CSS text */
699
+} cssDefaultList[];
700
+
701
+/*
702
+** Emits the list of built-in default CSS selectors. Intended
703
+** for use only from the /setup_skinedit page.
704
+*/
705
+static void skin_emit_css_defaults(){
706
+ struct strctCssDefaults const * pCss;
707
+ fossil_print("<h1>CSS Defaults</h1>");
708
+ fossil_print("If a skin defines any of the following CSS selectors, "
709
+ "that definition replaces the default, as opposed to "
710
+ "cascading from it. ");
711
+ fossil_print("See <a href=\"https://fossil-scm.org/fossil/"
712
+ "doc/trunk/www/css-tricks.md\">this "
713
+ "document</a> for more details.");
714
+ /* To discuss: do we want to list only the default selectors or
715
+ ** also their default values? The latter increases the size of the
716
+ ** page considerably, but is arguably more useful. We could, of
717
+ ** course, offer a URL param to toggle the view, but that currently
718
+ ** seems like overkill.
719
+ **
720
+ ** Be sure to adjust the default_css.txt #setup_skinedit_css entry
721
+ ** for whichever impl ends up being selected.
722
+ */
723
+#if 1
724
+ /* List impl which elides style values */
725
+ fossil_print("<div class=\"columns\" "
726
+ "id=\"setup_skinedit_css_defaults\"><ul>");
727
+ for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){
728
+ fossil_print("<li>%s</li>", pCss->elementClass);
729
+ }
730
+ fossil_print("</ul>");
731
+#else
732
+ /* Table impl which also includes style values. */
733
+ fossil_print("<table id=\"setup_skinedit_css_defaults\"><tbody>");
734
+ for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){
735
+ fossil_print("<tr><td>%s</td>", pCss->elementClass);
736
+ /* A TD element apparently cannot be told to scroll its contents,
737
+ ** so we require a DIV inside the value TD to scroll the long
738
+ ** url(data:...) entries. */
739
+ fossil_print("<td><div>%s</div></td>", pCss->value);
740
+ fossil_print("</td></tr>");
741
+ }
742
+ fossil_print("</tbody></table>");
743
+#endif
744
+}
693745
694746
/*
695747
** WEBPAGE: setup_skinedit
696748
**
697749
** Edit aspects of a skin determined by the w= query parameter.
@@ -814,10 +866,13 @@
814866
blob_reset(&from);
815867
blob_reset(&to);
816868
blob_reset(&out);
817869
}
818870
@ </div></form>
871
+ if(ii==0/*CSS*/){
872
+ skin_emit_css_defaults();
873
+ }
819874
style_footer();
820875
db_end_transaction(0);
821876
}
822877
823878
/*
824879
--- src/skins.c
+++ src/skins.c
@@ -688,10 +688,62 @@
688 }
689 }
690 return zResult;
691 }
692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
694 /*
695 ** WEBPAGE: setup_skinedit
696 **
697 ** Edit aspects of a skin determined by the w= query parameter.
@@ -814,10 +866,13 @@
814 blob_reset(&from);
815 blob_reset(&to);
816 blob_reset(&out);
817 }
818 @ </div></form>
 
 
 
819 style_footer();
820 db_end_transaction(0);
821 }
822
823 /*
824
--- src/skins.c
+++ src/skins.c
@@ -688,10 +688,62 @@
688 }
689 }
690 return zResult;
691 }
692
693 extern const struct strctCssDefaults {
694 /* From the generated default_css.h, which we cannot #include here
695 ** without causing an ODR violation.
696 */
697 const char *elementClass; /* Name of element needed */
698 const char *value; /* CSS text */
699 } cssDefaultList[];
700
701 /*
702 ** Emits the list of built-in default CSS selectors. Intended
703 ** for use only from the /setup_skinedit page.
704 */
705 static void skin_emit_css_defaults(){
706 struct strctCssDefaults const * pCss;
707 fossil_print("<h1>CSS Defaults</h1>");
708 fossil_print("If a skin defines any of the following CSS selectors, "
709 "that definition replaces the default, as opposed to "
710 "cascading from it. ");
711 fossil_print("See <a href=\"https://fossil-scm.org/fossil/"
712 "doc/trunk/www/css-tricks.md\">this "
713 "document</a> for more details.");
714 /* To discuss: do we want to list only the default selectors or
715 ** also their default values? The latter increases the size of the
716 ** page considerably, but is arguably more useful. We could, of
717 ** course, offer a URL param to toggle the view, but that currently
718 ** seems like overkill.
719 **
720 ** Be sure to adjust the default_css.txt #setup_skinedit_css entry
721 ** for whichever impl ends up being selected.
722 */
723 #if 1
724 /* List impl which elides style values */
725 fossil_print("<div class=\"columns\" "
726 "id=\"setup_skinedit_css_defaults\"><ul>");
727 for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){
728 fossil_print("<li>%s</li>", pCss->elementClass);
729 }
730 fossil_print("</ul>");
731 #else
732 /* Table impl which also includes style values. */
733 fossil_print("<table id=\"setup_skinedit_css_defaults\"><tbody>");
734 for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){
735 fossil_print("<tr><td>%s</td>", pCss->elementClass);
736 /* A TD element apparently cannot be told to scroll its contents,
737 ** so we require a DIV inside the value TD to scroll the long
738 ** url(data:...) entries. */
739 fossil_print("<td><div>%s</div></td>", pCss->value);
740 fossil_print("</td></tr>");
741 }
742 fossil_print("</tbody></table>");
743 #endif
744 }
745
746 /*
747 ** WEBPAGE: setup_skinedit
748 **
749 ** Edit aspects of a skin determined by the w= query parameter.
@@ -814,10 +866,13 @@
866 blob_reset(&from);
867 blob_reset(&to);
868 blob_reset(&out);
869 }
870 @ </div></form>
871 if(ii==0/*CSS*/){
872 skin_emit_css_defaults();
873 }
874 style_footer();
875 db_end_transaction(0);
876 }
877
878 /*
879
+55
--- src/skins.c
+++ src/skins.c
@@ -688,10 +688,62 @@
688688
}
689689
}
690690
return zResult;
691691
}
692692
693
+extern const struct strctCssDefaults {
694
+/* From the generated default_css.h, which we cannot #include here
695
+** without causing an ODR violation.
696
+*/
697
+ const char *elementClass; /* Name of element needed */
698
+ const char *value; /* CSS text */
699
+} cssDefaultList[];
700
+
701
+/*
702
+** Emits the list of built-in default CSS selectors. Intended
703
+** for use only from the /setup_skinedit page.
704
+*/
705
+static void skin_emit_css_defaults(){
706
+ struct strctCssDefaults const * pCss;
707
+ fossil_print("<h1>CSS Defaults</h1>");
708
+ fossil_print("If a skin defines any of the following CSS selectors, "
709
+ "that definition replaces the default, as opposed to "
710
+ "cascading from it. ");
711
+ fossil_print("See <a href=\"https://fossil-scm.org/fossil/"
712
+ "doc/trunk/www/css-tricks.md\">this "
713
+ "document</a> for more details.");
714
+ /* To discuss: do we want to list only the default selectors or
715
+ ** also their default values? The latter increases the size of the
716
+ ** page considerably, but is arguably more useful. We could, of
717
+ ** course, offer a URL param to toggle the view, but that currently
718
+ ** seems like overkill.
719
+ **
720
+ ** Be sure to adjust the default_css.txt #setup_skinedit_css entry
721
+ ** for whichever impl ends up being selected.
722
+ */
723
+#if 1
724
+ /* List impl which elides style values */
725
+ fossil_print("<div class=\"columns\" "
726
+ "id=\"setup_skinedit_css_defaults\"><ul>");
727
+ for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){
728
+ fossil_print("<li>%s</li>", pCss->elementClass);
729
+ }
730
+ fossil_print("</ul>");
731
+#else
732
+ /* Table impl which also includes style values. */
733
+ fossil_print("<table id=\"setup_skinedit_css_defaults\"><tbody>");
734
+ for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){
735
+ fossil_print("<tr><td>%s</td>", pCss->elementClass);
736
+ /* A TD element apparently cannot be told to scroll its contents,
737
+ ** so we require a DIV inside the value TD to scroll the long
738
+ ** url(data:...) entries. */
739
+ fossil_print("<td><div>%s</div></td>", pCss->value);
740
+ fossil_print("</td></tr>");
741
+ }
742
+ fossil_print("</tbody></table>");
743
+#endif
744
+}
693745
694746
/*
695747
** WEBPAGE: setup_skinedit
696748
**
697749
** Edit aspects of a skin determined by the w= query parameter.
@@ -814,10 +866,13 @@
814866
blob_reset(&from);
815867
blob_reset(&to);
816868
blob_reset(&out);
817869
}
818870
@ </div></form>
871
+ if(ii==0/*CSS*/){
872
+ skin_emit_css_defaults();
873
+ }
819874
style_footer();
820875
db_end_transaction(0);
821876
}
822877
823878
/*
824879
--- src/skins.c
+++ src/skins.c
@@ -688,10 +688,62 @@
688 }
689 }
690 return zResult;
691 }
692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
694 /*
695 ** WEBPAGE: setup_skinedit
696 **
697 ** Edit aspects of a skin determined by the w= query parameter.
@@ -814,10 +866,13 @@
814 blob_reset(&from);
815 blob_reset(&to);
816 blob_reset(&out);
817 }
818 @ </div></form>
 
 
 
819 style_footer();
820 db_end_transaction(0);
821 }
822
823 /*
824
--- src/skins.c
+++ src/skins.c
@@ -688,10 +688,62 @@
688 }
689 }
690 return zResult;
691 }
692
693 extern const struct strctCssDefaults {
694 /* From the generated default_css.h, which we cannot #include here
695 ** without causing an ODR violation.
696 */
697 const char *elementClass; /* Name of element needed */
698 const char *value; /* CSS text */
699 } cssDefaultList[];
700
701 /*
702 ** Emits the list of built-in default CSS selectors. Intended
703 ** for use only from the /setup_skinedit page.
704 */
705 static void skin_emit_css_defaults(){
706 struct strctCssDefaults const * pCss;
707 fossil_print("<h1>CSS Defaults</h1>");
708 fossil_print("If a skin defines any of the following CSS selectors, "
709 "that definition replaces the default, as opposed to "
710 "cascading from it. ");
711 fossil_print("See <a href=\"https://fossil-scm.org/fossil/"
712 "doc/trunk/www/css-tricks.md\">this "
713 "document</a> for more details.");
714 /* To discuss: do we want to list only the default selectors or
715 ** also their default values? The latter increases the size of the
716 ** page considerably, but is arguably more useful. We could, of
717 ** course, offer a URL param to toggle the view, but that currently
718 ** seems like overkill.
719 **
720 ** Be sure to adjust the default_css.txt #setup_skinedit_css entry
721 ** for whichever impl ends up being selected.
722 */
723 #if 1
724 /* List impl which elides style values */
725 fossil_print("<div class=\"columns\" "
726 "id=\"setup_skinedit_css_defaults\"><ul>");
727 for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){
728 fossil_print("<li>%s</li>", pCss->elementClass);
729 }
730 fossil_print("</ul>");
731 #else
732 /* Table impl which also includes style values. */
733 fossil_print("<table id=\"setup_skinedit_css_defaults\"><tbody>");
734 for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){
735 fossil_print("<tr><td>%s</td>", pCss->elementClass);
736 /* A TD element apparently cannot be told to scroll its contents,
737 ** so we require a DIV inside the value TD to scroll the long
738 ** url(data:...) entries. */
739 fossil_print("<td><div>%s</div></td>", pCss->value);
740 fossil_print("</td></tr>");
741 }
742 fossil_print("</tbody></table>");
743 #endif
744 }
745
746 /*
747 ** WEBPAGE: setup_skinedit
748 **
749 ** Edit aspects of a skin determined by the w= query parameter.
@@ -814,10 +866,13 @@
866 blob_reset(&from);
867 blob_reset(&to);
868 blob_reset(&out);
869 }
870 @ </div></form>
871 if(ii==0/*CSS*/){
872 skin_emit_css_defaults();
873 }
874 style_footer();
875 db_end_transaction(0);
876 }
877
878 /*
879

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button