File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,29 @@ article {
356356 color : # 49a345 ;
357357}
358358
359+ /* ==========================================================================
360+ Styling
361+ ========================================================================== */
362+
363+ .example-style-default {
364+ }
365+ .example-style-default : focus {
366+ }
367+
368+ .example-style-dark {
369+ padding : 0.5em ;
370+ color : white;
371+ background-color : darkgrey;
372+ border : 1px solid darkgrey;
373+ border-radius : 4px ;
374+ caret-color : yellow;
375+ }
376+ .example-style-dark : focus {
377+ outline : none;
378+ background-color : dimgrey;
379+ box-shadow : 0px 0px 8px black;
380+ }
381+
359382/* ==========================================================================
360383 iFrame
361384 ========================================================================== */
Original file line number Diff line number Diff line change @@ -66,6 +66,33 @@ <h3>HTML</h3>
6666 </ section >
6767
6868
69+ <!-- Styling -->
70+
71+ < section class ="example-section space-after ">
72+ < div class ="section-content ">
73+ < h2 class ="example-title "> Styling</ h2 >
74+
75+ < div class ="styling-example example-sheet ">
76+ < p class ="example-style-default ">
77+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero.
78+ </ p >
79+ </ div >
80+
81+ < div class ="code-example ">
82+ < p > Style the editable element using CSS to match your page’s design.</ p >
83+ < p >
84+ < label > For example:</ label >
85+ < select name ="editable-styles ">
86+ < option value ="default "> Default</ option >
87+ < option value ="dark "> Dark mode</ option >
88+ </ select >
89+ </ p >
90+ </ div >
91+
92+ </ div >
93+ </ section >
94+
95+
6996 <!-- Highlight -->
7097
7198 < section class ="example-section space-after ">
Original file line number Diff line number Diff line change @@ -19,13 +19,24 @@ $(() => {
1919 editable . add ( '.formatting-example p' )
2020 setupTooltip ( )
2121
22+ editable . add ( '.styling-example p' )
23+
2224 const secondExample = document . querySelector ( '.formatting-example p' )
2325 updateCode ( secondExample )
2426
2527 editable . on ( 'change' , ( elem ) => {
2628 if ( elem === secondExample ) updateCode ( elem )
2729 } )
2830
31+ // Styling
32+ // -------
33+
34+ $ ( 'select[name="editable-styles"]' ) . on ( 'change' , function ( ) {
35+ $ ( '.styling-example p' )
36+ . removeClass ( 'example-style-default example-style-dark' )
37+ . addClass ( 'example-style-' + $ ( this ) . val ( ) )
38+ } )
39+
2940 // IFrame
3041 // ------
3142
You can’t perform that action at this time.
0 commit comments