testomatio-editor-blocks 0.4.0 → 0.4.6
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.
- package/package/editor/blocks/snippet.js +32 -138
- package/package/editor/blocks/step.d.ts +6 -0
- package/package/editor/blocks/step.js +119 -52
- package/package/editor/blocks/stepField.d.ts +4 -1
- package/package/editor/blocks/stepField.js +651 -39
- package/package/editor/blocks/stepHorizontalView.d.ts +14 -0
- package/package/editor/blocks/stepHorizontalView.js +7 -0
- package/package/editor/customMarkdownConverter.d.ts +1 -0
- package/package/editor/customMarkdownConverter.js +153 -41
- package/package/editor/customSchema.d.ts +6 -0
- package/package/styles.css +569 -122
- package/package.json +5 -1
- package/src/editor/blocks/snippet.tsx +92 -212
- package/src/editor/blocks/step.tsx +268 -123
- package/src/editor/blocks/stepField.tsx +907 -95
- package/src/editor/blocks/stepHorizontalView.tsx +90 -0
- package/src/editor/customMarkdownConverter.test.ts +594 -29
- package/src/editor/customMarkdownConverter.ts +183 -42
- package/src/editor/markdownToBlocks.test.ts +2 -0
- package/src/editor/styles.css +565 -133
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { StepField } from "./stepField";
|
|
3
|
+
import type { StepSuggestion } from "../stepAutocomplete";
|
|
4
|
+
|
|
5
|
+
const STEP_PLACEHOLDER = "Enter step name";
|
|
6
|
+
const EXPECTED_RESULT_PLACEHOLDER = "Enter expected result";
|
|
7
|
+
|
|
8
|
+
type StepHorizontalViewProps = {
|
|
9
|
+
blockId: string;
|
|
10
|
+
stepNumber: number;
|
|
11
|
+
stepValue: string;
|
|
12
|
+
expectedResult: string;
|
|
13
|
+
onStepChange: (next: string) => void;
|
|
14
|
+
onExpectedChange: (next: string) => void;
|
|
15
|
+
onInsertNextStep: () => void;
|
|
16
|
+
onFieldFocus: () => void;
|
|
17
|
+
viewToggle?: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function StepHorizontalView({
|
|
21
|
+
blockId,
|
|
22
|
+
stepNumber,
|
|
23
|
+
stepValue,
|
|
24
|
+
expectedResult,
|
|
25
|
+
onStepChange,
|
|
26
|
+
onExpectedChange,
|
|
27
|
+
onInsertNextStep,
|
|
28
|
+
onFieldFocus,
|
|
29
|
+
viewToggle,
|
|
30
|
+
}: StepHorizontalViewProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div className="bn-teststep bn-teststep--horizontal" data-block-id={blockId}>
|
|
33
|
+
<div className="bn-teststep__timeline">
|
|
34
|
+
<span className="bn-teststep__number">{stepNumber}</span>
|
|
35
|
+
<div className="bn-teststep__line" />
|
|
36
|
+
</div>
|
|
37
|
+
<div className="bn-teststep__content">
|
|
38
|
+
<div className="bn-teststep__horizontal-fields">
|
|
39
|
+
<div className="bn-teststep__horizontal-col">
|
|
40
|
+
<div className="bn-teststep__header">
|
|
41
|
+
<span className="bn-teststep__title">Step</span>
|
|
42
|
+
</div>
|
|
43
|
+
<StepField
|
|
44
|
+
label="Step"
|
|
45
|
+
showLabel={false}
|
|
46
|
+
value={stepValue}
|
|
47
|
+
onChange={onStepChange}
|
|
48
|
+
placeholder={STEP_PLACEHOLDER}
|
|
49
|
+
enableAutocomplete
|
|
50
|
+
fieldName="title"
|
|
51
|
+
suggestionFilter={(suggestion) => (suggestion as StepSuggestion).isSnippet !== true}
|
|
52
|
+
onFieldFocus={onFieldFocus}
|
|
53
|
+
multiline
|
|
54
|
+
enableImageUpload
|
|
55
|
+
showFormattingButtons
|
|
56
|
+
showImageButton
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
<div className="bn-teststep__horizontal-col">
|
|
60
|
+
<div className="bn-teststep__header">
|
|
61
|
+
<span className="bn-teststep__title">Expected result</span>
|
|
62
|
+
{viewToggle}
|
|
63
|
+
</div>
|
|
64
|
+
<StepField
|
|
65
|
+
label="Expected result"
|
|
66
|
+
showLabel={false}
|
|
67
|
+
value={expectedResult}
|
|
68
|
+
onChange={onExpectedChange}
|
|
69
|
+
placeholder={EXPECTED_RESULT_PLACEHOLDER}
|
|
70
|
+
multiline
|
|
71
|
+
enableAutocomplete
|
|
72
|
+
enableImageUpload
|
|
73
|
+
showFormattingButtons
|
|
74
|
+
showImageButton
|
|
75
|
+
onFieldFocus={onFieldFocus}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div className="bn-step-actions">
|
|
80
|
+
<button type="button" className="bn-step-action-btn" onClick={onInsertNextStep}>
|
|
81
|
+
<svg className="bn-step-action-btn__icon" width="16" height="16" viewBox="0 0 13.334 13.334" fill="none" aria-hidden="true">
|
|
82
|
+
<path d="M6.667 0a6.667 6.667 0 1 1 0 13.334A6.667 6.667 0 0 1 6.667 0Zm0 1.334a5.333 5.333 0 1 0 0 10.666 5.333 5.333 0 0 0 0-10.666ZM7.334 3.334V6H10v1.334H7.334V10H6V7.334H3.334V6H6V3.334h1.334Z" fill="currentColor"/>
|
|
83
|
+
</svg>
|
|
84
|
+
Add new step
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|