@krainovsd/markdown-editor 0.4.0 → 0.4.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.
Files changed (61) hide show
  1. package/lib/cjs/{index-Dj0jRUGF.js → index-BZIT2oN2.js} +51 -47
  2. package/lib/cjs/index-BZIT2oN2.js.map +1 -0
  3. package/lib/cjs/{index-CXENq_0E.js → index-s-eevZJW.js} +2 -2
  4. package/lib/cjs/{index-CXENq_0E.js.map → index-s-eevZJW.js.map} +1 -1
  5. package/lib/cjs/index.js +1 -1
  6. package/lib/esm/extensions/auto-completes/custom/tag-auto-complete.js.map +1 -1
  7. package/lib/esm/extensions/init-extensions.js +2 -2
  8. package/lib/esm/extensions/init-extensions.js.map +1 -1
  9. package/lib/esm/extensions/keymaps/init-key-map.js +3 -9
  10. package/lib/esm/extensions/keymaps/init-key-map.js.map +1 -1
  11. package/lib/esm/extensions/listeners/get-change-event.js +3 -3
  12. package/lib/esm/extensions/listeners/get-change-event.js.map +1 -1
  13. package/lib/esm/extensions/listeners/get-focus-event.js +3 -3
  14. package/lib/esm/extensions/listeners/get-focus-event.js.map +1 -1
  15. package/lib/esm/extensions/markdown/blockquote/blockquote-decoration.js +1 -1
  16. package/lib/esm/extensions/markdown/blockquote/blockquote-decoration.js.map +1 -1
  17. package/lib/esm/extensions/markdown/bold/bold-decoration.js +1 -1
  18. package/lib/esm/extensions/markdown/code/code-decoration.js +3 -3
  19. package/lib/esm/extensions/markdown/code/code-decoration.js.map +1 -1
  20. package/lib/esm/extensions/markdown/header/header-decoration.js +1 -1
  21. package/lib/esm/extensions/markdown/image/image-decoration.js.map +1 -1
  22. package/lib/esm/extensions/markdown/image/image-widget.js +2 -1
  23. package/lib/esm/extensions/markdown/image/image-widget.js.map +1 -1
  24. package/lib/esm/extensions/markdown/italic/italic-decoration.js +2 -2
  25. package/lib/esm/extensions/markdown/italic/italic-decoration.js.map +1 -1
  26. package/lib/esm/extensions/markdown/link/link-decoration.js +1 -1
  27. package/lib/esm/extensions/markdown/link/link-decoration.js.map +1 -1
  28. package/lib/esm/extensions/markdown/link/link-widget.js +5 -2
  29. package/lib/esm/extensions/markdown/link/link-widget.js.map +1 -1
  30. package/lib/esm/extensions/markdown/list/list-decoration.js +1 -1
  31. package/lib/esm/extensions/markdown/list/list-decoration.js.map +1 -1
  32. package/lib/esm/extensions/markdown/markdown-decoration.js +2 -2
  33. package/lib/esm/extensions/markdown/markdown-decoration.js.map +1 -1
  34. package/lib/esm/extensions/markdown/mention/mention-decoration.js +1 -1
  35. package/lib/esm/extensions/markdown/mention/mention-parser.js.map +1 -1
  36. package/lib/esm/extensions/markdown/strike-through/strike-through-decoration.js +1 -1
  37. package/lib/esm/extensions/markdown/styles.module.scss.js +2 -2
  38. package/lib/esm/extensions/markdown/todo/todo-decoration.js +1 -1
  39. package/lib/esm/extensions/markdown/todo/todo-decoration.js.map +1 -1
  40. package/lib/esm/extensions/settings/init-settings.js +2 -2
  41. package/lib/esm/extensions/settings/init-settings.js.map +1 -1
  42. package/lib/esm/extensions/theme/themes/get-dark-theme.js +3 -2
  43. package/lib/esm/extensions/theme/themes/get-dark-theme.js.map +1 -1
  44. package/lib/esm/extensions/theme/themes/get-highlight-template.js +4 -1
  45. package/lib/esm/extensions/theme/themes/get-highlight-template.js.map +1 -1
  46. package/lib/esm/extensions/theme/themes/get-light-theme.js +3 -2
  47. package/lib/esm/extensions/theme/themes/get-light-theme.js.map +1 -1
  48. package/lib/esm/extensions/theme/themes/get-theme-template.js +3 -0
  49. package/lib/esm/extensions/theme/themes/get-theme-template.js.map +1 -1
  50. package/lib/esm/lib/utils/overlap-mark.js +5 -2
  51. package/lib/esm/lib/utils/overlap-mark.js.map +1 -1
  52. package/lib/esm/module/Editor/Editor.js +2 -6
  53. package/lib/esm/module/Editor/Editor.js.map +1 -1
  54. package/lib/esm/module/Editor/lib/init-editor-provider.js +2 -3
  55. package/lib/esm/module/Editor/lib/init-editor-provider.js.map +1 -1
  56. package/lib/esm/module/Editor/lib/init-editor.js +1 -1
  57. package/lib/esm/module/Editor/lib/init-editor.js.map +1 -1
  58. package/lib/esm/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js.map +1 -1
  59. package/lib/index.d.ts +2 -1
  60. package/package.json +18 -29
  61. package/lib/cjs/index-Dj0jRUGF.js.map +0 -1
@@ -174,6 +174,7 @@ function overlapMark({ marks, shift, state, requireMatched }) {
174
174
  originalText: text.substring(shiftBeforeOuter, text.length - shiftAfterOuter),
175
175
  };
176
176
  }
177
+ // eslint-disable-next-line max-params
177
178
  function findMarkIndex(text, marks, requireMatched, direction = "right") {
178
179
  if (text.length === 0)
179
180
  return -1;
@@ -201,8 +202,10 @@ function findMarkIndex(text, marks, requireMatched, direction = "right") {
201
202
  const posMin = pos - minRequired;
202
203
  const posMax = pos - matched;
203
204
  // console.log({ posMin, posMax, pos, minRequired, maxRequired, direction, matched });
205
+ // eslint-disable-next-line max-depth
204
206
  if (direction === "right" && posMin > start)
205
207
  start = posMin;
208
+ // eslint-disable-next-line max-depth
206
209
  if (direction === "left" && (posMax < start || start === -1))
207
210
  start = posMax;
208
211
  }
@@ -262,7 +265,7 @@ function processShiftContent(state, shift, marks) {
262
265
  if (initialText.length > 1)
263
266
  while (pos < initialText.length) {
264
267
  // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations
265
- if (marks.some((m) => m === initialText.codePointAt(pos)))
268
+ if (marks.some((mark) => mark === initialText.codePointAt(pos)))
266
269
  shiftBeforeInner++;
267
270
  else
268
271
  break;
@@ -274,7 +277,7 @@ function processShiftContent(state, shift, marks) {
274
277
  if (initialText.length > 1 || shiftBeforeInner > 0)
275
278
  while (pos > -1) {
276
279
  // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations
277
- if (marks.some((m) => m === initialTextWithoutBeforeShift.codePointAt(pos)))
280
+ if (marks.some((mark) => mark === initialTextWithoutBeforeShift.codePointAt(pos)))
278
281
  shiftAfterInner++;
279
282
  else
280
283
  break;
@@ -306,7 +309,10 @@ function getHighlightTemplate(config) {
306
309
  color: config.string,
307
310
  },
308
311
  { tag: [highlight.tags.function(highlight.tags.variableName), highlight.tags.labelName], color: config.function },
309
- { tag: [highlight.tags.color, highlight.tags.constant(highlight.tags.name), highlight.tags.standard(highlight.tags.name)], color: config.constant },
312
+ {
313
+ tag: [highlight.tags.color, highlight.tags.constant(highlight.tags.name), highlight.tags.standard(highlight.tags.name)],
314
+ color: config.constant,
315
+ },
310
316
  { tag: [highlight.tags.definition(highlight.tags.name), highlight.tags.separator], color: config.variable },
311
317
  { tag: [highlight.tags.className], color: config.class },
312
318
  {
@@ -366,6 +372,9 @@ function getThemeTemplate(dark, config) {
366
372
  background: config.codeBackground,
367
373
  color: config.codeColor,
368
374
  },
375
+ [`div.${CLASSES.code}`]: {
376
+ fontFamily: config.codeFontFamily,
377
+ },
369
378
  [`.${CLASSES.horizontal}`]: {
370
379
  borderBottomColor: config.horizontalColor,
371
380
  },
@@ -432,6 +441,7 @@ const THEME_CONFIG$1 = {
432
441
  codeColor: "#DDDDDD",
433
442
  color: "#DDDDDD",
434
443
  fontFamily: "Montserrat",
444
+ codeFontFamily: "Consolas",
435
445
  horizontalColor: "#DDDDDD",
436
446
  linkColor: "#8A5CF5",
437
447
  mentionColor: "#8A5CF5",
@@ -441,8 +451,8 @@ const THEME_CONFIG$1 = {
441
451
  codeBlockBackground: "#24292e",
442
452
  };
443
453
  function getDarkTheme({ dark }) {
444
- const highlightConfig = { ...HIGHLIGHT_CONFIG$1, ...(dark?.highlightConfig || {}) };
445
- const themeConfig = { ...THEME_CONFIG$1, ...(dark?.themeConfig || {}) };
454
+ const highlightConfig = { ...HIGHLIGHT_CONFIG$1, ...(dark?.highlightConfig ?? {}) };
455
+ const themeConfig = { ...THEME_CONFIG$1, ...(dark?.themeConfig ?? {}) };
446
456
  return [getThemeTemplate(true, themeConfig), getHighlightTemplate(highlightConfig)];
447
457
  }
448
458
 
@@ -469,6 +479,7 @@ const THEME_CONFIG = {
469
479
  codeColor: "#000000",
470
480
  color: "#000000",
471
481
  fontFamily: "Montserrat",
482
+ codeFontFamily: "Consolas",
472
483
  horizontalColor: "#000000",
473
484
  linkColor: "#8A5CF5",
474
485
  mentionColor: "#8A5CF5",
@@ -478,8 +489,8 @@ const THEME_CONFIG = {
478
489
  codeBlockBorderColor: "##CCCCCDFF",
479
490
  };
480
491
  function getLightTheme({ light }) {
481
- const highlightConfig = { ...HIGHLIGHT_CONFIG, ...(light?.highlightConfig || {}) };
482
- const themeConfig = { ...THEME_CONFIG, ...(light?.themeConfig || {}) };
492
+ const highlightConfig = { ...HIGHLIGHT_CONFIG, ...(light?.highlightConfig ?? {}) };
493
+ const themeConfig = { ...THEME_CONFIG, ...(light?.themeConfig ?? {}) };
483
494
  return [getThemeTemplate(false, themeConfig), getHighlightTemplate(highlightConfig)];
484
495
  }
485
496
 
@@ -662,15 +673,9 @@ const initKeyMaps = async ({ onEnter, onEscape, multiCursorMode, keyMaps, defaul
662
673
  view.dispatch({
663
674
  effects: ThemeCompartment.reconfigure(theme === "dark"
664
675
  ? getDarkTheme({
665
- dark,
666
- light,
667
- theme,
668
- })
676
+ dark})
669
677
  : getLightTheme({
670
- dark,
671
- light,
672
- theme,
673
- })),
678
+ light})),
674
679
  });
675
680
  });
676
681
  return true;
@@ -702,9 +707,9 @@ const initKeyMaps = async ({ onEnter, onEscape, multiCursorMode, keyMaps, defaul
702
707
 
703
708
  function getChangeEvent({ onChange }) {
704
709
  return onChange
705
- ? view.EditorView.updateListener.of((e) => {
706
- if (e.docChanged) {
707
- onChange(e);
710
+ ? view.EditorView.updateListener.of((event) => {
711
+ if (event.docChanged) {
712
+ onChange(event);
708
713
  }
709
714
  })
710
715
  : [];
@@ -712,11 +717,11 @@ function getChangeEvent({ onChange }) {
712
717
 
713
718
  function getFocusEvent({ onBlur, onFocus }) {
714
719
  return onFocus || onBlur
715
- ? view.EditorView.focusChangeEffect.of((e, focus) => {
720
+ ? view.EditorView.focusChangeEffect.of((event, focus) => {
716
721
  if (focus && onFocus)
717
- onFocus(e);
722
+ onFocus(event);
718
723
  else if (!focus && onBlur)
719
- onBlur(e);
724
+ onBlur(event);
720
725
  return null;
721
726
  })
722
727
  : [];
@@ -753,8 +758,8 @@ function styleInject(css, ref) {
753
758
  }
754
759
  }
755
760
 
756
- var css_248z = "._header_XFwV5{font-weight:700}._header_XFwV5._level_1_-KPph{font-size:2em}._header_XFwV5._level_2_ecHlB{font-size:1.8em}._header_XFwV5._level_3_SYcVr{font-size:1.6em}._header_XFwV5._level_4_V3o5m{font-size:1.4em}._header_XFwV5._level_5_I7eVk{font-size:1.3em}._header_XFwV5._level_6_A3lbK{font-size:1.2em}._bold_I8DT-{font-weight:700}._italic_72qBe{font-style:italic}._blockquote_Xq6O4{border-left:3px solid;margin-left:5px}._blockquote__inner_mjT0h{margin-left:1px;padding-left:5px;position:relative}._blockquote__inner_mjT0h:before{border-left:3px solid;content:\"\";height:140%;left:0;position:absolute;top:-3px}._blockquote__inner-deep_s6tNj{margin-left:5px}._strike-through_U64jP{text-decoration:line-through}._list_MHIjT._common_0GdDi{position:relative;visibility:hidden}._list_MHIjT._common_0GdDi:after{border-radius:100%;content:\"\";height:5px;left:0;position:absolute;top:50%;transform:translateY(-50%);visibility:visible;width:5px}._link_7U9wl{text-decoration:none;text-decoration:underline}._link__label_dHGGf{font-size:12px;position:relative;top:-4px}._image_KmBM8{display:inline-flex}._code__line_m3IiO{padding:5px;position:relative}._code__line_m3IiO,._code__single_hbMte{font-family:monospace}._code__button_WwYE-{background-color:transparent;border:none;border-radius:4px;box-shadow:none;cursor:pointer;min-width:30px;outline:none;padding:4px 10px;position:absolute;right:5px;top:5px;transition:all .3s ease;z-index:1}._code__button_WwYE-._pending_fgHgD:before{animation:_loading-btn--fade-in_8z5an .33s ease,_loading-btn--rotation_QaopN .66s linear 0s infinite;border:2px solid hsla(0,0%,100%,.33);border-radius:50%;border-top-color:#000;content:\"\";display:inline-block;height:10.5px;left:50%;position:absolute;top:50%;width:10.5px}._code__button_WwYE-._success_kUPnO:after{animation:_loading-btn--fade-in_8z5an .6s ease;border-color:currentcolor;border-style:solid;border-width:0 0 1px 1px;content:\"\";display:inline-block;height:7px;left:50%;position:absolute;top:50%;transform:translate(-50%,-75%) rotate(-45deg);width:11px}._code__button_WwYE-._fail_cOpap:after,._code__button_WwYE-._fail_cOpap:before{content:\" \";height:13px;left:50%;position:absolute;top:50%;width:1px}._code__button_WwYE-._fail_cOpap:before{transform:translate(-50%,-50%) rotate(45deg)}._code__button_WwYE-._fail_cOpap:after{transform:translate(-50%,-50%) rotate(-45deg)}@keyframes _loading-btn--fade-in_8z5an{0%{opacity:0}to{opacity:1}}@keyframes _loading-btn--rotation_QaopN{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}._code__span_iSCmj{opacity:1;transition:opacity .3s ease}._code__span_iSCmj._hide_uqpax{opacity:0}._code__block_JehA4{padding:1px 5px}._code__block_line_U7lcQ{border-left:1px solid;margin-left:5px}._horizontal_J1jU-{border-bottom:1px solid;margin:0 5px;position:relative;width:calc(100% - 10px)}._todo_m6MIP{align-items:flex-end;display:inline-flex;height:100%;padding-left:3px;padding-right:3px}._todo_m6MIP>input{margin:0}._todo__checked_kemjy{text-decoration:line-through}._mention_cpzik{font-weight:700}";
757
- const styles = {"header":"_header_XFwV5","level_1":"_level_1_-KPph","level_2":"_level_2_ecHlB","level_3":"_level_3_SYcVr","level_4":"_level_4_V3o5m","level_5":"_level_5_I7eVk","level_6":"_level_6_A3lbK","bold":"_bold_I8DT-","italic":"_italic_72qBe","blockquote":"_blockquote_Xq6O4","blockquote__inner":"_blockquote__inner_mjT0h","blockquote__inner-deep":"_blockquote__inner-deep_s6tNj","strike-through":"_strike-through_U64jP","list":"_list_MHIjT","common":"_common_0GdDi","link":"_link_7U9wl","link__label":"_link__label_dHGGf","image":"_image_KmBM8","code__line":"_code__line_m3IiO","code__single":"_code__single_hbMte","code__button":"_code__button_WwYE-","pending":"_pending_fgHgD","loading-btn--fade-in":"_loading-btn--fade-in_8z5an","loading-btn--rotation":"_loading-btn--rotation_QaopN","success":"_success_kUPnO","fail":"_fail_cOpap","code__span":"_code__span_iSCmj","hide":"_hide_uqpax","code__block":"_code__block_JehA4","code__block_line":"_code__block_line_U7lcQ","horizontal":"_horizontal_J1jU-","todo":"_todo_m6MIP","todo__checked":"_todo__checked_kemjy","mention":"_mention_cpzik"};
761
+ var css_248z = "._header_XFwV5{font-weight:700}._header_XFwV5._level_1_-KPph{font-size:2em}._header_XFwV5._level_2_ecHlB{font-size:1.8em}._header_XFwV5._level_3_SYcVr{font-size:1.6em}._header_XFwV5._level_4_V3o5m{font-size:1.4em}._header_XFwV5._level_5_I7eVk{font-size:1.3em}._header_XFwV5._level_6_A3lbK{font-size:1.2em}._bold_I8DT-{font-weight:700}._italic_72qBe{font-style:italic}._blockquote_Xq6O4{border-left:3px solid;margin-left:5px}._blockquote__inner_mjT0h{margin-left:1px;padding-left:5px;position:relative}._blockquote__inner_mjT0h:before{border-left:3px solid;content:\"\";height:140%;left:0;position:absolute;top:-3px}._blockquote__inner-deep_s6tNj{margin-left:5px}._strike-through_U64jP{text-decoration:line-through}._list_MHIjT._common_0GdDi{position:relative;visibility:hidden}._list_MHIjT._common_0GdDi:after{border-radius:100%;content:\"\";height:5px;left:0;position:absolute;top:50%;transform:translateY(-50%);visibility:visible;width:5px}._link_7U9wl{text-decoration:none;text-decoration:underline}._link__label_dHGGf{font-size:12px;position:relative;top:-4px}._image_KmBM8{display:inline-flex}._code__line_m3IiO{padding:5px;position:relative}._code__button_WwYE-{background-color:transparent;border:none;border-radius:4px;box-shadow:none;cursor:pointer;min-width:30px;outline:none;padding:4px 10px;position:absolute;right:5px;top:5px;transition:all .3s ease;z-index:1}._code__button_WwYE-._pending_fgHgD:before{animation:_loading-btn--fade-in_8z5an .33s ease,_loading-btn--rotation_QaopN .66s linear 0s infinite;border:2px solid hsla(0,0%,100%,.33);border-radius:50%;border-top-color:#000;content:\"\";display:inline-block;height:10.5px;left:50%;position:absolute;top:50%;width:10.5px}._code__button_WwYE-._success_kUPnO:after{animation:_loading-btn--fade-in_8z5an .6s ease;border-color:currentcolor;border-style:solid;border-width:0 0 1px 1px;content:\"\";display:inline-block;height:7px;left:50%;position:absolute;top:50%;transform:translate(-50%,-75%) rotate(-45deg);width:11px}._code__button_WwYE-._fail_cOpap:after,._code__button_WwYE-._fail_cOpap:before{content:\" \";height:13px;left:50%;position:absolute;top:50%;width:1px}._code__button_WwYE-._fail_cOpap:before{transform:translate(-50%,-50%) rotate(45deg)}._code__button_WwYE-._fail_cOpap:after{transform:translate(-50%,-50%) rotate(-45deg)}@keyframes _loading-btn--fade-in_8z5an{0%{opacity:0}to{opacity:1}}@keyframes _loading-btn--rotation_QaopN{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}._code__span_iSCmj{opacity:1;transition:opacity .3s ease}._code__span_iSCmj._hide_uqpax{opacity:0}._code__block_JehA4{padding:1px 5px}._code__block_line_U7lcQ{border-left:1px solid;margin-left:5px}._horizontal_J1jU-{border-bottom:1px solid;margin:0 5px;position:relative;width:calc(100% - 10px)}._todo_m6MIP{align-items:flex-end;display:inline-flex;height:100%;padding-left:3px;padding-right:3px}._todo_m6MIP>input{margin:0}._todo__checked_kemjy{text-decoration:line-through}._mention_cpzik{font-weight:700}";
762
+ const styles = {"header":"_header_XFwV5","level_1":"_level_1_-KPph","level_2":"_level_2_ecHlB","level_3":"_level_3_SYcVr","level_4":"_level_4_V3o5m","level_5":"_level_5_I7eVk","level_6":"_level_6_A3lbK","bold":"_bold_I8DT-","italic":"_italic_72qBe","blockquote":"_blockquote_Xq6O4","blockquote__inner":"_blockquote__inner_mjT0h","blockquote__inner-deep":"_blockquote__inner-deep_s6tNj","strike-through":"_strike-through_U64jP","list":"_list_MHIjT","common":"_common_0GdDi","link":"_link_7U9wl","link__label":"_link__label_dHGGf","image":"_image_KmBM8","code__line":"_code__line_m3IiO","code__button":"_code__button_WwYE-","pending":"_pending_fgHgD","loading-btn--fade-in":"_loading-btn--fade-in_8z5an","loading-btn--rotation":"_loading-btn--rotation_QaopN","success":"_success_kUPnO","fail":"_fail_cOpap","code__span":"_code__span_iSCmj","hide":"_hide_uqpax","code__block":"_code__block_JehA4","code__block_line":"_code__block_line_U7lcQ","horizontal":"_horizontal_J1jU-","todo":"_todo_m6MIP","todo__checked":"_todo__checked_kemjy","mention":"_mention_cpzik"};
758
763
  styleInject(css_248z);
759
764
 
760
765
  const NAME_OF_BLOCKQUOTE_MARK = "QuoteMark";
@@ -1047,7 +1052,7 @@ function getCodeSelectionDecorations({ decorations, node, view, forceActive, })
1047
1052
  }
1048
1053
  else {
1049
1054
  decorations.push(getMarkDecoration({
1050
- style: clsx(styles.code__single, CLASSES.code),
1055
+ style: clsx(CLASSES.code),
1051
1056
  range: [node.from, node.to],
1052
1057
  }));
1053
1058
  }
@@ -1210,6 +1215,7 @@ const CODE_OF_END_IMAGE_TEXT = 93; // ]
1210
1215
  const CODE_OF_START_IMAGE_URL = 40; // (
1211
1216
  const CODE_OF_END_IMAGE_URL = 41; // )
1212
1217
 
1218
+ /* eslint-disable max-params */
1213
1219
  const IMAGE_NODES = {};
1214
1220
  const INTERVAL_DELAY = 10000;
1215
1221
  const EXISTING_WIDGETS = new Set();
@@ -1362,7 +1368,7 @@ function isCorrectNode$1(text, link, node) {
1362
1368
  textContent.includes(text));
1363
1369
  }
1364
1370
  function selectLink$1({ link, node, selection, start }) {
1365
- const startPosition = start ?? (node.textContent?.indexOf?.(link) || 0);
1371
+ const startPosition = start ?? node.textContent?.indexOf?.(link) ?? 0;
1366
1372
  const endPosition = startPosition + link.length;
1367
1373
  if (startPosition === 0 && endPosition === 0) {
1368
1374
  const content = node.textContent;
@@ -1523,7 +1529,7 @@ function getItalicSelectionDecorations({ decorations, node, view, forceActive, s
1523
1529
  if (node.name !== NAME_OF_ITALIC) {
1524
1530
  return;
1525
1531
  }
1526
- if (checkIsSeveralEmphasis({ decorations, node, view, forceActive, settings })) {
1532
+ if (checkIsSeveralEmphasis({ node, view})) {
1527
1533
  return void splitEmphasis({ decorations, node, view, forceActive, settings });
1528
1534
  }
1529
1535
  let step = 1;
@@ -1606,6 +1612,7 @@ function getLinkLabelSelectionDecoration({ decorations, node, view, forceActive,
1606
1612
  }
1607
1613
  }
1608
1614
 
1615
+ /* eslint-disable max-params */
1609
1616
  const LINK_NODES = {};
1610
1617
  class LinkWidget extends view.WidgetType {
1611
1618
  text;
@@ -1662,7 +1669,9 @@ class LinkWidget extends view.WidgetType {
1662
1669
  anchor.clearListeners?.();
1663
1670
  const abortController = new AbortController();
1664
1671
  anchor.addEventListener("mousedown", (event) => handleClick(this.view, this.text, this.link, this.key, event), { signal: abortController.signal });
1665
- anchor.addEventListener("click", (e) => e.preventDefault(), { signal: abortController.signal });
1672
+ anchor.addEventListener("click", (event) => event.preventDefault(), {
1673
+ signal: abortController.signal,
1674
+ });
1666
1675
  anchor.clearListeners = () => {
1667
1676
  abortController.abort();
1668
1677
  };
@@ -1712,7 +1721,7 @@ function isCorrectNode(text, link, node) {
1712
1721
  textContent.includes(text));
1713
1722
  }
1714
1723
  function selectLink({ link, node, selection, start }) {
1715
- const startPosition = start ?? (node.textContent?.indexOf?.(link) || 0);
1724
+ const startPosition = start ?? node.textContent?.indexOf?.(link) ?? 0;
1716
1725
  const endPosition = startPosition + link.length;
1717
1726
  if (startPosition === 0 && endPosition === 0) {
1718
1727
  const content = node.textContent;
@@ -1815,7 +1824,7 @@ function getLinkSelectionDecorations({ decorations, node, view, forceActive, set
1815
1824
  urlCoordinates.to = pos;
1816
1825
  }
1817
1826
  if (urlCoordinates.from === -1 || urlCoordinates.to === -1)
1818
- return void getLinkLabelSelectionDecoration({ decorations, forceActive, node, view, settings });
1827
+ return void getLinkLabelSelectionDecoration({ decorations, forceActive, node, view});
1819
1828
  const text = content.substring(textCoordinates.from, textCoordinates.to);
1820
1829
  const url = content.substring(urlCoordinates.from, urlCoordinates.to);
1821
1830
  const openedLink = view.state.field(markdownState).openedLink;
@@ -1921,7 +1930,7 @@ function getListSelectionDecorations({ decorations, node, view, forceActive, })
1921
1930
  return;
1922
1931
  }
1923
1932
  const content = view.state.doc.sliceString(node.from, node.to);
1924
- const lastCodePoint = content.codePointAt(content.length - 1) || 0;
1933
+ const lastCodePoint = content.codePointAt(content.length - 1) ?? 0;
1925
1934
  if (!LIST_OF_LIST_MARKS.has(lastCodePoint) && CODE_OF_ORDERED_LIST_MARK !== lastCodePoint) {
1926
1935
  return;
1927
1936
  }
@@ -2061,7 +2070,7 @@ function getTodoSelectionDecoration({ decorations, node, view, forceActive, }) {
2061
2070
  const prevSibling = node.node.prevSibling;
2062
2071
  if (!prevSibling || prevSibling.name !== NAME_OF_LIST_MARK)
2063
2072
  return;
2064
- const isChecked = LIST_OF_TODO_MARKS.has(view.state.doc.sliceString(node.from + 1, node.from + 2).codePointAt(0) || 0);
2073
+ const isChecked = LIST_OF_TODO_MARKS.has(view.state.doc.sliceString(node.from + 1, node.from + 2).codePointAt(0) ?? 0);
2065
2074
  if (forceActive ||
2066
2075
  !view.hasFocus ||
2067
2076
  !isInRange(view.state.selection.ranges, [prevSibling.from, node.from + 3])) {
@@ -2143,10 +2152,10 @@ function createDecorationsGetter(settings) {
2143
2152
  return;
2144
2153
  /** Decoration by change content */
2145
2154
  if (processDecorations)
2146
- decorationFunctions.forEach((f) => f({ decorations, node, view: view$1, settings }));
2155
+ decorationFunctions.forEach((funk) => funk({ decorations, node, view: view$1, settings }));
2147
2156
  /** Decoration by selection content */
2148
2157
  if (processSelectionDecorations)
2149
- selectionDecorationFunctions.forEach((f) => f({
2158
+ selectionDecorationFunctions.forEach((funk) => funk({
2150
2159
  decorations: selectionDecorations,
2151
2160
  node,
2152
2161
  view: view$1,
@@ -2207,7 +2216,7 @@ const markdownDecorationPlugin = (settings) => {
2207
2216
  });
2208
2217
  };
2209
2218
 
2210
- async function InitSettings({ readonly, vimMode, }) {
2219
+ async function initSettings({ readonly, vimMode, }) {
2211
2220
  let vimExtension = [];
2212
2221
  if (vimMode) {
2213
2222
  const { vim } = await import('@replit/codemirror-vim');
@@ -2223,7 +2232,7 @@ async function InitSettings({ readonly, vimMode, }) {
2223
2232
  const initExtensions = async ({ onBlur, onChange, onFocus, onEnter, onEscape, readonly = true, vimMode = false, multiCursorText, provider, theme = "light", dark, light, languages, keyMaps, defaultKeyMaps, imageSrcGetter, autoCompleteTagOptions, autoCompleteConfig, }) => {
2224
2233
  const multiCursorMode = Boolean(multiCursorText && provider);
2225
2234
  const asyncPlugins = await Promise.all([
2226
- InitSettings({ readonly, vimMode }),
2235
+ initSettings({ readonly, vimMode }),
2227
2236
  initKeyMaps({
2228
2237
  onEnter,
2229
2238
  onEscape,
@@ -2236,7 +2245,7 @@ const initExtensions = async ({ onBlur, onChange, onFocus, onEnter, onEscape, re
2236
2245
  light,
2237
2246
  }),
2238
2247
  new Promise((resolve) => {
2239
- void Promise.resolve().then(() => require('./index-CXENq_0E.js')).then(({ initMarkdown }) => {
2248
+ void Promise.resolve().then(() => require('./index-s-eevZJW.js')).then(({ initMarkdown }) => {
2240
2249
  resolve(initMarkdown({ languages, imageSrcGetter }));
2241
2250
  });
2242
2251
  }),
@@ -2261,8 +2270,7 @@ async function initEditorProvider({ roomId, url, userName = "Anonymous", userCol
2261
2270
  const { WebsocketProvider } = await import('y-websocket');
2262
2271
  const multiCursorDocument = new Doc();
2263
2272
  const multiCursorText = multiCursorDocument.getText(roomId);
2264
- if (!userColor || !userColor.startsWith("#")) {
2265
- // eslint-disable-next-line no-console
2273
+ if (!userColor?.startsWith?.("#")) {
2266
2274
  console.warn("user color must be hex!");
2267
2275
  userColor = "#30bced";
2268
2276
  }
@@ -2277,7 +2285,7 @@ async function initEditorProvider({ roomId, url, userName = "Anonymous", userCol
2277
2285
  provider.on("status", (event) => {
2278
2286
  onStartProvider(event?.status);
2279
2287
  });
2280
- if (provider && multiCursorText)
2288
+ if (provider)
2281
2289
  provider.on("sync", (isSynced) => {
2282
2290
  if (isSynced && !multiCursorText.length && initialText) {
2283
2291
  multiCursorText.insert(0, initialText);
@@ -2305,7 +2313,7 @@ async function initEditor({ multiCursor, root, initialText, ...rest }) {
2305
2313
  }
2306
2314
  const state = await initEditorState({
2307
2315
  ...rest,
2308
- text: initialText || "",
2316
+ text: initialText ?? "",
2309
2317
  provider,
2310
2318
  multiCursorText,
2311
2319
  });
@@ -2391,14 +2399,10 @@ class Editor {
2391
2399
  effects: ThemeCompartment.reconfigure(theme === "dark"
2392
2400
  ? getDarkTheme({
2393
2401
  dark: this.arguments.dark,
2394
- light: this.arguments.light,
2395
- theme,
2396
- })
2402
+ light: this.arguments.light})
2397
2403
  : getLightTheme({
2398
2404
  dark: this.arguments.dark,
2399
- light: this.arguments.light,
2400
- theme,
2401
- })),
2405
+ light: this.arguments.light})),
2402
2406
  });
2403
2407
  });
2404
2408
  };
@@ -2439,4 +2443,4 @@ exports.Editor = Editor;
2439
2443
  exports.NAME_OF_MENTION = NAME_OF_MENTION;
2440
2444
  exports.markdownDecorationPlugin = markdownDecorationPlugin;
2441
2445
  exports.markdownState = markdownState;
2442
- //# sourceMappingURL=index-Dj0jRUGF.js.map
2446
+ //# sourceMappingURL=index-BZIT2oN2.js.map