bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/annotations/text/service.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

import Storage from '/imports/ui/services/storage/session';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
2017-09-21 05:05:17 +08:00
const DRAW_SETTINGS = 'drawSettings';
const setTextShapeValue = (text) => {
2017-09-21 05:05:17 +08:00
const drawSettings = Storage.getItem(DRAW_SETTINGS);
if (drawSettings) {
drawSettings.textShape.textShapeValue = text;
2017-09-21 05:05:17 +08:00
Storage.setItem(DRAW_SETTINGS, drawSettings);
}
};
const resetTextShapeActiveId = () => {
2017-09-21 05:05:17 +08:00
const drawSettings = Storage.getItem(DRAW_SETTINGS);
if (drawSettings) {
drawSettings.textShape.textShapeActiveId = '';
2017-09-21 05:05:17 +08:00
Storage.setItem(DRAW_SETTINGS, drawSettings);
}
};
const isPresenter = () => {
const currentUser = Users.findOne({ userId: Auth.userID });
2017-09-21 05:05:17 +08:00
return currentUser ? currentUser.presenter : false;
};
2018-04-10 07:18:49 +08:00
const getMultiUserStatus = (whiteboardId) => {
const data = WhiteboardMultiUser.findOne({ meetingId: Auth.meetingID, whiteboardId });
2017-09-21 05:05:17 +08:00
return data ? data.multiUser : false;
2017-08-24 12:27:41 +08:00
};
const activeTextShapeId = () => {
2017-09-21 05:05:17 +08:00
const drawSettings = Storage.getItem(DRAW_SETTINGS);
return drawSettings ? drawSettings.textShape.textShapeActiveId : '';
};
export default {
setTextShapeValue,
activeTextShapeId,
isPresenter,
resetTextShapeActiveId,
2017-08-24 12:27:41 +08:00
getMultiUserStatus,
};