11import React from 'react' ;
2- import ComponentManager from 'sn-components-api ' ;
2+ import ComponentRelay from '@standardnotes/component-relay ' ;
33
44export default class Home extends React . Component {
55
@@ -104,14 +104,14 @@ export default class Home extends React.Component {
104104 // Be sure to capture this object as a variable, as this.note may be reassigned in `streamContextItem`, so by the time
105105 // you modify it in the presave block, it may not be the same object anymore, so the presave values will not be applied to
106106 // the right object, and it will save incorrectly.
107- let note = this . note ;
107+ const note = this . note ;
108108
109- this . componentManager . saveItemWithPresave ( note , ( ) => {
109+ this . componentRelay . saveItemWithPresave ( note , ( ) => {
110110 note . content . preview_html = null ;
111111 note . content . preview_plain = 'Created with Secure Spreadsheets' ;
112112
113- let json = this . getJSON ( ) ;
114- let content = JSON . stringify ( json ) ;
113+ const json = this . getJSON ( ) ;
114+ const content = JSON . stringify ( json ) ;
115115 note . content . text = content ;
116116 } ) ;
117117 }
@@ -124,23 +124,17 @@ export default class Home extends React.Component {
124124 }
125125
126126 connectToBridge ( ) {
127- const permissions = [
128- {
129- name : 'stream-context-item'
130- }
131- ] ;
132-
133- this . componentManager = new ComponentManager ( permissions , ( ) => {
134- // on ready
135- const platform = this . componentManager . platform ;
136- if ( platform ) {
137- document . body . classList . add ( platform ) ;
127+ this . componentRelay = new ComponentRelay ( {
128+ targetWindow : window ,
129+ onReady : ( ) => {
130+ const { platform } = this . componentRelay ;
131+ if ( platform ) {
132+ document . body . classList . add ( platform ) ;
133+ }
138134 }
139135 } ) ;
140136
141- // componentManager.loggingEnabled = true;
142-
143- this . componentManager . streamContextItem ( ( note ) => {
137+ this . componentRelay . streamContextItem ( ( note ) => {
144138 this . note = note ;
145139
146140 // Only update UI on non-metadata updates.
0 commit comments