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 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 = "_toolbar_16b09_2";
985
- const inner = "_inner_16b09_15";
986
- const btn = "_btn_16b09_27";
987
- const btnActive = "_btnActive_16b09_50";
988
- const tableBubble = "_tableBubble_16b09_66";
989
- const txtIcon = "_txtIcon_16b09_78";
990
- const colorIcon = "_colorIcon_16b09_86";
991
- const colorIconGlyph = "_colorIconGlyph_16b09_94";
992
- const colorIconBar = "_colorIconBar_16b09_100";
993
- const scriptTrigger = "_scriptTrigger_16b09_107";
994
- const scriptTriggerGlyph = "_scriptTriggerGlyph_16b09_127";
995
- const divider = "_divider_16b09_135";
996
- const styleTrigger = "_styleTrigger_16b09_144";
997
- const styleTriggerLabel = "_styleTriggerLabel_16b09_173";
998
- const styleTriggerCaret = "_styleTriggerCaret_16b09_181";
999
- const styleItem = "_styleItem_16b09_187";
1000
- const styleIcon = "_styleIcon_16b09_193";
1001
- const scriptGlyph = "_scriptGlyph_16b09_203";
1002
- const menu = "_menu_16b09_215";
1003
- const menuItem = "_menuItem_16b09_226";
1004
- const menuItemSelected = "_menuItemSelected_16b09_252";
1005
- const popoverContent$1 = "_popoverContent_16b09_266";
1006
- const mathLayer = "_mathLayer_16b09_270";
1007
- const mathStack = "_mathStack_16b09_275";
1008
- const mathStackBlock = "_mathStackBlock_16b09_282";
1009
- const mathHint = "_mathHint_16b09_287";
1010
- const mathHintBlock = "_mathHintBlock_16b09_299";
1011
- const mathHintIcon = "_mathHintIcon_16b09_305";
1012
- const mathPreviewInline = "_mathPreviewInline_16b09_311";
1013
- const mathPreviewBlock = "_mathPreviewBlock_16b09_321";
1014
- const mathField = "_mathField_16b09_336";
1015
- const mathFieldBlock = "_mathFieldBlock_16b09_348";
1016
- const mathInput = "_mathInput_16b09_355";
1017
- const mathDone = "_mathDone_16b09_373";
1018
- const mathDoneKbd = "_mathDoneKbd_16b09_398";
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 = () => setLayerStyle(getMathLayerStyle(editor, kind, mode, pos));
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
  ),