@elice/material-quiz 1.240715.0-touch.3 → 1.240715.0-touch.5

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.
@@ -19,7 +19,8 @@ const EbDraggable = ({
19
19
  attributes,
20
20
  listeners,
21
21
  setNodeRef,
22
- transform
22
+ transform,
23
+ isDragging
23
24
  } = core.useDraggable({
24
25
  id,
25
26
  disabled
@@ -34,7 +35,9 @@ const EbDraggable = ({
34
35
  return React.createElement("div", Object.assign({
35
36
  ref: setNodeRef,
36
37
  className: className,
37
- style: style
38
+ style: isDragging ? Object.assign(Object.assign({}, style), {
39
+ zIndex: 1000
40
+ }) : style
38
41
  }, listeners, attributes), children);
39
42
  };
40
43
 
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { EliceWysiwygEditorProps } from '@elice/wysiwyg';
3
+ export declare const MarkdownEditor: ({ value, onChange, ...props }: EliceWysiwygEditorProps) => React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var React = require('react');
5
+ var reactUse = require('react-use');
6
+ var wysiwyg = require('@elice/wysiwyg');
7
+
8
+ const STATE_SYNC_DEBOUNCE_TIME = 50;
9
+ const MarkdownEditor = _a => {
10
+ var {
11
+ value,
12
+ onChange
13
+ } = _a,
14
+ props = tslib.__rest(_a, ["value", "onChange"]);
15
+ const [__value, __setValue] = React.useState(value);
16
+ reactUse.useDebounce(() => __setValue(value), STATE_SYNC_DEBOUNCE_TIME, [value]);
17
+ reactUse.useDebounce(() => {
18
+ if (__value !== value && typeof onChange === 'function') {
19
+ onChange(__value !== null && __value !== void 0 ? __value : '');
20
+ }
21
+ }, STATE_SYNC_DEBOUNCE_TIME, [__value]);
22
+ return React.createElement(wysiwyg.EliceWysiwygEditor, Object.assign({
23
+ value: value,
24
+ onChange: __setValue
25
+ }, props));
26
+ };
27
+
28
+ exports.MarkdownEditor = MarkdownEditor;
@@ -8,12 +8,13 @@ var designTokens = require('@elice/design-tokens');
8
8
  var intl = require('@elice/intl');
9
9
  var markdown = require('@elice/markdown');
10
10
  var types = require('@elice/types');
11
+ var wysiwyg = require('@elice/wysiwyg');
11
12
  var styled = require('styled-components');
12
13
  var MaterialQuizContext = require('./context/MaterialQuizContext.js');
13
14
 
14
15
  const StyledMarkdownSSR = styled(markdown.MarkdownSSR).withConfig({
15
16
  componentId: "sc-18kg5i5-0"
16
- })(["p{margin:0 !important;}"]);
17
+ })(["p{margin:0 !important;}", ""], wysiwyg.EliceWysiwygEditorTheme.resetMarkdownSSR);
17
18
  const StyledAccordion = styled(blocks.Accordion).withConfig({
18
19
  componentId: "sc-18kg5i5-1"
19
20
  })(["border-radius:8px;overflow:hidden;background-color:", " !important;border-radius:8px;overflow:hidden;& > *:first-child{background-color:", " !important;}& > *:last-child{background-color:", " !important;}"], designTokens.base.color.navy5, designTokens.base.color.navy7, designTokens.base.color.navy7);
@@ -7,6 +7,7 @@ var reactUse = require('react-use');
7
7
  var blocks = require('@elice/blocks');
8
8
  var icons = require('@elice/icons');
9
9
  var markdown = require('@elice/markdown');
10
+ var wysiwyg = require('@elice/wysiwyg');
10
11
  var material = require('@mui/material');
11
12
  var styled = require('styled-components');
12
13
  var QuestionBox = require('../shared/QuestionBox.js');
@@ -18,7 +19,7 @@ var MaterialQuizContext = require('./context/MaterialQuizContext.js');
18
19
  //
19
20
  const StyledMarkdownSSR = styled(markdown.MarkdownSSR).withConfig({
20
21
  componentId: "sc-1s7jbf9-0"
21
- })([".elicemd--theme-dark{pre{border:0;}table td,table th{border-bottom-color:rgba(255,255,255,0.16);}}"]);
22
+ })([".elicemd--theme-dark{pre{border:0;}table td,table th{border-bottom-color:rgba(255,255,255,0.16);}}", ""], wysiwyg.EliceWysiwygEditorTheme.resetMarkdownSSR);
22
23
  //
23
24
  //
24
25
  //
@@ -267,7 +267,7 @@ const MaterialQuizGroup = () => {
267
267
  handleAnswerReset
268
268
  }
269
269
  }, React.createElement(QuestionBox.default, {
270
- title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.title,
270
+ title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
271
271
  onNext: onNext,
272
272
  isNextActive: isNextActive,
273
273
  submitStatus: React.createElement(QuizSubmitStatusText.default, {
@@ -7,10 +7,10 @@ var reactHookForm = require('react-hook-form');
7
7
  var reactTransitionGroup = require('react-transition-group');
8
8
  var blocks = require('@elice/blocks');
9
9
  var intl = require('@elice/intl');
10
- var markdown = require('@elice/markdown');
11
10
  var types = require('@elice/types');
12
11
  var material = require('@mui/material');
13
12
  var flattenDeep = require('lodash-es/flattenDeep');
13
+ var index = require('../markdown-editor/index.js');
14
14
  var OptionGroup = require('./options/options-group/OptionGroup.js');
15
15
  var OptionSelectMultiple = require('./options/OptionSelectMultiple.js');
16
16
  var OptionSelectMultipleOrder = require('./options/OptionSelectMultipleOrder.js');
@@ -332,8 +332,7 @@ const MaterialQuizEditContent = () => {
332
332
  name: "questionDescription",
333
333
  render: ({
334
334
  field
335
- }) => React.createElement(markdown.MarkdownEditor, Object.assign({
336
- enableFooter: true,
335
+ }) => React.createElement(index.MarkdownEditor, Object.assign({
337
336
  placeholder: intl$1.formatMessage({
338
337
  id: 'content.description.placeholder'
339
338
  }),
@@ -561,8 +560,7 @@ const MaterialQuizEditContent = () => {
561
560
  role: "danger"
562
561
  }), React.createElement(blocks.Vspace, {
563
562
  height: 0.5
564
- })) : null, React.createElement(markdown.MarkdownEditor, Object.assign({
565
- enableFooter: true,
563
+ })) : null, React.createElement(index.MarkdownEditor, Object.assign({
566
564
  placeholder: intl$1.formatMessage({
567
565
  id: 'content.explanationInfo.textarea.errorMessage.required'
568
566
  }),
@@ -45,7 +45,7 @@ const StyledOrder = styled.div.withConfig({
45
45
  })(["width:1.5rem;height:1.5rem;display:flex;border-radius:4px;align-items:center;justify-content:center;color:", ";background-color:", ";flex:none;margin-left:0.5rem;"], designTokens.base.color.navy0, designTokens.base.color.navy4);
46
46
  const StyledQuizDraggbleOption = styled(EbDraggable.default).withConfig({
47
47
  componentId: "sc-19b0zkq-3"
48
- })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;z-index:980 !important;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], designTokens.base.color.navy4, designTokens.base.color.navy5, StyledQuizDraggbleOptionHandle, ({
48
+ })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], designTokens.base.color.navy4, designTokens.base.color.navy5, StyledQuizDraggbleOptionHandle, ({
49
49
  role
50
50
  }) => {
51
51
  switch (role) {
@@ -15,7 +15,8 @@ const EbDraggable = ({
15
15
  attributes,
16
16
  listeners,
17
17
  setNodeRef,
18
- transform
18
+ transform,
19
+ isDragging
19
20
  } = useDraggable({
20
21
  id,
21
22
  disabled
@@ -30,7 +31,9 @@ const EbDraggable = ({
30
31
  return React.createElement("div", Object.assign({
31
32
  ref: setNodeRef,
32
33
  className: className,
33
- style: style
34
+ style: isDragging ? Object.assign(Object.assign({}, style), {
35
+ zIndex: 1000
36
+ }) : style
34
37
  }, listeners, attributes), children);
35
38
  };
36
39
 
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { EliceWysiwygEditorProps } from '@elice/wysiwyg';
3
+ export declare const MarkdownEditor: ({ value, onChange, ...props }: EliceWysiwygEditorProps) => React.JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { __rest } from 'tslib';
2
+ import React from 'react';
3
+ import { useDebounce } from 'react-use';
4
+ import { EliceWysiwygEditor } from '@elice/wysiwyg';
5
+
6
+ const STATE_SYNC_DEBOUNCE_TIME = 50;
7
+ const MarkdownEditor = _a => {
8
+ var {
9
+ value,
10
+ onChange
11
+ } = _a,
12
+ props = __rest(_a, ["value", "onChange"]);
13
+ const [__value, __setValue] = React.useState(value);
14
+ useDebounce(() => __setValue(value), STATE_SYNC_DEBOUNCE_TIME, [value]);
15
+ useDebounce(() => {
16
+ if (__value !== value && typeof onChange === 'function') {
17
+ onChange(__value !== null && __value !== void 0 ? __value : '');
18
+ }
19
+ }, STATE_SYNC_DEBOUNCE_TIME, [__value]);
20
+ return React.createElement(EliceWysiwygEditor, Object.assign({
21
+ value: value,
22
+ onChange: __setValue
23
+ }, props));
24
+ };
25
+
26
+ export { MarkdownEditor };
@@ -4,12 +4,13 @@ import { base } from '@elice/design-tokens';
4
4
  import { useRawEliceIntl } from '@elice/intl';
5
5
  import { MarkdownSSR } from '@elice/markdown';
6
6
  import { enums } from '@elice/types';
7
+ import { EliceWysiwygEditorTheme } from '@elice/wysiwyg';
7
8
  import styled from 'styled-components';
8
9
  import { useMaterialQuizState } from './context/MaterialQuizContext.js';
9
10
 
10
11
  const StyledMarkdownSSR = styled(MarkdownSSR).withConfig({
11
12
  componentId: "sc-18kg5i5-0"
12
- })(["p{margin:0 !important;}"]);
13
+ })(["p{margin:0 !important;}", ""], EliceWysiwygEditorTheme.resetMarkdownSSR);
13
14
  const StyledAccordion = styled(Accordion).withConfig({
14
15
  componentId: "sc-18kg5i5-1"
15
16
  })(["border-radius:8px;overflow:hidden;background-color:", " !important;border-radius:8px;overflow:hidden;& > *:first-child{background-color:", " !important;}& > *:last-child{background-color:", " !important;}"], base.color.navy5, base.color.navy7, base.color.navy7);
@@ -3,6 +3,7 @@ import { useMeasure } from 'react-use';
3
3
  import { Vspace, Shimmer, IconButton } from '@elice/blocks';
4
4
  import { eilMathsignMultiplyBasic } from '@elice/icons';
5
5
  import { MarkdownSSR } from '@elice/markdown';
6
+ import { EliceWysiwygEditorTheme } from '@elice/wysiwyg';
6
7
  import { styled as styled$1, Modal, Box } from '@mui/material';
7
8
  import styled from 'styled-components';
8
9
  import QuestionBox from '../shared/QuestionBox.js';
@@ -14,7 +15,7 @@ import { useMaterialQuizState } from './context/MaterialQuizContext.js';
14
15
  //
15
16
  const StyledMarkdownSSR = styled(MarkdownSSR).withConfig({
16
17
  componentId: "sc-1s7jbf9-0"
17
- })([".elicemd--theme-dark{pre{border:0;}table td,table th{border-bottom-color:rgba(255,255,255,0.16);}}"]);
18
+ })([".elicemd--theme-dark{pre{border:0;}table td,table th{border-bottom-color:rgba(255,255,255,0.16);}}", ""], EliceWysiwygEditorTheme.resetMarkdownSSR);
18
19
  //
19
20
  //
20
21
  //
@@ -263,7 +263,7 @@ const MaterialQuizGroup = () => {
263
263
  handleAnswerReset
264
264
  }
265
265
  }, React.createElement(QuestionBox, {
266
- title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.title,
266
+ title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
267
267
  onNext: onNext,
268
268
  isNextActive: isNextActive,
269
269
  submitStatus: React.createElement(QuizSubmitStatusText, {
@@ -3,10 +3,10 @@ import { useFormContext, Controller } from 'react-hook-form';
3
3
  import { Transition } from 'react-transition-group';
4
4
  import { FormInputVerticalLayout, Label, Input, StatusText, Text, Checkbox, Vspace, Flex } from '@elice/blocks';
5
5
  import { useRawEliceIntl } from '@elice/intl';
6
- import { MarkdownEditor } from '@elice/markdown';
7
6
  import { enums } from '@elice/types';
8
7
  import { Tooltip, Stack, TextField, MenuItem, FormControlLabel, Switch, Alert, AlertTitle, Box } from '@mui/material';
9
8
  import flattenDeep from 'lodash-es/flattenDeep';
9
+ import { MarkdownEditor } from '../markdown-editor/index.js';
10
10
  import OptionGroup from './options/options-group/OptionGroup.js';
11
11
  import OptionSelectMultiple from './options/OptionSelectMultiple.js';
12
12
  import OptionSelectMultipleOrder from './options/OptionSelectMultipleOrder.js';
@@ -329,7 +329,6 @@ const MaterialQuizEditContent = () => {
329
329
  render: ({
330
330
  field
331
331
  }) => React.createElement(MarkdownEditor, Object.assign({
332
- enableFooter: true,
333
332
  placeholder: intl.formatMessage({
334
333
  id: 'content.description.placeholder'
335
334
  }),
@@ -558,7 +557,6 @@ const MaterialQuizEditContent = () => {
558
557
  }), React.createElement(Vspace, {
559
558
  height: 0.5
560
559
  })) : null, React.createElement(MarkdownEditor, Object.assign({
561
- enableFooter: true,
562
560
  placeholder: intl.formatMessage({
563
561
  id: 'content.explanationInfo.textarea.errorMessage.required'
564
562
  }),
@@ -41,7 +41,7 @@ const StyledOrder = styled.div.withConfig({
41
41
  })(["width:1.5rem;height:1.5rem;display:flex;border-radius:4px;align-items:center;justify-content:center;color:", ";background-color:", ";flex:none;margin-left:0.5rem;"], base.color.navy0, base.color.navy4);
42
42
  const StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
43
43
  componentId: "sc-19b0zkq-3"
44
- })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;z-index:980 !important;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], base.color.navy4, base.color.navy5, StyledQuizDraggbleOptionHandle, ({
44
+ })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], base.color.navy4, base.color.navy5, StyledQuizDraggbleOptionHandle, ({
45
45
  role
46
46
  }) => {
47
47
  switch (role) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-quiz",
3
- "version": "1.240715.0-touch.3",
3
+ "version": "1.240715.0-touch.5",
4
4
  "description": "User view and editing components of Elice material quiz",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -36,6 +36,7 @@
36
36
  "@elice/material-shared-utils": "*",
37
37
  "@elice/mui-system": "^5",
38
38
  "@elice/types": "^1",
39
+ "@elice/wysiwyg": "^1",
39
40
  "@emotion/react": "^11.10.0",
40
41
  "@emotion/styled": "^11.10.0",
41
42
  "@fortawesome/pro-regular-svg-icons": "^6",
@@ -67,10 +68,11 @@
67
68
  "@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
68
69
  "@elice/intl": "0.240425.0-rc.2",
69
70
  "@elice/markdown": "^1.240124.0",
70
- "@elice/material-shared-types": "1.240715.0-touch.3",
71
- "@elice/material-shared-utils": "1.240715.0-touch.3",
71
+ "@elice/material-shared-types": "1.240715.0-touch.5",
72
+ "@elice/material-shared-utils": "1.240715.0-touch.5",
72
73
  "@elice/mui-system": "^5.240108.1",
73
74
  "@elice/types": "^1.240619.0",
75
+ "@elice/wysiwyg": "1.240716.1",
74
76
  "@emotion/react": "^11.10.0",
75
77
  "@emotion/styled": "^11.10.0",
76
78
  "@fortawesome/pro-regular-svg-icons": "^6.4.2",
@@ -90,5 +92,5 @@
90
92
  "react-use": "^17.2.4",
91
93
  "styled-components": "^5.3.0"
92
94
  },
93
- "gitHead": "974b8b856bd216d827c9cb55cb2419247c2788f6"
95
+ "gitHead": "3b07b7d94b53db047b1866600eb51b52d259ddc7"
94
96
  }