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

39 lines
1.1 KiB
JavaScript
Raw Normal View History

import Storage from '/imports/ui/services/storage/session';
import Users from '/imports/ui/local-collections/users-collection/users';
import Auth from '/imports/ui/services/auth';
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 }, { fields: { presenter: 1 } });
2017-09-21 05:05:17 +08:00
return currentUser ? currentUser.presenter : false;
};
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,
};