Create new items in the project root if currently opened document is not inside the project.

This fixes issue #6544.