File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ( function ( aloha ) {
2+ 'use strict' ;
3+
4+ var $$ = aloha . editor . ui . $$ ;
5+ var Dom = aloha . dom ;
6+
7+ /*
8+ * make elements with the .aloha-sticky-top class stick to the top when scrolling
9+ */
10+ $$ ( window ) . on ( 'scroll' , function ( event ) {
11+ var stickies = $$ ( '.aloha-sticky-top' ) ;
12+ var scrollTop = Dom . scrollTop ( document ) ;
13+ stickies . elements . forEach ( function ( element ) {
14+ if ( Dom . hasClass ( element , 'aloha-sticky-top-active' ) ) {
15+ if ( scrollTop <= Dom . getAttr ( element , 'data-aloha-sticky-top-pos' ) ) {
16+ Dom . setAttr ( element , 'data-aloha-sticky-top-pos' , null ) ;
17+ Dom . removeClass ( element , 'aloha-sticky-top-active' ) ;
18+ }
19+ } else {
20+ if ( scrollTop > Dom . absoluteTop ( element ) ) {
21+ Dom . setAttr ( element , 'data-aloha-sticky-top-pos' , Dom . absoluteTop ( element ) ) ;
22+ Dom . addClass ( element , 'aloha-sticky-top-active' ) ;
23+ }
24+ }
25+ } ) ;
26+ } ) ;
27+ } ) ( window . aloha ) ;
Original file line number Diff line number Diff line change 528528 }
529529 } ) ;
530530
531- // make .aloha-sticky-top items stick to the top when scrolling
532- $$ ( window ) . on ( 'scroll' , function ( event ) {
533- var stickies = $$ ( '.aloha-sticky-top' ) ;
534- var scrollTop = Dom . scrollTop ( document ) ;
535- stickies . elements . forEach ( function ( element ) {
536- if ( Dom . hasClass ( element , 'aloha-sticky-top-active' ) ) {
537- if ( scrollTop <= Dom . getAttr ( element , 'data-aloha-sticky-top-pos' ) ) {
538- Dom . setAttr ( element , 'data-aloha-sticky-top-pos' , null ) ;
539- Dom . removeClass ( element , 'aloha-sticky-top-active' ) ;
540- }
541- } else {
542- if ( scrollTop > Dom . absoluteTop ( element ) ) {
543- Dom . setAttr ( element , 'data-aloha-sticky-top-pos' , Dom . absoluteTop ( element ) ) ;
544- Dom . addClass ( element , 'aloha-sticky-top-active' ) ;
545- }
546- }
547- } ) ;
548- } ) ;
549-
550531 var shortcuts = {
551532 'meta+k' : LinksUI . insertLink ,
552533 'ctrl+k' : LinksUI . insertLink
611592 }
612593
613594 aloha . editor . stack . unshift ( handleUi ) ;
595+
596+ // exports
597+ aloha . editor . ui = {
598+ '$$' : $$ ,
599+ shortcuts : shortcuts ,
600+ actions : actions
601+ } ;
614602} ( window . aloha ) ) ;
You can’t perform that action at this time.
0 commit comments