@pie-lib/editable-html-tip-tap 2.2.0-beta.9 → 3.0.0-next.36
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 +141 -0
- package/dist/components/EditableHtml.d.ts +11 -0
- package/dist/components/EditableHtml.js +330 -0
- package/dist/components/MenuBar.d.ts +11 -0
- package/dist/components/MenuBar.js +531 -0
- package/dist/components/TiptapContainer.d.ts +11 -0
- package/dist/components/TiptapContainer.js +167 -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 +96 -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 +34 -0
- package/dist/components/icons/TextAlign.d.ts +18 -0
- package/dist/components/icons/TextAlign.js +143 -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 +33 -0
- package/dist/components/image/InsertImageHandler.js +65 -0
- package/dist/components/image/findImageNode.d.ts +3 -0
- package/dist/components/image/findImageNode.js +11 -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 +157 -0
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts +20 -0
- package/dist/components/respArea/ExplicitConstructedResponse.js +84 -0
- package/dist/components/respArea/InlineDropdown.d.ts +18 -0
- package/dist/components/respArea/InlineDropdown.js +126 -0
- package/dist/components/respArea/MathTemplated.d.ts +19 -0
- package/dist/components/respArea/MathTemplated.js +98 -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 +120 -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 +223 -0
- package/dist/extensions/image.d.ts +10 -0
- package/dist/extensions/image.js +77 -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 +213 -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 +255 -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/dist/utils/toolbar.d.ts +10 -0
- package/dist/utils/toolbar.js +7 -0
- package/package.json +56 -42
- package/CHANGELOG.json +0 -32
- package/CHANGELOG.md +0 -2532
- package/lib/components/CharacterPicker.js +0 -226
- package/lib/components/CharacterPicker.js.map +0 -1
- package/lib/components/EditableHtml.js +0 -388
- package/lib/components/EditableHtml.js.map +0 -1
- package/lib/components/MenuBar.js +0 -702
- package/lib/components/MenuBar.js.map +0 -1
- package/lib/components/TiptapContainer.js +0 -242
- 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 -149
- 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 -253
- package/lib/components/respArea/DragInTheBlank/choice.js.map +0 -1
- package/lib/components/respArea/ExplicitConstructedResponse.js +0 -137
- package/lib/components/respArea/ExplicitConstructedResponse.js.map +0 -1
- package/lib/components/respArea/InlineDropdown.js +0 -223
- 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/components/respArea/inlineDropdownUtils.js +0 -67
- package/lib/components/respArea/inlineDropdownUtils.js.map +0 -1
- package/lib/constants.js +0 -11
- package/lib/constants.js.map +0 -1
- package/lib/extensions/css.js +0 -227
- 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 -351
- 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 -469
- 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 -452
- package/lib/extensions/responseArea.js.map +0 -1
- package/lib/index.js +0 -37
- 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/lib/utils/toolbar.js +0 -19
- package/lib/utils/toolbar.js.map +0 -1
- package/src/components/CharacterPicker.jsx +0 -237
- package/src/components/EditableHtml.jsx +0 -458
- package/src/components/MenuBar.jsx +0 -561
- package/src/components/TiptapContainer.jsx +0 -235
- 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 -127
- 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 -259
- package/src/components/respArea/ExplicitConstructedResponse.jsx +0 -136
- package/src/components/respArea/InlineDropdown.jsx +0 -240
- package/src/components/respArea/MathTemplated.jsx +0 -124
- package/src/components/respArea/ToolbarIcon.jsx +0 -66
- package/src/components/respArea/inlineDropdownUtils.js +0 -79
- package/src/constants.js +0 -5
- package/src/extensions/css.js +0 -233
- 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 -340
- package/src/extensions/image.js +0 -109
- package/src/extensions/index.js +0 -81
- package/src/extensions/math.js +0 -454
- package/src/extensions/media.js +0 -188
- package/src/extensions/responseArea.js +0 -407
- package/src/index.jsx +0 -5
- package/src/styles/editorContainerStyles.js +0 -145
- package/src/theme.js +0 -1
- package/src/utils/helper.js +0 -69
- package/src/utils/size.js +0 -32
- package/src/utils/toolbar.js +0 -15
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _renderUi = require("@pie-lib/render-ui");
|
|
8
|
-
var styles = function styles(theme) {
|
|
9
|
-
return {
|
|
10
|
-
root: {
|
|
11
|
-
position: 'relative',
|
|
12
|
-
padding: '0px',
|
|
13
|
-
border: '1px solid #ccc',
|
|
14
|
-
borderRadius: '4px',
|
|
15
|
-
cursor: 'text',
|
|
16
|
-
'& [data-slate-editor="true"]': {
|
|
17
|
-
wordBreak: 'break-word',
|
|
18
|
-
overflow: 'visible',
|
|
19
|
-
maxHeight: '500px',
|
|
20
|
-
// needed in order to be able to put the focus before a void element when it is the first one in the editor
|
|
21
|
-
padding: '5px'
|
|
22
|
-
},
|
|
23
|
-
'&:first-child': {
|
|
24
|
-
marginTop: 0
|
|
25
|
-
},
|
|
26
|
-
'& ul, & ol': {
|
|
27
|
-
padding: '0 1rem',
|
|
28
|
-
margin: '1.25rem 1rem 1.25rem 0.4rem'
|
|
29
|
-
},
|
|
30
|
-
'& ul li p, & ol li p': {
|
|
31
|
-
marginTop: '0.25em',
|
|
32
|
-
marginBottom: '0.25em'
|
|
33
|
-
},
|
|
34
|
-
'& h1, & h2, & h3, & h4, & h5, & h6': {
|
|
35
|
-
lineHeight: 1.1,
|
|
36
|
-
marginTop: '2.5rem',
|
|
37
|
-
textWrap: 'pretty'
|
|
38
|
-
},
|
|
39
|
-
'& h1, & h2': {
|
|
40
|
-
marginTop: '3.5rem',
|
|
41
|
-
marginBottom: '1.5rem'
|
|
42
|
-
},
|
|
43
|
-
'& h1': {
|
|
44
|
-
fontSize: '1.4rem'
|
|
45
|
-
},
|
|
46
|
-
'& h2': {
|
|
47
|
-
fontSize: '1.2rem'
|
|
48
|
-
},
|
|
49
|
-
'& h3': {
|
|
50
|
-
fontSize: '1.1rem'
|
|
51
|
-
},
|
|
52
|
-
'& h4, & h5, & h6': {
|
|
53
|
-
fontSize: '1rem'
|
|
54
|
-
},
|
|
55
|
-
'& code': {
|
|
56
|
-
backgroundColor: 'var(--purple-light)',
|
|
57
|
-
borderRadius: '0.4rem',
|
|
58
|
-
color: 'var(--black)',
|
|
59
|
-
fontSize: '0.85rem',
|
|
60
|
-
padding: '0.25em 0.3em'
|
|
61
|
-
},
|
|
62
|
-
'& pre': {
|
|
63
|
-
background: 'var(--black)',
|
|
64
|
-
borderRadius: '0.5rem',
|
|
65
|
-
color: 'var(--white)',
|
|
66
|
-
fontFamily: '\'JetBrainsMono\', monospace',
|
|
67
|
-
margin: '1.5rem 0',
|
|
68
|
-
padding: '0.75rem 1rem',
|
|
69
|
-
'& code': {
|
|
70
|
-
background: 'none',
|
|
71
|
-
color: 'inherit',
|
|
72
|
-
fontSize: '0.8rem',
|
|
73
|
-
padding: 0
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
'& blockquote': {
|
|
77
|
-
background: '#f9f9f9',
|
|
78
|
-
borderLeft: '5px solid #ccc',
|
|
79
|
-
margin: '1.5em 10px',
|
|
80
|
-
padding: '.5em 10px'
|
|
81
|
-
},
|
|
82
|
-
'& hr': {
|
|
83
|
-
border: 'none',
|
|
84
|
-
borderTop: '1px solid var(--gray-2)',
|
|
85
|
-
margin: '2rem 0'
|
|
86
|
-
},
|
|
87
|
-
'& table': {
|
|
88
|
-
tableLayout: 'fixed',
|
|
89
|
-
width: '100%',
|
|
90
|
-
borderCollapse: 'collapse',
|
|
91
|
-
color: _renderUi.color.text(),
|
|
92
|
-
backgroundColor: _renderUi.color.background()
|
|
93
|
-
},
|
|
94
|
-
'& table:not([border="1"]) tr': {
|
|
95
|
-
borderTop: '1px solid #dfe2e5'
|
|
96
|
-
},
|
|
97
|
-
'& td, th': {
|
|
98
|
-
padding: '.6em 1em',
|
|
99
|
-
textAlign: 'center'
|
|
100
|
-
},
|
|
101
|
-
'& table:not([border="1"]) td, th': {
|
|
102
|
-
border: '1px solid #dfe2e5'
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
children: {
|
|
106
|
-
padding: '10px 16px'
|
|
107
|
-
},
|
|
108
|
-
editorHolder: {
|
|
109
|
-
position: 'relative',
|
|
110
|
-
padding: '0px',
|
|
111
|
-
overflowY: 'auto',
|
|
112
|
-
color: _renderUi.color.text(),
|
|
113
|
-
backgroundColor: _renderUi.color.background()
|
|
114
|
-
},
|
|
115
|
-
disabledScrollbar: {
|
|
116
|
-
'&::-webkit-scrollbar': {
|
|
117
|
-
display: 'none'
|
|
118
|
-
},
|
|
119
|
-
scrollbarWidth: 'none',
|
|
120
|
-
'-ms-overflow-style': 'none'
|
|
121
|
-
},
|
|
122
|
-
error: {
|
|
123
|
-
border: "2px solid ".concat(theme.palette.error.main, " !important")
|
|
124
|
-
},
|
|
125
|
-
noBorder: {
|
|
126
|
-
border: 'none'
|
|
127
|
-
},
|
|
128
|
-
noPadding: {
|
|
129
|
-
padding: 0
|
|
130
|
-
},
|
|
131
|
-
toolbarOnTop: {
|
|
132
|
-
marginTop: '45px'
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
var _default = exports["default"] = styles;
|
|
137
|
-
//# sourceMappingURL=editorContainerStyles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editorContainerStyles.js","names":["_renderUi","require","styles","theme","root","position","padding","border","borderRadius","cursor","wordBreak","overflow","maxHeight","marginTop","margin","marginBottom","lineHeight","textWrap","fontSize","backgroundColor","color","background","fontFamily","borderLeft","borderTop","tableLayout","width","borderCollapse","text","textAlign","children","editorHolder","overflowY","disabledScrollbar","display","scrollbarWidth","error","concat","palette","main","noBorder","noPadding","toolbarOnTop","_default","exports"],"sources":["../../src/styles/editorContainerStyles.js"],"sourcesContent":["import { color } from '@pie-lib/render-ui';\n\nconst styles = (theme) => ({\n root: {\n position: 'relative',\n padding: '0px',\n border: '1px solid #ccc',\n borderRadius: '4px',\n cursor: 'text',\n '& [data-slate-editor=\"true\"]': {\n wordBreak: 'break-word',\n overflow: 'visible',\n maxHeight: '500px',\n // needed in order to be able to put the focus before a void element when it is the first one in the editor\n padding: '5px',\n },\n\n '&:first-child': {\n marginTop: 0,\n },\n\n '& ul, & ol': {\n padding: '0 1rem',\n margin: '1.25rem 1rem 1.25rem 0.4rem',\n },\n\n '& ul li p, & ol li p': {\n marginTop: '0.25em',\n marginBottom: '0.25em',\n },\n\n '& h1, & h2, & h3, & h4, & h5, & h6': {\n lineHeight: 1.1,\n marginTop: '2.5rem',\n textWrap: 'pretty',\n },\n\n '& h1, & h2': {\n marginTop: '3.5rem',\n marginBottom: '1.5rem',\n },\n\n '& h1': {\n fontSize: '1.4rem',\n },\n\n '& h2': {\n fontSize: '1.2rem',\n },\n\n '& h3': {\n fontSize: '1.1rem',\n },\n\n '& h4, & h5, & h6': {\n fontSize: '1rem',\n },\n\n '& code': {\n backgroundColor: 'var(--purple-light)',\n borderRadius: '0.4rem',\n color: 'var(--black)',\n fontSize: '0.85rem',\n padding: '0.25em 0.3em',\n },\n\n '& pre': {\n background: 'var(--black)',\n borderRadius: '0.5rem',\n color: 'var(--white)',\n fontFamily: '\\'JetBrainsMono\\', monospace',\n margin: '1.5rem 0',\n padding: '0.75rem 1rem',\n\n '& code': {\n background: 'none',\n color: 'inherit',\n fontSize: '0.8rem',\n padding: 0,\n },\n },\n\n '& blockquote': {\n background: '#f9f9f9',\n borderLeft: '5px solid #ccc',\n margin: '1.5em 10px',\n padding: '.5em 10px',\n },\n\n '& hr': {\n border: 'none',\n borderTop: '1px solid var(--gray-2)',\n margin: '2rem 0',\n },\n\n '& table': {\n tableLayout: 'fixed',\n width: '100%',\n borderCollapse: 'collapse',\n color: color.text(),\n backgroundColor: color.background(),\n },\n '& table:not([border=\"1\"]) tr': {\n borderTop: '1px solid #dfe2e5',\n },\n '& td, th': {\n padding: '.6em 1em',\n textAlign: 'center',\n },\n '& table:not([border=\"1\"]) td, th': {\n border: '1px solid #dfe2e5',\n },\n },\n children: {\n padding: '10px 16px',\n },\n editorHolder: {\n position: 'relative',\n padding: '0px',\n overflowY: 'auto',\n color: color.text(),\n backgroundColor: color.background(),\n },\n disabledScrollbar: {\n '&::-webkit-scrollbar': {\n display: 'none',\n },\n scrollbarWidth: 'none',\n '-ms-overflow-style': 'none',\n },\n error: {\n border: `2px solid ${theme.palette.error.main} !important`,\n },\n noBorder: {\n border: 'none',\n },\n noPadding: {\n padding: 0,\n },\n toolbarOnTop: {\n marginTop: '45px',\n },\n});\n\nexport default styles;\n"],"mappings":"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","ignoreList":[]}
|
package/lib/theme.js
DELETED
package/lib/theme.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":["primary","exports"],"sources":["../src/theme.js"],"sourcesContent":["export const primary = '#304ffe';\n"],"mappings":";;;;;;AAAO,IAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,SAAS","ignoreList":[]}
|
package/lib/utils/helper.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.normalizeInitialMarkup = void 0;
|
|
7
|
-
var escapeHtml = function escapeHtml(str) {
|
|
8
|
-
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Converts consecutive div elements into a single paragraph with line breaks.
|
|
13
|
-
* Example: "<div>A</div><div>B</div>" becomes "<p>A<br>B</p>"
|
|
14
|
-
*/
|
|
15
|
-
var convertConsecutiveDivsToParagraph = function convertConsecutiveDivsToParagraph(html) {
|
|
16
|
-
// Create a temporary element to parse the HTML
|
|
17
|
-
var temp = document.createElement('div');
|
|
18
|
-
temp.innerHTML = html;
|
|
19
|
-
|
|
20
|
-
// Get all top-level children
|
|
21
|
-
var children = Array.from(temp.children);
|
|
22
|
-
|
|
23
|
-
// Only convert if there are 2 or more divs
|
|
24
|
-
if (children.length < 2) {
|
|
25
|
-
return html;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Check if all children are divs with simple content (text or inline elements)
|
|
29
|
-
var allDivs = children.every(function (child) {
|
|
30
|
-
return child.tagName === 'DIV';
|
|
31
|
-
});
|
|
32
|
-
if (!allDivs) {
|
|
33
|
-
return html;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Check if divs have no attributes (only convert plain divs)
|
|
37
|
-
var hasNoAttributes = children.every(function (div) {
|
|
38
|
-
return div.attributes.length === 0;
|
|
39
|
-
});
|
|
40
|
-
if (!hasNoAttributes) {
|
|
41
|
-
return html;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Check if divs contain only simple content (no nested block elements)
|
|
45
|
-
var hasOnlySimpleContent = children.every(function (div) {
|
|
46
|
-
return Array.from(div.children).every(function (child) {
|
|
47
|
-
var tag = child.tagName;
|
|
48
|
-
// Allow inline elements and br tags
|
|
49
|
-
return ['SPAN', 'B', 'I', 'EM', 'STRONG', 'U', 'SUB', 'SUP', 'A', 'CODE', 'BR'].includes(tag);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
if (!hasOnlySimpleContent) {
|
|
53
|
-
return html;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Convert to paragraph with br tags
|
|
57
|
-
var contents = children.map(function (div) {
|
|
58
|
-
return div.innerHTML;
|
|
59
|
-
});
|
|
60
|
-
return "<p>".concat(contents.join('<br>'), "</p>");
|
|
61
|
-
};
|
|
62
|
-
var normalizeInitialMarkup = exports.normalizeInitialMarkup = function normalizeInitialMarkup(markup) {
|
|
63
|
-
var trimmed = String(markup !== null && markup !== void 0 ? markup : '').trim();
|
|
64
|
-
if (!trimmed) return '<div></div>';
|
|
65
|
-
var looksLikeHtml = /<[^>]+>/.test(trimmed);
|
|
66
|
-
if (!looksLikeHtml) {
|
|
67
|
-
return "<div>".concat(escapeHtml(trimmed), "</div>");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Apply the div-to-paragraph transformation
|
|
71
|
-
return convertConsecutiveDivsToParagraph(trimmed);
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=helper.js.map
|
package/lib/utils/helper.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","names":["escapeHtml","str","String","replace","convertConsecutiveDivsToParagraph","html","temp","document","createElement","innerHTML","children","Array","from","length","allDivs","every","child","tagName","hasNoAttributes","div","attributes","hasOnlySimpleContent","tag","includes","contents","map","concat","join","normalizeInitialMarkup","exports","markup","trimmed","trim","looksLikeHtml","test"],"sources":["../../src/utils/helper.js"],"sourcesContent":["const escapeHtml = (str) =>\n String(str)\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n\n/**\n * Converts consecutive div elements into a single paragraph with line breaks.\n * Example: \"<div>A</div><div>B</div>\" becomes \"<p>A<br>B</p>\"\n */\nconst convertConsecutiveDivsToParagraph = (html) => {\n // Create a temporary element to parse the HTML\n const temp = document.createElement('div');\n temp.innerHTML = html;\n\n // Get all top-level children\n const children = Array.from(temp.children);\n\n // Only convert if there are 2 or more divs\n if (children.length < 2) {\n return html;\n }\n\n // Check if all children are divs with simple content (text or inline elements)\n const allDivs = children.every((child) => child.tagName === 'DIV');\n\n if (!allDivs) {\n return html;\n }\n\n // Check if divs have no attributes (only convert plain divs)\n const hasNoAttributes = children.every((div) => div.attributes.length === 0);\n\n if (!hasNoAttributes) {\n return html;\n }\n\n // Check if divs contain only simple content (no nested block elements)\n const hasOnlySimpleContent = children.every((div) => {\n return Array.from(div.children).every((child) => {\n const tag = child.tagName;\n // Allow inline elements and br tags\n return ['SPAN', 'B', 'I', 'EM', 'STRONG', 'U', 'SUB', 'SUP', 'A', 'CODE', 'BR'].includes(tag);\n });\n });\n\n if (!hasOnlySimpleContent) {\n return html;\n }\n\n // Convert to paragraph with br tags\n const contents = children.map((div) => div.innerHTML);\n return `<p>${contents.join('<br>')}</p>`;\n};\n\nexport const normalizeInitialMarkup = (markup) => {\n const trimmed = String(markup ?? '').trim();\n if (!trimmed) return '<div></div>';\n\n const looksLikeHtml = /<[^>]+>/.test(trimmed);\n if (!looksLikeHtml) {\n return `<div>${escapeHtml(trimmed)}</div>`;\n }\n\n // Apply the div-to-paragraph transformation\n return convertConsecutiveDivsToParagraph(trimmed);\n};\n"],"mappings":";;;;;;AAAA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,GAAG;EAAA,OACrBC,MAAM,CAACD,GAAG,CAAC,CACRE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CACtBA,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACrBA,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACrBA,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CACvBA,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;AAAA;;AAE3B;AACA;AACA;AACA;AACA,IAAMC,iCAAiC,GAAG,SAApCA,iCAAiCA,CAAIC,IAAI,EAAK;EAClD;EACA,IAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAC1CF,IAAI,CAACG,SAAS,GAAGJ,IAAI;;EAErB;EACA,IAAMK,QAAQ,GAAGC,KAAK,CAACC,IAAI,CAACN,IAAI,CAACI,QAAQ,CAAC;;EAE1C;EACA,IAAIA,QAAQ,CAACG,MAAM,GAAG,CAAC,EAAE;IACvB,OAAOR,IAAI;EACb;;EAEA;EACA,IAAMS,OAAO,GAAGJ,QAAQ,CAACK,KAAK,CAAC,UAACC,KAAK;IAAA,OAAKA,KAAK,CAACC,OAAO,KAAK,KAAK;EAAA,EAAC;EAElE,IAAI,CAACH,OAAO,EAAE;IACZ,OAAOT,IAAI;EACb;;EAEA;EACA,IAAMa,eAAe,GAAGR,QAAQ,CAACK,KAAK,CAAC,UAACI,GAAG;IAAA,OAAKA,GAAG,CAACC,UAAU,CAACP,MAAM,KAAK,CAAC;EAAA,EAAC;EAE5E,IAAI,CAACK,eAAe,EAAE;IACpB,OAAOb,IAAI;EACb;;EAEA;EACA,IAAMgB,oBAAoB,GAAGX,QAAQ,CAACK,KAAK,CAAC,UAACI,GAAG,EAAK;IACnD,OAAOR,KAAK,CAACC,IAAI,CAACO,GAAG,CAACT,QAAQ,CAAC,CAACK,KAAK,CAAC,UAACC,KAAK,EAAK;MAC/C,IAAMM,GAAG,GAAGN,KAAK,CAACC,OAAO;MACzB;MACA,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAACM,QAAQ,CAACD,GAAG,CAAC;IAC/F,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,IAAI,CAACD,oBAAoB,EAAE;IACzB,OAAOhB,IAAI;EACb;;EAEA;EACA,IAAMmB,QAAQ,GAAGd,QAAQ,CAACe,GAAG,CAAC,UAACN,GAAG;IAAA,OAAKA,GAAG,CAACV,SAAS;EAAA,EAAC;EACrD,aAAAiB,MAAA,CAAaF,QAAQ,CAACG,IAAI,CAAC,MAAM,CAAC;AACpC,CAAC;AAEM,IAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,SAAzBA,sBAAsBA,CAAIE,MAAM,EAAK;EAChD,IAAMC,OAAO,GAAG7B,MAAM,CAAC4B,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,EAAE,CAAC,CAACE,IAAI,CAAC,CAAC;EAC3C,IAAI,CAACD,OAAO,EAAE,OAAO,aAAa;EAElC,IAAME,aAAa,GAAG,SAAS,CAACC,IAAI,CAACH,OAAO,CAAC;EAC7C,IAAI,CAACE,aAAa,EAAE;IAClB,eAAAP,MAAA,CAAe1B,UAAU,CAAC+B,OAAO,CAAC;EACpC;;EAEA;EACA,OAAO3B,iCAAiC,CAAC2B,OAAO,CAAC;AACnD,CAAC","ignoreList":[]}
|
package/lib/utils/size.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.valueToSize = void 0;
|
|
7
|
-
var valueToSize = exports.valueToSize = function valueToSize(v) {
|
|
8
|
-
if (!v) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
var calcRegex = /^calc\((.*)\)$/;
|
|
12
|
-
if (typeof v === 'string') {
|
|
13
|
-
if (v.endsWith('%')) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
if (v.endsWith('px') || v.endsWith('vh') || v.endsWith('vw') || v.endsWith('ch') || v.endsWith('em') || v.match(calcRegex)) {
|
|
17
|
-
return v;
|
|
18
|
-
}
|
|
19
|
-
var value = parseInt(v, 10);
|
|
20
|
-
return Number.isNaN(value) ? value : "".concat(value, "px");
|
|
21
|
-
}
|
|
22
|
-
if (typeof v === 'number') {
|
|
23
|
-
return "".concat(v, "px");
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=size.js.map
|
package/lib/utils/size.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"size.js","names":["valueToSize","exports","v","calcRegex","endsWith","undefined","match","value","parseInt","Number","isNaN","concat"],"sources":["../../src/utils/size.js"],"sourcesContent":["export const valueToSize = (v) => {\n if (!v) {\n return;\n }\n\n const calcRegex = /^calc\\((.*)\\)$/;\n\n if (typeof v === 'string') {\n if (v.endsWith('%')) {\n return undefined;\n }\n\n if (\n v.endsWith('px') ||\n v.endsWith('vh') ||\n v.endsWith('vw') ||\n v.endsWith('ch') ||\n v.endsWith('em') ||\n v.match(calcRegex)\n ) {\n return v;\n }\n\n const value = parseInt(v, 10);\n\n return Number.isNaN(value) ? value : `${value}px`;\n }\n\n if (typeof v === 'number') {\n return `${v}px`;\n }\n};\n"],"mappings":";;;;;;AAAO,IAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,SAAdA,WAAWA,CAAIE,CAAC,EAAK;EAChC,IAAI,CAACA,CAAC,EAAE;IACN;EACF;EAEA,IAAMC,SAAS,GAAG,gBAAgB;EAElC,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE;IACzB,IAAIA,CAAC,CAACE,QAAQ,CAAC,GAAG,CAAC,EAAE;MACnB,OAAOC,SAAS;IAClB;IAEA,IACEH,CAAC,CAACE,QAAQ,CAAC,IAAI,CAAC,IAChBF,CAAC,CAACE,QAAQ,CAAC,IAAI,CAAC,IAChBF,CAAC,CAACE,QAAQ,CAAC,IAAI,CAAC,IAChBF,CAAC,CAACE,QAAQ,CAAC,IAAI,CAAC,IAChBF,CAAC,CAACE,QAAQ,CAAC,IAAI,CAAC,IAChBF,CAAC,CAACI,KAAK,CAACH,SAAS,CAAC,EAClB;MACA,OAAOD,CAAC;IACV;IAEA,IAAMK,KAAK,GAAGC,QAAQ,CAACN,CAAC,EAAE,EAAE,CAAC;IAE7B,OAAOO,MAAM,CAACC,KAAK,CAACH,KAAK,CAAC,GAAGA,KAAK,MAAAI,MAAA,CAAMJ,KAAK,OAAI;EACnD;EAEA,IAAI,OAAOL,CAAC,KAAK,QAAQ,EAAE;IACzB,UAAAS,MAAA,CAAUT,CAAC;EACb;AACF,CAAC","ignoreList":[]}
|
package/lib/utils/toolbar.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.setToolbarOpened = exports.TOOLBAR_OPENED_META_KEY = void 0;
|
|
7
|
-
var TOOLBAR_OPENED_META_KEY = exports.TOOLBAR_OPENED_META_KEY = 'toolbarOpenedChanged';
|
|
8
|
-
var setToolbarOpened = exports.setToolbarOpened = function setToolbarOpened(editor, opened) {
|
|
9
|
-
var _editor$state;
|
|
10
|
-
var next = !!opened;
|
|
11
|
-
if (editor._toolbarOpened === next) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
editor._toolbarOpened = next;
|
|
15
|
-
if (editor !== null && editor !== void 0 && editor.view && editor !== null && editor !== void 0 && (_editor$state = editor.state) !== null && _editor$state !== void 0 && _editor$state.tr) {
|
|
16
|
-
editor.view.dispatch(editor.state.tr.setMeta(TOOLBAR_OPENED_META_KEY, true));
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=toolbar.js.map
|
package/lib/utils/toolbar.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.js","names":["TOOLBAR_OPENED_META_KEY","exports","setToolbarOpened","editor","opened","_editor$state","next","_toolbarOpened","view","state","tr","dispatch","setMeta"],"sources":["../../src/utils/toolbar.js"],"sourcesContent":["export const TOOLBAR_OPENED_META_KEY = 'toolbarOpenedChanged';\n\nexport const setToolbarOpened = (editor, opened) => {\n const next = !!opened;\n\n if (editor._toolbarOpened === next) {\n return;\n }\n\n editor._toolbarOpened = next;\n\n if (editor?.view && editor?.state?.tr) {\n editor.view.dispatch(editor.state.tr.setMeta(TOOLBAR_OPENED_META_KEY, true));\n }\n};\n"],"mappings":";;;;;;AAAO,IAAMA,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,sBAAsB;AAEtD,IAAME,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAIC,MAAM,EAAEC,MAAM,EAAK;EAAA,IAAAC,aAAA;EAClD,IAAMC,IAAI,GAAG,CAAC,CAACF,MAAM;EAErB,IAAID,MAAM,CAACI,cAAc,KAAKD,IAAI,EAAE;IAClC;EACF;EAEAH,MAAM,CAACI,cAAc,GAAGD,IAAI;EAE5B,IAAIH,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEK,IAAI,IAAIL,MAAM,aAANA,MAAM,gBAAAE,aAAA,GAANF,MAAM,CAAEM,KAAK,cAAAJ,aAAA,eAAbA,aAAA,CAAeK,EAAE,EAAE;IACrCP,MAAM,CAACK,IAAI,CAACG,QAAQ,CAACR,MAAM,CAACM,KAAK,CAACC,EAAE,CAACE,OAAO,CAACZ,uBAAuB,EAAE,IAAI,CAAC,CAAC;EAC9E;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import get from 'lodash-es/get';
|
|
5
|
-
|
|
6
|
-
import { PureToolbar } from '@pie-lib/math-toolbar';
|
|
7
|
-
|
|
8
|
-
import CustomPopper from './characters/custom-popper';
|
|
9
|
-
import { spanishConfig, specialConfig } from './characters/characterUtils';
|
|
10
|
-
|
|
11
|
-
const CharacterIcon = ({ letter }) => (
|
|
12
|
-
<div
|
|
13
|
-
style={{
|
|
14
|
-
fontSize: '24px',
|
|
15
|
-
lineHeight: '24px',
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
{letter}
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
CharacterIcon.propTypes = {
|
|
23
|
-
letter: PropTypes.string,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export function CharacterPicker({ editor, opts, onClose }) {
|
|
27
|
-
if (!opts?.characters?.length) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const containerRef = useRef(null);
|
|
32
|
-
const onCloseRef = useRef(onClose);
|
|
33
|
-
const [position, setPosition] = useState({ top: 0, left: 0 });
|
|
34
|
-
const [popover, setPopover] = useState(null);
|
|
35
|
-
|
|
36
|
-
onCloseRef.current = onClose;
|
|
37
|
-
|
|
38
|
-
const configToUse = useMemo(() => {
|
|
39
|
-
if (!opts) return spanishConfig;
|
|
40
|
-
|
|
41
|
-
switch (true) {
|
|
42
|
-
case opts.language === 'spanish':
|
|
43
|
-
return spanishConfig;
|
|
44
|
-
case opts.language === 'special':
|
|
45
|
-
return specialConfig;
|
|
46
|
-
default:
|
|
47
|
-
return opts;
|
|
48
|
-
}
|
|
49
|
-
}, [opts]);
|
|
50
|
-
|
|
51
|
-
const layoutForCharacters = useMemo(
|
|
52
|
-
() =>
|
|
53
|
-
configToUse.characters.reduce(
|
|
54
|
-
(obj, arr) => {
|
|
55
|
-
if (arr.length >= obj.columns) {
|
|
56
|
-
obj.columns = arr.length;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return obj;
|
|
60
|
-
},
|
|
61
|
-
{ rows: configToUse.characters.length, columns: 0 },
|
|
62
|
-
),
|
|
63
|
-
[configToUse],
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const closePopOver = () => setPopover(null);
|
|
67
|
-
|
|
68
|
-
useEffect(
|
|
69
|
-
() => () => {
|
|
70
|
-
closePopOver();
|
|
71
|
-
},
|
|
72
|
-
[],
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
// Keep `onClose` out of the dependency array — parents often pass a new callback each
|
|
76
|
-
// render (e.g. after each keystroke), which would re-run this effect constantly. Use a
|
|
77
|
-
// ref so click-outside always calls the latest close handler.
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
if (!editor) return;
|
|
80
|
-
|
|
81
|
-
const editorDOM = editor.options.element;
|
|
82
|
-
const editorViewDom = editor.view.dom;
|
|
83
|
-
|
|
84
|
-
// Position is computed in viewport coordinates (the dialog uses position: fixed),
|
|
85
|
-
// so coordsAtPos / getBoundingClientRect values can be used directly without
|
|
86
|
-
// adding scroll offsets. The dialog is then clamped to the viewport so it does
|
|
87
|
-
// not get cut off by fixed page headers/footers.
|
|
88
|
-
const updatePosition = () => {
|
|
89
|
-
if (!containerRef.current) return;
|
|
90
|
-
|
|
91
|
-
const editorRect = editorDOM.getBoundingClientRect();
|
|
92
|
-
const { from } = editor.state.selection;
|
|
93
|
-
const start = editor.view.coordsAtPos(from);
|
|
94
|
-
|
|
95
|
-
const dialogHeight = containerRef.current.offsetHeight;
|
|
96
|
-
const dialogWidth = containerRef.current.offsetWidth;
|
|
97
|
-
|
|
98
|
-
// prefer below the editor; flip above when there isn't room below.
|
|
99
|
-
const spaceBelow = window.innerHeight - (editorRect.bottom + 60);
|
|
100
|
-
let top =
|
|
101
|
-
spaceBelow >= dialogHeight || editorRect.top < dialogHeight + 80
|
|
102
|
-
? editorRect.bottom + 60
|
|
103
|
-
: editorRect.top - dialogHeight - 20;
|
|
104
|
-
|
|
105
|
-
let left = start.left;
|
|
106
|
-
|
|
107
|
-
const margin = 8;
|
|
108
|
-
top = Math.max(margin, Math.min(top, window.innerHeight - dialogHeight - margin));
|
|
109
|
-
left = Math.max(margin, Math.min(left, window.innerWidth - dialogWidth - margin));
|
|
110
|
-
|
|
111
|
-
setPosition({ top, left });
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
updatePosition();
|
|
115
|
-
|
|
116
|
-
let frame = null;
|
|
117
|
-
const scheduleUpdate = () => {
|
|
118
|
-
if (frame !== null) return;
|
|
119
|
-
frame = requestAnimationFrame(() => {
|
|
120
|
-
frame = null;
|
|
121
|
-
updatePosition();
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
window.addEventListener('scroll', scheduleUpdate, true);
|
|
126
|
-
window.addEventListener('resize', scheduleUpdate);
|
|
127
|
-
|
|
128
|
-
const handleClickOutside = (e) => {
|
|
129
|
-
if (containerRef.current && !containerRef.current.contains(e.target) && !editorViewDom.contains(e.target)) {
|
|
130
|
-
onCloseRef.current();
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const timeoutId = setTimeout(() => {
|
|
135
|
-
document.addEventListener('click', handleClickOutside);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
return () => {
|
|
139
|
-
clearTimeout(timeoutId);
|
|
140
|
-
if (frame !== null) cancelAnimationFrame(frame);
|
|
141
|
-
window.removeEventListener('scroll', scheduleUpdate, true);
|
|
142
|
-
window.removeEventListener('resize', scheduleUpdate);
|
|
143
|
-
document.removeEventListener('click', handleClickOutside);
|
|
144
|
-
};
|
|
145
|
-
}, [editor]);
|
|
146
|
-
|
|
147
|
-
const renderPopOver = (event, el) => setPopover({ anchorEl: event.currentTarget, el });
|
|
148
|
-
|
|
149
|
-
const handleChange = (val) => {
|
|
150
|
-
if (typeof val === 'string') {
|
|
151
|
-
editor.chain().focus().insertContent(val).run();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
return (
|
|
156
|
-
<>
|
|
157
|
-
{ReactDOM.createPortal(
|
|
158
|
-
<div
|
|
159
|
-
ref={containerRef}
|
|
160
|
-
className="insert-character-dialog"
|
|
161
|
-
data-toolbar-for={editor.instanceId}
|
|
162
|
-
style={{
|
|
163
|
-
visibility: position.top === 0 && position.left === 0 ? 'hidden' : 'initial',
|
|
164
|
-
position: 'fixed',
|
|
165
|
-
top: `${position.top}px`,
|
|
166
|
-
left: `${position.left}px`,
|
|
167
|
-
maxWidth: '500px',
|
|
168
|
-
zIndex: 1000,
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
<div>
|
|
172
|
-
<PureToolbar
|
|
173
|
-
keyPadCharacterRef={opts.keyPadCharacterRef}
|
|
174
|
-
setKeypadInteraction={opts.setKeypadInteraction}
|
|
175
|
-
autoFocus
|
|
176
|
-
noDecimal
|
|
177
|
-
hideInput
|
|
178
|
-
noLatexHandling
|
|
179
|
-
hideDoneButtonBackground
|
|
180
|
-
layoutForKeyPad={layoutForCharacters}
|
|
181
|
-
additionalKeys={configToUse.characters.reduce((arr, n) => {
|
|
182
|
-
arr = [
|
|
183
|
-
...arr,
|
|
184
|
-
...n.map((k) => ({
|
|
185
|
-
name: get(k, 'name') || k,
|
|
186
|
-
write: get(k, 'write') || k,
|
|
187
|
-
label: get(k, 'label') || k,
|
|
188
|
-
category: 'character',
|
|
189
|
-
extraClass: 'character',
|
|
190
|
-
extraProps: {
|
|
191
|
-
...(k.extraProps || {}),
|
|
192
|
-
style: {
|
|
193
|
-
...(k.extraProps || {}).style,
|
|
194
|
-
border: '1px solid #000',
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
...(configToUse.hasPreview
|
|
198
|
-
? {
|
|
199
|
-
actions: {
|
|
200
|
-
onMouseEnter: (ev) => renderPopOver(ev, k),
|
|
201
|
-
onMouseLeave: closePopOver,
|
|
202
|
-
},
|
|
203
|
-
}
|
|
204
|
-
: {}),
|
|
205
|
-
})),
|
|
206
|
-
];
|
|
207
|
-
|
|
208
|
-
return arr;
|
|
209
|
-
}, [])}
|
|
210
|
-
keypadMode="language"
|
|
211
|
-
onChange={handleChange}
|
|
212
|
-
onDone={onClose}
|
|
213
|
-
/>
|
|
214
|
-
</div>
|
|
215
|
-
</div>,
|
|
216
|
-
document.body,
|
|
217
|
-
)}
|
|
218
|
-
{popover &&
|
|
219
|
-
ReactDOM.createPortal(
|
|
220
|
-
<CustomPopper onClose={closePopOver} anchorEl={popover.anchorEl}>
|
|
221
|
-
<div>{popover.el.label}</div>
|
|
222
|
-
<div style={{ fontSize: 20, lineHeight: '20px' }}>{popover.el.description}</div>
|
|
223
|
-
<div style={{ fontSize: 20, lineHeight: '20px' }}>{popover.el.unicode}</div>
|
|
224
|
-
</CustomPopper>,
|
|
225
|
-
document.body,
|
|
226
|
-
)}
|
|
227
|
-
</>
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
CharacterPicker.propTypes = {
|
|
232
|
-
editor: PropTypes.object,
|
|
233
|
-
opts: PropTypes.object,
|
|
234
|
-
onClose: PropTypes.func.isRequired,
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
export { CharacterIcon };
|