Przeglądaj źródła

Add additional class to each $root element for current editing mode

panr 6 lat temu
rodzic
commit
c3f0649159

+ 7 - 0
packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js

@@ -92,6 +92,13 @@ export default class RestrictedEditingModeEditing extends Plugin {
 				evt.stop();
 			}
 		}, { priority: 'highest' } );
+
+		// Set unique class to every $root element for additional styling in restricted editing
+		editor.editing.view.change( writer => {
+			for ( const root of editor.editing.view.document.roots ) {
+				writer.addClass( 'ck-restricted-editing', root );
+			}
+		} );
 	}
 
 	/**

+ 7 - 0
packages/ckeditor5-restricted-editing/src/standardeditingmodeediting.js

@@ -54,5 +54,12 @@ export default class StandardEditingModeEditing extends Plugin {
 		} );
 
 		editor.commands.add( 'restrictedEditingException', new RestrictedEditingExceptionCommand( editor ) );
+
+		// Set unique class to every $root element for additional styling in standard editing
+		editor.editing.view.change( writer => {
+			for ( const root of editor.editing.view.document.roots ) {
+				writer.addClass( 'ck-standard-editing', root );
+			}
+		} );
 	}
 }