diff --git a/src/editor/components/components/SceneEditTitle/SceneEditTitle.component.jsx b/src/editor/components/components/SceneEditTitle/SceneEditTitle.component.jsx index 9ce85021d..1814eff39 100644 --- a/src/editor/components/components/SceneEditTitle/SceneEditTitle.component.jsx +++ b/src/editor/components/components/SceneEditTitle/SceneEditTitle.component.jsx @@ -1,7 +1,6 @@ import { useEffect, useState } from 'react'; import styles from './SceneEditTitle.module.scss'; import { updateSceneIdAndTitle } from '../../../api/scene'; -import Events from '../../../lib/Events'; const SceneEditTitle = ({ sceneData }) => { const [title, setTitle] = useState(sceneData?.sceneTitle); @@ -15,12 +14,9 @@ const SceneEditTitle = ({ sceneData }) => { }, [sceneData?.sceneTitle, sceneData?.sceneId, sceneId]); useEffect(() => { - const handleNewTitleEvent = (newTitle) => { - setTitle(newTitle); - saveNewTitle(newTitle); - }; - - Events.on('newtitle', handleNewTitleEvent); + AFRAME.scenes[0].addEventListener('newTitle', (event) => { + setTitle(event.detail.sceneTitle ?? ''); + }); }, []); const handleEditClick = () => { diff --git a/src/json-utils_1.1.js b/src/json-utils_1.1.js index 303e2b8c3..215d79b59 100644 --- a/src/json-utils_1.1.js +++ b/src/json-utils_1.1.js @@ -1,7 +1,5 @@ /* global AFRAME, Node */ /* version: 1.0 */ -import Events from './editor/lib/Events'; - window.STREET = {}; var assetsUrl; STREET.utils = {}; @@ -495,8 +493,6 @@ AFRAME.registerComponent('scene-title', { titleDiv.setAttribute('id', 'sceneTitle'); titleDiv.appendChild(newContent); document.body.append(titleDiv); - // update scene title in Editor mode - Events.emit('entityupdate', this.el); }, updateTitleText: function (titleText) { this.titleElement.textContent = titleText;