HostExtensionServices.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. import * as EditorEvents from "../editor/EditorEvents";
  23. import * as EditorUI from "../ui/EditorUI";
  24. import MainFrame = require("../ui/frames/MainFrame");
  25. import InspectorFrame = require("../ui/frames/inspector/InspectorFrame");
  26. import ModalOps = require("../ui/modal/ModalOps");
  27. import ResourceOps = require("../resources/ResourceOps");
  28. import Editor = require("../editor/Editor");
  29. /**
  30. * Generic registry for storing Editor Extension Services
  31. */
  32. export class ServicesProvider<T extends Editor.Extensions.ServiceEventListener> implements Editor.Extensions.ServicesProvider<T> {
  33. registeredServices: T[] = [];
  34. /**
  35. * Adds a service to the registered services list for this type of service
  36. * @param {T} service the service to register
  37. */
  38. register(service: T) {
  39. this.registeredServices.push(service);
  40. }
  41. unregister(service: T) {
  42. var index = this.registeredServices.indexOf(service, 0);
  43. if (index > -1) {
  44. this.registeredServices.splice(index, 1);
  45. }
  46. }
  47. }
  48. export interface ServiceEventSubscriber {
  49. /**
  50. * Allow this service registry to subscribe to events that it is interested in
  51. * @param {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
  52. */
  53. subscribeToEvents(topLevelWindow: Atomic.UIWidget);
  54. }
  55. /**
  56. * Registry for service extensions that are concerned about project events
  57. */
  58. export class ProjectServicesProvider extends ServicesProvider<Editor.HostExtensions.ProjectServicesEventListener> implements Editor.HostExtensions.ProjectServicesProvider {
  59. constructor() {
  60. super();
  61. }
  62. /**
  63. * Allow this service registry to subscribe to events that it is interested in
  64. * @param {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
  65. */
  66. subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
  67. eventDispatcher.subscribeToEvent(EditorEvents.LoadProjectNotification, (ev) => this.projectLoaded(ev));
  68. eventDispatcher.subscribeToEvent(EditorEvents.CloseProject, (ev) => this.projectUnloaded(ev));
  69. eventDispatcher.subscribeToEvent(EditorEvents.PlayerStartRequest, () => this.playerStarted());
  70. }
  71. /**
  72. * Called when the project is unloaded
  73. * @param {[type]} data Event info from the project unloaded event
  74. */
  75. projectUnloaded(data) {
  76. // Need to use a for loop for length down to 0 because extensions *could* delete themselves from the list on projectUnloaded
  77. for (let i = this.registeredServices.length - 1; i >= 0; i--) {
  78. let service = this.registeredServices[i];
  79. // Notify services that the project has been unloaded
  80. try {
  81. if (service.projectUnloaded) {
  82. service.projectUnloaded();
  83. }
  84. } catch (e) {
  85. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e} \n\n ${e.stack}`);
  86. }
  87. };
  88. }
  89. /**
  90. * Called when the project is loaded
  91. * @param {[type]} data Event info from the project unloaded event
  92. */
  93. projectLoaded(ev: Editor.EditorEvents.LoadProjectEvent) {
  94. // Need to use a for loop and don't cache the length because the list of services *may* change while processing. Extensions could be appended to the end
  95. for (let i = 0; i < this.registeredServices.length; i++) {
  96. let service = this.registeredServices[i];
  97. try {
  98. // Notify services that the project has just been loaded
  99. if (service.projectLoaded) {
  100. service.projectLoaded(ev);
  101. }
  102. } catch (e) {
  103. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  104. }
  105. };
  106. }
  107. playerStarted() {
  108. this.registeredServices.forEach((service) => {
  109. try {
  110. // Notify services that the project has just been loaded
  111. if (service.playerStarted) {
  112. service.playerStarted();
  113. }
  114. } catch (e) {
  115. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}\n \n ${e.stack}`);
  116. }
  117. });
  118. }
  119. /**
  120. * Return a preference value or the provided default from the user settings file
  121. * @param {string} extensionName name of the extension the preference lives under
  122. * @param {string} preferenceName name of the preference to retrieve
  123. * @param {number | boolean | string} defaultValue value to return if pref doesn't exist
  124. * @return {number|boolean|string}
  125. */
  126. getUserPreference(settingsGroup: string, preferenceName: string, defaultValue?: number): number;
  127. getUserPreference(settingsGroup: string, preferenceName: string, defaultValue?: string): string;
  128. getUserPreference(settingsGroup: string, preferenceName: string, defaultValue?: boolean): boolean;
  129. getUserPreference(extensionName: string, preferenceName: string, defaultValue?: any): any {
  130. return EditorUI.getEditor().getUserPreference(extensionName, preferenceName, defaultValue);
  131. }
  132. /**
  133. * Sets a user preference value in the user settings file
  134. * @param {string} extensionName name of the extension the preference lives under
  135. * @param {string} preferenceName name of the preference to set
  136. * @param {number | boolean | string} value value to set
  137. */
  138. setUserPreference(extensionName: string, preferenceName: string, value: number | boolean | string) {
  139. EditorUI.getEditor().setUserPreference(extensionName, preferenceName, value);
  140. }
  141. /**
  142. * Sets a group of user preference values in the user settings file located in the project. Elements in the
  143. * group will merge in with existing group preferences. Use this method if setting a bunch of settings
  144. * at once.
  145. * @param {string} extensionName name of the group the preference lives under
  146. * @param {string} groupPreferenceValues an object literal containing all of the preferences for the group.
  147. */
  148. setUserPreferenceGroup(extensionName: string, groupPreferenceValues: Object) {
  149. EditorUI.getEditor().setUserPreferenceGroup(extensionName, groupPreferenceValues);
  150. }
  151. }
  152. /**
  153. * Registry for service extensions that are concerned about Resources
  154. */
  155. export class ResourceServicesProvider extends ServicesProvider<Editor.HostExtensions.ResourceServicesEventListener> implements Editor.HostExtensions.ResourceServicesProvider {
  156. constructor() {
  157. super();
  158. }
  159. /**
  160. * Allow this service registry to subscribe to events that it is interested in
  161. * @param {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
  162. */
  163. subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
  164. eventDispatcher.subscribeToEvent(EditorEvents.SaveResourceNotification, (ev) => this.saveResource(ev));
  165. eventDispatcher.subscribeToEvent(EditorEvents.DeleteResourceNotification, (ev) => this.deleteResource(ev));
  166. eventDispatcher.subscribeToEvent(EditorEvents.RenameResourceNotification, (ev) => this.renameResource(ev));
  167. eventDispatcher.subscribeToEvent(EditorEvents.EditResource, (ev) => this.editResource(ev));
  168. }
  169. /**
  170. * Called after a resource has been saved
  171. * @param {Editor.EditorEvents.SaveResourceEvent} ev
  172. */
  173. saveResource(ev: Editor.EditorEvents.SaveResourceEvent) {
  174. // run through and find any services that can handle this.
  175. this.registeredServices.forEach((service) => {
  176. try {
  177. // Verify that the service contains the appropriate methods and that it can save
  178. if (service.save) {
  179. service.save(ev);
  180. }
  181. } catch (e) {
  182. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  183. }
  184. });
  185. }
  186. /**
  187. * Called when a resource has been deleted
  188. */
  189. deleteResource(ev: Editor.EditorEvents.DeleteResourceEvent) {
  190. this.registeredServices.forEach((service) => {
  191. try {
  192. // Verify that the service contains the appropriate methods and that it can delete
  193. if (service.delete) {
  194. service.delete(ev);
  195. }
  196. } catch (e) {
  197. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  198. }
  199. });
  200. }
  201. /**
  202. * Called when a resource has been renamed
  203. * @param {Editor.EditorEvents.RenameResourceEvent} ev
  204. */
  205. renameResource(ev: Editor.EditorEvents.RenameResourceEvent) {
  206. this.registeredServices.forEach((service) => {
  207. try {
  208. // Verify that the service contains the appropriate methods and that it can handle the rename
  209. if (service.rename) {
  210. service.rename(ev);
  211. }
  212. } catch (e) {
  213. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  214. }
  215. });
  216. }
  217. /**
  218. * Called when a resource is about to be edited
  219. * @param {Editor.EditorEvents.EditResourceEvent} ev
  220. */
  221. editResource(ev: Editor.EditorEvents.EditResourceEvent) {
  222. this.registeredServices.forEach((service) => {
  223. try {
  224. // Verify that the service contains the appropriate methods and that it can handle the edit
  225. if (service.edit) {
  226. service.edit(ev);
  227. }
  228. } catch (e) {
  229. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  230. }
  231. });
  232. }
  233. /**
  234. * Create New Material
  235. * @param {string} resourcePath
  236. * @param {string} materialName
  237. * @param {boolean} reportError
  238. */
  239. createMaterial(resourcePath: string, materialName: string, reportError: boolean): boolean {
  240. return ResourceOps.CreateNewMaterial(resourcePath, materialName, reportError);
  241. }
  242. }
  243. /**
  244. * Registry for service extensions that are concerned about Scenes
  245. */
  246. export class SceneServicesProvider extends ServicesProvider<Editor.HostExtensions.SceneServicesEventListener> implements Editor.HostExtensions.SceneServicesProvider {
  247. constructor() {
  248. super();
  249. }
  250. /**
  251. * Allow this service registry to subscribe to events that it is interested in
  252. * @param {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
  253. */
  254. subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
  255. eventDispatcher.subscribeToEvent(EditorEvents.ActiveSceneEditorChange, (ev) => this.activeSceneEditorChange(ev));
  256. eventDispatcher.subscribeToEvent(EditorEvents.SceneClosed, (ev) => this.sceneClosed(ev));
  257. }
  258. /**
  259. * Called after an active scene editor change
  260. * @param {Editor.EditorEvents.ActiveSceneEditorChangeEvent} ev
  261. */
  262. activeSceneEditorChange(ev: Editor.EditorEvents.ActiveSceneEditorChangeEvent) {
  263. // run through and find any services that can handle this.
  264. this.registeredServices.forEach((service) => {
  265. try {
  266. // Verify that the service contains the appropriate methods and that it can save
  267. if (service.activeSceneEditorChanged) {
  268. service.activeSceneEditorChanged(ev);
  269. }
  270. } catch (e) {
  271. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  272. }
  273. });
  274. }
  275. /**
  276. * Called after a scene is closed
  277. * @param {Editor.EditorEvents.SceneClosedEvent} ev
  278. */
  279. sceneClosed(ev: Editor.EditorEvents.SceneClosedEvent) {
  280. // run through and find any services that can handle this.
  281. this.registeredServices.forEach((service) => {
  282. try {
  283. // Verify that the service contains the appropriate methods and that it can save
  284. if (service.editorSceneClosed) {
  285. service.editorSceneClosed(ev);
  286. }
  287. } catch (e) {
  288. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  289. }
  290. });
  291. }
  292. }
  293. /**
  294. * Registry for service extensions that are concerned about and need access to parts of the editor user interface
  295. * Note: we may want to move this out into it's own file since it has a bunch of editor dependencies
  296. */
  297. export class UIServicesProvider extends ServicesProvider<Editor.HostExtensions.UIServicesEventListener> implements Editor.HostExtensions.UIServicesProvider {
  298. constructor() {
  299. super();
  300. }
  301. private mainFrame: MainFrame = null;
  302. private inspectorFrame: InspectorFrame = null;
  303. private modalOps: ModalOps;
  304. init(mainFrame: MainFrame, modalOps: ModalOps) {
  305. // Only set these once
  306. if (this.mainFrame == null) {
  307. this.mainFrame = mainFrame;
  308. this.inspectorFrame = this.mainFrame.inspectorframe;
  309. }
  310. if (this.modalOps == null) {
  311. this.modalOps = modalOps;
  312. }
  313. }
  314. /**
  315. * Adds a new menu to the plugin menu
  316. * @param {string} id
  317. * @param {any} items
  318. * @return {Atomic.UIMenuItemSource}
  319. */
  320. createPluginMenuItemSource(id: string, items: any): Atomic.UIMenuItemSource {
  321. return this.mainFrame.menu.createPluginMenuItemSource(id, items);
  322. }
  323. /**
  324. * Removes a previously added menu from the plugin menu
  325. * @param {string} id
  326. */
  327. removePluginMenuItemSource(id: string) {
  328. this.mainFrame.menu.removePluginMenuItemSource(id);
  329. }
  330. /**
  331. * Returns the currently active resource editor or null
  332. * @return {Editor.ResourceEditor}
  333. */
  334. getCurrentResourceEditor(): Editor.ResourceEditor {
  335. return this.mainFrame.resourceframe.currentResourceEditor;
  336. }
  337. /**
  338. * Adds a new menu to the hierarchy context menu
  339. * @param {string} id
  340. * @param {any} items
  341. * @return {Atomic.UIMenuItemSource}
  342. */
  343. createHierarchyContextMenuItemSource(id: string, items: any): Atomic.UIMenuItemSource {
  344. return this.mainFrame.hierarchyFrame.menu.createPluginItemSource(id, items);
  345. }
  346. /**
  347. * Removes a previously added menu from the hierarchy context menu
  348. * @param {string} id
  349. */
  350. removeHierarchyContextMenuItemSource(id: string) {
  351. this.mainFrame.hierarchyFrame.menu.removePluginItemSource(id);
  352. }
  353. /**
  354. * Adds a new menu to the project context menu
  355. * @param {string} id
  356. * @param {any} items
  357. * @return {Atomic.UIMenuItemSource}
  358. */
  359. createProjectContextMenuItemSource(id: string, items: any): Atomic.UIMenuItemSource {
  360. return this.mainFrame.projectframe.menu.createPluginItemSource(id, items);
  361. }
  362. /**
  363. * Removes a previously added menu from the project context menu
  364. * @param {string} id
  365. */
  366. removeProjectContextMenuItemSource(id: string) {
  367. this.mainFrame.projectframe.menu.removePluginItemSource(id);
  368. }
  369. /**
  370. * Refreshes the hierarchy frame
  371. */
  372. refreshHierarchyFrame() {
  373. this.mainFrame.hierarchyFrame.populate();
  374. }
  375. /**
  376. * Loads Custom Inspector Widget
  377. * @param {Atomic.UIWidget} customInspector
  378. */
  379. loadCustomInspector(customInspector: Atomic.UIWidget) {
  380. if (this.inspectorFrame) {
  381. this.inspectorFrame.loadCustomInspectorWidget(customInspector);
  382. }
  383. }
  384. /**
  385. * Disaplays a modal window
  386. * @param {Editor.Modal.ModalWindow} window
  387. */
  388. showModalWindow(windowText: string, uifilename: string, handleWidgetEventCB: (ev: Atomic.UIWidgetEvent) => void): Editor.Modal.ExtensionWindow {
  389. return this.modalOps.showExtensionWindow(windowText, uifilename, handleWidgetEventCB);
  390. }
  391. /**
  392. * Disaplays a modal error window
  393. * @param {string} windowText
  394. * @param {string} message
  395. */
  396. showModalError(windowText: string, message: string) {
  397. return this.modalOps.showError(windowText, message);
  398. }
  399. /**
  400. * Displays a resource slection window
  401. * @param {string} windowText
  402. * @param {string} importerType
  403. * @param {string} resourceType
  404. * @param {function} callback
  405. * @param {any} retObject
  406. * @param {any} args
  407. */
  408. showResourceSelection(windowText: string, importerType: string, resourceType: string, callback: (retObject: any, args: any) => void, args: any = undefined) {
  409. this.modalOps.showResourceSelection(windowText, importerType, resourceType, callback);
  410. }
  411. /**
  412. * Will register a custom editor for a particular file type.
  413. * @param {Editor.Extensions.ResourceEditorBuilder} editorBuilder
  414. */
  415. registerCustomEditor(editorBuilder: Editor.Extensions.ResourceEditorBuilder) {
  416. this.mainFrame.resourceframe.resourceEditorProvider.registerCustomEditor(editorBuilder);
  417. }
  418. /**
  419. * Will unregister a previously registered editor builder
  420. * @param {Editor.Extensions.ResourceEditorBuilder} editorBuilder
  421. */
  422. unregisterCustomEditor(editorBuilder: Editor.Extensions.ResourceEditorBuilder) {
  423. this.mainFrame.resourceframe.resourceEditorProvider.unregisterCustomEditor(editorBuilder);
  424. }
  425. /**
  426. * Called when a menu item has been clicked
  427. * @param {string} refId
  428. * @type {boolean} return true if handled
  429. */
  430. menuItemClicked(refid: string): boolean {
  431. // run through and find any services that can handle this.
  432. return this.registeredServices.some((service) => {
  433. try {
  434. // Verify that the service contains the appropriate methods and that it can handle it
  435. if (service.menuItemClicked) {
  436. if (service.menuItemClicked(refid)) {
  437. return true;
  438. }
  439. }
  440. } catch (e) {
  441. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  442. }
  443. });
  444. }
  445. /**
  446. * Called when a context menu item in the hierarchy pane has been clicked
  447. * @param {Atomic.Node} node
  448. * @param {string} refId
  449. * @type {boolean} return true if handled
  450. */
  451. hierarchyContextItemClicked(node: Atomic.Node, refid: string): boolean {
  452. if (!node)
  453. return false;
  454. // run through and find any services that can handle this.
  455. return this.registeredServices.some((service) => {
  456. try {
  457. // Verify that the service contains the appropriate methods and that it can handle it
  458. if (service.hierarchyContextItemClicked) {
  459. if (service.hierarchyContextItemClicked(node, refid)) {
  460. return true;
  461. }
  462. }
  463. } catch (e) {
  464. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  465. }
  466. });
  467. }
  468. /**
  469. * Called when a context menu item in the hierarchy pane has been clicked
  470. * @param {ToolCore.Asset} asset
  471. * @param {string} refId
  472. * @type {boolean} return true if handled
  473. */
  474. projectContextItemClicked(asset: ToolCore.Asset, refid: string): boolean {
  475. if (!asset)
  476. return false;
  477. // run through and find any services that can handle this.
  478. return this.registeredServices.some((service) => {
  479. try {
  480. // Verify that the service contains the appropriate methods and that it can handle it
  481. if (service.projectContextItemClicked) {
  482. if (service.projectContextItemClicked(asset, refid)) {
  483. return true;
  484. }
  485. }
  486. } catch (e) {
  487. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  488. }
  489. });
  490. }
  491. /**
  492. * Called when a project asset in the hierarchy pane has been clicked
  493. * @param {ToolCore.Asset} asset
  494. * @type {boolean} return true if handled
  495. */
  496. projectAssetClicked(asset: ToolCore.Asset):boolean {
  497. if (!asset) {
  498. return false;
  499. }
  500. // run through and find any services that can handle this.
  501. return this.registeredServices.some((service) => {
  502. try {
  503. // Verify that the service contains the appropriate methods and that it can handle it
  504. if (service.projectAssetClicked) {
  505. if (service.projectAssetClicked(asset)) {
  506. return true;
  507. }
  508. }
  509. } catch (e) {
  510. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  511. }
  512. });
  513. }
  514. /**
  515. * Hooks into web messages coming in from web views
  516. * @param {[String|Object]} data
  517. */
  518. handleWebMessage(data) {
  519. let messageType;
  520. let messageObject;
  521. try {
  522. messageObject = JSON.parse(data.request);
  523. messageType = messageObject.message;
  524. } catch (e) {
  525. // not JSON, we are just getting a notification message of some sort
  526. messageType = data.request;
  527. }
  528. // run through and find any services that can handle this.
  529. this.registeredServices.forEach((service) => {
  530. try {
  531. // Verify that the service contains the appropriate methods and that it can save
  532. if (service.handleWebMessage) {
  533. service.handleWebMessage(messageType, messageObject);
  534. }
  535. } catch (e) {
  536. EditorUI.showModalError("Extension Error", `Error detected in extension ${service.name}:\n${e}\n\n ${e.stack}`);
  537. }
  538. });
  539. }
  540. /**
  541. * Allow this service registry to subscribe to events that it is interested in
  542. * @param {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
  543. */
  544. subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
  545. // Placeholder for when UI events published by the editor need to be listened for
  546. eventDispatcher.subscribeToEvent(EditorEvents.WebMessage, (ev) => this.handleWebMessage(ev));
  547. }
  548. }