touchstudy-core 0.1.170 → 0.1.171

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6480,6 +6480,28 @@ var formatPhoneNumber = function formatPhoneNumber(phoneNumberString) {
6480
6480
  return phoneNumberString;
6481
6481
  };
6482
6482
 
6483
+ var cleanRichText = function cleanRichText(html, fontSize) {
6484
+ if (fontSize === void 0) {
6485
+ fontSize = "1rem";
6486
+ }
6487
+ var container = document.createElement('div');
6488
+ container.innerHTML = html;
6489
+ var tagsToRemove = ['script', 'style', 'img', 'video', 'audio', 'iframe', 'canvas', 'object', 'embed', 'table'];
6490
+ tagsToRemove.forEach(function (tag) {
6491
+ container.querySelectorAll(tag).forEach(function (el) {
6492
+ return el.remove();
6493
+ });
6494
+ });
6495
+ var textTags = ['p', 'div', 'section', 'article', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'address', 'aside', 'span', 'a', 'strong', 'b', 'em', 'i', 'u', 'small', 'abbr', 'cite', 'code', 'mark', 'sub', 'sup', 'time', 'kbd', 'samp', 'var', 'q', 'dfn', 'br', 'label', 'legend', 'summary', 'dt', 'dd', 'caption', 'figcaption', 'title'];
6496
+ container.querySelectorAll('*').forEach(function (el) {
6497
+ if (textTags.includes(el.tagName)) {
6498
+ el.style.fontSize = fontSize;
6499
+ el.style.lineHeight = "1";
6500
+ }
6501
+ });
6502
+ return container.innerHTML;
6503
+ };
6504
+
6483
6505
  var getLocalDayOfWeek = function getLocalDayOfWeek(utcDateTime, dayOfWeek) {
6484
6506
  var currentDayOfWeek = moment.utc(utcDateTime).weekday();
6485
6507
  var diff = dayOfWeek - currentDayOfWeek;
@@ -15786,15 +15808,18 @@ var NoteItem = function NoteItem(_ref) {
15786
15808
  var handleItemClick = function handleItemClick() {
15787
15809
  onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(data);
15788
15810
  };
15811
+ var cleanedRichText = useMemo(function () {
15812
+ return cleanRichText(data.content);
15813
+ }, [data.content]);
15789
15814
  useEffect(function () {
15790
15815
  onLoad === null || onLoad === void 0 ? void 0 : onLoad();
15791
- }, []);
15816
+ }, [cleanedRichText, JSON.stringify(data)]);
15792
15817
  useEffect(function () {
15793
15818
  if (window.MathJax) {
15794
15819
  var _window$MathJax;
15795
15820
  (_window$MathJax = window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.typeset();
15796
15821
  }
15797
- }, [data.content]);
15822
+ }, [cleanedRichText]);
15798
15823
  return React__default.createElement(Box, Object.assign({}, NoteItemStyles.root, {
15799
15824
  onClick: handleItemClick,
15800
15825
  sx: {
@@ -15826,7 +15851,7 @@ var NoteItem = function NoteItem(_ref) {
15826
15851
  overflow: "hidden"
15827
15852
  },
15828
15853
  dangerouslySetInnerHTML: {
15829
- __html: data.content || ""
15854
+ __html: cleanedRichText
15830
15855
  }
15831
15856
  }))), React__default.createElement(Box, null, (isAdmin || data.isOwned) && React__default.createElement(ClickAwayListener, {
15832
15857
  onClickAway: onClose
@@ -15939,6 +15964,9 @@ var NoteItemList = function NoteItemList(_ref) {
15939
15964
  onView(data);
15940
15965
  };
15941
15966
  var disabled = !data.isOwned && (!isAdminUser || data.type == undefined || data.type == NoteType.TeacherToAllAdmin || data.type == NoteType.TeacherToTeachers);
15967
+ var cleanedRichText = useMemo(function () {
15968
+ return cleanRichText(data.content);
15969
+ }, [data.content]);
15942
15970
  useEffect(function () {
15943
15971
  if (window.MathJax) {
15944
15972
  var _window$MathJax;
@@ -15973,7 +16001,7 @@ var NoteItemList = function NoteItemList(_ref) {
15973
16001
  overflow: "hidden"
15974
16002
  },
15975
16003
  dangerouslySetInnerHTML: {
15976
- __html: data.content
16004
+ __html: cleanedRichText
15977
16005
  }
15978
16006
  })), React__default.createElement(TableCell$1, {
15979
16007
  className: "text-nowrap"
@@ -17686,7 +17714,7 @@ var ExamResultItem = function ExamResultItem(_ref) {
17686
17714
  };
17687
17715
  useEffect(function () {
17688
17716
  onLoad === null || onLoad === void 0 ? void 0 : onLoad();
17689
- }, []);
17717
+ }, [JSON.stringify(data)]);
17690
17718
  var examTime = useMemo(function () {
17691
17719
  return utcToLocalTime(data.startTime, "HH:mm") + " ~ " + utcToLocalTime(data.endTime, "HH:mm");
17692
17720
  }, [data.startTime, data.endTime]);
@@ -23247,7 +23275,7 @@ var TextbookResultItem = function TextbookResultItem(_ref) {
23247
23275
  };
23248
23276
  useEffect(function () {
23249
23277
  onLoad === null || onLoad === void 0 ? void 0 : onLoad();
23250
- }, []);
23278
+ }, [JSON.stringify(data)]);
23251
23279
  return React__default.createElement(Stack, {
23252
23280
  height: "100%",
23253
23281
  direction: "column",
@@ -26193,7 +26221,7 @@ var CourseAttendanceItem = function CourseAttendanceItem(_ref) {
26193
26221
  var lastAttendance = timAgo(data.lastAttendanceDate, t);
26194
26222
  useEffect(function () {
26195
26223
  onLoad === null || onLoad === void 0 ? void 0 : onLoad();
26196
- }, []);
26224
+ }, [JSON.stringify(data)]);
26197
26225
  return React__default.createElement(Stack, {
26198
26226
  direction: "column",
26199
26227
  px: 2,
@@ -39133,10 +39161,19 @@ var AnnouncementItem = function AnnouncementItem(_ref) {
39133
39161
  onLoad = _ref.onLoad;
39134
39162
  var _useTranslation = useTranslation(),
39135
39163
  t = _useTranslation.t;
39164
+ var announcementData = convertAnnouncementData(t, role, data);
39165
+ var cleanedRichText = useMemo(function () {
39166
+ return cleanRichText(announcementData.content);
39167
+ }, [announcementData.content]);
39168
+ useEffect(function () {
39169
+ if (window.MathJax) {
39170
+ var _window$MathJax;
39171
+ (_window$MathJax = window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.typeset();
39172
+ }
39173
+ }, [cleanedRichText]);
39136
39174
  useEffect(function () {
39137
39175
  onLoad();
39138
- }, []);
39139
- var announcementData = convertAnnouncementData(t, role, data);
39176
+ }, [cleanedRichText, data.createdAt, announcementData.action, announcementData.name]);
39140
39177
  return React__default.createElement(Fragment$1, null, renderLink(React__default.createElement(ListItemButton, {
39141
39178
  sx: _extends({
39142
39179
  py: 1.5,
@@ -39166,7 +39203,10 @@ var AnnouncementItem = function AnnouncementItem(_ref) {
39166
39203
  display: "inline-block",
39167
39204
  px: "4px"
39168
39205
  }, announcementData.action + ":"), React__default.createElement(Box, {
39169
- display: "inline-block"
39206
+ display: "inline-block",
39207
+ sx: {
39208
+ verticalAlign: "middle"
39209
+ }
39170
39210
  }, React__default.createElement(Box, {
39171
39211
  sx: {
39172
39212
  display: "-webkit-box",
@@ -39177,7 +39217,7 @@ var AnnouncementItem = function AnnouncementItem(_ref) {
39177
39217
  overflow: "hidden"
39178
39218
  },
39179
39219
  dangerouslySetInnerHTML: {
39180
- __html: announcementData.content || ""
39220
+ __html: cleanedRichText
39181
39221
  }
39182
39222
  }))),
39183
39223
  secondary: React__default.createElement(Typography, {
@@ -40531,5 +40571,5 @@ var LayoutContext = function LayoutContext(_ref) {
40531
40571
  });else return React__default.createElement(Fragment$1, null, children);
40532
40572
  };
40533
40573
 
40534
- export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AcceptNoAcademy, ActionButtons, AnnouncementContainer, AnnouncementType, AnswerCountSelector, ArticleCategorySelector, ArticleDialog, ArticleGroupView, AttendanceFormDialog, BASE_URL, BRIEF_GRADE_OPTIONS, _ChapterBox as ChapterBox, ChatContainer, types as ChatTypes, ClassDetail, ClassList, ClassNoteDialog, ClassSelector, CommonCreateNewQuestionDialog, CommonDialog, ConfirmDeleteDialog, ConfirmDialog, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_NOTE_FILTER, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, ExamDetailView, ExamEvent, ExamNoteDialog, ExamResultV2, ExamStatus, GOOGLE_CLIENT_ID, GOOGLE_RECAPTCHA_ID, GOOGLE_RECAPTCHA_KEY, GOOGLE_RECAPTCHA_SECRET, GRADE_OPTIONS, Header, InputText, LANGUAGE, LEARNING_SPACE, Language, LanguageHeaders, LayoutContext, LessonTooltip, ListView, Loading, LoadingComponent, Login, LoginQRCode, LoginWithEmail, SignIn as LoginWithPassword, MathJaxContainer, MathTinyEditor, NewNoteButton, NoAcademyHeaders, NotFound, NoteDrawer, NoteTabs, NoteType, NotesContainer, NotificationDetail, NotificationList, OrderBy, OrderType, PRE_REDIRECT_URL, PUSHER_CONFIG, PassCodeCheck, PassCodeDialog, PreparedItem, PreparedTextbookList, PreparedTextbookView, PreparedType, PrintContainerClassName, PrintContentClassName, PrintExamResultView, PrintExamView2, PrintHeaderClassName, PrintTitleClassName, QRCodeConfirmation, QuestionAnswerType, QuestionCountSelector, REDIRECT_URL, RELEASE_DATE, RecentUserAction, RecentUserActionNames, RecentUserActionSortBy, ReleaseAlert, Role, SUPER_ADMIN_BASE_URL, SchoolType$1 as SchoolType, ScoreSelector, SearchInput, ShareToTeacherDialog, StudentInfoDrawer, StudentSelector, SubjectSelector, TextbookActionButtons, TextbookViewDetail as TextbookDetail, TextbookDrawer, TextbookEditorType, TextbookList, TheAcademyDropdown, TheLanguageDropdown, TinyEditor, UserList, UserSortColumn, VirtualListView, VirtualTableView, api, apiUpload, canAccess as canAccessRoute, convertHHMMSStoSeconds, createRecentUserActionListApi, diffFromNow, ellipsisText, encodeParams, formatDataMyAnswer, formatDateTime, formatPhoneNumber, formatRole, formatTextbookDataMyAnswer, formatTime, formatTimeSecond, getAcademyDomain, getAccessToken, getErrorMessage, getLanguage, getLearningSpace, getLocalDayOfWeek, getOrdinalSuffix, getRecentUserActionListApi, getRedirectUrl, getRemainTime, getRole, getUtcDayOfWeek, i18n, includePathname, isLocalHost, isTextType, minutesToTimeSpan, pushTo, reset, setAcademies, setAcademy, setAlert, setConcurrentConnectionPusher, setLanguage, setLoading, setReFetchUserAcademies, setTotalUnreadMessages, setUser, store, timAgo, timeSpanToLocalMoment, toISOString, toLocalTime, totalSolveTimeCategories, totalTextbookSolveTimeCategories, useAutoAcademyDomain, useChatContainer, useCountDownTimer, useGoogleSignOut, useKeyboardVisible, useLanguage, useList, useLoadMore, useLogin, useNotes, usePusherConversation, useSwitchAcademy, useVirtualizeList, utcToLocalTime };
40574
+ export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AcceptNoAcademy, ActionButtons, AnnouncementContainer, AnnouncementType, AnswerCountSelector, ArticleCategorySelector, ArticleDialog, ArticleGroupView, AttendanceFormDialog, BASE_URL, BRIEF_GRADE_OPTIONS, _ChapterBox as ChapterBox, ChatContainer, types as ChatTypes, ClassDetail, ClassList, ClassNoteDialog, ClassSelector, CommonCreateNewQuestionDialog, CommonDialog, ConfirmDeleteDialog, ConfirmDialog, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_NOTE_FILTER, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, ExamDetailView, ExamEvent, ExamNoteDialog, ExamResultV2, ExamStatus, GOOGLE_CLIENT_ID, GOOGLE_RECAPTCHA_ID, GOOGLE_RECAPTCHA_KEY, GOOGLE_RECAPTCHA_SECRET, GRADE_OPTIONS, Header, InputText, LANGUAGE, LEARNING_SPACE, Language, LanguageHeaders, LayoutContext, LessonTooltip, ListView, Loading, LoadingComponent, Login, LoginQRCode, LoginWithEmail, SignIn as LoginWithPassword, MathJaxContainer, MathTinyEditor, NewNoteButton, NoAcademyHeaders, NotFound, NoteDrawer, NoteTabs, NoteType, NotesContainer, NotificationDetail, NotificationList, OrderBy, OrderType, PRE_REDIRECT_URL, PUSHER_CONFIG, PassCodeCheck, PassCodeDialog, PreparedItem, PreparedTextbookList, PreparedTextbookView, PreparedType, PrintContainerClassName, PrintContentClassName, PrintExamResultView, PrintExamView2, PrintHeaderClassName, PrintTitleClassName, QRCodeConfirmation, QuestionAnswerType, QuestionCountSelector, REDIRECT_URL, RELEASE_DATE, RecentUserAction, RecentUserActionNames, RecentUserActionSortBy, ReleaseAlert, Role, SUPER_ADMIN_BASE_URL, SchoolType$1 as SchoolType, ScoreSelector, SearchInput, ShareToTeacherDialog, StudentInfoDrawer, StudentSelector, SubjectSelector, TextbookActionButtons, TextbookViewDetail as TextbookDetail, TextbookDrawer, TextbookEditorType, TextbookList, TheAcademyDropdown, TheLanguageDropdown, TinyEditor, UserList, UserSortColumn, VirtualListView, VirtualTableView, api, apiUpload, canAccess as canAccessRoute, cleanRichText, convertHHMMSStoSeconds, createRecentUserActionListApi, diffFromNow, ellipsisText, encodeParams, formatDataMyAnswer, formatDateTime, formatPhoneNumber, formatRole, formatTextbookDataMyAnswer, formatTime, formatTimeSecond, getAcademyDomain, getAccessToken, getErrorMessage, getLanguage, getLearningSpace, getLocalDayOfWeek, getOrdinalSuffix, getRecentUserActionListApi, getRedirectUrl, getRemainTime, getRole, getUtcDayOfWeek, i18n, includePathname, isLocalHost, isTextType, minutesToTimeSpan, pushTo, reset, setAcademies, setAcademy, setAlert, setConcurrentConnectionPusher, setLanguage, setLoading, setReFetchUserAcademies, setTotalUnreadMessages, setUser, store, timAgo, timeSpanToLocalMoment, toISOString, toLocalTime, totalSolveTimeCategories, totalTextbookSolveTimeCategories, useAutoAcademyDomain, useChatContainer, useCountDownTimer, useGoogleSignOut, useKeyboardVisible, useLanguage, useList, useLoadMore, useLogin, useNotes, usePusherConversation, useSwitchAcademy, useVirtualizeList, utcToLocalTime };
40535
40575
  //# sourceMappingURL=index.modern.js.map