The new editor called Gutenberg is here as plugin in 4.9, and as core functionality called Block Editor, in 5.0. Regarding to it, it is often needed to determine programmatically which editor is used to edit post or page in the site console. How to do it?
Update: There are number of outdated answers to similar question:
gutenberg_post_has_blocks()- this function exists only in Gutenberg plugin, and not in 5.0 Core
is_gutenberg_page()- the same
the_gutenberg_project()- the same
has_blocks()- does not work (returns false) when Classic Editor is on and its option "Default editor for all users" = "Block Editor"
- answer simply produces fatal error
Call to undefined function get_current_screen()
So, before commenting this question and answer, please take a work to check what do you propose. Check it now, with 4.9 and current version of WordPress, and all possible combinations of Classic Editor and Gutenberg/Block Editor. I will be happy to discuss tested solution, not links to something.