@pie-lib/editable-html-tip-tap 2.1.2-next.3 → 2.1.2-next.30
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/dist/components/CharacterPicker.d.ts +31 -0
- package/dist/components/CharacterPicker.js +131 -0
- package/dist/components/EditableHtml.d.ts +11 -0
- package/dist/components/EditableHtml.js +291 -0
- package/dist/components/MenuBar.d.ts +11 -0
- package/dist/components/MenuBar.js +462 -0
- package/dist/components/TiptapContainer.d.ts +11 -0
- package/dist/components/TiptapContainer.js +154 -0
- package/dist/components/characters/characterUtils.d.ts +35 -0
- package/dist/components/characters/characterUtils.js +465 -0
- package/dist/components/characters/custom-popper.d.ts +14 -0
- package/dist/components/characters/custom-popper.js +32 -0
- package/dist/components/common/done-button.d.ts +30 -0
- package/dist/components/common/done-button.js +26 -0
- package/dist/components/common/toolbar-buttons.d.ts +38 -0
- package/dist/components/common/toolbar-buttons.js +91 -0
- package/dist/components/icons/CssIcon.d.ts +11 -0
- package/dist/components/icons/CssIcon.js +14 -0
- package/dist/components/icons/RespArea.d.ts +26 -0
- package/dist/components/icons/RespArea.js +42 -0
- package/dist/components/icons/TableIcons.d.ts +14 -0
- package/dist/components/icons/TableIcons.js +32 -0
- package/dist/components/icons/TextAlign.d.ts +18 -0
- package/dist/components/icons/TextAlign.js +134 -0
- package/dist/components/image/AltDialog.d.ts +22 -0
- package/dist/components/image/AltDialog.js +61 -0
- package/dist/components/image/ImageToolbar.d.ts +24 -0
- package/dist/components/image/ImageToolbar.js +80 -0
- package/dist/components/image/InsertImageHandler.d.ts +32 -0
- package/dist/components/image/InsertImageHandler.js +53 -0
- package/dist/components/media/MediaDialog.d.ts +43 -0
- package/dist/components/media/MediaDialog.js +389 -0
- package/dist/components/media/MediaToolbar.d.ts +19 -0
- package/dist/components/media/MediaToolbar.js +41 -0
- package/dist/components/media/MediaWrapper.d.ts +19 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts +23 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.js +58 -0
- package/dist/components/respArea/DragInTheBlank/choice.d.ts +56 -0
- package/dist/components/respArea/DragInTheBlank/choice.js +156 -0
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts +20 -0
- package/dist/components/respArea/ExplicitConstructedResponse.js +83 -0
- package/dist/components/respArea/InlineDropdown.d.ts +18 -0
- package/dist/components/respArea/InlineDropdown.js +119 -0
- package/dist/components/respArea/MathTemplated.d.ts +19 -0
- package/dist/components/respArea/MathTemplated.js +97 -0
- package/dist/components/respArea/ToolbarIcon.d.ts +14 -0
- package/dist/components/respArea/ToolbarIcon.js +17 -0
- package/dist/components/respArea/inlineDropdownUtils.d.ts +15 -0
- package/dist/components/respArea/inlineDropdownUtils.js +15 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +4 -0
- package/dist/extensions/css.d.ts +11 -0
- package/dist/extensions/css.js +115 -0
- package/dist/extensions/custom-toolbar-wrapper.d.ts +11 -0
- package/dist/extensions/custom-toolbar-wrapper.js +61 -0
- package/dist/extensions/div-node.d.ts +10 -0
- package/dist/extensions/div-node.js +42 -0
- package/dist/extensions/ensure-empty-root-div.d.ts +14 -0
- package/dist/extensions/ensure-empty-root-div.js +24 -0
- package/dist/extensions/ensure-list-item-content-is-div.d.ts +15 -0
- package/dist/extensions/ensure-list-item-content-is-div.js +31 -0
- package/dist/extensions/extended-list-item.d.ts +13 -0
- package/dist/extensions/extended-list-item.js +5 -0
- package/dist/extensions/extended-table-cell.d.ts +10 -0
- package/dist/extensions/extended-table-cell.js +6 -0
- package/dist/extensions/extended-table.d.ts +17 -0
- package/dist/extensions/extended-table.js +34 -0
- package/dist/extensions/heading-paragraph.d.ts +17 -0
- package/dist/extensions/heading-paragraph.js +30 -0
- package/dist/extensions/image-component.d.ts +22 -0
- package/dist/extensions/image-component.js +220 -0
- package/dist/extensions/image.d.ts +10 -0
- package/dist/extensions/image.js +68 -0
- package/dist/extensions/index.d.ts +16 -0
- package/dist/extensions/index.js +64 -0
- package/dist/extensions/math.d.ts +15 -0
- package/dist/extensions/math.js +158 -0
- package/dist/extensions/media.d.ts +19 -0
- package/dist/extensions/media.js +149 -0
- package/dist/extensions/responseArea.d.ts +27 -0
- package/dist/extensions/responseArea.js +259 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +7 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/styles/editorContainerStyles.d.ts +134 -0
- package/dist/theme.d.ts +9 -0
- package/dist/utils/helper.d.ts +9 -0
- package/dist/utils/helper.js +27 -0
- package/dist/utils/size.d.ts +9 -0
- package/dist/utils/size.js +14 -0
- package/package.json +56 -40
- package/CHANGELOG.json +0 -32
- package/CHANGELOG.md +0 -2532
- package/LICENSE.md +0 -5
- package/lib/components/CharacterPicker.js +0 -195
- package/lib/components/CharacterPicker.js.map +0 -1
- package/lib/components/EditableHtml.js +0 -375
- package/lib/components/EditableHtml.js.map +0 -1
- package/lib/components/MenuBar.js +0 -693
- package/lib/components/MenuBar.js.map +0 -1
- package/lib/components/TiptapContainer.js +0 -234
- package/lib/components/TiptapContainer.js.map +0 -1
- package/lib/components/characters/characterUtils.js +0 -378
- package/lib/components/characters/characterUtils.js.map +0 -1
- package/lib/components/characters/custom-popper.js +0 -44
- package/lib/components/characters/custom-popper.js.map +0 -1
- package/lib/components/common/done-button.js +0 -34
- package/lib/components/common/done-button.js.map +0 -1
- package/lib/components/common/toolbar-buttons.js +0 -144
- package/lib/components/common/toolbar-buttons.js.map +0 -1
- package/lib/components/icons/CssIcon.js +0 -25
- package/lib/components/icons/CssIcon.js.map +0 -1
- package/lib/components/icons/RespArea.js +0 -72
- package/lib/components/icons/RespArea.js.map +0 -1
- package/lib/components/icons/TableIcons.js +0 -53
- package/lib/components/icons/TableIcons.js.map +0 -1
- package/lib/components/icons/TextAlign.js +0 -157
- package/lib/components/icons/TextAlign.js.map +0 -1
- package/lib/components/image/AltDialog.js +0 -98
- package/lib/components/image/AltDialog.js.map +0 -1
- package/lib/components/image/ImageToolbar.js +0 -137
- package/lib/components/image/ImageToolbar.js.map +0 -1
- package/lib/components/image/InsertImageHandler.js +0 -135
- package/lib/components/image/InsertImageHandler.js.map +0 -1
- package/lib/components/media/MediaDialog.js +0 -594
- package/lib/components/media/MediaDialog.js.map +0 -1
- package/lib/components/media/MediaToolbar.js +0 -74
- package/lib/components/media/MediaToolbar.js.map +0 -1
- package/lib/components/media/MediaWrapper.js +0 -67
- package/lib/components/media/MediaWrapper.js.map +0 -1
- package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js +0 -84
- package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js.map +0 -1
- package/lib/components/respArea/DragInTheBlank/choice.js +0 -250
- package/lib/components/respArea/DragInTheBlank/choice.js.map +0 -1
- package/lib/components/respArea/ExplicitConstructedResponse.js +0 -136
- package/lib/components/respArea/ExplicitConstructedResponse.js.map +0 -1
- package/lib/components/respArea/InlineDropdown.js +0 -165
- package/lib/components/respArea/InlineDropdown.js.map +0 -1
- package/lib/components/respArea/MathTemplated.js +0 -130
- package/lib/components/respArea/MathTemplated.js.map +0 -1
- package/lib/components/respArea/ToolbarIcon.js +0 -81
- package/lib/components/respArea/ToolbarIcon.js.map +0 -1
- package/lib/constants.js +0 -11
- package/lib/constants.js.map +0 -1
- package/lib/extensions/css.js +0 -217
- package/lib/extensions/css.js.map +0 -1
- package/lib/extensions/custom-toolbar-wrapper.js +0 -92
- package/lib/extensions/custom-toolbar-wrapper.js.map +0 -1
- package/lib/extensions/div-node.js +0 -83
- package/lib/extensions/div-node.js.map +0 -1
- package/lib/extensions/ensure-empty-root-div.js +0 -48
- package/lib/extensions/ensure-empty-root-div.js.map +0 -1
- package/lib/extensions/ensure-list-item-content-is-div.js +0 -64
- package/lib/extensions/ensure-list-item-content-is-div.js.map +0 -1
- package/lib/extensions/extended-list-item.js +0 -15
- package/lib/extensions/extended-list-item.js.map +0 -1
- package/lib/extensions/extended-table-cell.js +0 -22
- package/lib/extensions/extended-table-cell.js.map +0 -1
- package/lib/extensions/extended-table.js +0 -75
- package/lib/extensions/extended-table.js.map +0 -1
- package/lib/extensions/heading-paragraph.js +0 -61
- package/lib/extensions/heading-paragraph.js.map +0 -1
- package/lib/extensions/image-component.js +0 -348
- package/lib/extensions/image-component.js.map +0 -1
- package/lib/extensions/image.js +0 -134
- package/lib/extensions/image.js.map +0 -1
- package/lib/extensions/index.js +0 -46
- package/lib/extensions/index.js.map +0 -1
- package/lib/extensions/math.js +0 -343
- package/lib/extensions/math.js.map +0 -1
- package/lib/extensions/media.js +0 -243
- package/lib/extensions/media.js.map +0 -1
- package/lib/extensions/responseArea.js +0 -446
- package/lib/extensions/responseArea.js.map +0 -1
- package/lib/index.js +0 -30
- package/lib/index.js.map +0 -1
- package/lib/styles/editorContainerStyles.js +0 -137
- package/lib/styles/editorContainerStyles.js.map +0 -1
- package/lib/theme.js +0 -8
- package/lib/theme.js.map +0 -1
- package/lib/utils/helper.js +0 -73
- package/lib/utils/helper.js.map +0 -1
- package/lib/utils/size.js +0 -26
- package/lib/utils/size.js.map +0 -1
- package/src/__tests__/EditableHtml.test.jsx +0 -474
- package/src/__tests__/constants.test.js +0 -19
- package/src/__tests__/div-to-paragraph-conversion.test.jsx +0 -125
- package/src/__tests__/extensions.test.js +0 -208
- package/src/__tests__/index.test.jsx +0 -154
- package/src/__tests__/size-utils.test.js +0 -64
- package/src/__tests__/theme.test.js +0 -17
- package/src/components/CharacterPicker.jsx +0 -200
- package/src/components/EditableHtml.jsx +0 -438
- package/src/components/MenuBar.jsx +0 -549
- package/src/components/TiptapContainer.jsx +0 -219
- package/src/components/__tests__/AltDialog.test.jsx +0 -147
- package/src/components/__tests__/CharacterPicker.test.jsx +0 -219
- package/src/components/__tests__/CssIcon.test.jsx +0 -46
- package/src/components/__tests__/DragInTheBlank.test.jsx +0 -255
- package/src/components/__tests__/ExplicitConstructedResponse.test.jsx +0 -204
- package/src/components/__tests__/ImageToolbar.test.jsx +0 -128
- package/src/components/__tests__/InlineDropdown.test.jsx +0 -380
- package/src/components/__tests__/InsertImageHandler.test.js +0 -161
- package/src/components/__tests__/MediaDialog.test.jsx +0 -293
- package/src/components/__tests__/MediaToolbar.test.jsx +0 -74
- package/src/components/__tests__/MediaWrapper.test.jsx +0 -81
- package/src/components/__tests__/MenuBar.test.jsx +0 -249
- package/src/components/__tests__/RespArea.test.jsx +0 -122
- package/src/components/__tests__/TableIcons.test.jsx +0 -149
- package/src/components/__tests__/TextAlign.test.jsx +0 -167
- package/src/components/__tests__/TiptapContainer.test.jsx +0 -138
- package/src/components/__tests__/characterUtils.test.js +0 -166
- package/src/components/__tests__/choice.test.jsx +0 -171
- package/src/components/__tests__/custom-popper.test.jsx +0 -82
- package/src/components/__tests__/done-button.test.jsx +0 -54
- package/src/components/__tests__/toolbar-buttons.test.jsx +0 -234
- package/src/components/characters/characterUtils.js +0 -447
- package/src/components/characters/custom-popper.js +0 -38
- package/src/components/common/done-button.jsx +0 -27
- package/src/components/common/toolbar-buttons.jsx +0 -122
- package/src/components/icons/CssIcon.jsx +0 -15
- package/src/components/icons/RespArea.jsx +0 -71
- package/src/components/icons/TableIcons.jsx +0 -52
- package/src/components/icons/TextAlign.jsx +0 -114
- package/src/components/image/AltDialog.jsx +0 -82
- package/src/components/image/ImageToolbar.jsx +0 -99
- package/src/components/image/InsertImageHandler.js +0 -107
- package/src/components/media/MediaDialog.jsx +0 -596
- package/src/components/media/MediaToolbar.jsx +0 -49
- package/src/components/media/MediaWrapper.jsx +0 -39
- package/src/components/respArea/DragInTheBlank/DragInTheBlank.jsx +0 -76
- package/src/components/respArea/DragInTheBlank/choice.jsx +0 -256
- package/src/components/respArea/ExplicitConstructedResponse.jsx +0 -135
- package/src/components/respArea/InlineDropdown.jsx +0 -167
- package/src/components/respArea/MathTemplated.jsx +0 -124
- package/src/components/respArea/ToolbarIcon.jsx +0 -66
- package/src/components/respArea/__tests__/MathTemplated.test.jsx +0 -210
- package/src/constants.js +0 -5
- package/src/extensions/__tests__/css.test.js +0 -196
- package/src/extensions/__tests__/custom-toolbar-wrapper.test.jsx +0 -180
- package/src/extensions/__tests__/divNode.test.js +0 -87
- package/src/extensions/__tests__/ensure-empty-root-div.test.js +0 -57
- package/src/extensions/__tests__/ensure-list-item-content-is-div.test.js +0 -44
- package/src/extensions/__tests__/extended-list-item.test.js +0 -13
- package/src/extensions/__tests__/extended-table-cell.test.js +0 -22
- package/src/extensions/__tests__/extended-table.test.js +0 -183
- package/src/extensions/__tests__/image-component.test.jsx +0 -345
- package/src/extensions/__tests__/image.test.js +0 -237
- package/src/extensions/__tests__/math.test.js +0 -459
- package/src/extensions/__tests__/media-node-view.test.jsx +0 -298
- package/src/extensions/__tests__/media.test.js +0 -271
- package/src/extensions/__tests__/responseArea.test.js +0 -601
- package/src/extensions/css.js +0 -220
- package/src/extensions/custom-toolbar-wrapper.jsx +0 -78
- package/src/extensions/div-node.js +0 -86
- package/src/extensions/ensure-empty-root-div.js +0 -47
- package/src/extensions/ensure-list-item-content-is-div.js +0 -62
- package/src/extensions/extended-list-item.js +0 -10
- package/src/extensions/extended-table-cell.js +0 -19
- package/src/extensions/extended-table.js +0 -60
- package/src/extensions/heading-paragraph.js +0 -53
- package/src/extensions/image-component.jsx +0 -338
- package/src/extensions/image.js +0 -109
- package/src/extensions/index.js +0 -81
- package/src/extensions/math.js +0 -327
- package/src/extensions/media.js +0 -188
- package/src/extensions/responseArea.js +0 -401
- package/src/index.jsx +0 -5
- package/src/styles/editorContainerStyles.js +0 -145
- package/src/theme.js +0 -1
- package/src/utils/__tests__/helper.test.js +0 -126
- package/src/utils/helper.js +0 -69
- package/src/utils/size.js +0 -32
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NodeSelection, Plugin, PluginKey, TextSelection } from 'prosemirror-state';
|
|
3
|
-
import { Extension } from '@tiptap/core';
|
|
4
|
-
import { Node, ReactNodeViewRenderer } from '@tiptap/react';
|
|
5
|
-
import ExplicitConstructedResponse from '../components/respArea/ExplicitConstructedResponse';
|
|
6
|
-
import DragInTheBlank from '../components/respArea/DragInTheBlank/DragInTheBlank';
|
|
7
|
-
import InlineDropdown from '../components/respArea/InlineDropdown';
|
|
8
|
-
import MathTemplated from '../components/respArea/MathTemplated';
|
|
9
|
-
|
|
10
|
-
const lastIndexMap = {};
|
|
11
|
-
|
|
12
|
-
const normalizeType = (type) => String(type || '').replace(/-/g, '_');
|
|
13
|
-
|
|
14
|
-
const getAttrIndex = (node) => (node && node.attrs && node.attrs.index != null ? String(node.attrs.index) : null);
|
|
15
|
-
|
|
16
|
-
const collectNodesOfType = (doc, typeName) => {
|
|
17
|
-
const results = [];
|
|
18
|
-
|
|
19
|
-
doc.descendants((node, pos) => {
|
|
20
|
-
if (node.type && node.type.name === typeName) {
|
|
21
|
-
const index = getAttrIndex(node);
|
|
22
|
-
if (index != null) results.push({ index, pos, node });
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return results;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const countNodesOfType = (doc, typeName) => {
|
|
31
|
-
let count = 0;
|
|
32
|
-
doc.descendants((node) => {
|
|
33
|
-
if (node.type && node.type.name === typeName) count += 1;
|
|
34
|
-
return true;
|
|
35
|
-
});
|
|
36
|
-
return count;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const getDefaultNode = ({ schema, typeName, index }) => {
|
|
40
|
-
const nodeType = schema.nodes[typeName];
|
|
41
|
-
if (!nodeType) return null;
|
|
42
|
-
|
|
43
|
-
// mirror your Slate "getDefaultElement(opts, newIndex)"
|
|
44
|
-
// customize attrs as needed:
|
|
45
|
-
return nodeType.create({
|
|
46
|
-
index: String(index),
|
|
47
|
-
id: String(index),
|
|
48
|
-
value: '',
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// Find a good cursor position *after* an inserted node.
|
|
53
|
-
const selectionAfterPos = (doc, pos) => {
|
|
54
|
-
const $pos = doc.resolve(Math.min(pos, doc.content.size));
|
|
55
|
-
return TextSelection.near($pos, 1);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const ResponseAreaExtension = Extension.create({
|
|
59
|
-
name: 'responseArea',
|
|
60
|
-
|
|
61
|
-
addOptions() {
|
|
62
|
-
return {
|
|
63
|
-
maxResponseAreas: null,
|
|
64
|
-
error: null,
|
|
65
|
-
options: null,
|
|
66
|
-
respAreaToolbar: null,
|
|
67
|
-
onHandleAreaChange: null,
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
addProseMirrorPlugins() {
|
|
72
|
-
if (!this.options.type) {
|
|
73
|
-
return [];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const typeName = normalizeType(this.options.type);
|
|
77
|
-
const key = new PluginKey(`response-area-watcher:${typeName}`);
|
|
78
|
-
|
|
79
|
-
return [
|
|
80
|
-
new Plugin({
|
|
81
|
-
key,
|
|
82
|
-
|
|
83
|
-
view: (view) => {
|
|
84
|
-
// Lazy init lastIndexMap[typeName]
|
|
85
|
-
if (lastIndexMap[typeName] === undefined) {
|
|
86
|
-
lastIndexMap[typeName] = 0;
|
|
87
|
-
|
|
88
|
-
view.state.doc.descendants((node) => {
|
|
89
|
-
if (node.type && node.type.name === typeName) {
|
|
90
|
-
const idx = getAttrIndex(node);
|
|
91
|
-
if (idx != null) {
|
|
92
|
-
const n = parseInt(idx, 10);
|
|
93
|
-
if (!Number.isNaN(n) && n > lastIndexMap[typeName]) {
|
|
94
|
-
lastIndexMap[typeName] = n;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return true;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
update: (view, prevState) => {
|
|
104
|
-
const state = view.state;
|
|
105
|
-
if (prevState.doc.eq(state.doc)) return;
|
|
106
|
-
|
|
107
|
-
const currentList = collectNodesOfType(state.doc, typeName);
|
|
108
|
-
const oldList = collectNodesOfType(prevState.doc, typeName);
|
|
109
|
-
|
|
110
|
-
if (this.options.toolbar) {
|
|
111
|
-
this.options.toolbar.disabled = currentList.length >= this.options.maxResponseAreas;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Removed elements (same logic as Slate)
|
|
115
|
-
if (oldList.length > currentList.length) {
|
|
116
|
-
const currentIndexSet = new Set(currentList.map((x) => x.index));
|
|
117
|
-
|
|
118
|
-
const removed = oldList.filter((x) => !currentIndexSet.has(x.index));
|
|
119
|
-
|
|
120
|
-
if (removed.length && typeof this.options.onHandleAreaChange === 'function') {
|
|
121
|
-
this.options.onHandleAreaChange(removed);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
},
|
|
127
|
-
}),
|
|
128
|
-
];
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
addCommands() {
|
|
132
|
-
return {
|
|
133
|
-
insertResponseArea:
|
|
134
|
-
(type) =>
|
|
135
|
-
({ tr, state, dispatch, commands }) => {
|
|
136
|
-
const typeName = normalizeType(type);
|
|
137
|
-
|
|
138
|
-
// --- Slate: currentRespAreaList + max check ---
|
|
139
|
-
const currentCount = countNodesOfType(state.doc, typeName);
|
|
140
|
-
if (currentCount >= this.options.maxResponseAreas) {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// --- Slate: indexing logic (kept identical) ---
|
|
145
|
-
if (lastIndexMap[typeName] === undefined) {
|
|
146
|
-
lastIndexMap[typeName] = 0;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const prevIndex = lastIndexMap[typeName];
|
|
150
|
-
const newIndex = prevIndex + 1;
|
|
151
|
-
|
|
152
|
-
// Slate increments map even if newIndex === 0
|
|
153
|
-
lastIndexMap[typeName] += 1;
|
|
154
|
-
|
|
155
|
-
const newInline = getDefaultNode({
|
|
156
|
-
schema: state.schema,
|
|
157
|
-
typeName,
|
|
158
|
-
index: newIndex,
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
if (!newInline) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// --- Insert logic ---
|
|
166
|
-
const { selection } = state;
|
|
167
|
-
let insertPos = selection.from;
|
|
168
|
-
|
|
169
|
-
// If we're in a NodeSelection, insert before/after is ambiguous;
|
|
170
|
-
// We'll insert at its "from" (like your current code).
|
|
171
|
-
// If insertion fails, we fallback to end of doc.
|
|
172
|
-
const tryInsertAt = (pos) => {
|
|
173
|
-
try {
|
|
174
|
-
tr.insert(pos, newInline);
|
|
175
|
-
return pos;
|
|
176
|
-
} catch (e) {
|
|
177
|
-
return null;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
let usedPos = tryInsertAt(insertPos);
|
|
182
|
-
|
|
183
|
-
// Slate branch: "markup empty and there's no focus"
|
|
184
|
-
// ProseMirror doesn't expose "no focus" the same way, so the closest
|
|
185
|
-
// equivalent fallback is inserting at end of document.
|
|
186
|
-
if (usedPos == null) {
|
|
187
|
-
usedPos = tryInsertAt(tr.doc.content.size);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (usedPos == null) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Optionally select the node you just inserted (like your original command)
|
|
195
|
-
// tr.setSelection(NodeSelection.create(tr.doc, usedPos))
|
|
196
|
-
|
|
197
|
-
// --- Cursor move behavior for certain types (Slate: moveFocusTo next text) ---
|
|
198
|
-
if (['math_templated', 'inline_dropdown', 'explicit_constructed_response'].includes(typeName)) {
|
|
199
|
-
tr.setSelection(NodeSelection.create(tr.doc, usedPos));
|
|
200
|
-
} else {
|
|
201
|
-
const after = usedPos + newInline.nodeSize;
|
|
202
|
-
tr.setSelection(selectionAfterPos(tr.doc, after));
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (dispatch) {
|
|
206
|
-
commands.focus();
|
|
207
|
-
dispatch(tr);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return true;
|
|
211
|
-
},
|
|
212
|
-
refreshResponseArea:
|
|
213
|
-
() =>
|
|
214
|
-
({ tr, state, commands, dispatch }) => {
|
|
215
|
-
const { selection } = state;
|
|
216
|
-
const node = selection.$from.nodeAfter;
|
|
217
|
-
const nodePos = selection.from;
|
|
218
|
-
|
|
219
|
-
tr.setNodeMarkup(nodePos, undefined, { ...node?.attrs, updated: `${Date.now()}` });
|
|
220
|
-
tr.setSelection(NodeSelection.create(tr.doc, nodePos));
|
|
221
|
-
|
|
222
|
-
if (dispatch) {
|
|
223
|
-
commands.focus();
|
|
224
|
-
dispatch(tr);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return true;
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* ExplicitConstructedResponse Node
|
|
235
|
-
*/
|
|
236
|
-
export const ExplicitConstructedResponseNode = Node.create({
|
|
237
|
-
name: 'explicit_constructed_response',
|
|
238
|
-
group: 'inline',
|
|
239
|
-
inline: true,
|
|
240
|
-
atom: true,
|
|
241
|
-
addAttributes() {
|
|
242
|
-
return {
|
|
243
|
-
index: { default: null },
|
|
244
|
-
value: { default: '' },
|
|
245
|
-
updated: { default: '' },
|
|
246
|
-
};
|
|
247
|
-
},
|
|
248
|
-
parseHTML() {
|
|
249
|
-
return [
|
|
250
|
-
{
|
|
251
|
-
tag: 'span[data-type="explicit_constructed_response"]',
|
|
252
|
-
getAttrs: (el) => ({
|
|
253
|
-
index: el.dataset.index,
|
|
254
|
-
value: el.dataset.value,
|
|
255
|
-
}),
|
|
256
|
-
},
|
|
257
|
-
];
|
|
258
|
-
},
|
|
259
|
-
renderHTML({ HTMLAttributes }) {
|
|
260
|
-
return [
|
|
261
|
-
'span',
|
|
262
|
-
{
|
|
263
|
-
'data-type': 'explicit_constructed_response',
|
|
264
|
-
'data-index': HTMLAttributes.index,
|
|
265
|
-
'data-value': HTMLAttributes.value,
|
|
266
|
-
},
|
|
267
|
-
];
|
|
268
|
-
},
|
|
269
|
-
addNodeView() {
|
|
270
|
-
return ReactNodeViewRenderer((props) => <ExplicitConstructedResponse {...{ ...props, options: this.options }} />);
|
|
271
|
-
},
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* MathTemplated Node
|
|
276
|
-
*/
|
|
277
|
-
export const MathTemplatedNode = Node.create({
|
|
278
|
-
name: 'math_templated',
|
|
279
|
-
group: 'inline',
|
|
280
|
-
inline: true,
|
|
281
|
-
atom: true,
|
|
282
|
-
addAttributes() {
|
|
283
|
-
return {
|
|
284
|
-
index: { default: null },
|
|
285
|
-
value: { default: '' },
|
|
286
|
-
updated: { default: '' },
|
|
287
|
-
};
|
|
288
|
-
},
|
|
289
|
-
parseHTML() {
|
|
290
|
-
return [
|
|
291
|
-
{
|
|
292
|
-
tag: 'span[data-type="math_templated"]',
|
|
293
|
-
getAttrs: (el) => ({
|
|
294
|
-
index: el.dataset.index,
|
|
295
|
-
value: el.dataset.value,
|
|
296
|
-
}),
|
|
297
|
-
},
|
|
298
|
-
];
|
|
299
|
-
},
|
|
300
|
-
renderHTML({ HTMLAttributes }) {
|
|
301
|
-
return [
|
|
302
|
-
'span',
|
|
303
|
-
{
|
|
304
|
-
'data-type': 'math_templated',
|
|
305
|
-
'data-index': HTMLAttributes.index,
|
|
306
|
-
'data-value': HTMLAttributes.value,
|
|
307
|
-
},
|
|
308
|
-
];
|
|
309
|
-
},
|
|
310
|
-
addNodeView() {
|
|
311
|
-
return ReactNodeViewRenderer((props) => <MathTemplated {...{ ...props, options: this.options }} />);
|
|
312
|
-
},
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* DragInTheBlank Node
|
|
317
|
-
*/
|
|
318
|
-
export const DragInTheBlankNode = Node.create({
|
|
319
|
-
name: 'drag_in_the_blank',
|
|
320
|
-
group: 'inline',
|
|
321
|
-
inline: true,
|
|
322
|
-
atom: true,
|
|
323
|
-
addAttributes() {
|
|
324
|
-
return {
|
|
325
|
-
index: { default: null },
|
|
326
|
-
id: { default: null },
|
|
327
|
-
value: { default: '' },
|
|
328
|
-
inTable: { default: null },
|
|
329
|
-
updated: { default: '' },
|
|
330
|
-
};
|
|
331
|
-
},
|
|
332
|
-
parseHTML() {
|
|
333
|
-
return [
|
|
334
|
-
{
|
|
335
|
-
tag: 'span[data-type="drag_in_the_blank"]',
|
|
336
|
-
getAttrs: (el) => ({
|
|
337
|
-
index: el.dataset.index,
|
|
338
|
-
id: el.dataset.id,
|
|
339
|
-
value: el.dataset.value,
|
|
340
|
-
inTable: el.dataset.inTable,
|
|
341
|
-
}),
|
|
342
|
-
},
|
|
343
|
-
];
|
|
344
|
-
},
|
|
345
|
-
renderHTML({ HTMLAttributes }) {
|
|
346
|
-
return [
|
|
347
|
-
'span',
|
|
348
|
-
{
|
|
349
|
-
'data-type': 'drag_in_the_blank',
|
|
350
|
-
'data-index': HTMLAttributes.index,
|
|
351
|
-
'data-id': HTMLAttributes.id,
|
|
352
|
-
'data-value': HTMLAttributes.value,
|
|
353
|
-
'data-in-table': HTMLAttributes.inTable,
|
|
354
|
-
},
|
|
355
|
-
];
|
|
356
|
-
},
|
|
357
|
-
addNodeView() {
|
|
358
|
-
return ReactNodeViewRenderer((props) => <DragInTheBlank {...{ ...props, options: this.options }} />);
|
|
359
|
-
},
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* InlineDropdown Node
|
|
364
|
-
*/
|
|
365
|
-
export const InlineDropdownNode = Node.create({
|
|
366
|
-
name: 'inline_dropdown',
|
|
367
|
-
group: 'inline',
|
|
368
|
-
inline: true,
|
|
369
|
-
atom: true,
|
|
370
|
-
addAttributes() {
|
|
371
|
-
return {
|
|
372
|
-
index: { default: null },
|
|
373
|
-
value: { default: '' },
|
|
374
|
-
updated: { default: '' },
|
|
375
|
-
};
|
|
376
|
-
},
|
|
377
|
-
parseHTML() {
|
|
378
|
-
return [
|
|
379
|
-
{
|
|
380
|
-
tag: 'span[data-type="inline_dropdown"]',
|
|
381
|
-
getAttrs: (el) => ({
|
|
382
|
-
index: el.dataset.index,
|
|
383
|
-
value: el.dataset.value,
|
|
384
|
-
}),
|
|
385
|
-
},
|
|
386
|
-
];
|
|
387
|
-
},
|
|
388
|
-
renderHTML({ HTMLAttributes }) {
|
|
389
|
-
return [
|
|
390
|
-
'span',
|
|
391
|
-
{
|
|
392
|
-
'data-type': 'inline_dropdown',
|
|
393
|
-
'data-index': HTMLAttributes.index,
|
|
394
|
-
'data-value': HTMLAttributes.value,
|
|
395
|
-
},
|
|
396
|
-
];
|
|
397
|
-
},
|
|
398
|
-
addNodeView() {
|
|
399
|
-
return ReactNodeViewRenderer((props) => <InlineDropdown {...{ ...props, options: this.options }} />);
|
|
400
|
-
},
|
|
401
|
-
});
|
package/src/index.jsx
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { color } from '@pie-lib/render-ui';
|
|
2
|
-
|
|
3
|
-
const styles = (theme) => ({
|
|
4
|
-
root: {
|
|
5
|
-
position: 'relative',
|
|
6
|
-
padding: '0px',
|
|
7
|
-
border: '1px solid #ccc',
|
|
8
|
-
borderRadius: '4px',
|
|
9
|
-
cursor: 'text',
|
|
10
|
-
'& [data-slate-editor="true"]': {
|
|
11
|
-
wordBreak: 'break-word',
|
|
12
|
-
overflow: 'visible',
|
|
13
|
-
maxHeight: '500px',
|
|
14
|
-
// needed in order to be able to put the focus before a void element when it is the first one in the editor
|
|
15
|
-
padding: '5px',
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
'&:first-child': {
|
|
19
|
-
marginTop: 0,
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
'& ul, & ol': {
|
|
23
|
-
padding: '0 1rem',
|
|
24
|
-
margin: '1.25rem 1rem 1.25rem 0.4rem',
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
'& ul li p, & ol li p': {
|
|
28
|
-
marginTop: '0.25em',
|
|
29
|
-
marginBottom: '0.25em',
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
'& h1, & h2, & h3, & h4, & h5, & h6': {
|
|
33
|
-
lineHeight: 1.1,
|
|
34
|
-
marginTop: '2.5rem',
|
|
35
|
-
textWrap: 'pretty',
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
'& h1, & h2': {
|
|
39
|
-
marginTop: '3.5rem',
|
|
40
|
-
marginBottom: '1.5rem',
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
'& h1': {
|
|
44
|
-
fontSize: '1.4rem',
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
'& h2': {
|
|
48
|
-
fontSize: '1.2rem',
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
'& h3': {
|
|
52
|
-
fontSize: '1.1rem',
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
'& h4, & h5, & h6': {
|
|
56
|
-
fontSize: '1rem',
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
'& code': {
|
|
60
|
-
backgroundColor: 'var(--purple-light)',
|
|
61
|
-
borderRadius: '0.4rem',
|
|
62
|
-
color: 'var(--black)',
|
|
63
|
-
fontSize: '0.85rem',
|
|
64
|
-
padding: '0.25em 0.3em',
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
'& pre': {
|
|
68
|
-
background: 'var(--black)',
|
|
69
|
-
borderRadius: '0.5rem',
|
|
70
|
-
color: 'var(--white)',
|
|
71
|
-
fontFamily: '\'JetBrainsMono\', monospace',
|
|
72
|
-
margin: '1.5rem 0',
|
|
73
|
-
padding: '0.75rem 1rem',
|
|
74
|
-
|
|
75
|
-
'& code': {
|
|
76
|
-
background: 'none',
|
|
77
|
-
color: 'inherit',
|
|
78
|
-
fontSize: '0.8rem',
|
|
79
|
-
padding: 0,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
'& blockquote': {
|
|
84
|
-
background: '#f9f9f9',
|
|
85
|
-
borderLeft: '5px solid #ccc',
|
|
86
|
-
margin: '1.5em 10px',
|
|
87
|
-
padding: '.5em 10px',
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
'& hr': {
|
|
91
|
-
border: 'none',
|
|
92
|
-
borderTop: '1px solid var(--gray-2)',
|
|
93
|
-
margin: '2rem 0',
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
'& table': {
|
|
97
|
-
tableLayout: 'fixed',
|
|
98
|
-
width: '100%',
|
|
99
|
-
borderCollapse: 'collapse',
|
|
100
|
-
color: color.text(),
|
|
101
|
-
backgroundColor: color.background(),
|
|
102
|
-
},
|
|
103
|
-
'& table:not([border="1"]) tr': {
|
|
104
|
-
borderTop: '1px solid #dfe2e5',
|
|
105
|
-
},
|
|
106
|
-
'& td, th': {
|
|
107
|
-
padding: '.6em 1em',
|
|
108
|
-
textAlign: 'center',
|
|
109
|
-
},
|
|
110
|
-
'& table:not([border="1"]) td, th': {
|
|
111
|
-
border: '1px solid #dfe2e5',
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
children: {
|
|
115
|
-
padding: '10px 16px',
|
|
116
|
-
},
|
|
117
|
-
editorHolder: {
|
|
118
|
-
position: 'relative',
|
|
119
|
-
padding: '0px',
|
|
120
|
-
overflowY: 'auto',
|
|
121
|
-
color: color.text(),
|
|
122
|
-
backgroundColor: color.background(),
|
|
123
|
-
},
|
|
124
|
-
disabledScrollbar: {
|
|
125
|
-
'&::-webkit-scrollbar': {
|
|
126
|
-
display: 'none',
|
|
127
|
-
},
|
|
128
|
-
scrollbarWidth: 'none',
|
|
129
|
-
'-ms-overflow-style': 'none',
|
|
130
|
-
},
|
|
131
|
-
error: {
|
|
132
|
-
border: `2px solid ${theme.palette.error.main} !important`,
|
|
133
|
-
},
|
|
134
|
-
noBorder: {
|
|
135
|
-
border: 'none',
|
|
136
|
-
},
|
|
137
|
-
noPadding: {
|
|
138
|
-
padding: 0,
|
|
139
|
-
},
|
|
140
|
-
toolbarOnTop: {
|
|
141
|
-
marginTop: '45px',
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
export default styles;
|
package/src/theme.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const primary = '#304ffe';
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { normalizeInitialMarkup } from '../helper';
|
|
2
|
-
|
|
3
|
-
describe('normalizeInitialMarkup', () => {
|
|
4
|
-
describe('basic normalization', () => {
|
|
5
|
-
it('returns empty div for empty string', () => {
|
|
6
|
-
expect(normalizeInitialMarkup('')).toBe('<div></div>');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it('returns empty div for null', () => {
|
|
10
|
-
expect(normalizeInitialMarkup(null)).toBe('<div></div>');
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('returns empty div for undefined', () => {
|
|
14
|
-
expect(normalizeInitialMarkup(undefined)).toBe('<div></div>');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('wraps plain text in div', () => {
|
|
18
|
-
expect(normalizeInitialMarkup('Hello')).toBe('<div>Hello</div>');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns HTML tags as-is when detected as HTML', () => {
|
|
22
|
-
// Since '<script>' matches the HTML pattern, it's returned as-is
|
|
23
|
-
// To be escaped, it would need to not match the HTML pattern
|
|
24
|
-
expect(normalizeInitialMarkup('<script>')).toBe('<script>');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('escapes HTML entities in plain text', () => {
|
|
28
|
-
// Plain text without angle brackets gets escaped
|
|
29
|
-
expect(normalizeInitialMarkup('Hello & World')).toBe('<div>Hello & World</div>');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('returns single div as-is', () => {
|
|
33
|
-
const html = '<div>Hello</div>';
|
|
34
|
-
expect(normalizeInitialMarkup(html)).toBe(html);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('returns paragraph as-is', () => {
|
|
38
|
-
const html = '<p>Hello</p>';
|
|
39
|
-
expect(normalizeInitialMarkup(html)).toBe(html);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('consecutive divs to paragraph conversion', () => {
|
|
44
|
-
it('converts two consecutive divs to paragraph with br', () => {
|
|
45
|
-
const input = '<div>A</div><div>B</div>';
|
|
46
|
-
const expected = '<p>A<br>B</p>';
|
|
47
|
-
expect(normalizeInitialMarkup(input)).toBe(expected);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('converts three consecutive divs to paragraph with br tags', () => {
|
|
51
|
-
const input = '<div>A</div><div>B</div><div>C</div>';
|
|
52
|
-
const expected = '<p>A<br>B<br>C</p>';
|
|
53
|
-
expect(normalizeInitialMarkup(input)).toBe(expected);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('handles divs with whitespace', () => {
|
|
57
|
-
const input = '<div> A </div><div> B </div>';
|
|
58
|
-
const expected = '<p> A <br> B </p>';
|
|
59
|
-
expect(normalizeInitialMarkup(input)).toBe(expected);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('handles divs with inline elements', () => {
|
|
63
|
-
const input = '<div><strong>A</strong></div><div><em>B</em></div>';
|
|
64
|
-
const expected = '<p><strong>A</strong><br><em>B</em></p>';
|
|
65
|
-
expect(normalizeInitialMarkup(input)).toBe(expected);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('handles empty divs', () => {
|
|
69
|
-
const input = '<div></div><div>B</div>';
|
|
70
|
-
const expected = '<p><br>B</p>';
|
|
71
|
-
expect(normalizeInitialMarkup(input)).toBe(expected);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('preserves existing br tags within divs', () => {
|
|
75
|
-
const input = '<div>A<br>A2</div><div>B</div>';
|
|
76
|
-
const expected = '<p>A<br>A2<br>B</p>';
|
|
77
|
-
expect(normalizeInitialMarkup(input)).toBe(expected);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
describe('cases that should NOT convert', () => {
|
|
82
|
-
it('does not convert single div', () => {
|
|
83
|
-
const input = '<div>Hello</div>';
|
|
84
|
-
expect(normalizeInitialMarkup(input)).toBe(input);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('does not convert divs with nested block elements', () => {
|
|
88
|
-
const input = '<div><div>Nested</div></div><div>B</div>';
|
|
89
|
-
expect(normalizeInitialMarkup(input)).toBe(input);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('does not convert divs containing tables', () => {
|
|
93
|
-
const input = '<div><table><tr><td>A</td></tr></table></div><div>B</div>';
|
|
94
|
-
expect(normalizeInitialMarkup(input)).toBe(input);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('does not convert divs containing lists', () => {
|
|
98
|
-
const input = '<div><ul><li>Item</li></ul></div><div>B</div>';
|
|
99
|
-
expect(normalizeInitialMarkup(input)).toBe(input);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('does not convert mixed element types', () => {
|
|
103
|
-
const input = '<div>A</div><p>B</p>';
|
|
104
|
-
expect(normalizeInitialMarkup(input)).toBe(input);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('does not convert paragraphs', () => {
|
|
108
|
-
const input = '<p>A</p><p>B</p>';
|
|
109
|
-
expect(normalizeInitialMarkup(input)).toBe(input);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe('edge cases', () => {
|
|
114
|
-
it('handles divs with attributes', () => {
|
|
115
|
-
const input = '<div class="test">A</div><div>B</div>';
|
|
116
|
-
// Should not convert since we only want simple divs
|
|
117
|
-
expect(normalizeInitialMarkup(input)).toBe(input);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('handles complex inline formatting', () => {
|
|
121
|
-
const input = '<div><strong><em>A</em></strong></div><div><u>B</u></div>';
|
|
122
|
-
const expected = '<p><strong><em>A</em></strong><br><u>B</u></p>';
|
|
123
|
-
expect(normalizeInitialMarkup(input)).toBe(expected);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|