File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ const Toolbar = {
8181 } ,
8282 content : '<b>B</b>' ,
8383 disabledIn : [ 'H1' , 'H2' , 'BLOCKQUOTE' ] ,
84- activeIn : [ 'B' ]
84+ activeIn : [ 'B' ] ,
85+ toggles : true
8586 } ,
8687
8788 italic : {
@@ -92,7 +93,8 @@ const Toolbar = {
9293 validTags : [ 'I' ]
9394 } ,
9495 content : '<i>I</i>' ,
95- activeIn : [ 'I' ]
96+ activeIn : [ 'I' ] ,
97+ toggles : true
9698 } ,
9799
98100 underline : {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const TextFormatter = Module({
2828 formatText ( opts ) {
2929 this . preProcess ( ) ;
3030 this . process ( opts ) ;
31- this . postProcess ( ) ;
31+ this . postProcess ( opts ) ;
3232 } ,
3333
3434 preProcess ( ) {
@@ -44,11 +44,22 @@ const TextFormatter = Module({
4444 } ) ;
4545 } ,
4646
47- postProcess ( ) {
47+ postProcess ( opts ) {
4848 const { mediator } = this ;
4949
5050 mediator . exec ( 'contenteditable:refocus' ) ;
51- // mediator.exec('selection:reselect');
51+
52+ if ( opts . toggle ) {
53+ this . normalize ( ) ;
54+ }
55+ } ,
56+
57+ normalize ( ) {
58+ const { mediator } = this ;
59+ const currentSelection = mediator . get ( 'selection:current' ) ;
60+ const parentElement = currentSelection . anchorNode . parentElement ;
61+ parentElement . normalize ( ) ;
62+ console . log ( 'ping' ) ;
5263 }
5364 }
5465} ) ;
You can’t perform that action at this time.
0 commit comments