@elice/material-quiz 1.240716.0 → 1.240718.0-trasncript.0

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.
@@ -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,9 +8,9 @@ var reactTransitionGroup = require('react-transition-group');
8
8
  var blocks = require('@elice/blocks');
9
9
  var intl = require('@elice/intl');
10
10
  var types = require('@elice/types');
11
- var wysiwyg = require('@elice/wysiwyg');
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,7 +332,7 @@ const MaterialQuizEditContent = () => {
332
332
  name: "questionDescription",
333
333
  render: ({
334
334
  field
335
- }) => React.createElement(wysiwyg.EliceWysiwygEditor, Object.assign({
335
+ }) => React.createElement(index.MarkdownEditor, Object.assign({
336
336
  placeholder: intl$1.formatMessage({
337
337
  id: 'content.description.placeholder'
338
338
  }),
@@ -560,7 +560,7 @@ const MaterialQuizEditContent = () => {
560
560
  role: "danger"
561
561
  }), React.createElement(blocks.Vspace, {
562
562
  height: 0.5
563
- })) : null, React.createElement(wysiwyg.EliceWysiwygEditor, Object.assign({
563
+ })) : null, React.createElement(index.MarkdownEditor, Object.assign({
564
564
  placeholder: intl$1.formatMessage({
565
565
  id: 'content.explanationInfo.textarea.errorMessage.required'
566
566
  }),
@@ -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,9 +4,9 @@ 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
6
  import { enums } from '@elice/types';
7
- import { EliceWysiwygEditor } from '@elice/wysiwyg';
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';
@@ -328,7 +328,7 @@ const MaterialQuizEditContent = () => {
328
328
  name: "questionDescription",
329
329
  render: ({
330
330
  field
331
- }) => React.createElement(EliceWysiwygEditor, Object.assign({
331
+ }) => React.createElement(MarkdownEditor, Object.assign({
332
332
  placeholder: intl.formatMessage({
333
333
  id: 'content.description.placeholder'
334
334
  }),
@@ -556,7 +556,7 @@ const MaterialQuizEditContent = () => {
556
556
  role: "danger"
557
557
  }), React.createElement(Vspace, {
558
558
  height: 0.5
559
- })) : null, React.createElement(EliceWysiwygEditor, Object.assign({
559
+ })) : null, React.createElement(MarkdownEditor, Object.assign({
560
560
  placeholder: intl.formatMessage({
561
561
  id: 'content.explanationInfo.textarea.errorMessage.required'
562
562
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-quiz",
3
- "version": "1.240716.0",
3
+ "version": "1.240718.0-trasncript.0",
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",
@@ -66,8 +66,8 @@
66
66
  "@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
67
67
  "@elice/intl": "0.240425.0-rc.2",
68
68
  "@elice/markdown": "^1.240124.0",
69
- "@elice/material-shared-types": "1.240716.0",
70
- "@elice/material-shared-utils": "1.240716.0",
69
+ "@elice/material-shared-types": "1.240718.0-trasncript.0",
70
+ "@elice/material-shared-utils": "1.240718.0-trasncript.0",
71
71
  "@elice/mui-system": "^5.240108.1",
72
72
  "@elice/types": "^1.240619.0",
73
73
  "@elice/wysiwyg": "1.240716.1",
@@ -90,5 +90,5 @@
90
90
  "react-use": "^17.2.4",
91
91
  "styled-components": "^5.3.0"
92
92
  },
93
- "gitHead": "824db30f6b6377305ae84358cdb33224af59d1f1"
93
+ "gitHead": "832dc77a5e38ff02e0bfec8905a3a9706b9b9593"
94
94
  }