@@ -72,10 +72,6 @@ module.exports = class Guest extends Annotator
7272 formatted = {}
7373 for k, v of annotation when k isnt ' anchors'
7474 formatted[k] = v
75- # Work around issue in jschannel where a repeated object is considered
76- # recursive, even if it is not its own ancestor.
77- if formatted .document ? .title
78- formatted .document .title = formatted .document .title .slice ()
7975 formatted
8076
8177 this .addPlugin (' CrossFrame' , cfOptions)
@@ -115,21 +111,20 @@ module.exports = class Guest extends Annotator
115111 crossframe .onConnect (=> this .publish (' panelReady' ))
116112 crossframe .on (' onEditorHide' , this .onEditorHide )
117113 crossframe .on (' onEditorSubmit' , this .onEditorSubmit )
118- crossframe .on ' focusAnnotations' , (ctx , tags = []) =>
114+ crossframe .on ' focusAnnotations' , (tags = []) =>
119115 for anchor in @anchors when anchor .highlights ?
120116 toggle = anchor .annotation .$$tag in tags
121117 $ (anchor .highlights ).toggleClass (' annotator-hl-focused' , toggle)
122- crossframe .on ' scrollToAnnotation' , (ctx , tag ) =>
118+ crossframe .on ' scrollToAnnotation' , (tag ) =>
123119 for anchor in @anchors when anchor .highlights ?
124120 if anchor .annotation .$$tag is tag
125121 $ (anchor .highlights ).scrollintoview ()
126122 return
127- crossframe .on ' getDocumentInfo' , (trans ) =>
128- trans .delayReturn (true )
123+ crossframe .on ' getDocumentInfo' , (cb ) =>
129124 this .getDocumentInfo ()
130- .then ((info ) -> trans . complete ( info))
131- .catch ((reason ) -> trans . error (reason))
132- crossframe .on ' setVisibleHighlights' , (ctx , state ) =>
125+ .then ((info ) -> cb ( null , info))
126+ .catch ((reason ) -> cb (reason))
127+ crossframe .on ' setVisibleHighlights' , (state ) =>
133128 this .publish ' setVisibleHighlights' , state
134129
135130 _setupWrapper : ->
@@ -315,24 +310,20 @@ module.exports = class Guest extends Annotator
315310 return annotation
316311
317312 showAnnotations : (annotations ) =>
318- @crossframe ? .notify
319- method : " showAnnotations"
320- params : (a .$$tag for a in annotations)
313+ tags = (a .$$tag for a in annotations)
314+ @crossframe ? .call (' showAnnotations' , tags)
321315
322316 toggleAnnotationSelection : (annotations ) =>
323- @crossframe ? .notify
324- method : " toggleAnnotationSelection"
325- params : (a .$$tag for a in annotations)
317+ tags = (a .$$tag for a in annotations)
318+ @crossframe ? .call (' toggleAnnotationSelection' , tags)
326319
327320 updateAnnotations : (annotations ) =>
328- @crossframe ? .notify
329- method : " updateAnnotations"
330- params : (a .$$tag for a in annotations)
321+ tags = (a .$$tag for a in annotations)
322+ @crossframe ? .call (' updateAnnotations' , tags)
331323
332324 focusAnnotations : (annotations ) =>
333- @crossframe ? .notify
334- method : " focusAnnotations"
335- params : (a .$$tag for a in annotations)
325+ tags = (a .$$tag for a in annotations)
326+ @crossframe ? .call (' focusAnnotations' , tags)
336327
337328 onSuccessfulSelection : (event , immediate ) ->
338329 unless event?
@@ -396,11 +387,7 @@ module.exports = class Guest extends Annotator
396387 # Pass true to show the highlights in the frame or false to disable.
397388 setVisibleHighlights : (shouldShowHighlights ) ->
398389 return if @visibleHighlights == shouldShowHighlights
399-
400- @crossframe ? .notify
401- method : ' setVisibleHighlights'
402- params : shouldShowHighlights
403-
390+ @crossframe ? .call (' setVisibleHighlights' , shouldShowHighlights)
404391 this .toggleHighlightClass (shouldShowHighlights)
405392
406393 toggleHighlightClass : (shouldShowHighlights ) ->
@@ -413,11 +400,11 @@ module.exports = class Guest extends Annotator
413400
414401 # Open the sidebar
415402 showFrame : ->
416- @crossframe ? .notify method : ' open'
403+ @crossframe ? .call ( ' open' )
417404
418405 # Close the sidebar
419406 hideFrame : ->
420- @crossframe ? .notify method : ' back'
407+ @crossframe ? .call ( ' back' )
421408
422409 onAdderMouseup : (event ) ->
423410 event .preventDefault ()
0 commit comments