Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
5eb1ac77
Commit
5eb1ac77
authored
Mar 22, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Mar 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename toastMessagePushed message to toastMessageAdded to match actions from toast messenger
parent
42774ce6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
17 deletions
+19
-17
sidebar.ts
src/annotator/sidebar.ts
+2
-2
frame-sync.ts
src/sidebar/services/frame-sync.ts
+7
-5
frame-sync-test.js
src/sidebar/services/test/frame-sync-test.js
+8
-8
toast-messenger.ts
src/sidebar/services/toast-messenger.ts
+1
-1
port-rpc-events.d.ts
src/types/port-rpc-events.d.ts
+1
-1
No files found.
src/annotator/sidebar.ts
View file @
5eb1ac77
...
@@ -602,10 +602,11 @@ export class Sidebar implements Destroyable {
...
@@ -602,10 +602,11 @@ export class Sidebar implements Destroyable {
}
}
this
.
_updateLayoutState
(
true
);
this
.
_updateLayoutState
(
true
);
this
.
_sidebarRPC
.
call
(
'sidebarOpened'
);
}
}
close
()
{
close
()
{
this
.
_sidebarRPC
.
call
(
'sidebarClosed'
);
if
(
this
.
iframeContainer
)
{
if
(
this
.
iframeContainer
)
{
this
.
iframeContainer
.
style
.
marginLeft
=
''
;
this
.
iframeContainer
.
style
.
marginLeft
=
''
;
this
.
iframeContainer
.
classList
.
add
(
'sidebar-collapsed'
);
this
.
iframeContainer
.
classList
.
add
(
'sidebar-collapsed'
);
...
@@ -618,7 +619,6 @@ export class Sidebar implements Destroyable {
...
@@ -618,7 +619,6 @@ export class Sidebar implements Destroyable {
}
}
this
.
_updateLayoutState
(
false
);
this
.
_updateLayoutState
(
false
);
this
.
_sidebarRPC
.
call
(
'sidebarClosed'
);
}
}
/**
/**
...
...
src/sidebar/services/frame-sync.ts
View file @
5eb1ac77
...
@@ -159,7 +159,7 @@ export class FrameSyncService {
...
@@ -159,7 +159,7 @@ export class FrameSyncService {
*/
*/
private
_scheduleAnchorStatusUpdate
:
DebouncedFunction
<
[]
>
;
private
_scheduleAnchorStatusUpdate
:
DebouncedFunction
<
[]
>
;
/**
Tell
s if the sidebar is currently open or closed */
/**
Indicate
s if the sidebar is currently open or closed */
private
_sidebarIsOpen
:
boolean
;
private
_sidebarIsOpen
:
boolean
;
// Test seam
// Test seam
...
@@ -198,7 +198,7 @@ export class FrameSyncService {
...
@@ -198,7 +198,7 @@ export class FrameSyncService {
this
.
_pendingAnchorStatusUpdates
.
clear
();
this
.
_pendingAnchorStatusUpdates
.
clear
();
},
10
);
},
10
);
this
.
_sidebarIsOpen
=
tru
e
;
this
.
_sidebarIsOpen
=
fals
e
;
this
.
_setupSyncToGuests
();
this
.
_setupSyncToGuests
();
this
.
_setupHostEvents
();
this
.
_setupHostEvents
();
...
@@ -532,10 +532,12 @@ export class FrameSyncService {
...
@@ -532,10 +532,12 @@ export class FrameSyncService {
}
}
private
_setupToastMessengerEvents
()
{
private
_setupToastMessengerEvents
()
{
this
.
_toastMessenger
.
on
(
'toastMessagePushed'
,
(
message
:
ToastMessage
)
=>
{
this
.
_toastMessenger
.
on
(
'toastMessageAdded'
,
(
message
:
ToastMessage
)
=>
{
// Forward hidden messages to "host" when sidebar is collapsed
// Forward hidden messages to "host" when sidebar is collapsed, with the
// intention that another container can be used to render those messages
// there, ensuring screen readers announce them.
if
(
message
.
visuallyHidden
&&
!
this
.
_sidebarIsOpen
)
{
if
(
message
.
visuallyHidden
&&
!
this
.
_sidebarIsOpen
)
{
this
.
notifyHost
(
'toastMessage
Push
ed'
,
message
);
this
.
notifyHost
(
'toastMessage
Add
ed'
,
message
);
}
}
});
});
this
.
_toastMessenger
.
on
(
'toastMessageDismissed'
,
(
messageId
:
string
)
=>
{
this
.
_toastMessenger
.
on
(
'toastMessageDismissed'
,
(
messageId
:
string
)
=>
{
...
...
src/sidebar/services/test/frame-sync-test.js
View file @
5eb1ac77
...
@@ -1127,31 +1127,31 @@ describe('FrameSyncService', () => {
...
@@ -1127,31 +1127,31 @@ describe('FrameSyncService', () => {
});
});
});
});
context
(
'when a toast message is
push
ed'
,
()
=>
{
context
(
'when a toast message is
add
ed'
,
()
=>
{
it
(
'forwards the message to the host if it is hidden and the sidebar is collapsed'
,
()
=>
{
it
(
'forwards the message to the host if it is hidden and the sidebar is collapsed'
,
()
=>
{
const
message
=
{
visuallyHidden
:
true
};
const
message
=
{
visuallyHidden
:
true
};
emitHostEvent
(
'sidebarClosed'
);
emitHostEvent
(
'sidebarClosed'
);
fakeToastMessenger
.
emit
(
'toastMessage
Push
ed'
,
message
);
fakeToastMessenger
.
emit
(
'toastMessage
Add
ed'
,
message
);
assert
.
calledWith
(
hostRPC
().
call
,
'toastMessage
Push
ed'
,
message
);
assert
.
calledWith
(
hostRPC
().
call
,
'toastMessage
Add
ed'
,
message
);
});
});
it
(
'ignores the message if it is not hidden'
,
()
=>
{
it
(
'ignores the message if it is not hidden'
,
()
=>
{
const
message
=
{
visuallyHidden
:
false
};
const
message
=
{
visuallyHidden
:
false
};
emitHostEvent
(
'sidebarClosed'
);
fakeToastMessenger
.
emit
(
'toastMessageAdded'
,
message
);
fakeToastMessenger
.
emit
(
'toastMessagePushed'
,
message
);
assert
.
neverCalledWith
(
hostRPC
().
call
,
'toastMessage
Push
ed'
,
message
);
assert
.
neverCalledWith
(
hostRPC
().
call
,
'toastMessage
Add
ed'
,
message
);
});
});
it
(
'ignores the message if the sidebar is not collapsed'
,
()
=>
{
it
(
'ignores the message if the sidebar is not collapsed'
,
()
=>
{
const
message
=
{
visuallyHidden
:
true
};
const
message
=
{
visuallyHidden
:
true
};
fakeToastMessenger
.
emit
(
'toastMessagePushed'
,
message
);
emitHostEvent
(
'sidebarOpened'
);
fakeToastMessenger
.
emit
(
'toastMessageAdded'
,
message
);
assert
.
neverCalledWith
(
hostRPC
().
call
,
'toastMessage
Push
ed'
,
message
);
assert
.
neverCalledWith
(
hostRPC
().
call
,
'toastMessage
Add
ed'
,
message
);
});
});
});
});
...
...
src/sidebar/services/toast-messenger.ts
View file @
5eb1ac77
...
@@ -132,7 +132,7 @@ export class ToastMessengerService extends TinyEmitter {
...
@@ -132,7 +132,7 @@ export class ToastMessengerService extends TinyEmitter {
isDismissed
:
false
,
isDismissed
:
false
,
...
message
,
...
message
,
});
});
this
.
emit
(
'toastMessage
Push
ed'
,
message
);
this
.
emit
(
'toastMessage
Add
ed'
,
message
);
if
(
autoDismiss
)
{
if
(
autoDismiss
)
{
// Attempt to dismiss message after a set time period. NB: The message may
// Attempt to dismiss message after a set time period. NB: The message may
...
...
src/types/port-rpc-events.d.ts
View file @
5eb1ac77
...
@@ -235,7 +235,7 @@ export type SidebarToHostEvent =
...
@@ -235,7 +235,7 @@ export type SidebarToHostEvent =
/**
/**
* The sidebar is asking the host to toast a message
* The sidebar is asking the host to toast a message
*/
*/
|
'toastMessage
Push
ed'
|
'toastMessage
Add
ed'
/**
/**
* The sidebar is asking the host to dismiss a toast message
* The sidebar is asking the host to dismiss a toast message
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment