[FORWARD PORT] LPS-50696 autofill urlTitle and refactor Js code

This is a forward port of https://github.com/brianchandotcom/liferay-plugins-ee/pull/9333