tiptap-markdown-react 0.8.2 → 0.8.3
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/index.js +47 -36
- package/dist/index.js.map +1 -1
- package/dist/style.css +82 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -981,41 +981,41 @@ function insertMarkdown(editor, markdown, sources = []) {
|
|
|
981
981
|
const prepared = enrichMarkdownCitations(markdown, sources);
|
|
982
982
|
editor.chain().focus().insertContent(prepared, { contentType: "markdown" }).run();
|
|
983
983
|
}
|
|
984
|
-
const toolbar = "
|
|
985
|
-
const inner = "
|
|
986
|
-
const btn = "
|
|
987
|
-
const btnActive = "
|
|
988
|
-
const tableBubble = "
|
|
989
|
-
const txtIcon = "
|
|
990
|
-
const colorIcon = "
|
|
991
|
-
const colorIconGlyph = "
|
|
992
|
-
const colorIconBar = "
|
|
993
|
-
const scriptTrigger = "
|
|
994
|
-
const scriptTriggerGlyph = "
|
|
995
|
-
const divider = "
|
|
996
|
-
const styleTrigger = "
|
|
997
|
-
const styleTriggerLabel = "
|
|
998
|
-
const styleTriggerCaret = "
|
|
999
|
-
const styleItem = "
|
|
1000
|
-
const styleIcon = "
|
|
1001
|
-
const scriptGlyph = "
|
|
1002
|
-
const menu = "
|
|
1003
|
-
const menuItem = "
|
|
1004
|
-
const menuItemSelected = "
|
|
1005
|
-
const popoverContent$1 = "
|
|
1006
|
-
const mathLayer = "
|
|
1007
|
-
const mathStack = "
|
|
1008
|
-
const mathStackBlock = "
|
|
1009
|
-
const mathHint = "
|
|
1010
|
-
const mathHintBlock = "
|
|
1011
|
-
const mathHintIcon = "
|
|
1012
|
-
const mathPreviewInline = "
|
|
1013
|
-
const mathPreviewBlock = "
|
|
1014
|
-
const mathField = "
|
|
1015
|
-
const mathFieldBlock = "
|
|
1016
|
-
const mathInput = "
|
|
1017
|
-
const mathDone = "
|
|
1018
|
-
const mathDoneKbd = "
|
|
984
|
+
const toolbar = "_toolbar_w3tos_2";
|
|
985
|
+
const inner = "_inner_w3tos_15";
|
|
986
|
+
const btn = "_btn_w3tos_27";
|
|
987
|
+
const btnActive = "_btnActive_w3tos_50";
|
|
988
|
+
const tableBubble = "_tableBubble_w3tos_66";
|
|
989
|
+
const txtIcon = "_txtIcon_w3tos_78";
|
|
990
|
+
const colorIcon = "_colorIcon_w3tos_86";
|
|
991
|
+
const colorIconGlyph = "_colorIconGlyph_w3tos_94";
|
|
992
|
+
const colorIconBar = "_colorIconBar_w3tos_100";
|
|
993
|
+
const scriptTrigger = "_scriptTrigger_w3tos_107";
|
|
994
|
+
const scriptTriggerGlyph = "_scriptTriggerGlyph_w3tos_127";
|
|
995
|
+
const divider = "_divider_w3tos_135";
|
|
996
|
+
const styleTrigger = "_styleTrigger_w3tos_144";
|
|
997
|
+
const styleTriggerLabel = "_styleTriggerLabel_w3tos_173";
|
|
998
|
+
const styleTriggerCaret = "_styleTriggerCaret_w3tos_181";
|
|
999
|
+
const styleItem = "_styleItem_w3tos_187";
|
|
1000
|
+
const styleIcon = "_styleIcon_w3tos_193";
|
|
1001
|
+
const scriptGlyph = "_scriptGlyph_w3tos_203";
|
|
1002
|
+
const menu = "_menu_w3tos_215";
|
|
1003
|
+
const menuItem = "_menuItem_w3tos_226";
|
|
1004
|
+
const menuItemSelected = "_menuItemSelected_w3tos_252";
|
|
1005
|
+
const popoverContent$1 = "_popoverContent_w3tos_266";
|
|
1006
|
+
const mathLayer = "_mathLayer_w3tos_270";
|
|
1007
|
+
const mathStack = "_mathStack_w3tos_275";
|
|
1008
|
+
const mathStackBlock = "_mathStackBlock_w3tos_282";
|
|
1009
|
+
const mathHint = "_mathHint_w3tos_287";
|
|
1010
|
+
const mathHintBlock = "_mathHintBlock_w3tos_299";
|
|
1011
|
+
const mathHintIcon = "_mathHintIcon_w3tos_305";
|
|
1012
|
+
const mathPreviewInline = "_mathPreviewInline_w3tos_311";
|
|
1013
|
+
const mathPreviewBlock = "_mathPreviewBlock_w3tos_337";
|
|
1014
|
+
const mathField = "_mathField_w3tos_367";
|
|
1015
|
+
const mathFieldBlock = "_mathFieldBlock_w3tos_379";
|
|
1016
|
+
const mathInput = "_mathInput_w3tos_386";
|
|
1017
|
+
const mathDone = "_mathDone_w3tos_404";
|
|
1018
|
+
const mathDoneKbd = "_mathDoneKbd_w3tos_429";
|
|
1019
1019
|
const styles$3 = {
|
|
1020
1020
|
toolbar,
|
|
1021
1021
|
inner,
|
|
@@ -1134,6 +1134,10 @@ function resolveNodeEl(editor, pos) {
|
|
|
1134
1134
|
if (dom instanceof Node) return dom.parentElement;
|
|
1135
1135
|
return null;
|
|
1136
1136
|
}
|
|
1137
|
+
function getMathPreviewFontSize(editor, pos) {
|
|
1138
|
+
const el = pos != null ? resolveNodeEl(editor, pos) : null;
|
|
1139
|
+
return getComputedStyle(el ?? editor.view.dom).fontSize;
|
|
1140
|
+
}
|
|
1137
1141
|
function getMathLayerStyle(editor, kind, mode, pos) {
|
|
1138
1142
|
const host = editor.view.dom.parentElement;
|
|
1139
1143
|
if (!host) return {};
|
|
@@ -1187,6 +1191,9 @@ function MathEditorPopover({
|
|
|
1187
1191
|
const [layerStyle, setLayerStyle] = useState(
|
|
1188
1192
|
() => getMathLayerStyle(editor, kind, mode, pos)
|
|
1189
1193
|
);
|
|
1194
|
+
const [previewFontSize, setPreviewFontSize] = useState(
|
|
1195
|
+
() => getMathPreviewFontSize(editor, pos)
|
|
1196
|
+
);
|
|
1190
1197
|
const titleId = useId();
|
|
1191
1198
|
const inputRef = useRef(null);
|
|
1192
1199
|
const rootRef = useRef(null);
|
|
@@ -1196,7 +1203,10 @@ function MathEditorPopover({
|
|
|
1196
1203
|
setDraft(latex);
|
|
1197
1204
|
}, [latex]);
|
|
1198
1205
|
useEffect(() => {
|
|
1199
|
-
const update = () =>
|
|
1206
|
+
const update = () => {
|
|
1207
|
+
setLayerStyle(getMathLayerStyle(editor, kind, mode, pos));
|
|
1208
|
+
setPreviewFontSize(getMathPreviewFontSize(editor, pos));
|
|
1209
|
+
};
|
|
1200
1210
|
update();
|
|
1201
1211
|
window.addEventListener("resize", update);
|
|
1202
1212
|
return () => window.removeEventListener("resize", update);
|
|
@@ -1301,6 +1311,7 @@ function MathEditorPopover({
|
|
|
1301
1311
|
{
|
|
1302
1312
|
id: titleId,
|
|
1303
1313
|
className: isBlock ? styles$3.mathPreviewBlock : styles$3.mathPreviewInline,
|
|
1314
|
+
style: { fontSize: previewFontSize },
|
|
1304
1315
|
dangerouslySetInnerHTML: { __html: preview }
|
|
1305
1316
|
}
|
|
1306
1317
|
),
|