You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.js 868B

12345678910111213141516171819202122232425262728293031323334
  1. // @flow
  2. import { toState } from '../base/redux';
  3. const ETHERPAD_OPTIONS = {
  4. showControls: 'true',
  5. showChat: 'false',
  6. showLineNumbers: 'true',
  7. useMonospaceFont: 'false'
  8. };
  9. /**
  10. * Retrieves the current sahred document URL.
  11. *
  12. * @param {Function|Object} stateful - The redux store or {@code getState} function.
  13. * @returns {?string} - Current shared document URL or undefined.
  14. */
  15. export function getSharedDocumentUrl(stateful: Function | Object) {
  16. const state = toState(stateful);
  17. const { documentUrl } = state['features/etherpad'];
  18. const { displayName } = state['features/base/settings'];
  19. if (!documentUrl) {
  20. return undefined;
  21. }
  22. const params = new URLSearchParams(ETHERPAD_OPTIONS);
  23. if (displayName) {
  24. params.append('userName', displayName);
  25. }
  26. return `${documentUrl}?${params.toString()}`;
  27. }